Search completed in 1.03 seconds.
7857 results for "low":
Your results are loading. Please wait...
Flow Layout and Overflow - CSS: Cascading Style Sheets
when there is more content than can fit into a container, an overflow situation occurs.
... understanding how overflow behaves is important in dealing with any element with a constrained size in css.
... this guide explains how overflow works when working with normal flow.
...And 26 more matches
In Flow and Out of Flow - CSS: Cascading Style Sheets
in the previous guide i explained block and inline layout in normal flow.
... all elements that are in flow, will be laid out using this method.
... in the following example i have a heading, paragraph, a list and a final paragraph which contains a strong element.
...And 18 more matches
Reason: Multiple CORS header 'Access-Control-Allow-Origin' not allowed - HTTP
reason reason: multiple cors header ‘access-control-allow-origin’ not allowed what went wrong?
... more than one access-control-allow-origin header was sent by the server.
... this isn't allowed.
... if you have access to the server you can change your implementation to echo back an origin in the access-control-allow-origin header.
Notes on HTML Reflow - Archive of obsolete content
overview reflow is the process by which the geometry of the layout engine's formatting objects are computed.
...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 are earlier "in the flow", so layout can proceed left-to-right, top-to-bottom through the document.
...And 67 more matches
Table Reflow Internals - Archive of obsolete content
overview review of reflow table frames table reflow intro to paginated reflow table paginated reflow review of reflow reflow process starts when an html document starts loading (the frame tree contains only viewport, scroll(s), canvas, html, body).
...the container posts a dirty reflow command with itself as the target.
...the container posts a dirty reflow command with itself as the target.
...And 50 more matches
Overflowing content - Learn web development
previous overview: building blocks next overflow is what happens when there is too much content to fit in a container.
... in this guide you will learn what overflow is and how to manage it.
... prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to understand overflow and how to manage it.
...And 40 more matches
Debugging Frame Reflow
general overview the frame reflow can be logged with the debug capabilities implemented in nsframe.cpp.
... it provides the following information for each frame at the start of its reflow reflow reason available width, available height computed width, computed height the previous and the next frame in flow and a count number.
... when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max.
...And 21 more matches
overflow - CSS: Cascading Style Sheets
WebCSSoverflow
the overflow css shorthand property sets the desired behavior for an element's overflow — i.e.
... constituent properties this property is a shorthand for the following css properties: overflow-x overflow-y syntax /* keyword values */ overflow: visible; overflow: hidden; overflow: clip; overflow: scroll; overflow: auto; overflow: hidden visible; /* global values */ overflow: inherit; overflow: initial; overflow: unset; the overflow property is specified as one or two keywords chosen from the list of values below.
... if two keywords are specified, the first applies to overflow-x and the second to overflow-y.
...And 18 more matches
text-overflow - CSS: Cascading Style Sheets
the text-overflow css property sets how hidden overflow content is signaled to users.
... 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.
...And 15 more matches
Control flow and error handling - JavaScript
« previousnext » javascript supports a compact set of statements, specifically control flow statements, that you can use to incorporate a great deal of interactivity in your application.
...the block is delimited by a pair of curly brackets: { statement_1; statement_2; ⋮ statement_n; } example block statements are commonly used with control flow statements (if, for, while).
... you can also compound the statements using else if to have multiple conditions tested in sequence, as follows: if (condition_1) { statement_1; } else if (condition_2) { statement_2; } else if (condition_n) { statement_n; } else { statement_last; } in the case of multiple conditions, only the first logical condition which evaluates to true will be executed.
...And 15 more matches
2015 MDN Fellowship Program - Archive of obsolete content
warning: the 2015 mdn fellowship program is closed.
...this page is a historical archive, originally hosted at /fellowship, and was localized.
... more information: mdn/developerfellowship wiki page.
...And 13 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
the css 2.1 specification, which details how normal flow behaves, assumes a horizontal writing mode.
...in this guide, we look at how flow layout behaves when used with different document writing modes.
... this is not a comprehensive guide to the use of writing modes in css, the aim here is to document the areas where flow layout interacts with writing modes in possibly unanticipated ways.
...And 12 more matches
Normal Flow - Learn web development
previous overview: css layout next this article explains normal flow, or the way that webpage elements lay themselves out if you have not changed their layout.
... as detailed in the last lesson introducing layout, elements on a webpage lay out in the normal flow, if you have not applied any css to change the way they behave.
... and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether.
...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.
...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.
...And 10 more matches
IDBKeyRange.lowerBound() - Web APIs
the lowerbound() method of the idbkeyrange interface creates a new key range with only a lower bound.
... by default, it includes the lower endpoint value and is closed.
... syntax var myidbkeyrange = idbkeyrange.lowerbound(lower); var myidbkeyrange = idbkeyrange.lowerbound(lower, open); parameters lower specifies the lower bound of the new key range.
...And 9 more matches
overflow-block - CSS: Cascading Style Sheets
the overflow-block css property sets what shows when content overflows the block start and block end edges of a box.
... this may be nothing, a scroll bar, or the overflow content.
... the overflow-block property maps to overflow-y or overflow-x depending on the writing mode of the document.
...And 9 more matches
overflow-y - CSS: Cascading Style Sheets
the overflow-y css property sets what shows when content overflows a block-level element's top and bottom edges.
... this may be nothing, a scroll bar, or the overflow content.
... syntax /* keyword values */ overflow-y: visible; overflow-y: hidden; overflow-y: clip; overflow-y: scroll; overflow-y: auto; /* global values */ overflow-y: inherit; overflow-y: initial; overflow-y: unset; the overflow-y property is specified as a single keyword chosen from the list of values below.
...And 9 more matches
DataTransfer.effectAllowed - Web APIs
the datatransfer.effectallowed property specifies the effect that is allowed for a drag operation.
...within the dragenter and dragover event handlers, this property will be set to whatever value was assigned during the dragstart event, thus effectallowed may be used to determine which effect is permitted.
... assigning a value to effectallowed in events other than dragstart has no effect.
...And 8 more matches
-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.
... 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.
...And 7 more matches
Debugging Table Reflow
reflow the most efficient tool to claim that html-table code is the victim and not the source of layout bugs is a frame reflow debug log.
... block reflow another way to debug the reflow process is implemented inside 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.
...And 7 more matches
IDBKeyRange.lowerOpen - Web APIs
the loweropen read-only property of the idbkeyrange interface returns a boolean indicating whether the lower-bound value is included in the key range.
... syntax var loweropen = mykeyrange.loweropen value a boolean: value indication true the lower-bound value is not included in the key range.
... false the lower-bound value is included in the key range.
...And 7 more matches
msRegionOverflow - Web APIs
the msregionoverflow read-only property determines if content fully fits into the region or not.
... syntax string = object.msregionoverflow values type:domstring overflow: the region element's content overflows the region's content box.
... note that the region's overflow property value can be used to control the visibility of the overflowing content.
...And 7 more matches
CSS Overflow - CSS: Cascading Style Sheets
the css overflow module contains the features of css relating to scrollable overflow handling in visual media.
... in css overflow happens when the content 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.
...And 7 more matches
overflow-wrap - CSS: Cascading Style Sheets
the overflow-wrap css property applies to inline elements, setting whether the browser should insert line breaks within an otherwise unbreakable string to prevent text from overflowing its line box.
... note: in contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing.
...it has since been renamed to overflow-wrap, with word-wrap being an alias.
...And 7 more matches
Test your skills: Overflow - Learn web development
the aim of these tasks is to help you check your understanding of overflow in css.
... 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.
... task one the content is overflowing the box because it has a fixed height.
...And 6 more matches
Following the Android Toasts Tutorial from a JNI Perspective
this article is a work in progress and is based on githubgist :: _ff-addon-tutorial-jniandroidtoast.js this article will follow the android developers :: api guides - toasts tutorial.
... java code let's start with the following java code, which invokes a toast and says "hello, firefox!".
...the java code example above can be done with privileged javascript from firefox for android with the following code: window.nativewindow.toast.show("hello, firefox!", "short"); converting java to jni.jsm the first step is to look at the java code and see all the different types, methods, constructors, and fields that are being used.
...And 6 more matches
Handling Overflow in Multicol - CSS: Cascading Style Sheets
in this guide we look at how multicol deals with overflow, both inside the column boxes and in situations where there is more content than will fit into the container.
... overflow inside column boxes an overflow situation happens when an item's size is larger than the column box.
... in this situation, the content should visibly overflow into the next column, rather than be clipped by the column box.
...And 6 more matches
overflow-x - CSS: Cascading Style Sheets
the overflow-x css property sets what shows when content overflows a block-level element's left and right edges.
... this may be nothing, a scroll bar, or the overflow content.
... syntax /* keyword values */ overflow-x: visible; overflow-x: hidden; overflow-x: clip; overflow-x: scroll; overflow-x: auto; /* global values */ overflow-x: inherit; overflow-x: initial; overflow-x: unset; the overflow-x property is specified as a single keyword chosen from the list of values below.
...And 6 more matches
overflow - SVG: Scalable Vector Graphics
the overflow attribute sets what to do when an element's content is too big to fit in its block formatting context.
... it has the same parameter values and meaning as the css overflow property, however, the following additional points apply: if it has a value of visible, the attribute has no effect (i.e., a clipping rectangle is not created).
... if the overflow property has the value hidden or scroll, a clip of the exact size of the svg viewport is applied.
...And 6 more matches
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
tcp slow start helps buildup transmission speeds to the network's capabilities.
...tcp slow start is an algorithm used to detect the available bandwidth for packet transmission, and balances the speed of a network connection.
... it prevents the appearance of network congestion whose capabilities are initially unknown, and slowly increases the volume of information diffused until the network's maximum capacity is found.
...And 5 more matches
IDBKeyRange.lower - Web APIs
WebAPIIDBKeyRangelower
the lower read-only property of the idbkeyrange interface returns the lower bound of the key range.
... syntax var lower = mykeyrange.lower value the lower bound of the key range (can be any type.) example the following example illustrates how you'd use a key range.
... here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true).
...And 5 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.
...And 5 more matches
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
reason reason: cors header 'access-control-allow-origin' missing what went wrong?
... the response to the cors request is missing the required access-control-allow-origin header, which is used to determine whether or not the resource can be accessed by content operating within the current origin.
... if the server is under your control, add the origin of the requesting site to the set of domains permitted access by adding it to the access-control-allow-origin header's value.
...And 5 more matches
Access-Control-Allow-Headers - HTTP
the access-control-allow-headers response header is used in response to a preflight request which includes the access-control-request-headers to indicate which http headers can be used during the actual request.
... header type response header forbidden header name no syntax access-control-allow-headers: <header-name>[, <header-name>]* access-control-allow-headers: * directives <header-name> the name of a supported request header.
... examples a custom header here's an example of what an access-control-allow-headers header might look like.
...And 5 more matches
String.prototype.toLocaleLowerCase() - JavaScript
the tolocalelowercase() method returns the calling string value converted to lower case, according to any locale-specific case mappings.
... syntax str.tolocalelowercase() str.tolocalelowercase(locale) str.tolocalelowercase([locale, locale, ...]) parameters locale optional the locale parameter indicates the locale to be used to convert to lower case according to any locale-specific case mappings.
... return value a new string representing the calling string converted to lower case, according to any locale-specific case mappings.
...And 5 more matches
allowevents - Archive of obsolete content
« xul reference home allowevents type: boolean if true, events are passed to children of the element.
...by setting the allowevents attribute to true, this special behavior is disabled, and the events are targeted the same as other elements.
...however, the allowevents attribute is handled in a different way.
...And 4 more matches
HTMLImageElement.lowSrc - Web APIs
the htmlimageelement interface's obsolete lowsrc property can be used to specify the url of a reduced-quality or otherwise faster-loading version of the image specified by the src property.
... this property reflects the html lowsrc attribute.
... syntax htmlimageelement.lowsrc = imageurl; imageurl = htmlimageelement.lowsrc; value a domstring specifying the url of a version of the image specified by src which has been modified in some fashion so that it loads significantly more quickly than the primary image.
...And 4 more matches
PublicKeyCredentialRequestOptions.allowCredentials - Web APIs
allowcredentials is an optional property of the publickeycredentialrequestoptions dictionary which indicates the existing credentials acceptable for retrieval.
...contrary to allowcredentials, it is used to filter out credentials.
... syntax allowcredentials = publickeycredentialrequestoptions.allowcredentials value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created.
...And 4 more matches
overflow-block - CSS: Cascading Style Sheets
the overflow-block css media feature can be used to test how the output device handles content that overflows the initial containing block along the block axis.
... syntax the overflow-block feature is specified as a keyword value chosen from the list below.
... none content that overflows the block axis is not displayed.
...And 4 more matches
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
html provides a crossorigin attribute for images that, in combination with an appropriate cors header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current origin.
... if the source of the foreign content is an html <img> or svg <svg> element, attempting to retrieve the contents of the canvas isn't allowed.
... calling any of the following on a tainted canvas will result in an error: calling getimagedata() on the canvas's context calling toblob() on the <canvas> element itself calling todataurl() on the canvas attempting any of these when the canvas is tainted will cause a securityerror to be thrown.
...And 4 more matches
Access-Control-Allow-Origin - HTTP
the access-control-allow-origin response header indicates whether the response can be shared with requesting code from the given origin.
... header type response header forbidden header name no syntax access-control-allow-origin: * access-control-allow-origin: <origin> access-control-allow-origin: null directives * for requests without credentials, the literal value "*" can be specified, as a wildcard; the value tells browsers to allow requesting code from any origin to access the resource.
... note: null should not be used: "it may seem safe to return access-control-allow-origin: "null", but the serialization of the origin of any resource that uses a non-hierarchical scheme (such as data: or file:) and sandboxed documents is defined to be "null".
...And 4 more matches
FeaturePolicy.allowedFeatures() - Web APIs
the allowedfeatures() method of the featurepolicy interface returns a list of directive names of all features allowed by the feature policy.enables introspection of individual directives of the feature policy it is run on.
... as such, allowedfeatures() method returns a subset of directives returned by features().
... syntax const allowed = featurepolicy.allowedfeatures() parameters none.
...And 3 more matches
FeaturePolicy.allowsFeature() - Web APIs
the allowsfeature() method of the featurepolicy interface enables introspection of individual directives of the feature policy it is run on.
... it returns a boolean that is true if and only if the specified feature is allowed in the specified context (or the default context if no context is specified).
... syntax const allowed = featurepolicy.allowsfeature(<feature>) or const allowed = featurepolicy.allowsfeature(<feature>, <origin>) parameters feature name a specific feature name must be specified.
...And 3 more matches
FeaturePolicy.getAllowlistForFeature() - Web APIs
the getallowlistforfeature() method of the featurepolicy allows query of the allow list for a specific feature for the current feature policy.
... syntax const allowlist = featurepolicy.getallowlistforfeature(<feature>) parameter feature name a specific feature name must be specified.
... return value an allow list for the specified feature.
...And 3 more matches
HTMLIFrameElement.allowPaymentRequest - Web APIs
the allowpaymentrequest property of the htmliframeelement interface returns a boolean indicating whether the payment request api may be invoked on a cross-origin iframe.
... syntax var allow = htmliframeelement.allowpaymentrequest value a boolean.
... specifications specification status comment payment request apithe definition of 'allowpaymentrequest' in that specification.
...And 3 more matches
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0.
... when the number of buffered outgoing bytes, as indicated by the bufferedamount property, falls to or below this value, a bufferedamountlow event is fired.
...listeners may be added with onbufferedamountlow or addeventlistener().
...And 3 more matches
RTCDataChannel: bufferedamountlow event - Web APIs
a bufferedamountlow event is sent to an rtcdatachannel when the number of bytes currently in the outbound data transfer buffer falls below the threshold specified in bufferedamountlowthreshold.
... bufferedamountlow events aren't sent if bufferedamountlowthreshold is 0.
... bubbles no cancelable no interface event event handler property onbufferedamountlow examples this example sets up a handler for bufferedamountlow to request more data any time the data channel's buffer falls below the number of bytes specified by bufferedamountlowthreshold, which we have set to 65536.
...And 3 more matches
ValidityState.rangeOverflow - Web APIs
the read-only rangeoverflow property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's max attribute.
... if the field is numeric in nature, including the date, month, week, time, datetime-local, number and range types and a max value is set, if the value don't doesn't conform to the constraints set by the max value, the rangeoverflow property will be true.
... given the following: <input type="number" min="20" max="40" step="2"/> if value > 40, rangeoverflow will be true.
...And 3 more matches
ValidityState.rangeUnderflow - Web APIs
the read-only rangeunderflow property of a validitystate object indicates if the value of an <input>, after having been edited by the user, does not conform to the constraints set by the element's min attribute.
... if the field is numeric in nature, including the date, month, week, time, datetime-local, number and range types and a min value is set, if the value don't doesn't conform to the constraints set by the min value, the rangeunderflow property will be true.
... given the following: <input type="number" min="20" max="40" step="2"/> if value < 20, rangeunderflow will be true.
...And 3 more matches
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.
...And 3 more matches
Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz' - HTTP
reason reason: cors header 'access-control-allow-origin' does not match 'xyz' what went wrong?
... simply put, the origin making the request does not match any of the origins permitted by the access-control-allow-origin header.
... this error can also occur if the response includes more than one access-control-allow-origin header.
...And 3 more matches
Access-Control-Allow-Credentials - HTTP
the access-control-allow-credentials response header tells browsers whether to expose the response to frontend javascript code when the request's credentials mode (request.credentials) is include.
... when a request's credentials mode (request.credentials) is include, browsers will only expose the response to frontend javascript code if the access-control-allow-credentials value is true.
... the access-control-allow-credentials header works in conjunction with the xmlhttprequest.withcredentials property or with the credentials option in the request() constructor of the fetch api.
...And 3 more matches
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
the control flow is the order in which the computer executes statements in a script.
... code is run in order from the first line in the file to the last line, unless the computer runs across the (extremely frequent) structures that change the control flow, such as conditionals and loops.
...as you can see, control structures can dictate complex flows of processing even with only a few lines of code.
...And 2 more matches
overflow-clip-box
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, but <input type="text"> and similar use the value content-box.
...And 2 more matches
RTCDataChannel.onbufferedamountlow - Web APIs
the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel.
... this event, which is represented by a simple event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedamountlowthreshold.
... syntax rtcdatachannel.onbufferedamountlow = function; value a function which the browser will call to handle the bufferedamountlow event.
...And 2 more matches
overflow-inline - CSS: Cascading Style Sheets
the overflow-inline css media feature can be used to test how the output device handles content that overflows the initial containing block along the inline axis.
... syntax the overflow-inline feature is specified as a keyword value chosen from the list below.
... none content that overflows the inline axis is not displayed.
...And 2 more matches
grid-auto-flow - CSS: Cascading Style Sheets
the grid-auto-flow css property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid.
... syntax /* keyword values */ grid-auto-flow: row; grid-auto-flow: column; grid-auto-flow: dense; grid-auto-flow: row dense; grid-auto-flow: column dense; /* global values */ grid-auto-flow: inherit; grid-auto-flow: initial; grid-auto-flow: unset; this property may take one of two forms: a single keyword: one of row, column, or dense.
...mal definition initial valuerowapplies togrid containersinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ row | column ] | dense examples setting grid auto-placement html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> <div id="item4"></div> <div id="item5"></div> </div> <select id="direction" onchange="changegridautoflow()"> <option value="column">column</option> <option value="row">row</option> </select> <input id="dense" type="checkbox" onchange="changegridautoflow()"> <label for="dense">dense</label> css #grid { height: 200px; width: 200px; display: grid; grid-gap: 10px; grid-template: repeat(4, 1fr) / repeat(2, 1fr); grid-auto-flow: column; /* or 'row', 'row dense', 'column dense' */ } #i...
...And 2 more matches
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).
...And 2 more matches
Allow - HTTP
WebHTTPHeadersAllow
the allow header lists the set of methods supported by a resource.
... this header must be sent if the server responds with a 405 method not allowed status code to indicate which request methods can be used.
... an empty allow header indicates that the resource allows no request methods, which might occur temporarily for a given resource, for example.
...And 2 more matches
SyntaxError: "use strict" not allowed in function with non-simple parameters - JavaScript
the javascript exception "'use strict' not allowed in function" occurs when a "use strict" directive is used at the top of a function with default parameters, rest parameters, or destructuring parameters.
... message edge: cannot apply strict mode on functions with non-simple parameter list firefox: syntaxerror: "use strict" not allowed in function with default parameter syntaxerror: "use strict" not allowed in function with rest parameter syntaxerror: "use strict" not allowed in function with destructuring parameter chrome: syntaxerror: illegal 'use strict' directive in function with non-simple parameter list error type syntaxerror.
... a "use strict" directive is written at the top of a function that has one of the following parameters: default parameters rest parameters destructuring parameters a "use strict" directive is not allowed at the top of such functions per the ecmascript specification.
...And 2 more matches
String.prototype.toLowerCase() - JavaScript
the tolowercase() method returns the calling string value converted to lower case.
... syntax str.tolowercase() return value a new string representing the calling string converted to lower case.
... description the tolowercase() method returns the value of the string converted to lower case.
...And 2 more matches
Low-Level APIs - Archive of obsolete content
modules in this section implement low-level apis.
... privileged modules that expose powerful low-level capabilities such as window/utils and net/xhr.
... chrome the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis.
... event/core the event/core module allows the creation of apis to broadcast and subscribe to events.
-ms-overflow-style - Archive of obsolete content
the -ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows.
... 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-autohiding-scrollbar auto-hiding scrollbars are used if the element's content overflows.
overflow-clip-box-block
the overflow-clip-box-block css property specifies relative to which box the clipping happens when there is an overflow — in the block direction.
... /* keyword values */ overflow-clip-box-block: padding-box; overflow-clip-box-block: content-box; /* global values */ overflow-clip-box-block: inherited; overflow-clip-box-block: initial; overflow-clip-box-block: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
... examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overflow-clip-box-block: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistener...
...("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, should appear in css overflow module level 3.
overflow-clip-box-inline
the overflow-clip-box-inline css property specifies relative to which box the clipping happens when there is an overflow — in the inline direction.
... /* keyword values */ overflow-clip-box-inline: padding-box; overflow-clip-box-inline: content-box; /* global values */ overflow-clip-box-inline: inherited; overflow-clip-box-inline: initial; overflow-clip-box-inline: unset; note: on gecko, by default, padding-box is used everywhere, but <input type="text"> and similar use the value content-box.
... examples padding-box html <div class="things"> <input value="abcdefghijklmnopqrstuvwxyzÅÄÖ" class="scroll padding-box"> <div class="scroll padding-box"><span>abcdefghijklmnopqrstuvwxyzÅÄÖ</span></div> </div> css .scroll { overflow: auto; padding: 0 30px; width: 6em; border: 1px solid black; background: lime content-box; } .padding-box { overflow-clip-box-inline: padding-box; } javascript function scrollsomeelements() { var elms = document.queryselectorall('.scroll'); for (i=0; i < elms.length; ++i) { elms[i].scrollleft=80; } } var elt = document.queryelementsbytagname('body')[0]; elt.addeventlistene...
...r("load", scrollsomeelements, false); result specifications this property has been proposed to the w3c csswg; it is not yet on the standard track but, if accepted, should appear in css overflow module level 3.
Element: underflow event - Web APIs
the non-standard underflow event, which is specific to firefox, is fired when an element is no longer overflowed by its content.
... this only works for elements for which overflow is not set to visible.
... the counterpart overflow event is fired when overflow occurs.
... bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log( event ); }, false); wrapper.addeventlistener("underflow"...
x-ms-aria-flowfrom - Accessibility
the x-ms-aria-flowfrom property specifies the id of the previous element in an alternative reading order, allowing assistive technology to override the general default of reading in document source order.
... the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property.
... syntax x-ms-aria-flowfrom="elementid"; value the x-ms-aria-flowfrom property value uses an id selector to define which previous element the reading order will flow from.
... example <div tabindex="0" class="foo" id="element2" role="option" aria-posinset="1" aria-setsize="15" aria-flowto="element8" x-ms-aria-flowfrom="element5"> see also aria relationship attributes microsoft api extensions ...
overflow-anchor - CSS: Cascading Style Sheets
the overflow-anchor css property provides a way to opt out of the browser's scroll anchoring behavior, which adjusts scroll position to minimize content shifts.
... syntax /* keyword values */ overflow-anchor: auto; overflow-anchor: none; /* global values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position.
... formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | none examples prevent scroll anchoring to prevent scroll anchoring in a document, use the overflow-anchor property.
... body { overflow-anchor: none; } specifications specification status comment css scroll anchoring module level 1the definition of 'overflow-anchor' in that specification.
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ - HTTP
reason reason: invalid token ‘xyz’ in cors header ‘access-control-allow-headers’ 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.
... 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.
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Methods’ - HTTP
reason reason: invalid token ‘xyz’ 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.
... 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.
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.
... for example, if the response includes: access-control-allow-methods: get,head,post trying to use a put request will fail with this error.
... note: if the server includes any unrecognized or undefined method names in its access-control-allow-methods header, a different error occurs: reason: invalid token ‘xyz' in cors header ‘access-control-allow-methods’.
Access-Control-Allow-Methods - HTTP
the access-control-allow-methods response header specifies the method or methods allowed when accessing the resource in response to a preflight request.
... header type response header forbidden header name no syntax access-control-allow-methods: <method>, <method>, ...
... access-control-allow-methods: * directives <method> comma-delimited list of the allowed http request methods.
... examples access-control-allow-methods: post, get, options access-control-allow-methods: * specifications specification status comment fetchthe definition of 'access-control-allow-methods' in that specification.
JSSecurityCallbacks.contentSecurityPolicyAllows
the jssecuritycallbacks.contentsecuritypolicyallows callback is called when a script attempts to access an object property.
... description check whether runtime code generation is allowed for the current global.
... jssecuritycallbacks.contentsecuritypolicyallows is invoked once per global object upon the first attempt to evaluate js code from a string (either through eval or the function constructor).
Element: overflow event - Web APIs
the overflow event is fired when an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible).
... bubbles yes cancelable yes interface uievent event handler property unknown examples <div id="wrapper"> <div id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getelementbyid("wrapper"), child = document.getelementbyid("child"), toggle = document.getelementbyid("toggle"); wrapper.addeventlistener("overflow", function( event ) { console.log( event...
... ); }, false); wrapper.addeventlistener("underflow", function( event ) { console.log( event ); }, false); toggle.addeventlistener("change", function( event ) { if ( event.target.checked ) { child.style.width = "40px"; child.style.height = "40px"; } else { child.style.width = "10px"; child.style.height = "10px"; } }, false); </script> specifications not part of any specification.
flex-flow - CSS: Cascading Style Sheets
WebCSSflex-flow
the flex-flow css shorthand property specifies the direction of a flex container, as well as its wrapping behavior.
... constituent properties this property is a shorthand for the following css properties: flex-direction flex-wrap syntax /* flex-flow: <'flex-direction'> */ flex-flow: row; flex-flow: row-reverse; flex-flow: column; flex-flow: column-reverse; /* flex-flow: <'flex-wrap'> */ flex-flow: nowrap; flex-flow: wrap; flex-flow: wrap-reverse; /* flex-flow: <'flex-direction'> and <'flex-wrap'> */ flex-flow: row nowrap; flex-flow: column wrap; flex-flow: column-reverse wrap-reverse; /* global values */ flex-flow: inherit; flex-flow: initial; flex-flow: unset; values se...
...flex items are laid out in multiple lines */ flex-flow: column-reverse wrap; } specifications specification status comment css flexible box layout modulethe definition of 'flex-flow' in that specification.
math:lowest() - EXSLT
WebEXSLTmathlowest
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes math:lowest() returns the node in the specified node-set with the lowest value (where the lowest value calculated using math:min()).
... syntax math:lowest(nodeset) parameters nodeset the node-set whose lowest value is to be returned.
... specifications exslt - math:lowest ...
Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’ - HTTP
reason reason: expected ‘true’ in cors header ‘access-control-allow-credentials’ what went wrong?
... the cors request requires that the server permit the use of credentials, but the server's access-control-allow-credentials header's value isn't set to true to enable their use.
... to eliminate this error by changing the server's configuration, adjust the server's configuration to set the access-control-allow-credentials header's value to true.
Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’ - HTTP
reason reason: credential is not supported if the cors header ‘access-control-allow-origin’ is ‘*’ what went wrong?
... the cors request was attempted with the credentials flag set, but the server is configured using the wildcard ("*") as the value of access-control-allow-origin, which doesn't allow the use of credentials.
... if, instead, you need to adjust the server's behavior, you'll need to change the value of access-control-allow-origin to grant access to the origin from which the client is loaded.
Timing-Allow-Origin - HTTP
the timing-allow-origin response header specifies origins 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.
... header type response header forbidden header name no syntax timing-allow-origin: * timing-allow-origin: <origin>[, <origin>]* directives * the server may specify "*" as a wildcard, thereby allowing any origin to see timing resources.
... examples to allow any resource to see timing resources: timing-allow-origin: * to allow https://developer.mozilla.org to see timing resources, you can specify: timing-allow-origin: https://developer.mozilla.org specifications specification status comment resource timing level 3the definition of 'timing-allow-origin' in that specification.
405 Method Not Allowed - HTTP
WebHTTPStatus405
the hypertext transfer protocol (http) 405 method not allowed response status code indicates that the request method is known by the server but is not supported by the target resource.
... the server must generate an allow header field in a 405 response containing a list of the target resource's currently supported methods.
... status 405 method not allowed specifications specification title rfc 7231, section 6.5.5: 405 method not allowed hypertext transfer protocol (http/1.1): semantics and content ...
allownegativeassertions - Archive of obsolete content
« xul reference home allownegativeassertions type: boolean valid on any element that has a datasources attribute.
...this attribute, if true, which is the default, allows a datasource to negate an earlier assertion.
::-ms-fill-lower - Archive of obsolete content
the ::-ms-fill-lower css pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by the thumb.
... allowable properties only the following css properties can be used in a rule with ::-ms-fill-lower in its selector.
Reflow - MDN Web Docs Glossary: Definitions of Web-related terms
reflow happens when a browser must process and draw part or all of a webpage again, such as after an update on an interactive site.
... learn more google article "minimizing browser reflow" ...
GetAccessibleBelow
« nsiaccessible page summary this method returns an accessible node geometrically below this one.
... nsiaccessible getaccessiblebelow(); return value returns an accessible node geometrically below this one.
-webkit-overflow-scrolling - CSS: Cascading Style Sheets
the -webkit-overflow-scrolling css property controls whether or not touch devices use momentum-based scrolling for a given element.
... </p> </div> css div { width: 100%; overflow: auto; } p { width: 200%; background: #f5f9fa; border: 2px solid #eaf2f4; padding: 10px; } .scroll-touch { -webkit-overflow-scrolling: touch; /* lets it scroll lazy */ } .scroll-auto { -webkit-overflow-scrolling: auto; /* stops scrolling immediately */ } results specifications not part of any standard.
Disabling interruptible reflow - Archive of obsolete content
add the following variables to your environment to disable gecko interruptible reflow: gecko_reflow_interrupt_mode=counter gecko_reflow_interrupt_frequency=1000000 gecko_reflow_interrupt_checks_to_skip=1000000 now start firefox within this environment.
allowEvents - Archive of obsolete content
« xul reference allowevents type: boolean gets and sets the value of the allowevents attribute.
-ms-flow-from - Archive of obsolete content
the -ms-flow-from css property is a microsoft extension that gets or sets a value identifying a region container in the document that accepts the content flow from the data source.
-ms-flow-into - Archive of obsolete content
the -ms-flow-into css property is a microsoft extension that gets or sets a value identifying an iframe container in the document that serves as the region's data source.
copyToFollowingLinks
this content is now available at nsifile.copytofollowinglinks().
copyToFollowingLinksNative
this content is now available at nsifile.copytofollowinglinksnative().
isLowMemory
this content is now available at nsimemory.islowmemory().
Reason: CORS request external redirect not allowed - HTTP
reason reason: cors request external redirect not allowed what went wrong?
following-sibling - XPath
the following-sibling axis indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
following - XPath
WebXPathAxesfollowing
the following axis indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes.
Index - Web APIs
WebAPIIndex
below is a list of all the apis and interfaces (object types) that you may be able to use while developing your web app or site.
... 2 angle_instanced_arrays api, reference, webgl, webgl extension the angle_instanced_arrays extension is part of the webgl api and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type.
... 6 abortcontroller api, abortcontroller, experimental, interface, reference the abortcontroller interface represents a controller object that allows you to abort one or more dom requests as and when desired.
...And 292 more matches
Index - Archive of obsolete content
3 2015 mdn fellowship program 2015, archive, fellowship no summary!
... 68 low-level apis no summary!
... 70 chrome the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis.
...And 170 more matches
Index
in order to allow interoperability between software and devices that perform cryptographic operations, nss conforms to a standard called pkcs#11.
... (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module.
...this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface.
...And 140 more matches
sslfnc.html
syntax #include "nss.h" secstatus nss_init(char *configdir); parameter this function has the following parameter: configdir a pointer to a string containing the pathname of the directory where the certificate, key, and security module databases reside.
... the policy flags for all cipher suites are turned off by default, disallowing all cipher suites.
...this may be helpful if you have an export license that permits more or fewer capabilities than those allowed by the other export policy functions.
...And 119 more matches
HTTP Index - HTTP
WebHTTPIndex
http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response.
...it relies on a few basic concepts like the notion of resources and uris, a simple structure of messages, and a client-server structure for the communication flow.
... 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.
...And 86 more matches
Index
MozillaTechXPCOMIndex
it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.
... 5 bundling multiple binary components binary xpcom components are sometimes required to implement low-level features for extensions.
... 50 javaxpcom embedding, java, javaxpcom, mozilla, xpcom, xpcom:language bindings javaxpcom allows for communication between java and xpcom, such that a java application can access xpcom objects, and xpcom can access any java class that implements an xpcom interface.
...And 80 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
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 systems.
...underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element).
... 40 breadcrumb accessibility, glossary, navigation, search, site map, breadcrumb a breadcrumb, or breadcrumb trail, is a navigational aid that is typically placed between a site's header and the main content, displaying either a hierarchy of the current page in relation to the the site's structure, from top level to current page, or a list of the links the user followed to get to the current page, in the order visited.
...And 63 more matches
Drawing graphics - Learn web development
this article provides an introduction to canvas, and further resources to allow you to learn more.
...the web still had no way to effectively create animations, games, 3d scenes, and other requirements commonly handled by lower level languages such as c++ or java.
... the situation started to improve when browsers began to support the <canvas> element and associated canvas api — apple invented it in around 2004, and other browsers followed by implementing it in the years that followed.
...And 51 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
in the following you will find a brief description how to do so; a more detailed one can be found under setting up an extension development environment.
...most extensions include only one skin package, but you can include multiple skin packages to allow the gui to change with different themes.
...chrome urls are structured as: chrome://%package name%/%package type%/%relative path to source file% for example, the chrome url for the firefox browser window is as follows: chrome://browser/content/browser.xul here, the package name is “browser”, the file “browser.xul”, and the type of the package is “content”.
...And 45 more matches
HTML documentation index - HTML: Hypertext Markup Language
WebHTMLIndex
2 allowing cross-origin use of images and canvas advanced, cors, canvas, html, image, reference, security, storage, data html provides a crossorigin attribute for images that, in combination with an appropriate cors header, allows images defined by the <img> element that are loaded from foreign origins to be used in a <canvas> as if they had been loaded from the current origin.
...classes allow css and javascript to select and access specific elements via the class selectors or functions like the dom method document.getelementsbyclassname.
...if so, the browser modifies its widget to allow editing.
...And 45 more matches
Python binding for NSS
for information on nss and nspr, see the following: network security services (nss).
...the design of python-nss follows these basic guiding principles: be a thin layer with almost a one-to-one mapping of nss/nspr calls to python methods and functions.
...the term pythonic means to follow accepted python paradigms and idoms in the python language and libraries.
...And 42 more matches
WebIDL bindings
adding webidl bindings to a class to add a webidl binding for interface myinterface to a class mozilla::dom::myinterface that's supposed to implement that interface, you need to do the following: if your interface doesn't inherit from any other interfaces, inherit from nswrappercache and hook up the class to the cycle collector so it will trace the wrapper cache properly.
...(this allows the return value to be implicitly converted to a parentobject instance by the compiler via one of that class's non-explicit constructors.) if many instances of myinterface are expected to be created quicky, the return value of getparentobject should itself inherit from nswrappercache for optimal performance.
... returning null from getparentobject is allowed in situations in which it's ok to associate the resulting object with a random global object for security purposes; this is not usually ok for things that are exposed to web content.
...And 41 more matches
Migrating from Firebug - Firefox Developer Tools
the following list aims to help firebug users to find their way into the developer tools.
...it shows log information associated with a web page and allows you to execute javascript expressions via its command line.
... server logs firebug extensions like firephp allow to log server-side messages to the firebug console.
...And 41 more matches
Block and Line Layout Cheat Sheet - Archive of obsolete content
objects this section presents some of the classes involved in block and line reflow, along with important members of each object that control reflow processing.
... ns_frame_in_reflow this bit is set when the frame is being actively being reflowed.
... by default it is set in willreflow(), and unset in didreflow().
...And 40 more matches
Index - HTTP
WebHTTPHeadersIndex
found 122 pages: # page tags and summary 1 http headers http, http header, networking, overview, reference http headers allow the client and the server to pass additional information with the request or the response.
... an http header consists of its case-insensitive name followed by a colon ':', then by its value (without line breaks).
...browsers usually don't set this header as the default value for each content type is usually correct and transmitting it would allow easier fingerprinting.
...And 40 more matches
Index - Archive of obsolete content
ArchiveMozillaXULIndex
elements with a lower flexgroup are flexed first.
... 14 allowevents xul attributes, xul reference no summary!
... 15 allownegativeassertions xul attributes, xul reference no summary!
...And 39 more matches
LiveConnect Overview - Archive of obsolete content
all javascript access to java takes place with these objects, which are summarized in the following table.
...for example, you can create a java string object and assign it to the javascript variable mystring by using the new operator with the java constructor, as follows: var mystring = new java.lang.string("hello world"); in the previous example, the variable mystring is a javaobject because it holds an instance of the java object string.
...these java methods are available in javascript as methods of the javaobject, and you can call them as follows: mystring.length(); // returns 11 static members can be called directly on the javaclass object.
...And 39 more matches
Performance best practices for Firefox front-end engineers
if you need more elevated privileges than a standard worker allows, consider using a chromeworker, which is a firefox-only api which lets you create workers with more elevated privileges.
... 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.
...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.
...And 38 more matches
Feature-Policy - HTTP
the http feature-policy header provides a mechanism to allow and deny the use of browser features in its own frame, and in content within any <iframe> elements in the document.
... header type response header forbidden header name yes syntax feature-policy: <directive> <allowlist> <directive> the feature policy directive to apply the allowlist to.
... see directives below for a list of the permitted directive names.
...And 37 more matches
Introduction to CSS layout - Learn web development
css page layout techniques allow us to take elements contained in a web page and control where they are positioned relative to their default position in normal layout flow, the other elements around them, their parent container, or the main viewport/window.
... the page layout techniques we'll be covering in more detail in this module are normal flow the display property flexbox grid floats positioning table layout multiple-column layout each technique has its uses, advantages, and disadvantages, and no technique is designed to be used in isolation.
... normal flow normal flow is how the browser lays out html pages by default when you do nothing to control page layout.
...And 36 more matches
Index - Learn web development
at, accessibility, article, beginner, css, codingscripting, html, javascript, learn, tools, users, assistive technology, keyboard, screan reader, screenreader this article should have given you a useful high-level overview of accessibility, shown you why it's important, and looked at how you can fit it into your workflow.
...it allows you to upload code repositories for storage in the git version control system.
... accessibility, beginner, html, learn, needscontent the following content describes specific features of html that can be used to make a web page more accessible to people with different disabilities.
...And 35 more matches
A first splash into JavaScript - Learn web development
example — guess the number game in this article we'll show you how to build up the simple game you can see below: top hidden code <!doctype html> <html> <head> <meta charset="utf-8"> <title>number guessing game</title> <style> html { font-family: sans-serif; } body { width: 50%; max-width: 800px; min-width: 480px; margin: 0 auto; } .lastresult { color: white; padding:...
...we'll tell you if your guess was too high or too low.</p> <div class="form"> <label for="guessfield">enter a guess: </label><input type="text" id="guessfield" class="guessfield"> <input type="submit" value="submit guess" class="guesssubmit"> </div> <div class="resultparas"> <p class="guesses"></p> <p class="lastresult"></p> <p class="loworhi"></p> </div> <script> // your javascript goes here let randomnumber = math.floor(math.random() * 100) + 1; const guesses = document.queryselector('.guesses'); const lastresult = document.queryselector('.lastresult'); co...
...nst loworhi = document.queryselector('.loworhi'); const guesssubmit = document.queryselector('.guesssubmit'); const guessfield = document.queryselector('.guessfield'); let guesscount = 1; let resetbutton; function checkguess() { let userguess = number(guessfield.value); if (guesscount === 1) { guesses.textcontent = 'previous guesses: '; } guesses.textcontent += userguess + ' '; if (userguess === randomnumber) { lastresult.textcontent = 'congratulations!
...And 35 more matches
Introduction to automated testing - Learn web development
commercial cross-browser testing apps like lambdatest, sauce labs, browserstack, and testingbot are based on selenium, but allow you to access their set up remotely using a simple interface, saving you the hassle of setting up your own testing system.
...we will look at this below as well.
...note that node comes with node package manager (npm), which allows you to easily install packages, share your own packages with others, and run useful scripts on your projects.
...And 35 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
WebHTTPCORS
for example, xmlhttprequest and the fetch api follow the same-origin policy.
...a “simple request” is one that meets all the following conditions: one of the allowed methods: get head post apart from the headers automatically set by the user agent (for example, connection, user-agent, or the other headers defined in the fetch spec as a “forbidden header name”), the only headers which are allowed to be manually set are those which the fetch spec defines as a “cors-safelisted request-header”, which are: ...
... accept accept-language content-language content-type (but note the additional requirements below) dpr downlink save-data viewport-width width the only allowed values for the content-type header are: application/x-www-form-urlencoded multipart/form-data text/plain no event listeners are registered on any xmlhttprequestupload object used in the request; these are accessed using the xmlhttprequest.upload property.
...And 35 more matches
Details of the object model - JavaScript
because of this different basis, it can be less apparent how javascript allows you to create hierarchies of objects and to have inheritance of properties and their values.
...in addition, any object can be associated as the prototype for another object, allowing the second object to share the first object's properties.
... javascript follows a similar model, but does not have a class definition separate from the constructor.
...And 35 more matches
SVG documentation index - SVG: Scalable Vector Graphics
WebSVGIndex
3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnicalreview, svg, types, data types svg makes use of a number of data types.
... 16 svg event attributes advanced, attribute, draft, landing, needsupdate, svg event attributes always have their name starting with "on" followed by the name of the event for which they are intended.
...for example, this allows alphabetic baselines in roman text to stay aligned across font size changes.
...And 35 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
the following code shows blocks designated for internet explorer: .
...for example, rather than: if (ismozilla || isie5) you would use: if (document.getelementbyid) this would allow other browsers that support that w3c standard method, such as opera or safari, to work without any changes.
... javascript also allows inline conditional statements, which can help with code readability: var foo = (condition) ?
...And 34 more matches
TypeScript support in Svelte - Learn web development
even if you are not planning to adopt it, this article will be useful for allowing you to learn what it has to offer and help you make your own decision.
...according to stackoverflow's 2019 developer survey it is the third most loved language, right behind rust and python.
... rich ide support: type information allows code editors and ides to offer features like code navigation, autocompletion, and smarter hints.
...And 33 more matches
Setting up your own test automation environment - Learn web development
different browsers require different drivers to allow webdriver to communicate with and control them.
... next, we need to install a framework to allow us to work with selenium from inside node.
...to install selenium-webdriver, run the following command, making sure you are inside your project folder: npm install selenium-webdriver note: it is still a good idea to follow these steps even if you previously installed selenium-webdriver and downloaded the browser drivers.
...And 33 more matches
Floats - Learn web development
the background of floats the float property was introduced to allow web developers to implement simple layouts involving an image floating inside a column of text, with the text wrapping around the left or right of it.
... floats have commonly been used to create entire web site layouts featuring multiple columns of information floated so they sit alongside one another (the default behavior would be for the columns to sit below one another, in the same order as they appear in the source).
...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.
...And 32 more matches
Positioning - Learn web development
previous overview: css layout next positioning allows you to take elements out of the normal document layout flow, and make them behave differently; for example sitting on top of one another, or always remaining in the same place inside the browser viewport.
... we'd like you to follow along with the exercises on your local computer, if possible — grab a copy of 0_basic-flow.html from our github repo (source code here) and use that as a starting point.
... introducing positioning the whole idea of positioning is to allow us to override the basic document flow behavior described above, to produce interesting effects.
...And 32 more matches
Web Replay
learn more web replay allows firefox content processes to record their behavior, replay it later, and rewind to earlier states.
... there are a few ways to start recording a tab: record current tab open the developer tools and click the button indicated below.
... save recording and replay on the same machine clicking the 'tools -> web developer -> web replay -> save recording' menu item when a recording tab is open will allow the entire recording to be saved to a file.
...And 32 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
introduction for a long time, the web platform has offered javascript programmers a number of functions that allow them to asynchronously execute code after a certain time interval has elapsed, and to repeatedly execute a block of code asynchronously until you tell it to stop.
...executes a specified block of code before the browser next repaints the display, allowing an animation to be run at a suitable framerate regardless of the environment it is being run in.
...in the following sections we will show you how they can be used.
...And 31 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
WebHTMLElementinput
the available types are as follows: type description basic examples spec button a push button with no default behavior displaying the value of the value attribute, empty by default.
... <input type="button" name="button" /> checkbox a check box allowing single values to be selected/deselected.
... <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.
...And 30 more matches
Web video codec guide - Web media technologies
common codecs the following video codecs are those which are most commonly used on the web.
...each codec provides a link to a section below which offers additional details about the codec, including specific capabilities and compatibility issues you may need to be aware of.
...additionally, in saturated portions of the image (that is, where colors are pure and intense, such as a bright, pure red [rgba(255, 0, 0, 1)]), color depths below 10 bits per component (10-bit color) allow banding, where gradients cannot be represented without visible stepping of the colors.
...And 30 more matches
Client-side form validation - Learn web development
if the information is correctly formatted, the application allows the data to be submitted to the server and (usually) saved in a database; if the information isn't correctly formatted, it gives the user an error message explaining what needs to be corrected, and lets them try again.
... pattern: specifies a regular expression that defines a pattern the entered data needs to follow.
... if the data entered in a form field follows all of the rules specified by the above attributes, it is considered valid.
...And 29 more matches
Client-side storage - Learn web development
it consists of javascript apis that allow you to store data on the client (i.e.
... new school: web storage and indexeddb the "easier" features we mentioned above are as follows: the web storage api provides a very simple syntax for storing and retrieving smaller, data items consisting of a name and a corresponding value.
... you'll learn more about these apis below.
...And 29 more matches
Starting WebLock
once you do this, the observer service implementing nsiobserverservice can notify your object of registered events by means of this interface, as in the figure below.
...xxx what is example 2?following example 2, you change the class definition to support the nsiobserver interface and change ns_impl_isupports1 so that the queryinterface implementation knows that the component also supports nsiobserver.
... the weblock class definition with support for startup observation is below.
...And 29 more matches
Componentizing our Svelte app - Learn web development
we'll componentize our app, then add more functionality to allow users to update existing components.
... eventually, we will split up our app into the following components: alert.svelte: a general notification box for communicating actions that have occurred.
... newtodo.svelte: the text input and button that allow you to enter a new todo item.
...And 28 more matches
Content type - SVG: Scalable Vector Graphics
when used in the value of a property in a stylesheet, an <angle> is defined as follows: angle ::= number (~"deg" | ~"grad" | ~"rad")?
...in presentation attributes for all properties, whether defined in svg1.1 or in css2, the angle identifier, if specified, must be in lower case.
... when angles are used in an svg attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")?
...And 28 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
we will also learn about the action directive, which will allow us to extend the functionality of html elements in a reusable and declarative way.
... the following new components will be developed throughout the course of this article: moreactions: displays the check all and remove completed buttons, and emits the corresponding events required to handle their functionality.
...put the following content into your moreactions.svelte file: <script> import { createeventdispatcher } from 'svelte' const dispatch = createeventdispatcher() let completed = true const checkall = () => { dispatch('checkall', completed) completed = !completed } const removecompleted = () => dispatch('removecompleted') </script> <div class="btn-group"> <button type="button" class="bt...
...And 27 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
choosing mozilla products allow us to use the same apps while running either windows or linux systems (i suspect mac osx would be fine too).
... file api that centralized preference file uses a javascript api that allows us to do what we need.
...// pref("general.config.obscure_value", 0); // for mcd .cfg files pref('general.config.filename', 'thunderbird.cfg'); // for mcd .cfg files it used to be in previous releases (up until 7.0) in /usr/lib/thunderbird-x.0/default/pref/autoconf.js the first pref just tells us that we won't encode the file (no more rotary 13 or 7 cf below), the second pref is the name of the file to be read: /usr/lib/thunderbird/thunderbird.cfg.
...And 26 more matches
Grammar and types - JavaScript
because javascript is case sensitive, letters include the characters "a" through "z" (uppercase) as well as "a" through "z" (lowercase).
...(see variable scope below.) you can also simply assign a value to a variable for example, x = 42.
... an attempt to access an undeclared variable results in a referenceerror exception being thrown: var a; console.log('the value of a is ' + a); // the value of a is undefined console.log('the value of b is ' + b); // the value of b is undefined var b; // this one may puzzle you until you read 'variable hoisting' below console.log('the value of c is ' + c); // uncaught referenceerror: c is not defined let x; console.log('the value of x is ' + x); // the value of x is undefined console.log('the value of y is ' + y); // uncaught referenceerror: y is not defined let y; you can use undefined to determine whether a variable has a value.
...And 26 more matches
JXON - Archive of obsolete content
the algorithms proposed here (see: #1, #2, #3, #4) will consider only the following types of nodes and their attributes: document (only as function argument), documentfragment (only as function argument), element, text (never as function argument), cdatasection (never as function argument), attr (never as function argument).
... in order to avoid conflicts, the representation of nodes and attributes names is case insensitive (always rendered in lower case), so objects' local property names set using javascript must always have some kind of capitalization (that is, at least one capital letter somewhere in their names), as you can see below.
... the following algorithms are somewhat based on the parker convention, version 0.4, which prescribes the transformation of tags names into object properties names and the recognition of the typeof of all the collected text content of each tag (plain text parsing); but with some differences (so, one can say that we follow a our convention).
...And 25 more matches
Using Feature Policy - HTTP
feature policy allows you to control which origins can use which features, both in the top-level page and in embedded frames.
... essentially, you write a policy, which is an allowed list of origins for each feature.
... for every feature controlled by feature policy, the feature is only enabled in the current document or frame if its origin matches the allowed list of origins.
...And 25 more matches
Functions - JavaScript
defining functions function declarations a function definition (also called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function.
... for example, the following code defines a simple function named square: function square(number) { return number * number; } the function square takes one parameter, called number.
...a non-primitive value, such as array or a user-defined object) as a parameter and the function changes the object's properties, that change is visible outside the function, as shown in the following example: function myfunc(theobject) { theobject.make = 'toyota'; } var mycar = {make: 'honda', model: 'accord', year: 1998}; var x, y; x = mycar.make; // x gets the value "honda" myfunc(mycar); y = mycar.make; // y gets the value "toyota" // (the make property was changed by the function) function expressions while the function declaration above is syntactically a stat...
...And 25 more matches
Understanding WebAssembly text format - WebAssembly
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 body is just a linear list of low-level instructions.
... signatures and parameters the signature is a sequence of parameter type declarations followed by a list of return type declarations.
...And 25 more matches
Space Manager High Level Design - Archive of obsolete content
overview 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.
...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.
...the primary classes that interact with the space manager are: nsblockreflowstate nsblockframe nsboxtoblockadaptor the general interaction model is to create a space manager for a block frame in the context of a reflow, and to associate it with the blockreflowstate so it is passed down to child frames' reflow methods.
...And 24 more matches
Legacy layout methods - Learn web development
this knowledge will be helpful to you if you need to create fallback code for browsers that do not support newer methods, in addition to allowing you to work on existing projects which use these types of systems.
...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.
...replace whatever is inside the body currently with the following: <h1>2 column layout example</h1> <div> <h2>first column</h2> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit.
...And 24 more matches
Introducing a complete toolchain - Learn web development
tools used in our toolchain in this article we're going to use the following tools and features: jsx, a react-related set of syntax extensions that allow you to do things like defining component structures inside javascript.
... you won't need to know react to follow this tutorial, but we've included this to give you an idea of how a non-native web language could be integrated into a toolchain.
... as mentioned previously, github is a source code repository service that adds community features such as issue tracking, following project releases and much more.
...And 24 more matches
Eclipse CDT
using this plugin will result in parts of the ui described below being hidden or disabled.
...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".
... usage tips below are some of the more useful user tips.
...And 24 more matches
CSS values and units - Learn web development
previous overview: building blocks next every property used in css has a value or set of values that are allowed for that property, and taking a look at any property page on mdn will help you understand the values that are valid for any particular property.
... in the following example we have set the color of our heading using a keyword, and the background using the rgb() function: h1 { color: black; background-color: rgb(197,93,161); } a value in css is a way to define a collection of allowable sub-values.
...the following are all classed as numeric: data type description <integer> an <integer> is a whole number such as 1024 or -55.
...And 23 more matches
Getting started with HTML - Learn web development
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.
...however, it is best practice to write all tags in lowercase for consistency, readability, and other reasons.
...And 23 more matches
Working with Svelte stores - Learn web development
we will also see how to develop our own custom store to persist the todo information to web storage, allowing our todos to persist over page reloads.
... a store is simply an object with a subscribe() method that allows interested parties to be notified whenever the store value changes, and an optional set() method that allows you to set new values for the store.
... give it the following content: import { writable } from 'svelte/store' export const alert = writable('welcome to the to-do list app!') note: stores can be defined and used outside of svelte components, so you can organize them in any way you please.
...And 23 more matches
Getting started with Vue - Learn web development
this allows you to create markup managed entirely by vue, which can improve developer experience and performance when dealing with complex applications.
... it also allows you to take advantage of libraries for client-side routing and state management when you need to.
...this allows you to select a different routing/state management library if they better fit your application.
...And 23 more matches
OS.File for the main thread
using os.file from a jsm to import os.file into your chrome code, add the following line at the start of your script: components.utils.import("resource://gre/modules/osfile.jsm") promises before using os.file from the main thread, you need some understanding of the promise library.
... example: read the contents of a file as text the following snippet opens a file "file.txt" and read its contents as a string, using the default encoding (utf-8).
... example: write a string to a file the following snippet writes the text "this is some text" to a string "file.txt", using the default encoding (utf-8).
...And 23 more matches
Drag Operations - Web APIs
the following describes the steps that occur during a drag and drop operation.
...an os-specific rendering of the selection will appear and follow the mouse pointer as the drag occurs.
... here is an example which allows a section of content to be dragged.
...And 23 more matches
Variable fonts guide - CSS: Cascading Style Sheets
this allows for common typographic techniques such as setting different size headings in different weights for better readability at each size, or using a slightly narrower width for data-dense displays.
...the reason for this is that most typefaces have very specific designs for bolder weights and italics that often include completely different characters (lower-case 'a' and 'g' are often quite different in italics, for example).
... introducing the 'variation axis' the heart of the new variable fonts format is the concept of an axis of variation describing the allowable range of that particular aspect of the typeface design.
...And 23 more matches
display - CSS: Cascading Style Sheets
WebCSSdisplay
the display css property sets whether an element is treated as a block or inline element and the layout used for its children, such as flow layout, grid or flex.
...the outer type sets an element's participation in flow layout; the inner type sets the layout of children.
...keyword values are grouped into six 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.
...And 23 more matches
filter - CSS: Cascading Style Sheets
WebCSSfilter
ilter: contrast(200%); filter: drop-shadow(16px 16px 20px blue); filter: grayscale(50%); filter: hue-rotate(90deg); filter: invert(75%); filter: opacity(25%); filter: saturate(30%); filter: sepia(60%); /* multiple filters */ filter: contrast(175%) brightness(3%); /* use no filter */ filter: none; /* global values */ filter: inherit; filter: initial; filter: unset; with a function, use the following: filter: <filter-function> [<filter-function>]* | none for a reference to an svg <filter> element, use the following: filter: url(file.svg#filter-element-id) interpolation if both the beginning and end filters have a function list of the same length without <url>, each of their filter functions is interpolated according to its specific rules.
... functions the filter property is specified as none or one or more of the functions listed below.
...tic example</th> </tr> </thead> <tbody> <tr> <td><img alt="test_form.jpg" id="img1" class="internal default" src="/files/3710/test_form_2.jpg" style="width: 100%;" /></td> <td><img alt="test_form.jpg" id="img2" class="internal default" src="/files/3710/test_form_2.jpg" style="width: 100%;" /></td> <td> <div class="svg-container"> <svg id="img3" overflow="visible" viewbox="0 0 212 161" color-interpolation-filters="srgb"> <filter id="svgblur" x="-5%" y="-5%" width="110%" height="110%"> <fegaussianblur in="sourcegraphic" stddeviation="3.5"/> </filter> <image xlink:href="/files/3710/test_form_2.jpeg" filter="url(#svgblur)" width="212px" height="161px"/> </svg> </div> </td> ...
...And 23 more matches
Expressions and operators - JavaScript
operators javascript has the following types of operators.
... there are also compound assignment operators that are shorthand for the operations listed in the following table: compound assignment operators name shorthand operator meaning assignment x = y x = y addition assignment x += y x = x + y subtraction assignment x -= y x = x - y multiplication assignment x *= y x = x * y division assignment x /= y x = x / y remainder assignment x %= y x = x % ...
...the following table describes the comparison operators in terms of this sample code: var var1 = 3; var var2 = 4; comparison operators operator description examples returning true equal (==) returns true if the operands are equal.
...And 23 more matches
Layout System Overview - Archive of obsolete content
the original design of the layout system allowed for multiple, possibly different, presentations to be supported simultaneously from the same content model.
...how layout does its job: frames and reflow so, layout is concerned with providing a presentation, in galley or paged mode.
...we refer to this as 'laying out' the frame, or as 'reflowing' the frame.
...And 22 more matches
Handling common JavaScript problems - Learn web development
we'll explore all these problems and more below.
...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.
...And 22 more matches
Index
20 int_fits_in_jsval jsapi reference, obsolete, spidermonkey determines if a specified c integer value, i, lies within the range allowed for integer jsvals.
... 34 js::compileoptions jsapi reference, reference, référence(2), spidermonkey some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain.
... 67 js::setlargeallocationfailurecallback jsapi reference, reference, référence(2), spidermonkey if a large allocation fails when calling pod_{calloc,realloc}cangc, the js engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc.
...And 22 more matches
Mozilla internal string guide
all string classes support the following three ownership models dynamically: reference counted, copy-on-write, buffers (the default) adopted buffers (a buffer that the string class owns, but is not reference counted, because it came from somewhere else) dependent buffers, that is, an underlying buffer that the string class does not own, but that the caller that constructed the string guarantees will outlive the string instance ...
... the major string classes the list below describes the main base classes.
...this allows for a method (.get()) to access the underlying character buffer.
...And 22 more matches
Using IndexedDB - Web APIs
basic pattern the basic pattern that indexeddb encourages is the following: open a database.
... 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.
...transaction || {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.
...And 22 more matches
HTTP headers - HTTP
WebHTTPHeaders
an http header consists of its case-insensitive name followed by a colon (:), then by its value.
...the provided pixel value is a number rounded to the smallest following integer (i.e.
...the provided pixel value is a number rounded to the smallest following integer (i.e.
...And 22 more matches
CSS3 - Archive of obsolete content
media queries recommendation since june 19th, 2012 extends the former media type ( print, screen, … ) to a full language allowing queries on the device media capabilities like only screen and (color) .
... the next iteration of this specification is in the work, allowing to tailor a web site regarding the input methods available on the user agent, with new media features like hover or pointer.
... allow the styling of forms according their content using the css :indeterminate, :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write pseudo-classes and the ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements.
...And 21 more matches
Making decisions in your code — conditionals - Learn web development
human beings (and other animals) make decisions all the time that affect their lives, from small ("should i eat one cookie or two?") to large ("should i stay in my home country and work on my father's farm, or should i move to america and study astrophysics?") conditional statements allow us to represent such decision making in javascript, from the choice that must be made (for example, "one cookie or two"), to the resulting outcome of those choices (perhaps the outcome of "ate one cookie" might be "still felt hungry", and the outcome of "ate two cookies" might be "felt full, but mom scolded me for eating all the cookies".) if...else statements let's look at by far the most co...
...else syntax basic if...else syntax looks like the following in pseudocode: if (condition) { code to run if condition is true } else { run some other code instead } here we've got: the keyword if followed by some parentheses.
... this code is pretty human-readable — it is saying "if the condition returns true, run code a, else run code b" you should note that you don't have to include the else and the second curly brace block — the following is also perfectly legal code: if (condition) { code to run if condition is true } run some other code however, you need to be careful here — in this case, the second block of code is not controlled by the conditional statement, so it always runs, regardless of whether the condition returns true or false.
...And 21 more matches
NSS Tools modutil
syntax to run the security module database tool, type the command modutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section.
...the options and arguments for the modutil command are defined as follows: options -create create new secmod.db, key3.db, and cert8.db files.
...the following cipher is currently available: fortezza.
...And 21 more matches
JIT Optimization Strategies
optimization information is currently collected for the following operations: getproperty (obj.prop) setproperty (obj.prop = val) getelement (obj[elemname]) setelement (obj[elemname] = val) call (func(...)) at each operation site, ionmonkey tries a battery of strategies, from the most optimized but most restrictive to the least optimized but least restrictive.
...the function containing the arguments.length is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i] save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
...the function containing the arguments.callee is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i] save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
...And 21 more matches
Console messages - Firefox Developer Tools
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.
... the context menu options listed below are available on all message categories.
... css note: css warnings and reflow messages are not shown by default, for performance reasons (see bug 1452143).
...And 21 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
a webvtt file (.vtt) contains cues, which can be either a single line or multiple lines, as shown below: webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen.
... 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).
...you'll find more about these in the below section.
...And 21 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
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.
... the live example below has a <span> with display: flex applied.
...this means that some following text could come up alongside the flex container.
...And 21 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
WebHTMLAttributesrel
the type of relationships is given by the value of the rel attribute, which, if present, must have a value that is an unordered set of unique space-separated keywords, which are listed in the following table.
... link link not allowed author author of the current document or article.
... link link not allowed bookmark permalink for the nearest ancestor section.
...And 21 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
WebHTMLElementiframe
content categories flow content, phrasing content, embedded content, interactive content, palpable content.
... allow specifies a feature policy for the <iframe>.
... allowfullscreen set to true if the <iframe> can activate fullscreen mode by calling the requestfullscreen() method.
...And 21 more matches
Web audio codec guide - Web media technologies
common codecs the list below denotes the codecs most commonly used on the web and which containers (file types) support them.
...the table below lists a number of key source audio file format factors and their impact on the encoded audio.
...for real-time streaming of audio, a lossy codec is usually required in order to ensure the flow of data can keep up with the audio playback rate regardless of network performance.
...And 21 more matches
Codecs used by WebRTC - Web media technologies
it's encouraged that video be encoded at a frame rate and size no lower than that, since that's essentially the lower bound of what webrtc generally is expected to handle.
...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.
...And 21 more matches
The "codecs" parameter in common media types - Web media technologies
to do so, append a semicolon (;) followed by codecs= and then the string describing the format of the contents of the file.
... some media types only let you specify the names of the codecs to use, while others allow you to specify various constraints on those codecs as well.
...the list may also contain codecs not present in the file.= codec options by container the containers below support extended codec options in their codecs parameters: 3gp av1 iso bmff mpeg-4 quicktime webm several of the links above go to the same section; that's because those media types are all based on iso base media file format (iso bmff), so they share the same syntax.
...And 21 more matches
Fundamental text and font styling - Learn web development
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.
... 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.
...but it was a rare occasion such as this that he did.</p> font families to set a different font on your text, you use the font-family property — this allows you to specify a font (or list of fonts) for the browser to apply to the selected elements.
...And 20 more matches
Server-side web frameworks - Learn web development
the following sections illustrate some points using code fragments taken from real web frameworks.
...web frameworks allow you to write simplified syntax that will generate server-side code to work with these requests and responses.
... this means that you will have an easier job, interacting with easier, higher-level code rather than lower level networking primitives.
...And 20 more matches
Command line crash course - Learn web development
it provides direct access to the computer’s underlying file system and low-level features, and is therefore incredibly useful for performing complex tasks rapidly, if you know what you are doing.
... below you can see some of the different flavours of programs that are available that can get you to a terminal.
... and below, you can see the macos terminal application.
...And 20 more matches
Bytecode Descriptions
this must be used only in scripts where new.target is allowed: non-arrow function scripts and other scripts that have a non-arrow function script on the scope chain.
...sourcestart and sourceend follow the same rules as for jsop::classconstructor.
...this allows alternate faster implementations to be used that avoid unnecesary allocations.
...And 20 more matches
HTML5 - Developer guides
WebGuideHTMLHTML5
it is a new version of the language html, with new elements, attributes, and behaviors, and a larger set of technologies that allows the building of more diverse and powerful web sites and applications.
... semantics: allowing you to describe more precisely what your content is.
... connectivity: allowing you to communicate with the server in new and innovative ways.
...And 20 more matches
Lexical grammar - JavaScript
only the following unicode code points are treated as line terminators in ecmascript, other line breaking characters are treated as white space (for example, next line, nel, u+0085 is considered as white space).
... the first way is the // comment; this makes all text following it on the same line into a comment.
...an example is as follows: #!/usr/bin/env node console.log("hello world"); note: hashbang comments in javascript mimic shebangs in unix used to run files with proper interpreter.
...And 20 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
a license on a copyrighted work is a use permit that says “it’s ok to use this work within this scope, as long as you follow these conditions.” those conditions could be something like “if you pay me money” or “you can print up to 10,000 copies.” software licenses software is subject to copyright law.
...what is important to us now is the following three rights: open source rights: a user can create and distribute copies of the source code; a user can obtain a program’s source code; a user can modify the source code.
...the user is free to use (duplicate, distribute, and modify) the source code, following certain conditions.
...And 19 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
technical (what do we follow).
...following standards is certainly not a new organizational phenomenon; organizations require their employees to follow common rules, or a common set of standards all the time.
... as organizations mature, they discover that they need more processes to give them greater control, which allows them to more easily plan and predict.
...And 19 more matches
The box model - Learn web development
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.
...by default, the elements inside a box are laid out in normal flow, which means that they behave just like any other block and inline elements (as explained above).
... block and inline layout, however, is the default way that things on the web behave — as we said above, it is sometimes referred to as normal flow, because without any other instruction, our boxes lay out as block or inline boxes.
...And 19 more matches
Handling common HTML and CSS problems - Learn web development
responsive design problems are also common — a site that looks good in a desktop browser might provide a terrible experience on a mobile device, because the content is too small to read, or perhaps the site is slow because of expensive animations.
...one service that can do this is the w3c markup validation service, which allows you to point to your code, and returns a list of errors: css has a similar story — you need to check that your property names are spelled correctly, property values are spelled correctly and are valid for the properties they are used on, you are not missing any curly braces, and so on.
...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.
...And 19 more matches
Strategies for carrying out testing - Learn web development
throughout the following sections, we'll build up a support chart in this format.
... this gives us the following support chart so far: a grade: chrome and firefox for windows/mac, safari for mac, edge and ie for windows (last two versions of each), ios safari for iphone/ipad, android stock browser (last two versions) on phone/tablet, chrome and firefox for android (last two versions) on phone tablet b grade: ie 9 for windows c grade: n/a if you live somewhere else, or are working on a site that wi...
...you could place the snippets below your closing </body> tag, or somewhere else appropriate that keeps it from getting muddled up with your application code.
...And 19 more matches
CustomizableUI.jsm
the customizableui.jsm javascript code module allows you to interact with customizable buttons and items in firefox's main window ui.
...if you want to use it from a jsm or another context without a window reference, you need to import it yourself: components.utils.import("resource:///modules/customizableui.jsm"); introduction the module is intended for two primary purposes: allow adding, moving and removing customizable widgets.
...however, they can now be 'overflowable', that is, if there are too many widgets to fit in the toolbar's horizontal space, the excess widgets will be placed in a panel accessible from an anchor (chevron) in the toolbar.
...And 19 more matches
Creating localizable web applications
listed below are good practices and recommendations that should be followed in order to make your content easily localizable.
... note: most of the code snippets used in the examples below come from an early version of the getpersonas.com website.
...you can use one or more of the following techniques: http accept-language headers, the ua string, ip geolocation.
...And 19 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
you can read more about the relationship between flexbox and the writing modes specification in a later article; however, the following description should help explain why we do not talk about left and right and top and bottom when we describe the direction that our flex items flow in.
... after a while, thinking about start and end rather than left and right becomes natural, and will be useful to you when dealing with other layout methods such as css grid layout which follow the same patterns.
...as with all properties in css, some initial values are defined, so when creating a flex container all of the contained flex items will behave in the following way.
...And 19 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
that means that both of the following are considered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioelement.play(); the following web features and apis may be affected by autoplay blocking: the html <audio> and <video> elements the web audio api from the user's perspective, a web page or app that spontaneously starts making noise without ...
...because of that, browsers generally only allow autoplay to occur successfully under specific circumstances.
... autoplay availability as a general rule, you can assume that media will be allowed to autoplay only if at least one of the following is true: the audio is muted or its volume is set to 0 the user has interacted with the site (by clicking, tapping, pressing keys, etc.) if the site has been whitelisted; this may happen either automatically if the browser determines that the user 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.
...And 19 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
encryption and decryption allow two communicating parties to disguise information they send to each other.
... tamper detection allows the recipient of information to verify that it has not been modified in transit.
... authentication allows the recipient of information to determine its origin-that is, to confirm the sender's identity.
...And 18 more matches
Theme changes in Firefox 2 - Archive of obsolete content
changes to the default theme the table below lists all the changes made in the default theme for firefox 2; you can use this information as a starting point for figuring out the changes you need to make.
...it should use translucency to allow the window contents to be visible through it.
... global/alltabs-box-overflow-bkgnd.png new file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling.
...And 18 more matches
Practical positioning examples - Learn web development
general setup to begin with, add the following between your opening and closing <style> tags: html { font-family: sans-serif; } * { box-sizing: border-box; } body { margin: 0; } this is just some general setup to set a sans-serif font on our page, use the border-box box-sizing model, and get rid of the default <body> margin.
... next, add the following just below your previous css: .info-box { width: 450px; height: 400px; margin: 0 auto; } this sets a specific width and height on the content, and centers it on the screen using the old margin: 0 auto trick.
...first, add the following rule at the bottom of your css to remove the default padding-left and margin-top from the unordered list: .info-box ul { padding-left: 0; margin-top: 0; } note: we are using descendant selectors with .info-box at the start of the chain throughout this example — this is so that we can insert this feature into a page with other content already on it, without fear of interfering with the...
...And 18 more matches
How CSS is structured - Learn web development
erence an external css stylesheet from an html <link> element: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>hello world!</h1> <p>this is my first css example</p> </body> </html> the css stylesheet file might look like this: h1 { color: blue; background-color: yellow; border: 1px solid black; } p { color: red; } the href attribute of the <link> element needs to reference a file on your file system.
... the html for an internal stylesheet might look like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> <style> h1 { color: blue; background-color: yellow; border: 1px solid black; } p { color: red; } </style> </head> <body> <h1>hello world!</h1> <p>this is my first css example</p> </body> </html> in some circumstances, internal stylesheets can be useful.
...the implementation of an inline style in an html document might look like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>my css experiment</title> </head> <body> <h1 style="color: blue;background-color: yellow;border: 1px solid black;">hello world!</h1> <p style="color:red;">this is my first css example</p> </body> </html> avoid using css in this way when possible.
...And 18 more matches
UI pseudo-classes - Learn web development
we'll discuss these in more detail in the sections below, but briefly, the main ones we'll be looking at are: :required and :optional: targets required or optional form controls.
...for example, if we apply the following css to the above html: input:required { border: 1px solid black; } input:optional { border: 1px solid silver; } the required controls would have a black border, and the optional control will have a silver border, like so: you can also try submitting the form without filling it in, to see the client-side validation error messages browsers give you by default.
... 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%.
...And 18 more matches
An Overview of XPCOM
the xpcom solution the cross platform component object module (xpcom) is a framework which allows developers to break up monolithic software projects into smaller modularized pieces.
... the goal of xpcom is to allow different pieces of software to be developed and built independently of one another.
... in order to allow interoperability between components within an application, xpcom separates the implementation of a component from the interface, which we discuss in interfaces.
...And 18 more matches
Signaling and video calling - Web APIs
webrtc allows real-time, peer-to-peer, media exchange between two devices.
... to allow the server to support signaling and ice negotiation, we need to update the code.
... we'll have to allow directing messages to one specific user instead of broadcasting to all connected users, and ensure unrecognized message types are passed through and delivered, without the server needing to know what they are.
...And 18 more matches
Using CSS transitions - CSS: Cascading Style Sheets
with css transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized.
...linearly or quick at the beginning, slow at the end).
...this allows the creation of complex transitions.
...And 18 more matches
Using the application cache - HTML: Hypertext Markup Language
an application cache gives the following benefits: offline browsing users can navigate a site even when they are offline.
...[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.
... the process for loading documents and updating the application cache is specified in greater detail below: when the browser visits a document that includes the manifest attribute, if no application cache exists, the browser loads the document and then fetches all the entries listed in the manifest file, creating the first version of the application cache.
...And 18 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
we've written a simple-but-fun prototype for an application called snapshot, which takes a video stream from your webcam (using getusermedia()) then allows you to capture stills from that video stream (using html5 <canvas>), and save them to a gallery.
...we have used brick to create the mobile layout for snapshot, which you will read more about below.
... to get these sitting side-by-side we have used the following rules: x-card { width: 100%; } x-card:nth-child(1), x-card:nth-child(2) { width: 30%; float: left; padding: 2rem; } x-card:nth-child(3) { width: 40%; float: left; height: 100%; overflow: auto; padding: 2rem; } so we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left.
...And 18 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...an excellent semantic example might look something like the following: <h1>my heading</h1> <p>this is the first section of my document.</p> <p>i'll add another paragraph here too.</p> <ol> <li>here is</li> <li>a list for</li> <li>you to read</li> </ol> <h2>my subheading</h2> <p>this is the first subsection of my document.
... 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.
...And 17 more matches
HTML: A good basis for accessibility - Learn web development
note: it is a good idea to have a screen reader set up on your local computer so that you can do some testing of the examples shown below.
...an excellent semantic example might look something like the following: <h1>my heading</h1> <p>this is the first section of my document.</p> <p>i'll add another paragraph here too.</p> <ol> <li>here is</li> <li>a list for</li> <li>you to read</li> </ol> <h2>my subheading</h2> <p>this is the first subsection of my document.
... 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.
...And 17 more matches
Backgrounds and borders - Learn web development
in the example below, we have used various color values to add a background color to the box, a heading, and a <span> element.
...in the example below, we have two boxes — one has a background image which is larger than the box, the other has a small image of a star.
... try these values out in the example below.
...And 17 more matches
Flexbox - Learn web development
the following simple layout requirements are either difficult or impossible to achieve with such tools, in any kind of convenient, flexible way: vertically centering a block of content inside its parent.
... try adding the following declaration to your <section> rule: flex-direction: column; you'll see that this puts the items back in a column layout, much like they were before we added any css.
... wrapping one issue that arises when you have a fixed amount of width or height in your layout is that eventually your flexbox children will overflow their container, breaking the layout.
...And 17 more matches
React interactivity: Events and state - Learn web development
previous overview: client-side javascript frameworks next with our component plan worked out, it's now time to start updating our app from a completely static ui to one that actually allows us to interact and change things.
... all browser events follow this format in jsx – on, followed by the name of the event.
...your <form /> component call should be updated as follows: <form addtask={addtask} /> finally, you can use this prop inside the handlesubmit() function in your <form /> component!
...And 17 more matches
Mozilla
the articles below include content about downloading and building mozilla code.
...mozilla strives to make its software accessible; the documents below cover the ways in which we do so.
... add-ons add-ons allow developers to extend and modify the functionality of firefox.
...And 17 more matches
Web Console remoting - Firefox Developer Tools
this architecture allows you to connect a web console client instance to a server running on b2g, fennec or some other firefox instance.
... the new web console actors are: the webconsoleactor allows js evaluation, autocomplete, start/stop listeners, etc.
... to attach to the webconsoleactor, follow these steps: connecttoserver() // the usual listtabs() pickthetabyouwant() debuggerclient.attachconsole(tab.consoleactor, listeners, onattachconsole) the listeners argument is an array which specifies listeners you want to start in the web console.
...And 17 more matches
CSP: script-src - HTTP
syntax one or more sources can be allowed for the script-src policy: content-security-policy: script-src <source>; content-security-policy: script-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 17 more matches
CSP: style-src - HTTP
syntax one or more sources can be allowed for the style-src policy: content-security-policy: style-src <source>; content-security-policy: style-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 17 more matches
Digital audio concepts - Web media technologies
by chaining all the samples together, you can approximately represent the original wave, as seen in the diagram below.
...special low frequency enhancement (lfe) channels provide the signal for special speakers designed to produce the low frequency sounds and vibration to create a visceral sensation when listening to the audio.
... to provide additional room for a low-pass filter in order to avoid distortion caused by aliasing, an additional 2.05 khz transition band is added to the pre-sampling frequency (resulting in 22,050 hz).
...And 17 more matches
XUL accessibility guidelines - Archive of obsolete content
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.
...the bookmark manager allows users to sort bookmarks by a particular column of information and choose which columns to display.
...refer to the following resources when setting keyboard shortcuts.
...And 16 more matches
Styling lists - Learn web development
for reference.</p> <ul> <li>hummus</li> <li>pita</li> <li>green salad</li> <li>halloumi</li> </ul> <h2>recipe (ordered) list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <ol> <li>toast pita, leave to cool, then slice down the edge.</li> <li>fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li>wash and chop the salad.</li> <li>fill pita with salad, hummus, and fried halloumi.</li> </ol> <h2>ingredient description list</h2> <p>paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference, paragraph for reference.</p> <dl> <dt>hummus</dt> <dd>a thick dip/sauce ge...
... handling list spacing when styling lists, you need to adjust their styles so they keep the same vertical spacing as their surrounding elements (such as paragraphs and images; sometimes called vertical rhythm), and the same horizontal spacing as each other (you can see the finished styled example on github, and find the source code too.) 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.
... list-style-image: allows you to use a custom image for the bullet, rather than a simple square or circle.
...And 16 more matches
From object to iframe — other embedding technologies - Learn web development
at this point we'd like to take somewhat of a sideways step, looking at some elements that allow you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements.
... <iframe>s are for embedding other web pages, and the other two allow you to embed pdfs, svg, and even flash — a technology that is on the way out, but which you'll still see semi-regularly.
...these were embedded in a master document called a frameset, which allowed you to specify the area on the screen that each frame filled, rather like sizing the columns and rows of a table.
...And 16 more matches
Introduction to web APIs - Learn web development
application programming interfaces (apis) are constructs made available in programming languages to allow developers to create complex functionality more easily.
... in the same way, if you want to say, program some 3d graphics, it is a lot easier to do it using an api written in a higher-level language such as javascript or python, rather than try to directly write low level code (say c or c++) that directly controls the computer's gpu or other graphics functions.
...in the background, the browser is actually using some complex lower-level code (e.g.
...And 16 more matches
Third-party APIs - Learn web development
provide apis allowing developers to make use of their data (e.g.
... third party apis are apis provided by third parties — generally companies such as facebook, twitter, or google — to allow you to access their functionality via javascript and use it on your site.
... 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.
...And 16 more matches
Video and Audio APIs - Learn web development
html5 video and audio the <video> and <audio> elements allow us to embed video and audio into web pages.
... the htmlmediaelement api part of the html5 spec, the htmlmediaelement api provides features to allow you to control video and audio players programmatically — for example htmlmediaelement.play(), htmlmediaelement.pause(), etc.
... our finished example will look (and function) something like the following: getting started to get started with this example, download our media-player-start.zip and unzip it into a new directory on your hard drive.
...And 16 more matches
Getting started with Svelte - Learn web development
nevertheless, svelte is particularly appropriate to tackle the following situations: web applications intended for low power devices: applications built with svelte have smaller bundle sizes, which is ideal for devices with slow network connections and limited processing power.
... onboarding people with basic web development knowledge: svelte has a shallow learning curve.
...to achieve this, svelte extends vanilla web technologies in the following ways: it extends html by allowing javascript expressions in markup and providing directives to use conditions and loops, in a fashion similar to handlebars.
...And 16 more matches
Application Translation with Mercurial
install it into your default firefox profile (you will have more than one profile when following this guide).
... getting the current texts in english and your locale obtaining the english texts with the source code get the source code by downloading the following file: firefox desktop or firefox for android: download the mozilla-<branch>.hg file (e.g.
...file paths here work starting with a slash (/) followed by the drive letter, and then the directory structure like on windows, but using slashes (/) instead of backslashes (\).
...And 16 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.
...the layering section explains how the nss code is layered, and how higher-level functions wrap low-level functions.
...in addition, some low-level apis may be completely opaque to higher level layers.
...And 16 more matches
Key Values - Web APIs
the tables below list the standard key values in various categories of key, with an explanation of what the key is typically used for.
...allows typing control characters.
...used to allow generating function key (f1–f15, for instance) characters on keyboards without a dedicated function key area.
...And 16 more matches
<input type="email"> - HTML: Hypertext Markup Language
WebHTMLElementinputemail
additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, email inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid multiple whether or not to allow mult...
...see allowing multiple e-mail addresses for an example, or html attribute: multiple for more details.
... using email inputs e-mail addresses are among the most frequently-inputted textual data forms on the web; they're used when logging into web sites, when requesting information, to allow order confirmation, for webmail, and so forth.
...And 16 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
they have methods as well that allow you to manipulate the string and access information about the string: 'hello'.charat(0); // "h" 'hello, world'.replace('world', 'mars'); // "hello, mars" 'hello'.touppercase(); // "hello" other types javascript distinguishes between null, which is a value that indicates a deliberate non-value (and is only accessible through the null keyword), and undefined, which is a value of type undefined ...
... javascript has a boolean type, with possible values true and false (both of which are keywords.) any value can be converted to a boolean according to the following rules: false, 0, empty strings (""), nan, null, and undefined all become false.
... you can perform this conversion explicitly using the boolean() function: boolean(''); // false boolean(234); // true however, this is rarely necessary, as javascript will silently perform this conversion when it expects a boolean, such as in an if statement (see below).
...And 16 more matches
Loops and iteration - JavaScript
a for statement looks as follows: for ([initialexpression]; [conditionexpression]; [incrementexpression]) statement when a for loop executes, the following occurs: the initializing expression initialexpression, if any, is executed.
... this expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity.
... example in the example below, the function contains a for statement that counts the number of selected options in a scrolling list (a <select> element that allows multiple selections).
...And 16 more matches
JavaScript modules - JavaScript
browser support use of native javascript modules is dependent on the import and export statements; these are supported in browsers as follows: import desktopmobileserverchromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetnode.jsimportchrome full support 61edge full support 16 full support 16 ful...
... basic example structure in our first example (see basic-modules) we have a file structure as follows: index.html main.js modules/ canvas.js square.js note: all of the examples in this guide have basically the same structure; the above should start getting pretty familiar.
... the modules directory's two modules are described below: canvas.js — contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height inside a wrapper <div> with a specified id, which is itself appended inside a specified parent element.
...And 16 more matches
Performance fundamentals - Web Performance
application launch is one particularly important case discussed in more detail below.
...intelligently allocating memory to user state is an important concern that we go over in more detail below.
... platform performance optimizations this section provides a brief overview of how firefox/gecko contributes to performance generally, below the level of all applications.
...And 16 more matches
Textbox (XPFE autocomplete) - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
...as of gecko 1.9.1, this attribute is now always specified in lower case.
... the disabled attribute is allowed only for form controls.
...And 15 more matches
Cascade and inheritance - Learn web development
in the below example, we have two rules that could apply to the h1.
...it is basically a measure of how specific a selector's selection will be: an element selector is less specific — it will select all elements of that type that appear on a page — so will get a lower score.
...below we again have two rules that could apply to the h1.
...And 15 more matches
The HTML5 input types - Learn web development
now we'll look at the functionality of newer form controls in detail, including some new input types, which were added in html5 to allow collection of specific types of data.
...you can see this in action in the below screenshot.
... you can also use the multiple attribute in combination with the email input type to allow several email addresses to be entered in the same input (separated by commas): <input type="email" id="email" name="email" multiple> on some devices — notably, touch devices with dynamic keyboards like smart phones — a different virtual keypad might be presented that is more suitable for entering email addresses, including the @ key.
...And 15 more matches
Other form controls - Learn web development
<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.
... 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.
...its possible values are: both: the default — allows resizing horizontally and vertically.
...And 15 more matches
JavaScript basics - Learn web development
third-party apis that allow developers to incorporate functionality in sites from other content providers, such as twitter or facebook.
... the section below introduces some aspects of the core language, and offers an opportunity to play with a few browser api features too.
...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.
...And 15 more matches
Graceful asynchronous programming with Promises - Learn web development
previous overview: asynchronous next promises are a comparatively new feature of the javascript language that allow you to defer further actions until after a previous action has completed, or respond to its failure.
... note: the following example will not work if you just run it directly from the file (i.e.
... 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.
...And 15 more matches
Useful string methods - Learn web development
try entering the following lines: let browsertype = 'mozilla'; browsertype.length; this should return the number 7, because "mozilla" is 7 characters long.
... 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.
...try the following: browsertype.indexof('vanilla'); this should give you a result of -1 — this is returned when the substring, in this case 'vanilla', is not found in the main string.
...And 15 more matches
What is JavaScript? - Learn web development
a high-level definition javascript is a scripting or programming language that allows you to implement complex features on web pages — every time a web page does more than just sit there and display static information for you to look at — displaying timely content updates, interactive maps, animated 2d/3d graphics, scrolling video jukeboxes, etc.
... the core client-side javascript language consists of some common programming features that allow you to do things like: store useful values inside variables.
... apis are ready-made sets of code building blocks that allow a developer to implement programs that would otherwise be hard or impossible to implement.
...And 15 more matches
Introduction to client-side frameworks - Learn web development
the web allows us to do things that used to be possible only in native applications installed on our computers.
...these opinions allow for predictability and homogeneity in an application; predictability allows software to scale to an enormous size and still be maintainable; predictability and maintainability are essential for the health and longevity of software.
... there are many frameworks out there, but currently the "big four" are considered to be the following.
...And 15 more matches
Handling common accessibility problems - Learn web development
users of lower spec devices that might have slow processors.
... common accessibility issues in this section we'll detail some of the main issues that arise around web accessibility, connected with specific technologies, along with best practices to follow, and some quick tests you can do to see if your sites are going in the right direction.
...the elements that have this capability are the common ones that allow user to interact with web pages, namely links, <button>s, and form elements like <input>.
...And 15 more matches
Experimental features in Firefox
which you need is described alongside each feature's description below.
... 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.
... nightly 50 no developer edition 50 no beta 50 no release 50 no preference name layout.css.initial-letter.enabled conic gradients conic gradients expand css gradients to allow the color transitions to be rendered circling around a center point rather than radiating from it.
...And 15 more matches
IME handling guide
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").
...then, converts each clause with chinese characters: "私の", "名前は" and "中野です" (in the following screenshot each clause is underlined and not connected adjacently.
... if one or more clauses were not converted as expected, the user can choose one of the clauses with arrow keys and look for the expected result form the list in the drop down menu (in the following screenshot, the clause with the thicker underline is called "selected clause").
...And 15 more matches
IPDL Tutorial
ipdl, short for "inter-process-communication protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way.
...an ipdl protocol declares how actors communicate: it declares the possible messages that may be sent between actors, as well as a state machine describing when messages are allowed to be sent.
...the following ipdl code defines a very basic interaction of browser and plugin actors: async protocol pplugin { child: async init(nscstring pluginpath); async shutdown(); parent: async ready(); }; this code declares the pplugin protocol.
...And 15 more matches
Profiling with the Firefox Profiler
however the following could have some potentially useful information for gecko-specific problems.
...below the tracing markers are rows corresponding with activity on a variety of threads.
... tip: long-running tasks in the parent process will block all input or drawing with the browser ui (aka "ui jank") whereas long-running tasks in the content process will block interactivity with the page but still allowing the user to pan and zoom around thanks to apz.
...And 15 more matches
sslcrt.html
syntax #include <cert.h> secstatus cert_verifycertnow( certcertdbhandle *handle, certcertificate *cert, prbool checksig, seccertusage certusage, void *wincx); parameters this function has the following parameters: handle a pointer to the certificate database handle.
...see description below for more information.
... syntax #include <cert.h> secstatus cert_verifycertname( certcertificate *cert, char *hostname); parameters this function has the following parameters: cert a pointer to the certificate against which to check the hostname referenced by hostname.
...And 15 more matches
nsIAccessibleRole
role_grip 4 represents a special mouse pointer, which allows a user to manipulate user interface elements such as windows.
... for example, a user clicks and drags a sizing grip in the lower-right corner of a window to resize it.
...thus, panes represent a level of grouping lower than frame windows or documents, but above individual controls.
...And 15 more matches
Applying styles and colors - Web APIs
each of the following examples describe the same color.
... because the strokestyle and fillstyle properties accept css rgba color values, we can use the following notation to assign a transparent color to them.
... 112.5, 150, 37.5); // draw semi transparent rectangles for (var i = 0; i < 10; i++) { ctx.fillstyle = 'rgba(255, 255, 255, ' + (i + 1) / 10 + ')'; for (var j = 0; j < 4; j++) { ctx.fillrect(5 + i * 14, 5 + j * 37.5, 14, 27.5); } } } <canvas id="canvas" width="150" height="150"></canvas> draw(); screenshotlive sample line styles there are several properties which allow us to style lines.
...And 15 more matches
Using Service Workers - Web APIs
the previous attempt — appcache — seemed to be a good idea because it allowed you to specify assets to cache really easily.
... however, it made many assumptions about what you were trying to do and then broke horribly when your app didn’t follow those assumptions exactly.
...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.
...And 15 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
using this information, a screen reader will speak out loud important changes to the document or ui, and allow the user to track where they navigate.
...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.
... msaa provides information in several different ways: a com interface (iaccessible) that allows applications to expose the tree of data nodes that make up each window in the user interface currently being interacted with and custom interface extensions via interfaces via queryinterface and queryservice.
...And 15 more matches
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
a first look our three properties control the following aspects of a flex item's flexibility: flex-grow: how much of the positive free space does this item get?
...the following code would set the flex-grow property to 2, flex-shrink to 1 and flex-basis to auto.
... in the live example below for instance i have two paragraph elements that contain a string of text.
...And 15 more matches
Date and time formats used in HTML - HTML: Hypertext Markup Language
while user interfaces may allow entry of dates using other calendars, the underlying value always uses the gregorian calendar.
...scientists occasionally add leap seconds to the calendar (seriously) to handle the remaining three ten-thousandths of a day and to compensate for the gradual, naturally occurring slowing of earth's rotation.
...this is detailed in the following table.
...And 15 more matches
CSP: sandbox - HTTP
syntax content-security-policy: sandbox; content-security-policy: sandbox <value>; where <value> can optionally be one of the following values: allow-downloads-without-user-activation allows for downloads to occur without a gesture from the user.
... allow-forms allows the page to submit forms.
... if this keyword is not used, this operation is not allowed.
...And 15 more matches
Regular expressions - JavaScript
creating a regular expression you construct a regular expression in one of two ways: using a regular expression literal, which consists of a pattern enclosed between slashes, as follows: let re = /ab+c/; regular expression literals provide compilation of the regular expression when the script is loaded.
... or calling the constructor function of the regexp object, as follows: let re = new regexp('ab+c'); using the constructor function provides runtime compilation of the regular expression.
...for example, to match a single "a" followed by zero or more "b"s followed by "c", you'd use 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".
...And 15 more matches
Working with objects - JavaScript
for example, let's create an object named mycar and give it properties named make, model, and year as follows: var mycar = new object(); mycar.make = 'ford'; mycar.model = 'mustang'; mycar.year = 1969; the above example could also be written using an object initializer, which is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}): var mycar = { make: 'ford', model: 'mustang', year: 1969 }; unassigned propertie...
...so, for example, you could access the properties of the mycar object as follows: mycar['make'] = 'ford'; mycar['model'] = 'mustang'; mycar['year'] = 1969; an object property name can be any valid javascript string, or anything that can be converted to a string, including the empty string.
...examples are as follows: // four variables are created and assigned in a single go, // separated by commas var myobj = new object(), str = 'mystring', rand = math.random(), obj = new object(); myobj.type = 'dot syntax'; myobj['date created'] = 'string with space'; myobj[str] = 'string value'; myobj[rand] = 'random number'; myobj[obj] = 'object'; myobj[''] = '...
...And 15 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
this new navigational method allows us to make html user interfaces behave similarly to non-web based applications such as contact management software.
...see the table below for a description of how applications like this exemplify inner-browsing and how they might be implemented using the inner-browsing approach.
...today, this publishing system allows your users to modify content for the portal, but in order to have their text spell checked they must click somewhere and wait for the response page.
...And 14 more matches
Introduction to SSL - Archive of obsolete content
the ssl protocol runs above tcp/ip and below higher-level protocols such as http or imap.
... it uses tcp/ip on behalf of the higher-level protocols, and in the process allows an ssl-enabled server to authenticate itself to an ssl-enabled client, allows the client to authenticate itself to the server, and allows both machines to establish an encrypted connection.
... these capabilities address fundamental concerns about communication over the internet and other tcp/ip networks: ssl server authentication allows a user to confirm a server's identity.
...And 14 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
this article is outdated, do not follow it.
...it also includes compatibility features which allow it to reasonably handle legacy content which was developed for earlier generations of browsers such as netscape navigator 4 as well as features which provide compatibility with internet explorer 5 and 6.
... the easiest way to support gecko is to create content which follows web standards.
...And 14 more matches
Building up a basic demo with Three.js - Game development
add this code into our second <script> element, just below the javascript comment.
...let's create it, by adding the following line below our previous lines: var scene = new three.scene(); later, we will be using the .add() method, to add objects to this scene.
...the following lines put the camera in place in the 3d coordinate system, and point it in the direction of our scene, so we can finally see something: var camera = new three.perspectivecamera(70, width/height); camera.position.z = 50; scene.add(camera); add the above lines to your code, below those previously added.
...And 14 more matches
WAI-ARIA basics - Learn web development
previous overview: accessibility next following on from the previous article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult.
...as an example, aria-required="true" specifies that a form input needs to be filled in to be valid, whereas aria-labelledby="label" allows you to put an id on an element, then reference it as being the label for anything else on the page, including multiple elements, which is not possible using <label for="input">.
...where this is unavoidable, wai-aria provides a means to allow other elements to receive focus (using tabindex).
...And 14 more matches
HTML table basics - Learn web development
LearnHTMLTablesBasics
a table allows you to quickly and easily look up values that indicate some kind of connection between different types of data, for example a person and their age, or a day of the week, or the timetable for a local swimming pool.
...look at the table below for example and find a jovian gas giant with 62 moons.
...the main reasons are as follows: layout tables reduce accessibility for visually impaired users: screenreaders, used by blind people, interpret the tags that exist in an html page and read out the contents to the user.
...And 14 more matches
Fetching data from the server - Learn web development
enter ajax this led to the creation of technologies that allow web pages to request small chunks of data (such as html, xml, json, or plain text) and display them only when needed, helping to solve the problem described above.
...these technologies allow web pages to directly handle making http requests for specific resources available on a server and formatting the resulting data as needed before it is displayed.
... just inside the <script> element, add the following code.
...And 14 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
you'll learn how below.
... fixing syntax errors earlier on in the course we got you to type some simple javascript commands into the developer tools javascript console (if you can't remember how to open this in your browser, follow the previous link to find out how).
...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).
...And 14 more matches
Client-Server Overview - Learn web development
the different methods/verbs and their associated actions are listed below: get: get a specific resource (e.g.
... both static and dynamic websites (discussed in the following sections) use exactly the same communication protocol/patterns.
...for example, the http request that is sent when you perform a search on mdn for the term "client server overview" will look a lot like the text shown below (it will not be identical because parts of the message depend on your browser/setup).
...And 14 more matches
Getting started with Ember - Learn web development
use cases generally, emberjs works well for building apps that desire either or both of the following traits: single page applications, including native-like web apps, and progressive web apps (pwas) ember works best when it is the entire front end of your application.
... increasing cohesion among many team's technology stacks community-backed "best practices" allow for faster long-term development speed.
... ember is built on javascript technologies and is a thin layer on top of traditional object-oriented programming, while still allowing developers to utilize functional programming techniques.
...And 14 more matches
Ember interactivity: Events, classes and state - Learn web development
in the below sections we’ll do this for each component, and then walk you through how the functionality can be implemented.
... 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.
... to create a header class to go with your header component, type this in to your terminal: ember generate component-class header this will create the following empty class file — todomvc/app/components/header.js: import component from '@glimmer/component'; export default class headercomponent extends component { } inside this file we will implement the event handler code.
...And 14 more matches
Gecko info for Windows accessibility vendors
contains more desktop-style widgets than html and follows a box layout model, rather than being text-flow based.
...this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances).
... in total, gecko supports the following window classes: mozillauiwindowclass - root ui window, at the root of the window hierarchy mozillacontentwindowclass -- root document window mozillacontentframewindowclass - root of a subdocument created by a <frame> or <iframe> element mozillahiddenwindowclass - ignore these windows, they are used to help manage other windows mozillawindowclass - general filler window, ...
...And 14 more matches
Eclipse CDT Manual Setup
setup time some points in the rest of this document below are old and taken care of by the mach commands described above (although some of the project configuration is not done automatically yet).
...if that is not the case, then get your build going now so that it can be running while you continue with the instructions below.
...if you set up eclipse as detailed below, you will experience much better results.
...And 14 more matches
nsIDocShell
void setcurrenturi(in nsiuri auri); void suspendrefreshuris(); void tabtotreeowner(in boolean forward, out boolean tookfocus); attributes attribute type description allowauth boolean certain dochshells (like the message pane) should not throw up auth dialogs because it can act as a password trojan.
... allowdnsprefetch boolean attribute that determines whether dns prefetch is allowed for this subtree of the docshell tree.
... allowimages boolean attribute stating whether or not images should be loaded.
...And 14 more matches
WebGL best practices - Web APIs
oes_element_index_uint oes_standard_derivatives oes_vertex_array_object webgl_debug_renderer_info webgl_lose_context (see also: https://jdashg.github.io/misc/webgl/webgl-feature-levels.html) consider polyfilling these into webglrenderingcontext, like: https://github.com/jdashg/misc/blob/master/webgl/webgl-v1.1.js universally supported limits the minimum requirements for webgl are quite low.
... in practice, effectively all systems support at least the following: max_cube_map_texture_size: 4096 max_renderbuffer_size: 4096 max_texture_size: 4096 max_viewport_dims: [4096,4096] max_vertex_texture_image_units: 4 max_texture_image_units: 8 max_combined_texture_image_units: 8 max_vertex_attribs: 16 max_varying_vectors: 8 max_vertex_uniform_vectors: 128 max_fragment_uniform_vectors: 64 aliased_point_size_range: [1,100] your desktop may support 16k textures, or maybe 16 texture units in the vertex shader, but most other systems don't, and content that works for you will not work for them!
...the overhead for this is relatively low, but re-using vaos means fewer vertexattribpointer calls too, so it's worth doing wherever it's easy.
...And 14 more matches
Inputs and input sources - Web APIs
gaze tracking (following the movements of the eye to choose targets).
...the value of y would still be positive unless the controller was moved below the world space origin.
... this is shown in the diagram below, in which the controller is located down and to the left of the world space's origin, with the controller also moved to be closer to us than the origin.
...And 14 more matches
OpenType font features guide - CSS: Cascading Style Sheets
these are all referred to as opentype features, and are made available to use on the web via specific properties and a low-level control property — font-feature-settings.
... 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.
...they are all defined and shown here, but many will only work using the lower-level font-feature-settings property.
...And 14 more matches
Visual formatting model - CSS: Cascading Style Sheets
positioning scheme (normal flow, float, and absolute positioning).
...note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details.
...you can see the difference between line boxes and their containing block if you float an item and then follow it by a block that has a background color.
...And 14 more matches
position - CSS: Cascading Style Sheets
WebCSSposition
syntax the position property is specified as a single keyword chosen from the list of values below.
... values static the element is positioned according to the normal flow of the document.
... relative the element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left.
...And 14 more matches
Block formatting context - Developer guides
a block formatting context is created by at least one of the following: the root element of the document (<html>).
... block elements where overflow has a value other than visible.
... display: flow-root.
...And 14 more matches
<input type="search"> - HTML: Hypertext Markup Language
WebHTMLElementinputsearch
additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, search field inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the inpu...
... spellcheck non-standard attributes the following non-standard attributes are available to search input fields.
... attribute description autocorrect whether or not to allow autocorrect while editing this input field.
...And 14 more matches
CSP: base-uri - HTTP
if this value is absent, then any uri is allowed.
...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.
...And 14 more matches
An overview of HTTP - HTTP
WebHTTPOverview
http is a protocol which allows the fetching of resources, such as html documents.
...this means some parts of displayed text are links which can be activated (usually by a click of the mouse) to fetch a new web page, allowing the user to direct their user-agent and navigate through the web.
...proxies may perform numerous functions: caching (the cache can be public or private, like the browser cache) filtering (like an antivirus scan or parental controls) load balancing (to allow multiple servers to serve the different requests) authentication (to control access to different resources) logging (allowing the storage of historical information) basic aspects of http http is simple http is generally designed to be simple and human readable, even with the added complexity introduced in http/2 by encapsulating http messages into frames.
...And 14 more matches
Regular expression syntax cheatsheet - JavaScript
if 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.
... has one of the following meanings: matches any single character except line terminators: \n, \r, \u2028 or \u2029.
... es2018 added the s "dotall" flag, which allows the dot to also match line terminators.
...And 14 more matches
Populating the page: how browsers work - Web Performance
in our example above, the request is definitely less than 14kb, but the linked resources aren't requested until the browser encounters the links during parsing, described below.
... tcp slow start / 14kb rule the first response packet will be 14kb.
... this is part of tcp slow start, an algorithm which balances the speed of a network connection.
...And 14 more matches
Using the WebAssembly JavaScript API - WebAssembly
create a <script></script> element in your html file, and add the following code to it: var importobject = { imports: { imported_func: arg => console.log(arg) } }; streaming the webassembly module new in firefox 58 is the ability to compile and instantiate webassembly modules directly from underlying sources.
... add the following to your script, below the first block: webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the net result of this is that we call our exported webassembly function exported_func, which in turn calls our imported javascript function imported_func, which logs the value provided inside the webassembly instance (42) to the cons...
... 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.
...And 14 more matches
Handling different text directions - Learn web development
in the example below we have a heading displayed using writing-mode: vertical-rl.
... the three possible values for the writing-mode property are: horizontal-tb: top-to-bottom block flow direction.
... vertical-rl: right-to-left block flow direction.
...And 13 more matches
Images, media, and form elements - Learn web development
sizing images as you already know from following these lessons, everything in css generates a box.
... if you place an image inside a box that is smaller or larger than the intrinsic dimensions of the image file in either direction, it will either appear smaller than the box, or overflow the box.
... you need to make a decision about what happens with the overflow.
...And 13 more matches
Beginner's guide to media queries - Learn web development
media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the viewport, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse.
... media types the possible types of media you can specify are: all print screen speech the following media query will only set the body to 12pt if the page is printed.
... width and height the feature we tend to detect most often in order to create responsive designs (and that has widespread browser support) is viewport width, and we can apply css if the viewport is above or below a certain width — or an exact width — using the min-width, max-width, and width media features.
...And 13 more matches
CSS property compatibility table for form controls - Learn web development
the following compatibility tables try to summarize the state of css support for html forms.
... rendering for each property there are two possible renderings: n (normal) indicates that the property is applied as it is t (tweaked) indicates that the property is applied with the extra rule below: * { /* turn off the native look and feel */ -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 som...
... text-overflow opera, safari, and ie9 do not support this property on form widgets.
...And 13 more matches
HTML basics - Learn web development
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), wrapped in opening and closing angle brackets.
... elements can also have attributes that look like the following: attributes contain extra information about the element that you don't want to appear in the actual content.
...And 13 more matches
HTML text fundamentals - Learn web development
you just need to bear in mind a few best practices as you create such structures: preferably, you should use a single <h1> per page—this is the top level heading, and all others sit below this in the hierarchy.
...don't use <h3> elements to represent subheadings, followed by <h2> elements to represent sub-subheadings—that doesn't make sense and will lead to weird results.
...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.
...And 13 more matches
Looping code - Learn web development
he might use the following loop to achieve this: a loop usually has one or more of the following features: a counter, which is initialized with a certain value — this is the starting point of the loop ("start: i have no food", above).
... in pseudocode, this would look something like the following: loop(food = 0; foodneeded = 10) { if (food >= foodneeded) { exit loop; // we have enough food; let's go home } else { food += 2; // spend an hour collecting 2 more food // loop will then run again } } so the amount of food needed is set at 10, and the amount the farmer currently has is set at 0.
... if we weren't using a loop here, we'd have to repeat the following code for every circle we wanted to draw: ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); this would get very boring and difficult to maintain very quickly.
...And 13 more matches
Object building practice - Learn web development
these contain the following, respectively: a very simple html document featuring an <h1> element, a <canvas> element to draw our balls on, and elements to apply our css and javascript to our html.
...the resulting constant (ctx) is the object that directly represents the drawing area of the canvas and allows us to draw 2d shapes on it.
... the last bit of the initial script looks as follows: function random(min, max) { const num = math.floor(math.random() * (max - min + 1)) + min; return num; } this function takes two numbers as arguments, and returns a random number in the range between the two.
...And 13 more matches
Aprender y obtener ayuda - Learn web development
you concentrate deeply on a low-level topic and solving the specific problems that it brings.
...some of the articles will be tutorials, to teach you a certain technique or important concept (such as "learn how to create a video player" or "learn the css box model"), and some of the articles will be reference material, to allow you to look up details you may have forgotten (such as "what is the syntax of the css background property"?) mdn web docs is very good for both types — the area you are currently in is great for learning techniques and concepts, and we also have several giant reference sections allowing you to look up any syntax you can't remember.
... there are also several other great resources on the web, some of which we'll mention below.
...And 13 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status.
... create a <script> section at the top of src/components/todos.svelte and give it some content, as follows: <script> let todos = [ { id: 1, name: 'create a svelte starter app', completed: true }, { id: 2, name: 'create your first component', completed: true }, { id: 3, name: 'complete the rest of the tutorial', completed: false } ] let totaltodos = todos.length let completedtodos = todos.filter(todo => todo.completed).length </script> now let's do something with that inform...
... replace the existing <ul> element with the following simplified version to get an idea of how it works: <ul> {#each todos as todo, index (todo.id)} <li> <input type="checkbox" checked={todo.completed}/> {index}.
...And 13 more matches
source-editor.jsm
this object has the following properties: property type description str string the last string that was searched for.
... lastfound number the index of the previous location at which str was found, for multiple find operations (such as find() followed by findnext()).
...set it to false to allow editing.
...And 13 more matches
QA phase
preliminary instructions we will be using the following file directories for this example: your working directory (root)/ mozilla-aurora (en-us source, pulled from http://hg.mozilla.org/releases/mozilla-aurora )/ l10n-central (directory for l10n directories, one per l10n; often referred to as "l10n base")/ your-locale-code (a directory with your l10n files, in this example we'll use x-testing) example: root/mozilla-aurora & root/l...
... 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).
...And 13 more matches
Gecko Profiler FAQ
mstange and ehsan tried to respond to some of the questions in advance in writing, and you can find the answers below.
... is it worth slowing down cpu to increase the profiler resolution?
... if the issue you are trying to avoid is not profiling on fast machines that mozilla developers typically use to build firefox on, a better solution may be using a less high-end machine that actually has lower spec’d hardware instead of artificially slowing down just the cpu.
...And 13 more matches
Gecko Roles
role_grip represents a special mouse pointer, which allows a user to manipulate user interface elements such as windows.
... for example, a user clicks and drags a sizing grip in the lower-right corner of a window to resize it role_sound represents a system sound, which is associated with various system events.
...thus, panes represent a level of grouping lower than frame windows or documents, but above individual controls.
...And 13 more matches
History Service Design
objectives the primary objectives of the new history service implementation in places are: improve access to browsing history allow association of useful metadata with urls flexible query system for both end-users and add-ons developers clean architecture for ease of code reuse and maintainability the most known and visible feature of history are views.
...old history system was instead only storing first and last visit date, and a generic visits counter, creating some problem due to the impossibility to represent real history flow in a timeframe.
...each visit is associated with a favicon, to allow for better recognizability and groupable by common timeframes or domains.
...And 13 more matches
Component Internals
the illustration below shows the basic relationship between the shared library containing the component implementation code you write and the xpcom framework itself.
...parameters passed to this startup call allow you to configure some aspects of xpcom, including the customization of location of specific directories.
... xpcom startup the six basic steps to xpcom startup are as follows: application starts xpcom.
...And 13 more matches
Setting up the Gecko SDK
the following four sections tell the developer how to download and organize the gecko sdk and create a new project in which components like weblock can be created.
...the sdk is available for windows, linux, and mac operating systems, and versions for other operating systems are being developed, and can be retrieved from as a single archive from the following platform-specific locations (need correction for last version (now 1.9.2.8).
...if you choose some other location, remember to adjust the settings described here (e.g., in the building a microsoft visual cpp project section below) to point to this new location.
...And 13 more matches
nsIFile
void appendrelativenativepath(in acstring relativefilepath); void appendrelativepath(in astring relativefilepath); nsifile clone(); boolean contains(in nsifile infile); void copyto(in nsifile newparentdir, in astring newname); void copytofollowinglinks(in nsifile newparentdir, in astring newname); void copytofollowinglinksnative(in nsifile newparentdir, in acstring newname); native code only!
... followlinks prbool determines whether or not the nsifile will automatically resolve symbolic links.
... note: the value of the followlinks attribute is not encoded in the persistent descriptor.
...And 13 more matches
XPCOM string functions
xpcom provides these low-level string functions to let you work with strings; however, it's often better to use one of the string classes rather than directly using these functions.
...this is a low-level api.ns_cstringclonedatathe ns_cstringclonedata function returns a null-terminated, heap allocated copy of the string's internal buffer.ns_cstringcontainerfinishthe ns_cstringcontainerfinish function releases any memory allocated by a nscstringcontainer instance.ns_cstringcontainerinitthe ns_cstringcontainerinit function initializes a nscstringcontainer instance for use as a nsacstring.ns_cstringcontainerinit2the ns_cstringcontainerinit2 function initializes a nscstringcontainer instance for use as a nsacstring.ns_cstringcopythe ns_cstringcopy function copies the value from one nsacstring instance to another.
... this is a low-level api.ns_cstringcutdatathe ns_cstringcutdata function removes a section of the string's internal buffer.
...And 13 more matches
Debugger - Firefox Developer Tools
accessor properties of the debugger prototype object a debugger instance inherits the following accessor properties from its prototype: enabled a boolean value indicating whether this debugger instance’s handlers, breakpoints, and the like are currently enabled.
... allowunobservedasmjs a boolean value indicating whether asm.js code running inside this debugger instance’s debuggee globals is invisible to debugger api handlers and breakpoints.
... allowwasmbinarysource a boolean value indicating whether webassembly sources will be available in binary form.
...And 13 more matches
Element - Web APIs
WebAPIElement
<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...
... nondocumenttypechildnode.nextelementsibling read only is an element, the element immediately following the given one in the tree, or null if there's no sibling node.
... properties included from slotable the element interface includes the following property, defined on the slotable mixin.
...And 13 more matches
Node - Web APIs
WebAPINode
<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...
...arget="_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,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">node</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties in addition to the properties below, node inherits properties from its parent, eventtarget.
...in later versions, this does not happen, so the property is in lower case for both html and xhtml.
...And 13 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
the interface consists of master controls, which allow us to play/stop the sequencer, and adjust the bpm (beats per minute) to speed up or slow down the "music".
... each voice also has local controls, which allow you to manipulate the effects or parameters particular to each technique we are using to create those voices.
...we can allow the user to control these using range inputs on the interface: <label for="attack">attack</label> <input name="attack" id="attack" type="range" min="0" max="1" value="0.2" step="0.1" /> <label for="release">release</label> <input name="release" id="release" type="range" min="0" max="1" value="0.5" step="0.1" /> now we can create some variables over in javascript and have them change when the i...
...And 13 more matches
Web Audio API - Web APIs
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.
... web audio concepts and usage the web audio api involves handling audio operations inside an audio context, and has been designed to allow modular routing.
... a simple, typical workflow for web audio would look something like this: create audio context inside the context, create sources — such as <audio>, oscillator, stream create effects nodes, such as reverb, biquad filter, panner, compressor choose final destination of audio, for example your system speakers connect the sources up to the effects, and the effects to the destination.
...And 13 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
code an optional syntax allows you to include a string instead of a function, which is compiled and executed every delay milliseconds.
...see delay restrictions below for details on the permitted range of delay values.
... examples example 1: basic syntax the following example demonstrates setinterval()'s basic syntax.
...And 13 more matches
Introduction to formatting contexts - CSS: Cascading Style Sheets
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.
... a new bfc is created in the following situations: elements made to float using float absolutely positioned elements (including position: fixed or position: sticky) elements with display: inline-block table cells or elements with display: table-cell, including anonymous table cells created when using the display: table-* properties table captions or elements with display: table-caption block elements where overflow has a va...
...lue other than visible elements with display: flow-root or display: flow-root list-item elements with contain: layout, content, or strict flex items grid items multicol containers elements with column-span set to all this is useful because a new bfc will behave much like the outermost document in that it becomes a mini-layout inside the main layout.
...And 13 more matches
CSS values and units - CSS: Cascading Style Sheets
below is an overview of most of these data types.
... 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.
...And 13 more matches
HTML attribute reference - HTML: Hypertext Markup Language
allow <iframe> specifies a feature-policy for the iframe.
...allowed values are ltr (left-to-right) or rtl (right-to-left) dirname <input>, <textarea> disabled <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea> indicates whether the user can interact with the element.
... high <meter> indicates the lower bound of the upper range.
...And 13 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
in other words, an implementation should allow any valid combination of year, month, day, hour, and minute - even if such a combination is invalid in the user's local time zone (such as times within a daylight saving time spring-forward transition gap).
... for those of you not using a supporting browser, the chrome/opera datetime-local control looks like the below screenshot.
... clicking the down arrow on the right hand side brings up a date picker to allow you to choose a date; you have to enter the time manually.
...And 13 more matches
CSP: form-action - HTTP
not setting this allows anything.
... syntax one or more sources can be set for the form-action policy: content-security-policy: form-action <source>; content-security-policy: form-action <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
...And 13 more matches
CSP: navigate-to - HTTP
this is an enforcement on what navigations this document initiates not on what this document is allowed to navigate to.
...not setting this allows anything.
... syntax one or more sources can be set for the navigate-to policy: content-security-policy: navigate-to <source>; content-security-policy: navigate-to <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...And 13 more matches
jpm - Archive of obsolete content
jpm usage is: jpm [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version number --addon-dir - directory for your source code, defaulting to the current directory installation jpm is distributed with the node package manager npm.
...add the following line to the end of the file $home/.profile to add it to your path permanently (as the file .profile is executed every time a new terminal is opened): export path="$home/node_modules/.bin/:$path" installing jpm from git alternatively, you can also get the latest version of jpm using git: git clone https://github.com/mozilla-jetpack/jpm.git cd jpm npm install npm link after installing jpm ...
... command reference jpm supports the following commands: jpm init create a skeleton add-on as a starting point for your add-on.
...And 12 more matches
Extension Versioning, Update and Compatibility - Archive of obsolete content
as a rough overview this is a version string split by periods, some examples: 2.0 1.0b1 3.0pre1 5.0.1.2 note: before firefox 1.5 the more basic firefox version format was used: major.minor.release.build[+] where only digits were allowed.
... the toolkit version format supports the firefox version format but allows greater flexibility.
...this allows you to say that your add-on will install into any toolkit based application.
...And 12 more matches
The Essentials of an Extension - Archive of obsolete content
<em:id>helloworld@xulschool.com</em:id> this is the unique identifier for the extension.
...a localized description and name can be added with the following code: <em:localized> <description> <em:locale>es-es</em:locale> <em:name>xul school hola mundo</em:name> <em:description>bienvenido a xul school!</em:description> </description> </em:localized> the es-es locale string indicates that this is the spanish (es) localization for spain (es).
...if the application or version range don't match, you won't be allowed to install the extension, or the extension will be installed in a disabled state.
...And 12 more matches
jspage - Archive of obsolete content
var mootools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};var native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterimplement||function(){};var d=f||i;h=h!==false;d.constructor=native;d.$family={name:"native"}; if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.tolowercase();d.prototype.$family={name:e};native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o; }if(h){native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p); }}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return ...
...,initialize:a[h],protect:true}); }var d={"boolean":boolean,"native":native,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","lastindexof","match","replace","search","slice","split","substr","substring","tolowercase","touppercase","valueof"]}; for(var e in f){for(var b=f[e].length;b--;){native.genericize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getclean()); }for(var b in a){this[b]=a[b];}return this;}});hash.implement({foreach:function(b,c){for(var a in this){if(this.hasownproperty(a)){b.call(c,this[a],a,this); }}},getclean:funct...
...n $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browser=$merge({engine:{name:"unknown",version:0},platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].tolowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xmlhttprequest)?((document.queryselectorall)?6:5):4);},webkit:function(){return(naviga...
...And 12 more matches
splitter - Archive of obsolete content
the vbox is used to hold the .png image that a user clicks on to resize the search bar.--> <splitter tooltiptext="resize the search box" oncommand="alert('the splitter was dragged')"> <vbox id="example_vbox" /> </splitter> attributes collapse type: one of the values below determines which side of the splitter is collapsed when its grippy is clicked.
... both either the element immediately before the splitter, or the element immediately after the splitter can be collapsed, if the size of that element would fall below the minimum size due to the position of the splitter.
... resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned.
...And 12 more matches
RDF in Mozilla FAQ - Archive of obsolete content
both datasources refer to "website" by url: this is the "key" that allows the datasources to be "merged" effectively.
...var ds = rdf.getdatasource("http://www.mozilla.org/some-rdf-file.rdf"); // note that ds will load asynchronously, so assertions will not // be immediately available alternatively, you can create one directly using the xpcom component manager, as the following code fragment illustrates: // create an rdf/xml datasource using the xpcom component manager var ds = components .classes["@mozilla.org/rdf/datasource;1?name=xml-datasource"] .createinstance(components.interfaces.nsirdfdatasource); // the nsirdfremotedatasource interface has the interfaces // that we need to setup the datasource.
... for this reason, there is an observer interface that allows you to spy on a datasource's progress.
...And 12 more matches
Building up a basic demo with the PlayCanvas engine - Game development
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.
...again, add the following lines at the bottom of your script.
...let's start with the camera — add these lines to your code, below the previous ones.
...And 12 more matches
Accessible multimedia - Learn web development
the problem with native html5 controls html5 video and audio instances even come with a set of inbuilt controls that allow you to control the media straight out of the box.
... different browsers give the native controls differing styling and functionality, and they aren't stylable, meaning that they can't be easily made to follow a site style guide.
... creating custom audio and video controls html5 video and audio share an api — html media element — which allows you to map custom functionality to buttons and other controls — both of which you define yourself.
...And 12 more matches
Advanced styling effects - Learn web development
box shadows box-shadow allows you to apply one or more drop shadows to an element's box.
...lass="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).
... black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } button:focus, button:hover { background-image: linear-gradient(to bottom right, #888, #eee); } button:active { box-shadow: inset 2px 2px 1px black, inset 2px 3px 5px rgba(0,0,0,0.3), inset -2px -3px 5px rgba(255,255,255,0.5); } this gives us the following result: here we've set up some button styling along with focus/hover/active states.
...And 12 more matches
Manipulating documents - Learn web development
there are a few really obvious bits you'll reference regularly in your code — consider the following diagram, which represents the main parts of a browser directly involved in viewing web pages: the window is the browser tab that a web page is loaded into; this is represented in javascript by the window object.
...img is not a child of body, as it is two levels below it in the tree, but it is a descendant of body.
...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).
...And 12 more matches
Arrays - Learn web development
paste the following code into the console: let shopping = ['bread', 'milk', 'cheese', 'hummus', 'noodles']; shopping; in the above example, each element is a string, but in an array we can store various data types — strings, numbers, objects, and even other arrays.
... enter the following into your console: shopping[0]; // returns "bread" you can also modify an item in an array by simply giving a single array item a new value.
...try the following: shopping.length; // should return 5 this has other uses, but it is most commonly used to tell a loop to keep going until it has looped through all the items in an array.
...And 12 more matches
Introduction to the server side - Learn web development
perhaps the most significant benefit of server-side code is that it allows you to tailor website content for individual users.
... it can even allow interaction with users of the site, sending notifications and updates via email or through other channels.
... static sites the diagram below shows a basic web server architecture for a static site (a static site is one that returns the same hard-coded content from the server whenever a particular resource is requested).
...And 12 more matches
Package management basics - Learn web development
you could manage your own package registry — products like microsoft azure allow you to create proxies to the npm registry (so you can override or lock certain packages), github also offers a package registry service, and there will be likely more options appearing as time goes on.
...we’ll call it parcel-experiment, but you can call it whatever you like: mkdir parcel-experiment cd parcel-experiment next, let's initialise our app as an npm package, which creates a config file — package.json — that allows us to save our configuration details in case we want to recreate this environment later on, or even publish the package to the npm registry (although this is somewhat beyond the scope of this article).
... type the following command, making sure you are inside the parcel-experiment directory: npm init you will now be asked some questions; npm will then create a default package.json file based on the answers: name: a name to identify the app.
...And 12 more matches
Mozilla’s UAAG evaluation report
most browsers do not allow the user to select text with the keyboard alone.
... 2.4 allow time-independent interaction.
...allow configuration not to render some content that may reduce accessibility.
...And 12 more matches
Configuring Build Options
please read the following directions carefully before building, and follow them in order.
...this is useful if you choose to have multiple mozconfig files for different applications or configurations (see below for a full example).
... note that in the export example below the filename was not mozconfig.
...And 12 more matches
Multiple Firefox profiles
having different profiles would help separate work and personal life, or allow each family member to have his or her own set of bookmarks, settings, and add-ons.
... the page presents a list of all of your profiles, each beginning with "profile: " followed by its name.
...then follow the instructions below, applicable to your operating system.
...And 12 more matches
NSS PKCS11 Functions
syntax #include "secmod.h" extern secmodmodule *secmod_loadusermodule(char *modulespec, secmodmodule *parent, prbool recurse); parameters this function has the following parameters: modulespec is a pkcs #11 modulespec.
...syntax #include "secmod.h" extern secstatus secmod_unloadusermodule(secmodmodule *module); parameters this function has the following parameters: module is the module to be unloaded.
...syntax #include <pk11pub.h> secstatus secmod_closeuserdb(pk11slotinfo *slot) parameters this function has the following parameter: slot a pointer to a slot info structure.
...And 12 more matches
Introduction to XPCOM for the DOM
pure virtual methods are declared with the following syntax: virtual nsresult functionfoo() = 0; an interface is thus simply a c++ class where all the member functions are declared as pure virtual functions.
...the c++ code is the following: class nsfoo : public nsifoo for those unfamiliar with object-oriented c++, this means that nsfoo is declared as "derived from" nsifoo, and that nsifoo is a "base class" of nsfoo.
...a pointer to an interface nsifoo implemented by nsfoo can be declared as follows nsifoo *fooptr = new nsfoo; a pointer such as fooptr is then called a "pointer to an interface nsifoo implemented by an instance of the nsfoo class", or "pointer to nsifoo" in short.
...And 12 more matches
Using Objective-C from js-ctypes
speech synthesis example let's start with the following objective-c code, which invokes the speech synthesis api to say "hello, firefox!".
... while ([synth isspeaking]) {} [synth release]; return 0; } save this file as test.m, and run with the following command, inside the same directory as the saved file (needs xcode).
...let's look at the following codelet: [nsspeechsynthesizer alloc] it passes an alloc message to the nsspeechsynthesizer class, in objective-c syntax.
...And 12 more matches
Plug-in Basics - Plugins
when the user opens a page that contains embedded data of a media type that invokes a plug-in, the browser responds with the following sequence of actions: check for a plug-in with a matching mime type load the plug-in code into memory initialize the plug-in create a new instance of the plug-in gecko can load multiple instances of the same plug-in on a single page, or in several open windows at the same time.
... 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.
...the next section, how gecko finds plug-ins, describes these rules, and the following section, checking plug-ins by mime type, describes how you can use javascript to locate plug-ins yourself and establish which ones are to be registered for which mime types.
...And 12 more matches
IDBKeyRange - Web APIs
you can limit the range using lower and upper bounds.
... a key range can be a single value or a range with upper and lower bounds or endpoints.
... if the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded.
...And 12 more matches
Using XMLHttpRequest - Web APIs
some cases where dealing with non-text response types may involve some manipulation and analysis are outlined in the following sections.
... support for dom progress event monitoring of xmlhttprequest transfers follows the specification for progress events: these events implement the progressevent interface.
...the upload events are fired on the xmlhttprequest.upload object, as shown below: var oreq = new xmlhttprequest(); oreq.upload.addeventlistener("progress", updateprogress); oreq.upload.addeventlistener("load", transfercomplete); oreq.upload.addeventlistener("error", transferfailed); oreq.upload.addeventlistener("abort", transfercanceled); oreq.open(); note: progress events are not available for the file: protocol.
...And 12 more matches
ARIA Test Cases - Accessibility
tions: dragon 10 with firefox 3 and ie 8 beta 2 jaws 9 & 10 with firefox 3 jaws 9 & 10 with ie beta 2 nvda 0.6p2 with firefox 3 orca with firefox 3 window-eyes 7 with ie 8 beta 2 and firefox 3 voiceover (leopard) with safari 4.0.2 zoom (leopard) with safari 4.0.2, firefox 3.x and opera 9.x zoomtext 9.1 with firefox 3 and ie 8 beta 2 test case structure test cases are organized as follows: test case links test details expected at behavior markup notes results table at firefox ie opera safari jaws 9 - - - - jaws 10 - 1.
...when documenting an issue, please also list it in the relevant compatibility table below.
...mtext - - - - orca - - - - checkbox simple checkbox testcases: set aria-checked="false" for unchecked both remove or set attribute for unchecked case -- also includes an invalid and required checkbox hierarchical (newly added test not in test results yet) dojo nightly build expected at behavior: screen reader should speak the accessible name followed by both the type being checkbox and the state (checked, unchecked).
...And 12 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
the default flow is to arrange items by row.
...this means that they will contain the content added to them without causing an overflow.
...the following track listing will create an initial implicit row track as 100 pixels and a second as 200px.
...And 12 more matches
grid - CSS: Cascading Style Sheets
WebCSSgrid
constituent properties this property is a shorthand for the following css properties: grid-auto-columns grid-auto-flow grid-auto-rows grid-template-areas grid-template-columns grid-template-rows syntax /* <'grid-template'> values */ 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(au...
...to-fill, 50px); /* <'grid-template-rows'> / [ auto-flow && dense?
...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?
...And 12 more matches
Audio and Video Delivery - Developer guides
to deliver video and audio, the general workflow is usually something like this: check what format the browser supports via feature detection (usually a choice of two, as stated above).
... it's also possible to feed an <audio> element a base64 encoded wav file, allowing to generate audio on the fly: <audio id="player" src="data:audio/x-wav;base64,uklgrvc..."></audio> speak.js employs this technique.
...video element: if (navigator.mediadevices) { navigator.mediadevices.getusermedia({ video: true, audio: false }) .then(function onsuccess(stream) { var video = document.getelementbyid('webcam'); video.autoplay = true; video.srcobject = stream; }) .catch(function onerror() { alert('there has been a problem retreiving the streams - are you running on file:/// or did you disallow access?'); }); } else { alert('getusermedia is not supported in this browser.'); } to find out more, read our mediadevices.getusermedia page.
...And 12 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
WebHTMLElementimg
use both width and height to set the intrinsic size of the image, allowing it to take up space before it loads, to mitigate content layout shifts.
...below is a list of the image formats that are most commonly used on the web, as well as some older formats that should no longer be used, despite existing content possibly still using them.
... if the crossorigin attribute is specified, then a cors request is sent (with the origin request header); but if the server does not opt into allowing cross-origin access to the image data by the origin site (by not sending any access-control-allow-origin response header, or by not including the site's origin in any access-control-allow-origin response header it does send), then the browser marks the image as tainted and restricts access to its image data, preventing its usage in <canvas> elements.
...And 12 more matches
<input type="month"> - HTML: Hypertext Markup Language
WebHTMLElementinputmonth
<input> elements of type month create input fields that let the user enter a month and year allowing a month and year to be easily entered.
... for those of you using a browser that doesn't support month, the screenshot below shows what it looks like in chrome and opera.
... value a domstring representing the value of the month and year entered into the input, in the form yyyy-mm (four or more digit year, then a hyphen ("-"), followed by the two-digit month).
...And 12 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
WebHTMLElementlink
these provide useful hints to allow the browser to choose the most appropriate icon available.
...however, this isn't a good practice to follow; it makes more sense to separate your <link> elements from your body content, putting them in the <head>.
...the table below lists the valid values for this attribute and the elements or resources they apply to.
...And 12 more matches
Global attributes - HTML: Hypertext Markup Language
in addition to the basic html global attributes, the following global attributes also exist: xml:lang and xml:base — these are inherited from the xhtml specifications and deprecated, but kept for compatibility purposes.
...it can have the following values: off or none, no autocapitalization is applied (all letters default to lowercase) on or sentences, the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words, the first letter of each word defaults to a capital letter; all other letters default to lowercase characters, all letters should default to uppercase class a space...
...classes allows css and javascript to select and access specific elements via the class selectors or functions like the method document.getelementsbyclassname().
...And 12 more matches
Evolution of HTTP - HTTP
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).
... http/1.0 – building extensibility http/0.9 was very limited and both browsers and servers quickly extended it to be more versatile: versioning information is now sent within each request (http/1.0 is appended to the get line) a status code line is also sent at the beginning of the response, allowing the browser itself to understand the success or failure of the request and to adapt its behavior in consequence (like in updating or using its local cache in a specific way) the notion of http headers has been introduced, both for the requests and the responses, allowing metadata to be transmitted and making the protocol extremely flexible and extensible.
... at this point, a typical request and response looked like this: get /mypage.html http/1.0 user-agent: ncsa_mosaic/2.0 (windows 3.1) 200 ok date: tue, 15 nov 1994 08:12:31 gmt server: cern/3.0 libwww/2.17 content-type: text/html <html> a page with an image <img src="/myimage.gif"> </html> followed by a second connection and request to fetch the image (followed by a response to that request): get /myimage.gif http/1.0 user-agent: ncsa_mosaic/2.0 (windows 3.1) 200 ok date: tue, 15 nov 1994 08:12:32 gmt server: cern/3.0 libwww/2.17 content-type: text/gif (image content) these novelties have not been introduced as concerted effort, but as a try-and-see approach over the 1991-1995 period:...
...And 12 more matches
CSP: default-src - HTTP
for each of the following directives that are absent, the user agent looks for the default-src directive and uses this value for it: child-src connect-src font-src frame-src img-src manifest-src media-src object-src prefetch-src script-src script-src-elem script-src-attr style-src style-src-elem style-src-attr worker-src csp version 1 directive type fetch directive syntax one or more sources can be allowed for the default-src policy: content-security-policy: default-src <source>; content-security-policy: default-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name...
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 12 more matches
CSP: img-src - HTTP
syntax one or more sources can be allowed for the img-src policy: content-security-policy: img-src <source>; content-security-policy: img-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 12 more matches
Numbers and dates - JavaScript
decimal numbers 1234567890 42 // caution when using leading zeros: 0888 // 888 parsed as decimal 0777 // parsed as octal in non-strict mode (511 in decimal) note that decimal literals can start with a zero (0) followed by another decimal digit, but if every digit after the leading 0 is smaller than 8, the number gets parsed as an octal number.
... binary numbers binary number syntax uses a leading zero followed by a lowercase or uppercase latin letter "b" (0b or 0b).
... if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b".
...And 12 more matches
String.prototype.replace() - JavaScript
a number of special replacement patterns are supported; see the "specifying a string as a parameter" section below.
...the arguments supplied to this function are described in the "specifying a function as a parameter" section below.
... specifying a string as a parameter the replacement string can include the following special replacement patterns: pattern inserts $$ inserts a "$".
...And 12 more matches
eval() - JavaScript
see never use eval()!, below.
...in the following example, the string constructor is specified and eval() returns a string object rather than evaluating the string.
... eval() is also slower than the alternatives, since it has to invoke the javascript interpreter, while many other constructs are optimized by modern js engines.
...And 12 more matches
async function - JavaScript
for example, the following: async function foo() { return 1 } ...is equivalent to: function foo() { return promise.resolve(1) } the body of an async function can be thought of as being split by zero or more await expressions.
... in the following example, we successively await two promises.
... for example, in the following code an unhandled promise rejection error will be thrown, even if a .catch handler has been configured further along the promise chain.
...And 12 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
note: if you want to contribute to this document please follow the guidelines on the contribute page.
... <hbox> <label value="label1" flex="1" style="border: 1px solid;"/> <label value="label2" flex="2" style="border: 1px solid;"/> </hbox> listing 4: growing with flex figure 3: output of listing 4 ordinal within a xul box, elements will ordinarily be laid out following their order of appearance in the source code (laid out left to right or top to bottom).
... <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.
...And 11 more matches
MMgc - Archive of obsolete content
each instance manages its own set of objects; objects are not allowed to reference objects in other gc instances.
...see below.) class myobject : public mmgc::gcobject { ~myobject() { assert(!"this will never be hit (unless we also descend from gcfinalizedobject)"); } }; gcobject::getweakref gcweakref *getweakref() const; the getweakref method returns a weak reference to the object.
...it's best to avoid finalizers if you can, since finalization behavior can be unpredictable and nondeterministic, and also slows down the gc since the finalizers need to be invoked.
...And 11 more matches
Creating a Help Content Pack - Archive of obsolete content
the previous document had a lot of places where ideas were simply introduced without explanation, and i've tried to go through things a bit more slowly with better descriptions.
...insert into it the following text: <?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:rdf> if you're familiar with html or xml, you might recognize this as the container element for the whole document.
... next, you'll need to insert a rdf:description element into the file, inside the rdf:rdf element just created: <rdf:description rdf:about="urn:root" nc:title="" nc:defaulttopic="" nc:base=""> </rdf:description> fill in the attributes as follows: rdf:about must be urn:root or your pack won't work.
...And 11 more matches
Adding HTML Elements - Archive of obsolete content
remember that xml is case-sensitive though, so you'll have to enter the tags and attributes in lowercase.
...the attribute below should be added to the window tag of the xul file, or to the outermost html element.
...might be added to the find file window: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> then, you can use html tags as you would normally, keeping in mind the following: you must add a html: prefix to the beginning of each tag, assuming you declared the html namespace as above.
...And 11 more matches
CSS and JavaScript accessibility best practices - Learn web development
previous overview: accessibility next css and javascript, when used properly, also have the potential to allow for accessible web experiences ...
...the following sections summarize the main html features to consider.
... abbreviations an element that allows an abbreviation, acronym, or initialization to be associated with its expansion: <p>web content is marked up using <abbr title="hypertext markup language">html</abbr>.</p> again, you might want to style it in some simple way: abbr { color: #a60000; } the recognised styling convention for abbreviations is a dotted underline, and it is unwise to significantly deviate from this.
...And 11 more matches
Grids - Learn web development
the following video provides a nice visual explanation of using css grid: defining a grid as a starting point, download and open the starting point file in your text editor and browser (you can also see it live here).
...by default these display in normal flow so the boxes display one below the other.
...declaring display: grid gives you a one column grid, so your items will continue to display one below the other as they do in normal flow.
...And 11 more matches
Getting started with CSS - Learn web development
you can copy the code from below if you want to work on your own computer.
... save the code below as index.html in a folder on your machine.
...it contains an <em>emphasized</em> element.</p> <ul> <li>item one</li> <li>item two</li> <li>item <em>three</em></li> </ul> </body> </html> note: if you are reading this on a device or an environment where you can't easily create files, then don't worry — live code editors are provided below to allow you to write example code right here in the page.
...And 11 more matches
Choosing the right approach - Learn web development
further information introducing asynchronous javascript, in particular async callbacks settimeout() settimeout() is a method that allows you to run a function after an arbitrary amount of time has passed.
... further information cooperative asynchronous javascript: timeouts and intervals, in particular settimeout() settimeout() reference setinterval() setinterval() is a method that allows you to run a function repeatedly with a set interval of time between each execution.
... not as efficient as requestanimationframe(), but allows you to choose a running rate/frame rate.
...And 11 more matches
Introduction to events - Learn web development
in the following example, we have a single <button>, which when pressed, makes the background change to a random color: <button>change color</button> button { margin: 10px }; the javascript looks like so: const btn = document.queryselector('button'); function random(number) { return math.floor(math.random() * (number+1)); } btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + rand...
... the example output is as follows: it's not just web pages another thing worth mentioning at this point is that events are not unique to javascript — most programming languages have some kind of event model, and the way the model works often differs from javascript's way.
...the following works just the same: const btn = document.queryselector('button'); function bgchange() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } btn.onclick = bgchange; there are many different event handler properties available.
...And 11 more matches
Implementing feature detection - Learn web development
therefore, you can detect whether the browser supports geolocation or not by using something like the following: if ("geolocation" in navigator) { navigator.geolocation.getcurrentposition(function(position) { // show the location on a map, perhaps using the google maps api }); } else { // give the user a choice of static maps instead perhaps } it is probably better to use an established feature detection library however, rather than writing your own all the time.
...download the latest version (see manual installation), unzip the zip file, copy the html5shiv-printshiv.min.js and html5shiv.min.js files into your example directory, and link to one of the files by putting the following under your <title> element: <script src="html5shiv.min.js"></script> have a look at your example css files — you'll see that basic-styling.css handles all the styling that we want to give to every browser, whereas the other two css files contain the css we want to selectively apply to browser depending on their support levels.
... give it the following contents: const conditional = document.queryselector('.conditional'); const testelem = document.createelement('div'); if (testelem.style.flex !== undefined && testelem.style.flexflow !== undefined) { conditional.setattribute('href', 'flex-layout.css'); } else { conditional.setattribute('href', 'float-layout.css'); } here we are grabbing a reference to the second <link> element, and c...
...And 11 more matches
Command line options
each message option follows the syntax field=value, for example: to=foo@nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check 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 ( ).
... using command line options command line options follow the command to start the application.
...And 11 more matches
How Mozilla's build system works
the contents below will explain the basic concepts and terminology of the build system and how to do common tasks such as compiling components and creating jar files.
... when config.status runs, you'll see the following output: reticulating splines...
... to view information about the tiers, you can execute the following special make targets: command effect make echo-tiers show the final list of tiers.
...And 11 more matches
Localizing without a specialized tool
from the create a new localization document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (dtd and properties) used in the mozilla source code.
... with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation.
... repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version.
...And 11 more matches
DMD
look at the "trigger" section below to see the full list of ways to get a dmd report once you have it activated.
...for example, from javascript code you can do the following.
...with the following command.
...And 11 more matches
Power profiling overview
intel processor basics processor layout the following diagram (from the intel power governor documentation) shows how machines using recent intel processors are constructed.
... the important points are as follows.
...maintaining c-state residency is crucial to keep power consumption low, and so reducing wakeup frequency is one of the best ways to reduce power consumption.
...And 11 more matches
NSS Tools certutil
syntax to run the certificate database tool, type the command certutil option [arguments ] where options and arguments are combinations of the options and arguments listed in the following section.
...option arguments modify an action and are lowercase.
... certificate database tool command options and their arguments are defined as follows: options -n create new certificate and key databases.
...And 11 more matches
Scripting Java
it allows us to write powerful scripts quickly by making use of the many java libraries available.
...these packages are likely not in the java package, so you'll need to prefix the package name with "packages." for example, to import the org.mozilla.javascript package you could use importpackage() as follows: $ java org.mozilla.javascript.tools.shell.main js> importpackage(packages.org.mozilla.javascript); js> context.currentcontext; org.mozilla.javascript.context@bb6ab6 occasionally, you will see examples that use the fully qualified name of the package instead of importing using the importpackage() method.
...using a fully qualified name, the above example would look as follows: $ java org.mozilla.javascript.tools.shell.main js> jspackage = packages.org.mozilla.javascript; [javapackage org.mozilla.javascript] js> jspackage.context.currentcontext; org.mozilla.javascript.context@bb6ab6 alternatively, if you want to import just one class from a package you can do so using the importclass() method.
...And 11 more matches
Hacking Tips
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.
...x7fffefbbc250 typein:2 (0x7fffef1231c0 @ 24) #25158 0x7fffefbbc1c8 typein:3 (0x7fffef1231c0 @ 47) #25159 0x7fffefbbc140 typein:2 (0x7fffef1231c0 @ 24) #25160 0x7fffefbbc0b8 typein:3 (0x7fffef1231c0 @ 47) #25161 0x7fffefbbc030 typein:5 (0x7fffef123280 @ 9) note, you can do the exact same exercise above using lldb (necessary on osx after apple removed gdb) by running lldb -f js then following the remaining steps.
...to work-around this issue you can use the recording feature of gdb, to step one instruction, and settle back to where you came from with the following set of gdb commands: (gdb) record full (gdb) si (gdb) record goto 0 (gdb) record stop if you have a core file, you can use the gdb unwinder the same way, or do everything from the command line as follow: $ gdb -ex 'enable unwinder .* spidermonkey' -ex 'bt 0' -ex 'thread apply all backtrace' -ex 'quit' out/dist/bin/js corefile the gdb unwinder is supposed to be loaded by dist/bin/js-gdb.p...
...And 11 more matches
Shell global objects
console an object that has following property: log evaluate and print expressions to stdout.
...ename filename for error messages and debug info linenumber starting line number for error messages and debug info columnnumber starting column number for error messages and debug info global global in which to execute the code newcontext if true, create and use a new cx (default: false) catchtermination if true, catch termination (failure without an exception value, as for slow scripts or out-of-memory) and return 'terminated' element if present with value v, convert v to an object o and mark the source as being attached to the dom element o.
...if options is given, it may have any of the following properties: samezoneas the compartment will be in the same zone as the given object (defaults to a new zone) invisibletodebugger the global will be invisible to the debugger (default false) principal if present, its value converted to a number must be an integer that fits in 32 bits; use that as the new compartment's principal.
...And 11 more matches
Creating the Component Code
this interface provides yet another abstraction of the nsifactory object, and may allow for multiple nsifactory objects.
... basic structure of the weblock component source weblock1.cpp that defines these 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.
...for example, including nsicomponentmanager.idl without mozilla_strict_api defined will include the following headers, which are not supported across versions (unfrozen): nscomponentmanagerutils.h nscomponentmanagerobsolete.h these variables are picked up by files that do not specify themselves as mozilla_strict_api.
...And 11 more matches
nsIWindowMediator
a.org/appshell/window-mediator;1 as a service: var windowmediator = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); method overview void addlistener(in nsiwindowmediatorlistener alistener); boolean calculatezposition(in nsixulwindow inwindow, in unsigned long inposition, in nsiwidget inbelow, out unsigned long outposition, out nsiwidget outbelow); native code only!
... void setzposition(in nsixulwindow inwindow, in unsigned long inposition, in nsixulwindow inbelow); native code only!
... zlevelbelow 3 place window below some window.
...And 11 more matches
Index - Firefox Developer Tools
3 accessibility inspector accessibility, accessibility inspector, devtools, guide, tools the accessibility inspector provides a means to access important information exposed to assistive technologies on the current page via the accessibility tree, allowing you to check what's missing or otherwise needs attention.
...the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within.
... 7 dom inspector faq dom_inspector the file menu contains approaches which will allow you to inspect a document.
...And 11 more matches
BiquadFilterNode() - Web APIs
the biquadfilternode() constructor of the web audio api creates a new biquadfilternode object, which represents a simple low-order filter, and is created using the audiocontext.createbiquadfilter() method.
... options optional options are as follows: type: one of "lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass".
...the defaults for all are as follows: q: 1 detune: 0 frequency: 350 gain: 0 lowpass: (default) allows frequencies below a cutoff frequency to pass through, and attenuates frequencies above the cutoff.
...And 11 more matches
Using the CSS Painting API - Web APIs
registerpaint('headerhighlight', class { /* define if alphatransparency is allowed alpha is set to true by default.
... */ paint(ctx) { ctx.fillstyle = 'hsla(55, 90%, 60%, 1.0)'; ctx.fillrect(0, 15, 200, 20); /* order: x, y, w, h */ } }); in this class example we have defined a single context option with the contextoptions() function: we returned a simple object stating alpha transparency is allowed.
... we define the fillstyle as being hsla(55, 90%, 60%, 1.0), which is a shade of yellow, and then call fillrect() to create a rectangle of that color.
...And 11 more matches
Using microtasks in JavaScript with queueMicrotask() - Web APIs
in order to allow microtasks to be used by third-party libraries, frameworks, and polyfills, the queuemicrotask() method is exposed on the window and worker interfaces through the windoworworkerglobalscope mixin.
...the rest will have to wait until the following iteration.
...they're a highly specialized feature of modern browser-based javascript development, allowing you to schedule code to jump in front of other things in the long set of things waiting to happen on the user's computer.
...And 11 more matches
Streams API concepts - Web APIs
the streams api adds a very useful set of tools to the web platform, providing objects allowing javascript to programmatically access streams of data received over the network and process them as desired by the developer.
... readable streams a readable stream is a data source represented in javascript by a readablestream object that flows from an underlying source — this is a resource somewhere on the network or elsewhere on your domain that you want to get data from.
...an internal queue keeps track of the chunks that have not yet been read (see the internal queues and queuing strategies section below).
...And 11 more matches
WebGL model view projection - Web APIs
the first matrix discussed below is the model matrix, which defines how you take your original model data and move it around in 3d world space.
... the sections below offer an in-depth look into the ideas behind and implementation of the model, view, and projection matrices.
...the code below will create 2 triangles that will draw a square on the screen.
...And 11 more matches
Basic concepts behind Web Audio API - Web APIs
audio graphs the web audio api involves handling audio operations inside an audio context, and has been designed to allow modular routing.
...a simple, typical workflow for web audio would look something like this: create the audio context.
...the number after the period indicates the number of those channels which are reserved for low-frequency effect (lfe) outputs; these are often referred to as subwoofers.
...And 11 more matches
Migrating from webkitAudioContext - Web APIs
note: there is a library called webkitaudiocontext monkeypatch, which automatically fixes some of these changes to make most code targetting webkitaudiocontext to work on the standards based audiocontext out of the box, but it currently doesn't handle all of the cases below.
... if your code uses either of these names, like in the example below : // old method names var gain = context.creategainnode(); var delay = context.createdelaynode(); var js = context.createjavascriptnode(1024); you can simply rename the methods to look like this: // new method names var gain = context.creategain(); var delay = context.createdelay(); var js = context.createscriptprocessor(1024); the semantics of these methods remain the same in the renamed v...
... for example, if you have code like the below: var osc = context.createoscillator(); osc.noteon(1); osc.noteoff(1.5); var src = context.createbuffersource(); src.notegrainon(1, 0.25); src.noteoff(2); you can simply change it like this in order to port it to the standard audiocontext api: var osc = context.createoscillator(); osc.start(1); osc.stop(1.5); var src = context.createbuffersource(); src.start(1, 0.25); src.stop(2); remove sy...
...And 11 more matches
Accessibility documentation index - Accessibility
the following is intended to provide implementation guidance that respects screen readers developers' need to try different things.
... 5 aria annotations aria, accessibility, wai-aria, annotations, comments, details, suggestions wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations inside web documents.
...a few guidelines to follow that ensure better accessibility, like using drag and drop for placement of the widgets.
...And 11 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
luckily, css media queries level 5 will be a game-changer in accessibility initiatives, because it will allow users to select settings that accomodate their needs best.
... the rgb color model is extended to include “alpha” -- rgba -- to allow specification of the opacity of a color.
...for more on color contrast in animation, see three flashes or below threshold understanding sc 2.3.1 icons also need sufficient contrast for perception.
...And 11 more matches
Ordering Flex Items - CSS: Cascading Style Sheets
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.
...the specification continues with a warning not to use reordering to fix issues in your source: “authors must not use order or the *-reverse values of flex-flow/flex-direction as a substitute for correct source ordering, as that can ruin the accessibility of the document.” note: for some years firefox had a bug whereby it would attempt to follow the visual order and not the source order, making it behave differently to other browsers.
...And 11 more matches
Basic Shapes - CSS: Cascading Style Sheets
this type uses functional notation: the type of shape is followed by brackets, inside of which are additional values used to describe the shape.
...we will cover these in the examples below.
...in the screenshot below i have created a circle, using shape-outside: circle(50%).
...And 11 more matches
Value definition syntax - CSS: Cascading Style Sheets
the definition syntax describes which values are allowed and the interactions between them.
... bold [ thin && <length> ] this example matches the following values: bold thin 2vh bold 0 thin bold thin 3.5em but not: thin bold 3em, as bold is juxtaposed with the component defined by the brackets, it must appear before it.
... bold <length> , thin this example matches the following values: bold 1em, thin bold 0, thin bold 2.5cm, thin bold 3vh, thin but not: thin 1em, bold, as the entities must be in the expressed order bold 1em thin, as the entities are mandatory; the comma, a literal, must be present bold 0.5ms, thin, as the ms values are not <length> double ampersand separating two or more components, by a double ampersand, &&, means that all these entities are mandatory but may appear in any order.
...And 11 more matches
<color> - CSS: Cascading Style Sheets
a <color> can be defined in any of the following ways: using a keyword (such as blue or transparent) using the rgb cubic-coordinate system (via the #-hexadecimal or the rgb() and rgba() functional notations) using the hsl cylindrical-coordinate system (via the hsl() and hsla() functional notations) note: this article describes the <color> data type in detail.
... syntax the <color> data type is specified using one of the options listed below.
...word rgb hex value live keyword css level 1 black #000000 silver #c0c0c0 gray #808080 white #ffffff maroon #800000 red #ff0000 purple #800080 fuchsia #ff00ff green #008000 lime #00ff00 olive #808000 yellow #ffff00 navy #000080 blue #0000ff teal #008080 aqua #00ffff css level 2 (revision 1) orange #ffa500 css color module level 3 aliceblue #f0f8ff antiquewhite #faebd7 aquamarine #7fffd4 azure #f0ffff beige #f5f5dc bisque...
...And 11 more matches
text-transform - CSS: Cascading Style Sheets
it can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
... the text-transform property takes into account language-specific case mapping rules such as the following: in turkic languages, like turkish (tr), azerbaijani (az), crimean tatar (crh), volga tatar (tt), and bashkir (ba), there are two kinds of i, with and without the dot, and two case pairings: i/İ and ı/i.
... in greek (el), the lowercase sigma character has two forms: σ and ς.
...And 11 more matches
writing-mode - CSS: Cascading Style Sheets
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.
... 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 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).
...And 11 more matches
Creating a cross-browser video player - Developer guides
<source src="video/tears-of-steel-battle-clip-medium.ogg" type="video/ogg"> <!-- flash fallback --> <object type="application/x-shockwave-flash" data="flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" width="1024" height="576"> <param name="movie" value="flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" /> <param name="allowfullscreen" value="true" /> <param name="wmode" value="transparent" /> <param name="flashvars" value="controlbar=over&amp;image=img/poster.jpg&amp;file=flash-player.swf?videourl=video/tears-of-steel-battle-clip-medium.mp4" /> <img alt="tears of steel poster image" src="img/poster.jpg" width="1024" height="428" title="no video playback possible, please download the video ...
...from the link below" /> </object> <!-- offer download --> <a href="video/tears-of-steel-battle-clip-medium.mp4">download mp4</a> </video> <figcaption>&copy; blender foundation | <a href="http://mango.blender.org">mango.blender.org</a></figcaption> </figure> even though this player will define its own custom control set, the controls attribute is still added to the <video> element, and the player's default control set is switched off later with javascript.
... doing things this way still allows users who have javascript turned off (for whatever reason) to still have access to the browser's native controls.
...And 11 more matches
<input type="number"> - HTML: Hypertext Markup Language
WebHTMLElementinputnumber
step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below.
... a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max).
... the default stepping value for number inputs is 1, allowing only integers to be entered—unless the stepping base is not an integer.
...And 11 more matches
Standard metadata names - HTML: Hypertext Markup Language
WebHTMLElementmetaname
standard metadata names defined in the html specification the html specification defines the following set of standard metadata names: application-name: the name of the application running in the web page.
... standard metadata names defined in other specifications the css color adjustment specification defines the following metadata name: color-scheme: specifies one or more color schemes with which the document is compatible.
... the value of the content property for color-scheme may be one of the following: normal the document is unaware of color schemes and should simply be rendered using the default color palette.
...And 11 more matches
Content Security Policy (CSP) - HTTP
WebHTTPCSP
a csp compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling html attributes).
... as an ultimate form of protection, sites that want to never allow scripts to be executed can opt to globally disallow script execution.
... mitigating packet sniffing attacks in addition to restricting the domains from which content can be loaded, the server can specify which protocols are allowed to be used; for example (and ideally, from a security standpoint), a server can specify that all content must be loaded using https.
...And 11 more matches
Feature Policy - HTTP
feature policy allows web developers to selectively enable, disable, and modify the behavior of certain features and apis in the browser.
...this allows you to lock in best practices, even as the codebase evolves over time — as well as to more safely compose third-party content — by limiting which features are available.
... allow iframes to use the fullscreen api.
...And 11 more matches
CSP: connect-src - HTTP
syntax one or more sources can be allowed for the connect-src policy: content-security-policy: connect-src <source>; content-security-policy: connect-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 11 more matches
CSP: object-src - HTTP
to set allowed types for <object>, <embed>, and <applet> elements, use the plugin-types directive.
... elements controlled by object-src are perhaps coincidentally considered legacy html elements and aren't receiving new standardized features (such as the security attributes sandbox or allow for <iframe>).
... syntax one or more sources can be allowed for the object-src policy: content-security-policy: object-src <source>; content-security-policy: object-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...And 11 more matches
CSP: prefetch-src - HTTP
syntax one or more sources can be allowed for the prefetch-src policy: content-security-policy: prefetch-src <source>; content-security-policy: prefetch-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 11 more matches
CSP: script-src-attr - HTTP
syntax one or more sources can be allowed for the script-src-attr policy: content-security-policy: script-src-attr <source>; content-security-policy: script-src-attr <source> <source>; script-src-attr can be used in conjunction with script-src: content-security-policy: script-src <source>; content-security-policy: script-src-attr <source>; sources <source> can be one of the following: <host-source> internet hosts by name or...
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 11 more matches
CSP: script-src-elem - HTTP
syntax one or more sources can be allowed for the script-src-elem policy: content-security-policy: script-src-elem <source>; content-security-policy: script-src-elem <source> <source>; script-src-elem can be used in conjunction with script-src: content-security-policy: script-src <source>; content-security-policy: script-src-elem <source>; sources <source> can be one of the following: <host-source> internet hosts by name or...
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 11 more matches
Inheritance and the prototype chain - JavaScript
following the ecmascript standard, the notation someobject.[[prototype]] is used to designate the prototype of someobject.
...please note that the code below is free-standing (it is safe to assume there is no other javascript on the webpage other than the below code).
... for the best learning experience, it is highly recommended that you open a console, navigate to the "console" tab, copy-and-paste in the below javascript code, and run it by pressing the enter/return key.
...And 11 more matches
Enhanced Extension Installation - Archive of obsolete content
c:\program files\mozilla firefox\extensions extension metadata the extension system stores metadata in both of the two locations, in the following files: <location>/extensions/extensions.rdf - an xml/rdf datasource listing all the extensions installed at that location.
... the extension manager loads the xml/rdf datasources (this is allowable and necessary because a major change has happened) and gets a list of all items that need to be installed (tracked using a tobeinstalled flag on the item in the datasource).
... extension metadata the following files are now used to hold metadata: <profile>/extensions.ini -active items this file contains a list of active extension directories (i.e.
...And 10 more matches
Mozilla Application Framework in Detail - Archive of obsolete content
you may also further enhance the user interface by allowing 3rd parties to develop "themes" for your application.
...in addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets.
...xbl (extensible binding language) allows you to expand your library of interface elements, and even construct your own xml language for defining your ui.
...And 10 more matches
New Security Model for Web Services - Archive of obsolete content
if the sandbox is unable to distinguish the common uri substring of the domain to be trusted from similar uris of untrusted domains, then it could allow a script loaded from an indistinguishable domain to exploit firewall-protected resources.
...quite complex settings may be required to permit the user to allow access to desired external services without risking other resources.
... using a soap header for verification soap messages have a distinct processing model allowing a header to be added that the recipient is required to understand and accept, which identifies the untrusted source of a script making a request.
...And 10 more matches
Tamarin build documentation - Archive of obsolete content
tamarin source versions the following instructions are for obtaining and building the tamarin central source code.
... supported platforms tamarin currently supports the following operating systems and/or architectures.
... use the following command to create a copy of the tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-central tamarin-central tips for working with mercurial can be found here.
...And 10 more matches
XUL Events - Archive of obsolete content
« xul reference home the following tables and sections describe the event handler that are valid for most xul elements.
...when the user presses a key, the keydown event is sent first, followed by the keypress event and then the keyup event.
... attribute: oninput overflow this event is only sent to a box or other layout element with a css overflow property set to a value other than 'visible'.
...And 10 more matches
Templates - Archive of obsolete content
to allow the creation of elements based on rdf data, you need to provide a simple template which will be duplicated for each element that is created.
...for security reasons, mozilla doesn't allow access to them from other sources.
...the box has two special attributes that allow it to be used for templates, which are used to specify where the data comes from.
...And 10 more matches
XUL element attributes - Archive of obsolete content
« xul reference home the following attributes are common to all xul elements: align type: one of the values below the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children.
... allowevents type: boolean if true, events are passed to children of the element.
... allownegativeassertions type: boolean valid on any element that has a datasources attribute.
...And 10 more matches
Common Firefox theme issues and solutions - Archive of obsolete content
please see the following threads on mozillazine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 windows 7 aero not going into full screen mode properly on win7 with aero glass support firefox doesn't always go to full screen mode from a normal window properly.
... the resolution to this issue is to add the following code to your browser.css file somewhere below where the main-window is made transparent to support aero glass.
...in order to work around this issue, you need to either rename any of the following files that are in your chrome://browser/skin/ folder and fix any references to those files, or copy them to the folder chrome://browser/skin/lion/: keyhole-circle.png toolbar.png toolbarbutton-dropmarker.png tabbrowser/alltabs-box-bkgnd-icon.png tabview/tabview.png places/toolbar.png linux linux select box fields are showing both drop arrow and spinner arrows on linux: the styling ...
...And 10 more matches
Windows Media in Netscape - Archive of obsolete content
the following javascript illustrates one approach using object detection of activexobject and geckoactivexobject to determine if the windows media activex control is supported and available for use.
...below, some of the salient points are illustrated in a code snippet: if (window.activexobject && navigator.useragent.indexof('windows') != -1) { // ie for windows object instantiation -- use of activexobject } else if(window.geckoactivexobject) { // netscape 7.1 object instantiation --use of geckoactivexobject } else if(navigator.mimetypes) { // plugin architecture, such as in netscape 4x - 7.02 ...
...for the sake of brevity, we've made the following code snippet shorter to illustrate the relevant points about the api: var player; try { if(window.activexobject) { player = new activexobject("wmplayer.ocx.7"); } else if (window.geckoactivexobject) { player = new geckoactivexobject("wmplayer.ocx.7"); } } catch(e) { // handle error -- no wmp 7 or 9 control // can use wmp 6 also if necessary, but this is legacy software nowa...
...And 10 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.
...the liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line lengths on larger ones.
... 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.
...And 10 more matches
How to build custom form controls - Learn web development
if you want to learn more about this topic, you should check out the following helpful resources: uxmatters.com uxdesign.com the ux design section of smashingmagazine note: also, in most systems there is a way to open the <select> element with the keyboard to look at all the available choices (this is the same as clicking the <select> element with a mouse).
... the tabindex attribute is what allows the user to focus the control.
... .select { /* this will create a positioning context for the list of options; adding this to .select:focus-within will be a better option when fully supported */ position: relative; /* this will make our control become part of the text flow and sizable at the same time */ display : inline-block; } we need an extra class active to define the look and feel of our control when it is in its active state.
...And 10 more matches
Sending form data - Learn web development
client/server architecture at it's most basic, the web uses a client/server architecture that can be summarized as follows.
... in this example, the data is sent to an absolute url — https://example.com: <form action="https://example.com"> here, we use a relative url — the data is sent to a different url on the same origin: <form action="/somewhere_else"> when specified with no attributes, as below, the <form> data is sent to the same page that the form is present on: <form> note: it's possible to specify a url that uses the https (secure http) protocol.
... consider the following form: <form action="http://www.foo.com" method="get"> <div> <label for="say">what greeting do you want to say?</label> <input name="say" id="say" value="hi"> </div> <div> <label for="to">who do you want to say it to?</label> <input name="to" id="to" value="mom"> </div> <div> <button>send my greetings</button> </div> </form> since the get method has been used, ...
...And 10 more matches
Responsive images - Learn web development
a typical website may contain a header image and some content images below the header.
...in viewports below that width, the body will stay at 100% of the width of the viewport.
... the content images have been set so that if the body element becomes smaller than the image, the images start to shrink so that they always stay inside the body, rather than overflowing it.
...And 10 more matches
Basic math in JavaScript — numbers and operators - Learn web development
decimal is base 10 (meaning it uses 0–9 in each column), but we also have things like: binary — the lowest level language of computers; 0s and 1s.
...enter the commands listed below into your developer tools javascript console.
...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.
...And 10 more matches
Working with JSON - Learn web development
json is a text-based data format following javascript object syntax, which was popularized by douglas crockford.
...this allows you to construct a data hierarchy, like so: { "squadname": "super hero squad", "hometown": "metro city", "formed": 2016, "secretbase": "super tower", "active": true, "members": [ { "name": "molecule man", "age": 29, "secretidentity": "dan jukes", "powers": [ "radiation resistance", "turning tiny", "radiation blast" ] }, ...
...this is a very useful javascript object that allows us to make network requests to retrieve resources from a server via javascript (e.g.
...And 10 more matches
Getting started with React - Learn web development
this allows teams to set conventions that work best for them, and to adopt react in any way they would like to.
...adding a compiler like babel to a website makes the code on it run slowly, so developers often set up such tooling with a build step.
...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.
...And 10 more matches
Debugging on Mac OS X
this is due to notarization requiring hardened runtime to be enabled with the com.apple.security.get-task-allow entitlement disallowed.
...the differences are explained below.
...these builds enable hardened runtime and only differ from production builds in that they are not notarized which should not otherwise affect functionality, (other than the ability to easily launch the browser on macos 10.15+ -- see quarantine note below).
...And 10 more matches
How to implement a custom autocomplete search component
the component uses the autocompletesearchparam attribute or searchparam property to allow the developer to define the default directory otherwise only paths beginning with / or ~/ will be autocompleted.
...to do so you need the following: create an xpcom component that implements the nsiautocompletesearch interface.
... make sure the contract id of your xpcom component follows the following form: "@mozilla.org/autocomplete/search;1?name=xxx", where "xxx" is the name of your autocomplete source.
...And 10 more matches
Bootstrapping a new locale
hg allows localizers to work locally on their machines and then "push" changes to their official mozilla repository.
... (you should "cd" to the directory before beginning.) in the terminal, type the following command: $ hg clone http://hg.mozilla.org/releases/mozilla-x.x.x/ where "x.x.x" is the existing release branch version.
... if you are interested in localizing thunderbird 3, seamonkey 2 or other mozilla projects based on gecko 1.9.1 you'll need to follow the instructions on getting the source-code of the comm-central repository.
...And 10 more matches
Index
it allows mozilla localizers to easily check their work.
... 17 localization sign-off reviews guide, localization, mozilla this article presents an overview of why we do sign-off reviews of localizations, the details on the criteria used for the sign-off reviews, and the process for requesting a review and for following its progress.
... 18 localization technical reviews guide, localization, mozilla this guide provides details on what a localization technical review is, what criteria are used for the technical reviews, and the process for requesting one and following its progress.
...And 10 more matches
Mozilla DOM Hacking Guide
other browsers allow the history object to be used like an array, e.g.
...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.
...as an example, on the window object, we can call all the methods defined on the following interfaces: nsidomwindow, nsidomjswindow, nsidomeventreciever, nsidomeventtarget, nsidomviewcss, and nsidomabstractview.
...And 10 more matches
NSS environment variables
there is a separate set of environment variables that affect how nss is built, documented below.
... variable type description introduced in version nsrandcount integer (byte count) sets the maximum number of bytes to read from the file named in the environment variable nsrandfile (see below).
... before 3.0 nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 inside signatures.
...And 10 more matches
XForms Accessibility
get build subsections below explain how you can obtain accessible xforms-enabled build.
...see section below.
... build it yourself if you would like to build firefox/seamonkey yourself then please ensure your .mozconfig file has the following option: ac_add_options --enable-extensions=default,xforms,schema-validation how to test there are two approaches to test xforms accessibility.
...And 10 more matches
How to build an XPCOM component in JavaScript
here's the xpidl definition for our helloworld component: helloworld.idl #include "nsisupports.idl" [scriptable, uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] interface nsihelloworld : nsisupports { string hello(); }; note that you must generate a new uuid for each xpcom component that you create.
... {sdk_dir}/bin/xpidl -m typelib -w -v -i {sdk_dir}/idl -e helloworld.xpt helloworld.idl note: on windows you must use forward slashes for the include path.
... note: (the -i flag is an uppercase i, not a lowercase l.) this will create the typelib file helloworld.xpt in the current working directory.
...And 10 more matches
Using XPCOM Utilities to Make Things Easier
though they overlap somewhat (e.g., high-level macros expand to other macros), they fall into the following general categories.
...but they have the advantage of allowing much more rapid development.
... ns_impl_nsgetmodule_with_ctor(name, components, ctor) same as above but allows for a special function to be called when the module is created.
...And 10 more matches
Using Fetch - Web APIs
have a look at the following code: fetch('http://example.com/movies.json') .then(response => response.json()) .then(data => console.log(data)); here we are fetching a json file across the network and printing it to the console.
... supplying request options the fetch() method can optionally accept a second parameter, an init object that allows you to control a number of different settings: see fetch() for the full options available, and more details.
... mode: 'cors', // no-cors, *cors, same-origin cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached credentials: 'same-origin', // include, *same-origin, omit headers: { 'content-type': 'application/json' // 'content-type': 'application/x-www-form-urlencoded', }, redirect: 'follow', // manual, *follow, error referrerpolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url body: json.stringify(data) // body data type must match "content-type" header }); return response.json(); // parses json response into native javascript objects } postdata('htt...
...And 10 more matches
Pointer events - Web APIs
some sensing devices can detect the close proximity of the input device, and the state is expressed as a hover following the mouse.
... pointer capture pointer capture allows the events for a pointer to be retargeted to a particular element other than the normal hit test result of the pointer's location.
... the following sub-sections contain short descriptions of each interface and property.
...And 10 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
code an alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires.
...note that in either case, the actual delay may be longer than intended; see reasons for delays longer than specified below.
... note: passing additional parameters to the function in the first syntax does not work in internet explorer 9 and below.
...And 10 more matches
Cognitive accessibility - Accessibility
all of the following guidelines help more than just people with cognitive disabilities.
... for example, being able to extend the expiration time on an application requiring an authentication code sent to a mobile device via text message helps with the following scenarios: people with attention or anxiety disorders.
... time it is important to allow users the time they require to complete tasks.
...And 10 more matches
Web accessibility for seizures and physical reactions - Accessibility
in the article, "understanding wcag 2.0 three flashes or below threshold" notes generally that: “individuals who have photosensitive seizure disorders can have a seizure triggered by content that flashes at certain frequencies for more than a few flashes” and goes on to note, very specifically that: “people are even more sensitive to red flashing than to other colors, so a special test is provided for saturated red flashing”.
...the physical disorders listed below are all possible consequences: each of these physical reactions may be so severe as to be incapacitating.
...section 508 prohibits flickering effects with a frequency greater than 3 hz (flickers per second) and lower than 55 hz.
...And 10 more matches
Using CSS gradients - CSS: Cascading Style Sheets
the following are valid for all gradient functions: using more than two colors you don't have to limit yourself to two colors—you may use as many as you like!
... <div class="auto-spaced-linear-gradient"></div> div { width: 120px; height: 120px; } .auto-spaced-linear-gradient { background: linear-gradient(red, yellow, blue, orange); } positioning color stops you don't have to leave your color stops at their default positions.
... <div class="multiposition-stops"></div> <div class="multiposition-stop2"></div> div { width: 120px; height: 120px; float: left; margin-right: 10px; box-sizing: border-box; } .multiposition-stops { background: linear-gradient(to left, lime 20%, red 30%, red 45%, cyan 55%, cyan 70%, yellow 80% ); background: linear-gradient(to left, lime 20%, red 30% 45%, cyan 55% 70%, yellow 80% ); } .multiposition-stop2 { background: linear-gradient(to left, lime 25%, red 25%, red 50%, cyan 50%, cyan 75%, yellow 75% ); background: linear-gradient(to left, lime 25%, red 25% 50%, cyan 50% 75%, yellow 75% ); } in the first example above, the lime goes from the 0% mark...
...And 10 more matches
Using media queries - CSS: Cascading Style Sheets
media queries are used for the following: to conditionally apply styles with the css @media and @import at-rules.
... name summary notes any-hover does any available input mechanism allow the user to hover over elements?
... height height of the viewport hover does the primary input mechanism allow the user to hover over elements?
...And 10 more matches
Live streaming web audio and video - Developer guides
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).
... 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 looks like it's not keeping up, we drop down to a lower bandwidth (and consequently lower quality) stream.
...And 10 more matches
Challenge solutions - Developer guides
the sections below correspond to the titles of the tutorial sections.
... solution css supports common color names like orange, yellow, blue, green, or black.
... solution add a rule with an id selector of #second and a declaration color: blue;, as shown below: #second { color: blue; } a more specific selector, p#second also works.
...And 10 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
WebHTMLElementaudio
controls if this attribute is present, the browser will offer controls to allow the user to control audio playback, including volume, seeking, and pause/resume playback.
...the allowed values are: anonymous sends a cross-origin request without a credential.
...if the server does not give credentials to the origin site (by not setting the access-control-allow-origin: http header), the image will be tainted, and its usage restricted.
...And 10 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
WebHTMLElementvideo
controls if this attribute is present, the browser will offer controls to allow the user to control video playback, including volume, seeking, and pause/resume playback.
... the allowed values are nodownload, nofullscreen and noremoteplayback.
...the allowed values are: anonymous sends a cross-origin request without a credential.
...And 10 more matches
CSP: style-src-attr - HTTP
syntax one or more sources can be allowed for the style-src-attr policy: content-security-policy: style-src-attr <source>; content-security-policy: style-src-attr <source> <source>; style-src-attr can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-attr <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip addre...
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 10 more matches
CSP: style-src-elem - HTTP
syntax one or more sources can be allowed for the style-src-elem policy: content-security-policy: style-src-elem <source>; content-security-policy: style-src-elem <source> <source>; style-src-elem can be used in conjunction with style-src: content-security-policy: style-src <source>; content-security-policy: style-src-elem <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip a...
...unlike other values below, single quotes shouldn't be used.
... data: allows data: uris to be used as a content source.
...And 10 more matches
Feature-Policy: fullscreen - HTTP
the http feature-policy header fullscreen directive controls whether the current document is allowed to use element.requestfullscreen().
...this directive allows or prevents cross-origin frames from using fullscreen mode.
...via the allow attribute) and the allowfullscreen attribute are present on an <iframe> element, this directive takes precedence.
...And 10 more matches
Image file type and format guide - Web media technologies
however, the ones listed below are generally recognized as usable on the web, though bmp is generally not recommended as browser support is potentially constrained; it should usually be avoided for web content.
... image file type details the following sections provide a brief overview of each of the image file types supported by web browsers.
... in the tables below, the term bits per component refers to the number of bits used to represent each color component.
...And 10 more matches
Same-origin policy - Web security
(a "tuple" is a set of items that together comprise a whole — a generic form for double/triple/quadruple/quintuple/etc.) the following table gives examples of origin comparisons with the url http://store.company.com/dir/page.html: url outcome reason http://store.company.com/dir2/other.html same origin only the path differs http://store.company.com/dir/inner/another.html same origin only the path differs https://store.company.com/page.html failure different protocol ...
... for example, assume a script from the document at http://store.company.com/dir/other.html executes the following: document.domain = "company.com"; afterward, the page can pass the same-origin check with http://company.com/dir/page.html (assuming http://company.com/dir/page.html sets its document.domain to "company.com" to indicate that it wishes to allow that - see document.domain for more).
... note: when using document.domain to allow a subdomain to access its parent securely, you need to set document.domain to the same value in both the parent domain and the subdomain.
...And 10 more matches
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.
... if your add-on needs a lot of help from third party packages, low-level apis, or xpcom, then the cost of migrating is high, and may not be worth it at this point.
... by using the sdk's low-level apis you can directly modify the browser chrome.
...And 9 more matches
Preferences - Archive of obsolete content
if you haven't yet, read other documents about mozilla preferences on mdn (links below in resources section).
...look in the resources section below for the link to a list of preferences-related interfaces.
...here are the idl definitions: void getcomplexvalue(in string aprefname, in nsiidref atype, [iid_is(atype), retval] out nsqiresult avalue); void setcomplexvalue(in string aprefname, in nsiidref atype, in nsisupports avalue); as you can see, both of them take a parameter, atype, which can have one of the following values (to be precise, you should pass components.interfaces.nsiwhatever instead of just nsiwhatever, which is undefined).
...And 9 more matches
StringView - Archive of obsolete content
however, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats).
... 47 : 65; }; /* base64 string to array encoding */ stringview.bytestobase64 = function (abytes) { var eqlen = (3 - (abytes.length % 3)) % 3, sb64enc = ""; for (var nmod3, nlen = abytes.length, nuint24 = 0, nidx = 0; nidx < nlen; nidx++) { nmod3 = nidx % 3; /* uncomment the following line in order to split the output in lines 76-character long: */ /* if (nidx > 0 && (nidx * 4 / 3) % 76 === 0) { sb64enc += "\r\n"; } */ nuint24 |= abytes[nidx] << (16 >>> nmod3 & 24); if (nmod3 === 2 || abytes.length - nidx === 1) { sb64enc += string.fromcharcode(stringview.uint6tob64(nuint24 >>> 18 & 63), stringview.uint6tob64(nuint24 >>> 12 & 63), stringview.uint6t...
...the following table shows the behavior of the stringview constructor.
...And 9 more matches
Appendix D: Loading Scripts - Archive of obsolete content
below is an overview of the more common means of loading scripts, along with some of their primary advantages, disadvantages, quirks, and use cases.
... the examples below which make use of the services global assume that you're previously imported the services.jsm module.
...(a standalone xul window can use an onload attribute.) example the following overlay will load the script “overlay.js” from the same directory as the overlay file into the window which it overlays.
...And 9 more matches
Tabbed browser - Archive of obsolete content
openuilinkin( url, where, allowthirdpartyfixup, postdata, referrerurl ) where: "current" current tab (if there aren't any browser windows, then in a new window instead) "tab" new tab (if there aren't any browser windows, then in a new window instead) "tabshifted" same as "tab" but in background if default is to select new tabs, and vice versa "window" new window "save" save to disk (with no filename hint!) op...
...enuilink( url, e, ignorebutton, ignorealt, allowkeywordfixup, postdata, referrerurl ) the following code will open a url in a new tab, an existing tab, or an existing window based on which mouse button was pressed and which hotkeys (ex: ctrl) are being held.
...following this practice minimizes the proliferation of tabs and browsers created by your extension.
...And 9 more matches
Anonymous Content - Archive of obsolete content
a sample xbl binding for the file widget might look as follows: <binding id="fileupload"> <content> <html:input type="text"/> <html:input type="button"/> </content> </binding> because this content is not visible to its parent element, it is said to be anonymous content.
...whenever an element is inserted or appended, all insertion points are checked following all the same rules that applied when first placing explicit children during anonymous content generation.
...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.
...And 9 more matches
Positioning - Archive of obsolete content
default positioning of popups a top level menu popup is, by default, placed with the upper edge of the popup flush with the lower edge of the menu or button it is associated with.
... for both top level menus and submenus, they may appear above or to the left instead of their usual placement if there is not enough room to display the menu at full size below or to the right.
...these attributes are described below and function the same for all three elements.
...And 9 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
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.
...copy the following code.
... edit the file: installed-chrome.txt at the end of the file, add the following line.
...And 9 more matches
Document Object Model - Archive of obsolete content
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.
...for example, the following code will display the text 'message' in an alert twice.
...to do this, we can do the following: alert(window.opener.gettext()); each window has an opener property which holds the window object that opened this one.
...And 9 more matches
textbox - Archive of obsolete content
the disabled attribute is allowed only for form controls.
... hidespinbuttons type: boolean if true, the number box does not have arrow buttons next to it to allow the user to adjust the value.
... maxlength type: integer the maximum number of characters that the textbox allows to be entered.
...And 9 more matches
treecol - Archive of obsolete content
you can also place splitter elements between the columns to allow column resizing.
... attributes crop, cycler, dragging, editable, fixed, hidden, hideheader, ignoreincolumnpicker, label, primary, sort, sortactive, sortdirection, src, type, width properties accessibletype style classes treecol-image examples this example shows a checkbox in the first column, requires the style below.
...bel="name" flex="1" /> </treecols> <treechildren> <treeitem> <treerow> <treecell value="true"/> <treecell label="alice"/> </treerow> </treeitem> <treeitem> <treerow> <treecell value="false"/> <treecell label="bob"/> </treerow> </treeitem> </treechildren> </tree> to make the checkbox visible on some platforms, the following styles need to be added to the stylesheet (see treecol.type).
...And 9 more matches
window - Archive of obsolete content
this allows you to have a different icon for each window.
...e" value="enter last name:"/> <textbox id="your-lname" value="hernandez"/> </hbox> <hbox> <button oncommand="alert('save!')"> <description>save</description> </button> </hbox> </vbox> </radiogroup> </groupbox> </vbox> </window> attributes accelerated type: booleanset this attribute to true to allow hardware layer managers to accelerate the window.
... drawintitlebar type: boolean if this attribute is true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar.
...And 9 more matches
Mozilla XForms User Interface - Archive of obsolete content
elements from the "form controls" group allows users to interact with instance data.
...these attributes are combined into following logical groups.
...it can have the following representations: text field - default representation.
...And 9 more matches
Building up a basic demo with Babylon.js - Game development
add the following code to the bottom of your second <script> element: var engine = new babylon.engine(canvas); the babylon global object contains all the babylon.js functions available in the engine.
...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.
...let's start with the camera — add this line to your code below the scene creation and the line where we defined the clearcolor.
...And 9 more matches
Sizing items in CSS - Learn web development
we have given the image in the example below a border so that you can see the extent of the file.
...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.
...as we discovered in our previous lesson on overflow, a set height can cause content to overflow if there is more content than the element has space to fit inside it.
...And 9 more matches
Styling tables - Learn web development
link the css to the html by placing the following line of html inside your <head>: <link href="style.css" rel="stylesheet" type="text/css"> spacing and layout the first thing we need to do is sort out the spacing/layout — default table styling is so cramped!
... to do this, add the following css to your style.css file: /* spacing */ table { table-layout: fixed; width: 100%; border-collapse: collapse; border: 3px solid purple; } thead th:nth-child(1) { width: 30%; } thead th:nth-child(2) { width: 20%; } thead th:nth-child(3) { width: 15%; } thead th:nth-child(4) { width: 35%; } th, td { padding: 20px; } the most important parts to note are as follows: a table-layout value of fixed is generally a good idea to set on your table, as it makes the table behave a bit more predictably by default.
...the entire column width follows the width of its heading, making for a nice way to size your table columns.
...And 9 more matches
CSS FAQ - Learn web development
LearnCSSHowtoCSS FAQ
modern browsers have two main rendering modes: quirks mode: also called backwards-compatibility mode, allows legacy webpages to be rendered as their authors intended, following the non-standard rendering rules used by older browsers.
... standards mode: the browser attempts to follow the w3c standards strictly.
...css allows you to apply styles to particular id and/or class names.
...And 9 more matches
What are browser developer tools? - Learn web development
note: before you run through the examples below, open the beginner's example site that we built during the getting started with the web article series.
... you should have this open as you follow the steps below.
...(an added bonus: this method straight-away highlights the code of the element you right-clicked.) the inspector: dom explorer and css editor the developer tools usually open by default to the inspector, which looks something like the following screenshot.
...And 9 more matches
Styling web forms - Learn web development
these include the following elements: <form> <fieldset> and <legend> single-line text <input>s (e.g.
... note: there are some proprietary css pseudo-elements available that allow you to style internal components of these form controls, such as ::-moz-range-track, but these are not consistent across browsers, so can't be relied upon.
...to make your forms' appearance consistent with the rest of your content, you can add the following rules to your stylesheet: button, input, select, textarea { font-family: inherit; font-size: 100%; } the inherit property value causes the property value to match the computed value of the property of its parent element; inheriting the value of the parent.
...And 9 more matches
The web and web standards - Learn web development
they received a fair amount of interest, enough to convince timbl's bosses to allow him to go ahead and create a global hypertext system.
... in the next few years that followed, the web exploded, with multiple browsers being released, thousands of web servers being set up, and millions of web pages being created.
...after that other technologies followed such as css and javascript, and the web started to look more like the web we know today.
...And 9 more matches
HTML table advanced features and accessibility - Learn web development
you should put it just below the opening <table> tag.
...one clear way to do this is by using <thead>, <tfoot>, and <tbody>, which allow you to mark up a header, footer, and body section for the table.
...if you are using <col>/<colgroup> element, the table header should come just below those.
...And 9 more matches
Build your own function - Learn web development
type the following in your browser's javascript console, on any page you like: alert('this is a message'); the alert function takes a single argument — the string that is displayed in the alert box.
... note: for function naming conventions, you should follow the same rules as variable naming conventions.
... next, add the following inside the <script> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function.
...And 9 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
this includes allowing you to edit existing tasks, and filtering the list of tasks between all, completed, and incomplete tasks.
... a ui for editing in order to allow users to edit a task, we have to provide a user interface for them to do so.
...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 so far.
...And 9 more matches
Vue conditional rendering: editing existing todos - Learn web development
to do this, we will take advantage of vue's conditional rendering capabilities — namely v-if and v-else — to allow us to toggle between the existing todo item view, and an edit view where you can update todo item labels.
... copy the following code into that file: <template> <form class="stack-small" @submit.prevent="onsubmit"> <div> <label class="edit-label">edit name for &quot;{{label}}&quot;</label> <input :id="id" type="text" autocomplete="off" v-model.lazy.trim="newlabel" /> </div> <div class="btn-group"> <button type="button" class="btn" @click="oncancel"> cancel <span class="vi...
...osx-font-smoothing: grayscale; color: #0b0c0c; display: block; margin-bottom: 5px; } input { display: inline-block; margin-top: 0.4rem; width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } form { display: flex; flex-direction: row; flex-wrap: wrap; } form > * { flex: 0 0 100%; } </style> note: walk through the above code then read the below description to make sure you understand everything the component is doing before moving on.
...And 9 more matches
Deploying our app - Learn web development
netlify, amongst other things, also allows you to run pre-deployment tasks, which in our case means that all the production code build processes can be performed inside of netlify and if the build is successful, the website changes will be deployed.
...add the following line to your project now: "scripts": { ...
... you should now be able to run the following command in the root of your project directory to run the production build step (first quit the running process with ctrl + c if you need to): npm run build this should give you an output like the following, showing you the production files that were created, how big they are, and how long they took to build: dist/src.99d8a31a.js.map 446.15 kb 63ms dist/src.99d8a31a.js 172.51 kb 5.55s dist/stars.7f1dd035.svg 6.31 kb 145ms dist/asteriod2.3ead4904.svg 3.51 kb 155ms dist/asteriod1.698d75e9.svg 2.9 kb 153ms dist/src.84f2edd1...
...And 9 more matches
Client-side tooling overview - Learn web development
from a high-level perspective, you can put client-side tools into the following three broad categories of problems to solve: safety net — tools that are useful during your code development.
... a few very common safety net tool types you will find being used by developers are as follows.
... transformation this stage of your web app lifecycle typically allows you to code in either "future code" (such as the latest css or javascript features that might not have native support in browsers yet) or code using another language entirely, such as typescript.
...And 9 more matches
Software accessibility: Where are we today?
up until this point, the largest driving force behind desktop computing environments has been microsoft, first with ms dos, followed by variants of microsoft windows.
...here are some of the groups of people that have problems doing some of those tasks: print disabled: blind, deaf-blind, low vision, obstructed vision, dyslexic, cognitively disabled and illiterate individuals.
...some examples of these assistive devices and software include: screen reading software, which speaks text displayed on the screen using hardware or software text-to-speech, and which allows a blind person to use the keyboard to simulate mouse actions alternate input devices, which allow people with physical disabilities to use alternatives to a keyboard and mouse voice recognition software, which allows a person to simulate typing on a keyboard or selecting with a mouse by speaking into the computer screen magnification software, which allows a low-vision computer user to mor...
...And 9 more matches
The Firefox codebase: CSS Guidelines
most of the time, the common component already follows the a11y/theme standards defined in this guide.
... 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.
... 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.
...And 9 more matches
Error codes returned by Mozilla APIs
the following tables list errors that can occur when calling various mozilla apis.
...for example, by using components.results.ns_error_not_initialized general errors the following errors are general and can occur when using any component.
... ns_error_illegal_value (0x80070057) an argument supplied to a method was not valid, for instance a null value was supplied as an argument which does not allow null values, or a value was out of range.
...And 9 more matches
Overview of Mozilla embedding APIs
the component manager allows new instances of registered xpcom components to be instantiated.
...the webbrowser exposes a set of interfaces which allow the embedding application to control activity and respond to changes within this client area.
... public classes the following utility classes are available from the xpcom dll.
...And 9 more matches
HTTP Cache
//github.com/realityripple/uxp/blob/master/netwerk/cache2/nsicachestorageservice.idl "@mozilla.org/netwerk/cache-storage-service;1" provides methods accessing “storage” objects – see nsicachestorage below – giving further access to cache entries – see nsicacheentry more below – per specific url.
...urge any intermediate memory structures: clear – after it returns, all entries are no longer accessible through the cache apis; the method is fast to execute and non-blocking in any way; the actual erase happens in background purgefrommemory – removes (schedules to remove) any intermediate cache data held in memory for faster access (more about the intermediate cache below) nsiloadcontextinfo distinguishes the scope of the storage demanded to open.
... //github.com/realityripple/uxp/blob/master/netwerk/base/public/nsiloadcontextinfo.idl it is a helper interface wrapping following four arguments into a single one: private-browsing boolean flag anonymous load boolean flag app id number (0 for no app) is-in-browser boolean flag helper functions to create nsiloadcontextinfo objects: c++ consumers: functions at loadcontextinfo.h exported header js consumers: resource://gre/modules/loadcontextinfo.jsm module methods two storage objects created with the same set of nsiloadcontextinfo arguments are identical, containing the same cache entries.
...And 9 more matches
Extending a Protocol
unfortunately, it's not really fully documented anywhere - and the ipdl parser gets easily confused (hence us excluding comments below).
... creating the protocol pecho.ipdl let's start by saving the following file to ./dom/ipc/pecho.ipdl.
... we will explain what all the parts mean below.
...And 9 more matches
Mozilla Web Services Security Model
mozilla allows sites hosting such web services to tell mozilla that other sites can access the service.
...any errors in xml syntax, as well as many failures to follow the format, will cause the document to be ignored.
...this element must have either one delegate element child or any number (0 or more) of allow element children.
...And 9 more matches
A guide to searching crash reports
this brings up a search form like the one in the following screenshot.
... the default search: signature facet if you click on the "search" button, you will get results like the ones in the following screenshot.
...the links within the results do the following things.
...And 9 more matches
Introduction to NSPR
the netscape portable runtime (nspr) api allows compliant applications to use system facilities such as threads, thread synchronization, i/o, interval timing, atomic operations, and several other low-level services in a platform-independent manner.
... the current implementation of nspr allows developers to compile a single source code base on macintosh (ppc), win32 (nt 3.51, nt 4.0, win'95), and over twenty versions of unix.
... nspr naming conventions naming of nspr types, functions, and macros follows the following conventions: types exported by nspr begin with pr and are followed by intercap-style declarations, like this: print, prfiledesc function definitions begin with pr_ and are followed by intercap-style declarations, like this: pr_read, pr_jointhread preprocessor macros begin with the letters pr and are followed by all uppercase characters separated with the underscore character (_), like this: pr_bytes_per_short, pr_extern nspr threads nspr provides an execution environment that promotes the use of lightweight threads.
...And 9 more matches
NSS 3.12.6 release notes
the bug fixes in nss 3.12.6 are described in the "bugs fixed" section below.
... new in nss 3.12.6 ssl3 & tls renegotiation indication extension (rfc 5746) by default, nss 3.12.6 uses the new tls renegotiation indication extension for tls renegotiation but allows simple ssl/tls connections (without renegotiation) with peers that don't support the tls renegotiation indication extension.
... the behavior of nss for renegotiation can be changed through api function calls, or with the following environment variables: nss_ssl_enable_renegotiation values: [0|n|n]: ssl_renegotiate_never never allow renegotiation - that was the default for 3.12.5 release.
...And 9 more matches
sslerr.html
ssl_error_no_ciphers_supported -12265 "no cipher suites are present and enabled in this program." possible causes: (a) all cipher suites have been configured to be disabled, (b) the only cipher suites that are configured to be enabled are those that are disallowed by cipher export policy, (c) the socket is configured to handshake as a server, but the certificate associated with that socket is inappropriate for the key exchange algorithm selected.
... ssl_error_no_trusted_ssl_client_ca -12199 "no certificate authority is trusted for ssl client authentication." ssl_error_session_not_found -12198 "client's ssl session id not found in server's session cache." ssl_error_server_cache_not_configured -12185 "ssl server cache not configured and not disabled for this socket." ssl_error_renegotiation_not_allowed -12176 "renegotiation is not allowed on this ssl socket." received a malformed (too long or short or invalid content) ssl handshake: all the error codes in the following block indicate that the local socket received an improperly formatted ssl3 handshake message from the remote peer.
...eceived a malformed client key exchange handshake message." ssl_error_rx_malformed_finished -12252 "ssl received a malformed finished handshake message." ssl_error_rx_malformed_new_session_ticket -12178 "ssl received a malformed new session ticket handshake message." received a malformed (too long or short) ssl record: all the error codes in the following block indicate that the local socket received an improperly formatted ssl3 record from the remote peer.
...And 9 more matches
NSS Tools crlutil
syntax to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section.
...option arguments modify an action and are lowercase.
... certificate revocation list management tool command options and their arguments are defined as follows: options -g create new certificate revocation list(crl).
...And 9 more matches
Rhino Debugger
the rhino javascript debugger is a gui that allows debugging of interpreted javascript scripts run in rhino.
... controlling 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.
... 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 9 more matches
SpiderMonkey Build Documentation
(if you want to use spidermonkey as a library in your c++ application, or work on improving spidermonkey itself, do a developer/debug build instead, as described below.) cd js/src # this name should end with "_opt.obj" to make the version control system ignore it.
...refer the release notes under command line tools -> new features the release notes also states that this compatibility package will no longer be provided in the near future, so the build system on macos will have to be adapted to look for headers in the sdk until then, the following should help, open /library/developer/commandlinetools/packages/macos_sdk_headers_for_macos_10.14.pk this builds an executable named js in the directory build-release/dist/bin.
...thus, in addition to following the steps above, you should also create a debug build using these steps: cd js/src # this name should end with "_dbg.obj" to make the version control system ignore it.
...And 9 more matches
How to embed the JavaScript engine
a bare bones tutorial hello world sample embedding application the following code is a very simple application that shows how to embed spidermonkey and run a simple javascript script.
... see the instructions for building and running the sample below the code.
... spidermonkey 24 // following code might be needed in some case // #define __stdc_limit_macros // #include <stdint.h> #include "jsapi.h" /* the class of the global object.
...And 9 more matches
JSAPI User Guide
an overview of jsapi functionality follows.
...then it adds whatever custom classes, functions, and variables (like window) the application wants to provide; see custom objects below.
...the example below defines a very basic jsclass (named global_class) with no methods or properties of its own.
...And 9 more matches
JSAPI reference
_newcompartmentandglobalobject added in spidermonkey 1.8.1 obsolete since jsapi 16 js_entercrosscompartmentcall added in spidermonkey 1.8.1 obsolete since jsapi 18 js_leavecrosscompartmentcall added in spidermonkey 1.8.1 obsolete since jsapi 18 locale callbacks: struct jslocalecallbacks js_getlocalecallbacks js_setlocalecallbacks locale callback types: jslocaletouppercase jslocaletolowercase jslocalecompare jslocaletounicode scripts just running some javascript code is straightforward: class js::compileoptions added in spidermonkey 17 class js::owningcompileoptions added in spidermonkey 31 class js::readonlycompileoptions added in spidermonkey 31 class js::sourcebufferholder added in spidermonkey 31 js::evaluate added in spidermonkey 17 js_evaluatescript obsolet...
...rmatstring added in spidermonkey 17 class jserrorreport class js::autosaveexceptionstate added in spidermonkey 31 enum jsexntype added in spidermonkey 17 js_reporterror js_reportwarning js_reporterrornumber js_reporterrornumberuc js_reporterrorflagsandnumber js_reporterrorflagsandnumberuc js_reporterrornumberucarray added in spidermonkey 24 js_reportoutofmemory js_reportallocationoverflow added in spidermonkey 1.8 js_geterrorreporter js_seterrorreporterobsolete since jsapi 52 js_errorfromexception js_geterrorprototype jsreport_is_exception jsreport_is_strict jsreport_is_warning jsreport_is_strict_mode_error the following functions allow c/c++ functions to throw and catch javascript exceptions: js::createerror added in spidermonkey 38 js_isexceptionpending js_getpend...
...dermonkey 38 js::falsehandlevalue added in spidermonkey 38 jsval constants: jsval_null obsolete since jsapi 42 jsval_void obsolete since jsapi 42 jsval_true obsolete since jsapi 42 jsval_false obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolete since jsapi 42 function and macros for checking the type of a jsval: enum jstype js_typeofvalue all of the following are deprecated.
...And 9 more matches
Secure Development Guidelines
the following content will likely see significant revision, though can be used as a reference for security best practices to follow when developing code for mozilla.
...modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory saved return addr or function pointer get altered introduction: gaining control (3) common issues used to gain control buffer overflows format string bugs integer overflows/underflows writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation could save you without knowing it examples: if it doesn’t have to be negative, store it in an unsigned int if the input doesn’t have to be > 512, cut it off there if the i...
... xss: example the following snippet of javascript: document.write("welcome to " + document.location); ...
...And 9 more matches
A Web PKI x509 certificate primer
in order for a certificate to be valid these three requirements must be met: there is a verification path from the site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is considered trusted by the browser).
...this allows for a certificate to be used for more than one fqdn, for example you can have a certificate that is valid for both a.example.com and b.example.com basic constraints this allows certificates to be asserted as issuing certificates (it is mandatory for ca certificates).
...replace this value with the actual server name in the steps below.
...And 9 more matches
Using the Places history service
nsiautocompletesearch: url-bar autocomplete from history from 1.9.1 (firefox3.1) on, don't use any places service on (or after) quit-application has been notified, since the database connection will be closed to allow the last sync, and changes will most likely be lost.
... this separation of the global page information and the visit allows us to store information about each time the page was visited instead of just the last time.
... the "session id" allows these paths to be reconstructed more easily.
...And 9 more matches
nsINavHistoryService
to use this service, use: var historyservice = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsinavhistoryservice); method overview astring getpagetitle(in nsiuri auri); void markpageasfollowedbookmark(in nsiuri auri); void markpageasfollowedlink(in nsiuri auri); void markpageastyped(in nsiuri auri); boolean canadduri(in nsiuri auri); long long addvisit(in nsiuri auri, in prtime atime, in nsiuri areferringuri, in long atransitiontype, in boolean aisredirect, in long long asessionid); obsolete since gecko 22.0 nsinavhistoryquery getnewquer...
...this is much better than using browserhistory.count since that can be very slow if there is a lot of history (it must enumerate each item).
... constants transition type constants constant value description transition_link 1 this transition type means the user followed a link and got a new toplevel window.
...And 9 more matches
Performance
however, many things cause various database operations to be slow.
...this operation is extremely slow.
...the asynchronous writes discussed below removes most of the immediate penalty of a commit, so you will not notice the problem as much.
...And 9 more matches
Getting Started Guide
the following lists are good starting point, but by no means complete.
...all good getters addref the interface pointers they produce, thus providing you with an owning reference; you will hold onto the reference longer than the scope of the function in which you acquired it, e.g., you got it as a parameter, but you're hanging onto it in a member variable (see, for example, comparison 1, below).
...an nscomptr looks and acts as much like a raw xpcom interface pointer as c allows, but it knows it owns the object it points to.
...And 9 more matches
Index
the following preferences are supported to control how this gets logged: 30 gloda examples thunderbird 3, thunderbird this page provides some examples for using gloda.
...this allows exposure of mailnews-specific data to user interface using rdf templates.
...rss is implemented in js and doesn't follow the same pattern as the c++ protocols.
...And 9 more matches
Drawing shapes with canvas - Web APIs
below is the draw() function from the previous page, but now it is making use of these three functions.
...ample <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); ctx.fillrect(25, 25, 100, 100); ctx.clearrect(45, 45, 60, 60); ctx.strokerect(50, 50, 50, 50); } } this example's output is shown below.
...take a look at the smiley face below.
...And 9 more matches
EventTarget.addEventListener() - Web APIs
example of options usage html <div class="outer"> outer, once & none-once <div class="middle" target="_blank"> middle, capture & none-capture <a class="inner1" href="https://www.mozilla.org" target="_blank"> inner1, passive & preventdefault(which is not allowed) </a> <a class="inner2" href="https://developer.mozilla.org/" target="_blank"> inner2, none-passive & preventdefault(not open new page) </a> </div> </div> css .outer, .middle, .inner1, .inner2 { display: block; width: 520px; padding: 15px; margin: 15px; text-decoration: none; } .outer { border: 1px solid red; color: red; } .middle { border: 1px solid g...
...the benefits are as follows: it allows adding more than a single handler for an event.
... the alternative, older way to register event listeners, is described below.
...And 9 more matches
HTMLImageElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"...
...each candidate image is a url followed by a space, followed by a specially-formatted string indicating the size of the image.
...the page-local url is a pound (hash) symbol (#) followed by the id of the <map> element, such as #my-map-element.
...And 9 more matches
Using the Screen Capture API - Web APIs
ync function startcapture(displaymediaoptions) { let capturestream = null; try { capturestream = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); } catch(err) { console.error("error: " + err); } return capturestream; } you can write this code either using an asynchronous function and the await operator, as shown above, or using the promise directly, as seen below.
... see options and constraints, below, for more on both how to specify the type of surface you want as well as other ways to adjust the resulting stream.
... example of a window allowing the user to select a display surface to capture you can then use the captured stream, capturestream, for anything that accepts a stream as input.
...And 9 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
by importing this polyfill, we allow the example to work on many browsers that don't yet have webxr implementations in place, and we smooth out any transient deviations from the specification that occur during these still somewhat experimental days of the webxr specification.
...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.
... allowmouserotation if true, you can use the mouse to pitch and yaw the view angle.
...And 9 more matches
Using the Web Audio API - Web APIs
we'll briefly look at some concepts, then study a simple boombox example that allows us to load an audio track, play and pause it, and change its volume and stereo panning.
... example code our boombox looks like this: note the retro cassette deck with a play button, and vol and pan sliders to allow you to alter the volume and stereo panning.
... the web audio api handles audio operations inside an audio context, and has been designed to allow modular routing.
...And 9 more matches
Using Web Workers - Web APIs
in this section we'll discuss the javascript found in our basic dedicated worker example (run dedicated worker): this allows you to enter two numbers to be multiplied together.
... worker feature detection for slightly more controlled error handling and backwards compatibility, it is a good idea to wrap your worker accessing code in the following (main.js): if (window.worker) { ...
... in the worker, we can respond when the message is received by writing an event handler block like this (worker.js): onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } the onmessage handler allows us to run some code whenever a message is received, with the message itself being available in the message event's data attribute.
...And 9 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
the logical properties and values specification defines flow-relative mappings for the various margin, border, and padding properties and their shorthands.
...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.
... in the example below i have created two boxes and added different sized margins to each edge.
...And 9 more matches
Adding captions and subtitles to HTML5 video - Developer guides
the <track> element html5 allows us to specify subtitles for a video using the <track> element.
... the various attributes of this element allow us to specify such things as the type of content that we're adding, the language it's in, and of course a reference to the text file that contains the actual subtitle information.
... webvtt the files that contain the actual subtitle data are simple text files that follow a specified format, in this case the web video text tracks (webvtt) format.
...And 9 more matches
Audio and video manipulation - Developer guides
html <video id="my-video" controls src="myvideo.mp4" type="video/mp4"> </video> javascript var context = new audiocontext(), audiosource = context.createmediaelementsource(document.getelementbyid("my-video")), filter = context.createbiquadfilter(); audiosource.connect(filter); filter.connect(context.destination); // configure filter filter.type = "lowshelf"; filter.frequency.value = 1000; filter.gain.value = 25; playable code <video id="my-video" controls="true" width="480" height="270" crossorigin="anonymous"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type="video/mp4"> </video> <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"> filter.type = "lowshelf"; filter.frequency.value = 1000; filter.gain.value = 25;</textarea> var context = new audiocontext(), audiosource = context.createmediaelementsource(document.getelementbyid("my-video")), filter = context.createbiquadfilter(); audiosource.connect(filter); filter.connect(context.destination); var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code = textarea.value; function setfilter() { eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; setfilter(); }); edit.addeventlistener('...
... common audio filters these are some of the common types of audio filter you can apply: low pass: allows frequencies below the cutoff frequency to pass through and attenuates frequencies above the cutoff.
...And 9 more matches
CSP: font-src - HTTP
syntax one or more sources can be allowed for the font-src policy: content-security-policy: font-src <source>; content-security-policy: font-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 9 more matches
CSP: frame-src - HTTP
syntax one or more sources can be allowed for the frame-src policy: content-security-policy: frame-src <source>; content-security-policy: frame-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 9 more matches
CSP: manifest-src - HTTP
syntax one or more sources can be allowed for the manifest-src policy: content-security-policy: manifest-src <source>; content-security-policy: manifest-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 9 more matches
CSP: media-src - HTTP
syntax one or more sources can be allowed for the media-src policy: content-security-policy: media-src <source>; content-security-policy: media-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 9 more matches
HTTP Public Key Pinning (HPKP) - HTTP
some browsers might allow other hashing algorithms than sha-256 in the future.
... see below on how to extract this information out of a certificate or key file.
...this allows for changing the server's public key without breaking accessibility for clients that have already noted the pins.
...And 9 more matches
Closures - JavaScript
lexical scoping consider the following example code: function init() { var name = 'mozilla'; // name is a local variable created by init function displayname() { // displayname() is the inner function, a closure alert(name); // use variable declared in the parent function } displayname(); } init(); init() creates a local variable called name and a function called displayname().
... closure consider the following code example: function makefunc() { var name = 'mozilla'; function displayname() { alert(name); } return displayname; } var myfunc = makefunc(); myfunc(); running this code has exactly the same effect as the previous example of the init() function above.
...this has obvious parallels to object-oriented programming, where objects allow you to associate data (the object's properties) with one or more methods.
...And 9 more matches
Function.prototype.bind() - JavaScript
a bound function has the following internal properties: [[boundtargetfunction]] the wrapped function object [[boundthis]] the value that is always passed as this value when calling the wrapped function.
... when a bound function is called, it calls internal method [[call]] on [[boundtargetfunction]], with following arguments call(boundthis, ...args).
... where boundthis is [[boundthis]], args is [[boundarguments]], followed by the arguments passed by the function call.
...And 9 more matches
Install Manifests - Archive of obsolete content
id the id of the extension, which must be one of the following: guid (firefox 1.0) a string formatted like so: extensionname@example.org the latter format is significantly easier to generate and manipulate.
...these version strings are formatted in the same fashion as the version property and will be compared to the application version; this allows the extension author to specify which versions of firefox an extension has been tested with.
... examples <em:targetapplication> <description> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!--firefox--> <em:minversion>1.5</em:minversion> <em:maxversion>3.0.*</em:maxversion> </description> </em:targetapplication> gecko 1.9 based applications allow you to use the special targetapplication id toolkit@mozilla.org to say that the add-on is compatible with any toolkit app with a toolkit version matching the minversion and maxversion.
...And 8 more matches
Venkman Introduction - Archive of obsolete content
the interactive console also allows for execution of arbitrary javascript code.
...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 screenshot above—though you can customize the layout and presence of the different views however you want, as we describe in the view customization section below.
... the following section describes these views and their use within the interface as a whole.
...And 8 more matches
Element Positioning - Archive of obsolete content
there are a number of features that allow you to control the size of an element.
...an example is shown below: example 1: source view <button label="ok" width="100" height="40"/> however, it is not recommended that you do this.
...the following css properties can be used.
...And 8 more matches
Skinning XUL Files by Hand - Archive of obsolete content
following the instructions here, you are going to create a skin for a xul file and apply it by specifying classes for all of the interested elements.
...for example, when a button is defined as follows: <button class="plain" label="push me" /> then the following very simple style definition applies to that button.
... button.plain { border: 0px !important; } the global skin, in which styles for these several button classes and dozens of other elements are defined, is described in the following section.
...And 8 more matches
menuitem - Archive of obsolete content
attributes acceltext, accesskey, allowevents, autocheck, checked, closemenu, command, crop, description, disabled, image, key, label, name, selected, tabindex, type, validate, value properties accessibletype, accesskey, command, control, crop, disabled, image, label, labelelement, parentcontainer, selected, tabindex, value style classes menuitem-iconic, menuitem-non-iconic examples <menulist> <menupopup> <menuitem label="option 1" value="1"/> <menuitem label="option 2" value="2"/> <menuitem label="option 3" value="...
... allowevents type: boolean if true, events are passed to children of the element.
... closemenu type: one of the values below indicates if the menu closes when the menuitem is activated.
...And 8 more matches
tree - Archive of obsolete content
ArchiveMozillaXULtree
there are several ways in which trees are used, as listed below.
... if you would like to allow the tree to be horizontally scrolled, simply set the width attributes for each column to make the tree wider than its containing object.
... the disabled attribute is allowed only for form controls.
...And 8 more matches
Adobe Flash - Archive of obsolete content
the example below shows a detection heuristic in action.
... example 1: verifying the flash plugin version below, javascript identifies the version of flash, and whether it is scriptable in netscape gecko: can we have javascript in a wiki page?
...this is currently not the case, but 12 is a sufficiently high version number (current versions are version 6r.79) to allow for some leeway for fixing this down the road.
...And 8 more matches
XForms Custom Controls - Archive of obsolete content
it is possible to re-enable this by following the steps on using remote xul.
...to really grasp the following information, a good understanding of xforms, xbl, javascript and css is needed.
...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.
...And 8 more matches
Efficient animation for web games - Game development
this article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones.
... there are several techniques worth knowing that will improve the performance of your game or application whilst also using less battery life, especially on low-end devices.
...when you animate position with javascript, the browser cannot easily make that same assumption, and so you might end up causing it to draw only the newly-exposed region of content, which may introduce slow-down.
...And 8 more matches
Plug-in Development Overview - Gecko Plugin API Reference
a basic overview of the plug-in development process is given in the following steps.
...the following sections describe platform-specific discovery and registration: ms windows unix mac os x ms windows on windows, plug-ins are found according to the section how gecko finds plug-ins.
... to determine the mime types and file extensions that the plug-in handles, the browser normally uses the content of the registry entries for the plug-in described below in installation using the registry.
...And 8 more matches
What is accessibility? - Learn web development
overview: accessibility next this article starts the module off with a good look at what accessibility is — this overview 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.
...we traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections.
... other good practices that improve accessibility also make your site more usable by other groups, such as mobile phone users or those on low network speed.
...And 8 more matches
Test your skills: Selectors - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... selectors one without changing the html, use css to do the following things: make h1 headings blue.
... 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.
...And 8 more matches
Web fonts - Learn web development
in this article we will go further, exploring web fonts in detail — these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling.
...you can use the font stack to specify preferable fonts, followed by web-safe alternatives, followed by the default system font, but this adds overhead in terms of testing to make sure that your designs look ok with each font, etc.
...web fonts are a css feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that supports web fonts can have exactly the fonts you specify available to it.
...And 8 more matches
Advanced form styling - Learn web development
for example, let's take the following controls: <form> <p> <label for="search">search: </label> <input id="search" name="search" type="search"> </p> <p> <label for="text">text: </label> <input id="text" name="text" type="text"> </p> <p> <label for="date">date: </label> <input id="date" name="date" type="datetime-local"> </p> <p> <label for="radio">radio: </label> <input id="radio" nam...
...e="radio" type="radio"> </p> <p> <label for="checkbox">checkbox: </label> <input id="checkbox" name="checkbox" type="checkbox"> </p> <p><input type="submit" value="submit"></p> <p><input type="button" value="button"></p> </form> applying the following css to them removes system-level styling.
... the following live example shows you what they look like in your system — default on the left, and with the above css applied on the right (find it here also if you want to test it on other systems).
...And 8 more matches
Video and audio content - Learn web development
the <video> element the <video> element allows you to embed a video very easily.
... the paragraph inside the <video> tags this is called fallback content — this will be displayed if the browser accessing the page doesn't support the <video> element, allowing us to provide a fallback for older browsers.
... a webm file containing a movie which has a main video track and one alternate angle track, plus audio for both english and spanish, in addition to audio for an english commentary track can be conceptualized as shown in the diagram below.
...And 8 more matches
Handling text — strings in JavaScript - Learn web development
since the web is a largely text-based medium designed to allow humans to communicate and share information, it is useful for us to have control over the words that appear on it.
... html provides structure and meaning to our text, css allows us to precisely style it, and javascript contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more.
... 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.
...And 8 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
connecting the behavior in the footer to get the footer working, we need to implement the following thre areas of functionality: a pending todo counter.
...enter the following terminal command to do so: ember generate component-class footer next, go and find the newly-created todomvc/app/components/footer.js file and update it to the following: import component from '@glimmer/component'; import { inject as service } from '@ember/service'; export default class footercomponent extends component { @service('todo-data') todos; } now we need to go back to our todo-data.js file and add some functionality that will allow us to return the number of incomplete todos (useful for showing how many are left), and clear the completed to...
... in todo-data.js, add the following getter underneath the existing all() getter to define what the incomplete todos actually are: get incomplete() { return this.todos.filter(todo => { return todo.iscompleted === false; }); } using array.filter(), we declare that "incomplete" todos are ones that have iscompleted equal to false.
...And 8 more matches
Deployment and next steps - Learn web development
even if you are not planning to adopt it, this article will be useful for allowing you to learn what it has to offer and help you make your own decision.
...l `npm run start` once // the bundle has been generated !production && serve(), // watch the `public` directory and refresh the // browser on changes when not in production !production && livereload('public'), // if we're building for production (npm run build // instead of npm run dev), minify production && terser() ], there are many plugins for rollup that allow you to customize its behavior.
... note: the following section could be applied to any client-side static web site requiring a build step, not just svelte apps.
...And 8 more matches
Creating our first Vue component - Learn web development
create a <script></script> section below your template section.
...vue templates are currently only allowed a single root element — one element needs to wrap everything inside the template section (this will change when vue 3 comes out).
...add an id to the checkbox, and a for attribute mapping the checkbox to the label, as shown below.
...And 8 more matches
Introduction to cross browser testing - Learn web development
browsers are much better at following standards these days, but differences and bugs still creep through sometimes.
... some devices may have constraints that cause a web site to run slowly, or display badly.
...if your site includes a load of big animations, it might be ok on a high spec tablet, but might be sluggish or jerky on a low end device.
...And 8 more matches
Displaying Places information using views
places provides the following built-in views: tree menu toolbar instantiating the three built-in views are simply standard xul elements with a special type attribute whose value is "places".
... the following example uses the built-in tree view to display bookmarks whose titles or urls contain "mozilla".
... if you would like your tree view to be styled in the same manner that firefox styles its uses of the view, you should include the following stylesheet.
...And 8 more matches
Browser API
the html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications.
... navigation methods the following navigation methods allow navigation through the browsing history of the <iframe>.
... htmliframeelement.reload() allows reloading of the <iframe> element content.
...And 8 more matches
Getting Started with Chat
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.
... software there are several different applications which allow you to connect to irc networks.
... you will need to use the following information to configure the server connection: server: irc.mozilla.org port: 6667 (default) or 6697 (ssl) desktop clients desktop clients tens to allow the most detailed configuration.
...And 8 more matches
Internationalized Domain Names (IDN) Support in Mozilla Browsers
until recently domain names allowed only a subset of 7-bit ascii characters.
... idn allows host/domain names with non-ascii characters for user input into a browser's location bar or url's embedded in web pages.
... the process will convert uppercase characters to lowercase ones (case folding), unify characters with multiple representation, e.g.
...And 8 more matches
TimerFirings logging
set the following environment variable to enable it.
... the following sample shows the basics of this output.
...itytracker -991946880[7f46c365ba00]: [6775] fn timer (one_shot 250 ms): presshell::spaintsuppressioncallback -991946880[7f46c365ba00]: [6775] fn timer (one_shot 160 ms): nsbrowserstatusfilter::timeouthandler -991946880[7f46c365ba00]: [6775] iface timer (one_shot 200 ms): 7f46964d7f80 -1340643584[7f46c365ec00]: [6775] obs timer (slack 1000 ms): 7f46a95a0200 each line has the following information.
...And 8 more matches
about:memory
follow these steps.
... the use of trees allows measurements to be broken down into further categories, sub-categories, sub-sub-categories, etc., to arbitrary depth, as needed.
...if you find any particular tree overwhelming, it can be helpful to collapse all the sub-trees immediately below the root, and then gradually expand the sub-trees of interest.
...And 8 more matches
An overview of NSS Internals
in order to allow interoperability between software and devices that perform cryptographic operations, nss conforms to a standard called pkcs#11.
... (note that it's important to look at the number 11, as there are other pkcs standards with different numbers that define quite different topics.) a software or hardware module conforming to the pkcs#11 standard implements an interface of c calls, which allow querying the characteristics and offered services of the module.
...this strategy allows nss to work with many hardware devices (e.g., to speed up the calculations required for cryptographic operations, or to access smartcards that securely protect a secret key) and software modules (e.g., to allow to load such modules as a plugin that provides additional algorithms or stores key or trust information) that implement the pkcs#11 interface.
...And 8 more matches
NSS tools : certutil
arguments arguments modify a command option and are usually lower case, numbers, or symbols.
... -a use ascii format or allow the use of ascii format for input or output.
... this formatting follows rfc 1113.
...And 8 more matches
NSS tools : crlutil
to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section.
...the options and arguments for the crlutil command are defined as follows: -g create new certificate revocation list(crl).- -d delete certificate revocation list from cert database.
... -g arguments option arguments modify an action and are lowercase.
...And 8 more matches
NSS tools : crlutil
MozillaProjectsNSStoolscrlutil
to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section.
...the options and arguments for the crlutil command are defined as follows: -g create new certificate revocation list(crl).
... -g arguments option arguments modify an action and are lowercase.
...And 8 more matches
WebReplayRoadmap
the low level, yet flexible architecture (described here) provides an extremely powerful platform for implementing debugging and analysis features.
... time travel features more features are planned for the timeline, as described below.
... retroactive console logging offers a large improvement to this workflow.
...And 8 more matches
Animated PNG graphics
MozillaTechAPNG
error handling apng is designed to allow incremental display of frames before the entire image has been read.
...the 'actl' structure is described below.
...the full layout of 'fdat' and 'fctl' chunks is described below.
...And 8 more matches
nsIDOMWindowUtils
values correspond to the ime_status_* constants defined below.
... wheel_event_expected_overflow_delta_x_zero 0x0010 wheel_event_expected_overflow_delta_x_positive 0x0020 wheel_event_expected_overflow_delta_x_negative 0x0040 wheel_event_expected_overflow_delta_y_zero 0x0100 wheel_event_expected_overflow_delta_y_positive 0x0200 wheel_event_expected_overflow_delta_y_negative 0x0400 mousescroll_prefe...
... void forceupdatenativemenuat( in astring indexstring ); parameters indexstring garbagecollect() force a garbage collection followed by a cycle collection.
...And 8 more matches
Reference Manual
this allows source level debuggers to more easily "follow" the pointer.
...this section describes each of the possibilities, though the directives can be more succinctly described in the table below.
... you can construct an nscomptr from, or assign into it any of the following the value 0 another nscomptr of the same type a raw xpcom interface pointer of the same type a raw xpcom interface pointer of the same type, annotated with the dont_queryinterface directive a raw xpcom interface pointer of the same type, annotated with the dont_addref directive or a synonym any interface pointer (either nscomptr or a raw xpcom interface pointer) of any type, annotated with the do_queryinterface directive a do_queryreferent directive the first three of these are simple and obvious.
...And 8 more matches
Plug-in Development Overview - Plugins
a basic overview of the plug-in development process is given in the following steps.
...the following sections describe platform-specific discovery and registration: ms windows unix mac os x ms windows on windows, plug-ins are found according to the section how gecko finds plug-ins.
... to determine the mime types and file extensions that the plug-in handles, the browser normally uses the content of the registry entries for the plug-in described below in installation using the registry.
...And 8 more matches
Accessibility Inspector - Firefox Developer Tools
the accessibility inspector provides a means to access important information exposed to assistive technologies on the current page via the accessibility tree, allowing you to check what's missing or otherwise needs attention.
...while it’s running, it slows performance and takes up memory; therefore it interferes with the metrics from other panels such as memory and performance as well as overall browser performance.
...starting in firefox 79, it is automatically enabled when you do one of the following: choose accessibility in the tools > web developer menu.
...And 8 more matches
Debugger.Frame - Firefox Developer Tools
this allows the code using each debugger instance to place whatever properties it likes on its debugger.frame instances, without worrying about interfering with other debuggers.) when the debuggee pops a stack frame (say, because a function call has returned or an exception has been thrown from it), the debugger.frame instance referring to that frame becomes inactive: its live property becomes false, and a...
... a frame is a visible frame if any of the following are true: it is running debuggee code; its immediate caller is a frame running debuggee code; or it is a "debugger" frame, representing the continuation of debuggee code invoked by the debugger.
...even though the debuggee and debugger share the same javascript stack, frames pushed for spidermonkey’s calls to handler methods to report events in the debuggee are never considered visible frames.) invocation functions and “debugger” frames aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: debugger.object.prototype.call, debugger.frame.prototype.eval, and so on.
...And 8 more matches
Debugger.Script - Firefox Developer Tools
each of the following is represented by a single jsscript object: the body of a function—that is, all the code in the function that is not contained within some nested function.
...this allows the code using each debugger instance to place whatever properties it likes on its debugger.script instances, without worrying about interfering with other debuggers.) a debugger.script instance is a strong reference to a jsscript object; it protects the script it refers to from being garbage collected.
...many properties and methods below throw.
...And 8 more matches
MediaDevices.getUserMedia() - Web APIs
if the user denies permission, or matching media is not available, then the promise is rejected with notallowederror or notfounderror respectively.
... the following requests both audio and video without any specific requirements: { audio: true, video: true } if true is specified for a media type, the resulting stream is required to have that type of track in it.
...the following expresses a preference for 1280x720 camera resolution: { audio: true, video: { width: 1280, height: 720 } } the browser will try to honour this, but may return other resolutions if an exact match is not available, or the user overrides it.
...And 8 more matches
Typical use cases of Flexbox - CSS: Cascading Style Sheets
we either display the space outside of the items — therefore spacing them out with white space between or around them — or we absorb the extra space inside the items and therefore need a method of allowing the items to grow and take up this space.
... in the below live example we display the items at their natural size and by using justify-content: space-between make equal amounts of space between the items.
...in this case we would use the flex properties to allow items to grow and shrink in proportion to one another as described in controlling ratios of flex items along the main axis.
...And 8 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
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.
...in the below image you can see a track highlighted – this is the first row track in our grid.
...in this next example, my grid will consist of 10 tracks, a 1fr track, and then followed by a 2fr track.
...And 8 more matches
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
the logical properties and values specification introduces flow-relative mappings for many of the properties and values in css.
... this article introduces the specification, and explains flow relative properties and values.
...the logical properties and values specification defines mappings for these physical values to their logical, or flow relative, counterparts — e.g.
...And 8 more matches
Overview of CSS Shapes - CSS: Cascading Style Sheets
the specification defines three new properties: shape-outside — allows definition of basic shapes shape-image-threshold — sets an opacity threshold value.
... shape-margin — sets a margin around the defined shape defining basic shapes the shape-outside property allows us to a define a shape.
... in the following example i have an image floated left.
...And 8 more matches
conic-gradient() - CSS: Cascading Style Sheets
<angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis).
... note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients.
...if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the one that follows it.
...And 8 more matches
font-weight - CSS: Cascading Style Sheets
lighter; font-weight: bolder; /* numeric keyword values */ font-weight: 100; font-weight: 200; font-weight: 300; font-weight: 400;// normal font-weight: 500; font-weight: 600; font-weight: 700;// bold font-weight: 800; font-weight: 900; /* global values */ font-weight: inherit; font-weight: initial; font-weight: unset; the font-weight property is specified using any one of the values listed below.
...note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below.
...note that only four font weights are considered for relative weight calculation; see the meaning of relative weights section below.
...And 8 more matches
Constraint validation - Developer guides
by setting values on validation-related attributes, allowing basic constraints to be described in a simple way, without the need for javascript.
... validation-related attributes in addition to the type attribute described above, the following attributes are used to describe basic constraints: attribute input types supporting the attribute possible values constraint description associated violation pattern text, search, url, tel, email, password a javascript regular expression (compiled with the ecmascript 5 global, ignorecase, and multiline flags disabled) the value must match the pattern...
... 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 value must be less than or equal to the value rangeoverflow constraint violation date, month, week a valid date datetime, datetime-local, time a valid date and time required text, search, url, tel, email, password, date, datetime, datetime-local, month, week, time, number, checkbox, radio, file; also on the <select> and <textarea> elements none as it is a boolean attribute: its presence means true, its absenc...
...And 8 more matches
<input type="file"> - HTML: Hypertext Markup Language
WebHTMLElementinputfile
additional attributes in addition to the common attributes shared by all <input> elements, inputs of type file also support the following attributes: attribute description accept one or more unique file type specifiers describing file types to allow capture what source to use for capturing image or video data files a filelist listing the chosen files multiple a boolean which, if present, indicates that the user may choose more than one file accept the accep...
... multiple when the multiple boolean attribute is specified, the file input allows the user to select more than one file.
... non-standard attributes in addition to the attributes listed above, the following non-standard attributes are available on some browsers.
...And 8 more matches
<input type="tel"> - HTML: Hypertext Markup Language
WebHTMLElementinputtel
additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, telephone number inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum length, in utf-16 characters, to accept as a valid input minlength the minimum length that is considered valid for the field's contents pattern a regular expression the entered ...
... see pattern validation below for details and an example.
... non-standard attributes the following non-standard attributes are available to telephone number input fields.
...And 8 more matches
<input type="text"> - HTML: Hypertext Markup Language
WebHTMLElementinputtext
additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, text inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the inpu...
... "" (empty string) or no value follow the element's default behavior for spell checking.
... non-standard attributes the following non-standard attributes are also available on some browsers.
...And 8 more matches
<input type="time"> - HTML: Hypertext Markup Language
WebHTMLElementinputtime
additional attributes in addition to the attributes common to all <input> elements, time inputs offer the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options max the latest time to accept, in the syntax described under time value format min the earliest time to accept as a valid input readonly a boolean attribute which, if present, indicates that the cont...
... step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below.
... a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max).
...And 8 more matches
<input type="url"> - HTML: Hypertext Markup Language
WebHTMLElementinputurl
additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, url inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be considered valid pattern a regular expression the inpu...
... "" (empty string) or no value follow the element's default behavior for spell checking.
... non-standard attributes the following non-standard attributes are also available on some browsers.
...And 8 more matches
<meter>: The HTML Meter element - HTML: Hypertext Markup Language
WebHTMLElementmeter
content categories flow content, phrasing content, labelable content, palpable content.
... min the lower numeric bound of the measured range.
... low the upper numeric bound of the low end of the measured range.
...And 8 more matches
CSP: child-src - HTTP
syntax one or more sources can be allowed for the child-src policy: content-security-policy: child-src <source>; content-security-policy: child-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 8 more matches
CSP: worker-src - HTTP
syntax one or more sources can be allowed for the worker-src policy: content-security-policy: worker-src <source>; content-security-policy: worker-src <source> <source>; sources <source> can be one of the following: <host-source> internet hosts by name or ip address, as well as an optional url scheme and/or port number.
... data: allows data: uris to be used as a content source.
... mediastream: allows mediastream: uris to be used as a content source.
...And 8 more matches
Feature-Policy: geolocation - HTTP
the http feature-policy header geolocation directive controls whether the current document is allowed to use the geolocation interface.
...this directive allows or prevents cross-origin frames from accessing geolocation.
... syntax feature-policy: geolocation <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
...And 8 more matches
Indexed collections - JavaScript
creating an array the following statements create equivalent arrays: let arr = new array(element0, element1, ..., elementn) let arr = array(element0, element1, ..., elementn) let arr = [element0, element1, ..., elementn] element0, element1, ..., elementn is a list of values for the array's elements.
... to create an array with non-zero length, but without any items, either of the following can be used: // this...
...the following example illustrates this behavior.
...And 8 more matches
Assertions - JavaScript
types the following section is also duplicated on this cheatsheet.
...this is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space.
... /oo\b/ does not match the "oo" in "moon", because "oo" is followed by "n" which is a word character.
...And 8 more matches
Add to Home screen - Progressive web apps (PWAs)
add to home screen (or a2hs for short) is a feature available in modern browsers that allows a user to "install" a web app, ie.
...this guide explains how a2hs is used, and what you need to do as a developer to allow your users to take advantage of it.
... 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.
...And 8 more matches
Structural overview of progressive web apps - Progressive web apps (PWAs)
in this structural overview, we'll look at the features that make up a standard web application, as well as some design patterns you can follow when building your pwa.
... client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning.
... the website is slower on an initial visit, but can be faster to navigate.
...And 8 more matches
Introduction to using XPath in JavaScript - XPath
the existing documentation for this method is located at document.evaluate, but it is rather sparse for our needs at the moment; a more comprehensive examination will be given below.
...they are explained below in the section "specifying the return type." result: if an existing xpathresult object is specified, it will be reused to return the results.
... simple types when the desired result type in resulttype is specified as either: number_type - a double string_type - a string boolean_type - a boolean we obtain the returned value of the expression by accessing the following properties respectively of the xpathresult object.
...And 8 more matches
Modules - Archive of obsolete content
however, the following example shows how it can be used to load scripts from other locations: const { classes: cc interfaces: ci } = components; var instance = cc["@mozilla.org/moz/jssubscript-loader;1"]; var loader = instance.getservice(ci.mozijssubscriptloader); function loadscript(url) { loader.loadsubscript(url); } when a script is loaded, it is evaluated in the scope of the global object of the ...
...any property defined on the global object will be accessible from both scripts: // index.js: loadscript("www.foo.com/a.js"); foo; // => 3 // a.js: foo = 3; exporting names the script loader we obtained from the components object allows us load scripts from other locations, but its api is rather limited.
...the script loader we obtained from components allows us to do just that: function loadscript(url) { let global = {}; loader.loadsubscript(url, global); return global; } if present, the loadsubscript function evaluates the script to be loaded in the scope of the second argument.
...And 7 more matches
widget - Archive of obsolete content
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.
... allow object an optional object describing permissions for the content.
...And 7 more matches
Localization - Archive of obsolete content
see limitations below.
...hello_id= <blink>hello!</blink> localizing element attributes this feature is new in firefox 39 you can localize certain attributes of elements with an l10n-id by setting its value with l10n-id.attributename in the properties file like: hello_id.accesskey= h the following attributes are supported: accesskey alt label title placeholder further the localization of the aria attributes aria-label, aria-valuetext and aria-moz-hint are supported with the same aliases as on firefox os: arialabel ariavaluetext ariamozhint using localized strings in javascript to reference localized strings from your main add-on code, you do this: var _ = require("sdk/...
...in this scheme a language maps each distinct range of numbers on to one of up to six forms, identified by the following categories: zero, one, two, few, many, and other.
...And 7 more matches
JavaScript Object Management - Archive of obsolete content
we'll be using the placeholder 〈namespace〉 below.
... */ if (typeof 〈namespace〉 == "undefined") { var 〈namespace〉 = {}; }; note: the naming standard that we normally follow is that the first part of the namespace corresponds to the development group (or company), and the second to the specific project.
... however, most extensions are small projects by individuals, so these examples follow a more practical approach of having just one namespace with the project name.
...And 7 more matches
XPCOM Objects - Archive of obsolete content
this lower layer is called xulrunner, and it is a very powerful platform, providing a very robust development base for web-enabled, cross-platform applications.
... the fact that it allows to easily create os-independent applications is a big selling point for xulrunner.
...most of the objects and functions in the lower layers are hidden from the chrome; those that need to be publicized are exposed through xpcom components and interfaces.
...And 7 more matches
Source code directories overview - Archive of obsolete content
rhapsody contains source code for mac os x server (which is based on nextstep which is based on x-windows on unix) using yellow box (cocoa).
...this will be covered below.
... db contains c code for the mdb/mork database which is a low-level, general-purpose and cross-platform file library.
...And 7 more matches
Drag and Drop JavaScript Wrapper - Archive of obsolete content
you can look at the contents of these files to see how drag and drop is done at a lower level.
...the following is an example of calling the nsdraganddrop object.
...if we wanted to handle the other cases also, we can call the other functions, as in the following example: <description value="click and drag this text." ondraggesture="nsdraganddrop.startdrag(event,textobserver)" ondragover="nsdraganddrop.dragover(event,textobserver)" ondragexit="nsdraganddrop.dragexit(event,textobserver)" ondragdrop="nsdraganddrop.drop(event,textobserver)" /> as mentioned earlier, there is nothing special that happens ...
...And 7 more matches
JavaScript crypto - Archive of obsolete content
using the mozilla crypto object from javascript mozilla defines a special javascript object to allow web pages access to certain cryptographic-related services.
... web sites which use ssl clientauth login could use the following code to refresh the page on token insertions and removals: <!doctype html> <p>...
...this allows the page to automatically login and logout based on the presence of the smartcard.
...And 7 more matches
Space Manager Detailed Design - Archive of obsolete content
*/ void clearregions(); /** * methods for dealing with the propagation of float damage during * reflow.
... */ void clearregions(); float impact /** * methods for dealing with the propagation of float damage during * reflow.
...this will be the y offset of the frame that is being reflowed.
...And 7 more matches
Menus - Archive of obsolete content
the following is a brief summary of these elements, examples of each will be provided later.
...clicking the button will display the menu, allowing a command to be selected.
... menu tag overview the following shows a simple menu example, containing a menubar with a single menu labeled 'file'.
...And 7 more matches
OpenClose - Archive of obsolete content
for menupopups attached to other elements using the popup or context attributes, see opening a popup below.
... there are several situations when opening a menu is not allowed.
...for menupopups attached to other elements using the popup or context attributes, see closing a popup below.
...And 7 more matches
Result Generation - Archive of obsolete content
in the picture below, you can see that node a at the top has arcs pointing to b, c and d.
...to navigate around, you could start at node a and navigate around the graph following the arrows to b, c or d.
...no requirement exists to follow the arrows in the direction they point; you can easily go the other way (though in only one direction within a given series of iterations).
...And 7 more matches
textbox (Toolkit autocomplete) - Archive of obsolete content
the example below will create an autocomplete textbox that will search the user's history.
... the disabled attribute is allowed only for form controls.
... maxlength type: integer the maximum number of characters that the textbox allows to be entered.
...And 7 more matches
Advanced Rules - Archive of obsolete content
the simple rule syntax is really just a shortcut for the full rule syntax which is described below.
...the syntax of the content element is as follows: <content uri="?var"/> the question mark indicates that the text following it is a variable.
...let's say you have a list of cities described in the following rdf/xml fragment: <rdf:seq about="http://www.xulplanet.com/rdf/weather/cities"> <rdf:li resource="http://www.xulplanet.com/rdf/weather/city/paris"/> <rdf:li resource="http://www.xulplanet.com/rdf/weather/city/manchester"/> <rdf:li resource="http://www.xulplanet.com/rdf/weather/city/melbourne"/> <rdf:li resource="http://www.xulplanet.com/rdf/weather/city/kiev"/> </rdf:seq> <rdf:description about="http://www.xulplanet.com...
...And 7 more matches
Manifest Files - Archive of obsolete content
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.
...three overlays are also specified, which allow content from different packages to combine together.
...add the following to the file: content findfile file:///findfile/content/ skin findfile classic/1.0 file:///findfile/skin/ locale findfile en-us file:///findfile/locale/ create the new directories listed above.
...And 7 more matches
Splitters - Archive of obsolete content
it creates a skinny bar between two sections which allows these sections to be resized.
... you can place a splitter anywhere you want and it will allow resizing of the elements that come before it and the elements that come after it in the same box.
... when a splitter is placed inside a horizontal box, it will allow resizing horizontally.
...And 7 more matches
XUL Questions and Answers - Archive of obsolete content
the following bugs were reported on this issue: bug 22942, bug 133698.
... a scheme is in development to allow servers to open up their site for cross-site access, but that's not yet done.
...the following is the code they wrote: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="test-window" title="check list test" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <listbox rows="4"> <listhead> <listheader label="multi-column"/> </listhead> <listcols> <listcol flex="1"/> </l...
...And 7 more matches
XUL Event Propagation - Archive of obsolete content
the following image describes in a very basic way how the various actors in the event model interact with one another.
... the combination of basic these two basic event flow mechanisms, event bubbling and event capturing, mean that events raised in the interface can be caught anywhere above the element that raised the event.
... the widget hierarchy consider the following xul file: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="events" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" oncommand="alert('window handler')"> <vbox> <vbox style="background-color: lightgrey;" oncommand="alert('box handler')"> <menu class="menu" label="file" oncommand="alert('menu handler')"> <menupopup> <menuitem oncommand="alert('new item alert')" label="new" /> <menuitem label="open" /> <menuitem oncommand="alert('close handler')" label="close" /> </menupopup> </menu> <menu class="menu" label="edit"> <...
...And 7 more matches
TCP/IP Security - Archive of obsolete content
when a user wants to transfer data across networks, the data is passed from the highest layer through intermediate layers to the lowest layer, with each layer adding information.
... the lowest layer sends the accumulated data through the physical network; the data is then passed up through the layers to its destination.
... essentially, the data produced by a layer is encapsulated in a larger container by the layer below it.
...And 7 more matches
XForms Input Element - Archive of obsolete content
mozilla extensions labelposition - only for boolean types: show the label before or after the checkbox (see below) type restrictions the input element can be bound to a node containing simple content of any data type except xsd:base64binary, xsd:hexbinray or any data type derived from these.
... representations the xforms input element can be represented by the following widgets for the spcified data types (or types derived from these data types): text field - the default widget when no type is specified or the data is of type xsd:string (xhtml/xul) checkbox - used for xsd:boolean instance data.
... of type xsd:date (xhtml/xul) calendar - used to represent data of type xsd:date when appearance attribute also has the value 'full' (xhtml/xul) month list - used to represent data of type xsd:gmonth (xhtml only) days list - used to represent data of type xsd:gday (xhtml only) number field - used to represent data of numeric type (fx 3.0 only, xul only) more detail about each of these widgets follows below.
...And 7 more matches
Building up a basic demo with A-Frame - Game development
mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascript or glsl.
... html structure the first step is to create an html document — inside your project directory, create a new index.html file, and save the follow html inside it: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: a-frame demo</title> <script src="aframe.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this contains some basic information like the document charset and <title>.
...add the following html before the <a-cube> element: <a-sky color="#dddddd"></a-sky> at this point, if you save the code and refresh your browser you can already see the cube on the screen with our custom background: here's the code we have created so far: you can also check it out on github.
...And 7 more matches
Player paddle and controls - Game development
loading the paddle first, add the paddle variable we will be using in our game, right after the ball variable: var paddle; then, in the preload function, load the paddle image by adding the following new load.image() call: function preload() { // ...
... rendering the paddle, with physics next up, we will init our paddle by adding the following add.sprite() call inside the create() function — add it right at the bottom: paddle = game.add.sprite(game.world.width*0.5, game.world.height-5, 'paddle'); we can use the world.width and world.height values to position the paddle exactly where we want it: game.world.width*0.5 will be right in the middle of the screen.
...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.
...And 7 more matches
Basic native form controls - Learn web development
the following screenshot shows default, focused and disabled text input types in firefox 71 and safari on macos and in chrome 79 and edge 18 on windows 10.
... the following screenshots show default, focused and disabled checkboxes in firefox 71 and safari 13 on macos and chrome 79 and edge 18 on windows 10: note: any checkboxes and radio buttons with the checked attribute on load match the :default pseudo class, even if they are no longer checked.
...> <li> <label for="soup">soup</label> <input type="radio" id="soup" name="meal" value="soup" checked> </li> <li> <label for="curry">curry</label> <input type="radio" id="curry" name="meal" value="curry"> </li> <li> <label for="pizza">pizza</label> <input type="radio" id="pizza" name="meal" value="pizza"> </li> </ul> </fieldset> the following screenshots show unchecked and checked radio buttons, radio buttons that have focus, and disabled unchecked and checked radio buttons — on firefox 71 and safari 13 on macos and chrome 79 and edge 18 on windows 10.
...And 7 more matches
Adding vector graphics to the Web - Learn web development
previous overview: multimedia and embedding next vector graphics are very useful in many circumstances — they have small file sizes and are highly scalable, so they don't pixelate when zoomed in or blown up to a large size.
...the svg format allows us to create powerful vector graphics for use on the web.
...more advanced svg features include <fecolormatrix> (transform colors using a transformation matrix,) <animate> (animate parts of your vector graphic,) and <mask> (apply a mask over the top of your image.) as a simple example, the following code creates a circle and a rectangle: <svg version="1.1" baseprofile="full" width="300" height="200" xmlns="http://www.w3.org/2000/svg"> <rect width="100%" height="100%" fill="black" /> <circle cx="150" cy="100" r="90" fill="blue" /> </svg> this creates the following output: from the example above, you may get the impression that svg is easy to handcode.
...And 7 more matches
Making asynchronous programming easier with async and await - Learn web development
try typing the following lines into your browser's js console: function hello() { return "hello" }; hello(); the function returns "hello" — nothing special, right?
...try the following: async function hello() { return "hello" }; hello(); ah.
...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.
...And 7 more matches
Storing the information you need — Variables - Learn web development
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.
...you do this by typing the variable name, followed by an equals sign (=), followed by the value you want to give it.
... a couple of simple differences are explained below.
...And 7 more matches
Inheritance in JavaScript - Learn web development
defining a teacher() constructor function the first thing we need to do is create a teacher() constructor — add the following below the existing code: function teacher(first, last, age, gender, interests, subject) { person.call(this, first, last, age, gender, interests); this.subject = subject; } this looks similar to the person constructor in many ways, but there is something strange here that we've not seen before — the call() function.
... this function basically allows you to call a function defined somewhere else, but in the current context.
...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 properties by doing this (as well as the other steps described below, of course): function blueglassbrick() { brick.call(this); this.opacity = 0.5; this.color = 'blue'; } note that we've only specified this inside call() — no other parameters are required as we are not inheriting any properties from the parent that are set via parameters.
...And 7 more matches
Website security - Learn web development
cross-site scripting (xss) xss is a term used to describe a class of attacks that allow an attacker to inject client-side scripts through the website into the browsers of other users.
... sql injection sql injection vulnerabilities enable malicious users to execute arbitrary sql code on a database, allowing data to be accessed, modified, or deleted irrespective of the user's permissions.
...for example, the following code is intended to list all users with a particular name (username) that has been supplied from an html form: statement = "select * from users where name = '" + username + "';" if the user specifies a real name, the statement will work as intended.
...And 7 more matches
Ember app structure and componentization - Learn web development
this already exists, and its contents currently look like so: {{!-- the following component displays ember's default welcome message.
...to start with, delete the contents of application.hbs and replace them with the following: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" placeholder="what needs to be done?" autofocus > </section> note: aria-label provides a label for assistive technology to make use of — for example, for a screenreader to read out.
...r class="footer"> <span class="todo-count"> <strong>0</strong> todos left </span> <ul class="filters"> <li> <a href="#">all</a> <a href="#">active</a> <a href="#">completed</a> </li> </ul> <button type="button" class="clear-completed"> clear completed </button> </footer> </section> the rendered output should now be as follows: this looks pretty complete, but remember that this is only a static prototype.
...And 7 more matches
PromiseWorker.jsm
javascript files imported into the worker scope and main thread scope which allows posting to the worker and receiving in the form of a promise.
...the following sections tell you which content to use in your worker and main thread files, in order to use promiseworker objects.
...the code below is what should be copied and pasted: importscripts('resource://gre/modules/workers/require.js'); let promiseworker = require('resource://gre/modules/workers/promiseworker.js'); // instantiate abstractworker (see below).
...And 7 more matches
Sqlite.jsm
sqlite.jsm offers some compelling advantages over the low-level storage xpcom interfaces: automatic statement management.
...sqlite.jsm exposes a transaction api built on top of task.jsm that allows transactions to be written as procedural javascript functions (as opposed to a series of callback driven operations).
...however, sharing also requires connections to obtain a lock, possibly making database access slower.
...And 7 more matches
Translation phase
projects the mozilla projects and their l10n workflows are divided into these groups: mozilla applications, mozilla websites, and add-ons.
... below you'll find the list of all mozilla projects, their associated l10n tools, and links to tutorials outlining their workflows.
...each l10n tool follows a different workflow for localizing mozilla application projects.
...And 7 more matches
MathML Accessibility in Mozilla
this table below provides a list of mathml constructions and how they are read in mozilla applications for various platforms: windows: mathml support is provided by nvda, which actually delegates math reading to the proprietary mathplayer plugin.
...subscript b superscript c a base b subscript c superscript scripted ab __________ a with b below __________ a.
...overscript b a base b overscript scripted abc __________ a with b below and with c above __________ a, with c underneath.
...And 7 more matches
Mozilla Port Blocking
background on 08/15/2001, cert issued a vulnerability note vu#476267 for a "cross-protocol" scripting attack, known as the html form protocol attack which allowed sending arbitrary data to most tcp ports.
... a simple exploit of this hole allows an attacker to send forged unsigned mail through a mail server behind your firewall: a really nasty hole.
...if a user attempts to access a uri on a blocked port, mozilla shows one of the following alerts to the user or in the error console.
...And 7 more matches
Memory reporting
two ways to measure memory reporters can be divided into the two following kinds.
... traversal-based reporters are preferable, for the following reasons.
... they provide more information to dmd, which is a tool that helps keep about:memory's "heap-unclassified" number low.
...And 7 more matches
AsyncTestUtils extended framework
boilerplate add the following code to the top of your test file to 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 basics why do we need it?
...this allows you to write reasonably normal looking functions instead of having to chain together a whole bunch of functions and callbacks.
...And 7 more matches
nss tech note1
it is made of two parts : the lower byte, which can contain asn.1 tags, and the upper 3 bytes, which can contain decoder modifiers.
... asn.1 tags asn.1 tags are specified in the lower byte of the kind field of the template, as noted above.
... the following is not an attempt to explain asn.1 tags or their purposes.
...And 7 more matches
pkfnc.html
syntax #include <pk11func.h> #include <certt.h> certcertificate *pk11_findcertfromnickname( char *nickname, void *wincx); parameters this function has the following parameters: nickname a pointer to the nickname in the certificate database or to the nickname in the token.
... syntax #include <pk11func.h> #include <certt.h> #include <keyt.h> seckeyprivatekey *pk11_findkeybyanycert( certcertificate *cert, void *wincx); parameters this function has the following parameters: cert a pointer to a certificate structure in the certificate database.
... syntax #include <pk11func.h> char *pk11_getslotname(pk11slotinfo *slot); parameters this function has the following parameter: slot a pointer to a slot info structure.
...And 7 more matches
NSS_3.12.3_release_notes.html
the bug fixes in nss 3.12.3 are described in the "bugs fixed" section below.
...able is excerpted from https://developer.mozilla.org/en/nss_reference/nss_environment_variables environment variable value type description nsrandcount integer (byte count) sets the maximum number of bytes to read from the file named in the environment variable nsrandfile (see below).
... nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 hash algorithms inside signatures.
...And 7 more matches
certutil
arguments option arguments modify an action and are lowercase.
... -a use ascii format or allow the use of ascii format for input or output.
... this formatting follows rfc 1113.
...And 7 more matches
nsIChannel
netwerk/base/nsichannel.idlscriptable this interface allows clients to construct 'get' requests for specific protocols, and manage them in a uniform way.
...for example, queryinterfacing to nsihttpchannel allows response headers to be retrieved for the corresponding http transaction.
... the value of the contenttype attribute is a lowercase string.
...And 7 more matches
nsIMemory
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.
... islowmemory determine if we are in a low-memory situation (what constitutes low-memory is platform dependent).
...if you need to monitor low memory conditions, you should watch for the low memory notifications "memory-pressure" notifications instead.
...And 7 more matches
nsIParserUtils
astring converttoplaintext(in astring src, in unsigned long flags, in unsigned long wrapcol); nsidomdocumentfragment parsefragment(in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, in nsidomelement element); astring sanitize(in astring src, in unsigned long flags); constants constant value description sanitizerallowcomments (1 << 0) flag for sanitizer: allow comment nodes.
... sanitizerallowstyle (1 << 1) flag for sanitizer: allow <style> elements and style attributes (with contents sanitized in case of -moz-binding).
... sanitizercidembedsonly (1 << 2) flag for sanitizer: only allow cid: urls for embedded content.
...And 7 more matches
XPIDL
the following is the correspondence table: table 1: standard idl types idl c++ in parameter c++ out parameter js type notes boolean bool bool* boolean char char char* string only chars in range \u0000-\u00ff permitted double double double* number float float float* number long int32_...
... in addition to this list, nearly every idl file includes nsrootidl.idl in some fashion, which also defines the following types: table 2: types provided by nsrootidl.idl idl typedef c++ in parameter c++ out parameter js type notes prtime (xpidl unsigned long long typedef, 64 bits) number prtime is in microseconds, while js date assumes time in milliseconds nsresult (xpidl unsigned long typedef, 32 bits) number nsrefcnt (xpidl unsigned lon...
...g typedef, 32 bits) number size_t (xpidl unsigned long typedef, 32 bits) number voidptr void* void* not allowed charptr char* char** not allowed unicharptr char16_t* char16_t** not allowed nsidref const nsid& nsid* ?
...And 7 more matches
Int64
this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number.
... method overview number compare(a, b); number hi(a); int64 join(high, low); number lo(a); string tosource(); string tostring([radix]); methods compare() compares two 64-bit integer values.
... lo() returns the low 32 bits of the specified value.
...And 7 more matches
UInt64
this may be specified as an integer (if the value can be represented as a 32-bit value), another 64-bit integer object (either signed or unsigned), or as a string, which may consist of an optional minus sign, followed by either a decimal number or "0x" or "0x" followed by a hexadecimal number.
... method overview number compare(a, b); number hi(a); uint64 join(high, low); number lo(a); string tosource(); string tostring([radix]); methods compare() compares two 64-bit integer values.
... lo() returns the low 32 bits of the specified value.
...And 7 more matches
Network request details - Firefox Developer Tools
the tabs at the top of this pane enable you to switch between the following pages: headers messages (only for websocket items) cookies params response cache timings security (only for secure pages) stack trace (only when the request has a stack trace, e.g.
... headers tab the headers tab has a toolbar, followed by three main sections.
... request information the following information is shown only when the section is expanded: scheme: the scheme used in the url host: the server involved in the request filename: the full path to the file requested address: the ip address of the host the following information is shown in both the collapsed and the expanded states: status: the http response code for the request.
...And 7 more matches
Network request list - Firefox Developer Tools
you can configure the threshhold in the configuration editor (about:config) by modifying the devtools.netmonitor.audits.slow setting.
... cached resources may be fetched from the cache and the network simultaneously, which may improve load time for slow caches.
...for example, "csp", "malware", "cors missing allow origin", "blocked by [name of extension]".
...And 7 more matches
Edit fonts - Firefox Developer Tools
empty elements will not have any fonts used and will display the message "no fonts were found for the current element." fonts will be included in this section for one of the following reasons: they are listed in the element's font-family css declaration value.
... fonts editor firefox 63 adds the font editor — a new area below "fonts used" with additional controls for editing the fonts’ characteristics.
... for standard (static) fonts, you will be able to change the settings listed below size the font-size for the inspected element.
...And 7 more matches
AbstractRange - Web APIs
<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/abstractrange" target="_top"><rect x="1" y="1" width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53"...
...range provides methods that allow you to alter the range's endpoints, as well as methods to compare ranges, detect intersections beween ranges, and so forth.
... to illustrate this, consider the html below: <div class="container"> <div class="header"> <img src="" class="sitelogo"> <h1>the ultimate website</h1> </div> <article> <section class="entry" id="entry1"> <h2>section 1: an interesting thing...</h2> <p>a <em>very</em> interesting thing happened on the way to the forum...</p> <aside class="callout"> <h2>aside</h2> <p>an interesting aside to ...
...And 7 more matches
Background Tasks API - Web APIs
window.requestidlecallback() makes it possible to become actively engaged in helping to ensure that the browser's event loop runs smoothly, by allowing the browser to tell your code how much time it can safely use without causing the system to lag.
...using timeouts can ensure that your code runs in a timely manner, but it can also allow you to cause lag or animation stutters by mandating that the browser call you when there's not enough time left for you to run without disrupting performance.
... example in this example, we'll take a look at how you can use requestidlecallback() to run time-consuming, low-priority tasks during time the browser would otherwise be idle.
...And 7 more matches
BiquadFilterNode.type - Web APIs
syntax var audioctx = new audiocontext(); var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = 'lowpass'; value a string (enum) representing a biquadfiltertype.
... type values and their meaning type description frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff.
... frequencies below the cutoff pass through; frequencies above it are attenuated.
...And 7 more matches
BiquadFilterNode - Web APIs
the biquadfilternode interface represents a simple low-order filter, and is created using the audiocontext.createbiquadfilter() method.
... the meaning of the different parameters depending of the type of the filter (detune has the same meaning regardless, so isn't listed below) type description frequency q gain lowpass standard second-order resonant lowpass filter with 12db/octave rolloff.
... frequencies below the cutoff pass through; frequencies above it are attenuated.
...And 7 more matches
DirectoryEntrySync - Web APIs
about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011.
... the following creates an empty file called seekrits.txt in the root directory.
...the following creates a new directory called superseekrit in the root directory.
...And 7 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
these characters allow you to format your code in a way that will make it easily readable by yourself and other people.
...take the following minimal example: <!doctype html> <h1> hello world!
... take the following document, for example: <!doctype html> <html> <head> <title>my document</title> </head> <body> <h1>header</h1> <p> paragraph </p> </body> </html> the dom tree for this looks like so: conserving whitespace characters in the dom is useful in many ways, but there are certain places where this makes certain layouts more difficult to implement, and causes problems for developers w...
...And 7 more matches
FileSystemEntrySync - Web APIs
[ todo: specify what kind of metadata ] metadata getmetada () raises (fileexception); parameter none returns metadata exceptions this method can raise a fileexception with the following codes: exception description not_found_err the entry does not exist.
... you cannot do the following: move a directory inside itself or to any child at any depth move an entry into its parent if a name different from its current one isn't provided move a file to a path occupied by a directory or move a directory to a path occupied by a file move any element to a path occupied by a directory that is not empty.
... exceptions this method can raise a fileexception with the following codes: exception description encoding_err the name supplied is invalid, because at least one of the characters is reserved or illegal.
...And 7 more matches
Introduction to the File and Directory Entries API - Web APIs
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.
...the api is a better choice for apps that deal with blobs for the following reasons: the file and directory entries api offers client-side storage for use cases that are not addressed by databases.
...And 7 more matches
HTMLImageElement.alt - Web APIs
these are shown in the examples below.
...this is shown in the example below.
... html in the html for this example, shown below, the <img> element includes the alt property, which will prevent the image from having any alternate text, since it's simply a decorational detail.
...And 7 more matches
HTMLInputElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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,3...
... allowdirs boolean: part of the non-standard directory upload api; indicates whether or not to allow directories and files both to be selected in the file list.
...when there's no selection, this returns the offset of the character immediately following the current text input cursor position.
...And 7 more matches
IDBObjectStoreSync - Web APIs
constants mode constants constant value description read_only 1 modification operations are not allowed on this object store.
... read_write 0 modification operations are allowed on this object store.
... any add( in any value, in optional any key ) raises (idbdatabaseexception); parameters returns exceptions this method can raise a idbdatabaseexception with the following codes: value the value to store into the index.
...And 7 more matches
Basic concepts - Web APIs
you'll find the following useful: for an overview of the design and structure of indexeddb, see big concepts.
...like most web storage solutions, indexeddb follows a same-origin policy.
...so keep the following important concepts in mind: indexeddb databases store key-value pairs.
...And 7 more matches
Timing element visibility with the Intersection Observer API - Web APIs
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.
...below that, we define the site's sidebar as a list of links within an <aside> block.
... the wrapper's width is fixed at 700px so that it will fit in the available space when presented inline on mdn below.
...And 7 more matches
Intersection Observer API - Web APIs
one thing the intersection observer api can't tell you: the exact number of pixels that overlap or specifically which ones they are; however, it covers the much more common use case of "if they intersect by somewhere around n%, i need to do something." intersection observer concepts and usage the intersection observer api allows you to configure a callback that is called: (1) whenever one element, called the target, intersects either the device viewport or a specified element; for the purpose of this api, this is called the root element or root (2) and whenever the observer is asked to watch a target for the very first time typically, you'll want to watch for intersection changes with regard to the element's closest ...
...it has the following fields: root the element that is used as the viewport for checking visibility of the target.
... if the intersection root has an overflow clip, the root intersection rectangle is the root element's content area.
...And 7 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
as much as possible, standard cinematographic techniques are used, since the viewer has likely grown up watching films using those techniques, and has subconscious expectations that a film or animation will follow those methods.
... when using webgl to accelerate 2d graphics drawing, the camera is typically placed directly above the center of the scene with the distance and field of view set to allow the entire scene to be presented.
... in single-screen 2d games, the camera is not associated directly with the player or any other character in the game, but is instead either fixed above or next to the game play area, or follows the action as the action moves around a scrolling game world.
...And 7 more matches
Geometry and reference spaces in WebXR - Web APIs
the following code snippet shows two simple functions, degreestoradians() and radianstodegrees(), which convert back and forth between the two units for measuring angles.
... the directionality of the coordinate system can be seen in the following diagram: an xrrigidtransform called the origin offset is used to transform points from the space's own effective coordinate system to the xr device's native coordinate system.
...values of y less than 0 are found below the origin, extending toward the bottom of the screen and reaching -1.0 at the bottom of the world's space.
...And 7 more matches
Text labels and names - Accessibility
there are many situations in which a control, dialog, or other website feature should be given a descriptive name or label to allow users of assistive technologies to understand what its purpose is and to be able to understand and operate it correctly.
...the different problems and solutions are discussed in the sections below.
... examples the following example show a simple image map (taken from h24: providing text alternatives for the area elements of image maps): <img src="welcome.gif" usemap="#map1" alt="areas in the library.
...And 7 more matches
Color picker tool - CSS: Cascading Style Sheets
; 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; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-tra...
...nsform: 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; } /* * color picker tool */ body { max-width: 1000px; margin: 0 auto; font-family: "segoe ui", arial, helvetica, sans-serif; box-shadow: 0 0 5px 0 #999; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } /** * resize handle */ .resize-handle { width: 10px; height: 10px; background: url('https://mdn.mozillademos.org/files/6083/resize.png') center center no-repeat; position: ab...
...isplay: table; } /** * picker zone */ #picker { padding: 10px; width: 980px; } .ui-color-picker { padding: 3px 5px; float: left; border-color: #fff; } .ui-color-picker .switch_mode { display: none; } .ui-color-picker .preview-color:hover { cursor: move; } /** * picker container */ #picker-samples { width: 375px; height: 114px; max-height: 218px; margin: 0 10px 0 30px; overflow: hidden; position: relative; float: left; transition: all 0.2s; } #picker-samples .sample { width: 40px; height: 40px; margin: 5px; border: 1px solid #ddd; position: absolute; float: left; transition: all 0.2s; } #picker-samples .sample:hover { cursor: pointer; border-color: #bbb; transform: scale(1.15); border-radius: 3px; } #picker-samples .sample[data-active='true'] { border...
...And 7 more matches
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
this means that if you have a set of flex items that are too wide for their container, they will overflow it.
... if you want to cause them to wrap once they become too wide you must add the flex-wrap property with a value of wrap, or use the shorthand flex-flow with values of row wrap or column wrap.
... single-dimensional layout explained as we have seen from the above examples if our items are allowed to grow and shrink, when there are fewer items in the last row or column then those items grow to fill the available space.
...And 7 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
flexbox provides access to properties that allow the alignment of items on their cross axis and justification of items on the main axis.
...there is a note in the flexbox spec stating that in the future, once it is completed, the definitions in box alignment level 3 will supersede those of flexbox: "note: while the alignment properties are defined in css box alignment [css-align-3], flexible box layout reproduces the definitions of the relevant ones here so as to not create a normative dependency that may slow down advancement of the spec.
... the writing modes the writing modes specification defines the following values of the writing-mode property, which serve to change the direction that blocks are laid out on the page, to match the direction that blocks lay out when content is formatted in that particular writing mode.
...And 7 more matches
Logical properties for sizing - CSS: Cascading Style Sheets
in this guide we will explain the flow-relative mappings between physical dimension properties and logical properties used for sizing elements on our pages.
... when specifying the size of an item, the logical properties and values specification gives you the ability to indicate sizing as it relates to the flow of text (inline and block) rather than physical sizing which relates to the physical dimensions of horizontal and vertical (e.g.
...while these flow relative mappings may well become the default for many of us, in a design you may well use both physical and logical sizing.
...And 7 more matches
Shorthand properties - CSS: Cascading Style Sheets
as missing values are replaced by their initial value, it is impossible to allow inheritance of individual properties by omitting them.
... background properties a background with the following properties ...
... font properties the following declarations ...
...And 7 more matches
Specificity - CSS: Cascading Style Sheets
selector types the following list of selector types increases by specificity: type selectors (e.g., h1) and pseudo-elements (e.g., ::before).
... #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.
... for more information, visit: https://stackoverflow.com/questions/3706819/what-are-the-implications-of-using-important-in-css https://stackoverflow.com/questions/9245353/what-does-important-in-css-mean https://stackoverflow.com/questions/5701149/when-to-use-important-property-in-css https://stackoverflow.com/questions/11178673/how-to-override-important https://stackoverflow.com/questions/2042497/when-to-use-important-to-save-the-day-when-worki...
...And 7 more matches
linear-gradient() - CSS: Cascading Style Sheets
<linear-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (each being either a <percentage> or a <length> along the gradient's axis).
... note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients.
...if you don't specify the location of a color, it is placed halfway between the one that precedes it and the one that follows it.
...And 7 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
color keywords include the standard primary and secondary colors (such as red, blue, or orange), shades of gray (from black to white, including colors like darkgray and lightgrey), and a variety of other blended colors including lightseagreen, cornflowerblue, and rebeccapurple.
...the alpha channel is specified by 0xaa; the lower this value is, the more translucent the color becomes.
...the alpha channel is specified by 0xaa; the lower this value is, the more translucent the color becomes.
...And 7 more matches
<a>: The Anchor element - HTML: Hypertext Markup Language
WebHTMLElementa
allowed values are the same as the global lang attribute.
...when the link is followed, the browser will send post requests with the body ping to the urls.
... referrerpolicy how much of the referrer to send when following the link.
...And 7 more matches
HTML elements reference - HTML: Hypertext Markup Language
WebHTMLElement
content sectioning content sectioning elements allow you to organize the document content into logical pieces.
...<h1> is the highest section level and <h6> is the lowest.
... <div> the html content division element (<div>) is the generic container for flow content.
...And 7 more matches
itemprop - HTML: Hypertext Markup Language
examples the example below shows the source for a set of elements marked up with itemprop attributes, followed by a table showing the resulting structured data.
...mscope> <img itemprop="image" src="google-logo.png" alt="google"> </div> when a string value can't be easily read and understood by a person (e.g., a long string of numbers and letters), it can be displayed using the value attribute of the data element, with the more easily-understood-by-a human-version given in the element's contents (which is not part of the structured data - see example below).
... same structured data marked up in two different ways there is no semantic difference between the following two examples <figure> <img src="castle.jpeg"> <figcaption><span itemscope><span itemprop="name">the castle</span></span> (1986)</figcaption> </figure> <span itemscope><meta itemprop="name" content="the castle"></span> <figure> <img src="castle.jpeg"> <figcaption>the castle (1986)</figcaption> </figure> both have a figure with a caption, and both, completely unrelated to...
...And 7 more matches
MIME types (IANA media types) - HTTP
no whitespace is allowed in a mime type: type/subtype the type represents the general category into which the data type falls, such as video or text.
... mime types are case-insensitive but are traditionally written in lowercase, with the exception of parameter values, whose case may or may not have specific meaning.
...this can be used, for instance, to represent an email that includes a forwarded message as part of its data, or to allow sending very large messages in chunks as if it were multiple messages.
...And 7 more matches
CSP: frame-ancestors - HTTP
not setting this allows anything.
... 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.
...And 7 more matches
Feature-Policy: publickey-credentials-get - HTTP
the http feature-policy header publickey-credentials-get directive controls whether the current document is allowed to access web authentcation api to create new public-key credentials, i.e, via navigator.credentials.get({publickey: ..., ...}).
... syntax feature-policy: publickey-credentials-get <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 7 more matches
Feature-Policy: unsized-media - HTTP
the http feature-policy header unsized-media directive controls whether the current document is allowed to change the size of media elements after the initial layout is complete.
... syntax feature-policy: unsized-media <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 7 more matches
Firefox user agent string reference - HTTP
see below for further details and examples.
... for other products based on gecko, the string can take one of two forms, where the tokens have the same meaning except those noted below: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail appname/appversion mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion appname/appversion appname/appversion indicates the application name and version.
... windows windows user agents have the following variations, where x.y is the windows nt version (for instance, windows nt 6.1).
...And 7 more matches
parseInt() - JavaScript
the description below explains in more detail what happens when radix is not provided.
...leading and trailing spaces are allowed.
...if no signs are found, the algorithm moves to the following step; otherwise, it removes the sign and runs the number-parsing on the rest of the string.
...And 7 more matches
Authoring MathML - MathML
as a consequence, good mathml authoring tools are more important and we describe some tools below.
...for example the following function verifies the mathml support by testing the mspace element (you may replace mspace with mpadded): function hasmathmlsupport() { var div = document.createelement("div"), box; div.innerhtml = "<math><mspace height='23px' width='77px'/></math>"; document.body.appendchild(div); box = div.firstchild.firstchild.getboundingclientrect(); document.body.removechild(div); return mat...
...h.abs(box.height - 23) <= 1 && math.abs(box.width - 77) <= 1; } alternatively, the following ua string sniffing will allow to detect the rendering engines with native mathml support (gecko and webkit).
...And 7 more matches
<mo> - MathML
WebMathMLElementmo
allowed values are true or false.
... allowed values are true or false.
...allowed values are either true or false.
...And 7 more matches
Web Performance
optimizing the critical render path improves render performance.the critical rendering path includes the document object model (dom), css object model (cssom), render tree and layout.css and javascript animation performancebrowsers are able to optimize rendering flows.
...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.
...this could be a file loaded later or link target a user tries to follow.
...And 7 more matches
Paths - SVG: Scalable Vector Graphics
WebSVGTutorialPaths
while creating complex paths using an xml editor or text editor is not recommended, understanding how they work will allow to identify and repair display issues in svgs.
...an uppercase letter specifies absolute coordinates on the page, and a lowercase letter specifies relative coordinates (e.g., move 10px up and 7px to the left from the last point).
...for example: m x y (or) m dx dy in the following example there's only a point at (10,10).
...And 7 more matches
panel - Archive of obsolete content
the screenshot below shows a panel whose content is built from the list of currently open tabs: panels are useful for presenting temporary interfaces to users in a way that is easier for users to ignore and dismiss than a modal dialog, since panels are hidden the moment users interact with parts of the application interface outside them.
... the following add-on adds a button which displays a panel when clicked.
... the position object has one or more of the following properties: top, right, bottom and left.
...And 6 more matches
JavaScript Daemons Management - Archive of obsolete content
the following daemons management framework is the major version of setinterval – a little framework.
... daemon.js what follows is the module that declares the daemon constructor (the core of this framework).
...function () { vcallback.apply(null, aargs); } : vcallback, ndelay); }; window.setinterval.ispolyfill = true; } */ daemon-safe.js what follows is the module which extends the daemon constructor with a daemon.safe sub-system.
...And 6 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
firefox allows all of this by default, and if you don't pay attention to the details we describe here, your toolbar may not be as easy to customize as the rest.
... <overlay id="xulschoolhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="xulschoolhello-hello-world-button" class="toolbarbutton-1 chromeclass-toolbar-additional" label="&xulschoolhello.helloworld.label;" tooltiptext="&xulschoolhello.helloworld.tooltip;" oncommand="xulschoolchrome.browseroverlay.dosomething(event);" /> <!-- more buttons here.
...this menu allows hiding and showing any toolbar.
...And 6 more matches
Setting Up a Development Environment - Archive of obsolete content
inside the helloworld2 directory, you'll see two directories: bin and src.
... open the project file (helloworld2.komodoproject) from the src directory in komodo edit.
...run the following command: make that's it.
...And 6 more matches
Custom toolbar button - Archive of obsolete content
in the extensions directory, create a new directory with the following name.
... copy the name from here and paste it, to avoid typing errors: custom-toolbar-button@example.com perform the following steps in this new directory, creating two files and a directory there.
... copy the following content, making sure that you scroll to get all of it.
...And 6 more matches
Adding Event Handlers - Archive of obsolete content
add the line below just after the opening window tag and before any elements.
...for example, you may use urls of the following form: <script src="findfile.js"/> <script src="chrome://findfiles/content/help.js"/> <script src="http://www.example.com/js/items.js"/> this tutorial does not attempt to describe how to use javascript (except as related to event handling) as this is a fairly large topic and there are plenty of other resources that are available for this.
... in the capturing phase, the event is first sent to the window, then to the document, followed by each ancestor of the xul element where the event occured downwards until it reaches that element.
...And 6 more matches
Keyboard Shortcuts - Archive of obsolete content
in the example below, the file menu can be selected by pressing alt + f together (or some other key combination for a specific platform).
...usually, a keyboard shortcut will be allowed at any time and you can check to see whether it should do something using a script.
...an example is shown below: <keyset> <key id="sample-key" modifiers="shift" key="r"/> </keyset> this sample defines a keyboard shortcut that is activated when the user presses the shift key and r.
...And 6 more matches
Localization - Archive of obsolete content
xul and xml provide entities which are a convenient way of allowing localization.
...xml has a syntax which allows you to declare custom entities.
...the example below demonstrates the use of an entity in a button.
...And 6 more matches
More Button Features - Archive of obsolete content
the button below will have both a label and the image 'happy.png'.
...this is designed to allow the 'skin' (in this case, the appearance of the image) to be changed without changing the xul file.
... an example is shown below.
...And 6 more matches
Numeric Controls - Archive of obsolete content
other characters are not allowed and are just ignored if typed.
... in addition, arrow buttons appear beside the textbox to allow the user to cycle through the values.
...for instance, the following numeric textbox has a range between 1 and 20.
...And 6 more matches
The Box Model - Archive of obsolete content
this model allows you to divide a window into a series of boxes.
...although a box is the fundamental part of xul element layout, it follows a few very simple rules.
...box elements the basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox> <!-- vertical elements --> </vbox> the hbox element is used to create a horizontally oriented box.
...And 6 more matches
XUL Structure - Archive of obsolete content
this allows a special url form, called a chrome:// url, to be used.
...the extension will hook into the browser using a xul specific feature called an overlay which allows the xul from the extension to mesh with the xul in the browser.
... remote xul was disabled in firefox 8, so the following is of historic interest only.
...And 6 more matches
Archived Mozilla and build documentation - Archive of obsolete content
implementing a calicalendarviewcontroller allows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included.
... download manager improvements in firefox 3 firefox 3 offers improvements to the download manager that allow multiple progress listeners, use of the storage api for data management, download resuming, and more.
... dtrace dtrace is sun microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active.
...And 6 more matches
Anatomy of a video game - Game development
this article looks at the anatomy and workflow of the average video game from a technical point of view, in terms of how the main loop should run.
...being more specific with the browser about when your function needs to be called allows the browser to optimize when it is called.
... timing the main loop to when the browser paints to the display allows you to run your loop as frequently as the browser wants to paint.
...And 6 more matches
Audio for Web games - Game development
it is worth noting that autoplay with sound is allowed if: the user has interacted with the domain.
... note: playing part of your file at zero volume could also work if the browser allows you to change volume (see below).
...encoding your audio at lower bit rates means smaller file sizes but lower seeking accuracy.
...And 6 more matches
2D maze game with device orientation - Game development
let’s set it up: our starting point is the index.html file with the following content.
... you can create this yourself if you want to follow along: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>cyber orb demo</title> <style> body { margin: 0; background: #333; } </style> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/preloader.js"></script> <script src="src/mainmenu.js"></script> <script src="src/howto.js"></script> <script src="src/game.js"></script> </head> <body> <script> (function() { var game = new phaser.game(320, 480, phaser.canvas, 'game'); game.state.add('boot', ball.boot); game.state.add('preloader', ball.preloader); game.state.add('mainmenu', ball.mainmenu); game.state.add('howto', ball.howto); game.state.add('game', ball.gam...
... 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.
...And 6 more matches
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
xml inclusions (xinclude) is a w3c recommendation to allow inclusion of xml more different sources in a more convenient fashion than xml external entities.
... when used in conjunction with xpointer (firefox supports a subset of it, and is used in the code sample below), xinclude can also target just specific portions of a document for inclusion.
... firefox does not support it natively, but the following function aims to allow its use with documents passed into it.
...And 6 more matches
Organizing your CSS - Learn web development
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.
...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 ||.
... 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.
...And 6 more matches
Test your skills: Writing Modes and Logical Properties - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...your example should look like the image below.
... try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor.
...And 6 more matches
Creating hyperlinks - Learn web development
hyperlinks allow us to link documents to other documents or resources, link to specific parts of documents, or make apps available at a web address.
...</p> this gives us the following result: i'm creating a link to the mozilla homepage.
...</p> this gives us the following result and hovering over the link displays the title as a tooltip.
...And 6 more matches
Adding features to our bouncing balls demo - Learn web development
read the whole assessment before you start coding, and take each step slowly and carefully.
... the following screenshot gives you an idea of what the finished program should look like: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do.
... you should do this something like shape.call(this, x, y, 20, 20, exists); it should also define its own properties, as follows: color — 'white' size — 10 again, remember to define your inherited properties as parameters in the constructor, and set the prototype and constructor properties correctly.
...And 6 more matches
Multimedia: Images - Learn web development
in terms of download performance, eliminating media, and reducing file size is the low-hanging fruit.
... for the average website, 51% of its bandwidth comes from imagery, followed by video at 25%, so it's safe to say it's important to address and optimize your multi-media content.
... optimizing image delivery despite being the largest consumer of bandwidth, images load asynchronously so the visitor can see the page as they download and therefore, their impact on perceived performance is far lower than many expect.
...And 6 more matches
Framework main features - Learn web development
domain-specific languages all of the frameworks discussed in this module are powered by javascript, and all allow you to use domain-specific languages (dsls) in order to build your applications.
... the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expression represents an html <header> element with a <h1> element inside.
...typescript is useful for the strictness it allows developers to enforce on their code.
...And 6 more matches
Styling Vue components with CSS - Learn web development
add the following contents to the reset.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: in...
...herit; 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%; max-width: 68rem; margin: 0 auto; font: 1.6rem/1.25 "helvetica neue", helvetica, arial, sans-serif; background-color: #f5f5f5; color: #4d4d4d; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; } @media screen and (min-width: 620px) { body { font-size: 1.9rem; line-height: 1.31579; } } /*end resets*/ next, in your src/main.js...
...the images below show the look of the app before and after the reset is applied.
...And 6 more matches
Accessibility Features in Firefox
keyboard support "mozilla firefox is a web-browser with superior keyboard support." alan cantor, cantor access consulting firefox includes keyboard access to all of its amazing features: browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor.
... this allows copying arbitrary pieces of text to the clipboard.
...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.
...And 6 more matches
Chrome registration
this allows translators to plug in a different chrome package to translate an application without altering the rest of the source code.
.../ are not allowed in the packagename.
...any following character in the same line is ignored.
...And 6 more matches
Debugging on Windows
ways to start the debugger first of all, it's necessary to install a visual studio extension to be able to follow child processes as they are created.
...microsoft child process debugging power tool allows automatically attaching to child processes, such as web content process, gpu process, etc.
... 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.
...And 6 more matches
Obsolete Build Caveats and Tips
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.
...to get this code, do the following: # pull the mozilla source to the folder 20src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/releases/mozilla-2.0/ 20src cd 20src mozilla-1.9.2 (firefox 3.6) code for the firefox 3.6 (gecko 1.9.2) release lives in releases/mozilla-1.9.2.
... to get this code, do the following: # pull the mozilla source to the folder 192src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/releases/mozilla-1.9.2/ 192src cd 192src mozilla-1.9.1 (firefox 3.5) code for the firefox 3.5 (gecko 1.9.1) release lives in releases/mozilla-1.9.1.
...And 6 more matches
Storage access policy: Block cookies from trackers
consider the following examples: hostname on the list hostname of resource matched example.com example.com yes example.com a.b.example.com yes blah.example.com example.com no a.b.example.com c.d.example.com no blah.example.com foo.blah.example.com yes what does the storage access policy block?
...specifically, firefox does this by imposing the following restrictions: cookies: block cookie request headers and ignore set-cookie response headers.
...these heuristics are intended to allow some third-party integrations that are common on the web to continue to function.
...And 6 more matches
Script security
the rules for determining whether an object is same-origin with another, and what access is allowed cross-origin, are now mostly standardized across browsers.
... security policy gecko implements the following security policy: objects that are same-origin are able to access each other freely.
... objects in a privileged scope are allowed complete access to objects in a less privileged scope, but by default they see a restricted view of such objects, designed to prevent them from being tricked by the untrusted code.
...And 6 more matches
Localization content best practices
there is an established format for localization comments: it's important to follow the format as closely as possible, since there are a number of automated tools that parse these comments for easier access and use by localizers.
... word order if a string will contain a placeholder, always add the placeholder to the string to allow the localizer to change the word order if necessary.
...for example, in english all the following begin with the same clause: the url of this feed is invalid; the url of this feed cannot be reached; the url of this feed cannot be parsed.
...And 6 more matches
Localizing with Mercurial
mercurial allows localizers to work locally (on their machines) and then push (an hg term) changes to a remote repository, which usually is hosted on the mozilla servers (hg.mozilla.org).
... for the eager and quick, below you'll find instructions on installing 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.
...And 6 more matches
NSS_3.12_release_notes.html
nss 3.12 release notes 17 june 2008 newsgroup: mozilla.dev.tech.crypto contents introduction distribution information new in nss 3.12 bugs fixed documentation compatibility feedback introduction network security services (nss) 3.12 is a minor release with the 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.
...nss 3.12 libraries have the following versions: sqlite3: 3.3.17 nssckbi: 1.70 softokn3 and freebl3: 3.12.0.3 other nss libraries: 3.12.0.3 new in nss 3.12 3 new shared library are shipped with nss 3.12: nssutil sqlite nssdbm 1 new include file is shipped with nss3.12: utilrename.h new functions in the nss shared library: cert_checknamespace (see cert.h) cert_encodecertpoliciesextension (see cert.h) cert_encodeinfoacces...
...ithmid (see cryptohi.h) new macros for camellia support (see blapit.h): nss_camellia nss_camellia_cbc camellia_block_size new macros for rsa (see blapit.h): rsa_max_modulus_bits rsa_max_exponent_bits new macros in certt.h: x.509 v3 ku_encipher_only cert_max_serial_number_bytes cert_max_dn_bytes pkix cert_rev_m_do_not_test_using_this_method cert_rev_m_test_using_this_method cert_rev_m_allow_network_fetching cert_rev_m_forbid_network_fetching cert_rev_m_allow_implicit_default_source cert_rev_m_ignore_implicit_default_source cert_rev_m_skip_test_on_missing_source cert_rev_m_require_info_on_missing_source cert_rev_m_ignore_missing_fresh_info cert_rev_m_fail_on_missing_fresh_info cert_rev_m_stop_testing_on_fresh_info cert_rev_m_continue_testing_on_fresh_info cert_rev_mi_test_each_method...
...And 6 more matches
NSS functions
in addition to the functions listed here, applications that support ssl use some of the certificate functions, crypto functions, and utility functions described below on this page.
... if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference.
...lurl mxr 3.2 and later ssl_securitystatus mxr 3.2 and later ssl_setmaxservercachelocks mxr 3.4 and later ssl_setpkcs11pinarg mxr 3.2 and later ssl_setsockpeerid mxr 3.2 and later ssl_seturl mxr 3.2 and later ssl_shutdownserversessionidcache mxr 3.7.4 and later deprecated ssl functions the following ssl functions have been replaced with newer versions.
...And 6 more matches
JS::CompileOptions
methods some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain.
... 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 the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents.
...And 6 more matches
SpiderMonkey 1.8.5
it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below.
...migrating to spidermonkey 1.8 the following features in earlier versions of spidermonkey have been dropped.
...multithreaded programs are allowed, but each thread must operate on objects in a separate compartment, isolated from the other threads.
...And 6 more matches
Places utilities for JavaScript
utils.js is accessible at the following url: http://mxr.mozilla.org/mozilla-centr...ntent/utils.js this file includes utility functions used by a lot of the bookmarking, tagging, and annotation services that are built into firefox.
...faultinsertionpoint, boolean ashowpicker); array object getannotationsforuri(nsiuri auri); array object getannotationsforitem(int aitemid); void setannotationsforuri(nsiuri auri, object aannos); void setannotationsforuri(int aitemid, object aannos); getviewfornode(nsidomnode anode); void markpageastyped(string aurl); void markpageasfollowedbookmark(string aurl); boolean checkurlsecurity(nsinavhistoryresultnode aurinode); string getquerystringforfolder(int afolderid); string getdescriptionfromdocument(nsidomdocument doc); string setpostdataforbookmark(int aboomarkid, string apostdata); string getpostdataforbookmark(int aboomarkid); array string geturlandpostdataforkeyword(string...
... showminimaladdmultibookmarkui() show an "add bookmarks" dialog to allow the adding of a folder full of bookmarks corresponding to the objects in the urilist.
...And 6 more matches
Building the WebLock UI
each of these files is described briefly in the sections below.
... in the following chapter we'll describe how you can take these files and create a package, an installable archive that includes the weblock component and the new ui.
...like the secure page icon, the weblock icon that appears in the lower right corner of the browser should indicate whether the browser is currently locked or unlocked.
...And 6 more matches
Finishing the Component
see the following sidebar for information about how frozen and unfrozen interfaces can affect your component development, and for technical details about how interface changes beneath your code can cause havoc.
... below, the component is compiled against a version of the nsifoo interface that has three methods.
... weblock interfaces interface name defined by status summary nsisupports xpcom frozen provides interface discovery, and object reference counting nsiobserver xpcom frozen allows messaging passing between objects nsicontentpolicy content not frozen interface for policy control mechanism iweblock web lock not frozen enables and disables weblock.
...And 6 more matches
Using XPCOM Components
the cookie manager dialog this dialog is written in xul and javascript, and uses a part of xpcom called xpconnect to seamlessly connect to the cookiemanager component (see connecting to components from the interface below).
... the functionality of the cookiemanager component is available through the nsicookiemanager interface, which is comprised of the public methods in the table below.
... 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.
...And 6 more matches
nsILocalFileMac
obsolete since gecko 2.0 methods native code only!getcfurl note: observes the state of the followlinks attribute.
... if the file object is an alias and followlinks is true, returns the target of the alias.
... if followlinks is false, returns the unresolved alias file.
...And 6 more matches
nsIProtocolHandler
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean allowport(in long port, in string scheme); nsichannel newchannel(in nsiuri auri); nsiuri newuri(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description defaultport long the default port is the port the protocol uses by default.
... uri_forbids_automatic_document_replacement 1<<5 "automatic" loads that would replace the document (such as a meta refresh, certain types of xlinks, and other non-user-triggered loads) are not allowed if the originating uri has this protocol flag.
... uri_is_local_file 1<<9 uris for this protocol from other origins should only be allowed if those origins should have access to the local file system.
...And 6 more matches
nsISelectionPrivate
void getrangesforinterval(in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out nsidomrange results); void getrangesforintervalarray(in nsinode beginnode, in print32 beginoffset, in nsinode endnode, in print32 endoffset, in boolean allowadjacent, in rangearray results); native code only!
... void getrangesforintervalcomarray(in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results); native code only!
... endplaceholdertransaction will give rise to reflow/refreshing view/scroll, and call times of nstextframe::getpointfromoffset whose return value is to be cached.
...And 6 more matches
XUL Overlays
MozillaTechXULOverlays
thus, given the following base: ...
...and given the following overlay: <?xml version="1.0"?> <overlay id="singleitemex" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menupopup id="menu_filepopup"> <menu id="file_menu"> <menuitem name="super stream player"/> </menu> </menupopup> </overlay> the result will be: ...
...inserting the following processing instruction before the doctype declaration in a base file tells the layout engine to load the named overlay file: <?xul-overlay href="chrome://component/content/componentoverlay.xul"?> where component is the name of the package being overlayed (e.g., chrome://navigator/content/navigatoroverlay.xul).
...And 6 more matches
Autoconfiguration in Thunderbird
the configuration file description and definition the original project page on the mozilla wiki for background, design, implementation and project details this document describes how autoconfiguration in thunderbird works, and what to do to allow mail servers to be autoconfigured.
...this allows to autoconfigure almost 50% of our user's email accounts.
... configuration server at isp isps have the option to provide their configuration information themselves directly to users, by setting up a web server at autoconfig.<domain>, which simply returns a static xml file with the configuration, as described below.
...And 6 more matches
Working with ArrayBuffers
this feature is based on the following work: //github.com/realityripple/uxp/blob/master/js/src/ctypes/ctypes.cpp#3080 //github.com/realityripple/uxp/blob/master/js/src/vm/arraybufferobject.cpp#1301 example 1 - image data the following example illustrates how to transfer a byte array pointed by ctypes.uint8_t.ptr to imagedata of canvas.
... the following codeblock provides a basic example of getting and setting uint8clampedarray and arraybuffer of imagedata: // context is a canvasrenderingcontext2d of some canvas var imagedata = context.getimagedata(x, y, w, h); var array = imagedata.data; // array is a uint8clampedarray var buffer = imagedata.data.buffer; // buffer is a arraybuffer // incomingbuffer is a typedarray var imagedata2 = context.createimagedata(w, h); imagedata2.data.set(incomingbuffer); further, if you have a byte array pixelbuffer, and you need to create imagedata from it.
... we start with the following: // pixelbuffer is a pointer to a rgba pixel buffer of 400x400 image.
...And 6 more matches
Debugger.Object - Firefox Developer Tools
this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers.
... accessor properties of the debugger.object prototype a debugger.object instance inherits the following accessor properties from its prototype: proto the referent’s prototype (as a new debugger.object instance), or null if it has no prototype.
...this string takes one of the following values: "pending", if the promise is pending.
...And 6 more matches
Debugger.Source - Firefox Developer Tools
many properties below return placeholder values.
... convention for descriptions of properties and methods below, if the behavior of the property or method differs between the instance referring to javascript source or to a block of webassembly code, the text will be split into two sections, headed by “if the instance refers to javascript source” and “if the instance refers to webassembly code”, respectively.
... accessor properties of the debugger.source prototype object a debugger.source instance inherits the following accessor properties from its prototype: text if the instance refers to javascript source, the javascript source code, as a string.
...And 6 more matches
Debugger.Object - Firefox Developer Tools
this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers.
... accessor properties of the debugger.object prototype a debugger.object instance inherits the following accessor properties from its prototype: proto the referent's prototype (as a new debugger.object instance), or null if it has no prototype.
... function properties of the debugger.object prototype the functions described below may only be called with a this value referring to a debugger.object instance; they may not be used as methods of other kinds of objects.
...And 6 more matches
Introduction to the DOM - Web APIs
for example, the standard dom specifies that the getelementsbytagname method in the code below must return a list of all the <p> elements in the document: const paragraphs = document.getelementsbytagname("p"); // paragraphs[0] is the first <p> element // paragraphs[1] is the second <p> element, etc.
...your dom programming may be something as simple as the following, which displays an alert message by using the alert() function from the window object, or it may use more sophisticated dom methods to actually create new content, as in the longer example below.
... this following javascript will display an alert when the document is loaded (and when the whole dom is available for use): <body onload="window.alert('welcome to my home page!');"> another example.
...And 6 more matches
Fullscreen API - Web APIs
see the browser compatibility section below for details on support for this api.
...these are listed in the following sections.
... methods the fullscreen api adds methods to the document and element interfaces to allow turning off and on full-screen mode.
...And 6 more matches
HTML Drag and Drop API - Web APIs
a translucent representation of the draggable elements follows the pointer during the drag operation.
... identify what is draggable making an element draggable requires adding the draggable attribute and the ondragstart global event handler, as shown in the following code sample: <script> function dragstart_handler(ev) { // add the target element's id to the data transfer object ev.datatransfer.setdata("text/plain", ev.target.id); } window.addeventlistener('domcontentloaded', () => { // get the element by id const element = document.getelementbyid("p1"); // add the ondragstart event listener element.addeventlistener("dragsta...
...the setdata() method is used to add an item to the drag data, as shown in the following example.
...And 6 more matches
KeyboardEvent - Web APIs
note: keyboardevent events just indicate what interaction the user had with a key on the keyboard at a low level, providing no contextual meaning to that interaction.
... <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/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...
... constants the keyboardevent interface defines the following constants.
...And 6 more matches
Using the MediaStream Recording API - Web APIs
it allows you to record snippets of audio and then play them back.
... css goodies the html is pretty simple in this app, so we won't go through it here; there are a couple of slightly more interesting bits of css worth mentioning, however, so we'll discuss them below.
...why was css2 layout so awkward?" it allows you do a calculation to determine the computed value of a css unit, mixing different units in the process.
...And 6 more matches
Using the Notifications API - Web APIs
this is a common requirement when an api tries to interact with something outside a web page — at least once, the user needs to specifically grant that application permission to present notifications, thereby letting the user control which apps/sites are allowed to display notifications.
...this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notification permission requests not triggered in response to a user gesture.
...https), and you can no longer allow notification permissions to be requested from cross-origin <iframe>s.
...And 6 more matches
SVGTransformList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 6 more matches
Touch events - Web APIs
the touch events interfaces are relatively low-level apis that can be used to support application-specific multi-touch interactions such as a two-finger gesture.
... example this example tracks multiple touchpoints at a time, allowing the user to draw in a <canvas> with more than one finger at a time.
... note: the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus or other contact method.
...And 6 more matches
Rendering and the WebXR frame animation callback - Web APIs
this is due to early displays using the ac electrical grid's current flow waveform, which cycles 60 times per second in the united states (50 in europe), for timing purposes.
...the division of time into 60 hz blocks with each block being used at least in part to render the scene is shown in the diagram below.
... fortunately, you can easily compute how much time you're allowed to use between frames as 1/refreshrate seconds.
...And 6 more matches
Functions and classes available to Web Workers - Web APIs
unknown no postmessage() yes, on dedicatedworkerglobalscope no no unknown no apis available in workers function functionality support in gecko (firefox) support in ie support in blink (chrome and opera) support in webkit (safari) broadcast channel api allows simple communication between browsing contexts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site).
... channel messaging api allows two separate scripts running in different browsing contexts attached to the same document (e.g., two iframes, or the main document and an iframe, two documents via a sharedworker, or two workers) to communicate directly via two ports.
...it allows access to a cryptographically strong random number generator and to cryptographic primitives.
...And 6 more matches
Operable - Accessibility
see ui controls and building keyboard accessibility back in 2.1.4 character key shortcuts (a) added in 2.1 if a single character key shortcut exists, then at least one of the following is true: single character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus.
...completing a hotel or flight booking often has a time limit), the user should be given controls to allow them to adjust, extend or turn off the time limit.
... 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 6 more matches
@supports - CSS: Cascading Style Sheets
WebCSS@supports
declaration syntax the most basic supports condition is a simple declaration (a property name followed by a value, separated by a colon).
...the following example returns true if the browser's transform-origin property considers 5% 5% valid: @supports (transform-origin: 5% 5%) {} function syntax the second basic supports condition is a supports function, the syntax for these is supported by all browsers, but the functions themselves are still being standardized.
...the following example returns true if the browser supports the child combinator: @supports selector(a > b) {} the not operator the not operator can precede any expression to create a new expression, resulting in the negation of the original one.
...And 6 more matches
Box-shadow generator - CSS: Cascading Style Sheets
roup:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .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; border: 1px solid #2c9fc9; border-radius: 3px; position: relative; top: -3px; left: 0%; } .ui-slider-btn-set { width: 25px; background-color: #2c9fc9; border-radius: 3px; color: #fff; font-weight: bold; text-align: center; } .ui-slider-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; fo...
...tica, sans-serif; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } #container { width: 100%; padding: 2px; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* container with shadows stacks */ #stack_container { height: 400px; overflow: hidden; position: relative; border: 1px solid #ccc; border-radius: 3px; -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: borde...
...And 6 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
basic examples the following examples demonstrate how some of the box alignment properties are applied in grid and flexbox.
...the inline axis is the axis along which words in a sentence flow in the writing mode being used — for english, for example, the inline axis is horizontal.
... the below image shows an alignment container with two alignment subjects inside.
...And 6 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
you can take a look at the code of this example below.
... properties that control alignment the properties we will look at in this guide are as follows.
... 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.
...And 6 more matches
Logical properties for floating and positioning - CSS: Cascading Style Sheets
mapped properties and values the table below details the properties and values discussed in this guide along with their physical mappings.
... in the example below i have two boxes — the first has the box floated with float: left, the second with float: inline-start.
... if you change the writing-mode to vertical-rl or the direction to rtl you will see that the left-floated box always sticks to the left, whereas the inline-start-floated item follows the direction and writing-mode.
...And 6 more matches
CSS Tutorials - CSS: Cascading Style Sheets
WebCSSTutorials
using multiple backgrounds backgrounds are fundamental for nice styling: css allows you to set several of them on each box.
... scaling background images css allows you to resize images used as an element's background.
... css animations css3 animations allow you to define configurations of style, as keyframes, and to transition between them defining an animation.
...And 6 more matches
<display-outside> - CSS: Cascading Style Sheets
the <display-outside> keywords specify the element’s outer display type, which is essentially its role in flow layout.
... 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.
...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.
...And 6 more matches
resize - CSS: Cascading Style Sheets
WebCSSresize
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.
... 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 a mechanism for allowing the user to resize it in the horizontal direction.
...And 6 more matches
<input type="checkbox"> - HTML: Hypertext Markup Language
WebHTMLElementinputcheckbox
a checkbox allows you to select single values for submission in a form (or not).
... note: radio buttons are similar to checkboxes, but with an important distinction — radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off.
... where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected.
...And 6 more matches
<input type="range"> - HTML: Hypertext Markup Language
WebHTMLElementinputrange
events change and input supported common attributes autocomplete, list, max, min, and step idl attributes list, value, and valueasnumber methods stepdown() and stepup() validation there is no pattern validation available; however, the following forms of automatic validation are performed: if the value is set to something which can't be converted into a valid floating-point number, validation fails because the input is suffering from a bad input.
...rangeelem.min : rangeelem.min + (rangeelem.max - rangeelem.min)/2; if an attempt is made to set the value lower than the minimum, it is set to the minimum.
... additional attributes in addition to the attributes shared by all <input> elements, range inputs offer the following attributes: attribute description list the id of the <datalist> element that contains optional pre-defined options max the maximum permitted value min the minimum permitted value step the stepping interval, used both for user interface and validation purposes list the values of the list attribute is the id of a <datalist> element located in the same document.
...And 6 more matches
<input type="week"> - HTML: Hypertext Markup Language
WebHTMLElementinputweek
<input> elements of type week create input fields allowing easy entry of a year plus the iso 8601 week number during that year (i.e., week 1 to 52 or 53).
... you can also get and set the value in javascript using the input element's value property, for example: var weekcontrol = document.queryselector('input[type="week"]'); weekcontrol.value = '2017-w45'; additional attributes in addition to the attributes common to <input> elements, week inputs offer the following attributes: attribute description max the latest year and week to accept as valid input min the earliest year and week to accept as valid input readonly a boolean which, if present, indicates that the user cannot edit the field's contents step the stepping interval (the distance between allowed values) to use for both user interf...
... step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below.
...And 6 more matches
Inline elements - HTML: Hypertext Markup Language
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.
...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.
...And 6 more matches
Content negotiation - HTTP
the default value identity is at the lowest priority (unless otherwise declared).
...a default value is often set according the language of the graphical interface of the user agent, but most browsers allow to set different language preferences.
... a product token is a name followed by a '/' and a version number, like firefox/4.0.1.
...And 6 more matches
Content-Security-Policy - HTTP
the http content-security-policy response header allows web site administrators to control resources the user agent is allowed to load for a given page.
... elements controlled by object-src are perhaps coincidentally considered legacy html elements and are not receiving new standardized features (such as the security attributes sandbox or allow for <iframe>).
... trusted-types used to specify an allow-list of trusted types policies.
...And 6 more matches
Feature-Policy: camera - HTTP
the http feature-policy header camera directive controls whether the current document is allowed to use video input devices.
... when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror.
... syntax feature-policy: camera <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
...And 6 more matches
Feature-Policy: encrypted-media - HTTP
the http feature-policy header encrypted-media directive controls whether the current document is allowed to use the encrypted media extensions api (eme).
... syntax feature-policy: encrypted-media <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: microphone - HTTP
the http feature-policy header microphone directive controls whether the current document is allowed to use audio input devices.
... when this policy is enabled, the promise returned by mediadevices.getusermedia() will reject with a notallowederror.
... syntax feature-policy: microphone <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
...And 6 more matches
Feature-Policy: midi - HTTP
the http feature-policy header midi directive controls whether the current document is allowed to use the web midi api.
... syntax feature-policy: midi <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: payment - HTTP
the http feature-policy header field's payment directive controls whether the current document is allowed to use the payment request api.
... syntax feature-policy: payment <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: picture-in-picture - HTTP
the http feature-policy header picture-in-picture directive controls whether the current document is allowed to play a video in a picture-in-picture mode via the corresponding api.
... syntax feature-policy: picture-in-picture <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: screen-wake-lock - HTTP
the http feature-policy header screen-wake-lock directive controls whether the current document is allowed to use screen wake lock api to indicate that device should not dim or turn off the screen.
... syntax feature-policy: screen-wake-lock <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: sync-xhr - HTTP
the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xmlhttprequest requests.
... syntax feature-policy: sync-xhr <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: usb - HTTP
the http feature-policy header usb directive controls whether the current document is allowed to use the webusb api.
... syntax feature-policy: usb <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: wake-lock - HTTP
the http feature-policy header wake-lock directive controls whether the current document is allowed to use wake lock api to indicate that device should not enter power-saving mode.
... syntax feature-policy: wake-lock <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Feature-Policy: xr-spatial-tracking - HTTP
the http feature-policy header xr-spatial-tracking directive controls whether the current document is allowed to use the webxr device api.
... syntax feature-policy: xr-spatial-tracking <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 6 more matches
Array.prototype.forEach() - JavaScript
(for sparse arrays, see example below.) callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is provided to foreach(), it will be used as callback's this value.
...(see this example, below.) foreach() executes the callback function once for each array element; unlike map() or reduce() it always returns the value undefined and is not chainable.
... the following example illustrates an alternative approach, using foreach().
...And 6 more matches
this - JavaScript
since the following code is not in strict mode, and because the value of this is not set by the call, this will default to the global object, which is window in a browser.
... function f1() { return this; } // in a browser: f1() === window; // true // in node: f1() === globalthis; // true in strict mode, however, if the value of this is not set when entering an execution context, it remains as undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() === undefined; // true in the second example, this should be undefined, because f2 was called directly and not as a method or property of an object (e.g.
... to set the value of this to a particular value when calling a function, use call(), or apply() as in the examples below.
...And 6 more matches
Template literals (Template strings) - JavaScript
template literals are string literals allowing embedded expressions.
... using normal strings, you would have to use the following syntax in order to get multi-line strings: console.log('string text line 1\n' + 'string text line 2'); // "string text line 1 // string text line 2" using template literals, you can do the same like this: console.log(`string text line 1 string text line 2`); // "string text line 1 // string text line 2" expression interpolation in order to embed expressions within normal strings, you woul...
...d use the following syntax: let a = 5; let b = 10; console.log('fifteen is ' + (a + b) + ' and\nnot ' + (2 * a + b) + '.'); // "fifteen is 15 and // not 20." now, with template literals, you are able to make use of the syntactic sugar, making substitutions like this more readable: let a = 5; let b = 10; console.log(`fifteen is ${a + b} and not ${2 * a + b}.`); // "fifteen is 15 and // not 20." nesting templates in certain cases, nesting a template is the easiest (and perhaps more readable) way to have configurable strings.
...And 6 more matches
MathML documentation index - MathML
WebMathMLIndex
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.
... 10 <maction> mathml, mathml reference, mathml:element, mathml:enlivening expressions the following example uses the "toggle" actiontype: 11 <math> mathml, mathml reference, mathml:element the top-level element in mathml is <math>.
... 19 <mmultiscripts> mathml, mathml reference, mathml:element, mathml:script and limit schemata the mathml <mmultiscripts> element allows you to create tensor-like objects.
...And 6 more matches
Mobile first - Progressive web apps (PWAs)
mobile constraints we have already mentioned the fact that mobiles generally have less memory, processing power and bandwidth than other devices (although bear in mind that smart tvs are also generally pretty low powered.) they also have less viewport size available.
...you should at least consider it as an option, especially if you are experiencing slow or laggy performance when your application is running on mobile.
...see below for more details.
...And 6 more matches
d - SVG: Scalable Vector Graphics
WebSVGAttributed
the commands are detailed below.
...an upper-case command specifies absolute coordinates, while a lower-case command specifies coordinates relative to the current position.
...any subsequent coordinate pair(s) are interpreted as parameter(s) for implicit absolute lineto (l) command(s) (see below).
...And 6 more matches
stroke-linejoin - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element 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...
... --> <path d="m9,11 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="arcs" /> <!-- the following pink lines highlight the position of the path for each stroke --> <g id="highlight"> <path d="m1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="pink" fill="none" stroke-width="0.025" /> <circle cx="1" cy="5" r="0.05" fill="pink" /> <circle cx="3" cy="2" r="0.05" fill="pink" /> <circle cx="5" cy="5.5" r="0.05" fill="pink" /> </g> <use xlink:href="#highlight"...
...use xlink:href="#highlight" x="12" /> <use xlink:href="#highlight" x="2" y="6" /> <use xlink:href="#highlight" x="8" y="6" /> </svg> usage context value arcs | bevel |miter | miter-clip | round default value miter animatable yes arcs note: the arcs value as been introduced in svg2 and it isn't widely supported yet, see browser compatibility bellow for details.
...And 6 more matches
WebAssembly Concepts - WebAssembly
it is not primarily intended to be written by hand, rather it is designed to be an effective compilation target for low-level source languages like c, c++, rust, etc.
... webassembly goals webassembly is being created as an open standard inside the w3c webassembly community group with the following goals: be fast, efficient, and portable — webassembly code can be executed at near-native speed across different platforms by taking advantage of common hardware capabilities.
... be readable and debuggable — webassembly is a low-level assembly language, but it does have a human-readable text format (the specification for which is still being finalized) that allows code to be written, viewed, and debugged by hand.
...And 6 more matches
/loader - Archive of obsolete content
there are lots of different possibilities, but the most common setup looks like this: let { loader } = require('toolkit/loader'); let loader = loader({ paths: { // resolve all modules starting with `toolkit/` as follows: // toolkit/foo -> resource://gre/modules/commonjs/toolkit/foo.js // toolkit/foo/bar -> resource://gre/modules/commonjs/toolkit/foo/bar.js 'toolkit/': 'resource://gre/modules/commonjs/toolkit/', // resolve all other non-relative module requirements as follows: // devtools/gcli -> resource:///modules/devtools/gcli.js // panel -> resource:///modules/...
...in those cases you have to decide what the entry point module is relative to and provide an appropriate mapping for it: let { loader } = require('toolkit/loader'); let loader = loader({ paths: { // resolve all modules starting with `toolkit/` as follows: // toolkit/foo -> resource://gre/modules/commonjs/toolkit/foo.js // toolkit/foo/bar -> resource://gre/modules/commonjs/toolkit/foo/bar.js 'toolkit/': 'resource://gre/modules/commonjs/toolkit/', // resolev all other non-relative module requirements as follows: // devtools/gcli -> resource:///modules/devtools/gcli.js // panel -> resource:///modules/...
...panel.js '': 'resource:///modules/', // allow relative urls and resolve them to add-on root: // ./main -> resource://my-addon/root/main.js './': 'resource://my-addon/root/' } }); the order of keys in paths is irrelevant since they are sorted by keys from longest to shortest to allow overlapping mapping.
...And 5 more matches
platform/xpcom - Archive of obsolete content
for example, the add-on below implements the nsiobserver interface to listen for and log all topic notifications: var { class } = require('sdk/core/heritage'); var { unknown } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome') var observerservice = cc['@mozilla.org/observer-service;1'].
... for example, this add-on defines a subclass of unknown called helloworld that implements a function called hello.
... by creating a factory and passing it the contract id for the helloworld component and the helloworld constructor, we enable xpcom clients to access the helloworld component, given its contract id.
...And 5 more matches
cfx - Archive of obsolete content
cfx supports the following global options: -h, --help - show a help message and exit -v, --verbose - enable lots of output "command-specific options" are documented alongside the commands.
... this command will create an skeleton add-on, as a starting point for your own add-on development, with the following file structure: my-addon data docs main.md lib main.js package.json readme.md tests test-main.js cfx run this command is used to run the add-on.
... for example, to pass the -jsconsole argument to firefox, which will launch the javascript error console, try the following: cfx run --binary-args -jsconsole to pass multiple arguments, or arguments containing spaces, quote them: cfx run --binary-args '-url "www.mozilla.org" -jsconsole' --extra-packages=extra_packages extra packages to include, specified as a comma-separated list of package names.
...And 5 more matches
File I/O - Archive of obsolete content
if you need to use file:// uris as initializers, see discussion of nsiioservice below.
...however, you can enumerate available drives using the following code: components.utils.import("resource://gre/modules/fileutils.jsm"); var root = new fileutils.file("\\\\."); var drivesenum = root.directoryentries, drives = []; while (drivesenum.hasmoreelements()) { drives.push(drivesenum.getnext().
...an example below shows how you should save a path in user prefs.
...And 5 more matches
Intercepting Page Loads - Archive of obsolete content
attaching the load event handler to gbrowser allows us to listen to these events for all tabs, without having to worry how many tabs are open.
...the channel is available to allow you to modify headers and such.
...aevent.target; let webprogress = gbrowser.getbrowserfortab(tab).webprogress; this._toggleprogresslistener(webprogress, ("tabopen" == aevent.type)); }, _toggleprogresslistener : function(awebprogress, aisadd) { if (aisadd) { awebprogress.addprogresslistener(this, awebprogress.notify_all); } else { awebprogress.removeprogresslistener(this); } } this shouldn't be too hard to follow.
...And 5 more matches
Source Navigator - Archive of obsolete content
but on the other hand mxr can only allow you to type in the name for it to generate a long list of occurances.
...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.
...And 5 more matches
Creating regular expressions for a microsummary generator - Archive of obsolete content
for example, the following regular expression matches--and looks exactly like--the beginning of the url: http:// but some characters are special in regular expressions.
... for example, a period (.) matches any character, and a period followed by an asterisk (.*) matches any combination of characters.
...so we remove the item number, leaving us with the following regular expression: ^http://cgi\.ebay\.com/ws/ebayisapi\.dll\?viewitem&item= accommodating variations in query parameters we now have a regular expression that matches all four example urls.
...And 5 more matches
Repackaging Firefox - Archive of obsolete content
the following diagram represents an overview of the process and the pieces involved: you will need the following to get started: a macintosh computer (even for repackaging windows or linux only); it may be either powerpc or intel based.
...more about this below.
...at the very least, don't skip the "important extension preferences" section below.
...And 5 more matches
Style System Overview - Archive of obsolete content
style context api the style context api allows data to be obtained through a set of structs (see nsstylestruct.h).
...this is big, and slow to fill in.
... the rule tree allows sharing.
...And 5 more matches
Table Layout Strategy - Archive of obsolete content
the code the layout strategies are invoked from nstableframe::reflow.
...on the first reflow nstableframe::balancecolumnwidths is called.
...in the following the basic table layout strategy is discussed.
...And 5 more matches
URIs and URLs - Archive of obsolete content
resources are identified by uri "uniform resource identifier" (taken from rfc 2396): uniform uniformity provides several benefits: it allows different types of resource identifiers to be used in the same context, even when the mechanisms used to access those resources may differ; it allows uniform semantic interpretation of common syntactic conventions across different types of resource identifiers; it allows introduction of new types of resource identifiers without interfering with the way that existing identifiers are used; and, it allows the identifiers to be reused in many different contex...
...together these segments form the url spec with the following syntax: scheme://username:password@host:port/directory/filebasename.fileextension;param?query#ref for performance reasons the complete spec is stored in escaped form in the nsstandardurl object with pointers (position and length) to each basic segment and for the more global segments like path and prehost for example.
...an escaped character is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing the octet code.
...And 5 more matches
Using Breakpoints in Venkman - Archive of obsolete content
the first click will clear the hard breakpoint and leave you with only a future breakpoint, which is represented by a yellow letter "f".
... advanced breakpoints venkman allows you to associate a breakpoint with a script that will be executed in the scope of the function when that breakpoint is hit.
...the following options are available: continue regardless of result causes venkman to continue normal execution after running the breakpoint script.
...And 5 more matches
Binding Attachment and Detachment - Archive of obsolete content
in the following example, a binding is referenced that will be attached to all html checkbox elements.
... for example, given a binding d1, with an explicit inheritance chain of d1 -> d2 -> d3 if this element is attached to an element using element.style.mozbinding that already has a binding chain of s1 -> s2 -> s3 the resulting binding chain following the addition of the binding is d1 -> d2 -> d3 -> s1 -> s2 -> s3 the inheritance between d3 and s1 is implicit, meaning that there is no connection in the xbl documents between the two bindings.
... when a binding is attached, the following events occur: if required, anonymous content is cloned from the binding's content template and inserted around the bound element.
...And 5 more matches
Creating XPI Installer Modules - Archive of obsolete content
under the chrome/ directory, you'll notice that in addition to the package subdirectories, there are now also a handful of jar files, or java archives (see figure below).
...what follows is a very brief overview of the design and a description of what mozilla expects in installable packages.
...package creation overview this tutorial describes the following sequence of steps for creating a new package: developing the resources organizing the resources creating the contents.rdf file making the barley install script creating a xpi you can examine (or install!) the package described here by downloading the barley xpi file and using a zip unarchiver[zip] to open it.
...And 5 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
first, a quick scan of the contents of the xpi file (which you can open using with any unzip utility) reveals the following high-level directory structure: install.js bin\ chrome\ components defaults\ icons\ plugins\ res\ note that this high-level structure parallels the directory structure of the installed browser very closely: as you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself,...
... most installation scripts, including the one discussed here, take the following basic form (in pseudo-code and with links to the sections in which these installation steps are documented): initinstall(); if (verify_space()) { err = add_dirs_and_files; register_files; if (err==success) { performinstall() }; else { cancelinstall() }; } as you can see in the code listing, the verification process at the top is on lines 1 to 18; the file addition process, here part of the main install...
... the initinstall method takes the following parameters: the display name of the package, the name of the package as it appears in the client registry, and the version, which can be expressed as a number or as an installversion object.
...And 5 more matches
Introduction to XUL - Archive of obsolete content
conceptually, the xul language will allow someone with a text editor, given a package of components which can work together, the ability to put together an application by specifying something like this (for an application on an os using menubars across the top of its applications' windows): main window containing menubar area at top across width of window containing menubar (and its contents) toolbar area below menubar across wi...
...dth of window containing main toolbar (and its contents) application-specific content area below toolbar area structure of a xul file our language of choice is xml, flavoured with css stylistic information.
...these elements are widgets and certain infrastructure associated with the behaviour of the window, explained below.
...And 5 more matches
Install Scripts - Archive of obsolete content
the install script is even flexible enough to allow you to uninstall files.
...some of the install object's functions will be described below.
... the install script should take the following steps: initialize the installation by specifying what package and version is being installed.
...And 5 more matches
Popup Menus - Archive of obsolete content
creating a popup menu xul has three different types of popups, described below.
...the sample below shows how we might do this: example 1 : source view <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <box context="clipmenu"> <label value="context click for menu"/> </box> here, the menupopup has been associated with a box.
...however, it does allow you to use any content besides text in a tooltip.
...And 5 more matches
Trees - Archive of obsolete content
ArchiveMozillaXULTutorialTrees
a tree also allows the user to rearrange, resize and hide individual columns.
...this allows the view to be optimized such that it only needs to load the data for displayed content.
... an advantage of using a tree view is that it allows the view to store the data in a manner which is more suitable for the data, or to load the data on demand as rows are displayed.
...And 5 more matches
XPCOM Interfaces - Archive of obsolete content
you can get a component using javascript code like that below: var afile = components.classes["@mozilla.org/file/local;1"].createinstance(); the file component is retrieved and stored in the afile variable.
...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.
...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.interfaces.nsisound); xpcom interfaces can inherit from other interfaces.
...And 5 more matches
The Implementation of the Application Object Model - Archive of obsolete content
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.
...they are likely to change following the first release of nglayout, and when they do, anyone that implemented one of those interfaces will have to change as well in order to upgrade to the new world.
...a picture (provided by chris waterson) of the xul/rdf architecture is shown below.
...And 5 more matches
browser - Archive of obsolete content
droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the following arguments.
... droppedlinkhandler(event, uri, name) -- firefox 51 or older droppedlinkhandler(event, links) -- firefox 52 or newer event -- drop event, or null if no event is available uri -- uri string of the dropped link name -- name string of the dropped link links -- array of the dropped items with nsidroppedlinkitem interface homepage type: url this attribute allows you to set a homepage for the browser element.
... type type: one of the values below.
...And 5 more matches
scrollbox - Archive of obsolete content
if you just want scrollbars to appear, add style='overflow: auto;'.
... examples the following shows the xul for a bunch of labels.
...el value="02 our fathers brought forth on "/> <label value="03 this continent, a new nation, "/> <label value="04 conceived in liberty, and "/> <label value="05 dedicated to the proposition "/> <label value="06 that all men are created equal."/> </vbox> the next bunch of labels is similar, but if the container doesn't give enough room for it, scroll bars will sprout out of nowhere and allow the user to scroll around the big content in the small view space.
...And 5 more matches
tabbrowser - Archive of obsolete content
addtab( url, referreruri, charset, postdata, owner, allowthirdpartyfixup ) addtab( url, {referreruri: ..., charset: ..., postdata: ..., owner: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
... firefox 3.6 note the second form of this method was added in firefox 3.6; it allows you to specify the parameters by name, in any order.
... loadonetab( url, referreruri, charset, postdata, loadinbackground, allowthirdpartyfixup ) loadonetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackground: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
...And 5 more matches
toolbarbutton - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir type: one of the values below the direction in which the child elements of the element are placed.
... the disabled attribute is allowed only for form controls.
...And 5 more matches
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
in most cases, developers of xulrunner applications can download an existing sdk and follow the instructions in getting started with xulrunner.
...follow the instructions for meeting build requirements and getting the source, then come back here since the build process itself will be slightly different.
...make sure you change the application name (following ac_add_app_options to that of your app.
...And 5 more matches
XULRunner tips - Archive of obsolete content
the following prefs must also be set to make the xpinstall dialog, extension manager, and theme manager work: pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallconfirm.xul"); pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?type=themes"); pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?type=ex...
... 1.9 or greater, you can create your own alias in your chrome manifest add a "skin" line: skin communicator classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single css file named "communicator.css" with this content: @import url("chrome://global/skin"); dom inspector to add dom inspector 2.0.* to your xulrunner 1.9.0.* application follow these steps: download the dom inspector (instead of clicking the "add to..." button, right-click and select "save link as...").
... save the dom_inspector-*.xpi package to a temporary directory unzip the package copy the following files: chrome/inspector.jar to the chrome directory of your xulrunner application components/inspector-cmdline.js to your components directory defaults/preferences/inspector.js to your preferences directory open your chrome.manifest file and add these lines: content inspector jar:inspector.jar!/content/inspector/ xpcnativewrappers=no locale inspector en-us jar:inspector.jar!/locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/skin/modern/inspector/ skin inspector classic/1.0 jar:inspector.jar!/skin/classic/inspector/ overlay chrome://inspector/content/popupoverlay.xul chrome://inspector/content/view...
...And 5 more matches
Gecko Compatibility Handbook - Archive of obsolete content
or, if you are using user-agent detection, you can install an extension in firefox or mozilla which allows you to "spoof" the user-agent strings of the various gecko browsers.
...once you filled the dialog box (it should look like the screenshot below), click ok and close theoptions dialog.
... review your results the following scenarios all relate to browser detection.
...And 5 more matches
Mozilla release FAQ - Archive of obsolete content
some people are just rude, and some people have a low tolerance for uninformed people.
...regarding shells, i would like to recommend the following: if you are using unix, use bash-family shells for the build because of the better control over redirection (in case you want to log errors and messages) if you are using win32, using the default shell cmd.exe (as opposed to 4dos or 4nt) will probably yield better results.
... regarding compilation options, it would be good not to compile with optimization, because it's much slower to build, and on windows platforms, there's a bug in some versions of vc++ that makes mozilla crash in many common circumstances if compiled with optimization on.
...And 5 more matches
2006-09-29 - Archive of obsolete content
it was determined that the generated elements from wordpress do not follow the wc3 guidelines in appendix c of xhtml 1.0.
...details can be located at layout confusion refactoring the nshtmlreflowstate(computeblockboxdata, initconstraints) and nsimageframe::getdesiredsize which uses ns_inrinsicsize, into the following method: /** * compute the size that a frame will occupy.
... called while * constructing the nshtmlreflowstate to be used to reflow the frame, * in order to fill its mcomputedwidth and mcomputedheight member * variables.
...And 5 more matches
NPAPI plugin reference - Archive of obsolete content
the articles below describe each of the apis related to npapi plugins.
... browser-side plug-in api this chapter describes methods in the plug-in api that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth.
... np_getvalue allows the browser to query the plug-in for information.
...And 5 more matches
Processing XML with E4X - Archive of obsolete content
variables and expressions can be used to create attribute values by simply wrapping them with braces ({}) and omitting quotation marks that would normally go around an attribute value, as the following example illustrates: var a = 2; var b = <foo bar={a}>"hi"</foo>; upon execution the variable is evaluated and quotes are automatically added where appropriate.
...one must instead either calculate the variable with a javascript expression (e.g., bar={'a'+var1+var2}), define a new variable before the element literal which includes the full interpolation and then include that variable or retrieve the attribute after the literal to alter it (see below).
... objects representing xml elements provide a number of useful methods, some of which are illustrated below: todo: add all of the methods to the javascript reference, link from here alert(person.name.text()) // bob smith var xml = person.name.toxmlstring(); // a string containing xml var personcopy = person.copy(); // a deep copy of the xml object var child = person.child(1); // the second child node; in this case the <likes> element working with xmllists in addition to the xml object, e4x intro...
...And 5 more matches
Using the Right Markup to Invoke Plugins - Archive of obsolete content
e="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="366" height="142" id="myflash"> <param name="movie" value="javascript-to-flash.swf" /> <param name="quality" value="high" /> <param name="swliveconnect" value="true" /> </object> in the above example, the classid attribute that goes along with the object element points to a "clsid:" urn followed by the unique identifier of an activex control (in the above example, the string beginning with "d27...").
...future netscape browsers based on mozilla source code will allow the use of a special param element to specify where to get plugins that are not present, but this feature is not available in netscape 7.
...thus, in the following example, instead of stopping at the activex control, ie will display the same animation twice since it also understands the mime type for flash: <!-- usage will not work as intended --> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="366" height="142" id="myflash"> <param na...
...And 5 more matches
Archive of obsolete content
2015 mdn fellowship program add-ons archived add-ons documentation.
... archived open web documentation the documentation listed below is archived, obsolete material about open web topics.
... list of former mozilla-based applications the following is a list of all known applications that at one point used mozilla technologies or that are no longer being actively maintained.
...And 5 more matches
Game promotion - Game development
plus competitions generally require games to follow a mandatory theme, so you can get creative around a theme if you are stuck for ideas.
...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.
...And 5 more matches
Mobile accessibility - Learn web development
to make a website accessible and usable on mobile, you just need to follow general good web design and accessibility best practices.
...follow any additional on-screen prompts that you are presented with.
... global and local menus talkback allows you to access global and local context menus, wherever you have navigated to on the device.
...And 5 more matches
CSS building blocks - Learn web development
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.
... css selectors there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style.
...And 5 more matches
Test your skills: Flexbox - Learn web development
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.
...the finished example should look like the image below.
...And 5 more matches
How do I use GitHub Pages? - Learn web development
it allows you to upload code repositories for storage in the git version control system.
... publishing content github is a very important and useful community to get involved in, and git/github is a very popular version control system — most tech companies now use it in their workflow.
... github has a very useful feature called github pages, which allows you to publish website code live on the web.
...And 5 more matches
Your first form - Learn web development
forms allow users to enter data, which is generally sent to a web server for processing and storage (see sending form data later in the module), or used on the client-side to immediately update the interface in some way (for example, add another item to a list, or show or hide a ui feature).
...it's beyond the scope of this article to cover the user experience of forms, but if you want to dig into that topic you should read the following articles: smashing magazine has some good articles about forms ux, including an older but still relevant extensive guide to web form usability article.
...we will use the following html elements: <form>, <label>, <input>, <textarea>, and <button>.
...And 5 more matches
CSS basics - Learn web development
(if you haven't been following our project, pause here to read dealing with files and html basics.) open your index.html file.
... paste the following line in the head (between the <head> and </head> tags): <link href="styles/style.css" rel="stylesheet"> save index.html and load it in your browser.
... add the following lines (shown below), replacing the font-family assignment with your font-family selection from what will your website look like?.
...And 5 more matches
Introducing asynchronous JavaScript - Learn web development
synchronous javascript to allow us to understand what asynchronous javascript is, we ought to start off by making sure we understand what synchronous javascript is.
...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.
...in the below sections we'll review each of these in turn.
...And 5 more matches
Functions — reusable blocks of code - Learn web development
previous overview: building blocks next another essential concept in coding is functions, which allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command — rather than having to type out the same code multiple times.
... 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 — many of these functions are calling parts of the background browser code, which is written largely in low-level system languages like c++, not web languages like javascript.
...And 5 more matches
Test your skills: Strings - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 5 more matches
JavaScript object basics - Learn web development
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.
...i\'m ' + this.name[0] + '.'); } }; after saving and refreshing, try entering some of the following into the javascript console on your browser devtools: person.name person.name[0] person.age person.interests[1] person.bio() person.greeting() you have now got some data and functionality inside your object, and are now able to access them with some nice simple syntax!
...And 5 more matches
The "why" of web performance - Learn web development
overview: performance next web performance is all about making websites fast, including making slow processes seem fast.
...bad performing sites are slow to display and slow to respond to input.
...the same site will be slow to load, possibly verging on unusable depending on cell coverage.
...And 5 more matches
Routing in Ember - Learn web development
because that application template is the entry point to our todo app, we'll need to make some changes to allow for routing.
...to do this you’ll need to enter the following commands into your terminal, inside the root directory of your app: ember generate route index ember generate route completed ember generate route active the second and third commands should have not only generated new files, but also updated an existing file, app/router.js.
... it 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.
...And 5 more matches
Accessibility in React - Learn web development
let's see this in action; put the following useeffect() call just above the return statement in the body of todo(), and pass into it a function that logs the words "side effect" to your console: useeffect(() => { console.log("side effect"); }); to illustrate the difference between the main render process and code run inside useeffect(), add another log – put this one below the previous addition: console.log("main render"); now, ...
... paste the following code near the top of todo.js, above your todo() function.
...we want this constant to track the previous value of isediting, so we call useprevious with isediting as an argument: const wasediting = useprevious(isediting); with this constant, we can update our useeffect() hook to implement the pseudocode we discussed before — update it as follows: useeffect(() => { if (!wasediting && isediting) { editfieldref.current.focus(); } if (wasediting && !isediting) { editbuttonref.current.focus(); } }, [wasediting, isediting]); note that the logic of useeffect() now depends on wasediting, so we provide it in the array of dependencies.
...And 5 more matches
Componentizing our React app - Learn web development
that second bullet is especially valuable: making a component out of common ui elements allows you to change your code in one place and see those changes everywhere that component is used.
...the following commands make a components directory and then, within that, a file called todo.js.
...open it up and give it its first line: import react from "react"; since we're going to make a component called todo, you can start adding the code for that to todo.js too, as follows.
...And 5 more matches
Beginning our React todo list - Learn web development
previous overview: client-side javascript frameworks next let's say that we’ve been tasked with creating a proof-of-concept in react – an app that allows users to add, edit, and delete tasks they want to work on, and also mark tasks as complete without deleting them.
...our app should fulfill the following stories: as a user, i can read a list of tasks.
... then, copy and paste the following commands into your terminal to delete some unneeded files.
...And 5 more matches
Starting our Svelte Todo list app - Learn web development
note: you can put your components anywhere inside the src folder, but the components folder is a recognized convention to follow, allowing you to find your components easily.
... create a file named src/components/todos.svelte with the following content: <h1>svelte to-do list</h1> change the title element in public/index.html to contain the text svelte to-do list: <title>svelte to-do list</title> open src/app.svelte and replace its contents with the following: <script> 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.
...copy and paste the following into our todos.svelte component file, replacing the existing content: <!-- todos.svelte --> <div class="todoapp stack-large"> <!-- newtodo --> <form> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg"> what needs to be done?
...And 5 more matches
Understanding client-side JavaScript frameworks - Learn web development
beginning our react todo list let's say that we’ve been tasked with creating a proof-of-concept in react – an app that allows users to add, edit, and delete tasks they want to work on, and also mark tasks as complete without deleting them.
...react interactivity: events and state with our component plan worked out, it's now time to start updating our app from a completely static ui to one that actually allows us to interact and change things.
...this includes allowing you to edit existing tasks and filtering the list of tasks between all, completed, and incomplete tasks.
...And 5 more matches
CSUN Firefox Materials
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.
..." - alan cantor, cantor access consulting (http://www.cantoraccess.com) firefox includes keyboard access to all of its amazing features: find as you type allows for quick navigation to links and text searching without opening a separate dialog -- this allows more convenient use by screen magnification users because there is a single point of regard for the search.
... browse with caret allows users to select arbitrary content with the keyboard and move through content as if inside a read-only editor.
...And 5 more matches
Embedding API for Accessibility
there are many other pieces, such as preferences to allow the user to change foreground and background colors, and font sizes.
...be aware that in debug builds, this can cause a great number of assertions (bug 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.image.imagebehavior", behavior); /* behavior: 0=accept, 1=accept images from originating server only, 2=no images */ moz 0.8 cookies setintpref("network.cookie.cookiebehavior", behavior); /* behavior: 0=accept, 1=accept cookies from originating server only, 2=no cookies */ setboolpref("network.cookie.warnaboutcookies", boolw...
...And 5 more matches
Using the Browser API
MozillaGeckoChromeAPIBrowser APIUsing
the html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications.
... demo to demonstrate basic usage of this api, we have created a simple browser api demo that provides buttons allowing you to (re)load web pages, stop loading, move forward and back in history, and zoom in and out of the page.
... in any case, you should at least download the repo and refer to the code as you read the sections below.
...And 5 more matches
Introduction to Layout in Mozilla
overview basic data flow key data structures detailed walk-through incrementalism future tech-talks wrap-up, q&a basic data flow source document arrives via network apis incrementally “pumped” through the single-threaded layout engine parse, compute style, render; repeat css used for rendering all content content theoretically separate from “presentation” key data structures content node elements, attributes, leaves dom frame rectangular formatting primitive geometric information [0..n] per content node 2nd thru nth are “continuations” style context non-geometric information may be shared by adjacent frames reference counted, owned by frame ...
... may not be directly manipulated detailed walk-through setting up content model construction frame construction style resolution reflow painting setting up assume basic knowledge of embedding and network apis (doc shell, streams) content dll auto-registers a document loader factory (dlf) @mozilla.org/content-viewer-factory/view;1?type=text/html all mime types mapped to the same class, nscontentdlf nsdocshell receives inbound content via nsdsuricontentlistener invokes nsidlf::create...
...reset style context object is a placeholder for partially computed stylistic data style data is computed lazily, as it is asked for reflow recursively compute geometry (x, y, w, h) for frames, views, and widgets given w & h constraints of “root frame” compute (x, y, w, h) for all children constraints propagated “down” via nshtmlreflowstate desired size returned “up” via nshtmlreflowmetrics basic pattern parent frame initializes child reflow state (available w, h); places child ...
...And 5 more matches
Localizing extension descriptions
because a new method for doing so was implemented in gecko 1.9 (firefox 3), there are two sets of instructions below.
...the following example demonstrates this (most normal manifest properties have been removed for brevity): <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>tabsidebar@blueprintit.co.uk</em:id> <em:localized> <description> <em:locale>de-de</em:locale> <em...
...n> <em:locale>nl-nl</em:locale> <em:name>tab sidebar</em:name> <em:description>laat voorbeeldweergaven van uw tabbladen in de zijbalk zien.</em:description> </description> </em:localized> <em:name>tab sidebar</em:name> <em:description>displays previews of your tabs in your sidebar.</em:description> </description> </rdf> all of the metadata mentioned below can be localized in this way.
...And 5 more matches
Localization formats
advantages to html good for small projects very simple for web developers gives localizers the exact context of translations a localizer who knows basic html can style translations to make sure translations display correctly...we can allow slight modifications (e.g.
... rtl or wider display) gives the possibility to customize content per locale simple workflow, just put the file on svn and it can appear on the staging server disadvantages to html very hard for qa if localizer changes something incorrectly (i.e.
...that file will have the following structure: ;getting started débuter avec firefox the english content is designated by the semi-colon and the localizer provides the translation underneath.
...And 5 more matches
MathML Demo: <mo> - operator, fence, separator, or accent
binary operators and relations the following table contains instances of all operators found on the swp binary operations and binary relations panels.
...� c a ⊎ b ⋖ c a ⌆ b ⋗ c a ⨿ b ∣ c a ⊴ b ∥ c a ⊵ b ∼ c a ▽ b ≈ c a △ b ≊ c a ⋄ b ⪸ c a † b ⪷ c a ‡ b ∋ c a ⊞ b \vartriangle c arrows the following table contains instances of all arrows found on the swp arrows panel.
... a - b ↫ c a + b ↬ c a - b ⊸ c a + b ⇛ c a - b ⇚ c a + b ↶ c a - b ↷ c a + b ⤏ c a - b ⤎ c a + b ⇒ c a - b ⇐ c a + b ⇔ c negated relations the following table contains instances of all negated relations found on the swp panel.
...And 5 more matches
Activity Monitor, Battery Status Menu and top
the following screenshot shows a customized "energy" tab.
... the power-related columns are as follows.
... energy impact / avg energy impact: see the separate section below.
...And 5 more matches
Investigating leaks using DMD heap scan mode
firefox’s dmd heap scan mode tracks the set of all live blocks of malloc-allocated memory and their allocation stacks, and allows you to log these blocks, and the values stored in them, to a file.
... the particular steps given below are intended for the case where the leaked object is alive all the way through shutdown.
...non-optimized dmd builds will generate better stack traces, but they can be so slow as to be useless.
...And 5 more matches
PR_Shutdown
syntax #include <prio.h> prstatus pr_shutdown( prfiledesc *fd, prshutdownhow how); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a connected socket.
... how the kind of disallowed operations on the socket.
... possible values include the following: pr_shutdown_rcv.
...And 5 more matches
NSS Certificate Download Specification
netscape certificate sequence: this is another pkcs#7 object format, and like the signeddata format, it allows multiple certificates to be imported together.
...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.
...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.
...And 5 more matches
Introduction to Network Security Services
figure 1, below, shows a simplified view of the relationships among the three shared libraries listed above and nspr, which provides low-level cross platform support for operations such as threading and i/o.
...so the nss library has the following forms: libnss3.so - unix shared library libnss3.sl - hp-ux shared library libnss.a - unix static library nss3.dll - windows shared library nss3.lib - windows import library binding to nss3.dll nss.lib - windows static library nss, ssl, and s/mime have all of the above forms.
... the following static libaries aren't included in any shared libraries libcrmf.a/crmf.lib provides an api for crmf operations.
...And 5 more matches
NSS 3.14 release notes
introduction the nss team has released network security services (nss) 3.14, which is a minor release with the following new features: support for tls 1.1 (rfc 4346) experimental support for dtls 1.0 (rfc 4347) and dtls-srtp (rfc 5764) support for aes-ctr, aes-cts, and aes-gcm support for keying material exporters for tls (rfc 5705) in addition to the above new features, the following major changes have been introduced: support for certificate signatures using the md5 hash algorithm is now disabled by default.
...new in nss 3.14 the sections that follow discuss specific changes in nss 3.14 in more detail.
... to better support tls 1.1 and future versions of tls, a new version range api was introduced to allow applications to specify the desired minimum and maximum versions.
...And 5 more matches
NSS 3.35 release notes
see below for details.
...below, are explanations that could be helpful for environments that need to adopt to the new default.
...note that debug builds will use a lower count, for better performance in test environments.
...And 5 more matches
gtstd.html
ssl is built on top of nspr, which handles sockets, threads, and related low-level os operations.
...the instructions that follow assume you are using the certificate database tool to set up both the server and client databases for testing purposes.
...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.
...And 5 more matches
NSS tools : signtool
digital signatures allow ssl-enabled clients to perform two important operations: * confirm the identity of the individual, company, or other entity whose digital signature is associated with the files * check whether the files have been tampered with since being signed if you have a signing certificate, you can use netscape signing tool to digitally sign files and package them as a jar file.
... an object-signing certificate is a special kind of certificate that allows you to associate your digital signature with one or more files.
...for more details, see the description of -m that follows.
...And 5 more matches
GCIntegration - SpiderMonkey Redirect 1
this should be obvious by now, but never ever allow a gc thing point to a gc thing in a different compartment unless it's a wrapper that's registered in the cross-compartment wrapper map.
...in between these slices, non-gc code is allowed to run.
...consider the following example.
...And 5 more matches
JS_GetGCParameter
typedef enum jsgcparamkey { jsgc_max_bytes, jsgc_max_malloc_bytes, jsgc_max_nursery_bytes, jsgc_bytes, jsgc_number, jsgc_mode, jsgc_unused_chunks, jsgc_total_chunks, jsgc_slice_time_budget, jsgc_mark_stack_limit, jsgc_high_frequency_time_limit, jsgc_high_frequency_low_limit, jsgc_high_frequency_high_limit, jsgc_high_frequency_heap_growth_max, jsgc_high_frequency_heap_growth_min, jsgc_low_frequency_heap_growth, jsgc_dynamic_heap_growth, jsgc_dynamic_mark_slice, jsgc_allocation_threshold, jsgc_min_empty_chunk_count, jsgc_max_empty_chunk_count, jsgc_compaction_enabled, jsgc_allocation_threshold_factor, jsgc_allocati...
... jsgc_high_frequency_low_limit / "highfrequencylowlimit" controls for dynamic heap growth.
... when the gc is in "high frequency" mode (see above) then, the heap will be allowed to grow between collections according to these four parameters.
...And 5 more matches
SpiderMonkey 1.8.7
it is much faster than spidermonkey 1.8, implements es-5 (ecma 262, 5th edition), and contains many new language and api features, described in detail below.
...the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
...And 5 more matches
Components.utils.exportFunction
to understand what happens if the functions you export accept arguments, see exporting functions that take arguments below.
...the following options are currently defined: defineas: determines the name of the function in targetscope.
... allowcallbacks: deprecated/redundant from firefox 34.
...And 5 more matches
nsIHttpChannel
netwerk/protocol/http/nsihttpchannel.idlscriptable this interface allows for the modification of http request parameters and the inspection of the resulting http response status and headers when they become available.
...be sent referrer_policy_origin only send the origin of the referring uri referrer_policy_origin_when_xorigin same as the default; only send the origin of the referring uri for cross-origin requests referrer_policy_unsafe_url always send the referrer, even when downgrading from https to http attributes attribute type description allowpipelining boolean this attribute is a hint to the channel to indicate whether or not the underlying http transaction should be allowed to be pipelined with other transactions.
... redirectionlimit unsigned long this attribute specifies the number of redirects this channel is allowed to make.
...And 5 more matches
wrappedJSObject
suppose we register the component below with the @myself.com/my-component;1 contract.
... // constructor function helloworld() { }; helloworld.prototype = { hello: function() { return "hello world!"; }, queryinterface: function(aiid) { if (!aiid.equals(components.interfaces.nsisupports) && !aiid.equals(components.interfaces.nsihelloworld)) throw components.results.ns_error_no_interface; return this; } }; xpconnect wrapping now let's get a reference to our component.
... 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.
...And 5 more matches
Address Book examples
in the following examples: selectedab is the uri of an address book to default the dialog to saving the card in.
...the following options are available.
...for example, in order to register a load listener for a contact, the following should take place within the scope of the contact editor dialog: /* an example load listener for a contact * acard the nsiabcard being loaded * adocument a reference to the contact editor document */ function foo(acard, adocument) { // do something useful, like disabling // input fields that cards for this // address book type do not support.
...And 5 more matches
Mail composition back end
this will change in the coming weeks and allow for developers to write javascript to take advantage of the back end services.
...(for detailed information on the listener interfaces, see the listener interfaces section of this document) nsimsgsend the following describes the methods of the nsimsgsend interface.
...this is something that very well may change as time allows).
...And 5 more matches
Working with data
if type is an array type of unspecified length, the following steps are taken: if the value is a size value, a new array of that length is created, with its cells ready to accept values of the same type as those in the specified array.
... if the type represents a javascript string (that is, an array of jschar characters followed by a null terminator), a copy of that string is created and returned.
... note: these 64-bit integer types are intentionally low on features, so that when javascript adds a "big number" type, we can easily upgrade to support that properly.
...And 5 more matches
AddressErrors - Web APIs
see the examples below to see how this works.
...try to avoid asking the user to make corrections to things they can't change, and there may be situations in which you need to allow validation errors to be accepted anyway (for example, if you validate addresses against a postal service database and a new home has been built and its address is not yet in the database).
...in the example, we're handling a donation to an organization that will be sending a "thank you" gift to the donor, so it requests shipping information along with allowing the donation payment itself.
...And 5 more matches
CanvasRenderingContext2D - Web APIs
see the interface's properties and methods in the sidebar and below.
... drawing text the following methods draw text.
... line styles the following methods and properties control how lines are drawn.
...And 5 more matches
Content Index API - Web APIs
the content index api allows developers to register their offline enabled content with the browser.
...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.
...And 5 more matches
DOMException - Web APIs
note: because historically the errors were identified by a numeric value that corresponded with a named variable defined to have that value, some of the entries below indicate the legacy code value and constant name that were used in the past.
... indexsizeerror the index is not in the allowed range.
...(legacy code value: 5 and legacy constant name: invalid_character_err) nomodificationallowederror the object cannot be modified.
...And 5 more matches
Using files from web applications - Web APIs
the multiple attribute on the input element allows the user to select multiple files.
... example: showing file(s) size the following example shows a possible use of the size property: <!doctype html> <html> <head> <meta charset="utf-8"> <title>file(s) size</title> </head> <body> <form name="uploadform"> <div> <input id="uploadinput" type="file" name="myfiles" multiple> selected files: <span id="filenum">0</span>; total size: <span id="filesize">0</span> </div> <div><input type="submit" ...
... using a label element to trigger a hidden file input element to allow opening the file picker without using javascript (the click() method), a <label> element can be used.
...And 5 more matches
Using the Gamepad API - Web APIs
for example, the first code example above you be rewritten as shown below: window.addeventlistener("gamepadconnected", function(e) { var gp = navigator.getgamepads()[e.gamepad.index]; console.log("gamepad connected at index %d: %s.
... %d buttons, %d axes.", gp.index, gp.id, gp.buttons.length, gp.axes.length); }); the gamepad object's properties are as follows: id: a string containing some information about the controller.
...this information is intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user.
...And 5 more matches
IDBKeyRange.bound() - Web APIs
WebAPIIDBKeyRangebound
the bound() method of the idbkeyrange interface creates a new key range with the specified upper and lower bounds.
... syntax var myidbkeyrange = idbkeyrange.bound(lower, upper); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen, upperopen); parameters lower specifies the lower bound of the new key range.
... loweropen optional indicates whether the lower bound excludes the endpoint value.
...And 5 more matches
Using the Permissions API - Web APIs
historically, different apis handle their own permissions inconsistently — for example the notifications api allows for explicit checking of permission status and requesting permission, whereas the geolocation api doesn't (which causes problems if the user denied the initial permission request, as we'll see below).
... the permissions api provides the tools to allow developers to implement a better user experience as far as permissions are concerned.
...most of the code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts.
...And 5 more matches
Screen Wake Lock API - Web APIs
it allows for a simple platform based solution which up until now could only be achieved via workarounds which were potentially power hungry.
... there are plenty of use cases for keeping a screen on, including reading an ebook, map navigation, following a recipe, presenting to an audience, scanning a qr/barcode or applications that use voice or gesture control, rather than tactile input (the default way to keep a screen awake).
... you acquire a wakelocksentinel object by calling the navigator.wakelock.request() promise based method that resolves if the platform allows it.
...And 5 more matches
Sensor APIs - Web APIs
these sensor types are referred to as low-level and high-level respectively.
... therefore, feature detection for sensor apis must include both detection of the apis themselves and defensive programming strategies (see below).
... the examples below show three methods for detecting sensor apis.
...And 5 more matches
Writing WebSocket servers - Web APIs
a websocket server is nothing more than an application listening on any port of a tcp server that follows a specific protocol.
... a websocket server is explained on a very low level here.
...you can use this header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see.
...And 5 more matches
Background audio processing using AudioWorklet - Web APIs
slider controls are available to allow controlling the gain of both the oscillator and the audio worklet's output.
... structure of an audio worklet processor an audio worklet processor is a javascript module which consists of the following: a javascript class which defines the audio processor.
...this is demonstrated in the following example.
...And 5 more matches
Web Authentication API - Web APIs
many websites already have pages that allow users to register new accounts or sign in to an existing account, and the web authentication api acts as a replacement or supplement to those on those existing webpages.
... registration a typical registration process has six steps, as illustrated in figure 1 and described further below.
...the parameters to the create() call are passed to the authenticator, along with a sha-256 hash of the clientdatajson (only a hash is sent because the link to the authenticator may be a low-bandwidth nfc or bluetooth link and the authenticator is just going to sign over the hash to ensure that it isn't tampered with).
...And 5 more matches
Window.open() - Web APIs
WebAPIWindowopen
see window features below for documentation of each of the features that can be specified.
... toolbar and ui parts features in modern browsers (firefox 76 or newer, google chrome, safari, chromium edge), the following features are just a condition for whether to open popup or not.
... the following features control the visibility of each ui parts, all features can be set to yes or 1, or just be present to be on.
...And 5 more matches
WindowOrWorkerGlobalScope.fetch() - Web APIs
redirect the redirect mode to use: follow (automatically follow redirects), error (abort with an error if a redirect occurs), or manual (handle redirects manually).
... in chrome the default is follow (before chrome 47 it defaulted to manual).
... keepalive the keepalive option can be used to allow the request to outlive the page.
...And 5 more matches
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
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.
...in the example below you can change the value between mandatory and proximity to see the effect this has on the scroll experience.
...in the below example you can change the value of scroll-snap-align to see how this changes the scroll behavior.
...And 5 more matches
Shapes from box values - CSS: Cascading Style Sheets
the box values allowable as a shape value are: content-box padding-box border-box margin-box the border-radius values are also supported, this means that you can have something in your page with a curved border, and your shape can follow the created shape.
...in all of the examples below i am using an element which has padding, a border, and a margin defined in order that you can see the different ways in which content will flow.
... in the example below, we have a circular purple item which is a <div> with a height, width, and background colour.
...And 5 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
oz-user-select: none; user-select: none; } .ui-input-slider * { float: left; 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; line-height: inherit; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cursor: pointer; background: url("arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("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: ...
...; user-select: none; } .ui-slider > * { float: left; height: 100%; line-height: 100%; } /* slider */ .ui-slider-slider { height: 10px; width: 200px; margin: 4px 10px; display: block; border: 1px solid #999; border-radius: 3px; background: #eee; } .ui-slider-slider:hover { cursor: pointer; } .ui-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-slider-pointer { width: 12px; height: 13px; margin: 0 0 0 -7px; background-color: #eee; border: 1px solid #2c9fc9; border-radius: 3px; position: relative; top: -3px; left: 0%; } .ui-slider-button { width: 25px; background-color: #2c9fc9; border-radius: 3px; color: #fff; font-weight: bold; line-height: 14px; text-align: center; } .ui-slider-button:hover { backgroun...
...n select button */ .ui-dropdown-select { padding: 0 0.75em; color: #fff; line-height: 2em; } /* dropdown list */ .ui-dropdown-list { width: 100%; height: 150px; max-height: 150px; margin: 0; padding: 0 0.3em; border: 1px solid #3490d2; border-color: #208b20; background: #666; background-color: #eef1f5; color: #000; position: absolute; top: 100%; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !important; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='right'] .ui-dropdown...
...And 5 more matches
animation-timing-function - CSS: Cascading Style Sheets
the non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic bézier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value.
... 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.
... 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.
...And 5 more matches
calc() - CSS: Cascading Style Sheets
WebCSScalc
it can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.
...the expression can be any simple expression combining the following operators, using standard operator precedence rules: + addition.
...for instance, calc(50% -8px) will be parsed as a percentage followed by a negative length — an invalid expression — while calc(50% - 8px) is a percentage followed by a subtraction operator and a length.
...And 5 more matches
clamp() - CSS: Cascading Style Sheets
WebCSSclamp
the clamp() css function clamps a value between an upper and lower bound.
...it takes three parameters: a minimum value, a preferred value, and a maximum allowed value.
... the clamp() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.
...And 5 more matches
<length> - CSS: Cascading Style Sheets
WebCSSlength
syntax the <length> data type consists of a <number> followed by one of the units listed below.
... note: some properties allow negative <length>s, while others do not.
...on fonts with the "x" letter, this is generally the height of lowercase letters in the font; 1ex ≈ 0.5em in many fonts.
...And 5 more matches
transition-timing-function - CSS: Cascading Style Sheets
the non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic bézier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value.
... 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.
... ease-in equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the transition speed increasing until complete.
...And 5 more matches
Getting Started - Developer guides
the two major features of ajax allow you to do the following: make requests to the server without reloading the page receive and work with data from the server step 1 – how to make an http request in order to make an http request to the server with javascript, you need an instance of an object with the necessary functionality.
...then, mozilla, safari, and other browsers followed, implementing an xmlhttprequest object that supported the methods and properties of microsoft's original activex object.
...for example, use the following before calling send() for form data sent as a query string: httprequest.setrequestheader('content-type', 'application/x-www-form-urlencoded'); step 2 – handling the server response when you sent the request, you provided the name of a javascript function to handle the response: httprequest.onreadystatechange = nameofthefunction; what should this function do?
...And 5 more matches
Cross-browser audio basics - Developer guides
this article provides: a basic guide to creating a cross-browser html5 audio player with all the associated attributes, properties, and events explained a guide to custom controls created using the media api basic audio example the code below is an example of a basic audio implementation using html5: <audio controls> <source src="audiofile.mp3" type="audio/mpeg"> <source src="audiofile.ogg" type="audio/ogg"> <!-- fallback for non supporting browsers goes here --> <p>your browser does not support html5 audio, but you can still <a href="audiofile.mp3">download the music</a>.</p> </audio> note: you can also use an mp4 file instead of mp3.
...if you don't specify this attribute, no controls will appear — and you will instead have to create your own controls and program their functionality using the media api (see below).
... preload the preload attribute allows you to specify a preference for how the browser preloads the audio, in other words, which part of the file it downloads when the <audio> element is initialized, and before the play button is pressed.
...And 5 more matches
Video player styling basics - Developer guides
this follow-up article looks at how to style this custom player, including making it responsive.
... the markup for the custom controls now looks as follows: <div id="video-controls" class="controls" data-state="hidden"> <button id="playpause" type="button" data-state="play">play/pause</button> <button id="stop" type="button" data-state="stop">stop</button> <div class="progress"> <progress id="progress" value="0" min="0"> <span id="progress-bar"></span> </progress> </div> <button id="mute" type="button" data-stat...
... this "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling.
...And 5 more matches
Media buffering, seeking, and time ranges - Developer guides
a timeranges object consists of the following properties: length: the number of time ranges in the object.
... without any user interaction there is usually only one time range, but if you jump about in the media more than one time range can appear, as illustrated by the below visualization.
... ------------------------------------------------------ |=============| |===========| | ------------------------------------------------------ 0 5 15 19 21 for this audio instance, the associated timeranges object would have the following available properties: myaudio.buffered.length; // returns 2 myaudio.buffered.start(0); // returns 0 myaudio.buffered.end(0); // returns 5 myaudio.buffered.start(1); // returns 15 myaudio.buffered.end(1); // returns 19 to try out and visualize buffered time ranges we can write a little bit of html: <p> <audio id="my-audio" controls> <source src="music.mp3" type="audio/mpeg"> </...
...And 5 more matches
<input type="password"> - HTML: Hypertext Markup Language
WebHTMLElementinputpassword
specifics of how the entry process works may vary from browser to browser; mobile devices, for example, often display the typed character for a moment before obscuring it, to allow the user to be sure they pressed the key they meant to press; this is helpful given the small size of keys and the ease with which the wrong one can be pressed, especially on virtual keyboards.
... additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, password field inputs support the following attributes: attribute description maxlength the maximum length the value may be, in utf-16 characters minlength the minimum length in characters that will be considered valid pattern a regular expression the value must match in order to be valid placeholder an example value to display in the field when the field is empty ...
... <label for="userpassword">password: </label> <input id="userpassword" type="password"> allowing autocomplete to allow the user's password manager to automatically enter the password, specify the autocomplete attribute.
...And 5 more matches
CORS errors - HTTP
WebHTTPCORSErrors
cross-origin resource sharing (cors) is a standard that allows a server to relax the same-origin policy.
... this is used to explicitly allow some cross-origin requests while rejecting others.
... if the cors configuration isn't setup correctly, the browser console will present an error like "cross-origin request blocked: the same origin policy disallows reading the remote resource at $somesite" indicating that the request was blocked due to violating the cors security rules.
...And 5 more matches
Feature-Policy: accelerometer - HTTP
the http feature-policy header accelerometer directive controls whether the current document is allowed to gather information about the acceleration of the device through the accelerometer interface.
... syntax feature-policy: accelerometer <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: ambient-light-sensor - HTTP
the http feature-policy header ambient-light-sensor directive controls whether the current document is allowed to gather information about the amount of light in the environment around the device through the ambientlightsensor interface.
... syntax feature-policy: ambient-light-sensor <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: autoplay - HTTP
the http feature-policy header autoplay directive controls whether the current document is allowed to autoplay media requested through the htmlmediaelement interface.
... syntax feature-policy: autoplay <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: battery - HTTP
the http feature-policy header battery directive controls whether the current document is allowed to gather information about the acceleration of the device through the batterymanager interface obtained via navigator.getbattery().
... syntax feature-policy: battery <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: display-capture - HTTP
syntax feature-policy: display-capture <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... 'src': (in an iframe allow attribute only) the feature will be allowed in this iframe, as long as the document loaded into it comes from the same origin as the url in the iframe's src attribute.
...And 5 more matches
Feature-Policy: document-domain - HTTP
the http feature-policy header document-domain directive controls whether the current document is allowed to set document.domain.
... syntax feature-policy: document-domain <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: gyroscope - HTTP
the http feature-policy header gyroscope directive controls whether the current document is allowed to gather information about the orientation of the device through the gyroscope interface.
... syntax feature-policy: gyroscope <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: layout-animations - HTTP
the http feature-policy header layout-animations directive controls whether the current document is allowed to show layout animations.
... syntax feature-policy: layout-animations <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: legacy-image-formats - HTTP
the http feature-policy header legacy-image-formats directive controls whether the current document is allowed to display images in legacy formats.
... syntax feature-policy: legacy-image-formats <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: magnetometer - HTTP
the http feature-policy header magnetometer directive controls whether the current document is allowed to gather information about the orientation of the device through the magnetometer interface.
... syntax feature-policy: magnetometer <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: oversized-images - HTTP
the http feature-policy header oversized-images directive controls whether the current document is allowed to download and display large images.
... syntax feature-policy: oversized-images <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: unoptimized-images - HTTP
the http feature-policy header unoptimized-images directive controls whether the current document is allowed to download and display unoptimized images.
... syntax feature-policy: unoptimized-images <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Feature-Policy: vibrate - HTTP
the http feature-policy header vibrate directive controls whether the current document is allowed to trigger device vibrations via navigator.vibrate() method of vibration api.
... syntax feature-policy: vibrate <allowlist>; <vibrate> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
web-share - HTTP
the http feature-policy header web-share directive controls controls whether the current document is allowed to use the navigator.share() of web share api to share text, links, images, and other content to arbitrary destiations of user's choice.
... syntax feature-policy: web-share <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin.
... 'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
...And 5 more matches
Proxy Auto-Configuration (PAC) file - HTTP
the format of this string is defined in return value format below.
... return value format the javascript function returns a single string if the string is null, no proxies should be used the string can contain any number of the following building blocks, separated by a semicolon: direct connections should be made directly, without any proxies proxy host:port the specified proxy should be used socks host:port the specified socks server should be used recent versions of firefox support as well: http host:port the specified proxy should be used https host:port the specified https proxy should be used socks4 host:port socks5 host:port the specified socks server (with the specified sock version) should be used if there are multiple semicolon-separated settings, the left-most setting will be used, until firefox fails to establish the conn...
...name based conditions shexpmatch() time based conditions 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.
...And 5 more matches
Introduction - JavaScript
what you should already know this guide assumes you have the following basic background: a general understanding of the internet and the world wide web (www).
... where to find javascript information the javascript documentation on mdn includes the following: learn web development provides information for beginners and introduces basic concepts of programming and the internet.
... there are also more advanced server side versions of javascript such as node.js, which allow you to add more functionality to a website than simply downloading files (such as realtime collaboration between multiple computers).
...And 5 more matches
Text formatting - JavaScript
'\xa9' // "©" unicode escape sequences the unicode escape sequences require at least four hexadecimal digits following \u.
...for example, the following code assigns hellolength the value 13, because "hello, world!" has 13 characters, each represented by one utf-16 code unit.
... the following table summarizes the methods of string objects.
...And 5 more matches
Functions - JavaScript
however, object references are values, too, and they are special: if the function changes the referred object's properties, that change is visible outside the function, as shown in the following example: /* declare the function 'myfunc' */ function myfunc(theobject) { theobject.brand = "toyota"; } /* * declare variable 'mycar'; * create and initialize a new object; * assign reference to it to 'mycar' */ var mycar = { brand: "honda", model: "accord", year: 1998 }; /* logs 'honda' */ console.log(mycar.brand); /* pass object reference to the function */ myfunc(mycar); /*...
... function parameters default parameters default function parameters allow formal parameters to be initialized with default values if no value or undefined is passed.
... rest parameters the rest parameter syntax allows representing an indefinite number of arguments as an array.
...And 5 more matches
Intl.Collator() constructor - JavaScript
the following unicode extension keys are allowed: co variant collations for certain locales.
...the "standard" and "search" values are ignored; they are replaced by the options property usage (see below).
... kf whether upper case or lower case should sort first.
...And 5 more matches
Promise - JavaScript
it allows you to associate handlers with an asynchronous action's eventual success value or failure reason.
...(see throw -999 in the example, below, for a technique to handle the consequences.) on the other hand, in the absence of an immediate need, it is simpler to leave out error handling until a final .catch() statement.
...for the following code, the transiton of promisea into a "settled" state will cause both instances of .then() to be invoked.
...And 5 more matches
new operator - JavaScript
description the new keyword does the following things: creates a blank, plain javascript object; links (sets the constructor of) this object to another object; passes the newly created object from step 1 as the this context; returns this if the function doesn't return an object.
...see the examples below.
... when the code new foo(...) is executed, the following things happen: a new object is created, inheriting from foo.prototype.
...And 5 more matches
Progressive web apps (PWAs)
in order to call a web app a pwa, technically speaking it should have the following features: secure contexts (https), one or more service workers, and a manifest file.
... 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.
... documentation <-- the temporary automatic list below will be replaced soon --> add to home screenadd to home screen (or a2hs for short) is a feature available in modern browsers that allows a user to "install" a web app, ie.
...And 5 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
those changes are listed below including their support status within mozilla applications.
...enditem(), replaceitem(), and insertitembefore() on list objects making a copy of any list item being inserted that is already in another list implementation status unknown crossorigin attribute for <image> and <script> elements not implemented yet (at least for <image>; bug 1240357) rendering model change notes svg root and <foreignobject> not overflow:hidden in ua style sheet implementation status unknown allow overflow: auto; to clip and show scroll bars implementation status unknown allow overflow: scroll; to show scroll bars on <svg> elements implementation status unknown basic data types and interfaces change notes dommatrix or dommatrixreadonly instead of svgmatrix implementat...
... not implemented (bug 778654) svgelement.tabindex implemented (bug 778654) document.activeelement implementation status unknown globaleventhandlers on svgelement implementation status unknown options dictionary attribute for svggraphicselement.getbbox() implemented behind the preference svg.new-getbbox.enabled (bug 999964, bug 1019326) allow leading and trailing whitespace in <length>, <angle>, <number> and <integer> implementation status unknown form feed (u+000c) in whitespace implementation status unknown svgelement.xmlbase, svgelement.xmllang and svgelement.xmlspace removed implementation status unknown svgviewspec removed implementation status unknown svgelement.style removed im...
...And 5 more matches
SVG animation with SMIL - SVG: Scalable Vector Graphics
smil allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path this is done adding an svg element like <animate> inside the svg element to animate.
... below are examples for the four different ways.
... animating attributes of an element the following example animates the cx attribute of a circle.
...And 5 more matches
SVG and CSS - SVG: Scalable Vector Graphics
below you'll create a simple demonstration that runs in your svg-enabled browser.
...ing started - svg demonstration</desc> <defs> <radialgradient id="fade" cx="0" cy="0" r="200" gradientunits="userspaceonuse"> <stop id="fade-stop-1" offset="33%"/> <stop id="fade-stop-2" offset="95%"/> </radialgradient> </defs> <text id="heading" x="-280" y="-270">svg demonstration</text> <text id="caption" x="-280" y="-250">move your mouse pointer over the flower.</text> <g id="flower"> <circle id="overlay" cx="0" cy="0" r="200" stroke="none" fill="url(#fade)"/> <g id="outer-petals"> <g class="quadrant"> <g class="segment"> <path class="segment-fill" d="m0,0 v-200 a40,40 0 0,0 -62,10 z"/> <path class="segment-edge" d="m0,-200 a40,40 0 0,0 -62,10"/> </g> <g class="segment" transform="rotate(18...
...copy and paste the content from here, making sure that you scroll to get all of it: /*** svg demonstration ***/ /* page */ svg { background-color: beige; } #heading { font-size: 24px; font-weight: bold; } #caption { font-size: 12px; } /* flower */ #flower:hover { cursor: crosshair; } /* gradient */ #fade-stop-1 { stop-color: blue; } #fade-stop-2 { stop-color: white; } /* petals */ .segment-fill { fill: var(--segment-fill-fill); stroke: var(--segment-fill-stroke); stroke-width: var(--segment-fill-stroke-width); } .segment-fill:hover { fill: var(--segment-fill-fill-hover); stroke: var(--segment-fill-stroke-hover); } ...
...And 5 more matches
Subresource Integrity - Web security
it works by allowing you to provide a cryptographic hash that a fetched resource must match.
... note: for subresource-integrity verification of a resource served from an origin other than the document in which it’s embedded, browsers additionally check the resource using cross-origin resource sharing (cors), to ensure the origin serving the resource allows it to be shared with the requesting origin.
... an integrity value begins with at least one string, with each string including a prefix indicating a particular hash algorithm (currently the allowed prefixes are sha256, sha384, and sha512), followed by a dash, and ending with the actual base64-encoded hash.
...And 5 more matches
Compiling a New C/C++ Module to WebAssembly - WebAssembly
we will look at both below.
...take a copy of the following simple c example, and save it in a file called hello.c in a new directory on your local drive: #include <stdio.h> int main(int argc, char ** argv) { printf("hello world\n"); } now, using the terminal window you used to enter the emscripten compiler environment, navigate to the same directory as your hello.c file, and run the following command: emcc hello.c -s wasm=1 -o hello.html the options we’ve passed in with the command are as follows: -s wasm=1 — specifies that we want wasm output.
... first of all, save the following c code in a file called hello2.c, in a new directory: #include <stdio.h> int main(int argc, char ** argv) { printf("hello world\n"); } search for the file shell_minimal.html in your emsdk repo.
...And 5 more matches
WebAssembly
webassembly is a new type of code that can be run in modern web browsers — it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as c/c++, c# and rust with a compilation target so that they can run on the web.
... it is also designed to run alongside javascript, allowing both to work together.
...this allows you to take advantage of webassembly's performance and power and javascript's expressiveness and flexibility in the same apps, even if you don't know how to write webassembly code.
...And 5 more matches
Classes and Inheritance - Archive of obsolete content
data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior.
... inheritance allows classes to inherit state and behavior from an existing classes, known as the base class.
...the resulting constructor looks as follows: function circle(x, y, radius) { if (!this) return new circle(x, y, radius); shape.call(this, x, y); this.radius = radius; } note that the constructor for shape is called as an ordinary function, and reuses the object created for the constructor call to circle.
...And 4 more matches
page-mod - Archive of obsolete content
for example, the following add-on displays an alert whenever the user visits any page hosted at "mozilla.org": var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'window.alert("page matches ruleset");' }); you can modify the document in your script: var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); you can su...
... these options are documented in detail below.
... for example, the following add-on retrieves the html content of specific tags from documents that match the pattern.
...And 4 more matches
Developing for Firefox Mobile - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... it's possible to use the android emulator to develop add-ons for android without access to a device, but it's slow, so for the time being it's much easier to use the technique described below.
... this will be followed by lots of debug output.
...And 4 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
follow every step methodically and you'll probably be alright.
...use only lowercase letters.
...module and xpi_name are both set to the name of your extension; they should be repeated in all project makefiles so that all of the files land in the same place in the xpi staging area (see below).
...And 4 more matches
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
- #include "nsastring.h"- #include "nsstring.h"- #include "nsreadableutils.h"- #include "nsescape.h" + #include "nsstringapi.h" on windows, if you see the following error, you are including a header you shouldn't be: nsstringfwd.h(60) : fatal error c1001: internal compiler error to debug this error, make in the failing directory, adding the /showincludes directive to figure out what is being included incorrectly: make -c directory/that/failed os_cppflags=-showincludes the frozen string api is similar but not identical to the nonfrozen string api.
... the following functions, however, are implemented in the glue library and can be used from frozen-linkage code: ns_newarrayenumerator (excluding deprecated nsisupportsarray version) ns_newemptyenumerator ns_newunionenumerator nscrt functions in nscrt.h are not available to frozen-linkage code.
... #define caseinsensitivecompare pr_true this allows you to use caseinsensitivecompare as the parameter to various string methods that normally accept pr_true under the internal api.
...And 4 more matches
Multiple item extension packaging - Archive of obsolete content
every multiple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as noted below.
...the basic structure is shown below: /install.rdf install manifest /extension1.xpi extension /extension2.xpi extension /theme1.jar theme /theme2.jar theme ...
...the xml namespace xmlns:nc="http://home.netscape.com/nc-rdf#" must also be declared in your install.rdf as shown below.
...And 4 more matches
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
this is because a lot of javascript files can slow down the browser down if they’re opened for debugging, but you’ll need to lift this restriction in order to develop extensions.
...install quicknote from the following url and relaunch firefox.
...install mozlab from the following url and relaunch firefox.
...And 4 more matches
Adding windows and dialogs - Archive of obsolete content
the following features are very important and you should always keep them in mind: chrome.
...it allows you to send a set of optional parameters that can be used to communicate with the dialog.
...the prompt service allows better alerts to be displayed.
...And 4 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
the following methods will all safely create a dom tree without risk of remote execution.
...it is safe, though inefficient, to assign dynamic values to innerhtml if any dynamic content in the value is escaped with the following function: function escapehtml(str) { return str.replace(/[&"'<>]/g, (m) => ({ "&": "&amp;", '"': "&quot;", "'": "&#39;", "<": "&lt;", ">": "&gt;" })[m]); } or slightly more verbose, but slightly more efficient: function escapehtml(str) { return str.replace(/[&"'<>]/g, (m) => escapehtml.replacements[m]); } escapehtml.replacements = { "&": "&amp;", '"': "&quot;", "'": "&#39;", "<": "&lt;", ">...
...the following two code fragments are roughly equivalent: function clickify(elem, address) { elem.addeventlistener("click", function (event) { openwindow(address) }, false); } function clickify(elem, address) { elem.onclick = function (event) { openwindow(address) }; } multiple attributes sometimes there is a need for event listeners to appear as attributes in the dom.
...And 4 more matches
Getting Started with Firefox Extensions - Archive of obsolete content
they allow the application to be customized to fit the personal needs of each user if they need additional features, while keeping the applications small to download.
... firefox provides a very rich and flexible architecture that allows extension developers to add advanced features, customize the user's experience, and completely replace and remove parts of the browser.
...click on the link below.
...And 4 more matches
Handling Preferences - Archive of obsolete content
to open the preferences window in firefox, select the following from the main menu: on windows, tools > options on mac, firefox > preferences on linux, edit > preferences note: keep in mind the usage of the terms "preferences" and "options" in different platforms.
...the following files are used: default preferences: these are stored in the directory defaults/pref in the firefox installation directory.
...this xul page lists all the preferences defined in the firefox installation, allowing you to change them as you please.
...And 4 more matches
The Box Model - Archive of obsolete content
any xul interface can be broken down into the following basic components: boxes text images alignment and flexibility widths and heights margins and paddings menus, toolbar buttons, and even the most complex elements in xul are composed of these simple ingredients.
...a vbox is oriented vertically by default, its child nodes displayed one below the other from top to bottom.
...if we add flexibility to the hbox in our first example, we get the following result: the box flexes to cover the available horizontal space.
...And 4 more matches
Promises - Archive of obsolete content
the following page contains examples of many promise-based replacement apis for common operations.
... these apis allow asynchronous operation to be achieved with a coding style similar to synchronous variants.
... the following examples make use of the task api, which harnesses generator functions to remove some of the syntactic clutter of raw promises, such that asynchronous promise code more closely resembles synchronous, procedural code.
...And 4 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
the space below the baseline is referred to as "descender space" since that's where the descenders in lowercase letters like "j", "y", and "q" are drawn.
... there is one obvious fix-- stop creating designs that are dependent on tables and sliced up or single-pixel images-- but it's not terribly practical for many designers, and it sure doesn't help fix old designs that are suddenly blowing apart in recent browsers.
...in the simplest case, we might add a style like this: td img {display: block;} consider this rule when applied to the following markup: <table cellspacing="0" cellpadding="0" border="0" width="500"> <tr><td><img src="nav1.gif"><img src="nav2.gif"><img src="nav3.gif"><img src="nav4.gif"><img src="nav5.gif"></td></tr> <tr><td style="background: red;"> <img src="smallred.gif" height="1" width="1"></td></tr> <tr><td> <p style="margin: 0.5em;">this is text in another cell of the table.
...And 4 more matches
Java in Firefox Extensions - Archive of obsolete content
the following technique only works in javascript code linked from or contained in xul files.
...the following approach is taken from the extension xquseme (note you must use the latest version, currently still in the sandbox, as prior versions only worked with liveconnect before java 6 update 11) which borrows some of the code of the java firefox extension in order to grant full privileges to java within a firefox extension, but it is easier to understand and doesn't require creation of a xpcom compo...
...[note: a simpler hello world version than that below is now available at http://brett-zamir.me/java_demo/ ] for privileges, the basic procedure is: download and include http://simile.mit.edu/repository/jav...nsionutils.jar within your extension (you can also build your own from the source files at http://simile.mit.edu/repository/jav...xtensionutils/ ) build and add references leading to this jar and all other jars in your extension within an array of java.net.url's, pass to java.net.urlclassloader to get a class loader, and finally pass the classloader and array to a function which gives the necessary privileges: // this function will be called to give the necessary privileges to your jar files // however, the policy never comes into play, because // (1) adding permissions does...
...And 4 more matches
Menu - Archive of obsolete content
ArchiveMozillaJetpackUIMenu
jetpack's menu api allows features to access and modify the browser's built-in menus.
... to create a new menu, use one of the jetpack.menu constructors below.
...parameters properties an object defining any of the properties below.
...And 4 more matches
Modularization techniques - Archive of obsolete content
inheriting from nsisupports allows any interface to be interrogated about other interfaces that its instance may support, and insures that reference counting facilities are always available.
... on the other hand, objects are allowed a certain degree of flexibility in their implementations of addref() and release().
...a factory allows an implementor to hide both the class declaration and creation details of an object, an extremely important step for allowing maximum flexibility in the implementation of a class and reducing compile time dependencies.
...And 4 more matches
Treehydra Manual - Archive of obsolete content
treehydra provides the following callbacks to analysis scripts: process_tree_decl, process_tree, process_tree_type, and process_cp_pre_genericize.
...by default, this is called just after gcc converts the ast to gimple, before any further lowering or optimization.
...e(fn) { print("function " + decl_name(fn)); // fn is a function_decl let cfg = function_decl_cfg(fn); for (let bb in cfg_bb_iterator(cfg)) { print(" basic block " + bb_label(cfg, bb)); for (let isn in bb_isn_iterator(bb)) { print(" " + isn_display(isn)); } } } post-inlining gimple cfgs treehydra can be positioned after any pass, allowing you access various levels of gimple.
...And 4 more matches
Elements - Archive of obsolete content
helloworld.html: <!doctype html public "-//w3c//dtd html 4.01//en"> <html> <head> <title>hello world!</title> <style type="text/css"> p { -moz-binding: url(hello.xml#default); } #p03 { -moz-binding: url(hello.xml#hello2); } </style> </head> <body> <p>default content</p> <p>default content</p> <p id="p03">default content</p> </body> </html> hello.xml: <?xml version="1.0"?> <bindings xmlns=...
...</html:b><children/></content> </binding> </bindings> you can view the result by opening helloworld.html in firefox.
... hello.xml should reside in the same directory which contains helloworld.html.
...And 4 more matches
Event Handlers - Archive of obsolete content
the handler contains script that is executed when an event flows to the object the handler is attached to and if that event matches all of the criteria specified by the handler.
... the phase attribute specifies the phase of event flow that the handler is registered for.
...the other possible values are target, which means the handler will only fire if event.originaltarget is the same as the target to which the handler is attached, and capturing, which indicates the handler should fire during the capturing phase of event flow.
...And 4 more matches
A XUL Bestiary - Archive of obsolete content
the chrome url, which appears in place of the http url in pointers like the following global skin processing instruction: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> specifies a chrome to be loaded by the gecko rendering engine.
...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 simple restyling of the browser.
...so the following structure obtains: navigator/ content/ default/ navigator.xul ...
...And 4 more matches
Template and Tree Listeners - Archive of obsolete content
these each implement a different xpcom interface, as listed below: nsixulbuilderlistener - used to listen to template rebuilds.
...the tree view handles all of these operations, but allows an observer to be attached which is invoked during these operations.
...this allows you to handle dragging with more flexibility.
...And 4 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
the general syntax of methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-name2"/> .
...for example, the following javascript function would be written as an xbl method like so: function getmaximum(num1,num2) { if (num1 <= num2) return num2; else return num1; } xbl: <method name="getmaximum"> <parameter name="num1"/> <parameter name="num2"/> <body> if (num1 &lt;= num2) return num2; else return num1; </body> </method> this function, getmaximum, returns the largest of the values, each...
...(the bound element.) the parameter tag allows you to define parameters for a method.
...And 4 more matches
Adding Properties to XBL-defined Elements - Archive of obsolete content
the general syntax is as follows: <binding id="element-name"> <content> -- content goes here -- </content> <implementation> <field name="field-name-1"/> <field name="field-name-2"/> <field name="field-name-3"/> <property name="property-name-1"/> <property name="property-name-2"/> <property name="property-name-3"/> .
...the example below creates a button which generates and stores a random number.
...for example, the following field is given a default value equal to the current time: <field name="currenttime"> new date().gettime(); </field> properties sometimes you will want to validate the data that is assigned to a property.
...And 4 more matches
Anonymous Content - Archive of obsolete content
declaring scrollbar example the example below shows how a scrollbar might be declared (it has been simplified a bit from the real thing): <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <binding id="scrollbarbinding"> <content> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scr...
...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.
...filename input field example another example, this time for a field for entering a filename: <binding id="fileentry"> <content> <textbox/> <button label="browse..."/> </content> </binding> attaching this binding to an element will cause it to contain a field for entering text, followed by a browse button.
...And 4 more matches
Input Controls - Archive of obsolete content
the following are some of them: id a unique identifier so that you can identify the textbox.
... maxlength the maximum number of characters that the textbox allows.
... 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.
...And 4 more matches
List Controls - Archive of obsolete content
the following example demonstrates these additional features: example 2 : source view <listbox rows="3"> <listitem label="butter pecan" value="bpecan" /> <listitem label="chocolate chip" value="chocchip" /> <listitem label="raspberry ripple" value="raspripple" /> <listitem label="squash swirl" value="squash" /> </listbox> the example has been changed to display only 3 rows at a time.
... the following example is of a listbox with two columns and three rows: example 3 : source view <listbox> <listcols> <listcol/> <listcol/> </listcols> <listitem> <listcell label="george" /> <listcell label="house painter" /> </listitem> <listitem> <listcell label="mary ellen" /> <listcell label="candle maker" /> </listitem> <listitem> <listcell label="roger" /> ...
... <listcell label="swashbuckler" /> </listitem> </listbox> header rows list boxes also allow a special header row to be used.
...And 4 more matches
More Event Handlers - Archive of obsolete content
in the example below, currenttarget is always the vbox, whereas target would be the specific element, either the button or checkbox, that was activated.
...to manually stop event propagation, call the event object's stoppropagation method, as in the following example.
...the default action can be prevented with the event object's preventdefault method, as in the example below.
...And 4 more matches
Styling a Tree - Archive of obsolete content
« previousnext » the following describes how to style a tree.
... set the property on a row or cell, as in the following example: <treerow properties="makeitblue"> css selectors for the tree the style sheet can take this property and use it to change the appearance of the row for unread messages or labels.
...the following is the syntax that needs to be used: treechildren::-moz-tree-row(makeitblue) { background-color: blue; } this style which has a complex selector is used to style the background color of rows that have the 'makeitblue' property.
...And 4 more matches
Trees and Templates - Archive of obsolete content
« previousnext » the following describes how to use a template with a tree.
...the following example uses the history datasource: <tree datasources="rdf:history" ref="nc:historybydate" flags="dont-build-content"> as described in the previous section, the tree may use a tree builder for template generation instead of the normal content builder.
...template-built tree example the following example demonstrates a template-built tree, in this case for the file system.
...And 4 more matches
button - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir type: one of the values below the direction in which the child elements of the element are placed.
... the disabled attribute is allowed only for form controls.
...And 4 more matches
menu - Archive of obsolete content
ArchiveMozillaXULmenu
attributes acceltext, accesskey, allowevents, command, crop, disabled, image, label, menuactive, open, sizetopopup, tabindex, value properties accessibletype, accesskey, command, control, crop, disabled, image, itemcount, label, labelelement, menupopup, open, parentcontainer, selected, tabindex, value methods appenditem, getindexofitem, getitematindex, insertitemat, removeitemat style classes menu-iconic example <menubar id="sampl...
... allowevents type: boolean if true, events are passed to children of the element.
... crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...And 4 more matches
prefwindow - Archive of obsolete content
prefer the classical window.opendialog() with the following window features: "chrome,titlebar,toolbar,centerscreen,dialog=yes".
... buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box.
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
...And 4 more matches
Debugging a XULRunner Application - Archive of obsolete content
see also debugging javascript prefs setting the following prefs will make your debugging life much easier!
... jsdump(str) (function defined below) will output str as a "message" with a speech bubble icon next to it: function jsdump(str) { components.classes['@mozilla.org/consoleservice;1'] .getservice(components.interfaces.nsiconsoleservice) .logstringmessage(str); } for more information about the error console see the error console and browser console article.
...add the following code to your xul app: components.utils.import('resource://gre/modules/devtools/dbg-server.jsm'); if (!debuggerserver.initialized) { debuggerserver.init(); // don't specify a window type parameter below if "navigator:browser" // is suitable for your app.
...And 4 more matches
What is RSS - Archive of obsolete content
netscape's rss 0.91 was only xml-based and added a dtd to allow several entities (commonly found in html).
...for example: <?xml version="1.0"?> <rss version="2.0"> <channel> <title>joe blow's blog</title> <description>this is the weblog of joe blow</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://joe-blow.example.net/</link> <item> <title>i be blogging...</title> <guid>http://joe-blow.example.net/log/21</guid> <pubdate>sun, 15 may 2005 13:02:08 -0500</pubdate> <li...
...nk>http://joe-blow.example.net/log/21</link> </item> <item> <title>i am so smrt</title> <guid>http://joe-blow.example.net/log/20</guid> <pubdate>sat, 14 may 2005 22:19:18 -0500</pubdate> <link>http://joe-blow.example.net/log/20</link> </item> <item> <title>huh?</title> <guid>http://joe-blow.example.net/log/19</guid> <pubdate>sat, 14 may 2005 09:55:59 -0500</pubdate> <link>http://joe-blow.example.net/log/19</link> </item> <item> <title>black cat spotted</title> <guid>http://joe-blow.example.net/log/18</guid> <pubdate>fri, 13 may 2005 13:13:13 -0500</pubdate> <link>http://joe-blow.example.net/log/18</link>...
...And 4 more matches
Array comprehensions - Archive of obsolete content
the array comprehension syntax was a javascript expression which allowed you to quickly assemble a new array based on an existing one.
... syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of iterable) x + y] description inside array comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component.
... multiple for-of iterations or if statements are allowed.
...And 4 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
listing 3 below details a script used to process an rss feed from the mozilla website.
...the common values for this attribute are explained below, though there are more than just these.
... runat=”server-proxy” – allows for the exposure of server-side javascript functions to the browser.
...And 4 more matches
Mozilla's DOCTYPE sniffing - Archive of obsolete content
the goals that led to choosing this behavior were the following: almost all existing text/html pages on the web that need to be in quirks mode to be displayed correctly should be displayed using quirks mode.
... (almost all, rather than all, to allow for the following points as well.) authors writing web pages to current standards should be able to trigger strict mode.
... full standards mode the following trigger full standards mode: any document sent with an xml mime type such as text/xml, application/xml, or application/xhtml+xml (since sniffing only occurs for documents sent as text/html).
...And 4 more matches
Tiles and tilemaps overview - Game development
the below images shows a tile atlas of 8 x 4 tiles: using an atlas also has the advantage of naturally assigning every tile an index.
...square tiles allow for two perspectives: top-down (like many rpg's or strategy games like warcraft 2 or final fantasy's world view.) side-view (like platformers such as super mario bros.) static tilemaps a tilemap can either fit into the visible screen area screen or be larger.
...they can follow a character — like in platformers or rpgs — or allow the player to control the camera — like in strategy or simulation games.
...And 4 more matches
Move the ball - Game development
delete all the javascript you currently have inside your html file except for the first two lines, and add the following below them.
...now, let's draw the ball — add the following inside your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame.
... 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 v...
...And 4 more matches
Paddle and keyboard controls - Game development
add the following variables near the top of your code, beside your other variables: var paddleheight = 10; var paddlewidth = 75; var paddlex = (canvas.width-paddlewidth) / 2; here we're defining the height and width of the paddle and its starting point on the x axis for use in calculations further on down the code.
...add the following just below your drawball() function: function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, canvas.height-paddleheight, paddlewidth, paddleheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } allowing the user to control the paddle we can draw the paddle wherever we want, but it should respond to the user's actions.
...we will need the following: two variables for storing information on whether the left or right control button is pressed.
...And 4 more matches
Animations and tweens - Game development
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.
... loading the animation next up, go into your create() function, find the line that loads the ball sprite, and below it put the call to animations.add() seen below: ball = game.add.sprite(50, 250, 'ball'); ball.animations.add('wobble', [0,1,0,2,0,1,0,2,0], 24); to add an animation to the object we use the animations.add() method, which contains the following parameters the name we chose for the animation an array defining the order in which to display the frames during the animation.
... applying the animation when the ball hits the paddle in the arcade.collide() method call that handles the collision between the ball and the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function.
...And 4 more matches
Build the brick field - Game development
defining new variables first, let's define the needed variables — add the following below your previous variable definitions: var bricks; var newbrick; var brickinfo; the bricks variable will be used to create a group, newbrick will be a new object added to the group on every iteration of the loop, and brickinfo will store all the data we need.
... rendering the brick image next, let's load the image of the brick — add the following load.image() call just below the others: function preload() { // ...
...add the initbricks() function at the end of our games code, just before the closing </script> tag, as shown below.
...And 4 more matches
Debugging CSS - Learn web development
for example in firefox there are some excellent tools for working visually with css layout, allowing you to inspect and edit grid layouts, flexbox, and shapes.
...load this up in a new tab if you want to follow along, and open up your devtools as described in the article linked above.
... the following video provides some useful tips on debugging css using the firefox devtools: editing values in addition to turning properties on and off, you can edit their values.
...And 4 more matches
Test your skills: The Box Model - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... the box model one with the two boxes below, one is using the standard box model, the other the alternate box model.
...your final result will look like the image below.
...And 4 more matches
Type, class, and ID selectors - Learn web development
in the example below we have used the span, em and strong selectors.
...in the following example we have used the universal selector to remove the margins on all elements.
...since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below.
...And 4 more matches
CSS selectors - Learn web development
there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style.
... h1, .special { color: blue; } in the live example below try combining the two selectors which have identical declarations.
... in the following example, the invalid class selector rule will be ignored, whereas the h1 would still be styled.
...And 4 more matches
Test your skills: floats - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...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.
...And 4 more matches
What is CSS? - Learn web development
overview: first steps next css (cascading style sheets) allows you to create great-looking web pages, but how does it work under the hood?
... for more on browser/default styles, check out the following video: what is css for?
...for example "i want the main heading on my page to be shown as large red text." the following code shows a very simple css rule that would achieve the styling described above: h1 { color: red; font-size: 5em; } the rule opens with a selector .
...And 4 more matches
What are hyperlinks? - Learn web development
back in 1989, tim berners-lee, the web's inventor, spoke of the three pillars on which the web stands: url, an address system that keeps track of web documents http, a transfer protocol to find documents when given their urls html, a document format allowing for embedded hyperlinks as you can see in the three pillars, everything on the web revolves around documents and how to access them.
... deeper dive as we said, a link is a text string tied to a url, and we use links to allow easy jumping from one document to another.
... when you're starting out, you don't have to worry about external and incoming links as much, but they are very important if you want search engines to find your site (see below for more details).
...And 4 more matches
How to structure a web form - Learn web development
you can label a <fieldset> by including a <legend> element just below the opening <fieldset> tag.
... for example, clicking on the "i like cherry" label text in the example below will toggle the selected state of the taste_cherry checkbox: <form> <p> <input type="checkbox" id="taste_1" name="taste_cherry" value="cherry"> <label for="taste_1">i like cherry</label> </p> <p> <input type="checkbox" id="taste_2" name="taste_banana" value="banana"> <label for="taste_2">i like banana</label> </p> </form> note: you can find this example in checkbox-labe...
... let's consider this example: <p>required fields are followed by <abbr title="required">*</abbr>.</p> <!-- so this: --> <div> <label for="username">name:</label> <input id="username" type="text" name="username"> <label for="username"><abbr title="required" aria-label="required">*</abbr></label> </div> <!-- would be better done like this: --> <div> <label for="username"> <span>name:</span> <input id="username" type="text" name="username"> <abbr title="required" aria-l...
...And 4 more matches
Tips for authoring fast-loading HTML pages - Learn web development
minimize the number of files reducing the number of files referenced in a web page lowers the number of http connections required to download a page, thereby reducing the time for these requests to be sent, and for their responses to be received.
...it allows for efficient page caching; by means of this header, information is conveyed to the user agent about the file it wants to load, such as when it was last modified.
...first, browsers will have no need to perform error-correction when parsing the html (this is aside from the philosophical issue of whether to allow format variation in user input and then programmatically "correct" or normalize it; or whether, instead, to enforce a strict, no-tolerance input format).
...And 4 more matches
Advanced text formatting - Learn web development
this is usually a feeling, thought, or piece of additional background information.</dd> <dd>in writing, a section of content that is related to the current topic, but doesn't fit directly into the main flow of content so is presented nearby (often in a box off to the side.)</dd> </dl> active learning: marking up a set of definitions it's time to try your hand at description lists; add elements to the raw text in the input field so that it appears as a description list in the output field.
...for example, the following markup is taken from the mdn <blockquote> element page: <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> to turn this into a block quote, we would just do this: <p>here below is a blockquote...</p> <blockquote cite="/docs/web/html/element/blockquote"> <p>the <stro...
...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 put in quotes to indicate a quotation, like so: citations the content of the cite attribute sounds useful, but unf...
...And 4 more matches
What’s in the head? Metadata in HTML - Learn web development
the <title> contents are also used in search results, as you'll see below.
... note: in google, you will see some relevant subpages of mdn web docs listed below the main homepage link — these are called sitelinks, and are configurable in google's webmaster tools — a way to make your site's search results better in the google search engine.
... 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.
...And 4 more matches
Test your skills: Conditionals - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 4 more matches
Test your skills: Events - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript.
...And 4 more matches
Object-oriented JavaScript for beginners - Learn web development
i\'m ' + obj.name + '.'); }; return obj; } you can now create a new person by calling this function — try the following lines in your browser's javascript console: const salva = createnewperson('salva'); salva.name; salva.greeting(); this works well enough, but it is a bit long-winded; if we know we want to create an object, why do we need to explicitly create a new empty object and return it?
... replace your previous function with the following: function person(name) { this.name = name; this.greeting = function() { alert('hi!
... add the following lines below your previous code addition: let person1 = new person('bob'); let person2 = new person('sarah'); save your code and reload it in the browser, and try entering the following lines into your js console: person1.name person1.greeting() person2.name person2.greeting() cool!
...And 4 more matches
Object prototypes - Learn web development
you can check out existing prototype properties for yourself — go back to our previous example and try entering the following into the javascript console: person.prototype the output won't show you very much because we haven't defined anything on our custom constructor's prototype!
...now try the following: object.prototype you'll see a large number of methods defined on object's prototype property, which are then available on objects that inherit from object, as shown earlier.
...you can check this by entering the following in the console: person2.__proto__ this will return the person1 object.
...And 4 more matches
Perceived performance - Learn web development
how fast or slow something feels like it's taking depends a lot on whether the user is actively or passively waiting for this thing to happen.
... there are tips and tricks to follow.
...loading essential data in initial requests and progressively loading features and data only as needed helps mitigate low bandwidth and lower spec hardware.
...And 4 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
what we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data.
...let's create a new component that will allow us to add a new to-do item.
...update your template as follows: <template> <form> <label for="new-todo-input"> what needs to be done?
...And 4 more matches
Learn web development
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.
... web forms — working with user data web forms are a potent tool for interacting with users — most commonly, they are used for collecting data from users, or allowing them to control a user interface.
... in the articles listed below, we'll cover all the essential aspects of structuring, styling, and interacting with web forms.
...And 4 more matches
Accessibility API cross-reference
<h> is also available but its use is not recommended because of lack of suitable tools - and the heading level is undefined click on this thing and then click on the item for tooltip style help helpballoon n/a n/a n/a editable field that allows user to assign a key combination hotkeyfield n/a n/a n/a graphic that indicates something, such as an arrow indicator n/a n/a n/a abstract role - a generic type of widget that allows user input.
... marquee the main menu bar below the app's title bar menubar menu_bar menu_bar menubar a menu item menuitem menu_item menu_item menuitem a menuitem with a checkable state whose possible values are true, false, or mixed.
... sectionhead (abstract role) a form widget that allows the user to make selections from a set of choices.
...And 4 more matches
Accessibility/LiveRegionDevGuide
the later method will be explained in detail below.
...both will be discussed in detail below.
...if one is present, the text changed event should be discarded because an object changed event will follow.
...And 4 more matches
Mozilla's Section 508 Compliance
the following is provided for informational purposes only and is not a legally binding voluntary product accessibility template (vpat).
... caveats: 1) although sidebar cannot be customized without a mouse, all sidebar functions that come with the browser are available through other means 2) java and in-page plugins cannot be used with the keyboard, so they must not be installed for keyboard-only users additional features for the keyboard: 1) find as you type allows for quick navigation to links and convenient text searching 2) browse with caret (f7 key toggles) allows users to select arbitrary content with the keyboard and move through content as if inside a readonly editor.
...under linux/unix it is the user's choice, whether to stick with the gnome theme or not -- they must choose classic if they want to follow the gnome theme.
...And 4 more matches
Theme concepts
add the theme image file to the folder: <mytheme> <your_header_image>.<type> create a file called manifest.json in the folder and edit its content as follows: { "manifest_version": 2, "version": "1.0", "name": "<your_theme_name>", "theme": { "images": { "theme_frame": "<your_header_image>.<type>" }, "colors": { "frame": "#ffffff", "tab_background_text": "#000" } } } where: "frame": is the heading area background color for your theme.
... package your theme and submit it to amo, following these instructions.
...practically, this means you would need to allow for a width of up to 5120 pixels wide (for the next generation of 5k monitors).
...And 4 more matches
Simple Thunderbird build
while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram.
...so firstly complete the instructions for your os and then continue following these build instructions.
... 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.
...And 4 more matches
Creating Custom Events That Can Pass Data
(see bug 427537) requirements in order to do this you must be able to do all of the following: download mozilla source code build mozilla creating custom firefox extensions with the mozilla build system.
...what follows a list of the files you'll need to modify, as well as a discussion of each change.
... 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.
...And 4 more matches
SVG Guidelines
this isn't to say that svg images are always slower than raster equivalents.
...and even when an svg image is slower than a raster equivalent, the difference is usually not noticable.
... 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.
...And 4 more matches
Frame script loading and lifetime
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.
... to define the mapping between a chrome:// url and a frame script packaged with an extension, use a "chrome.manifest" file to register a chrome url: // chrome.manifest content my-e10s-extension chrome/content/ // chrome script mm.loadframescript("chrome://my-e10s-extension/content/content.js", true); allowdelayedload if the message manager is a global frame message manager or a window message manager then: if allowdelayedload is true, the frame script will be loaded into any new frame, which has opened after the loadframescript() call.
... if allowdelayedload is false, the script will only be loaded into frames which are open when the call was made.
...And 4 more matches
Localizing with Koala
the easy way involves opening the console and issuing the following commands: c:\users\stas> cd c:\mozilla\l10n\application\firefox c:\mozilla\l10n\application\firefox> rmdir 3.6 c:\mozilla\l10n\application\firefox> hg clone http://hg.mozilla.org/releases/mozilla-1.9.2 3.6 requesting all changes adding changesets adding manifests adding file changes added 33099 changesets with 158636 changes to 50664 files (+9 heads) updating working directory 40357 files upda...
...just open the console and issue the following commands: c:\users\stas> cd c:\mozilla\l10n\locale\x-testing c:\mozilla\l10n\locale\x-testing> rmdir 3.6 c:\mozilla\l10n\locale\x-testing> hg clone http://hg.mozilla.org/releases/l10n-mozilla-1.9.2/x-testing 3.6 new localizations: if you have the bitbucket repository already set up by l10n-drivers, the steps are the same as above.
...or, you can select firefox (3.6), en-us (included) and x-testing (3.6) in the "open" section below, and click "update repos" on the right.
...And 4 more matches
gettext
consider the following code snippet: <?php $num = 1; printf(ngettext("%d user likes this.", "%d users like this.", $num), $num); ?> depending on the value of the $num variable, this code will either use the singular ("user likes) or the plural ("users like") form of the string.
...for english, the above code will produce the following output: 1 user likes this.
...for example, for english, the plural rule is of the following form: plural-forms: nplurals=2; plural=n != 1; the first part defines the number of different plural forms (2).
...And 4 more matches
Fonts for Mozilla 2.0's MathML engine
quick instructions try this test page to quickly determine whether you need to install additional fonts and to follow the instructions below.
...the fonts may be installed by extracting the font files (which have the .otf extension) from the zip archive, then following instructions for microsoft windows, or copying the files to a ~/library/fonts folder on mac os x, or to a ~/.fonts/ directory (which may need to be created) on unix/linux systems.
... alternatively, follow dafont's "how to install a font".
...And 4 more matches
BloatView
you can set these environment variables to any of the following values.
...(see below for how to fix this.) the bytes leaked for your classes should be zero!
... combining and sorting bloat logs you can view one or more bloat logs in your browser by running the following program.
...And 4 more matches
Scroll-linked effects
below are a couple of examples of effects that would not work well with asynchronous scrolling, along with equivalent versions that would work well: example 1: sticky positioning here is an implementation of a sticky-positioning effect, where the "toolbar" div will stick to the top of the screen as you scroll down.
... example 2: scroll snapping below is an implementation of scroll snapping, where the scroll position snaps to a particular destination when the user's scrolling stops near that destination.
...instead, using the css snap-points property will allow the browser to run the animation asynchronously, providing a smooth visual effect to the user.
...And 4 more matches
tools/power/rapl
mac on mac, rapl can be run as follows.
... $objdir/dist/bin/rapl linux on linux, rapl can be run as root, as follows.
... windows unfortunately, rapl does not work on windows, and porting it would be difficult because windows does not have apis that allow easy access to the relevant model-specific registers.
...And 4 more matches
JSS Provider Notes
apply for your own jce code-signing certificate following the procedure at how to implement a provider for the javatm cryptography extension.
... the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens cryptomanager manager = cryptomanager.getinstance(); cryptotoken tokena = manager.gettokenbyname("tokena"); cryptotoken tokenb = manager.gettokenbyname("tokenb"); // create an rsa keypairgenerator using tokena manager.setthreadtoken(tokena); keypairgenerator rsakpg = keypairgenerato...
...dsakpg.initialize(1024); keypair dsapair = dsakpg.generatekeypair(); supported classes cipher dsaprivatekey dsapublickey keyfactory keygenerator keypairgenerator mac messagedigest rsaprivatekey rsapublickey secretkeyfactory secretkey securerandom signature what's not supported the following classes don't work very well: keystore: there are many serious problems mapping the jca keystore interface onto nss's model of pkcs #11 modules.
...And 4 more matches
Mozilla-JSS JCA Provider notes
apply for your own jce code-signing certificate following the procedure at how to implement a provider for the javatm cryptography extension.
...the following example shows how you can specify which token is used for various jca operations: // lookup pkcs #11 tokens cryptomanager manager = cryptomanager.getinstance(); cryptotoken tokena = manager.gettokenbyname("tokena"); cryptotoken tokenb = manager.gettokenbyname("tokenb"); // create an rsa keypairgenerator using tokena manager.setthreadtoken(tokena); keypairgenerator rsakpg = keypairgenerator.ge...
...dsakpg.initialize(1024); keypair dsapair = dsakpg.generatekeypair(); supported classes cipher dsaprivatekey dsapublickey keyfactory keygenerator keypairgenerator mac messagedigest rsaprivatekey rsapublickey secretkeyfactory secretkey securerandom signature cipher supported algorithms notes aes des desede (des3) rc2 rc4 rsa the following modes and padding schemes are supported: algorithm mode padding des ecb nopadding cbc nopadding pkcs5 padding desede des3 ecb nopadding cbc nopadding pkcs5 padding ...
...And 4 more matches
nss tech note3
bolyard this week at least 5 different people came to me with variants of the same question: what certificate extensions do i have to put into my cert for nss to allow it to be used for purpose <x>??
... the list of known seccertusages is short: certusagesslclient ........... an ssl client authentication cert certusagesslserver ........... an ordinary ssl server cert certusagesslserverwithstepup.. an ssl server cert that allows export clients to use strong crypto.
... certusagesslca ............... an intermediate or root ca cert allowed to issue ssl client or ssl server certs or other intermediate ssl ca certs.
...And 4 more matches
NSS Tools ssltap
the options for the command are the following: -v print a version string for the tool.
...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 following are well-known port numbers: http 80 https 443 smtp 25 ftp 21 imap 143 imaps 993 (imap over ssl) nntp 119 nntps 563 (nntp over ssl) examples you can use the ssl debugging tool to intercept any connection information.
...And 4 more matches
Property cache
warning: the details below are obsolete.
...entry->vword is described in the section entry value words below.
... throughout this article, phrases such as "own property" should be taken to refer to the low-level representation of properties in scopes and shape chains.
...And 4 more matches
Handling Mozilla Security Bugs
general policies mozilla.org has adopted the following general policies for handling bug reports related to security vulnerabilities: security bug reports can be treated as special and handled differently than "normal" bugs.
... in particular, the mozilla.org bugzilla system will allow bug reports related to security vulnerabilities to be marked as "security-sensitive," and will have special access control features specifically for use with such bug reports.
...each and every member of the mozilla security bug group will automatically have access to all mozilla bugs marked "security-sensitive." the members of the mozilla security bug group will be drawn primarily from the following groups: security developers (i.e., those whose bugs are often singled out as security-relevant or who have security-relevant bugs assigned to them), and security qa people who are the qa contacts for those bugs.
...And 4 more matches
nsIDOMEvent
eventphase unsigned short used to indicate which phase of event flow is currently being evaluated.
...any new event type must not begin with any upper, lower, or mixed case version of the string "dom".
...if, during any stage of event flow, the preventdefault method is called the event is canceled.
...And 4 more matches
nsITreeView
3 note: renamed from progressnone in gecko 1.8 drop_before -1 drop_on 0 drop_after 1 indropbefore 0 obsolete since gecko 1.8 indropon 1 obsolete since gecko 1.8 indropafter 2 obsolete since gecko 1.8 methods candrop() methods used by the drag feedback code to determine if a drag is allowable at the current location.
... to get the behavior where drops are only allowed on items, such as the mailnews folder pane, always return false when the orientation is not drop_on.
... return value true if a drop is allowed at the current location; otherwise false.
...And 4 more matches
nsIWebContentHandlerRegistrar
can bypass this by opening about:config and setting preference of gecko.handlerservice.allowregisterfromdifferenthost to true.
... examples register a webmail service as mailto handler the following code aims to add "outlook.com live mail" to list of webservice handlers.
... in the image below "gmail" and "yahoo!
...And 4 more matches
XPCOM
it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.
...this article will show you how to use the available interfaces in several mozilla products.aggregating the in-memory datasourcealready_addrefedalready_addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.binary compatibilityif mozilla decides to upgrade to a compiler that does not have the same abi as the current version, any built component may fail.
...effectively, it is a different platform.bundling multiple binary componentsbinary xpcom components are sometimes required to implement low-level features for extensions.
...And 4 more matches
Set a breakpoint - Firefox Developer Tools
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.
... 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).
...And 4 more matches
Debugger.Memory - Firefox Developer Tools
the dbg.memory object is an instance of debugger.memory; its inherited accesors and methods are described below.
... accessor properties of the debugger.memory.prototype object ifdbg is a debugger instance, then <i>dbg</i>.memory is a debugger.memory instance, which inherits the following accessor properties from its prototype: trackingallocationsites a boolean value indicating whether this debugger.memory instance is capturing the javascript execution stack when each object is allocated.
... allocationslogoverflowed returns true if there have been more than [maxallocationsloglength][#max-alloc-log] allocations since the last time [drainallocationslog][#drain-alloc-log] was called and some data has been lost.
...And 4 more matches
DevTools API - Firefox Developer Tools
to use the gdevtools api from an add-on, it can be imported with following snippet const { gdevtools } = require("resource:///modules/devtools/gdevtools.jsm"); methods registertool(tooldefinition) registers a new tool and adds a tab to each existing toolbox.
... events following events are emitted by the gdevtools object via the eventemitter interface.
... constants the toolbox constructor contains following constant properties.
...And 4 more matches
Examine and edit CSS - Firefox Developer Tools
examine css rules the rules view lists all the rules that apply to the selected element, ordered from most-specific to least-specific: the four buttons on the right top of the rules view allow you to change the display of certain css and rules view features.
...in the following example, a spelling error, "background-colour" instead of "background-color" has made the rule invalid: rule display it displays each rule as in a stylesheet, with a list of selectors followed by a list of property:value; declarations.
... displaying pseudo-elements the rule view displays the following pseudo-elements, if they are applied to the selected element: ::after ::backdrop ::before ::first-letter ::first-line ::selection :-moz-color-swatch :-moz-number-spin-box :-moz-number-spin-down :-moz-number-spin-up :-moz-number-text :-moz-number-wrapper :-moz-placeholder :-moz-progress-bar :-moz-range-progress :-moz-range-thumb :-moz-range-track :-moz-selection if the select...
...And 4 more matches
Waterfall - Firefox Developer Tools
the following operations are recorded: name and description color detailed information dom event javascript code that's executed in response to a dom event.
...this operation is sometimes called "reflow".
...this operation is labeled "layout" but is also sometimes called "reflow".
...And 4 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
myp.appendchild(mytextnode); after testing this sample, note that the words hello and world are together: helloworld.
...the following figure shows the recently created text node object inside the document tree.
...the following code removes text node mytextnode (containing the word "world") from the second <p> element, myp.
...And 4 more matches
Element.classList - Web APIs
WebAPIElementclassList
the following polyfill for both classlist and domtokenlist ensures full compliance (coverage) for all standard methods and properties of element.prototype.classlist for ie10-ie11 browsers plus nearly compliant behavior for ie 6-9.
...implement the barebones domtokenlist livelyness polyfill if (typeof domtokenlist !== "function") (function(window){ var document = window.document, object = window.object, hasownprop = object.prototype.hasownproperty; var defineproperty = object.defineproperty, allowtokenlistconstruction = 0, skippropchange = 0; function domtokenlist(){ if (!allowtokenlistconstruction) throw typeerror("illegal constructor"); // internally let it through } domtokenlist.prototype.tostring = domtokenlist.prototype.tolocalestring = function(){return this.value}; domtokenlist.prototype.add = function(){ a: for(var v=0, arglen=arguments.length,val=""...
...pchange = 1, target.classlist = restokenlist, target.classname = strval; skippropchange = 0, restokenlist.length = tokens.length - sub; } } function polyfillclasslist(ele){ if (!ele || !("innerhtml" in ele)) throw typeerror("illegal invocation"); ele.detachevent( "onpropertychange", whenpropchanges ); // prevent duplicate handler infinite loop allowtokenlistconstruction = 1; try{ function protoobj(){} protoobj.prototype = new domtokenlist(); } finally { allowtokenlistconstruction = 0 } var protoobjproto = protoobj.prototype, restokenlist = new protoobj(); a: for(var toks=ele.classname.trim().split(wsre), ci=0, clen=toks.length, sub=0; ci !== clen; ++ci){ for (var inneri=0; inneri !== ci; ++inneri) ...
...And 4 more matches
HTMLElement - Web APIs
<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="middle">eventtarget</text></a><polyl...
... htmlorforeignelement.nonce returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed.
...in addition, the following handlers are specific to htmlelement.
...And 4 more matches
HTMLFormElement - Web APIs
it allows access to—and, in some cases, modification of—aspects of the form, as well as access to its component elements.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"...
...you can then use any of the following syntaxes to get an individual form: document.forms[index] returns the form at the specified index into the array of forms.
...And 4 more matches
HTMLIFrameElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" alignm...
... htmliframeelement.allow is a list of origins the the frame is allowed to display content from.
... htmliframeelement.allowfullscreen is a boolean indicating whether the inline frame is willing to be placed into full screen mode.
...And 4 more matches
HTMLImageElement.srcset - Web APIs
this is followed by a comma (,) character and then a condition descriptor that indicates the circumstances in which the indicated image should be used.
...otherwise, the condition descriptor may take one of two forms: to indicate that the image resource specified by the image candidate string should be used when the image is being rendered with a particular width in pixels, provide a width descriptor comprised the number giving that width in pixels followed by the lower case letter "w".
...this is written by stating the pixel density as a positive, non-zero floating-point value followed by the lower-case letter "x".
...And 4 more matches
HTMLTableCellElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
...permitted values for scope are: col the header cell applies to the following cells in the same column (or columns, if colspan is used as well), until either the end of the column or another <th> in the column establishes a new scope.
...this value is only allowed if the cell is in a column group.
...And 4 more matches
IDBTransaction - Web APIs
<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...
...(bug 888598) transactions can have one of three modes: constant value description read_only "readonly" (0 in chrome) allows data to be read but not changed.
... read_write "readwrite" (1 in chrome) allows reading and writing of data in existing data stores to be changed.
...And 4 more matches
LockedFile - Web APIs
methods lockedfile.getmetadata() allows to retrieve the file metadata (size and date of the last modification).
... lockedfile.readasarraybuffer() allows to retrieve a part of the content of the file as an arraybuffer.
... lockedfile.readastext() allows to retrieve a part of the content of the file as a string.
...And 4 more matches
MediaTrackConstraints - Web APIs
a constraints dictionary is passed into applyconstraints() to allow a script to establish a set of exact (required) values or ranges and/or preferred values or ranges of values for the track, and the most recently-requested set of custom constraints can be retrieved by calling getconstraints().
... properties some combination—but not necessarily all—of the following properties will exist on the object.
...allowed values are none and crop-and-scale.
...And 4 more matches
RTCConfiguration - Web APIs
it may be passed into the constructor when instantiating a connection, or used with the rtcpeerconnection.getconfiguration() and rtcpeerconnection.setconfiguration() methods, which allow inspecting and changing the configuration while a connection is established.
...see using certificates below for additional information.
...you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called.
...And 4 more matches
RTCDataChannel - Web APIs
values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used.
... the default is "blob".bufferedamount read only the read-only rtcdatachannel property bufferedamount returns the number of bytes of data currently queued to be sent over the data channel.bufferedamountlowthreshold the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0.id read only the read-only rtcdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel.
... these labels are not required to be unique.maxpacketlifetime read only the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.maxretransmits read only the read-only rtcdatachannel property maxretransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum.negotiated read only the read-only rtcdatachannel property negotiated indicates whether the rtcdatachannel's connection was negotiated by the web app (true) or by the webrtc layer (false).ordered read only the read-only rtcdatachannel pro...
...And 4 more matches
SVGLengthList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGNumberList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGPathSegList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified.
...And 4 more matches
SVGPointList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
SVGStringList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 4 more matches
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
capabilities of rtp rtp's primary benefits in terms of webrtc include: generally low latency.
...instead, it only offers the information necessary to allow qos to be implemented elsewhere in the stack.
...these correspond to the following three types of transport supported by rtcpeerconnection: rtcrtpsender rtcrtpsenders handle the encoding and transmission of mediastreamtrack data to a remote peer.
...And 4 more matches
Using the Web Speech API - Web APIs
the following variable is defined to hold our grammar: var colors = [ 'aqua' , 'azure' , 'beige', 'bisque', 'black', 'blue', 'brown', 'chocolate', 'coral' ...
...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 equals sign are the alternative values that will be recognised and accepted as appropriate values for the term.
... you can have as many terms defined as you want on separate lines following the above structure, and include fairly complex grammar definitions.
...And 4 more matches
Window.prompt() - Web APIs
WebAPIWindowprompt
example let sign = prompt("what's your sign?"); if (sign.tolowercase() == "scorpio") { alert("wow!
... 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.
...And 4 more matches
XRReferenceSpace - Web APIs
for xr systems that allow the user to physically move around, such as those that track movement with a real-world camera, this boundary establishes the edges of the area the user is able to move around in, whether due to physical obstacles or due to limitations of the xr hardware.
...xrreferencespace also provides the following methods.
... events in addition to other events that may be sent to xrspace or eventtarget objects, the following also apply to xrreferencespace objects.
...And 4 more matches
Using the slider role - Accessibility
the slider role is used for markup that allows a user to select a value from within a given range.
...see the examples section below for more information.
...arrow keys should operate as follows (localization for right-to-left languages should reverse the direction of the arrows): key(s) action right and up arrows increase the selected value left and down arrows decrease the selected value page up and page down optionally increase and decrease the value by a set amount (e.g.
...And 4 more matches
ARIA annotations - Accessibility
wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations inside web documents.
... below we'll introduce the new features associated with aria annotations, and have a look at some code examples that show them in action.
... aria annotations features the aria attributes providing these new abilities are as follows: aria-description="" — provides a detailed description of an html element, as opposed to the brief label provided by aria-label.
...And 4 more matches
font-weight - CSS: Cascading Style Sheets
the font-weight css descriptor allows authors to specify font weights for the fonts specified in the @font-face rule.
... syntax /* single values */ font-weight: normal; font-weight: bold; font-weight: 400; /* multiple values */ font-weight: normal bold; font-weight: 300 500; the font-weight property is described using any one of the values listed below.
...higher numbers represent weights that are bolder than (or as bold as) lower numbers.
...And 4 more matches
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
the idea of these prefixes was to allow implementations of the spec to be tested and explored by browser engineers and web developers alike without clashing with other implementations.
... floated items “float and clear do not create 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.
...And 4 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
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.
... -webkit-flex-wrap: $value; @if $value == nowrap { -ms-flex-wrap: none; } @else { -ms-flex-wrap: $value; } flex-wrap: $value; } flexbox flow (shorthand) the flex-flow property is shorthand for setting the flex-direction and flex-wrap properties, which together define the flex container's main and cross axes.
...And 4 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
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.
... in the following example, i have four grid areas within my grid.
...And 4 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
in the code snippet below, the item is placed 20 pixels from the top, and 30 pixels from the left of the container: .container { position: relative; } .item { position: absolute; top: 20px; left: 30px; } <div class="container"> <div class="item">item</div> </div> another place you might see physical keywords in use, is when using text-align: right to align text to the right.
...in the example below, i have two paragraphs.
...they prevent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom.
...And 4 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
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.
... in the below example i have a wrapper containing four child items.
...however, it has been taken out of flow as is usual for absolutely positioned items and so the auto-placement rules now place items into the same space.
...And 4 more matches
Subgrid - CSS: Cascading Style Sheets
the children of these items display in normal flow.
... 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.
... a subgrid in both dimensions you can of course define both rows and columns as a subgrid, as in the example below.
...And 4 more matches
CSS reference - CSS: Cascading Style Sheets
WebCSSReference
where : selectors-list ::= selector[:pseudo-class] [::pseudo-element] [, selectors-list] properties-list ::= [property : value] [; properties-list] see the index of selectors, pseudo-classes, and pseudo-elements below.
...nsion>: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-synthesisfont-variantfont-variant (@font-face)font-variant-alternatesfont-variant-c...
...apsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont-weight (@font-face)format()fr<frequency><frequency-percentage>:fullscreenggapgrad<gradient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshhzhanging-punctuationheightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensi<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>...
...And 4 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
d properties on the standards track -webkit-appearance -webkit-font-size-delta -webkit-mask-composite -webkit-mask-position-x -webkit-mask-position-y -webkit-mask-repeat-x -webkit-mask-repeat-y formerly proprietary properties that are now standard note: to maximize the compatibility of your css, you should use the unprefixed standard properties instead of the prefixed ones listed below.
...coration-break -webkit-box-shadow -webkit-box-sizing c -webkit-clip-path -webkit-column-count -webkit-column-fill -webkit-column-gap -webkit-column-rule -webkit-column-rule-color -webkit-column-rule-style -webkit-column-rule-width -webkit-column-span -webkit-column-width -webkit-columns f -webkit-filter -webkit-flex -webkit-flex-basis -webkit-flex-direction -webkit-flex-flow -webkit-flex-grow -webkit-flex-shrink -webkit-flex-wrap -webkit-font-feature-settings -webkit-font-kerning -webkit-font-variant-ligatures g-j -webkit-grid -webkit-grid-area -webkit-grid-auto-columns -webkit-grid-auto-flow -webkit-grid-auto-rows -webkit-grid-column -webkit-grid-column-end -webkit-grid-column-gap -webkit-grid-column-start -webkit-grid-gap -webkit-grid-row -web...
...ize-adjust -webkit-text-underline-position -webkit-transform -webkit-transform-origin -webkit-transform-style -webkit-transition -webkit-transition-delay -webkit-transition-duration -webkit-transition-property -webkit-transition-timing-function u-w -webkit-user-select -epub-word-break -epub-writing-mode supported in non-webkit browsers without a prefix, but not standard the following properties are supported in at least one browser without a prefix, but are not on the standards track.
...And 4 more matches
align-items - CSS: Cascading Style Sheets
the interactive example below demonstrates some of the values for align-items using grid layout.
...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-positioned layouts, the keyword behaves like start on replaced absolutely-positioned boxes, and as stretch ...
...if the cross-size of an item is larger than the flex container, it will overflow equally in both directions.
...And 4 more matches
<easing-function> - CSS: Cascading Style Sheets
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).
...the most useful of these functions are given a keyword that allows them to be easily referenced.
...And 4 more matches
font-variation-settings - CSS: Cascading Style Sheets
the font-variation-settings css property provides low-level control over variable font characteristics, by specifying the four letter axis names of the characteristics you want to vary, along with their values.
...each setting is always one or more pairs consisting of a <string> of 4 ascii characters followed by a <number> indicating the axis value to set.
... description this property is a low-level mechanism designed to set variable font features where no other way to enable or access those features exist.
...And 4 more matches
<integer> - CSS: Cascading Style Sheets
WebCSSinteger
decimal points are not allowed.
... +---12 only one leading +/- is allowed.
... ten letters are not allowed.
...And 4 more matches
Guide to scroll anchoring - CSS: Cascading Style Sheets
you browse to a long page on a slow connection and begin to scroll to read the content; while you are busy reading, the part of the page you are looking at suddenly jumps.
... if one node doesn't seem appropriate to be an anchor, you can exclude it using overflow-anchor, as described below.
... the specification provides a new property, overflow-anchor, which can be used to disable scroll anchoring on all or part of the document.
...And 4 more matches
repeating-conic-gradient() - CSS: Cascading Style Sheets
<angular-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (an <angle> along the gradient's circumference axis).
... note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients.
... the above gradients are defined as being one third blue, one third red, and one third yellow.
...And 4 more matches
Overview of events and handlers - Developer guides
events and event handling become central to web programming with the addition of the language to browsers, accompanying a switch in the rendering architecture of browsers from fetch and load page rendering to event driven, reflow based, page rendering.
...douglas crockford explains this change effectively in several lectures, notably his talk, an inconvenient api: the theory of the dom, which shows the change in flow from the original browser flow to the event driven browser.
... the latter approach changes the last steps from a single flow into a perpetual loop, where waiting for and handling the incidence of new events follows painting.
...And 4 more matches
User input and controls - Developer guides
user input and controls workflow the following diagram illustrates the typical workflow for implementing user input mechanisms: first of all, you need to decide which input mechanisms you want to cover in your application out of mouse, keyboard, finger touch and so on.
... the following is a set of recommendations and best practices for using such tools in open web apps.
... when the input device is a mouse, you can also control user input through the pointer lock api and implement drag & drop (see below).
...And 4 more matches
HTML attribute: accept - HTML: Hypertext Markup Language
the accept attribute takes as its value a comma-separated list of one or more file types, or unique file type specifiers, describing which file types to allow.
... <p> <label for="soundfile">select an audio file:</label> <input type="file" id="soundfile" accept="audio/*"> </p> <p> <label for="videofile">select a video file:</label> <input type="file" id="videofile" accept="video/*"> </p> <p> <label for="imagefile">select some images:</label> <input type="file" id="imagefile" accept="image/*" multiple> </p> note the last example allows you to select multiple iamges.
...each unique file type specifier may take one of the following forms: a valid case-insensitive filename extension, starting with a period (".") character.
...And 4 more matches
<input type="date"> - HTML: Hypertext Markup Language
WebHTMLElementinputdate
additional attributes along with the attributes common to all <input> elements, date inputs have the following attributes: attribute description max the latest acceptable date min the earliest acceptable date step the stepping interval, when clicking up and down spinner buttons and validating the date max the latest date to accept.
... step the step attribute is a number that specifies the granularity that the value must adhere to, or the special value any, which is described below.
... a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max).
...And 4 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
WebHTMLElementtr
we have some examples below, but for more examples and an in-depth tutorial, see the html tables series in our learn web development area, where you'll learn how to use the table elements and their attributes to get just the right layout and formatting for your tabular data.
... deprecated attributes the following attributes may still be implemented in browsers but are no longer part of the html specification and may be missing or may not work as expected.
...this uses the char and charoff to establish the alignment character (typically "." or "," when aligning numerical data) and the number of characters that should follow the alignment character.
...And 4 more matches
itemscope - HTML: Hypertext Markup Language
in each of the following examples, the vocabulary is from schema.org.
... note: find more about itemtype attributes at http://schema.org/thing simple example html the following example specifies the itemscope attribute.
... <div itemscope itemtype="http://schema.org/movie"> <h1 itemprop="name">avatar</h1> <span>director: <span itemprop="director">james cameron</span> (born august 16, 1954)</span> <span itemprop="genre">science fiction</span> <a href="https://youtu.be/0ay1xikx7by" itemprop="trailer">trailer</a> </div> structured data the following table shows the structured data from the preceding example.
...And 4 more matches
Link types - HTML: Hypertext Markup Language
list of the defined link types and their significance in html link type description allowed in these elements not allowed in these elements alternate if the element is <link> and the rel attribute also contains the stylesheet type, the link defines an alternative style sheet; in that case the title attribute must be present and not be the empty string.
... this allows for bookmarking a single article in a page containing multiple articles, such as on a monthly summary blog page, or a blog aggregator.
... <link> <a>, <area>, <form> dns-prefetch hints to the browser that a resource is needed, allowing the browser to do a dns lookup and protocol handshaking before a user clicks the link.
...And 4 more matches
Array.prototype.concat() - JavaScript
if all valuen parameters are omitted, concat returns a shallow copy of the existing array on which it is called.
... see the description below for more details.
... description the concat method creates a new array consisting of the elements in the object on which it is called, followed in order by, for each argument, the elements of that argument (if the argument is an array) or the argument itself (if the argument is not an array).
...And 4 more matches
Array.prototype.filter() - JavaScript
you can work around this by inserting the following code at the beginning of your scripts, allowing use of filter() in ecma-262 implementations which do not natively support it.
...} } } } else{ while (++i !== len){ // checks to see if the key was set if (i in this){ kvalue = t[i]; if (func.call(thisarg, t[i], i, t)){ res[c++] = kvalue; } } } } res.length = c; // shrink down array to proper size return res; }; } examples filtering out all small values the following example uses filter() to create a filtered array that has all elements with values less than 10 removed.
... function isbigenough(value) { return value >= 10 } let filtered = [12, 5, 8, 130, 44].filter(isbigenough) // filtered is [12, 130, 44] find all prime numbers in an array the following example returns all prime numbers in the array: const array = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; function isprime(num) { for (let i = 2; num > i; i++) { if (num % i == 0) { return false; } } return num > 1; } console.log(array.filter(isprime)); // [2, 3, 5, 7, 11, 13] filtering invalid entries from json the following example uses filter() to create a filtered json of all elements with non-zero, numeric id.
...And 4 more matches
Array.prototype.map() - JavaScript
the callback function accepts the following arguments: currentvalue the current element being processed in the array.
... you can work around this by inserting the following code at the beginning of your scripts, allowing use of map in implementations which do not natively support it.
... // in browsers that support object.defineproperty, use the following: // object.defineproperty(a, k, { // value: mappedvalue, // writable: true, // enumerable: true, // configurable: true // }); // for best browser support, use the following: a[k] = mappedvalue; } // d.
...And 4 more matches
Array.prototype.sort() - JavaScript
if a and b are two elements being compared, then: if comparefunction(a, b) returns less than 0, sort a to an index lower than b (i.e.
... if comparefunction(a, b) returns greater than 0, sort b to an index lower than a (i.e.
... so, the compare function has the following form: function compare(a, b) { if (a is less than b by some ordering criterion) { return -1; } if (a is greater than b by the ordering criterion) { return 1; } // a must be equal to b return 0; } to compare numbers instead of strings, the compare function can simply subtract b from a.
...And 4 more matches
Math.clz32() - JavaScript
consider the following 32-bit word: var a = 32776; // 00000000000000001000000000001000 (16 leading zeros) math.clz32(a); // 16 var b = ~32776; // 11111111111111110111111111110111 (32776 inversed, 0 leading zeros) math.clz32(b); // 0 (this is equal to how many leading one's there are in a) using this logic, a clon function can be created as follows: var clz = math.clz32; function clon(integer){ return ...
...clz(~integer); } further, this technique could be extended to create jumpless "count trailing zeros" and "count trailing ones" functions as seen below.
... the ctrz function below fills in all the high bits with the lowest filled bit, then negates the bits to erase all higher set bits so that clz can then be used.
...And 4 more matches
Object.defineProperty() - JavaScript
description this method allows a precise addition to or modification of a property on an object.
...this method allows these extra details to be changed from their defaults.
...they share the following optional keys (note: the default value is in the case of defining properties using object.defineproperty()): configurable true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
...And 4 more matches
String.prototype.split() - JavaScript
see “how do you get a string to a character array in javascript?” on stackoverflow.
... const mystring = '' const splits = mystring.split() console.log(splits) // ↪ [""] the following example defines a function that splits a string into an array of strings using separator.
...nsole.log('the array has ', arrayofstrings.length, ' elements: ', arrayofstrings.join(' / ')) } const tempeststring = 'oh brave new world that has such people in it.' const monthstring = 'jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec' const space = ' ' const comma = ',' splitstring(tempeststring, space) splitstring(tempeststring) splitstring(monthstring, comma) this example produces the following output: the original string is: "oh brave new world that has such people in it." the separator is: " " the array has 10 elements: oh / brave / new / world / that / has / such / people / in / it.
...And 4 more matches
Operator precedence - JavaScript
operators with higher precedence become the operands of operators with lower precedence.
... precedence and associativity consider an expression describable by the representation below.
... a op1 b op2 c if op1 and op2 have different precedence levels (see the table below), the operator with the highest precedence goes first and associativity does not matter.
...And 4 more matches
break - JavaScript
the break statement terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement.
... description the break statement includes an optional label that allows the program to break out of a labeled statement.
... a break statement, with or without a following label, cannot be used within the body of a function that is itself nested within the current loop, switch, or label statement that the break statement is intended to break out of.
...And 4 more matches
Trailing commas - JavaScript
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.
... json, however, disallows trailing commas.
... var arr = [1, 2, 3,,,]; arr.length; // 5 objects starting with ecmascript 5, trailing commas in object literals are legal as well: var object = { foo: "bar", baz: "qwerty", age: 42, }; trailing commas in functions ecmascript 2017 allows trailing commas in function parameter lists.
...And 4 more matches
Privacy, permissions, and information security
privacy exceptions may be granted to specific sites or applications, but it may also be granted conditionally, such as by permitting only a select group of people to access it, or only allowing the information to be accessed and used for a limited period of time.
... modern browsers take steps to help prevent fingerprinting-based attacks by either not allowing information to be accessed or, where the information must be made available, by introducing variations that prevent it from being used for identification purposes.
...the following list includes features affecting both, since many of these features are used for both.
...And 4 more matches
Progressive web app structure - Progressive web apps (PWAs)
client-side rendering (csr) allows the website to be updated in the browser almost instantly when navigating to different pages, but requires more of an initial download hit and extra rendering on the client at the beginning.
... the website is slower on an initial visit, but can be faster to navigate.
...the most popular approach is the "app shell" concept, which mixes ssr and csr in exactly the way described above, and in addition follows the "offline first" methodology which we will explain in detail in upcoming articles and use in our example application.
...And 4 more matches
Getting started - SVG: Scalable Vector Graphics
take a look at the following code.
...it will render as shown in the following screenshot.
... (firefox users: click here) the rendering process involves the following: we start with the <svg> root element: a doctype declaration as known from (x)html should be left off because dtd based svg validation leads to more problems than it solves before svg 2, to identify the version of the svg for other types of validation the version and baseprofile attributes should always be used instead.
...And 4 more matches
PI Parameters - XSLT: Extensible Stylesheet Language Transformations
to solve this two new pis are implemented in firefox 2 (see supported versions below for details), <?xslt-param?> and <?xslt-param-namespace?>.
... the following document passes the two parameters "color" and "size" to the stylesheet "style.xsl".
...parsing of any attribute must not fail due to the presence of an unrecognized attribute as long as that attribute follows the syntax in xml-stylesheet.
...And 4 more matches
page-worker - Archive of obsolete content
allow object an object with keys to configure the permissions on the page worker.
... the boolean key script controls if scripts from the page are allowed to run.
...this may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded,...
...And 3 more matches
passwords - Archive of obsolete content
you can store different sorts of credentials, as outlined in the "credentials" section below.
...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.
...they contain the following properties: username the username.
...And 3 more matches
Canvas code snippets - Archive of obsolete content
code usable from web content getting the number of pixels of a certain color in a canvas the following function will return the number of pixels in a canvas that have the rgb color of r, g and b.
... r, g, b) { var cx = canvas.getcontext('2d'); var pixels = cx.getimagedata(0, 0, canvas.width, canvas.height); var all = pixels.data.length; var amount = 0; for (i = 0; i < all; i += 4) { if (pixels.data[i] === r && pixels.data[i + 1] === g && pixels.data[i + 2] === b) { amount++; } } return amount; }; getting the color of a pixel in a canvas this following snippet returns an object with the rgba values of the pixel at position x and y of the canvas.
...earrect', '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 'createimagedata', 'createlineargradient', 'createradialgradient', 'getimagedata', 'putimagedata' ]; var props = ['canvas', 'fillstyle', 'font', 'globalalpha', 'globalcompositeoperation', 'linecap', 'linejoin', 'linewidth', 'miterlimit', 'shadowoffsetx', 'shadowoffsety', 'shadowblur', 'shadowcolor', 'strokest...
...And 3 more matches
Connecting to Remote Content - Archive of obsolete content
following initialization, onload and onerror handlers are registered to a callback function to handle the response returned from the remote server.
...sending a post request requires you to set the content type of the request and to pass the post data to the send() method as below.
...unlike javascript, the json format doesn't allow any kind of code that can be run, only data.
...And 3 more matches
Case Sensitivity in class and id Names - Archive of obsolete content
for example, there might be this css: p.warning {color: red; background: yellow;} ...coupled with this html: <p class="warning">warning!</p> in netscape 6, the paragraph in question will have neither red text nor a yellow background.
...(for a detailed explanation of what html 4.01 says, see the following section, "why so case-sensitive?") the only way to avoid this particular problem is to make sure that your class and id names have consistent case throughout the entire document, and with respect to your css and javascript.
...for example, you would not want to do something like: .urgent {color: purple;} .urgent {color: yellow;} even though these are technically two distinct class names, browsers other than netscape 6 will treat them as though they are the same thing.
...And 3 more matches
Dehydra Object Reference - Archive of obsolete content
each member of the array has the following properties: { name: string, value: string or number, if applicable } see an example on enforcing final classes.
...the following properties are usually available: property type description .name string the function or variable name.
...the following additional properties are available on functions: property type description .isvirtual true or "pure" true for virtual methods, or "pure" for pure virtuals (e.g.
...And 3 more matches
Mozilla Crypto FAQ - Archive of obsolete content
export regulations in january 2000 to allow export of source code for open source software implementing encryption, the major remaining legal obstacle to mozilla crypto development was the fact that rsa security, inc., held a u.s.
...nss 3.1 will be available in beta form in september 2000, with the final release to follow in october 2000.
... this form of licensing was chosen to allow the released personal security manager and network security services source code to be used in as many contexts as possible; for example, the psm and nss code can be used in mozilla under mpl terms, and can also be used in gnu and other projects under gpl terms.
...And 3 more matches
Nanojit - Archive of obsolete content
it is an acronym for "low-level intermediate representation".
... example the following code works with spidermonkey's hacked version of nanojit.
... figuring out how to compile it is left as an exercise for the reader; the following works when run in the object directory of an --enable-debug spidermonkey shell: g++ -ddebug -g3 -wno-invalid-offsetof -fno-rtti -include js-confdefs.h -i dist/include/ -i..
...And 3 more matches
How to Write and Land Nanojit Patches - Archive of obsolete content
we land patches initially in nanojit-central, and those landings are followed up with semi-automated landings on tracemonkey and tamarin-redux.
... these follow-up landings on tracemonkey and tamarin-redux will overwrite any changes made to nanojit in tracemonkey and tamarin-redux!
...the following files in tracemonkey are from nanojit: everything in js/src/nanojit/ everything in js/src/vprof/ scenario 0: a common prefix for all scenarios make private clones of all three repositories: nanojit-central, tracemonkey and tamarin-redux.
...And 3 more matches
Scripting - Archive of obsolete content
prism allows for some client-side web application customization.
... the web application bundle is allowed to hold a javascript file named webapp.js (called the webapp script).
...it can contain the following functions: startup when the app starts, before the user interface is displayed.
...And 3 more matches
Same origin policy for XBL - Archive of obsolete content
when mozilla needs to decide whether or not xbl is allowed to be loaded, 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.
... checks performed once the originating principal is determined, checks are done to make sure the load should be allowed.
...And 3 more matches
Supporting private browsing mode - Archive of obsolete content
this allows us to, for example, work with the places database without affecting its contents.
... private browsing notifications there are notifications available that allow you to easily watch for changes to the status of the private browsing mode, including detecting when it turns on and off.
...} in addition, you can install watcher functions to be called when private browsing turns on and off, as shown in the following example.
...And 3 more matches
The new nsString class implementation (1999) - Archive of obsolete content
oss dll boundaries offers c-style function api to manipulate nsstrimpl offers simple memory allocator api for specialized memory policy shares binary format with bstring coming soon: a new xpcom (nsistring) interface non-templatized; this is a requirement for gecko very efficient buffer manipulation architecture the fundamental data type in the new architecture is struct nsstrimpl, given below: struct nsstrimpl { print32 mlength; void* mbuffer; print32 mcapacity; char mcharsize; char munused; // and now for the nsstrimpl api...
...this very useful class allows programmers to take advantage of the nsstring/nsstrimpl implementation, while eliminating heap based allocations.
... an additional improvement has been made to nsautostring that allows it to use an arbitrarily sized stack based buffer rather than its own internal buffer.
...And 3 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
plugins can consist of the following types of files, all of which can be installed via an xpi package: shared libraries (i.e.
... write keys in the windows registry which store information about this secondary location, in particular the plugin path and the xpt path (if applicable) so that netscape gecko browsers can pick up the plugin from the secondary location if they are installed after the plugin is (and thus, if a particular netscape gecko browser follows or replaces the current browser).
... on windows, the windows registry keys mentioned above follow a nomenclature using the concept of a plugin identifier as the name of the key under the mozillaplugins subkey.
...And 3 more matches
execute - Archive of obsolete content
method of install object syntax int execute ( string xpisourcepath [, boolean blocking]); int execute ( string xpisourcepath, string args [, boolean blocking]); parameters the execute method has the following parameters: xpisourcepath the pathname of the file to extract and execute.
...see note below.
...see note below.
...And 3 more matches
Extensions - Archive of obsolete content
for example, to add an item to the end of the tools menu, use the following: <menupopup id="menu_toolspopup"> <menuitem label="thesaurus"/> </menupopup> note that other extensions may be adding their own items into the same menus.
...for example, the following may be used to insert a command just after the 'select all' command: <popup id="contentareacontextmenu"> <menuitem label="select links" oncommand="thumbnails.selectalllinks();" insertafter="context-selectall"/> </popup> see firefox context menu for a list of the ids of the items found on the firefox context menu.
...this allows the menu to have different commands for different types of targets.
...And 3 more matches
MenuItems - Archive of obsolete content
this allows the user to discover what shortcut keys are available by looking at the menus.
...hence, -moz-image-region is not applied to the menu itself, but one level lower: <menuitem id="add-bookmark" class="menuitem-iconic" label="add bookmark" image="addbookmark.png"/> #add-bookmark { list-style-image: url('addbookmark.png'); } #add-bookmark .menu-iconic-icon { -moz-image-region: rect(0px, 16px, 16px, 0px) !important; } #add-bookmark:hover .menu-iconic-icon { -moz-image-region: rect(16px, 16px, 32px, 0px) !important; } this behavior is fundamentally dif...
... disabling a menuitem to have an item initially disabled, set the disabled attribute to true as in the following example: <menuitem label="undo" accesskey="u" disabled="true"/> when disabled, the item will appear greyed out and the action associated with the item cannot be carried out.
...And 3 more matches
Additional Navigation - Archive of obsolete content
the resulting data will look like the following: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg) here is the example.
...another thing that you cannot have is a triple where both variables would be unknown as in the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?category" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> in this case when the template builder gets to the triple, neither the ?category nor the ?title variables can be filled in so the builder doesn't know what to generate.
... source navigation triples may also be used to navigate up the graph as well as downwards, following the graph arrows in the reverse direction.
...And 3 more matches
RDF Query Syntax - Archive of obsolete content
the content tag doesn't do anything else at this point, meaning it doesn't add anything else to the network of potential results, so processing continues on to the next statement, the triple, which looks like this: <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> the triple statement is used to follow arcs or arrows in the rdf graph.
... the predicate attribute specifies the labels of the arrows to follow.
...the builder can either follow the arrows in a forward or backward direction, but only one direction per statement.
...And 3 more matches
Special Condition Tests - Archive of obsolete content
for example, the bookmarks toolbar in a web browser might display buttons at the first level, but menus and submenus for content below that.
... templates have a means of allowing a rule to match only if the generated content would be inserted inside an element with a particular tag name.
...for the bookmarks toolbar, the outer content is inserted into an <hbox>, but at lower levels, the content will be inserted into a <menu> in case you aren't clear, the tag that must match for the outer iteration is the root element, the one with the datasources attribute on it.
...And 3 more matches
Commands - Archive of obsolete content
a simple way of using commands is as follows: example: simple command example 1 : source view <command id="cmd_openhelp" oncommand="alert('help!');"/> <button label="help" command="cmd_openhelp"/> in this example, instead of placing the oncommand attribute on the button, we instead place it on a command element.
... it is normal to put a group of commands inside a commandset element, together near the top of the xul file, as in the following: <commandset> <command id="cmd_open" oncommand="alert('open!');"/> <command id="cmd_help" oncommand="alert('help!');"/> </commandset> a command is invoked when the user activates the button or other element attached to the command.
...a controller is expected to implement four methods, which are listed below: supportscommand (command) this method should return true if the controller supports a command.
...And 3 more matches
Creating a Skin - Archive of obsolete content
a simple skin the image below shows the current find files dialog.
... creating a custom skin package to create a skin, do the following: (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.
... 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.
...And 3 more matches
Creating a Window - Archive of obsolete content
the simplest xul file has the following structure: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- other elements go here --> </window> this window will not do anything since it doesn't contain any ui elements.
... note: the local xul document can be opened in the browser as mentioned above only if |dom.allow_xul_xbl_for_file| preference in "about:config" has been set to |true| .
...the syntax is described below: window.open(url,windowname,flags); where the flags contains the flag "chrome" as in this example window.open("chrome://navigator/content/navigator.xul", "bmarks", "chrome,width=600,height=300"); if you are using firefox, try below: window.open("chrome://browser/content/places/places.xul", "bmarks", "chrome,width=600,height=300"); you can test lines of javascript like these in the error ...
...And 3 more matches
RDF Datasources - Archive of obsolete content
the table below shows the resources (or fields) that you can retrieve from the history datasource.
... put the url values below where you want the value of the resource to be used.
...ildren> <treeitem uri="rdf:*"> <treerow> <treecell label="rdf:http://home.netscape.com/nc-rdf#name"/> <treecell label="rdf:http://home.netscape.com/nc-rdf#url"/> <treecell label="rdf:http://home.netscape.com/nc-rdf#date"/> </treerow> </treeitem> </treechildren> </rule> </template> </tree> other datasources the tables below list some of the other datasources available with mozilla.
...And 3 more matches
Using Spacers - Archive of obsolete content
some users may have larger displays with higher resolutions and others may have lower resolutions.
...applications that need to support multiple platforms and languages usually have their windows laid out with lots of space to allow for this.
...we'll talk more about this in the next section but it essentially allows you to divide a window into a series of boxes that hold elements.
...And 3 more matches
XPCOM Examples - Archive of obsolete content
this allows you to create a window menu with a list of the currently open windows in the application.
...we can use this as in the following example: example 1 : source <toolbox> <menubar id="windowlist-menubar"> <menu label="window"> <menupopup id="window-menu" datasources="rdf:window-mediator" ref="nc:windowmediatorroot"> <template> <rule> <menuitem uri="rdf:*" label="rdf:http://home.netscape.com/nc-rdf#name"/> </rule> </template> </menupopup> </menu> </menubar> </toolbox> a window menu will be created with a list of all the open windows.
...the code below shows how to get a component which implements it: var wmdata = components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"].getservice(); wmdata.queryinterface(components.interfaces.nsiwindowdatasource); this code retrieves a window mediator data source component.
...And 3 more matches
Using the Editor from XUL - Archive of obsolete content
having an id attribute, id="content-frame", allows us to find this element with document.getelementbyid("content-frame"), and to style it from css.
...we are currently only able to have one editor per composer window; in future, relaxing this restriction would allow us to edit all the subdocuments in a frameset at the same time.
...one thing to note about editor initialization is that we pass into the editor's init() method an nsicontent* that corresponds to the root of the content tree that the editor is allowed to work with.
...And 3 more matches
Writing Skinnable XUL and CSS - Archive of obsolete content
the following document outlines rules that one must abide by when writing a skin.
...below are examples for each case.
...this allows the button to blend in as much as possible regardless of where it is used.
...And 3 more matches
XUL controls - Archive of obsolete content
the following table lists the xul user interface controls.
... <colorpicker type="button" color="#cc0080"/> colorpicker reference <datepicker> a set of textboxes which may be used to allow the entry of a date.
... groupbox reference related elements: caption <filefield> allows the user to select a file.
...And 3 more matches
iframe - Archive of obsolete content
type type: one of the values below.
...the content that is loaded inside the browser is not allowed to access the chrome above it.
...the content that is loaded inside the browser is not allowed to access the chrome above it.
...And 3 more matches
menuseparator - Archive of obsolete content
attributes acceltext, accesskey, allowevents, command, crop, disabled, image, label, selected, tabindex, value properties accessibletype, accesskey, command, control, crop, disabled, image, label, labelelement, parentcontainer, selected, tabindex, value examples <menu label="menu"> <menupopup> <menuitem label="item1"/> <menuseparator/> <menuitem label="item2"/> <menuitem label="item3"/> </menupopup> </menu> attributes acceltext type: string text that appears beside the menu label to indicate the shortcut...
... allowevents type: boolean if true, events are passed to children of the element.
... crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...And 3 more matches
panel - Archive of obsolete content
ArchiveMozillaXULpanel
attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type properties accessibletype, label, popupboxobject, popup, state methods hidepopup, moveto, openpopup, openpopupatscreen, sizeto examples the following example shows how a panel may be attached to a label.
... fadetype: one of the values belowthe fade attribute, which may only be used with arrow panels, lets you set up a panel that will automatically fade away after a short time.
... nonethe panels doesn't automatically fade away.slowthe panels slowly fades away after a short time.fastthe panels quickly fades away after a short time.
...And 3 more matches
scale - Archive of obsolete content
ArchiveMozillaXULscale
« xul reference home [ examples | attributes | properties | methods | related ] a scale (sometimes referred to as a "slider") allows the user to select a value from a range.
... a bar displayed either horizontally or vertically allows the user to select a value by dragging a thumb on the bar.
...lower values are to the left and higher values are to the right.
...And 3 more matches
XULRunner 2.0 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\2.0 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/2.0 .
...And 3 more matches
Getting started with XULRunner - Archive of obsolete content
one way to achieve this is to run the following script everytime you want to install a new version: firefox_version=`grep -po "\d{2}\.\d+" /usr/lib/firefox/platform.ini` arch=`uname -p` xurl=https://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/$firefox_version/runtimes/xulrunner-$firefox_version.en-us.linux-$arch.tar.bz2 cd /opt sudo sh -c "wget -o- $xurl | tar -xj" sudo ln -s /opt/xulrunner/xulrunner /usr/bin/xulrunner sudo ln -s /...
...all of what you see below can be found in the xulrunner documentation here on mdn in much more detail.
... hint: skip ahead and download the sample application, you can experiment with it while following this tutorial.
...And 3 more matches
2006-10-06 - Archive of obsolete content
discussions protocol handlers boris zbarsky posed the question, should random webpages have access to the following protocols: feed, pcast, moz-bookmark, webcal, swebcal.
... as well as any protocols that you have implemented and are not in the list of protocols nsscriptsecuritymanager::checkloaduri feed: consensus is that it should be allowed and treated as an ordinary link.
... pcast: similar to feed: just differentiating between different types of feeds and should be allowed access.
...And 3 more matches
-ms-filter - Archive of obsolete content
syntax the -ms-filter property is specified as a string that contains a list of one or more items, separated by spaces, of the following types: filters transitions procedural surfaces formal syntax filter: <-ms-filter-function>+ -ms-filter: [ "'" <-ms-filter-function># "'" ] | [ '"' <-ms-filter-function># '"' ] where <-ms-filter-function> = <-ms-filter-function-progid> | <-ms-filter-function-legacy> where <-ms-filter-function-progid> = 'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value> ')'...
... 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.
...And 3 more matches
E4X for templating - Archive of obsolete content
strs.formatstringfromname(msg,args,args.length); } return strs.getstringfromname(msg); } for example, <toolbarbutton label={$s('mytoolbar.label')}/> conditionals function _if (cond, h, _else) { if (cond && cond != undefined) { // we need undefined condition for e4x return h(cond); } else if (_else) { return _else(cond); } return ''; // empty string allows conditions in attribute as well as element content } for example: {_if(elems.length(), function () <description>{elems[0]}</description>, function _else () <label>no data</label> )} note that the simple xmllist() constructor (<></>) may be useful to still be able to use an expression closure (i.e., without needing return statements and braces): {_if(elems.length(), function () <> ...
...eparate file templates (to be eval()d at a later time, taking into account security considerations, such as escaping with the above), e4x content using such functions can also be easily serialized inline (and then perhaps converted to the dom) as needed: var list = <>{_if(elems.length(), function () <> <markup/> <markup/> </>)}</>.toxmlstring(); iterating functions such as the following foreach (which can work with arrays, objects, or e4x objects) are quite convenient in iterating over complex structures such as e4x would not normally allow.
... if (h.length === 1) { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(arr[k], it, lev); // need to get it or lev via arguments[] since our length detection implies no explicit additional params; otherwise define with more than one param (see below) ++it; } } else { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(k, arr[k], it, lev); ++it; } } return ret; } the following real case example iterates over an array of the lines in an e4x chi...
...And 3 more matches
VBArray.lbound - Archive of obsolete content
the vbarray.lbound method returns the lowest index value used in the specified dimension of a vbarray.
...the dimension of the vbarray for which the lower bound index is wanted.
... example the following example consists of three parts.
...And 3 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
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[ ...
... } </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.
...And 3 more matches
Reference - Archive of obsolete content
--nickolay 05:37, 31 aug 2005 (pdt) gonna follow mozilla's coding guides here: http://www.mozilla.org/hacking/mozil...de.html#visual --maian 00:30, 20 september 2005 (pdt) btoa() and atob() base64 encode and decode functions this documentation is missing the base64 encode (btoa) and decode (atob) functions.
...there are still valid needs for this: computers on slow links, computers behind insane firewalls, as well as computers not connected to internet.
...i checked this by doing alert(math.constructor) //shows that object is its constructor alert(object.constructor) //shows that function is its constructor alert(function.constructor) //shows that function is its constructor note : the function.constructor seems to keep on refering to itself, if you do the following you get same results which suggests that this is indeed the top level object.
...And 3 more matches
Mozilla XForms Specials - Archive of obsolete content
instead you will have to use the following normal classes instead: xf-value xf-repeat-item xf-repeat-index for example, to target the value element of an input control use: @namespace xf url("http://www.w3.org/2002/xforms"); xf|input .xf-value { ...
...instead of using digest('abc', 'sha-1') explicitly use the third parameter (the results are equal): digest('abc', 'sha-1', 'base64') (limitation tracked in bug 477857) extensions enumerating instances the standardized nsixformsmodelelement does not allow one to enumerate over all possible instances, but only to retrieve instances by their name.
...we have added a function via the getfeature() call on each node, that allows the form author to do that.
...And 3 more matches
Archived open Web documentation - Archive of obsolete content
the documentation listed below is archived, obsolete material about open web topics.
...konqueror is listed below the table, which seems inconsistent.
...the default object semantics are implemented in the javascript engine, often written in lower-level languages like c++.
...And 3 more matches
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
the new mozilla xpcom architecture allows xpcom components be scriptable via a different mechanism called xpconnect.
...the changes allow to make existing 4.x plugins scriptable with only minor modifications in their code.
... how to call plugin native methods the following html code will do the job:</p> this should be changed, we shouldn't advocate embed <embed type="application/plugin-mimetype"> <script language="javascript"> var embed = document.embeds[0]; embed.nativemethod(); </script> how to build and install having the built mozilla tree is probably not necessary, but building the plugin with a scriptable instance interface will require mozilla headers an...
...And 3 more matches
Index - Game development
it's totally up to you which path you're going to follow.
...followup articles will cover implementations in specific 3d libraries.
...mozilla's a-frame framework provides a markup language allowing us to build 3d vr landscapes using a system familiar to web developers, which follows game development coding principles; this is useful for quickly and successfully building prototypes and demos, without having to write a lot of javascript or glsl.
...And 3 more matches
Game monetization - Game development
you have to follow the market and do your own research — learning from your mistakes quickly is important.
... there are many companies offering advert systems — you sign up and allow them to show adverts in exchange for a percentage of the earnings.
...they follow various strategies to earn money via your games, but you don't have to worry about all that as selling the license is usually a one-time deal.
...And 3 more matches
Collision detection - Game development
for the center of the ball to be inside the brick, all four of the following statements need to be true: the x position of the ball is greater than the x position of the brick.
... let's write that down in code: function collisiondetection() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var b = bricks[c][r]; if(x > b.x && x < b.x+brickwidth && y > b.y && y < b.y+brickheight) { dy = -dy; } } } } add the above block to your code, below the keyuphandler() function.
...update the following part of the code as indicated by the highlighted line: var bricks = []; for(var c=0; c<brickcolumncount; c++) { bricks[c] = []; for(var r=0; r<brickrowcount; r++) { bricks[c][r] = { x: 0, y: 0, status: 1 }; } } next we'll check the value of each brick's status property in the drawbricks() function before drawing it — if status is 1, then draw it, but if it's 0, then it ...
...And 3 more matches
MVC - MDN Web Docs Glossary: Definitions of Web-related terms
the three parts of the mvc software-design pattern can be described as follows: model: manages data and business logic.
...below we'll describe how we could implement some of this functionality using mvc.
... so for example, our shopping list could have input forms and buttons that allow us to add or delete items.
...And 3 more matches
Test your skills: WAI-ARIA - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...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.
...And 3 more matches
Pseudo-classes and pseudo-elements - Learn web development
if we wanted to make the first paragraph in an article larger and bold, we could add a class to that paragraph and then add css to that class, as shown in the first example below: however, this could be annoying to maintain — what if a new paragraph got added to the top of the document?
...try editing the previous live example so it uses the following css.
... you could use these to insert a string of text, such as in the live example below.
...And 3 more matches
Test your skills: sizing - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...the first should be sized so that the height will be at least 100 pixels tall, even if there is less content than would cause it to grow to that height, however, the content should not overflow if there is more content than fits in 100 pixels.
... the second box should be fixed at 100 pixels tall, so that content will overflow if there is too much.
...And 3 more matches
Test your skills: Grid Layout - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
...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.
...And 3 more matches
Multiple-column layout - Learn web development
you can follow along by downloading the multicol starting point file and adding the css into the appropriate places.
...the column-count property will create as many columns as the value you give it, so if you add the following css to your stylesheet and reload the page, you will get three columns: .container { column-count: 3; } the columns that you create have flexible widths — the browser works out how much space to assign each column.
...cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> </div> .container { column-count: 3; } change your css to use column-width as follows: .container { column-width: 200px; } the browser will now give you as many columns as it can of the size that you specify; any remaining space is then shared between the existing columns.
...And 3 more matches
How CSS works - Learn web development
it processes the document in a number of stages, which we've listed below.
... the following diagram also offers a simple view of the process.
... take the following html code: <p> let's use: <span>cascading</span> <span>style</span> <span>sheets</span> </p> in the dom, the node corresponding to our <p> element is a parent.
...And 3 more matches
create fancy boxes - Learn web development
all of the following: its box model properties: width, height, padding, border, etc.
... box model tweak the box model alone allows us to do some basic stuff, like adding simple borders, making squares, etc..
...as our text will still flow in a square, it looks nicer that way, giving the feeling that it's a "real" circle.
...And 3 more matches
Styling links - Learn web development
default styles the following example illustrates what a link will behave like by default (the css is simply enlarging and centering the text to make it stand out more.) <p><a href="#">a simple link</a></p> p { font-size: 2rem; text-align: center; } note: all the links in the examples in this page are fake links — a # (hash, or pound sign) is put in place of the real url.
... the default styles can be turned off/changed using the following css properties: color for the text color.
...two points to note here are: the underline has been created using border-bottom, not text-decoration — some people prefer this because the former has better styling options than the latter, and is drawn a bit lower, so doesn't cut across the descenders of the word being underlined (e.g.
...And 3 more matches
How much does it cost to do something on the Web? - Learn web development
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).
...to publish a barebones website, you only need a basic computer capable of launching an editor, and a web browser, so the entry level can be quite low.
... you need to upload content to a remote server (see hosting below), so you need a modem.
...And 3 more matches
Example 1 - Learn web development
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-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
... .1em .1em 0; background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } result for basic state active state html <div class="select active"> <span class="value">cherry</span> <ul class="optlist hidden"> <li class="option">cherry</li> <li class="option">lemon</li> <li class="option">banana</li> <li class="option">strawbe...
...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-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...And 3 more matches
Test your skills: Basic controls - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
...And 3 more matches
Images in HTML - Learn web development
it also slows down your page, leaving you with no control over whether the image is removed or replaced with something embarrassing.
... our above code would give us the following result: note: elements like <img> and <video> are sometimes referred to as replaced elements.
...its value is supposed to be a textual description of the image, for use in situations where the image cannot be seen/displayed or takes a long time to render because of a slow internet connection.
...And 3 more matches
General asynchronous programming concepts - Learn web development
it is up to the programming environment you are using (web browsers, in the case of web development) to provide you with apis that allow you to run such tasks asynchronously.
...web workers allow you to send some of the javascript processing off to a separate thread, called a worker so that you can run multiple javascript chunks simultaneously.
...consider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b then does something to the image like applying a filter to it.
...And 3 more matches
Function return values - Learn web development
we'll cover all of these below.
...it looks like this: function random(number) { return math.floor(math.random() * number); } this could be written as follows: function random(number) { const result = math.floor(math.random() * number); return result; } but the first version is quicker to write, and more compact.
... 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.
...And 3 more matches
Test your skills: Functions - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript.
...And 3 more matches
Test your skills: Object basics - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 3 more matches
Measuring performance - Learn web development
performance apis when writing code for the web, there are a large number of web apis available that allow you to create your own performance measuring tools.
...you can use the api for metrics related to all of the navigation events displayed in the didagram below.
...these interfaces allows the accurate measurement of the time it takes for javascript tasks to complete.
...And 3 more matches
Multimedia: video - Learn web development
the sections below describe each of these optimization techniques.
...if not, there are online tools, such as ffmpeg (discussed in section below), that encode, decode, convert, and perform other optimization functions.
... playsinline is required for mobile safari, allowing videos to play without forcing fullscreen mode.
...And 3 more matches
Web performance - Learn web development
guides this topic contains the following guides.
... the following is a suggested order for working through them; you should definitely start with the first one.
... measuring performance now that you understand a few performance metrics, we take a deeper dive into performance tools, metrics, and apis and how we can make performance part of the web development workflow.
...And 3 more matches
Creating a Language Pack
windows: replace make with mozmake in the commands below!
... while in that directory, issue the following command: $ make merge-x-testing locale_mergedir=$(pwd)/mergedir x-testing: browser chrome browser aboutcerterror.dtd // add and localize this file ...
... $ make wget-en-us en_us_binary_url=http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora if you're building on mac 64 bit, you'll need to change the command slightly: $ make wget-en-us en_us_binary_url=http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora moz_pkg_platform=mac at some point, you should see the following success message: downloaded http://ftp.mozilla.org/pub/mozilla.o....en-us.mac.dmg to /users/your_id/mozilla/vc/firefox/browser/locales/../../dist/firefox-3.6b5pre.en-us.mac.dmg the en-us binary has been downloaded.
...And 3 more matches
Creating a spell check dictionary add-on
parts needed to create a dictionary add-on, you first need two things: a spell check dictionary in hunspell or myspell format, with a license which allows you to use it.
...to create a dictionary add-on, simply create a zip file which contains the following files and folders: my-dictionary.xpi install.rdf dictionaries/ locale-code.dic locale-code.aff the .dic and .aff files must be placed in a subfolder named dictionaries within the zip file.
...this file contains information about your add-on such as name and version number (see below).
...And 3 more matches
HTTP logging
this allows you to capture only the "interesting" part of the browser's behavior (i.e.
... go to the "logging section" adjust the location of the log file if you don't like the default adjust the list of modules that you want to log: this list has the exact same format as the moz_log environment variable (see below).
... copy and paste the following lines one at a time into the command prompt window.
...And 3 more matches
Old Thunderbird build
while you can build thunderbird on older hardware it can take quite a bit of time to compile on slower machines with less ram.
...so firstly complete the instructions for your os and then continue following these build instructions.
... 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.
...And 3 more matches
Simple SeaMonkey build
you can build a bleeding-edge, development version of seamonkey using the commands below.
... high speed internet installing build tools if your system is not listed below, see the build prerequisites page.
...tall all 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 cent...
...And 3 more matches
Gecko Logging
lazyloglodule provides a conversion operator to logmodule* and is suitable for passing into the logging macros detailed below.
...the first character must be a lowercase or uppercase ascii char, underscore, dash, or dot.
... verbose 5 a message that will be printed a lot, useful for debugging program flow and will probably impact performance.
...And 3 more matches
Cross Process Object Wrappers
add-on code is still allowed to use cpows "unsafely".
...this is because the chrome process runs the firefox ui, so if it were blocked by the content process, then a slow content process could cause firefox to become unresponsive to users.
...one of these shims provides the following behavior: whenever chrome code tries to access content directly (for example, through window.content or browser.contentdocument), it is given back a cpow that wraps the content object.
...And 3 more matches
PopupNotifications.jsm
see notification actions below for details.
...see notification options below for details.
... a notification action object must contain the following properties: label a text label describing the action.
...And 3 more matches
SourceMap.jsm
according to the spec, source maps have the following attributes: version: which version of the source map spec this map is following.
...the only argument is an object with the following properties: line: the line 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 available.
...And 3 more matches
Localization and Plurals
if you don't know how many plural forms you need, check the pluralrule number in chrome/global/intl.properties, and look up the corresponding entry in the following list of plural rules.
...additionally, there is a brief description of each plural form, followed by some sample numbers that fall into that particular form.
... examples the following are some examples for various languages and a brief thought processes.
...And 3 more matches
Localization technical reviews
this guide provides details on what a localization technical review is, what criteria are used for the technical reviews, and the process for requesting one and following its progress.
... allows us to understand how each l10n team is performing their localization work.
... allows us to discover potential bugs within l10n tools.
...And 3 more matches
Refcount tracing and balancing
refcount balancing is a follow-up step that analyzes the resulting log to help a developer figure out where refcounting went wrong.
... warning: you should never use this without xpcom_mem_log_classes and/or xpcom_mem_log_objects, because without some filtering the logging will be completely useless due to how slow the browser will run and how large the logs it produces will be.
... however, having an nscomptr log and using it in the creation of the balance tree allows addref and release calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic.
...And 3 more matches
Reporting a Performance Problem
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.
... viewing addon performance in geckoview sometimes an addon or more are slowing down firefox.
... make sure you are doing whatever it is that slows down firefox while recording the profile.
...And 3 more matches
powermetrics
the following command encompasses the most useful ones: sudo powermetrics --samplers tasks --show-process-coalition --show-process-gpu -n 1 -i 5000 --samplers tasks tells it to just do per-process measurements.
... the following is example output from such an invocation: *** sampled system activity (fri sep 4 17:15:14 2015 +1000) (5009.63ms elapsed) *** *** running tasks *** name id cpu ms/s user% deadlines (<2 ms, 2-5 ms) wakeups (intr, pkg idle) gpu ms/s com.apple.terminal 293 447.66 274.83 120.35 221.74 firefox ...
... 0.00 com.apple.safari.searchhelper 84690 0.15 49.49 0.00 0.00 0.20 0.20 0.00 org.mozilla.firefox 482 76.56 124.34 63.47 0.00 firefox 84496 76.70 89.18 10.58 5.59 124.55 63.48 0.00 this sample was taken while the following programs were running: firefox beta (single process, invoked from the mac os dock, shown in the org.mozilla.firefox coalition.) firefox nightly (multi-process, invoked from the command line, shown in the com.apple.terminal coalition.) google chrome.
...And 3 more matches
L20n HTML Bindings
in addition to the pre-defined whitelists, any element found in the original source html is allowed in the translation as well.
... consider the following source html: <p data-l10n-id="save"> <input type="submit"> <a href="/main" class="btn-cancel"></a> </p> assume the following malicious translation: <save """ <input value="save" type="text"> or <a href="http://myevilwebsite.com" onclick="alert('pwnd!')" title="back to the homepage">cancel</a>.
...</p> the input element is not on the default whitelist but since it's present in the source html, it is also allowed in the translation.
...And 3 more matches
L20n Javascript API
ctx.registerlocalenegotiator(function(available, requested, deflocale) { return intl.prioritizelocales(available, requested, deflocale); }); negotiator is a function which takes the following arguments: available - all locales available to the context instance, requested - locales preferred by the user, deflocale - the default locale to be used as the ultimate fallback, callback - the function to call when the negotiation completes (useful for asynchronous negotiators).
... ctx.requestlocales('pl'); if registerlocales hasn't been called, the special i-default locale is used, which means that the following minimal code is valid and will result in a fully operational context instance.
...the error object is passed as the first argument to callback and can be one of the following: context.error, when there are problems with setting up resources (e.g.
...And 3 more matches
Localization Use Cases
declensions in gaia's browser app, there's an about-browser string defined as follows in apps/browser/locales/browser: about-browser=about {{browserbrandshortname}} problem definition in many inflected languages (e.g.
... in shared/branding/official/branding, we can define browserbrandshortname as: <browserbrandshortname{ nominative: "firefox", genitive: "firefoxa", dative: "firefoxu", accusative: "firefox", locative: "firefoxu", instrumental:"firefoxom" }> and in shared/branding/unofficial/branding, we can define browserbrandshortname as follows, to mean web browser: now, coming back to apps/browser/locales/browser, we can take advantage of the grammatical cases.
..., as: <brandshortname "boot2gecko" _gender:"neutral"> now we can translate crash-banner-os2 into polish without sounding like a robot: <crashbanneros2[brandshortname::_gender] { masculine: "{{ brandshortname }} uległ awarii", feminine: "{{ brandshortname }} uległa awarii", neutral: "{{ brandshortname }} uległo awarii" }> this will give us, depending on the current branding, the following messages: firefox os uległ awarii boot2gecko uległo awarii isolation let's look at how the settings app formats sizes.
...And 3 more matches
NSPR Poll Method
the prototype of the poll method is print16 poll_method(prfiledesc *fd, print16 in_flags, print16 *out_flags); the purpose of the poll method is to allow a layer to modify that flags that will ultimately be used in the call to the underlying network transport's select (or equivalent) function, and to indicate that a layer is already able to make progress in the manner suggested by the polling flags.
... the arguments and return value of the poll method are described below.
...to remain compatible with this potential semantic change, nspr clients should only use *out_flags as described in the how to use the poll method section below.
...And 3 more matches
NSS 3.12.4 release notes
the bug fixes in nss 3.12.4 are described in the "bugs fixed" section below.
... cert_decodecrlissuingdistributionpoint cert_findcrlissuingdistpointexten the old documentation of the expression matching syntax rules was incorrect, and the new corrected documentation is as follows for public nssutil functions (see portreq.h): port_regexpvalid port_regexpsearch port_regexpcasesearch these functions will match a string with a shell expression.
...if one is upper case and the other is lower case, then the ascii non-alphanumeric characters between z and a will also be in range.
...And 3 more matches
NSS 3.12.5 release_notes
the bug fixes in nss 3.12.5 are described in the "bugs fixed" section below.
... this default setting can also be changed within the application by using the following existing api functions: secstatus ssl_optionset(prfiledesc *fd, print32 option, prbool on) secstatus ssl_optionsetdefault(print32 option, prbool on) there is now a new value for "option", which is: ssl_enable_renegotiation the corresponding new values for ssl_enable_renegotiation are: ssl_renegotiate_never: never renegotiate at all (default).
...(see ssl.h) error codes: ssl_error_decompression_failure (see sslerr.h) ssl_error_renegotiation_not_allowed (see sslerr.h) new context initialization and shutdown functions see nss.h for details.
...And 3 more matches
NSS 3.19.2.1 release notes
the bug fixes in nss 3.19.2.1 are described in the "security advisories" section below.
... nss 3.19.2.1 and nspr 4.10.10 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_19_2_1_rtm/src/ https://ftp.mozilla.org/pub/nspr/releases/v4.10.10/src/ security advisories the following security-relevant bugs have been resolved in nss 3.19.2.1.
...an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution.
...And 3 more matches
NSS 3.19.4 release notes
the bug fixes in nss 3.19.4 are described in the "security advisories" section below.
... nss 3.19.4 and nspr 4.10.10 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_19_4_rtm/src/ https://ftp.mozilla.org/pub/nspr/releases/v4.10.10/src/ security advisories the following security-relevant bugs have been resolved in nss 3.19.4.
...an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution.
...And 3 more matches
NSS 3.20.1 release notes
the bug fixes in nss 3.20.1 are described in the "security advisories" section below.
... nss 3.20.1 and nspr 4.10.10 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_20_1_rtm/src/ https://ftp.mozilla.org/pub/nspr/releases/v4.10.10/src/ security advisories the following security-relevant bugs have been resolved in nss 3.20.1.
...an attacker that successfully exploited these issues can overflow the heap and may be able to obtain remote code execution.
...And 3 more matches
NSS 3.24 release notes
counter mode and galois/counter mode (gcm) have checks to prevent counter overflow.
... nss softoken has also been updated to allow nss to run in fips level 1 (no password).
... notable changes in nss 3.24 additions, deprecations, and other changes in nss 3.24 are listed below.
...And 3 more matches
PKCS11 FAQ
MozillaProjectsNSSPKCS11FAQ
other certificates on the token are also loaded (to allow building certificate chains), but it's not necessary to include the full chain, as long as the full chain is available in the regular certificate database.
... certificates and keys are often looked up by the following methods: by looking up all private keys.
...the label for a token certificate is presented to the user as follows:token label :certificate label .
...And 3 more matches
NSS tools : ssltab
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 following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information.
...the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
...And 3 more matches
NSS tools : ssltap
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 following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information.
...the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
...And 3 more matches
NSS tools : vfychain
options -a the following certfile is base64 encoded -b yymmddhhmmz validate date (default: now) -d directory database directory -f enable cert fetching from aia url -o oid set policy oid for cert validation(format oid.1.2.3) -p use pkix library to validate certificate by calling: * cert_verifycertificate if specified once, * cert_pkixverifycert if specified twice and more.
... -r following certfile is raw binary der (default) -t following cert is explicitly trusted (overrides db trust) -u usage 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email recipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode.
... prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ...
...And 3 more matches
NSS Tools pk12util
the tool allows you to import certificates and keys from pkcs #12 files into nss or export them and also list certificates and keys in such files.
...rtkeylen] [common-options] or pk12util -l p12file [-h tokenname] [-r] [common-options] where [common-options] = [-d dir] [-p dbprefix] [-k slotpasswordfile | -k slotpassword] [-w p12filepasswordfile | -w p12filepassword] syntax to run the pkcs #12 tool, type ther command pk12util option [arguments] where option and arguments are combinations of the options and arguments listed in the following section.
...the options and arguments for the pk12util command are defined as follows: options -i p12file import a certificate and private key from from the p12file into the database.
...And 3 more matches
NSS tools : ssltap
MozillaProjectsNSStoolsssltap
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 following are well-known port numbers: * http 80 * https 443 * smtp 25 * ftp 21 * imap 143 * imaps 993 (imap over ssl) * nntp 119 * nntps 563 (nntp over ssl) usage and examples you can use the ssl debugging tool to intercept any connection information.
...the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program waits for an incoming connection on the default port 1924.
...And 3 more matches
NSS tools : vfychain
options -a the following certfile is base64 encoded -b yymmddhhmmz validate date (default: now) -d directory database directory -f enable cert fetching from aia url -o oid set policy oid for cert validation(format oid.1.2.3) -p use pkix library to validate certificate by calling: * cert_verifycertificate if specified once, ...
... -r following certfile is raw binary der (default) -t following cert is explicitly trusted (overrides db trust) -u usage 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email recipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode.
... prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ...
...And 3 more matches
Rhino overview
rhino contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language.
... in addition, rhino has implemented javaadapters, which allows javascript to implement any java interface or extend any java class with a javascript object.
...these features allow "computational reflection": that is, the ability for a script to determine and influence aspects of the way it is evaluated.
...And 3 more matches
Rhino scopes and contexts
simple embeddings of rhino probably won't need any of the information here, but more complicated embeddings can gain performance and flexibility from the techniques described below.
...we'll see below that there are ways to share a scope created this way among multiple scopes and threads.
...in the diagram below, the order in which the six objects are traversed is indicated.
...And 3 more matches
Creating JavaScript jstest reftests
non262 tests the directory js/src/tests/non262/ should contain all tests of the following type: regressions of spidermonkey non-standard spidermonkey extensions to the javascript language test of "implementation-defined" details of the ecmascript standard for example, the exact definition of pi or some details of array sorting.
... you should not add tests of the following type: tests of the jit test of jit correctness belong in the jit-test suite, read more here.
... you should contribute directly to test262 in the following scenarios: you are writing tests for the implementation of a new feature or feature proposal for ecmascript.
...And 3 more matches
Getting SpiderMonkey source code
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.
... 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.
... 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.
...And 3 more matches
Exact Stack Rooting
instead, spidermonkey has a convenient suite of c++ raii classes to do this for you, called js::rootedt: rootedstring str1(cx, js_valuetostring(cx, val)); rootedstring str2(rt, js_valuetostring(cx, val)); note 1: c++ insists that an initializing assignment (e.g., the default constructor followed by operator=) must have a copy constructor available, even if it is not used.
... the purpose of js::mutablehandlet is to allow out-parameters for rooted gcthings.
... this class solves two problems: c++ only allows one level of user-defined implicit type conversion.
...And 3 more matches
Introduction to the JavaScript shell
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.
...these are summarized below.
...anything other than 0 will make javascript run extremely slow but may help reveal or reproduce gc-related bugs.
...And 3 more matches
JS_SetOptions
this is the logical or of zero or more flags described below.
...to turn individual options on or off, use js_setoptions with js_getoptions: // turn on warnings for dubious practices js_setoptions(cx, js_getoptions(cx) | jsoption_extra_warnings); // turn off those extra warnings js_setoptions(cx, js_getoptions(cx) & ~jsoption_extra_warnings); the options parameter and the return value are the logical or of zero or more constants from the following table: option description jsoption_extra_warnings warn on dubious practice.
... mxr id search for jsoption_xml jsoption_allow_xml added in spidermonkey 15 if this is off, e4x syntax isn't supported no matter what version number is set.
...And 3 more matches
Parser API
by default, the parsing returns a program object (see below) representing the parsed abstract syntax tree (ast).
... additional options may be provided via the options object, which can include any of the following properties: loc boolean default: true when loc is true, the parser includes source location information in the returned ast nodes.
...all node types implement the following interface: interface node { type: string; loc: sourcelocation | null; } the type field is a string representing the ast variant type.
...And 3 more matches
Split object
this makes the problem resistant to a wrapper-based approach.) older versions of firefox accomplished this by blowing away all window properties every time a user navigated to another page, then reusing the window.
...this was slow.
...this privilege check may be slow.
...And 3 more matches
TPS Bookmark Lists
all bookmark paths must begin with one of the following: "menu": the normal bookmarks menu "toolbar": the bookmarks toolbar "tags": the tags folder "unfiled": the unfiled bookmarks folder "places": the places root folder ("menu", "toolbar", and "unfiled" are all children of this) sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu".
...folder contents the contents for a folder are given as an array of objects, representing various bookmark types, described below.
...ion, tags, keyword properties above, plus two additional properties: location: the full path of the folder that the bookmark should be moved to position: the title of the existing bookmark item, in the current folder, where this bookmark should be moved to (i.e., this bookmark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be positioned below the current one) example: { uri: "http://www.google.com", title: "google", loadinsidebar: false, tags: [ "google", "computers", "misc" ] } livemark objects valid properties are: livemark: the livemark name.
...And 3 more matches
Places Developer Guide
the example below shows how to enumerate a bookmark folder's contents, and how to access the properties of the items themselves.
...the example below shows how to search through all bookmarks, and to iterate over the results.
...examples of the capabilities of each are provided below.
...And 3 more matches
Querying Places
executing a query places queries have several basic parts: the query object: nsinavhistoryquery, holds the search parameters the query options: nsinavhistoryqueryoptions, allows configuration of the search result the history service: nsinavhistoryservice, executes the query the first first step is to create the query and options, and fill them with the parameters you want.
...let options = placesutils.history.getnewqueryoptions(); // no query parameters will return everything let query = placesutils.history.getnewquery(); // execute the query let result = placesutils.history.executequery(query, options); result types nsinavhistoryqueryoptions has a resulttype property that allows configuration of the grouping and level of detail to be returned in the results.
... the different values for this property are listed below.
...And 3 more matches
XML Extras
the xml extras module contains several features that allow developers to treat xml as data i.e.
...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.
...if you follow that link to look at the examples you will need to look at page source for the html documents.
...And 3 more matches
Accessing the Windows Registry Using XPCOM
the interface follows the windows api fairly closely, but with many of the low-level details taken care of for you.
...the data types supported by this interface are defined as named constants on the interface as follows: type_none — probably not useful type_string — a unicode string value type_binary — binary data type_int — a 32 bit integer type_int64 — a 64 bit integer each of these types (except type_none) has a corresponding method to read the value data: readstringvalue() readbinaryvalue() readintvalue() readint64value() since javascript is a dynamically-typed language, you may w...
...ish to use the following code to handle all types of data.
...And 3 more matches
XPCOM array guide
MozillaTechXPCOMGuideArrays
this array is read-only, and the interface does not provide any methods that will allow adding and removing members.
... nsimutablearray - a scriptable container for scriptable xpcom objects, which allows addition and removal of member objects.
...this basic interface only allows querying of existing elements in the array.
...And 3 more matches
Avoiding leaks in JavaScript XPCOM components
the most common strategies for managing heap allocation are the following: malloc and free (or new and delete) the simplest strategy for heap allocation is that the programmer makes one function call to request memory from the heap and another one to return it.
... reference counting reference counting is a simple solution to the problem of allowing multiple owners to influence the lifetime of an object.
...it allows javascript code to access xpcom objects (i.e., it wraps native xpcom objects for javascript) and it allows javascript code to implement xpcom interfaces (i.e., it wraps javascript objects for xpcom).
...And 3 more matches
Detailed XPCOM hashtable guide
mozilla's hashtable implementations mozilla has several hashtable implementations, which have been tested and, tuned, and hide the inner complexities of hashtable implementations: pldhash - low-level c api; stores keys and data in one large memory structure; uses the heap efficiently; client must declare an "entry class" and may not hold onto entry pointers.
... plhashtable - low-level c api; entry class pointers are constant; more efficient for large entry structures; often wastes memory making many small heap allocations.
... nsthashtable - low-level c++ wrapper around pldhash; generates callback functions and handles most casting automagically.
...And 3 more matches
nsIAbCard
following a huge refactoring of the address book code, most of the documentation below is out of date.
... prefermailformat unsigned long allowed values are stored in nsiabprefermailformat.
... allowremotecontent boolean allow remote content to be displayed in html mail received from this contact methods getcardvalue() astring getcardvalue(in string name) parameters name the attribute you want the value for.
...And 3 more matches
nsIBrowserHistory
to use this service, use: var browserhistory = components.classes["@mozilla.org/browser/nav-history-service;1"] .getservice(components.interfaces.nsibrowserhistory); method overview void addpagewithdetails(in nsiuri auri, in wstring atitle, in long long alastvisited); obsolete since gecko 15.0 void markpageasfollowedlink(in nsiuri auri); obsolete since gecko 22.0 void markpageastyped(in nsiuri auri); obsolete since gecko 22.0 void registeropenpage(in nsiuri auri); obsolete since gecko 9.0 void removeallpages(); void removepage(in nsiuri auri); void removepages([array, size_is(alength)] in nsiuri auris, in unsigned long alength, in boolean adobatchnotify); ...
... void removepagesbytimeframe(in long long abegintime, in long long aendtime); void removepagesfromhost(in autf8string ahost, in boolean aentiredomain); void removevisitsbytimeframe(in long long abegintime, in long long aendtime); void unregisteropenpage(in nsiuri auri); obsolete since gecko 9.0 note: the markpageasfollowedlink and markpageastyped methods were moved to nsinavhistoryservice in gecko 22.0 so that all markpageas* methods can be found in one interface.
... markpageasfollowedlink() obsolete since gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) note: this method was moved to another interface in gecko 22.0.
...And 3 more matches
nsIClipboardDragDropHooks
allowdrop() will be called many times during drag so ensure that it is efficient.
... method overview boolean allowdrop(in nsidomevent event, in nsidragsession session); boolean allowstartdrag(in nsidomevent event); boolean oncopyordrag(in nsidomevent aevent, in nsitransferable trans); boolean onpasteordrop(in nsidomevent event, in nsitransferable trans); methods allowdrop() tells gecko whether a drop is allowed on this content area.
... boolean allowdrop( in nsidomevent event, in nsidragsession session ); parameters event the dom event (drag gesture).
...And 3 more matches
nsIDroppedLinkHandler
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean candroplink(in nsidomdragevent aevent, in prbool aallowsamedocument); astring droplink(in nsidomdragevent aevent, out astring aname, [optional] in boolean adisallowinherit); void droplinks(in nsidomdragevent aevent, [optional] in boolean adisallowinherit, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsidroppedlinkitem alinks); methods candroplink() determines if a link being dragged can be dropped.
... boolean candroplink( in nsidomdragevent aevent, in prbool aallowsamedocument ); parameters aevent a dragenter or dragover event.
... aallowsamedocument if false, drops are only allowed if the document of the source of the drag is different from the destination.
...And 3 more matches
nsIEffectiveTLDService
the methods below implement the public suffix algorithm in full, including the implicit "*" rule.
...is "pretty.flowers" a domain name, according to getpublicsuffix()?
... ns_error_unexpected or other error returned by nsiidnservice.normalize() when the hostname contains characters disallowed in uris.
...And 3 more matches
nsIFrameScriptLoader
methods void loadframescript(in astring aurl, in boolean aallowdelayedload, [optional] in boolean aruninglobalscope) void removedelayedframescript(in astring aurl); jsval getdelayedframescripts(); loadframescript() load a script in the remote frame.
... if this function is called on a chromemessagebroadcaster (for example, a global frame message manager or a window message manager) then: loadframescript() will load the frame script independently into each applicable frame: every open frame in the given window for the window message manager, or every frame in every window for the global message manager if aallowdelayedload is true, then the script will also be loaded into any applicable new frames opened after the loadframescript() call.
... if this function is called on a chromemessagesender: it will load the frame script only into this chromemessagesender's frame aallowdelayedload should always be true.
...And 3 more matches
nsIIOService
implemented by @mozilla.org/network/io-service;1 as a service: var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); method overview boolean allowport(in long aport, in string ascheme); acstring extractscheme(in autf8string urlstring); unsigned long getprotocolflags(in string ascheme); nsiprotocolhandler getprotocolhandler(in string ascheme); nsichannel newchannel(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); obsolete since gecko 48 nsichannel newchannel2(in autf8string asp...
... methods allowport() checks if a port number is banned.
... is similar to nsiprotocolhandler.allowport().
...And 3 more matches
nsIProcessScriptLoader
methods void loadprocessscript(in astring aurl, in boolean aallowdelayedload) void removedelayedprocessscript(in astring aurl); jsval getdelayedprocessscripts(); loadprocessscript() load a script in the child process.
... if aallowdelayedload is true, then the script will also be loaded into any new child processes created after the loadprocessscript() call.
... if this function is called on a chromemessagesender: it will load the process script only into this chromemessagesender's child process aallowdelayedload should always be true.
...And 3 more matches
nsISecurityCheckedComponent
inherits from: nsisupports last changed in gecko 1.7 capability strings in gecko, a "capability" is a string identifying a set of actions that code is allowed to perform.
... two examples: code that has the "universalxpconnect" capability is allowed to access all of xpcom.
...code that has the "universalbrowserread" capability is allowed to perform certain actions that allow it to read information from the local system.
...And 3 more matches
nsIXULTemplateBuilder
the structure of a template is as follows: <rootnode datasources="" ref=""> <template> <queryset> <query></query> <rule> <conditions>...</conditions> <bindings>...</bindings> <action>...</action> </rule> </queryset> </template> </rootnode> the datasources attribute on the root node is used to identify the source of data to be used.
...there may be more than one <queryset> if multiple queries are desired, and this element is optional if only one query is needed -- in that case the <query> and <rule>s are allowed to be children of the <template> node.
...this allows the query processor to be specific to a particular kind of input data or query syntax, while the template builder remains independent of the kind of data being used.
...And 3 more matches
Setting HTTP request headers
this method allows us to set an http request header.
... below is some sample code where we set an http header.
...below is an example observer that adds a custom header "x-hello" to the channel passed in for http-on-modify-request notification: var {cc, ci} = require("chrome"); var httprequestobserver = { observe: function(subject, topic, data) { if (topic == "http-on-modify-request") { var httpchannel = subject.queryinterface(ci.nsihttpchannel); httpchannel.setrequestheader("x-hello", "world",...
...And 3 more matches
Weak reference
and the call would fail if the pointer were allowed to dangle, therefore, the pointer should be a owning reference.
... what is actually needed in this case, is either out-of-band signaling, where when the observer wants to go away, it unregisters itself from the observable, which then releases its owning reference, allowing the observer to die, or else a new kind of reference.
...in the following example, an nsobservable must keep some kind of a reference to each observer, in order to report events.
...And 3 more matches
MailNews fakeserver
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.
...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.
...the server provides the following api to xpcshell tests: <caption> nsmailserver xpcshell api </caption> name arguments returns description performtest none nothing runs until the test is forcibly aborted or stopped normally isstopped none if the server is stopped helper for performtest istestfinished none if the test is finished helper for performtest playtransaction none the transaction the transaction is an object...
...And 3 more matches
Zombie compartments
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.
... for example, if i open www.techcrunch.com the following compartments are created.
... these are a particular kind of memory leak, and they cause firefox's memory usage to increase gradually over time, slowing it down and making it more likely to crash.
...And 3 more matches
Standard OS Libraries
this article allows you to find out what types to give to values/arguments by supplying links to the documentation of the os libraries.
...gtk+ is the toolkit to build apps, gdk is more low-level.
...examples for both are found below.
...And 3 more matches
Using js-ctypes
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.
... windows on windows, the following locations are searched for the library, in this order: the application's directory.
... note: this example will not work on 64bit os x, see below for core foundation for 64bit os x /* build a str255 ("pascal style") string from the passed-in string */ function makestr(str) { return string.fromcharcode(str.length) + str; } components.utils.import("resource://gre/modules/ctypes.jsm"); var carbon = ctypes.open("/system/library/frameworks/carbon.framework/carbon"); stdalert = carbon.declare("standardalert", /* function name */ ...
...And 3 more matches
DOM Inspector internals - Firefox Developer Tools
at the top of each panel is a toolbar which contains a menu button allowing you to choose which viewer to display from the viewer list, a label displaying the name of the currently active viewer, and another menu button allowing you to issue viewer-specific commands.
...this separation allows for viewers to be self-contained, with a viewer's xul defined in its own document and loaded in its own scope, without fear of collisions in the xul, css, or js.
...its contents should resemble the following: extensions/ … jsutil/ … prefs/ … res/ … tests/ … viewers/ … browseroverlay.xul commandoverlay.xul editingoverlay.xul flasher.js hooks.js inspector.css inspector.js inspectoroverlay.xul inspector.xml inspector.xul keysetoverlay.xul object.js object.xul popupoverlay.xul sidebar.js sidebar.xul ...
...And 3 more matches
Introduction to DOM Inspector - Firefox Developer Tools
this allows you to use the dom inspector without having to use a separate browser window, or without embedding a browser in your application at all.
...you can traverse the structure and go from the topmost parts parts of the dom tree to lower level nodes, such as the "search-go-button" icon that lets users perform a query using the selected search engine.
...the following descriptions provide an overview of what these viewers are about: the dom nodes viewer shows attributes of nodes that can take them, or the text content of text nodes, comments, and processing instructions.
...And 3 more matches
UI Tour - Firefox Developer Tools
the ui is split vertically into three panels source list pane source pane the contents of the third pane depend on the current state of the debugger and may include the following sections: toolbar watch expressions breakpoints call stack scopes xhr breakpoints event listener breakpoints dom mutation breakpoints source list pane the source list pane lists all the javascript source files loaded into the page, and enables you to select one to debug.
... for files, the following context menu options are available: copy source uri copies the full identifier of the file to the clipboard.
... for folders and groups, the following context menu options are available: collapse all collapses all subfolders of the item.
...And 3 more matches
Deprecated tools - Firefox Developer Tools
you may see a warning message, as in the following image, when trying to activate a deprecated panel: in addition, if you open the panel for one of these tools, you will also see a warning message about its removal.
... description webide allowed you to connect the firefox developer tools to remote browsers, such as firefox for android.
... canvas debugger bugzilla issue: bug 1403938 removed as of firefox 67 description canvas debugger allowed users to inspect the canvas element and see how frequently a given function is called.
...And 3 more matches
Dominators view - Firefox Developer Tools
if you already know what shallow size, retained size, and dominators are, skip to the dominators ui section.
... each entry displays: the retained size of the node, as bytes and as a percentage of the total the shallow size of the node, as bytes and as a percentage of the total the nodes's name and address in memory.
...you can also see that these objects have a relatively tiny "shallow size", so almost all of the retained size is in the objects that they dominate.
...And 3 more matches
Examine and edit HTML - Firefox Developer Tools
that allows you to find css selectors and xpath expressions occurring within the text.
...this allows you to search for specific elements without the conflict of matching words within the text.
...furthermore it allows for some more advanced searches like finding elements that start with a specific text, for example.
...And 3 more matches
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
the grid inspector allows you to examine css grid layouts using the firefox devtools, discovering grids present on a page, examining and modifying them, debugging layout issues, and more.
...you can find out more about those in the section below.
...the above and below screenshots should give you further hints on how to get to this.
...And 3 more matches
about:debugging - Firefox Developer Tools
note: if the version of firefox on your remote device is more than one major version older than the version running on your computer, you may see a message like the following: in firefox 76 and above, the message can look like the following: see connection for firefox for android 68 for more information.
...when you do, it is added to the network locations list along with the devices, as shown below: this firefox the this firefox tab combines the features of extensions, tabs, and workers into a single tab with the following sections: temporary extensions displays a list of the extensions that you have loaded using the load temporary add-on button.
... you can use the following buttons: inspect loads the extension in the debugger.
...And 3 more matches
AuthenticatorAssertionResponse.authenticatorData - Web APIs
syntax var authnrdata = authenticatorassertionresponse.authenticatordata; value an arraybuffer that has a arraybuffer.bytelength of at least 37 bytes, containing the following fields: rpidhash (32 bytes) - a sha256 hash of the relying party id that was seen by the browser.
...the bits are as follows, where "bit 0" is the least significant bit and all bits not specifically mentioned below are "reserved for future use": bit 0, user presence (up) - if set, authenticator validated that the user was present through some test of user presence (tup), such as touching a button on the authenticator.
... bit 6, attested credential data (at) - if set, attestedcredentialdata will immediately follow the first 37 bytes of this authenticatordata.
...And 3 more matches
Basic animations - Web APIs
in the examples below, we'll use the window.requestanimationframe() method to control the animation.
...the number of callbacks is usually 60 times per second and may be reduced to a lower rate when running in background tabs.
... img.src = 'https://mdn.mozillademos.org/files/4553/capitan_meadows,_yosemite_national_park.jpg'; var canvasxsize = 800; var canvasysize = 200; var speed = 30; // lower is faster var scale = 1.05; var y = -4.5; // vertical offset // main program var dx = 0.75; var imgw; var imgh; var x = 0; var clearx; var cleary; var ctx; img.onload = function() { imgw = img.width * scale; imgh = img.height * scale; if (imgw > canvasxsize) { // image larger than canvas x = canvasxsize - imgw; } if (imgw > canvasxsize) { // image...
...And 3 more matches
console - Web APIs
WebAPIConsole
note: the actual console interface is defined as all lower case (i.e.
... console.group() creates a new inline group, indenting all following output by another level.
... console.groupcollapsed() creates a new inline group, indenting all following output by another level.
...And 3 more matches
Document.cookie - Web APIs
WebAPIDocumentcookie
consider also that: any of the following cookie attribute values can optionally follow the key-value pair, specifying the cookie to set/update, and preceded by a semi-colon separator: ;path=path (e.g., '/', '/mydir') if not specified, defaults to the current path of the current document location.
... the strict value will prevent the cookie from being sent by the browser to the target site in all cross-site browsing contexts, even when following a regular link.
... the cookie value string can use encodeuricomponent() to ensure that the string does not contain any commas, semicolons, or whitespace (which are disallowed in cookie values).
...And 3 more matches
Document.requestStorageAccess() - Web APIs
if the sub frame doesn't have the token allow-storage-access-by-user-activation, reject.
...examples: allow lists, block lists, on-device classification, user settings, anti-clickjacking heuristics, or prompting the user for explicit permission.
...after the requesting origin has exceeded the maximum allowable number of storage access grants, any future call to requeststorageaccess() during the same browsing session will prompt the user.
...And 3 more matches
FileError - Web APIs
WebAPIFileError
so the following are a few tips that could help you avoid some pitfalls.
... don't run your app from file:// for security reasons, browsers do not allow you to run your app from file://.
...just start chrome with the --allow-file-access-from-files flag.
...And 3 more matches
Using the Frame Timing API - Web APIs
frame observers the performance observer interfaces allow an application to register an observer for specific performance event types.
...in the following example, two observers for the "frame" performance entry type are created and the first observer constructor uses inline function syntax.
...in the following example, the observer only registers for "frame" performance entry notifications.
...And 3 more matches
HTMLTextAreaElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 1...
...if no text is selected, contains the index of the character that follows the input cursor.
...if no text is selected, contains the index of the character that follows the input cursor.
...And 3 more matches
In depth: Microtasks and the JavaScript runtime environment - Web APIs
it was designed in an era in which this was a positive choice; there were few multi-processor computers available to the general public, and the expected amount of code that would be handled by javascript was relatively low at that time.
...to support this, it was necessary to find ways to allow for projects to escape the limitations of a single-threaded language.
...consider the javascript program below: let outputelem = document.getelementbyid("output"); let userlanguages = { "mike": "en", "teresa": "es" }; function greetuser(user) { function localgreeting(user) { let greeting; let language = userlanguages[user]; switch(language) { case "es": greeting = `¡hola, ${user}!`; break; case "en": default: greeting = `hello, ${user}!`; ...
...And 3 more matches
Recommended Drag Types - Web APIs
it holds the urls of links followed by their titles, separated by a linebreak.
... the following example shows how to create an area for receiving dropped files: <listbox ondragenter="return checkdrag(event)" ondragover="return checkdrag(event)" ondrop="dodrop(event)"/> <script> function checkdrag(event) { return event.datatransfer.types.contains("application/x-moz-file"); } function dodrop(event) { var file = event.datatransfer.mozgetdataat("application/x-moz-fil...
... as a result, the contains method no longer works; the includes method should be used instead to check if a specific type of data is provided, using code like the following: if ([...event.datatransfer.types].includes('text/html')) { // do something } you could use feature detection to determine which method is supported on types, then run code as appropriate.
...And 3 more matches
IDBDatabase.transaction() - Web APIs
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.
...to avoid slowing things down, don't open a readwrite transaction unless you actually need to write into the database.
... if you need to open the object store in readwrite mode to change data, you would use the following: var transaction = db.transaction('my-store-name', "readwrite"); as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other indexeddb-supporting browsers.
...And 3 more matches
IDBIndexSync - Web APIs
any add( in any value, in optional any key ) raises (idbdatabaseexception); parameters returns exceptions this method can raise a idbdatabaseexception with the following code: value the value to store into the index.
... exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if no record exists in this index for the given key.
... exceptions this method can raise a idbdatabaseexception with the following code: not_found_err if no record exists in this index for the given key.
...And 3 more matches
IDBObjectStore.createIndex() - Web APIs
bear in mind that indexeddb indexes can contain any javascript data type; indexeddb uses the structured clone algorithm to serialize stored objects, which allows for storage of simple and complex objects.
... objectparameters optional an idbindexparameters object, which can include the following properties: attribute description unique if true, the index will not allow duplicate values for a single key.
... locale currently firefox-only (43+), this allows you to specify a locale for the index.
...And 3 more matches
IDBTransaction.mode - Web APIs
syntax var mycurrentmode = idbtransaction.mode; value an idbtransactionmode object defining the mode for isolating access to data in the current object stores: value explanation readonly allows data to be read but not changed.
... readwrite allows reading and writing of data in existing data stores to be changed.
... versionchange allows any operation to be performed, including ones that delete and create object stores and indexes.
...And 3 more matches
IndexedDB API - Web APIs
indexeddb is a low-level api for client-side storage of significant amounts of structured data, including files/blobs.
... note: like most web storage solutions, indexeddb follows a same-origin policy.
... idbobjectstore represents an object store that allows access to a set of data in an indexeddb database, looked up via primary key.
...And 3 more matches
install - Web APIs
method of installtrigger object syntax int install(array xpilist [, function callbackfunc ] ) parameters the install method has the following parameters: xpilist an array of files to be installed (see example below).
... callbackfunc an optional callback function invoked when the installation is complete (see example below).
...to surface detail about the status of the installation, use the optional callback function and its status parameter, as in the example below.
...And 3 more matches
MediaStreamAudioSourceNode - Web APIs
properties in addition to the following properties, mediastreamaudiosourcenode inherits the properties of its parent, audionode.
... if you do chooose to use mediastreamaudiosourcenode, you should keep the following in mind.
...next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode.
...And 3 more matches
Media Session API - Web APIs
it does this by providing metadata for display by the user agent of the media your web app is playing, and allows you to create event handlers, to define your own behaviors for a user-agent playback controls.
... the aim of this is allowing users to know what's playing, and to control it, without opening the specific page that launched it.
...for example, to set the current state of the media session to playing: navigator.mediasession.playbackstate = "playing"; interfaces mediametadata allows a web page to provide rich media metadata, for display in a platform ui.
...And 3 more matches
Transcoding assets for Media Source Extensions - Web APIs
below we'll cover all of these steps, but first let's look at a toolchain we can use to do this fairly easily.
... sample media if you're looking to follow the steps listed here, but don't have any media to experiment with, you can grab the trailer to big buck bunny [0] here.
... [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.
...And 3 more matches
Navigator.registerProtocolHandler() - Web APIs
this will be displayed to the user, such as prompting “allow this site to handle [scheme] links?” or listing registered handlers in the browser’s settings.
... a custom scheme may be registered as long as: the custom scheme's name begins with web+ the custom scheme's name includes at least 1 letter after the web+ prefix the custom scheme has only lowercase ascii letters in its name.
... for example, web+burger, as shown in the example below.
...And 3 more matches
PaymentRequest.PaymentRequest() - Web APIs
each item in the array contains the following fields: supportedmethods for early implementations of the spec, this was a sequence of identifiers for payment methods that the merchant website accepts.
...this parameter contains the following fields: total the total amount of the payment request.
...this parameter contains the following fields: additionaldisplayitems an array of items to be appended to the details.displayitems property.
...And 3 more matches
Using Performance Timeline - Web APIs
the standard also includes interfaces that allow an application to be notified when specific performance events occur.
...the following example show the usage of these methods getentries(), getentriesbyname() and getentriesbytype().
...the following example shows the use of these properties.
...And 3 more matches
Using Pointer Events - Web APIs
example the text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location.
...</canvas> <br> <button onclick="startup()">initialize</button> <br> log: <pre id="log" style="border: 1px solid #ccc;"></pre> setting up the event handlers when the page loads, the startup() function shown below should be called by our <body> element's onload attribute (but in the example we use a button to trigger it, due to limitations of the mdn live example system).
... var ongoingtouches = new array(); when a pointerdown event occurs, indicating that a new touch on the surface has occurred, the handlestart() function below is called.
...And 3 more matches
Push API - Web APIs
WebAPIPush API
see the following articles for more information: cross-site request forgery (csrf) prevention cheat sheet preventing csrf and xsrf attacks for an app to receive push messages, it has to have an active service worker.
...this allows apps to react to push messages being received, for example, by displaying a notification (using serviceworkerregistration.shownotification().) each subscription is unique to a service worker.
...firefox allows a limited number (quota) of push messages to be sent to an application, although push messages that generate notifications are exempt from this limit.
...And 3 more matches
RTCPeerConnection - Web APIs
<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...
...browser versions have implemented it.removetrack()the rtcpeerconnection.removetrack() method tells the local end of the connection to stop sending media from the specified track, without actually removing the corresponding rtcrtpsender from the list of senders as reported by rtcpeerconnection.getsenders().restartice()the webrtc api's rtcpeerconnection interface offers the restartice() method to allow a web application to easily request that ice candidate gathering be redone on both ends of the connection.setconfiguration() the rtcpeerconnection.setconfiguration() method sets the current configuration of the rtcpeerconnection based on the values included in the specified rtcconfiguration object.
... obsolete method the following method was obsoleted long ago and was never implemented in all major browsers.
...And 3 more matches
Request() - Web APIs
WebAPIRequestRequest
note the following behavioural updates to retain security while making the constructor less likely to throw exceptions: if this object exists on another origin to the constructor call, the request.referrer is stripped out.
... redirect: the redirect mode to use: follow, error, or manual.
... the default is follow.
...And 3 more matches
SVGTransform - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
...And 3 more matches
Using server-sent events - Web APIs
when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6).
...this limit is per browser + domain, which means that you can open 6 sse connections across all of the tabs to www.example1.com and another 6 sse connections to www.example2.com (per stackoverflow).
... 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.
...And 3 more matches
Storage Access API - Web APIs
the api provides methods that allow embedded resources to check whether they currently have access to their first-party storage, and to request access to their first-party storage from the user agent.
...the api therefore also adds the allow-storage-access-by-user-activation sandbox token.
... the embedding website needs to add this to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin"> ...
...And 3 more matches
TextRange - Web APIs
WebAPITextRange
this property should only be used as one of the solutions when you need to be compatible with lower versions of ie, rather than relying on it completely in cross browser scripts.
...it can be used as an alternative to element.scrollintoview in the lower version of ie.
... example the following example is valid under ie9.
...And 3 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.
...the method takes one argument, the name of the mark, as shown in the following example.
...the following examples shows how to use each of these methods (performance.getentries(), performance.getentriesbytype(entrytype), and performance.getentriesbyname(name, entrytype) ) to retrieve one or more marks.
...And 3 more matches
Fundamentals of WebXR - Web APIs
as browser developers built support for webvr and allowed developers to experiment, it became clear that in order to finish an api for virtual environments on the web, it would make more sense to start a new specification than to try to "fix" webvr.
... devices which use transparent glasses to allow the user to see the world, while overlaying the rendered image atop the scene.
... simpler and lower-priced xr devices typically use an integrated computer or connect to a smartphone, essentially using the mobile cpu and gpu to run apps, render images, and display them to the user.
...And 3 more matches
Using the Web Animations API - Web APIs
we can achieve this via the following function: var growalice = function() { // play alice's animation.
... nommingcake.play(); } when a user holds their mouse down or presses their finger on the cake on a touch screen, we can now call growalice to make all the animations play: cake.addeventlistener("mousedown", growalice, false); cake.addeventlistener("touchstart", growalice, false); other useful methods in addition to pausing and playing, we can use the following animation methods: animation.finish() skips to the end of the animation.
...in the red queen’s race example, alice and the red queen are running to stay in place (check out the full code on codepen): because small children tire out easily, unlike automaton chess pieces, alice is constantly slowing down.
...And 3 more matches
Example and tutorial: Simple synth keyboard - Web APIs
the keyboard allows you to switch among the standard waveforms as well as one custom waveform, and you can control the master gain using a volume slider beneath the keyboard.
... this example makes use of the following web api interfaces: audiocontext, oscillatornode, periodicwave, and gainnode.
...the range element will typically be presented as a slider control; we configure it to allow any value between 0.0 and 1.0, stepping by 0.01 each position.
...And 3 more matches
Privileged features - Web APIs
the following features require the chrome-privilege.
... alwayslowered if on, the new created window floats below, under its own parent when the parent window is not minimized.
... alwayslowered windows are often referred as pop-under windows.
...And 3 more matches
Using the aria-labelledby attribute - Accessibility
the examples section below provides more information on how to use the attribute this way.
... examples example 1: multiple labels in the example below, each input field is labelled by both its own individual label and by the label for the group: <div id="mybillingid">billing</div> <div> <div id="mynameid">name</div> <input type="text" aria-labelledby="mybillingid mynameid"/> </div> <div> <div id="myaddressid">address</div> <input type="text" aria-labelledby="mybillingid myaddressid"/> </div> example 2: associating headings w...
...ith regions in the example below, header elements are associated with the content they head.
...And 3 more matches
Accessibility: What users can do to browse more safely - Accessibility
personalization and accessibility settings from the article, "understanding success criterion 2.3.1: three flashes or below threshold" "flashing can be caused by the display, the computer rendering the image or by the content being rendered.
...one work station can be set up to acommodate both a low-vision individual (needs high-contrast) and to accomodate an individual with photosensitive susceptibilities, by simply, adjusting personalization and accessiblity settings.
...the user would access this through an accessibility interface, as seen below.
...And 3 more matches
Color contrast - Accessibility
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 site benefits all your users, but it is particularly beneficial to users with certain types of color blindness and other similar conditions, who experience low contrast, and have trouble differentiating between similar colors.
...And 3 more matches
Perceivable - Accessibility
understanding orientation 1.3.5 identify input purpose (aa) added in 2.1 follow the list of 53 input fields to programmatically identify the purpose of a field.
... 1.4.6 enhanced contrast (aaa) this follows, and builds on, criterion 1.4.3.
... 1.4.7 low or no background audio (aaa) prerecorded audio recordings that primarily feature speech should have minimal background noise, so the content can be easily understood.
...And 3 more matches
Understandable - Accessibility
3.1.5 reading level (aaa) if text is provided that requires a higher reading level that lower secondary education level (typically children around 11-14 years old), provide supplementary explainer material to help people who can't read it, or provide an alternative version that is written at lower secondary level.
...it is better to just write all content at lower secondary level, even technical documentation like programming tutorials, unless there is a good reason not to (e.g.
... the html5 <audio> element 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.
...And 3 more matches
font-stretch - CSS: Cascading Style Sheets
the font-stretch css descriptor allows authors to specify a normal, condensed, or expanded face for the fonts specified in the @font-face rule.
...ondensed; font-stretch: semi-condensed; font-stretch: normal; font-stretch: semi-expanded; font-stretch: expanded; font-stretch: extra-expanded; font-stretch: ultra-expanded; font-stretch: 50%; font-stretch: 100%; font-stretch: 200%; /* multiple values */ font-stretch: 75% 125%; font-stretch: condensed ultra-condensed;; the font-weight property is described using any one of the values listed below.
...negative values are not allowed for this property.
...And 3 more matches
@font-feature-values - CSS: Cascading Style Sheets
a swash feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't.
...an annotation feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't.
...an ornaments feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't.
...And 3 more matches
@media - CSS: Cascading Style Sheets
WebCSS@media
name summary notes any-hover does any available input mechanism allow the user to hover over elements?
... height height of the viewport hover does the primary input mechanism allow the user to hover over elements?
... 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?
...And 3 more matches
Coordinate systems - CSS: Cascading Style Sheets
the y-coordinate specifies the vertical offset, with a negative value being above the origin and a positive value being below the origin.
... on the web, the default origin is the top-left corner of a given context (with positive y-coordinate values being below the origin).
... standard cssom coordinate systems there are four standard coordinate systems used by the css object model, as described below.
...And 3 more matches
Border-image generator - CSS: Cascading Style Sheets
roup:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .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-sizin...
...g: 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; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; 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; cu...
.../ .ui-dropdown-select { height: inherit; padding: 0 0.75em; color: #fff; line-height: 2em; } /* dropdown list */ .ui-dropdown-list { width: 100%; height: 150px; max-height: 150px; margin: 0; padding: 0 0.3em; border: 3px solid #3490d2; border-color: #208b20; background: #666; background-color: #eef1f5; color: #000; position: absolute; top: 2em; left: 0; z-index: 100; overflow: hidden; transition: all 0.3s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-dropdown-list:hover { overflow: auto; } .ui-dropdown-list[data-hidden='true'] { height: 0 !important; opacity: 0; visibility: hidden; } .ui-dropdown[data-position='left'] .ui-dropdown-list { left: -100%; top: 0; } .ui-dropdown[data-position='right'] .ui-dropdown...
...And 3 more matches
Spanning and Balancing Columns - CSS: Cascading Style Sheets
in the example below, the h2 element is set to column-span: all and spans all of the columns.
... when a spanner is introduced, it breaks the flow of columns and columns restart after the spanner, effectively creating a new set of column boxes.
... limitations of column-span in the current level 1 specification there are only two allowable values for column-span.
...And 3 more matches
Using feature queries - CSS: Cascading Style Sheets
a feature query consists of the @supports rule, followed by the property name and value you would like to test for.
... you may not test for a bare property name such as display; the rule requires a property name and a value: @supports (property: value) { css rules to apply } if you want to check if a browser supports the row-gap property, for example, you would write the following feature query.
... testing for lack of support in addition to asking the browser if it supports a feature, you can test for the opposite by adding in the not keyword: @supports not (property: value) { css rules to apply } the css inside the following example feature query will run if the browser does not support row-gap.
...And 3 more matches
CSS Containment - CSS: Cascading Style Sheets
the aim of the css containment specification is to improve performance of web pages by allowing developers to isolate a subtree of the page from the rest of the page.
...for example a listing of article headlines and content, as in the mark-up below.
...nothing can visibly overflow.
...And 3 more matches
The stacking context - CSS: Cascading Style Sheets
a stacking context is formed, anywhere in the document, by any element in the following scenarios: root element of the document (<html>).
... element with any of the following properties with value other than none: transform filter perspective clip-path mask / mask-image / mask-border element with a isolation value isolate.
... element with a -webkit-overflow-scrolling value touch.
...And 3 more matches
Syntax - CSS: Cascading Style Sheets
WebCSSSyntax
the basic goal of the cascading stylesheet (css) language is to allow a browser engine to paint elements of the page with specific features, like colors, positioning, or decorations.
...not all pairs of properties and values are allowed and each property defines what are the valid values.
... a css declaration block is visualized in the diagram below.
...And 3 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
custom properties allow a value to be stored in one place, then referenced in multiple other places.
... 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"> <textarea class="four">lorem ipsum</textarea> </div> this leads to the same result as the previous example, yet allows for one canonical declaration of the desired property value; very useful if you want to change the value across the entire page later.
...with the following css: .two { --test: 10px; } .three { --test: 2em; } in this case, the results of var(--test) are: for the class="two" element: 10px for the class="three" element: 2em for the class="four" element: 10px (inherited from its parent) for the class="one" element: invalid value, which is the default value of any custom property keep in mind that these are custom properties, not actual variables like you might find in other programming languages.
...And 3 more matches
align-content - CSS: Cascading Style Sheets
the interactive example below use grid layout to demonstrate some of the values of this property.
... items have a half-size space on either end */ align-content: space-evenly; /* distribute items evenly items have equal space around them */ align-content: stretch; /* distribute items evenly stretch 'auto'-sized items to fit the container */ /* overflow alignment */ align-content: safe center; align-content: unsafe center; /* global values */ align-content: inherit; align-content: initial; align-content: unset; values start the items are packed flush to each other against the start edge of the alignment container in the cross axis.
...if the chosen keyword means that the item overflows the alignment container causing data loss, the item is instead aligned as if the alignment mode were start.
...And 3 more matches
box-lines - CSS: Cascading Style Sheets
WebCSSbox-lines
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.
...if a line contains only a single element that doesn't fit, then the element should stay on that line and overflow out of the box.
...And 3 more matches
break-after - CSS: Cascading Style Sheets
to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
... if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value).
... syntax the break-after property is specified as one of the keyword values from the list below.
...And 3 more matches
break-before - CSS: Cascading Style Sheets
to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
... if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value).
... syntax the break-before property is specified as one of the keyword values from the list below.
...And 3 more matches
color-adjust - CSS: Cascading Style Sheets
by default, the browser is allowed to make any adjustments to the element's appearance it determines to be necessary and prudent given the type and capabilities of the output device.
... syntax color-adjust: economy; color-adjust: exact; the color-adjust property's value must be one of the following keywords.
... values economy the user agent is allowed to make adjustments to the element as it deems appropriate and prudent in order to optimize the output for the device it's being rendered for.
...And 3 more matches
<custom-ident> - CSS: Cascading Style Sheets
it consists of one or more characters, where characters can be any of the following: any alphabetical character (a to z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its unicode code point) note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive.
...moreover, the first character must not be a decimal digit, nor a hyphen (-) followed by a decimal digit or another hyphen.
...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, gurmukhi, hebrew, hiragana, hiragana-iroha, japanese-formal, japanese-informal, kannada, katakana, katakana-iroha, khmer, korean-hangul-formal, korean-hanja-forma...
...And 3 more matches
flex - CSS: Cascading Style Sheets
WebCSSflex
constituent properties this property is a shorthand for the following css properties: flex-grow flex-shrink flex-basis syntax /* keyword values */ flex: auto; flex: initial; flex: none; /* one value, unitless number: flex-grow */ flex: 2; /* one value, width/height: flex-basis */ flex: 10em; flex: 30%; flex: min-content; /* two values: flex-grow | flex-basis */ flex: 1 30px; /* two values: flex-grow | flex-shrink */ flex: 2 2; /* three values: flex-...
... three-value syntax: the values must be in the following order: a <number> for <flex-grow>.
... description for most purposes, authors should set flex to one of the following values: auto, initial, none, or a positive unitless number.
...And 3 more matches
font-size-adjust - CSS: Cascading Style Sheets
the font-size-adjust css property sets the size of lower-case letters relative to the current font size (which defines the size of upper-case letters).
... /* use the specified font size */ font-size-adjust: none; /* use a font size that makes lowercase letters half the specified font size */ font-size-adjust: 0.5; /* global values */ font-size-adjust: inherit; font-size-adjust: initial; font-size-adjust: unset; the property is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters.
... legibility can become an issue when the first-choice font-family is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font).
...And 3 more matches
font-variant-caps - CSS: Cascading Style Sheets
s: normal; font-variant-caps: small-caps; font-variant-caps: all-small-caps; font-variant-caps: petite-caps; font-variant-caps: all-petite-caps; font-variant-caps: unicase; font-variant-caps: titling-caps; /* global values */ font-variant-caps: inherit; font-variant-caps: initial; font-variant-caps: unset; the font-variant-caps property is specified using a single keyword value from the list below.
...small-caps glyphs typically use the form of uppercase letters but are reduced to the size of lowercase letters.
... all-small-caps enables display of small capitals for both upper and lowercase letters (opentype features: c2sc, smcp).
...And 3 more matches
justify-content - CSS: Cascading Style Sheets
the interactive example below demonstrates some of the values using grid layout.
...ems have a half-size space on either end */ justify-content: space-evenly; /* distribute items evenly items have equal space around them */ justify-content: stretch; /* distribute items evenly stretch 'auto'-sized items to fit the container */ /* overflow alignment */ justify-content: safe center; justify-content: unsafe center; /* global values */ justify-content: inherit; justify-content: initial; justify-content: unset; values start the items are packed flush to each other toward the start edge of the alignment container in the main axis.
...if the chosen keyword means that the item overflows the alignment container causing data loss, the item is instead aligned as if the alignment mode were start.
...And 3 more matches
list-style-type - CSS: Cascading Style Sheets
disc a filled circle (default value) circle a hollow circle square a filled square decimal decimal numbers beginning with 1 cjk-decimal han decimal numbers e.g.
...01, 02, 03, … 98, 99 lower-roman lowercase roman numerals e.g.
...i, ii, iii, iv, v… lower-greek lowercase classical greek alpha, beta, gamma… e.g.
...And 3 more matches
overscroll-behavior-block - CSS: Cascading Style Sheets
/* keyword values */ overscroll-behavior-block: auto; /* default */ overscroll-behavior-block: contain; overscroll-behavior-block: none; /* global values */ overscroll-behavior-block: inherit; overscroll-behavior-block: initial; overscroll-behavior-block: unset; syntax the overscroll-behavior-block 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.
...And 3 more matches
overscroll-behavior-inline - CSS: Cascading Style Sheets
/* keyword values */ overscroll-behavior-inline: auto; /* default */ overscroll-behavior-inline: contain; overscroll-behavior-inline: none; /* global values */ overscroll-behavior-inline: inherit; overscroll-behavior-inline: initial; overscroll-behavior-inline: unset; syntax the overscroll-behavior-inline 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.
...And 3 more matches
shape-outside - CSS: Cascading Style Sheets
7,0,0.3 a0.25,0.25,1,1,1,0.5,0.3 a0.25,0.25,1,1,1,1,0.3 c1,0.7,0.5,1,0.5,1 z'); /* <url> value */ shape-outside: url(image.png); /* <gradient> value */ shape-outside: linear-gradient(45deg, rgba(255, 255, 255, 0) 150px, red 150px); /* global values */ shape-outside: initial; shape-outside: inherit; shape-outside: unset; the shape-outside property is specified using the values from the list below, which define the float area for float elements.
...the shape follows the normal border radius shaping rules for the outside of the border.
...the shape follows the normal border radius shaping rules for the inside of the border.
...And 3 more matches
vertical-align - CSS: Cascading Style Sheets
cal-align: text-top; vertical-align: text-bottom; vertical-align: middle; vertical-align: top; vertical-align: bottom; /* <length> values */ vertical-align: 10em; vertical-align: 4px; /* <percentage> values */ vertical-align: 20%; /* global values */ vertical-align: inherit; vertical-align: initial; vertical-align: unset; the vertical-align property is specified as one of the values listed below.
...a negative value is allowed.
...a negative value is allowed.
...And 3 more matches
Rich-Text Editing in Mozilla - Developer guides
starting in firefox 3, mozilla also supports internet explorer's contenteditable attribute which allows any element to become editable or non-editable (the latter for when preventing change to fixed elements in an editable environment).
... similarly, setting contenteditable to "true" allows you to make individual elements of a document editable.
... executing commands when an html document has been switched to designmode, the document object exposes the document.execcommand method which allows one to run commands to manipulate the contents of the editable region.
...And 3 more matches
Index - Developer guides
WebGuideIndex
this follow-up article looks at how to style this custom player, including making it responsive.
... 14 web audio playbackrate explained apps, audio, media, video, playbackrate the playbackrate property of the <audio> and <video> elements allows us to change the speed, or rate, at which a piece of web audio or video is playing 15 writing web audio api code that works in every browser api you probably have already read the announcement on the web audio api coming to firefox, and are totally excited and ready to make your until-now-webkit-only sites work with firefox, which uses the unprefixed version of the spec.
...web applications that want to heavily modify the content or user flow for mobile users should probably go for a separate mobile site.
...And 3 more matches
<caption>: The Table Caption element - HTML: Hypertext Markup Language
WebHTMLElementcaption
permitted content flow content.
... tag omission the end tag can be omitted if the element is not immediately followed by ascii whitespace or a comment.
... deprecated attributes the following attributes are deprecated and should not be used.
...And 3 more matches
<hgroup> - HTML: Hypertext Markup Language
WebHTMLElementhgroup
content categories flow content, heading content, palpable content.
... permitted parents any element that accepts flow content.
... 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.
...And 3 more matches
<input type="color"> - HTML: Hypertext Markup Language
WebHTMLElementinputcolor
only simple colors (without alpha channel) are allowed though css colors has more formats, e.g.
... value a 7-character domstring specifying a <color> in lower-case hexadecimal notation events change and input supported common attributes autocomplete and list idl attributes list and value methods select() value the value of an <input> element of type color is always a domstring which contains a 7-character string specifying an rgb color in hexadecimal format.
... while you can input the color in either upper- or lower-case, it will be stored in lower-case form.
...And 3 more matches
<input type="image"> - HTML: Hypertext Markup Language
WebHTMLElementinputimage
additional attributes in addition to the attributes shared by all <input> elements, image button inputs support the following attributes: attribute description alt alternate string to display when the image can't be shown formaction the url to which to submit the data formenctype the encoding method to use when submitting the form data formmethod the http method to use when submitting the form formnovalidate a boolean which, if present, indi...
... multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server.
... obsolete attributes the following attribute was defined by html 4 for image inputs, but was not implemented by all browsers and has since been deprecated: attribute description usemap the name of an image map (<map>) element to use with the image; this is obsolete.
...And 3 more matches
<input type="radio"> - HTML: Hypertext Markup Language
WebHTMLElementinputradio
they are called radio buttons because they look and operate in a similar manner to the push buttons on old-fashioned radios, such as the one shown below.
...where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected.
... it's fairly uncommon to actually want to allow the form to be submitted without any of the radio buttons in a group selected, so it is usually wise to have one default to the checked state.
...And 3 more matches
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
WebHTMLElementmeta
if the itemprop attribute is present: flow content, phrasing content.
... implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlmetaelement the type of metadata provided by the meta element can be one of the following: if the name attribute is set, the meta element provides document-level metadata, applying to the whole page.
...the attribute is named http-equiv(alent) because all the allowed values are names of particular http headers: content-security-policy allows page authors to define a content policy for the current page.
...And 3 more matches
<script>: The Script element - HTML: Hypertext Markup Language
WebHTMLElementscript
content categories metadata content, flow content, phrasing content.
... this attribute allows the elimination of parser-blocking javascript where the browser would have to load and evaluate scripts before continuing to parse.
...to allow error logging for sites which use a separate domain for static media, use this attribute.
...And 3 more matches
<table>: The Table element - HTML: Hypertext Markup Language
WebHTMLElementtable
content categories flow content permitted content in this order: an optional <caption> element, zero or more <colgroup> elements, an optional <thead> element, either one of the following: zero or more <tbody> elements one or more <tr> elements an optional <tfoot> element tag omission none, both the starti...
... permitted parents any element that accepts flow content implicit aria role table permitted aria roles any dom interface htmltableelement attributes this element includes the global attributes.
...it may have the following values: left: the table is displayed on the left side of the document; center: the table is displayed in the center of the document; right: the table is displayed on the right side of the document.
...And 3 more matches
HTML: Hypertext Markup Language
WebHTML
that is, it can be written in uppercase, lowercase, or a mixture.
... the articles below can help you learn more about html.
... advanced topics cors enabled image the crossorigin attribute, in combination with an appropriate cors header, allows images defined by the <img> element to be loaded from foreign origins and used in a <canvas> element as if they were being loaded from the current origin.
...And 3 more matches
Browser detection using the user agent - HTTP
an example of feature detection is as follows.
...although it is off-topic, perhaps the following detailed example might give you insights and ideas that persuade you to forgo user agent sniffing.
...the first method uses horizontal flexboxes to group the content such that when the page is displayed to the end user, all the dogs boxes are at the top of the page and all the cat boxes are lower on the page.
...And 3 more matches
HTTP conditional requests - HTTP
both last-modified and etag allow both types of validation, though the complexity to implement it on the server side may vary.
... integrity of a partial download partial downloading of files is a functionality of http that allows to resume previous operations, saving bandwidth and time, by keeping the already obtained information: a server supporting partial downloads broadcasts this by sending the accept-ranges header.
...this is very common in any file system or source control applications, but any application that allows to store remote resources needs such a mechanism.
...And 3 more matches
Using HTTP cookies - HTTP
WebHTTPCookies
for details about the header attributes mentioned below, refer to the set-cookie reference article.
... domain attribute the domain attribute specifies which hosts are allowed to receive the cookie.
...with strict, the cookie is sent only to the same site as the one that originated it; lax is similar, with an exception for when the user navigates to a url from an external site, such as by following a link; none has no restrictions on cross-site requests.
...And 3 more matches
SameSite cookies - HTTP
the samesite attribute of the set-cookie http response header allows you to declare if your cookie should be restricted to a first-party or same-site context.
... values the samesite attribute accepts three values: lax cookies are allowed to be sent with top-level navigations and will be sent along with get request initiated by third party website.
... none cookies will be sent in all contexts, i.e sending cross-origin is allowed.
...And 3 more matches
Set-Cookie - HTTP
it also must not contain a separator character like the following: ( ) < > @ , ; : \ " / [ ] ?
...it does help satisfying the requirements about which characters are allowed for <cookie-value> though.
... multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included.
...And 3 more matches
Link prefetching FAQ - HTTP
an example using the link tag follows: <link rel="prefetch" href="/images/big.jpeg"> the same prefetching hint using an http link: header: link: </images/big.jpeg>; rel=prefetch the format for the link: header is described in rfc 5988 section 5.
... some more examples follow: <link rel="prefetch alternate stylesheet" title="designed for mozilla" href="mozspecific.css"> <link rel="next" href="2.html"> are anchor (<a>) tags prefetched?
...in fact, the html 4.01 specification explicitly allows for the definition of new link relation types (see section 6.12: link types).
...And 3 more matches
HTTP Messages - HTTP
WebHTTPMessages
it can be an absolute path, ultimately followed by a '?' and query string.
... headers http headers from a request follow the same basic structure of an http header: a case-insensitive string followed by a colon (':') and a value whose structure depends upon the header.
... http responses status line the start line of an http response, called the status line, contains the following information: the protocol version, usually http/1.1.
...And 3 more matches
JavaScript data types and data structures - JavaScript
number type ecmascript has two built-in numeric types: number and bigint (see below).
... symbol type a symbol is a unique and immutable primitive value and may be used as the key of an object property (see below).
... data property associates a key with a value, and has the following attributes: attributes of a data property attribute type description default value [[value]] any javascript type the value retrieved by a get access of the property.
...And 3 more matches
Deprecated and obsolete features - JavaScript
regexp properties the following properties are deprecated.
... rightcontext the substring following the most recent match.
... the following are now properties of regexp instances, no longer of the regexp object: property description global whether or not to test the regular expression against all possible matches in a string, or only against the first.
...And 3 more matches
Arrow function expressions - JavaScript
shorter functions var elements = [ 'hydrogen', 'helium', 'lithium', 'beryllium' ]; // this statement returns the array: [8, 6, 7, 9] elements.map(function(element) { return element.length; }); // the regular function above can be written as the arrow function below elements.map((element) => { return element.length; }); // [8, 6, 7, 9] // when there is only one parameter, we can remove the surrounding parentheses elements.map(element => { return element.length; }); // [8, 6, 7, 9] // when the only statement in an arrow function is `return`, we can remove `return` and remove // the surrounding curly brackets elements.map(element => element.length); // [...
...e can use destructuring parameter: // notice that the `length` corresponds to the property we want to get whereas the // obviously non-special `lengthfoobarx` is just the name of a variable which can be changed // to any valid variable name you want elements.map(({ length: lengthfoobarx }) => lengthfoobarx); // [8, 6, 7, 9] // this destructuring parameter assignment can also be written as seen below.
...the this value of the enclosing lexical scope is used; arrow functions follow the normal variable lookup rules.
...And 3 more matches
Array - JavaScript
console.log(vegetables) // ["cabbage", "carrot"] (the original array is changed) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arrays are zero-indexed.
...nevertheless, trying to access an element of an array as follows throws a syntax error because the property name is not valid: console.log(arr.0) // a syntax error there is nothing special about javascript arrays and the properties that cause this.
...as a result, '2' and '02' would refer to two different slots on the years object, and the following example could be true: console.log(years['2'] != years['02']) relationship between length and numerical properties a javascript array's length property and numerical properties are connected.
...And 3 more matches
Intl - JavaScript
however, it's conventional to use title case (first letter capitalized, successive letters lower case) for script code, upper case for region codes, and lower case for everything else.
... bcp 47 also allows for extensions, each consisting of a single digit or letter (other than "x") and one or more two- to eight-letter or digit tags, all separated by hyphens.
... finally, an extension using the letter "x" may appear, followed by one or one- to eight-letter or digit tags.
...And 3 more matches
JSON - JavaScript
a decimal point must be followed by at least one digit.
...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) // throws a syntaxerror in old engines other differences include allowing only double-quoted strings and having no provisions for undefined or comments.
...And 3 more matches
Promise.prototype.then() - JavaScript
the behavior of the handler function follows a specific set of rules.
... following, an example to demonstrate the asynchronicity of the then method.
...}); chaining the then method returns a promise which allows for method chaining.
...And 3 more matches
String.prototype.charAt() - JavaScript
examples displaying characters at different locations in a string the following example displays characters at different locations in the string "brave new world": var anystring = 'brave new world'; console.log("the character at index 0 is '" + anystring.charat() + "'"); // no index was provided, used 0 as default console.log("the character at index 0 is '" + anystring.charat(0) + "'"); 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 character, even if the string contains characters that are not in the basic multi-lin...
... var code = str.charcodeat(i); if (number.isnan(code)) { return ''; // position not found } if (code < 0xd800 || code > 0xdfff) { return str.charat(i); } // high surrogate (could change last hex to 0xdb7f to treat high private // surrogates as single characters) if (0xd800 <= code && code <= 0xdbff) { if (str.length <= (i + 1)) { throw 'high surrogate without following low surrogate'; } var next = str.charcodeat(i + 1); if (0xdc00 > next || next > 0xdfff) { throw 'high surrogate without following low surrogate'; } return str.charat(i) + str.charat(i + 1); } // low surrogate (0xdc00 <= code && code <= 0xdfff) if (i === 0) { throw 'low surrogate without preceding high surrogate'; } var prev = str.charcodeat(i - 1...
...And 3 more matches
String.prototype.charCodeAt() - JavaScript
this is because the higher code points are represented by a pair of (lower valued) "surrogate" pseudo-characters which are used to comprise the real character.
...see examples 2 and 3 (below).
... examples using charcodeat() the following example returns 65, the unicode value for a.
...And 3 more matches
String.prototype.indexOf() - JavaScript
for fromindex values lower than 0, or greater than str.length, the search starts at index 0 and str.length, respectively.
...with no fromindex value, or any fromindex value lower than the string's length, the returned value is the same as the fromindex value: 'hello world'.indexof('') // returns 0 'hello world'.indexof('', 0) // returns 0 'hello world'.indexof('', 3) // returns 3 'hello world'.indexof('', 8) // returns 8 however, with any fromindex value equal to or greater than the string's length, the returned value is the string's length: 'hello world'.indexof('',...
...for example, the following expression returns -1: 'blue whale'.indexof('blue') // returns -1 checking occurrences note that 0 doesn't evaluate to true and -1 doesn't evaluate to false.
...And 3 more matches
String.prototype.match() - JavaScript
in this case, the returned item will have additional properties as described below.
... additional properties as explained above, some results contain additional properties as described below.
... examples using match() in the following example, match() is used to find 'chapter' followed by 1 or more numeric characters followed by a decimal point and numeric character 0 or more times.
...And 3 more matches
String.prototype.normalize() - JavaScript
these values have the following meanings: "nfc" canonical decomposition, followed by canonical composition.
... "nfkc" compatibility decomposition, followed by canonical composition.
... the code point for "n" (u+006e) followed by the code point for the combining tilde (u+0303).
...And 3 more matches
encodeURIComponent() - JavaScript
~ * ' ( ) encodeuricomponent() differs from encodeuri as follows: var set1 = ";,/?:@&=+$"; // reserved characters var set2 = "-_.!~*'()"; // unescaped characters var set3 = "#"; // number sign var set4 = "abc abc 123"; // alphanumeric characters + space console.log(encodeuri(set1)); // ;,/?:@&=+$ console.log(encodeuri(set2)); // -_.!~*'() console.log(encodeuri(set3)); // # console.log(encodeuri(set4)); // abc%20abc%20123 (the space gets encoded...
... as %20) console.log(encodeuricomponent(set1)); // %3b%2c%2f%3f%3a%40%26%3d%2b%24 console.log(encodeuricomponent(set2)); // -_.!~*'() console.log(encodeuricomponent(set3)); // %23 console.log(encodeuricomponent(set4)); // abc%20abc%20123 (the space gets encoded as %20) note that a urierror will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g., // high-low pair ok console.log(encodeuricomponent('\ud800\udfff')); // lone high surrogate throws "urierror: malformed uri sequence" console.log(encodeuricomponent('\ud800')); // lone low surrogate throws "urierror: malformed uri sequence" console.log(encodeuricomponent('\udfff')); use encodeuricomponent() on user-entered fields from forms post'd to the server.
... for application/x-www-form-urlencoded, spaces are to be replaced by "+", so one may wish to follow a encodeuricomponent() replacement with an additional replacement of "%20" with "+".
...And 3 more matches
Logical AND (&&) - JavaScript
short-circuit evaluation the logical and expression is evaluated left to right, it is tested for possible "short-circuit" evaluation using the following rule: (some falsy expression) && expr is short-circuit evaluated to the falsy expression; short circuit means that the expr part above is not evaluated, hence any side effects of doing so do not take effect (e.g., if expr is a function call, the calling never takes place).
...see example: function a(){ console.log('called a'); return false; } function b(){ console.log('called b'); return true; } console.log( a() && b() ); // logs "called a" due to the function call, // then logs false (which is the resulting value of the operator) operator precedence the following expressions might seem equivalent, but they are not, because the && operator is executed before the || operator (see operator precedence).
... true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using and the following code shows examples of the && (logical and) operator.
...And 3 more matches
Logical OR (||) - JavaScript
short-circuit evaluation the logical or expression is evaluated left to right, it is tested for possible "short-circuit" evaluation using the following rule: (some truthy expression) || expr is short-circuit evaluated to the truthy expression.
...see example: function a(){ console.log('called a'); return false; } function b(){ console.log('called b'); return true; } console.log( b() || a() ); // logs "called b" due to the function call, // then logs true (which is the resulting value of the operator) operator precedence the following expressions might seem equivalent, but they are not, because the && operator is executed before the || operator (see operator precedence).
... true || false && false // returns true, because && is executed first (true || false) && false // returns false, because operator precedence cannot apply examples using or the following code shows examples of the || (logical or) operator.
...And 3 more matches
delete operator - JavaScript
however, it is important to consider the following scenarios: if the property which you are trying to delete does not exist, delete will not have any effect and will return true.
... the following snippet gives a simple example: var employee = { age: 28, name: 'abc', designation: 'developer' } console.log(delete employee.name); // returns true console.log(delete employee.age); // returns true // when trying to delete a property that does // not exist, true is returned console.log(delete employee.salary); // returns true non-configurable properties when a property is mar...
...delete employeedetails; // returns true function f() { var z = 44; // delete doesn't affect local variable names delete z; // returns false } delete and the prototype chain in the following example, we delete an own property of an object while a property with the same name is available on the prototype chain: function foo() { this.bar = 10; } foo.prototype.bar = 42; var foo = new foo(); // foo.bar is associated with the // own property.
...And 3 more matches
typeof - JavaScript
syntax the typeof operator is followed by its operand: typeof operand typeof(operand) parameters operand an expression representing the object or primitive whose type is to be returned.
... description the following table summarizes the possible return values of typeof.
... type result undefined "undefined" null "object" (see below) boolean "boolean" number "number" bigint (new in ecmascript 2020) "bigint" string "string" symbol (new in ecmascript 2015) "symbol" function object (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascript 2019 and older permitted implementations to have typeof return any implementation-defined string value for non-callable non-standard exotic objects.
...And 3 more matches
switch - JavaScript
the switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case.
...if no default clause is found, the program continues execution at the statement following the end of switch.
... the optional break statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues execution at the statement following switch.
...And 3 more matches
<mtable> - MathML
WebMathMLElementmtable
the mathml <mtable> element allows you to create tables or matrices.
...this allows you to align the specified row of the table rather than the whole table.
...multiple values separated by space are allowed and apply to the corresponding columns (e.g.
...And 3 more matches
Media container formats (file types) - Web media technologies
common container formats while there are a vast number of media container formats, the ones listed below are the ones you are most likely to encounter.
...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.
...And 3 more matches
Animation performance and frame rate - Web Performance
animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not done correctly.
...slow scripts and animating expensive css properties can result in jank as the browser struggles to hit a smooth frame rate.
... the rendering waterfall the process a browser uses to paint changes to a page when an element is animating css properties can be described as a waterfall consisting of the following steps: recalculate style: when a property for an element changes, the browser must recalculate computed styles.
...And 3 more matches
Introduction to progressive web apps - Progressive web apps (PWAs)
pwas are web apps developed using a number of specific technologies and standard patterns to allow them to take advantage of both web and native app features.
...progressive enhancement and responsive design already allow us to build mobile friendly websites.
...given their profit increase, and the relatively low amount of work required for the conversion of these apps to pwas, the advantage is clear.
...And 3 more matches
requiredFeatures - SVG: Scalable Vector Graphics
see feature strings below for a list of allowed values.
... feature strings the following are the feature strings for the requiredfeatures attribute.
... http://www.w3.org/tr/svg11/feature#svg at least one of the following feature is supported: http://www.w3.org/tr/svg11/feature#svg-static http://www.w3.org/tr/svg11/feature#svg-animation http://www.w3.org/tr/svg11/feature#svg-dynamic http://www.w3.org/tr/svg11/feature#svgdom http://www.w3.org/tr/svg11/feature#svgdom at least one of the following feature is supported: http://www.w3.org/tr/svg11/feature#svgdom-static http://www.w3.org/tr/...
...And 3 more matches
transform - SVG: Scalable Vector Graphics
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>).
... value <transform-list> default value none animatable yes transform functions the following transform functions can be used by the transform attribute <transform-list> warning: as per the spec, you should be able to also use css transform functions.
...matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix:(acebdf001)\begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} which maps coordinates from a previous coordinate system into a new coordinate system by the following matrix equalities:(xnewcoordsysynewcoordsys1)=(acebdf001)(xprevcoordsysyprevcoordsys1)=(axprevcoordsys+cyprevcoordsys+ebxprevcoordsys+dyprevcoordsys+f1) \begin{pmatrix} x_{\mathrm{newcoordsys}} \\ y_{\mathrm{newcoordsys}} \\ 1 \end{pmatrix} = \begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x_{\mathrm{prevcoordsys}} \\ y_{\mathrm{prevcoordsys}} \\ 1 \end{pmatri...
...And 3 more matches
Clipping and masking - SVG: Scalable Vector Graphics
but when you try to create a semicircle in svg, you will find out the use of the following properties quickly.
... masking on the other hand allows soft edges by taking transparency and grey values of the mask into account.
...since the rectangle covers only the upper half of the circle, the lower half of the circle will vanish: screenshotlive sample we now have a semicircle without having to deal with arcs in path elements.
...And 3 more matches
SVG fonts - SVG: Scalable Vector Graphics
this bears an id attribute, to enable it to be referenced via a uri (see below).
...all following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heights are ascenders.
... following <font-face-src> is a <missing-glyph> element.
...And 3 more matches
Web security
this secure connection allows clients to be sure that they are connected with the intended server, and to exchange sensitive data.
...it works by allowing you to provide a cryptographic hash that a fetched resource must match.
... http access-control-allow-origin the access-control-allow-origin response header indicates whether the response can be shared with requesting code from the given origin.
...And 3 more matches
Using custom elements - Web Components
high-level view the controller of custom elements on a web document is the customelementregistry object — this object allows you to register a custom element on the page, return information on what custom elements are registered, etc.
... optionally, an options object containing an extends property, which specifies the built-in element your element inherits from, if any (only relevant to customized built-in elements; see the definition below).
... you'll learn more about these in the using the lifecycle callbacks section below.
...And 3 more matches
Compiling from Rust to WebAssembly - WebAssembly
install rust install rust by going to the install rust page and following the instructions.
...to download and install it, enter the following command into your terminal: $ cargo install wasm-pack install node.js we are building an npm package in this tutorial, and so you need to have node.js and npm installed.
...page and follow the instructions.
...And 3 more matches
Content Processes - Archive of obsolete content
content workers combine these ideas, allowing you to inject a content script into a content process, and automatically set up a communication channel between them.
...among other things, this allows us to specify one or more content scripts to be loaded.
... when a content script is first loaded, the content worker automatically imports a messaging api that allows it to emit messages over a pipe.
...And 2 more matches
Private Properties - Archive of obsolete content
consider the following example: function point(x, y) { this._x = x; this._y = y; } the properties _x and _y are intended to be private, and should only be accessed by member functions.
...before explaining how weakmaps work, the following looks at how ordinary objects can be used as hash maps, by creating a simple image cache: let images = {}; function getimage(name) { let image = images[name]; if (!image) { image = loadimage(name); images[name] = image; } return image; } now suppose there's a need to associate a thumbnail with each image.
...a weakmap is very similar to an ordinary hash map, but differs from it in two crucial ways: it can use ordinary objects as keys it does not maintain a strong reference to its values to understand how weakmaps are used in practice, the following rewrites the thumbnail cache using a weakmap: let thumbnails = new weakmap(); function getthumbnail(image) { let thumbnail = thumbnails.get(image); if (!thumbnail) { thumbnail = createthumbnail(image); thumbnails.set(image, thumbnail); } return thumbnail; } this version suffers from none of the problems we mentioned earlier.
...And 2 more matches
content/symbiont - Archive of obsolete content
this may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded,...
... allow object permissions for the content, with the following keys: script boolean whether or not to execute script in the content.
... symbiont symbiont is composed from the worker trait, therefore instances of symbiont and their descendants expose all the public properties exposed by worker along with additional public properties that are listed below: properties contentscriptfile the local file urls of content scripts to load.
...And 2 more matches
frame/utils - Archive of obsolete content
execution of scripts may easily be enabled: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,top'); let frame = create(window.document, { uri: 'data:text/html,<script>console.log("running");</script>', allowjavascript: true }); } globals functions create(document, options) creates a xul browser element in a privileged document.
... remote boolean if true separate process will be used for this frame, and all the following options are ignored.
... allowauth boolean whether to allow auth dialogs.
...And 2 more matches
ui/frame - Archive of obsolete content
frame supports the following events: attach, detach, load, ready, and message.
...frame supports the following events: attach, detach, load, ready, and message.
...frame supports the following events: attach, detach, load, ready, and message.
...And 2 more matches
ui/toolbar - Archive of obsolete content
toolbar supports the following events: attach, detach, show, and hide.
...toolbar supports the following events: attach, detach, show, and hide.
...toolbar supports the following events: attach, detach, show, and hide.
...And 2 more matches
jpm-mobile - Archive of obsolete content
jpm usage is: jpm-mobile [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -v, --version - print the jpm version number installation jpm-mobile is distributed using the node package manager npm, so to get jpm-mobile you need to have npm installed, if you haven't already.
... jpm-mobile run this command runs a new instance of firefox with the add-on installed: jpm-mobile run jpm-mobile run accepts the following options: --adb /path/to/adb provides the path to adb.
... jpm-mobile run -b fennec you can get the package name by following command.
...And 2 more matches
package.json - Archive of obsolete content
"name": "my-addon", "title": "my-addon", "id": "jid1-1fergv45e4f4f@jetpack", "description": "a basic add-on", "author": "", "license": "mpl-2.0", "version": "0.1" } if you are using the new jpm tool, you can easily access manifest data from package.json by requiring it like any other module: var title = require("./package.json").title; key reference package.json may contain the following keys: author the name of the package's original author; this could be the name of a person or a company.
... you can generate the url to your add-on icon in the data directory using the url format below, where "your-addon-name" is the value in the name field of package.json.
... locales an object holding json objects referenced by a locale name that use the following keys: title, description and homepage.
...And 2 more matches
Chrome Authority - Archive of obsolete content
using chrome authority the most powerful low-level modules are run with "chrome privileges", which gives them access to the infamous components object, which grants unfettered access to the host system.
...to obtain these privileges, the module must declare its intent with a statement like the following: var {cc, ci} = require("chrome"); the "chrome" built-in pseudo module is provided by the "toolkit/loader" module.
... components an alias for components itself (note the lower-case).
...And 2 more matches
Getting started (cfx) - Archive of obsolete content
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.
...open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://www.mozilla.org/"); } save the file.
...this will bring up a file selection dialog; navigate to the "my-addon.xpi" file, open it and follow the prompts to install the add-on.
...And 2 more matches
Unit Testing - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm and followed the tutorial on writing reusable modules.
...now create a new file called "base64.js", and give it the following contents: const { atob, btoa } = require("resource://gre/modules/services.jsm"); exports.atob = a => atob(a); exports.btoa = b => btoa(b); this code exports two functions, which just call the platform's btoa() and atob() functions.
... to show the module in use, edit the "index.js" file as follows: var base64 = require("./base64"); var button = require("sdk/ui/button/action").actionbutton({ id: "base64", label: "base64", icon: "./icon-16.png", onclick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); to run this example you'll also have to have an icon file named "icon-16.png" saved in your add-ons "data" directory.
...And 2 more matches
HTML to DOM - Archive of obsolete content
the function below will safely parse simple html and return a dom object which can be manipulated like web page elements.
...see using a hidden iframe element to parse html to a window's dom below.
..."http://example.org/file.html", false); request.send(null); our next step is to create the document object that will represent the dom into which we'll insert our newly-retrieved html: var doc = document.implementation.createhtmldocument("example"); doc.documentelement.innerhtml = request.responsetext; after this any manipulation that we might want to do will be something as simple as the following: doc.body.textcontent = "this is inside the body!"; using a hidden iframe element to parse html to a window's dom sample code may need more work.
...And 2 more matches
Miscellaneous - Archive of obsolete content
<div id="scrollarea" style="overflow: scroll; height: 6em; width: 10em;"> this is the scrolling area.
...the meaning of the action preference is shown in the following table mousewheel.withxxxkey.action result 0 scroll by lines.
...alue.length); element.value = beforetext + snippet + aftertext; element.focus(); //put the cursor after the inserted text element.setselectionrange(selectionend, selectionend); } inserttext(document.getelementbyid("example"), "the text to be inserted"); disabling javascript programmatically // disable js in the currently active tab from the context of browser.xul gbrowser.docshell.allowjavascript = false; if this isn't your browser, you should save the value and restore it when finished.
...And 2 more matches
Rosetta - Archive of obsolete content
nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript.
...the following code is nothing but the base for an extensible collection of compilers.
...it relies on the fact that unrecognized mime types will be simply ignored: this allows us to manually parse them.
...And 2 more matches
Extension Etiquette - Archive of obsolete content
ideally, the location would be below the add-ons item, grouped with the other extension-related commands (menuitem:insertafter="javascriptconsole,devtoolsseparator").
...they allow for easy identification among other extensions in the extensions manager.
... some namespaces have specific conflict prevention conventions, which should be followed as appropriate.
...And 2 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
var myextension = { mylistener: function(evt) { alert("received from web page: " + evt.target.getattribute("attribute1") + "/" + evt.target.getattribute("attribute2")); } } document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); // the last value is a mozilla-specific value to indicate untrusted content is allowed to trigger the event.
...haracters only): "it is also strongly recommended that third parties adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events.") in the case where your extension's overlay does not interact directly with browser.xul, such as in a sidebar, it might be easier to add the event listener to the top-level document directly as shown below (also see: accessing the elements of the top-level document from a child window).
... note: if you're using html5's postmessage() to send a message from unprivileged code to privileged code, adding 'true' to the end of your event listener in your privileged chrome code will allow the message to be received.
...And 2 more matches
Jetpack Processes - Archive of obsolete content
messaging facilities that allow them to communicate with their parent chrome process are the only means by which they can be endowed with any real power.
...privileged apis when script is evaluated in a jetpack process via a call to nsijetpack.evalscript(), the script's global scope is endowed with the following privileged apis: sendmessage(amessagename [, v1 [, v2 [, ...]]]) similar to nsijetpack.sendmessage(), this function asynchronously sends a message to the chrome process.
...to prevent such memory leaks, a process can either invalidate a handle, immediately preventing it from being passed as a message argument, or it can unroot the handle, allowing it to be passed as a message argument until all references to it are removed, at which point it is garbage collected.
...And 2 more matches
Chapter 1: Introduction to Extensions - Archive of obsolete content
« previousnext » note: if you want contribute to this document please following guidelines from the contribute page.
... the add-ons manager handles the following tasks: safely installs and uninstalls add-ons makes sure add-ons are compatible with the version of firefox you're using manages a whitelist of sites trusted for installing add-ons helps troubleshoot add-ons by disabling them and offering a safe mode confirms and runs updates provides access to add-ons' settings dialogs provides access to add-ons' support sites development environme...
... this lowers the threshold both to using and to developing extensions; that fact, combined with firefox's rapidly growing popularity, has created a positive feedback loop, with the number of extension users and extension developers growing explosively—there are now more than 7000 extensions and themes published at the firefox add-ons site (https://addons.mozilla.org).
...And 2 more matches
Adding Events and Commands - Archive of obsolete content
the addeventlistener method allows you to control the phase where you want to handle an event, with the last argument of the function.
...the dom createevent function allows you to create custom events that you can dispatch and capture.
...this allows you to choose which attributes you want it to observe.
...And 2 more matches
Custom XUL Elements with XBL - Archive of obsolete content
this code gets the dom object that corresponds to the xshelloperson tag, allowing you access to its methods and properties.
... properties and fields the field and property tags allow you to handle element variables and access them from outside of the element.
...it is defined using a getter and setter method, allowing read-only and write-only properties, as well as more complex behavior.
...And 2 more matches
Local Storage - Archive of obsolete content
having that function in place, we do something like the following: let myfile = xulschool.getlocaldirectory(); myfile.append("somefile.txt"); // do stuff with the file.
...in the initialization method of your one of your "common" or startup objects, add the following code: let formatter = new log4moz.basicformatter(); let root = log4moz.repository.rootlogger; let logfile = this.getlocaldirectory(); // remember this?
... let appender; logfile.append("log.txt"); // loggers are hierarchical, lowering this log level will affect all // output.
...And 2 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
the most technically sound method of achieving this, and the only acceptable way of changing preferences such that they are automatically restored on add-on uninstall, is to make such changes in the default preference branch, as explained below.
... while the technical details below are important to understand, a library which encapsulates the appropriate logic is provided along with the example add-on at the end, and should be used where possible.
...the following file, for instance, would change the default keyword search engine, assuming that an engine with the name example engine is installed, as described below: // this is a localizable preference, so it must contain a url which // points at a properties file containing the preference name as a // property.
...And 2 more matches
Index of archived content - Archive of obsolete content
.htaccess ( hypertext access ) 2015 mdn fellowship program api navigator navigator.moznotification add-ons add-on sdk builder guides content scripts communicating with other scripts communicating using "port" communicating using "postmessage" cross-domain content scripts interacting with page scripts loading content scripts reddit example port self ...
...panel passwords private-browsing querystring request selection self simple-prefs simple-storage system tabs timers ui url widget windows low-level apis /loader chrome console/plain-text console/traceback content/content content/loader content/mod content/symbiont content/worker core/heritage core/namespace core/promise dev/panel ...
...or 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 firefox profiles repackaging firefox style system overview using microformats...
...And 2 more matches
Dehydra Function Reference - Archive of obsolete content
gcc command line -fplugin=/path/to/gcc_dehydra.so -fplugin-arg-gcc_dehydra=/path/to/your/script.js callback functions the following functions may be provided by the analysis script and will be called by dehydra while compiling.
...builtin functions the following functions are provided by dehydra and may be called by the user: print(msg) print a string to stdout (or stderr if the compiler is piping output).
... optional: code is an integer parameter that allows warnings to be enabled(-wfoo) and disabled(-wno-) on the gcc commandline.
...And 2 more matches
Drag and Drop - Archive of obsolete content
the drag and drop interface many user interfaces allow one to drag particular objects around within the interface.
... the list below describes the event handlers that can be called, which may be placed on any element.
... the function invokedragsession takes four parameters, as described below: invokedragsession(element, transferablearray, region, actions) element a reference to the element that is being dragged.
...And 2 more matches
Editor Embedding Guide - Archive of obsolete content
nscomptr<nsieditingsession> editingsession; nsiwebbrowser->do_getinterface(getter_addrefs(editingsession)); if (editingsession) editingsession->makewindoweditable(domwindow, "html", pr_true); the valid editor types are: "text" (similar to notepad or a textarea; does not allow for html) "textmail" (similar to "text" but html can be inserted; intended for plaintext mail usage and handling of citations) "html" (this is the default type if no type is specified; it allows for all html tags to be inserted) "htmlmail" (this is much like "html" except there are a few editing rules/behaviors that differ such as splitting of mail quotes) editor commands you need to call c...
...below is the sequence of steps that need to be followed for the same: 1.
...call a command -- docommand: commandmanager->docommand(acommand, acommandparams); acommand is a const char * to a supported command name (see list below).
...And 2 more matches
Documentation for BiDi Mozilla - Archive of obsolete content
bidi processing for a given html document will only take place if one of the following is true: the page includes a hebrew or arabic character or a hindi digit.
...in a bidi-enabled document, the following things happen: during a reflow, nsbidipresutils::resolve is called.
... framemanager::setframeproperty is used to set the following flags and pointers (for terminology see the specification of the uba): embeddinglevel: the embedding level of the frame textclass: the text class of the frame.
...And 2 more matches
JavaScript Client API - Archive of obsolete content
is managed and protected; (b) that your third party client will only store data in encrypted form on the firefox sync servers operated by mozilla; (c) that you and your third party client will use the firefox sync apis solely for their intended purpose; (d) that your third party client will not hide or mask its identity as it uses the services and/or firefox sync apis, including by failing to follow required identification conventions; and (e) that you and your third party client will not use the firefox sync apis for any application or service that replicates or attempts to replicate the services or firefox sync experience unless such use is non-confusing (by non-confusing, we mean that people should always know with whom they are dealing and where the information or software they are downl...
...have a look at one of the following files: services/sync/modules/engines/bookmarks.js services/sync/modules/engines/history.js setting up a js module the code for your custom sync engine should live in a js module.
...depending of what type of data you're working with, you might already have guids built into your data that you can make use of (note that guids must be allowed to change and should be url friendly).
...And 2 more matches
GRE - Archive of obsolete content
this embedding framework allows applications to locate a compatible gecko runtime and embed it without knowing in advance where that runtime will be installed.
... xulrunner: the new gre xulrunner is the new version of the gre, which not only allows embedding but is capable of bootstrapping entire xul applications such as firefox.
...this allows the embedder to specify what version(s) of gre are appropriate, and to specify any special features the gre must have (currently there are no special features defined).
...And 2 more matches
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
testing summary acceptance tests have passed on the following supported platforms: * windows, 32 & 64 bit * mac ox x ppc & intel, 32 bit * linux, 32 bit * windows mobile arm version asc-4200 of the actionscript compiler was used for all tests.
... performance testsuite time metric the following is a comparison of the current tamarin-central (tc-703) versus the prior build (tc-700) as well as current against the vm in flash player 10.
... osdefault-jitinterpretedaggressive jit mac (os/x 10.4 intel, 2ghz dual core)tc-703 vs tc-700: 0.0%tc-703 vs flash10: 1.1% slowertc-703 vs tc-700: 17.4% fastertc-703 vs flash10: 165.3% fastertc-703 vs tc-700: 0.1% fastertc-703 vs flash10: 0.8% slower windows (xp pro, 2.13ghz dual core)tc-703 vs tc-700: 0.6% fastertc-703 vs flash10: 0.8% fastertc-703 vs tc-700: 16.4% fastertc-703 vs flash10: 148.7% fastertc-703 vs tc-700: 0.1% slowertc-703 vs flash10: 5.2% faster linux (ubuntu linux, 2.13 ghz dual core)tc-703 vs tc-700: 6.0% fastertc-703 vs flash10: 1.7% fastertc-703 vs tc-700: 89.5% fastertc-703 vs flash10: 182.0% fastertc-703 vs tc-700: 6.1% fastertc-703 vs flash10: 1.4% faster ...
...And 2 more matches
Tamarin mercurial commit hook - Archive of obsolete content
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/tamarin-redux/utils/hooks/tamarin-commit-hook.py:master_hook once added, all commits will run the commit hook.
... 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?
...And 2 more matches
Tuning Pageload - Archive of obsolete content
to best understand what the following preferences affect, there are a few things you should know.
... the data flows in gecko as follows: network -> necko -> parser -> content sink -> content model -> rendering model -> layout -> painting.
... content.interrupt.parsing this preference, when true, means that the content sink can tell the parser to stop for now and return to the event loop, which allows layout and painting to happen.
...And 2 more matches
Writing to Files - Archive of obsolete content
see below for more details about this.
...other character encodings are available; see writing other character encodings below for details about writing text in other encodings.
...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.
...And 2 more matches
Panels - Archive of obsolete content
for example, the following panel displays a textbox for entering a name.
...for other types of elements, you need to use a different technique as in the following example.
...for instance, to attach the popup defined above to a label, use the following code: <label value="search" popup="search-panel"/> the result is a search button which opens a panel for entering the search term.
...And 2 more matches
Actions - Archive of obsolete content
this content will be copied for each matching result (though see below for an exception) and inserted into the document.
...for result b, the builder would have generated the following content: <button id="http://www.xulplanet.com/rdf/b" label="http://www.xulplanet.com/rdf/b"/> naturally, you wouldn't use an id attribute inside a template action since the id would be replaced anyway.
...after all the results have been examined, the dom tree will look like the following: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> <content uri="?start"/> <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <action> <button uri="?relateditem" label="?relateditem"/> </action> ...
...And 2 more matches
Multiple Queries - Archive of obsolete content
the following is the basic structure of a template with multiple queries: <listbox datasources="..." ref="..."> <queryset> <query> ...
...the results from the first query are generated first and output generated for it, followed by the results and output for the second query, and so forth for all of the queries.
... this method of using multiple queries allows different content to generated for each query.
...And 2 more matches
Multiple Rules - Archive of obsolete content
this allows the conditions can be simpler.
... it also allows a common technique where the last rule in a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule.
... a multiple rule template looks like the following: <hbox id="photoslist" datasources="template-guide-photos3.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> <template> <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> <rule> <where subject="?title" rel="equals" value="canal"/> <action> <button uri="?photo" image="?photo" label="view" orient="vertical"/> </action> </rule> <rule> <action> <image uri="?photo" src="?photo"/> </action> </rule> </template> </hbox> this template contains a query with two rules.
...And 2 more matches
RDF Modifications - Archive of obsolete content
for instance, an assert call looks like the following: var source = rdf.getresource("http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg"); var predicate = rdf.getresource("http://purl.org/dc/elements/1.1/description"); var target = rdf.getliteral("one of the thirty or so egyptian obelisks"); datasource.assert(source, predicate, target, true); the assert call adds a new triple to the rdf datasource.
... adding rdf triples let's say we've just added the triple below to the datasource.
...let's assume we have single query with as follows: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> these query statements will cause any photos with bo...
...And 2 more matches
Sorting Results - Archive of obsolete content
this method of sorting a seq works best for the simple query syntax since it is obvious how the starting ref relates to the end member results (they are just the children), or for extended syntax queries that follow a similar pattern.
...if you don't want to allow sorting by a certain column, you can leave out the sort attribute.
... only specify this attribute on columns that you wish to allow the user to sort by.
...And 2 more matches
Template Logging - Archive of obsolete content
each result is logged in a form much like the following: in template with id root using ref http://www.some-fictitious-zoo.com/birds new active result for query 2 matching rule 1: http://www.some-fictitious-zoo.com/birds/emperorpenguin in the example above, a new result has been added.
...this allows us to narrow down what query and rule is being used to generate the content.
...to summarize, the following forms of message may be logged: new active result for query 1 matching rule 2 a new data result has been added.
...And 2 more matches
Box Objects - Archive of obsolete content
the following example shows this.
...to retrive or modify the hidden or collapsed state use the corresponding properties as in the following example.
...the box object also allows navigation in a similar means but retrieves the elements in display order.
...And 2 more matches
Broadcasters and Observers - Archive of obsolete content
the simplest broadcaster is shown below.
...below, some additional observers are defined: <broadcaster id="offline_command" label="offline" accesskey="f"/> <keyset> <key id="goonline_key" observes="offline_command" modifiers="accel" key="o"/> </keyset> <menuitem id="offline_menuitem" observes="offline_command"/> <toolbarbutton id="offline_toolbarbutton" observes="offline_command"/> in this example, both the label and the accesskey will be ...
...like its attribute counterpart, it allows you to define an element to be an observer.
...And 2 more matches
Focus and Selection - Archive of obsolete content
the following example can be used to apply a function to handle a focus event.
...the example below shows this.
...for instance, you could make a label focusable, as in the example below.
...And 2 more matches
Introduction - Archive of obsolete content
you can follow along by looking for these sections.
...this is done using a feature of xul called an overlay, which allows the ui provided from one source, in this case, the firefox browser, to be merged together with the ui from the extension.
... standalone xulrunner application xulrunner is a packaged version of the mozilla platform which allows you to create standalone xul applications.
...And 2 more matches
Introduction to RDF - Archive of obsolete content
the sample below shows a simple rdf template.
...for example, a selection of the fields in the mozilla bookmark list is described by the uris below: name http://home.netscape.com/nc-rdf#name bookmark name url http://home.netscape.com/nc-rdf#url url to link to description http://home.netscape.com/nc-rdf#description bookmark description last visited http://home.netscape.com/web-rdf#lastvisitdate date of last visit these are g...
...rdf/xml file example below, a sample rdf/xml file is shown, listing a table with three records and three fields.
...And 2 more matches
Modifying the Default Skin - Archive of obsolete content
support for the userchrome.css file and any of its elements described below are not guaranteed in future versions of firefox.
... a skin is described using css, allowing you to define the colors, borders and images used to draw elements.
... for example, by adding the following to the end of the file, you can change all menubar elements to have a red background.
...And 2 more matches
Tabboxes - Archive of obsolete content
it involves five new elements, which are described briefly here and in more detail below.
... shown below is the general syntax of a tabbox: <tabbox id="tablist"> <tabs> <!-- tab elements go here --> </tabs> <tabpanels> <!-- tabpanel elements go here --> </tabpanels> </tabbox> the tab elements are placed inside a tabs element, which is much like a regular box.
...the tabbox also contains a tabpanels element which will appear below the tabs due to the vertical orientation on the whole tabbox.
...And 2 more matches
Updating Commands - Archive of obsolete content
a simple way of doing this is the following: var controller = document.commanddispatcher.getcontrollerforcommand("cmd_paste"); if (controller && controller.iscommandenabled("cmd_paste")){ controller.docommand(command); } the code above first retrieves the controller for the 'cmd_paste' command from the command dispatcher.
...the only other thing you need to do is ensure that the enabled status of the paste command, and therefore the button, is updated at the right time, which is described below.
... command updaters a command updater is a feature of the commandset element which allows it to update commands when certain events happen.
...And 2 more matches
key - Archive of obsolete content
ArchiveMozillaXULkey
the disabled attribute is allowed only for form controls.
... modifiers type: space-separated list of the values below a list of modifier keys that should be pressed to invoke the keyboard shortcut.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
...And 2 more matches
listbox - Archive of obsolete content
there are numerous methods which allow the items in the listbox to be retrieved and modified.
... the disabled attribute is allowed only for form controls.
... seltype type: one of the values below used to indicate whether multiple selection is allowed.
...And 2 more matches
listitem - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } current type: boolean this attribute will be set to true if the listitem is the current item.
... the disabled attribute is allowed only for form controls.
...And 2 more matches
menulist - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disableautoselect type: boolean if this attribute is true or omitted, the selected item on the menu will update to match what the user entered in the textbox.
... the disabled attribute is allowed only for form controls.
...And 2 more matches
preference - Archive of obsolete content
the disabled attribute is allowed only for form controls.
...a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
... the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascript"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </script> <textbox id="find-text" onchange="return myfunction(event);"/> </window> readonly type: boolean if set to true, then the user cannot change the value of the element.
...And 2 more matches
radio - Archive of obsolete content
ArchiveMozillaXULradio
attributes accesskey, command, crop, disabled, focused, group, image, label, selected, tabindex, value properties accesskey, accessibletype, control, crop, disabled, image, label, radiogroup, selected, tabindex, value examples <radiogroup> <radio id="orange" label="red" accesskey="r"/> <radio id="violet" label="green" accesskey="g" selected="true"/> <radio id="yellow" label="blue" accesskey="b" disabled="true"/> </radiogroup> attributes accesskey type: character this should be set to a character that is used as a shortcut key.
... crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
...And 2 more matches
<statusbarpanel> - Archive of obsolete content
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 crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
...And 2 more matches
tab - Archive of obsolete content
ArchiveMozillaXULtab
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
...And 2 more matches
timepicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the timepicker is used to allow the user to enter a time.
...arrow buttons next to the fields allow the values to be adjusted with the mouse.
... a fourth textbox appears for 12 hour clocks which allows selection of am or pm.
...And 2 more matches
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\1.8.0.1 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/1.8.0.1 .
...And 2 more matches
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\1.8.0.4 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/1.8.0.4 .
...And 2 more matches
XULRunner 1.9.1 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\1.9.1 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/1.9.1 .
...And 2 more matches
XULRunner 1.9.2 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\1.9.2 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/1.9.2 .
...And 2 more matches
XULRunner 1.9 Release Notes - Archive of obsolete content
the following directory is recommended: c:\program files\mozilla xulrunner\1.9 .
... mac os x open the .pkg file within the installer and follow the directions.
...the following directory is recommended: /opt/xulrunner/1.9 .
...And 2 more matches
2006-10-20 - Archive of obsolete content
he stated that he was able to pre-package the extensions that he wanted by following this walkthrough and a little bit of help from this post.
...he can be contacted via: email: preed@mozilla.com irc: preed on irc.mozilla.org phone: 650.903.0800 x256 uploading language packs to amo on october 17th benjamin smedberg brought the following to the attention of the localizers and the build team: that he is planning to upload the firefox 2 language packages currently located at http://releases.mozilla.org/pub/mozi...rc3/win32/xpi/ to addons.mozilla.org in the next few days.
...you can do this by replying to the following post.
...And 2 more matches
2006-11-03 - Archive of obsolete content
summary: mozilla.dev.builds - october 28th to november 3rd 2006 no such file or directory (build problem on winxp) november 2nd: kenoa complained that when he is compiling using cygwin on win32 he gets the following error no such file or directory1: /cygdrive/c/mozilla/mail/config/mozconfig client.mk:339: /cygdrive/c/mozilla/.mozconfig.mk: no such file or directory he claims that the file ".mozconfig" exists in /cygdrive/c/mozilla/mail/config/mozconfig the disable-crypto cause problem originally posted on november 2nd: gxk is building minimo using the code base from sept.
... when he builds using the disable.crypto option he encounters the following problem: no rule to make target `../../dist/lib/components/libpipboot.a', needed by `minimo'.
...according to him he has followed the windows build requirements recommended by mozilla.
...And 2 more matches
Extentsions FAQ - Archive of obsolete content
there are workarounds to this restriction by messing around with overflow or negative margins but i forgot offhand how to do that.
...<https://bugzilla.mozilla.org/show_bug.cgi?id=312818> "thunderbird requires domain in addresses and doesn't always add default" there is an extension that allows what you want attached to one of the comments in this bug.
...however, it's functional and does allow for the explorer to be handling the display of the folder contents, and all of the right-click context menu support is present so it should meet my needs.
...And 2 more matches
NPEvent - Archive of obsolete content
ef struct _npevent { uint16 event; uint32 wparam; uint32 lparam; } npevent; mac os typedef eventrecord npevent; type eventrecord = record { what: integer; message: longint; when: longint; where: point; modifiers: integer; end; xwindows typedef xevent npevent; fields npevent on microsoft windows the data structure has the following fields: event one of the following event types: wm_paint wm_lbuttondown wm_lbuttonup wm_lbuttondblclk wm_rbuttondown wm_rbuttonup wm_rbuttondblclk wm_mbuttondown wm_mbuttonup wm_mbuttondblclk wm_mousemove wm_keyup wm_keydown wm_setcursor wm_setfocus wm_killfocus for information about these events, see the microsoft windows developer documentation.
... eventrecord npevent on mac os npevent is defined as an eventrecord data structure, which has the following fields: what integer representing an event type.
...the event type may be any of the ollowing: graphicsexpose focusin focusout enternotify leavenotify motionnotify buttonpress buttonrelease keypress keyrelease description microsoft windows description the type npevent represents an event passed by npp_handleevent() to a windowless plug-in.
...And 2 more matches
The First Install Problem - Archive of obsolete content
the following write-up describes how a plugin installer can write keys to the win32 system registry to enable gecko-based browsers to discover the plugin at runtime.
... add the following values to the newly created key -- some are string values (reg_sz), and some are actually subkeys.
... the mimetypes subkeys contain the following string (reg_sz) value: "description" -- this is the actual description of the mimetype, very much as it appears in the dll (e.g.
...And 2 more matches
Tamarin Tracing Build Documentation - Archive of obsolete content
tamarin source versions the following instructions are for obtaining and building the tamarin tracing source code.
...use the following command to create a copy of the tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-tracing tamarin-tracing building tamarin building tamarin will create all the libraries for the avmplus and garbage collector (mmgc), and create a standalone executable, avmshell, for executing files in the abc file format.
... running tamarin compliance tests follow the same steps as the tamarin central instructions.
...And 2 more matches
Building a Theme - Archive of obsolete content
next, the contents of the following directories to their respective folders into the folder.
... copy the contents of the following directories to their respective folders.
...e/browser/ communicator to chrome/communicator/ you should end up with this directory structure: <ext path>/ /install.rdf /chrome.manifest /chrome/ browser/ communicator/ global/ mozapps/ after this, it would be a good idea to read the article setting up extension development environment and follow the directions there.
...And 2 more matches
CSS - Archive of obsolete content
ArchiveWebCSS
e -ms-content-zoom-snap-type css property is a microsoft extension that specifies how zooming is affected by defined snap-points.-ms-content-zoomingthe -ms-content-zooming css property is a microsoft extension that specifies whether zooming is enabled.-ms-filterthe -ms-filter css property is a microsoft extension that sets or retrieves the filter or collection of filters applied to an object.-ms-flow-fromthe -ms-flow-from css property is a microsoft extension that gets or sets a value identifying a region container in the document that accepts the content flow from the data source.-ms-flow-intothe -ms-flow-into css property is a microsoft extension that gets or sets a value identifying an iframe container in the document that serves as the region's data source.-ms-high-contrast-adjustthe -ms-...
...the extension is implemented in microsoft edge and internet explorer 11.-ms-overflow-stylethe -ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows.-ms-scroll-chainingthe -ms-scroll-chaining css property is a microsoft extension that specifies the scrolling behavior that occurs when a user hits the scroll limit during a manipulation.-ms-scroll-limitthe -ms-scroll-limit css property is a microsoft e...
...ty is a microsoft extension that specifies the color of the track element of a scrollbar.-ms-text-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 a...
...And 2 more matches
Writing JavaScript for XHTML - Archive of obsolete content
(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.
... problem: names in xhtml and html are represented in different cases scripts that used getelementsbytagname() with an upper case html name no longer work, and attributes like nodename or tagname return upper case in html and lower case in xhtml.
... solution: use or convert to lower case for methods like getelementsbytagname(), passing the name in lower case will work in both html and xhtml.
...And 2 more matches
Troubleshooting XForms Forms - Archive of obsolete content
any instance, no controls get bound if no controls show with either inline instance or an <xf:instance src="...">, check the following: as with inline instance, make sure the instance of the form control ref binding expression matches the namespace of the data.
... </tr> </xf:repeat> </table> the xhtml modularization does not allow this.
... if you are trying to submit to a different domain than the form is loaded from, make sure that you have allowed cross-domain submission for that specific "form domain".
...And 2 more matches
The Business Benefits of Web Standards - Archive of obsolete content
feed content such as rss and atom simply will not work without being implemented by following the requisite standard.
...it does not follow for example that successful business users have wide monitors.
...from this it follows that there needs to be a framework and a process for content contributors to post articles, to upload videos, sound or any other media.
...And 2 more matches
Common causes of memory leaks in extensions - Extensions
consider the following example code that could be part of your browser.xul overlay: gbrowser.addeventlistener("domcontentloaded", function(evt) { var contentdoc = evt.originaltarget; var i = 0; // refresh the title once each second setinterval(function() { contentdoc.title = ++i; }, 1000); }, false); one would normally expect that the interval (or timer) would be destroyed as soon as the document u...
...for example, the following code snippets — part of a bootstrap.js — will leak: function leakref() {} function modifydocument(document) { var a = document.createelement("a"); document.body.appendchild(a); // the new dom node holding a reference to leakref will prevent // that function object from being garbage collected and hence // will leak the whole bootstrap compartment.
... window.addeventlistener("leaky", leakref, true); // the following line still fails to avoid the leak, as usecapture differs // and removeeventlistener will not remove anything.
...And 2 more matches
3D collision detection - Game development
followup articles will cover implementations in specific 3d libraries.
...the overlapping area between two non-rotated boxes can be checked with logical comparisons alone, whereas rotated boxes require additional trigonometric operations, which are slower to calculate.
... if you have entities that will be rotating, you can either modify the dimensions of the bounding box so it still wraps the object, or opt to use another bounding geometry type, such as spheres (which are invariant to rotation.) the animated gif below shows a graphic example of an aabb that adapts its size to fit the rotating entity.
...And 2 more matches
Building up a basic demo with PlayCanvas editor - Game development
now follow the same steps as we did before when coloring the cube: create a new material using the add asset (plus) button.
... 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 screenshot.
...add the following line inside this function, to rotate the cube on every frame: this.entity.rotate(dt*10, dt*20, dt*30); in the line above this.entity refers to the object to which the script will be attached (the box); using the dt variable, which contains the delta time passed since the previous frame, we can rotate the box by a different amount around all three axes.
...And 2 more matches
Unconventional controls - Game development
interestingly enough, the first captain rogers game (asteroid belt of sirius) was optimized for low-end, small-screen, cheap smartphones running firefox os, so you can see the difference three years can make — you can read the whole story in our building games for firefox os tv hacks post.
...you can also check this handy cheat sheet seen below if you're working with panasonic tvs running firefox os: you can add moving between states, starting a new game, controlling the ship and blowing stuff up, pausing and restarting the game.
... to get the leap motion working on your computer you have to first install it by following the steps at leapmotion.com/setup.
...And 2 more matches
Implementing controls using the Gamepad API - Game development
this article looks at implementing an effective, cross-browser control system for web games using the gamepad api, allowing you to control your web games using console game controllers.
...eventually, extra drivers and plugins allowed us to use console gamepads with desktop games — either native games or those running in the browser.
... the second, hidden "change" implementation is the ability to transform the static fridge into a full-blown moving, shooting and eating machine.
...And 2 more matches
Track the score and win - Game development
add the following into your javascript, after the rest of your variables: var score = 0; you also need a drawscore() function, to create and update the score display.
... add the following after the collisiondetection() function: function drawscore() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("score: "+score, 8, 20); } drawing text on a canvas is similar to drawing a shape.
...add the following highlighted line to your code: function collisiondetection() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var b = bricks[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; score++...
...And 2 more matches
Load the assets and print them on screen - Game development
add the following line between the game initialization code (our var game...
...add the following new line just inside the preload() function, at the bottom: function preload() { // ...
...(note that the file name does not also have to be the same, but we'd recommend it, as it makes everything easier to follow.) of course, to load the image, it must be available in our code directory.
...And 2 more matches
CORS - MDN Web Docs Glossary: Definitions of Web-related terms
but cors gives web servers the ability to say they want to opt into allowing cross-origin access to their resources.
... learn more general knowledge cross-origin resource sharing (cors) on mdn cross-origin resource sharing on wikipedia cors headers access-control-allow-origin indicates whether the response can be shared.
... access-control-allow-credentials indicates whether or not the response to the request can be exposed when the credentials flag is true.
...And 2 more matches
Test your skills: HTML accessibility - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
...And 2 more matches
Test your skills: Images and Form elements - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... task one in this task, you have an image that is overflowing the box.
... in the example below see if you can match the image above.
...And 2 more matches
Attribute selectors - Learn web development
[attr|=value] div[lang|="zh"] matches elements with an attr attribute whose value is exactly value or begins with value immediately followed by a hyphen.
... in the example below you can see these selectors being used.
... substring matching selectors these selectors allow for more advanced matching of substrings inside the value of your attribute.
...And 2 more matches
Combinators - Learn web development
body article p in the example below, we are matching only the <p> element which is inside an element with a class of .box.
...for example, to select all <img> elements that come right after <p> elements: p + img a common use case is to do something with a paragraph that follows a heading, as in my example below.
...to select all <img> elements that come anywhere after <p> elements, we'd do this: p ~ img in the example below we are selecting all <p> elements that come after the <h1>, and even though there is a <div> in the document as well, the <p> that comes after it is selected.
...And 2 more matches
Test Your Skills: Fundamental layout comprehension - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
...opening the index.html file in a browser should give you a page with basic styling but no layout, which should look something like the image seen below.
...And 2 more matches
Supporting older browsers - Learn web development
a basic level of support comes from structuring your content well so that the normal flow of your page makes sense.
... a user with a very limited feature phone might not get much of your css, but the content will flow in a way that makes reading easy.
... in the below example, we have floated three <div>s so they display in a row.
...And 2 more matches
CSS layout - Learn web development
normal flow elements on webpages lay themselves out according to normal flow - until we do something to change that.
... this article explains the basics of normal flow as a grounding for learning how to change it.
... positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place inside the browser viewport.
...And 2 more matches
How do you upload your files to a web server? - Learn web development
your account is: demozilla your website will be visible at demozilla.examplehostingprovider.net to publish to this account, please connect through sftp with the following credentials: sftp server: sftp://demozilla.examplehostingprovider.net username: demozilla password: quickbrownfox port: 5548 to publish on the web, put your files into the public/htdocs directory.
... to connect your sftp client to the distant server, follow these steps: choose file > site manager...
...a basic command looks like so: rsync [-options] source user@x.x.x.x:destination -options is a dash followed by a one or more letters, for example -v for verbose error messages, and -b to make backups.
...And 2 more matches
HTML forms in legacy browsers - Learn web development
graceful degradation is web developer's best friend graceful degradation and progressive enhancement are development patterns that allow you to build great stuff by supporting a wide range of browsers at the same time.
...modernizr is a library that allows you to test the availability of functionality in order to act accordingly.
... here is an example: modernizr.load({ // this tests if your browser supports the html5 form validation api test : modernizr.formvalidation, // if the browser does not support it, the following polyfill is loaded nope : form-validation-api-polyfill.js, // in any case, your core app file that depends on that api is loaded both : app.js, // once both files are loaded, this function is called in order to initialize the app.
...And 2 more matches
Test your skills: Form validation - Learn web development
try submitting your form — it should refuse to submit until the above constaints are followed, and give suitable error messages.
... all of the user names in our application consist of a single letter, followed by a dot, followed by three or more letters or numbers.
... all letters should be lowercase.
...And 2 more matches
Test your skills: Other controls - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... other controls 2 now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided.
...And 2 more matches
Web forms — Working with user data - Learn web development
web forms are a very powerful tool for interacting with users — most commonly they are used for collecting data from users, or allowing them to control a user interface.
...in the articles listed below, we'll cover all the essential aspects of web forms including marking up their html structure, styling form controls, validating form data, and submitting data to the server.
...therefore, before you look at the other sections listed below we'd recommend that you go away and learn some css and javascript first.
...And 2 more matches
Document and website structure - Learn web development
active learning: exploring the code for our example our example seen above is represented by the following code (you can also find the example in our github repository).
... we'd like you to look at the example above, and then look over the listing below to see what parts make up what section of the visual.
... <!doctype html> <html> <head> <meta charset="utf-8"> <title>my page title</title> <link href="https://fonts.googleapis.com/css?family=open+sans+condensed:300|sonsie+one" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="style.css"> <!-- the below three lines are a fix to get html5 semantic elements working in old versions of internet explorer--> <!--[if lt ie 9]> <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script> <![endif]--> </head> <body> <!-- here is our main header that is used across all the pages of our website --> <header> <h1>header</h1> </header> <nav> <ul> <li><a href="#">home</a></li> <li><a href="#">our team</a></li> <li><a href="...
...And 2 more matches
Test your skills: Links - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
...And 2 more matches
Test your skills: Arrays - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 2 more matches
Test your skills: variables - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 2 more matches
Test your skills: Object-oriented JavaScript - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... 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.
...And 2 more matches
CSS performance optimization - Learn web development
browsers follow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees.
... animating on the gpu browsers are optimized to handle css animations, and handle animating properties that do not trigger a reflow (and therefore also a repaint) very well.
... will-change: opacity, transform; the font-display property applied to the @font-face rule, the font-display property defines how font files are loaded and displayed by the browser, allowing text to appear with a fallback font while a font loads, or fails to load.
...And 2 more matches
Android-specific test suites
for example, to disable org.mozilla.gecko.permissions.testsuccessrunnableisexecutedifpermissionsaregranted, add @ignore as follows: ...
... disabling one failing test in general, it's not sensible to allow java code that doesn't observe the existing coding style; in this respect, this job is equivalent to the eslint jobs that check the javascript coding style throughout the tree.
... using this suite will allow the code to be analyzed to spot any design flaws or potential bugs.
...And 2 more matches
Testopia
it is designed to be a generic tool for tracking test cases, allowing for testing organizations to integrate bug reporting with their test case run results.
... new reports: worst offender and case roll-up set priorities on indidual case-runs new clone options uses the latest extjs 3.0 library converts testopia into a true bugzilla extension numerous bug fixes integration points testopia integrates with bugzilla products, components, versions, and milestones to allow a single management interface for high level objects.
... testopia allows users to login to one tool and uses bugzilla group permissions to limit access to modifying test objects.
...And 2 more matches
Creating reftest-based unit tests
step 3 create a file named foo.html with the following: <html><head><title>reftest0001</title> <body><strong>hello!</strong></body> </html> step 4 create a file named bar.html with the following: <html><head><title>reftest0001</title> <body><b>hello!</b></body> </html> step 5 create a file named reftest.list with the following: == foo.html bar.html you are now ready to run the test (but first you must go back to the root of fir...
...more information on this file can be found in the readme.txt referenced below, which was written by the creator of the reftest tool.
...the cost of adding a new test to an automated suite is very, very low.
...And 2 more matches
Commenting IDL for better documentation
happily, following these recommendations will also help ensure your comments are extremely human-readable, too.
...but by following the guidelines here, you can help make sure that our tools can generate a "good start" version of the documentation for your interfaces, and that the writers will be able to easily figure out what the tools are not able to do automatically.
... comment format doxygen supports several comment formats; for style and consistency reasons, we use the following: /** * */ note the two asterisks ("**") on the first line of the comment.
...And 2 more matches
mozbrowsercontextmenu
details the details property returns an anonymous javascript object with the following properties: clientx the x value of the coordinate that was clicked inside the browser <iframe>'s viewport.
... systemtargets an array containing one or more menusystem objects (see the menusystem object, below), containing details of the standard menu(s) that will be shown.
... contextmenu a menu object (see the menu object, below) representing a custom menu defined via <menu> / <menuitem> elements and pointed to via a contextmenu attribute on the dom element clicked on, which contains the menu's id.
...And 2 more matches
Embedding the editor
xbl creates an nseditorboxobject for each <editor> tag, and allows javascript to access properties of this box object (such as the nsieditorshell).
...this needs to be changed to allow embedders to provide their own, possibly native ui.
... meeting these objectives will also solve the following existing composer problems: composer should handle frameset documents composer should handle documents with <iframe>s.
...And 2 more matches
Roll your own browser: An embedding how-to
contained within this directory are a couple of makefiles: basebrowser-unix basebrowser-win the xpinstall packager follows the same format.
...(screenshot) xparts: kde extension that allows mozilla to be embedded into the konqueror browser.
...(mozilla blurb) bradsoft's topstyle css builder: implements an internal browser using mozilla activex embedding control.obsolete since gecko 7.0 nxzilla: a set of libraries that allow mozilla to be used with a nanox server.
...And 2 more matches
Gecko Keypress Event
when the keypress event includes modifier keys, sometimes the charcode value is replaced with an ascii character according to the following rules.
...there are also some differences between the platforms, as described in the following sections.
... (bug 359638 partially addressed this issue by trying both characters on the key, but bug 303192 would provide a complete solution.) solution the following rules apply: key handlers should be provided with information about all the possible meanings of the event.
...And 2 more matches
How to get a stacktrace with WinDbg
(to get a stacktrace for thunderbird or some other product, substitute the product name where ever you see firefox in this instructions.) requirements to get such a stacktrace you need to install the following software: debugging tools for windows microsoft distributes the debugging tools for windows for free, those include windbg which you will need here.
...to load the symbols, enter the three commands below, pressing enter after each one.
... 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.
...And 2 more matches
How to Report a Hung Firefox
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.
... if firefox is truly hung, please note the approximate amount of time you waited before forcing a crash (below) in the bug report.
... if you suspect a hang (as opposed to slow performance), wait one minute on an idle system before getting the stack trace.
...And 2 more matches
PBackground
ipdl protocols are used to specify how the chrome and content processes talk to each other and verify that a content process is "following the rules".
...this protocol is called pcompositor, and allows us to bypass the main thread of the parent process, which trims the latency of texture uploads since they will not get bogged down if that thread is busy.
...pbackground allows us to bypass the chrome process's main thread if used from the content process' main thread.
...And 2 more matches
FileUtils.jsm
need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/fileutils.jsm"); the file constructor if you have a path to a file (or directory) you want to obtain an nsifile for, you can do so using the file constructor, like this: var f = new fileutils.file(mypath); method overview nsifile getfile(string key, array patharray, bool followlinks); nsifile getdir(string key, array patharray, bool shouldcreate, bool followlinks); nsifileoutputstream openfileoutputstream(nsifile file, int modeflags); nsifileoutputstream openatomicfileoutputstream(nsifile file, int modeflags); nsifileoutputstream opensafefileoutputstream(nsifile file, int modeflags); void closeatomicfileoutputstream(nsifileou...
... nsifile getfile( string key, array patharray, bool followlinks ); parameters key the nsidirectoryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key.
... followlinks optional true if links should be followed, false otherwise.
...And 2 more matches
FxAccountsOAuthClient.jsm
components.utils.import("resource://gre/modules/fxaccountsoauthclient.jsm"); creating a new fxaccountsoauthclient new fxaccountsoauthclient(object options); method overview launchwebflow(); teardown(); attributes parameters object returns the set of parameters that initialized the firefox accounts oauth flow.
... oncomplete function gets called when the firefox accounts oauth flow successfully completes.
... parameters set of parameters to initialize the firefox accounts oauth flow.
...And 2 more matches
JavaScript OS.Constants
using os.constants from the main thread to initialize os.constants for use in the main thread, add the following snippet to your code: components.classes["@mozilla.org/net/osfileconstantsservice;1"].
...useful mostly for using js-ctypes to interact with the following platforms: macos x; android; linux; other variants of unix.
... eoverflow (not always available under windows) value too large to be stored in datatype.
...And 2 more matches
WebRequest.jsm
usage to import webrequest, use code like: let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); the webrequest object has the following properties, each of which corresponds to a specific stage in executing a web request: onbeforerequest onbeforesendheaders onsendheaders onheadersreceived onresponsestarted oncompleted each of these objects defines two functions: addlistener(callback, filter, opt_extrainfospec) removelistener(callback) adding listeners use addlistener to add a listener to a particular event.
... it takes one mandatory argument and two optional arguments, as detailed below.
... to perform one of these operations, include a property with the appropriate name in the object returned from the listener, and assign it the desired value, as detailed in the table below: operation available in return property cancel onbeforerequest cancel boolean value set to true.
...And 2 more matches
JavaScript code modules
ctypes.jsm provides an interface that allows javascript code to call native libraries without requiring the development of an xpcom component.
... customizableui.jsm allows you to interact with customizable buttons and items in firefox's main window ui.
... jni.jsm abstracts the js-ctypes to provide an interface that allows javascript code to call code running in native jvms.
...And 2 more matches
Localizing with Pontoon
pontoon is a very simple and intuitive tool that requires little to no technical skill to use in the l10n workflow.
...note that for our purposes here, we'll be using firefox affiliates website to demo pontoon's functionality and workflow.
...only the toolbar on top belongs to pontoon, containing the following items (from left to right): list of strings opens a sidebar with a list of all strings to localize.
...And 2 more matches
SVN for Localizers
it's a handy tool that allows us to grab, change, and store versions of source files in one location.
... enter the following command in your command-line tool: svn checkout https://svn.mozilla.org/projects/mozilla.com/trunk/locales/[your locale code] mozilla-l10n-[your-localecode] this command creates the mozilla-l10n-[your-localecode] directory on your computer and copies into it all of the files from https://svn.mozilla.org/projects/moz...om/trunk/locales/[your locale code].
... once you're satisfied with changes, commit them to the appropriate mozilla svn repository by entering the following command: svn commit -m "minor modifications for firefox [version #] beta page for [your locale]" the svn commit command will commit your changes directly to the mozilla svn repositories.
...And 2 more matches
Localization sign-off reviews
this article presents an overview of why we do sign-off reviews of localizations, the details on the criteria used for the sign-off reviews, and the process for requesting a review and for following its progress.
... allows us to understand how each l10n team is performing their localization work.
... allows us to discover potential bugs within l10n tools.
...And 2 more matches
Basics
this demo has been made to illustrate the following aspects.
...notice how the mathematics appear in the main flow of text and respond as you resize the window.
... you can also make displayed equations, such as the following ones: x → maps to y = f n ⁡ ( x ) = ( 1 + 1 x n ) n ∫ a b f ( x ) d x = b - a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] - ( b - a ) 5 4 !
...And 2 more matches
Fonts for Mozilla's MathML engine
installation instructions windows install the latin modern math and stix fonts as follows: download latinmodern-math-1959.zip.
... os x install the latin modern math and stix fonts as follows: download latinmodern-math-1959.zip.
... on debian/ubuntu/mint and other debian-based distributions, use the following command: sudo apt-get install fonts-lmodern fonts-stix on fedora and other fedora-based distributions, use the following command (stix-math-fonts is often already installed): sudo dnf install texlive-lm-math stix-math-fonts on opensuse and other opensuse-based distributions, use the following command: sudo zypper install texlive-lm-math stix-fonts on other linux distributions, consider i...
...And 2 more matches
Mozilla Web Developer FAQ
lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg.
... style sheet processing instructions are only allowed in the prolog of xml documents.
...for example, the existence of document.getelementbyid() can be checked as follows: if(document.getelementbyid) { /* code that uses document.getelementbyid() */ } why doesn’t mozilla display my alt tooltips?
...And 2 more matches
TraceMalloc
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.
...this file can be post-processed by tools in mozilla/tools/trace-malloc as follows: histogram.pl, which produces a type histogram that can be diffed with histogram-diff.sh to produce output that looks like this: ---- base ---- ---- incr ---- ----- difference ---- type count bytes count bytes count bytes %total total 48942 4754774 76136 6566453 27194 1811679 100.00 nstokenallocator 17 110007 60 3...
... also, your javascript can call the following dom window methods: tracemallocdisable() - turn off tracing, first flushing any buffered log events for all log files.
...And 2 more matches
Profile Manager
additionally, you can manually add firefox versions by clicking the "manage firefox versions..." button: each firefox version in the list has the following properties: path, version, and default.
... a dialog will appear that allows you to specify the profile's name, and optionally the profile's path, and the version of firefox (or other application) that will be used with this profile: launching firefox with a profile to launch firefox with a specific profile, select the profile in the main window, and hit the "start firefox" button: firefox will be launched with that profile, and profile manager will terminate.
... other operations context-clicking any profile in the profile list will cause a popup menu to appear with the following commands: copy - makes a copy of the profile using a name and location of your choice.
...And 2 more matches
About NSPR
it strives to not export the lowest common denominator, but to exploit the best features of each operating system on which it runs, and still provide a uniform service across a wide range of host offerings.
... i/o nspr's i/o is a slightly augmented bsd sockets model that allows arbitrary layering.
...while the object is not declared as opaque, the api provides methods that allow and encourage clients to treat the addresses as polymorphic items.
...And 2 more matches
PR_InitializeNetAddr
syntax #include <prnetdb.h> prstatus pr_initializenetaddr( prnetaddrvalue val, pruint16 port, prnetaddr *addr); parameters the function has the following parameters: val the value to be assigned to the ip address portion of the network address.
... returns the function returns one of the following values: if successful, pr_success.
... description pr_initializenetaddr allows the assignment of special network address values and the port number, while also setting the state that indicates the version of the address being used.
...And 2 more matches
NSS Key Log Format
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.
...secrets follow the format <label> <space> <clientrandom> <space> <secret> where: <label> describes the following secret.
... <secret> depends on the label (see below).
...And 2 more matches
NSS 3.15.2 release notes
the bug fixes in nss 3.15.2 are described in the "bugs fixed" section below.
... distribution information nss 3.15.2 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_2_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.2.
...specifically, the following cipher suites are now supported: tls_ecdhe_ecdsa_with_aes_128_gcm_sha256 tls_ecdhe_rsa_with_aes_128_gcm_sha256 tls_dhe_rsa_with_aes_128_gcm_sha256 tls_rsa_with_aes_128_gcm_sha256 new functions pk11_cipherfinal has been introduced, which is a simple alias for pk11_digestfinal.
...And 2 more matches
NSS 3.16.3 release notes
the bug fixes in nss 3.16.3 are described in the "bugs fixed" section below.
...nss 3.16.3 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_3_rtm/src/ new in nss 3.16.3 this release consists primarily of ca certificate changes as listed below, and fixes an issue with a recently added utility function.
... notable changes in nss 3.16.3 the following 1024-bit ca certificates were removed cn = entrust.net secure server certification authority sha1 fingerprint: 99:a6:9b:e6:1a:fe:88:6b:4d:2b:82:00:7c:b8:54:fc:31:7e:15:39 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 ou = valicert class 1 policy validation authority sha1 fingerprint: e5:df:74:3c:b6:01:c4:9b:98:43:dc:ab:8c:e8:6a:81:10:9f:e4:8e ou...
...And 2 more matches
NSS sources building testing
create a new directory on your computer that you will use as your local work area, and run the following commands.
...the subdirectories dbm, security/dbm, security/coreconf, security/nss were part of the nss sources.) the nss directory contains the following important subdirectories: nss/coreconf contains knowledge for cross platform building.
...any c function that isn't contained in .def files is strictly for private use within nss, and applications and test tools are not allowed to call them.
...And 2 more matches
nss tech note7
data types nss uses the following data types to represent keys: seckeypublickey: a public key, defined in "keythi.h".
...to prevent denial-of-service attacks with huge public keys, nss disallows modulus size greater than 8192 bits.
...here is the asn.1 type definition: rsapublickey ::= sequence { modulus integer, -- n publicexponent integer -- e } the following sample code (error handling omitted for brevity) encodes a rsapublickey from a modulus and a public exponent and imports the public key into nss.
...And 2 more matches
PKCS #11 Module Specs
pkcs #11 module specs the following is a proposal to the pkcs #11 working group made in august 2001 for configuring pkcs #11 modules.
... recognized names all applications/libraries must be able recognize the following name values: library this specifies the path to the pkcs #11 library.
... parameter this specifies a pkcs #11 library parameter with the application must pass to the pkcs #11 library at c_initialize() time (see below).
...And 2 more matches
ssltyp.html
when an application makes a copy of a particular certificate structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
...if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems.
... syntax #include <seccomon.h> typedef enum { secwouldblock = -2, secfailure = -1, secsuccess = 0 } secstatus; enumerators the enum includes the following enumerators: secwouldblock reserved for internal use.
...And 2 more matches
Rebranding SpiderMonkey (1.8.5)
after installing the build pre-requisites and downloading the spidermonkey source tarball issue the following commands at the terminal: cd js/src autoconf-2.13 for the remainder of this document wherever you see the text $brand you will substitute that text with the name of your brand.
...in the unix world we would issue the following command: find ./ -type f -exec sed -i "s/mozjs185/$brand/" {} \; windows users: notepad++ can be used to perform the recursive find and replace text operation.
...it also allows these instructions to apply to a wide range platforms without introducing more software dependencies.
...And 2 more matches
64-bit Compatibility
the following types or typedefs are always 64-bit on 64-bit platforms, and 32-bit on 32-bit platforms: pointers uintptr_t, intptr_t, ptrdiff_t, (probably) size_t jsval jsuword, jsword length of a string, though the actual length cannot exceed 30 bits jsuintptr, jsintptr, jsptrdiff, jsuptrdiff, jssize, jsuword, jsword (let's not use these, kthx) the following types are 32-bit on 32-bit platforms.
...mucking with native integers in lir the following opcodes can be used to safely load, modify, and compare native integers.
...the following table contains the most relevant opcodes: platform alias 32-bit op 64-bit op ldp ld ldq ldcp ldc ldcq piadd add qiadd piand and qiand pilsh lsh qilsh pirsh rsh qirsh pursh ush qursh pcmov cmov qcmov pior or qior pxor xor qxor addp iaddp qaddp peq - puge eq - uge qeq - quge pcall icall qcall the 32-bit versions have the following i...
...And 2 more matches
Tracing JIT
the tracing jit in spidermonkey consists of a generic, low level component called nanojit which is co-maintained between adobe and mozilla, and a spidermonkey-specific high level component called jstracer.
... 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.
...in this way the assembler can "patch together" multiple fragments, so that program control can flow from one fragment into another, or back out of generated code and into the interpreter.
...And 2 more matches
SpiderMonkey 1.8.8
it also contains new language and api features described in detail below.
...migrating to spidermonkey 1.8.8 the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
...And 2 more matches
SpiderMonkey 17
it also contains new language and api features described in detail below.
...migrating to spidermonkey 17 the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
...And 2 more matches
Signing Mozilla apps for Mac OS X
once you have that you can do the following to create your id: open the developer certificate utility.
... click "create" and follow the instructions in the wizard.
...these types of accounts only allow for the "agent" role to create developer ids.
...And 2 more matches
XPCOM changes in Gecko 2.0
documentation will be updated as time allows to remove references to interfaces being "frozen" or "unfrozen." component registration the way xpcom components are registered changed in gecko 2.
...}; // the following line is what xpcom uses to create components.
...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.
...And 2 more matches
Packaging WebLock
the following sections describe the steps you can take to organize the weblock component for distribution and installation.
... the sample installation script shown below uses the mozilla xpinstall technology to manipulate an installer and talk to mozilla'schrome registry as high-level javascript objects.
... once you have the component and the other resources for weblock packaged properly (see the following section, archiving resources), the installation script for weblock is a simple one (see the weblock installation script).
...And 2 more matches
Preface
accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work.
...though you can create xpcom components in javascript and other languages, and though you might be able to follow along as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component starts from c++.
... organization of the tutorial the following list provides an overview of the steps that we will take to build an xpcom component called weblock, which provides site blocking functionality to gecko-based browsers.
...And 2 more matches
XPCShell Reference
-v version this allows you to specify a specific version of js to use, and should be set to an integral value specified by the jsversion enumerated type.
... -w (lower case) this option turns on javascript warnings.
... 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.
...And 2 more matches
Language bindings
in order to allow any other language to use the xpcom api, a bridging layer is required.
... the following bridging layers are currently available: components objectthe components object is the object through which xpconnect functionality is reflected into javascript.
...ess (boostrapped) extensions, so that you can unload an old version of a code module when a new version of your add-on is installed.components.utils.unwaivexraysundo a previous call to components.utils.waivexrays(), restoring xray vision for the caller.components.utils.waivexrayswaives xray vision for an object, giving the caller a transparent wrapper to the underlying object.javaxpcomjavaxpcom allows for communication between java and xpcom, such that a java application can access xpcom objects, and xpcom can access any java class that implements an xpcom interface.
...And 2 more matches
nsIAccessible
nsiaccessible.role to get the role of the accessible nsiaccessible.getstate() to get states of the accessibe nsiaccessible.name, nsiaccessible.value to get the name and the value of the accessible tree navigation you can navigate through the accessible tree by the following methods and attributes.
...the following methods are intended for this nsiaccessible.actioncount, nsiaccessible.getactionname(), nsiaccessible.getactiondescription() and nsiaccessible.doaction().
...following methods are used to get them nsiaccessible.defaultkeybinding(), nsiaccessible.getkeybindings(), nsiaccessible.keyboardshortcut.
...And 2 more matches
nsIMemoryReporter
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) any piece of code that wishes to allow its memory use to be monitored may create an nsimemoryreporter object and then register it by calling nsimemoryreportermanager.registerreporter().
... kind print32 the memory kind, one of the memory reporter kind constants below.
...paths are delimited with '/' characters to allow a hierarchy of memory to be displayed in about:memory.
...And 2 more matches
nsIMsgFolder
ed long numfolders); nsisupportsarray getallfolderswithflag(in unsigned long aflag); void getexpansionarray(in nsisupportsarray expansionarray); acstring geturiformsg(in nsimsgdbhdr msghdr); void deletemessages(in nsisupportsarray messages,in nsimsgwindow msgwindow, in boolean deletestorage, in boolean ismove, in nsimsgcopyservicelistener listener, in boolean allowundo); void copymessages(in nsimsgfolder srcfolder, in nsisupportsarray messages,in boolean ismove, in nsimsgwindow msgwindow,in nsimsgcopyservicelistener listener, in boolean isfolder, in boolean allowundo); void copyfolder(in nsimsgfolder srcfolder, in boolean ismovefolder,in nsimsgwindow msgwindow, in nsimsgcopyservicelistener listener ); void copyfilemessage(in nsifi...
... invfeditsearchscope boolean readonly customidentity nsimsgidentity readonly: this allows a folder to have a special identity.
... knowssearchnntpextension boolean readonly allowsposting boolean readonly relativepathname acstring readonly sizeondisk unsigned long size of this folder on disk (not including .msf file) for imap, it's the sum of the size of the messages.
...And 2 more matches
nsIMutableArray
index the position in the array: if the position is lower than the current length of the array, the elements at that position and onwards are bumped one position up.
...an index lower than 0 or higher than the current length of the array is invalid and will be ignored.
...if the position is lower than the current length of the array, an existing element will be replaced.
...And 2 more matches
nsIParentalControlsService
toolkit/components/parentalcontrols/public/nsiparentalcontrolsservice.idlscriptable this interface provides access to the operating system's parental controls feature, allowing code to detect whether such a service is enabled and to request overrides to bypass the feature.
...see the constants for allowed values.
... aflag pass true if the event was blocked or false if it was allowed.
...And 2 more matches
nsIPrincipal
wn 2 enable_with_user_permission 3 enable_granted 4 methods native code only!canenablecapability short canenablecapability( in string capability ); parameters capability missing description return value missing description exceptions thrown missing exception missing description checkmayload() checks whether this principal is allowed to load the network resource located at the given uri under the same-origin policy.
... this means that codebase principals are only allowed to load resources from the same domain, the system principal is allowed to load anything, and null principals are not allowed to load anything.
...if the load is allowed this function does nothing.
...And 2 more matches
nsISHistoryListener
return value true to allow the go back operation to proceed or false to cancel it.
... return value true to allow the go forward operation to proceed or false to cancel it.
... return value true to allow the operation to proceed or false to cancel it.
...And 2 more matches
nsISelection2
method overview void getrangesforinterval(in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out nsidomrange results); void getrangesforintervalcomarray(in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results); native code only!
... void getrangesforinterval( in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out nsidomrange results ); parameters beginnode beginoffset endnode endoffset these four parameters represent the range to compare against the selection.
... allowadjacent specifies whether the returned ranges are allowed to touch the input range rather than merely overlapping it.
...And 2 more matches
nsISupportsPriority
following unix conventions, smaller (and possibly negative) values have higher priority.
...in some cases, changing the priority of an object may be disallowed (resulting in an exception being thrown) or may simply be ignored.
...priority_lowest.
...And 2 more matches
nsITelemetry
toolkit/components/telemetry/nsitelemetry.idlscriptable a service to gather performance data that can be tracked over time to allow generating histograms.
... canrecordextended boolean a flag indicating if telemetry is allowed to record extended data.
...{ 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.
...And 2 more matches
nsITraceableChannel
netwerk/base/public/nsitraceablechannel.idlscriptable this interface is used to allow intercepting of http traffic.
... 1.0 66 introduced gecko 1.9.0.4 inherits from: nsisupports last changed in gecko 1.9.0.4 the typical way to use this interface is as follows: register for the "http-on-examine-response" notification to track all http responses; skip redirects (responsestatus = 3xx on nsihttpchannel), since otherwise you may end up with two listeners registered for a channel; qi the channel passed as the "subject" to your observer to nsitraceablechannel, and replace the default nsistreamlistener (that passes the data to the original requester - e.g.
... to xmlhttprequest or to the browser tab that made the request) with your own implementation (see "implementing nsistreamlistener" below).
...And 2 more matches
nsIURI
netwerk/base/public/nsiuri.idlscriptable this is an interface for an uniform resource identifier with internationalization support, offering attributes that allow setting and querying the basic components of a uri, and methods for performing basic operations on uris.
... inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) see the following rfcs for details: rfc3490: internationalizing domain names in applications (idna) rfc3986: uniform resource identifier (uri): generic syntax rfc3987: internationalized resource identifiers subclasses of nsiuri, such as nsiurl, impose further structure on the uri.
...follows the idna draft specification for converting internationalized domain names (utf-8) to ascii for compatibility with existing internet infrastructure.
...And 2 more matches
nsIWebProgressListener
(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.
...the degree of security is expressed by state_secure_high, state_secure_med, or state_secure_low.
... state_secure_low 0x00020000 this flag indicates a low degree of security.
...And 2 more matches
nsIXPConnect
xt, in jsobjectptr ajsobj, in nsiidref aiid, [iid_is(aiid),retval] out nsqiresult result); nsixpconnectjsobjectholder wrapnative(in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, in nsiidref aiid); void wrapnativetojsval(in jscontextptr ajscontext, in jsobjectptr ascope, in nsisupports acomobj, in nswrappercacheptr acache, in nsiidptr aiid, in boolean aallowwrapper, out jsval aval, out nsixpconnectjsobjectholder aholder); attributes attribute type description collectgarbageonmainthreadonly prbool obsolete since gecko 1.9 currentjsstack nsistackframe read only.
...the object will be set up according to the flags (defined below).
... aflags one of the flags below specifying what options this global object wants.
...And 2 more matches
Using the clipboard
the clipboard model in mozilla requires you to perform the following steps to copy data: create an xpcom wrapper for the data which you want to put on the clipboard.
...this allows the clipboard to be used by another application right away.
... the following boilerplate utility functions will be used in all later code examples.
...And 2 more matches
Mail and RDF
this allows exposure of mailnews-specific data to user interface using rdf templates.
...from this resource, you can follow a number of arcs to find servers, folders, and finally messages.
...this allows each template-based widget to maintain view/window-specific data with each datasource.
...And 2 more matches
Working with windows in chrome code
to overcome this difficulty, you can move the initialization code to a load handler of the window being opened or pass a callback function, as described below.
... the following two subsections describe how to cross chrome-content boundaries in either way, i.e.
...this can be done using the following statement: var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(com...
...And 2 more matches
Drawing and Event Handling - Plugins
the window field holds a platform-specific handle to a drawable, as follows: windows: hdc mac os: pointer to np_port structure.
...see below.) in both cases, the drawable can be an off-screen pixmap.
...processes that apply to only one of these plug-in types are described in the following sections.
...And 2 more matches
Streams - Plugins
the browser can create a stream for several different types of data: for the file specified in the data attribute of the object element or the src attribute of the embed element for a data file for a full-page instance the npp_newstream method has the following syntax: nperror npp_newstream(npp instance, npmimetype type, npstream *stream, npbool seekable, uint16* stype); the instance parameter refers to the plug-in instance receiving the stream; the type parameter represents the stream's mime type.
...this function allows the browser to send only as much data to the instance as it can handle at one time, and it helps both the browser and the plug-in to use their resources efficiently.
... the npn_requestread method has the following syntax: nperror npn_requestread(npstream *stream, npbyterange *rangelist); the stream parameter is the stream from which to read bytes; the rangelist parameter specifies the range of bytes in the form of a linked list of npbyterange objects, which the plug-in must allocate.
...And 2 more matches
URLs - Plugins
the table below summarizes urls supported by gecko.
... javascript executes javascript code that follows the url.
...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.
...And 2 more matches
Browser Console - Firefox Developer Tools
beginning with firefox 68, the browser console allows you to show or hide messages from the content process (i.e.
...the following image shows the browser console focused on the same page as above after clicking on the show content messages checkbox.
...below is an example of how to access it, which adds a message to the browser console.
...And 2 more matches
Frame rate - Firefox Developer Tools
a low or inconsistent frame rate can make a site appear unresponsive or janky, making for a bad user experience.
...frame rate is most obviously applicable to animations: if the frame rate is too low, an animation will have a jerky appearance, while a faster frame rate will be smoother.
... for example, if moving the mouse over some page element triggers some javascript that changes the element's appearance, and that triggers a reflow and a repaint, then all this work needs to be completed in that frame.
...And 2 more matches
Responsive Design Mode - Firefox Developer Tools
on the right end of the screen, three buttons allow you to: camera button - take a screenshot settings button - opens the rdm settings menu close button - closes rdm mode and returns to regular browsing the settings menu includes the following commands: left-align viewport - when checked moves the rdm viewport to the left side of the browser window show user agent - when checked displays the user agent string the final two options de...
...select a device, and responsive design mode sets the following properties to match the selected device: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch event simulation additionally, firefox sets the user-agent http request header to identify itself as the default browser on the selected device.
...you can also define a custom device, as described below.
...And 2 more matches
The JavaScript input interpreter - Firefox Developer Tools
the expression you type is echoed under the input prompt, followed by the result.
...the snippet is echoed under the input prompt (in the right-side pane), followed by the result.
... starting in firefox 76, if the code snippet is more than five lines long, only the first five lines are echoed in the console, preceeded by a disclosure triangle (or "twistie"), and followed by an ellipsis (…).
...And 2 more matches
AudioNode.connect() - Web APIs
WebAPIAudioNodeconnect
this is allowed only if there is at least one delaynode in the cycle.
...this parameter is not allowed if the destination is an audioparam.
... return value if the destination is a node, connect() returns a reference to the destination audionode object, allowing you to chain multiple connect() calls.
...And 2 more matches
AudioParam - Web APIs
an audioparam can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern.
...this list of events allows us to schedule changes that have to happen at very precise times, using arbitrary timelime-based automation curves.
...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.
...And 2 more matches
Pixel manipulation with canvas - Web APIs
it contains the following read-only attributes: width the width of the image in pixels.
... for example, to read the blue component's value from the pixel at column 200, row 50 in the image, you would do the following: bluecomponent = imagedata.data[((50 * (imagedata.width * 4)) + (200 * 4)) + 2]; if given a set of coordinates (x and y), you may end up doing something like this: var xcoord = 50; var ycoord = 100; var canvaswidth = 1024; function getcolorindicesforcoord(x, y, width) { var red = y * (width * 4) + x * 4; return [red, red + 1, red + 2, red + 3]; } var colorindices = getcolorindicesforc...
... for example, to paint the entire image represented by myimagedata to the top left corner of the context, you can simply do the following: ctx.putimagedata(myimagedata, 0, 0); grayscaling and inverting colors in this example we iterate over all pixels to change their values, then we put the modified pixel array back to the canvas using putimagedata().
...And 2 more matches
Using images - Web APIs
getting images to draw the canvas api is able to use any of the following data types as an image source: htmlimageelement these are images created using the image() constructor, as well as any <img> element.
...data urls allow you to completely define an image as a base64 encoded string of characters directly in your code.
... example: a simple line graph in the following example, we will use an external image as the backdrop for a small line graph.
...And 2 more matches
Constraint validation API - Web APIs
concepts and usage certain html form controls, such as <input>, <select> and <textarea>, can restrict the format of allowable values, using attributes like required and pattern to set basic constraints.
... extensions to other interfaces the constraint validation api extends the interfaces for the form-associated elements listed below with a number of new properties and methods (elements that can have a form attribute that indicates their form owner): htmlbuttonelement htmlfieldsetelement htmlinputelement htmlobjectelement htmloutputelement htmlselectelement htmltextareaelement properties validity a read-only property that returns a validitystate object, whose properties represent validation errors for the value...
... examples take the following form: <form> <label for="name">enter username (upper and lowercase letters): </label> <input type="text" name="name" id="name" required pattern="[a-za-z]+"> <button>submit</button> </form> the basic html form validation features will cause this to produce a default error message if you try to submit the form with either no valid filled in, or a value that does not match the pattern.
...And 2 more matches
DisplayMediaStreamConstraints.video - Web APIs
syntax displaymediastreamconstraints.video = allowvideoflag; displaymediastreamconstraints.video = mediatrackconstraints; displaymediastreamconstraints = { video: allowvideoflag | mediatrackconstraints; } value the value may be either a boolean or a mediatrackconstraints object.
...the value may be a single one of the following strings, or an array of them to allow the browser flexibility in deciding what to do about the cursor.
...this may be a single one of the following strings, or a list of them to allow multiple source surfaces: application the stream contains all of the windows of the application chosen by the user rendered into the one video track.
...And 2 more matches
Examples of web and XML development using the DOM - Web APIs
example 1: height and width the following example shows the use of the height and width properties alongside images of varying dimensions: <!doctype html> <html lang="en"> <head> <title>width/height example</title> <script> function init() { var arrimages = new array(3); arrimages[0] = document.getelementbyid("image1"); arrimages[1] = document.getelementbyid("image2"); arrimages[2] = document.getelementbyid("image3"); var objoutput = document.getelementbyid("output"); var strhtml = "<ul>"; for (var i = 0; i < arrimages.length; i++) { strhtml += "<li>image" +...
... var ss = document.stylesheets; for(var i = 0; i < ss.length; i++) { for(var j = 0; j < ss[i].cssrules.length; j++) { dump( ss[i].cssrules[j].selectortext + "\n" ); } } for a document with a single stylesheet in which the following three rules are defined: body { background-color: darkblue; } p { font-face: arial; font-size: 10pt; margin-left: .125in; } #lumpy { display: none; } this script outputs the following: body p #lumpy example 5: event propagation this example demonstrates how events fire and are handled in the dom in a very simple way.
... getcomputedstyle() returns a computedcssstyledeclaration object, whose individual style properties can be referenced with this object's getpropertyvalue() method, as the following example document shows.
...And 2 more matches
EffectTiming.fill - Web APIs
WebAPIEffectTimingfill
see the alternatives to fill modes section below for approaches that are simpler and more performant.
...below that, another <div> serves as a button that will trigger the animation to begin.
... result below we see what the result looks like.
...And 2 more matches
Event.preventDefault() - Web APIs
as noted below, calling preventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect.
...<code>preventdefault()</code> won't let you check this!<br>"; event.preventdefault(); }, false); html <p>please click on the checkbox control.</p> <form> <label for="id-checkbox">checkbox:</label> <input type="checkbox" id="id-checkbox"/> </form> <div id="output-box"></div> result stopping keystrokes from reaching an edit field the following example demonstrates how invalid text input can be stopped from reaching the input field with preventdefault().
... html here's the form: <div class="container"> <p>please enter your name using lowercase letters only.</p> <form> <input type="text" id="my-textbox"> </form> </div> css we use a little bit of css for the warning box we'll draw when the user presses an invalid key: .warning { border: 2px solid #f39389; border-radius: 2px; padding: 10px; position: absolute; background-color: #fbd8d4; color: #3b3c40; } javascript and here's the javascript code that does the job.
...And 2 more matches
Fetch API - Web APIs
WebAPIFetch API
this will allow them to be used wherever they are needed in the future, whether it’s for service workers, cache api, and other similar things that handle or modify requests and responses, or any kind of use case that might require you to generate your responses programmatically (that is, the use of computer program or personal programming instructions).
...the following browsers shipped and outdated native fetch, and were updated in these versions: firefox version 61.0b13.
... aborting a fetch browsers have started to add experimental support for the abortcontroller and abortsignal interfaces (aka the abort api), which allow operations like fetch and xhr to be aborted if they have not already completed.
...And 2 more matches
FileHandle API - Web APIs
the filehandle api allows for the manipulating of files, including creating files and modifying their content (unlike the file api).
... api overview this api is based on the following interfaces: idbdatabase.mozcreatefilehandle (was called idbdatabase.mozcreatefilehandle.) idbmutablefile (was previously filehandle.) lockedfile filerequest it also has connections with the file api, especially the file and blob interfaces.
... basic operations create a filehandle because the intent is to allow the storage of files through indexeddb, creating a filehandle instance requires an indexeddb database.
...And 2 more matches
HTMLButtonElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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>...
...this is an enumerated attribute with the following possible values: submit: the button submits the form.
... recommendation the following attribute has been added: menu.
...And 2 more matches
HTMLHyperlinkElementUtils - Web APIs
these utilities allow to deal with common features like urls.
... htmlhyperlinkelementutils.href this a stringifier property that returns a usvstring containing the whole url, and allows the href to be updated.
... htmlhyperlinkelementutils.pathname this is a usvstring containing an initial '/' followed by the path of the url.
...And 2 more matches
HTMLSelectElement.add() - Web APIs
examples creating elements from scratch var sel = document.createelement("select"); var opt1 = document.createelement("option"); var opt2 = document.createelement("option"); opt1.value = "1"; opt1.text = "option: value 1"; opt2.value = "2"; opt2.text = "option: value 2"; sel.add(opt1, null); sel.add(opt2, null); /* produces the following, conceptually: <select> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> */ the before parameter is optional.
... so the following is accepted.
... append to an existing collection var sel = document.getelementbyid("existinglist"); var opt = document.createelement("option"); opt.value = "3"; opt.text = "option: value 3"; sel.add(opt, null); /* takes the existing following select object: <select id="existinglist"> <option value="1">option: value 1</option> <option value="2">option: value 2</option> </select> and changes it to: <select id="existinglist"> <option value="1">option: value 1</option> <option value="2">option: value 2</option> <option value="3">option: value 3</option> </select> */ the before parameter is optional.
...And 2 more matches
File drag and drop - Web APIs
these steps are described below, including example code snippets.
...the following code snippet shows how this is done with a <div> element: <div id="drop_zone" ondrop="drophandler(event);"> <p>drag one or more files to this drop zone ...</p> </div> typically, an application will include a dragover event handler on the drop target element and that handler will turn off the browser's default drag behavior.
...in this example, the drop target element uses the following styling: #drop_zone { border: 5px solid blue; width: 200px; height: 100px; } note that dragstart and dragend events are not fired when dragging a file into the browser from the os.
...And 2 more matches
Dragging and Dropping Multiple Items - Web APIs
setting and getting with indices the mozsetdataat() method allows you to add multiple items during a dragstart event.
...to reject the items, either don't cancel the dragover event, or set the effectallowed property to none.
...the following example retrieves a set of files being dragged and adds them to an array.
...And 2 more matches
Headers - Web APIs
WebAPIHeaders
the headers interface of the fetch api allows you to perform various actions on http request and response headers.
... headers.entries() returns an iterator allowing to go through all key/value pairs contained in this object.
... headers.keys() returns an iterator allowing you to go through all keys of the key/value pairs contained in this object.
...And 2 more matches
Working with the History API - Web APIs
example of pushstate() method suppose http://mozilla.org/foo.html executes the following javascript: let stateobj = { foo: "bar", } history.pushstate(stateobj, "page 2", "bar.html") this will cause the url bar to display http://mozilla.org/bar.html, but won't cause the browser to load bar.html or even check that bar.html exists.
...this allows a wider variety of objects to be safely passed.
...this allows a wider variety of objects to be safely passed.
...And 2 more matches
IDBDatabaseSync - Web APIs
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 database.
... exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if an object store with the given name (based on case-sensitive comparison) already exists in the connected database.
... returns void exceptions this method can raise an idbdatabaseexception with the following code: not_found_err if the object store with the given name (based on case-sensitive comparison) does not exist in the connected database.
...And 2 more matches
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.
... 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.
... example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
...And 2 more matches
LocalFileSystem - Web APIs
so to request storage, you need to do something like the following: var requestedbytes = 1024*1024*10; // 10mb navigator.webkitpersistentstorage.requestquota ( requestedbytes, function(grantedbytes) { window.requestfilesystem(persistent, grantedbytes, oninitfs, errorhandler); }, function(e) { console.log('error', e); } ); your user must grant your app permission to store data locally before your app can use persistent storage.
...to learn more, see this stackoverflow answer.
... example the following is a code snippet that shows how you can request a file system storage.
...And 2 more matches
MediaStream Image Capture API - Web APIs
in addition to capturing data, it also allows you to retrieve information about device capabilities such as image size, red-eye reduction and whether or not there is a flash and what they are currently set to.
... conversely, the api allows the capabilities to be configured within the constraints what the device allows.
... mediastream image capture concepts and usage the process of retrieving an image or video stream happens as described below.
...And 2 more matches
Capabilities, constraints, and settings - Web APIs
you can specify one or more media input device ids to establish restrictions on which input sources are allowed.
... getting the constraints in effect if at any time you need to fetch the set of constraints that are currently applied to the media, you can get that information by calling mediastreamtrack.getconstraints(), as shown in the example below.
... below all of that, you'll see the video itself.</p> <p>click the "start" button to begin.</p> <h3>constrainable properties available:</h3> <ul id="supportedconstraints"> </ul> <div id="startbutton" class="button"> start </div> <div class="wrapper"> <div class="trackrow"> <div class="leftside"> <h3>requested video constraints:</h3> <textarea id="videoconstrainteditor" cols=32 rows=8...
...And 2 more matches
Navigator.sendBeacon() - Web APIs
historically, this was addressed with some of the following workarounds to delay the page unload long enough to send data to some url: submitting the data with a blocking synchronous xmlhttprequest call in unload or beforeunload event handlers.
... all of these methods block unloading the document, which slows down the next navigation.
... there is nothing the next page can do to avoid this, so the new page seems slow, even though it's the previous page's fault.
...And 2 more matches
PaymentAddress - Web APIs
obsolete properties the following properties are obsolete and should no longer be used, but may still be present in some browser versions.
... examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options.
... the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary.
...And 2 more matches
Payment Request API - Web APIs
the browser can automatically suggest which card to use based on past usage patterns or restrictions from the merchant (e.g, "we only accept visa or mastercard"), or allow the user to say which is their default/favorite card.
...the paymentrequest allows the web page to exchange information with the user agent while the user provides input to complete the transaction.
... note: the api is available inside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them.
...And 2 more matches
Pointer Lock API - Web APIs
more than that, the api is useful for any applications that require significant mouse input to control movements, rotate objects, and change entries, for example allowing users to control the viewing angle simply by moving the mouse around without any button clicking.
...pointer lock is different from mouse capture in the following ways: it is persistent: pointer lock does not release the mouse until an explicit api call is made or the user uses a specific release gesture.
...ent === canvas || document.mozpointerlockelement === canvas) { console.log('the pointer lock status is now locked'); } else { console.log('the pointer lock status is now unlocked'); } the document.exitpointerlock() method is used to exit pointer lock, and like requestpointerlock, works asynchronously using the pointerlockchange and pointerlockerror events, which you'll see more about below.
...And 2 more matches
Multi-touch interaction - Web APIs
// log events flag var logevents = false; // event caches, one per touch target var evcache1 = new array(); var evcache2 = new array(); var evcache3 = new array(); register event handlers event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup.
...e me 2</div> <div id="target3"> tap, hold or swipe me 3</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved with the event flow.
...is event in the target's cache var cache = get_cache(ev); cache.push(ev); } function remove_event(ev) { // remove this event from the target's cache var cache = get_cache(ev); for (var i = 0; i < cache.length; i++) { if (cache[i].pointerid == ev.pointerid) { cache.splice(i, 1); break; } } } update background color the background color of the touch areas will change as follows: no active touches is white; one active touch is yellow; two simultaneous touches is ping and three or more simultaneous touches is lightblue.
...And 2 more matches
RTCPeerConnection.addIceCandidate() - Web APIs
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.
...the parameters for this form of addicecandidate() are described below, to aid in updating existing code.
... 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.
...And 2 more matches
Request - Web APIs
WebAPIRequest
it may be one of follow, error, or manual.
... request implements body, so it also inherits the following properties: body read only a simple getter used to expose a readablestream of the body contents.
... request implements body, so it also has the following methods available to it: body.arraybuffer() returns a promise that resolves with an arraybuffer representation of the request body.
...And 2 more matches
Using the Resource Timing API - Web APIs
timing resource loading phases the following example illustrates using the resource timing properties to calculate the amount of time the following phases take: redirection (redirectstart and redirectend ), dns lookup (domainlookupstart and domainlookupend), tcp handshake (connectstart and connectend), and response (responsestart and responseend).
... the following example demonstrates using these three properties.
... the following example demonstrates the usage of these two methods.
...And 2 more matches
Using readable streams - Web APIs
consuming a fetch as a stream the fetch api allows you to fetch resources across the network, providing a modern alternative to xhr.
... you keep running the function recursively until there is no more stream to read, in which case step 2 is followed.
...the readablestream() constructor allows you to do this via a syntax that looks complex at first, but actually isn’t too bad.
...And 2 more matches
Streams API - Web APIs
the streams api allows javascript to programmatically access streams of data received over the network and process them as desired by the developer.
... readablestreamdefaultcontroller represents a controller allowing control of a readablestream's state and internal queue.
... writablestreamdefaultcontroller represents a controller allowing control of a writablestream's state.
...And 2 more matches
Multi-touch interaction - Web APIs
example this example demonstrates using the touchstart, touchmove, touchcancel, and touchend) touch events for the following gestures: single touch, two (simultaneous) touches, more than two simultaneous touches, 1-finger swipe, and 2-finger move/pinch/swipe.
..., hold or swipe me 3</div> <div id="target4"> tap, hold or swipe me 4</div> <!-- ui for logging/bebugging --> <button id="log" onclick="enablelog(event);">start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> miscellaneous functions these functions support the application but aren't directly involved with the event flow.
... update background color the background color of the touch areas will change as follows: no touch is white; one touch is yellow; two simultaneous touches is pink, and three or more simultaneous touches is lightblue.
...And 2 more matches
URL - Web APIs
WebAPIURL
it works by providing properties which allow you to easily read and modify the components of a url.
... properties hash a usvstring containing a '#' followed by the fragment identifier of the url.
... host a usvstring containing the domain (that is the hostname) followed by (if a port was specified) a ':' and the port of the url.
...And 2 more matches
URLSearchParams - Web APIs
an object implementing urlsearchparams can directly be used in a for...of structure, for example the following two lines are equivalent: for (const [key, value] of mysearchparams) {} for (const [key, value] of mysearchparams.entries()) {} note: this feature is available in web workers.
... urlsearchparams.entries() returns an iterator allowing iteration through all key/value pairs contained in this object.
... urlsearchparams.foreach() allows iteration through all values contained in this object via a callback function.
...And 2 more matches
WakeLock.request() - Web APIs
WebAPIWakeLockrequest
the request() method of the wakelock interface returns a promise that resolves with a wakelocksentinel object, which allows control over screen dimming and locking.
... syntax var wakelock = navigator.wakelock.request(type); parameters type options are as follows: 'screen': requests a screen wake lock.
... exceptions notallowederror thrown when wake lock is not available, which can happen because: document is not allowed to use screen wake lock due to screen-wake-lock policy.
...And 2 more matches
WebGLRenderingContext.blendFuncSeparate() - Web APIs
for possible values, see below.
...for possible values, see below.
...for possible values, see below.
...And 2 more matches
WebGLRenderingContext.vertexAttribPointer() - Web APIs
possible values: gl.byte: signed 8-bit integer, with values in [-128, 127] gl.short: signed 16-bit integer, with values in [-32768, 32767] gl.unsigned_byte: unsigned 8-bit integer, with values in [0, 255] gl.unsigned_short: unsigned 16-bit integer, with values in [0, 65535] gl.float: 32-bit ieee floating point number when using a webgl 2 context, the following values are available additionally: gl.half_float: 16-bit ieee floating point number normalized a glboolean specifying whether integer data values should be normalized into a certain range when being cast to a float.
...if stride is 0, the attribute is assumed to be tightly packed, that is, the attributes are not interleaved but each attribute is in a separate block, and the next vertex' attribute follows immediately after the current vertex.
...on high-end graphics cards, the maximum is 16, on lower-end graphics cards, the value will be lower.
...And 2 more matches
WebRTC connectivity - Web APIs
the information we need to exchange is the offer and answer which just contains the sdp mentioned below.
...media begins to flow as configured.
... the pending description (returned by rtcpeerconnection.pendinglocaldescription and rtcpeerconnection.pendingremotedescription) indicates a description which is currently under consideration following a call to setlocaldescription() or setremotedescription(), respectively.
...And 2 more matches
Introduction to WebRTC protocols - Web APIs
ice interactive connectivity establishment (ice) is a framework to allow your web browser to connect with peers.
...it needs to bypass firewalls that would prevent opening connections, give you a unique address if like most situations your device doesn’t have a public ip address, and relay data through a server if your router doesn’t allow you to directly connect with peers.
... ice uses stun and/or turn servers to accomplish this, as described below.
...And 2 more matches
WebRTC API - Web APIs
events bufferedamountlow the amount of data currently buffered by the data channel—as indicated by its bufferedamount property—has decreased to be at or below the channel's minimum buffered data size, as specified by bufferedamountlowthreshold.
... datachannel a new rtcdatachannel is available following the remote peer opening a new data channel.
... negotiationneeded informs the rtcpeerconnection that it needs to perform session negotiation by calling createoffer() followed by setlocaldescription().
...And 2 more matches
Lighting a WebXR setting - Web APIs
ambient light is commonly present simply to prevent shadowed areas from becoming too dark, although it affects the entire scene; however, the amount of ambient light in a scene should be very low.
... ambient light can also be used to apply a color tint to a scene; for example, in a game in which the player has a special pair of yellow-tinted glasses, you can add a yellow ambient light.
... saturn's fifth-largest moon, tethys, bathed in sunlight, coming from the lower left.
...And 2 more matches
Starting up and shutting down a WebXR session - Web APIs
there may be options available to allow you to experiment with webxr even if you don't have a compatible system, however.
... getting the extension download the webxr api emulator for your supported browser below: google chrome mozilla firefox the source code for the extension is also available on github.
... 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.
...And 2 more matches
WebXR Device API - Web APIs
to accomplish these things, the webxr device api provides the following key capabilities: find compatible vr or ar output devices render a 3d scene to the device at an appropriate frame rate (optionally) mirror the output to a 2d display create vectors representing the movements of input controls at the most basic level, a scene is presented in 3d by computing the perspective to apply to the scene in order to render it from the viewpoint of each of the use...
...each view has an offset used to shift the position of the view relative to the camera, in order to allow for creating stereographic effects.
... event interfaces the following interfaces are used to represent the events used by the webxr api.
...And 2 more matches
Keyframe Formats - Web APIs
there are several options to this format, which are explained below.
... the easing to apply between keyframes can be specified by providing an easing value as illustrated below.
... element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
...And 2 more matches
Using IIR filters - Web APIs
it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects.
...for instance, if you want to filter lower frequencies from your sound, you can set the type to highpass and then set which frequency to filter from (or cut off).
...so you can create a highpass filter, or a lowpass filter, or a more bespoke one.
...And 2 more matches
Web Locks API - Web APIs
the web locks api allows scripts running in one tab or worker to asynchronously acquire a lock, hold it while work is performed, then release it.
... while held, no other script executing in the same origin can acquire the same lock, which allows a web app running in multiple tabs or workers to coordinate work and the use of resources.
...for example, if a web app running in multiple tabs wants to ensure that only one tab is syncing data between the network and indexed db, each tab could try to acquire a "my_net_db_sync" lock, but only one tab will succeed (the leader election pattern.) the api is used as follows: the lock is requested.
...And 2 more matches
Synchronous and asynchronous requests - Web APIs
this is done by setting the value of the timeout property on the xmlhttprequest object, as shown in the code below: function loadfile(url, timeout, callback) { var args = array.prototype.slice.call(arguments, 3); var xhr = new xmlhttprequest(); xhr.ontimeout = function () { console.error("the request for " + url + " timed out."); }; xhr.onload = function() { if (xhr.readystate === 4) { if (xhr.status === 200) { callback.apply(xhr, args); ...
...but developers typically don't notice the problem because the hang only manifests with poor network conditions or when the remote server is slow to respond.
... all new xhr features such as timeout or abort are not allowed for synchronous xhr.
...And 2 more matches
ARIA Screen Reader Implementors Guide - Accessibility
the following is intended to provide implementation guidance that respects screen readers developers' need to try different things.
...interpreting wai-aria live region markup live changes are hints: in general live region markup is provided by the author as hints, and the assistive technology may allow for global, site or even region-specific settings, as well as heuristics to help with live changes on pages that have no wai-aria hints.
...text to speech and a braille display), then two queues can be maintained to allow for parallel presentation.
...And 2 more matches
Using the alert role - Accessibility
possible effects on user agents and assistive technology when the alert role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having an alert role in the operating system's accessibility api.
... examples example 1: adding the role in the html code the snippet below shows how the alert role is added directly into the html source code.
...this allows the developer to reiterate information that has become more relevant or urgent to the user.
...And 2 more matches
ARIA: Region role - Accessibility
this label will allow an assitive technology user to be able to quickly understand the purpose of each landmark.
... scrolling content areas with overflow text if there is a content area with tabindex="0", add role="region" to convey to screen reader users that is a generic region.
... this is done to allow keyboard-only users to scroll regions with overflow text.
...And 2 more matches
ARIA: textbox role - Accessibility
the textbox role is used to identify an element that allows the input of free-form text.
...it supports the following values: inline: predicted text is inserted after the caret.
... possible effects on user agents and assistive technology when the textbox role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a textbox role in the operating system's accessibility api.
...And 2 more matches
An overview of accessible web applications and widgets - Accessibility
javascript to update the aria-checked attribute var showtip = function(el) { el.setattribute('aria-hidden', 'false'); } role changes aria allows developers to declare a semantic role for an element that otherwise offers incorrect or no semantics.
... for example, consider an "inline edit" widget: a component that allows users to edit a piece of text in place, without switching contexts.
...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.
...And 2 more matches
Architecture - Accessibility
this allows at's to find its position within that text, because the hyperlink interface exposes a start and end index.
... example take the following html code: <div>hello<a href="http://www.mozilla.org/access">my link<img src="image.gif">is cool</a>bye</div> both the <a> and <img> are hyperlinks also, both the <div> and <a> are hypertexts so the <a> is both a hypertext and a hyperlink, because it contains text and is contained within text.
... navigating to the next word follows a similar pattern.
...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.
...(this is poorly supported by browsers; see the browser compatibility table below.) a combination of the ::before pseudo-element and the content property may inject some text at the beginning of the element.
... allowable properties only a small subset 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...
...And 2 more matches
:visited - CSS: Cascading Style Sheets
WebCSS:visited
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.
...And 2 more matches
range - CSS: Cascading Style Sheets
for each individual range, the first value is the lower bound and the second value is the upper bound.
... a range is inclusive, that means it always contains both, the lower and upper bound numbers.
... if the lower bound of any range is higher than the upper bound, the entire descriptor is invalid and will be ignored.
...And 2 more matches
system - CSS: Cascading Style Sheets
extends allows authors to use the algorithm of another counter style, but alter its other aspects.
..."; } ul { list-style: abc; } result numeric counter with numeric symbols as shown in the following example, if digits from 0 to 9 are specified as symbols, this counter style will render symbols same as the decimal counter style.
...if you need to represent counter values as roman numerals, you could use either one of the predefined counter styles, upper-roman or lower-roman, rather than recreating the rule yourself.
...And 2 more matches
Using multi-column layouts - CSS: Cascading Style Sheets
the css multi-column layout module extends the block layout mode to allow the easy definition of multiple columns of text.
... unfortunately this is impossible to do with css and html without forcing column breaks at fixed positions, or severely restricting the markup allowed in the text, or using heroic scripting.
... in a multi-column block, content is automatically flowed from one column into the next as needed.
...And 2 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
the ie/edge (≤15) version of the specification is prefixed with an -ms prefix and the properties implemented in ie/edge (≤15) are as follows: grid-template-columns as -ms-grid-columns grid-template-rows as -ms-grid-rows grid-row-start as -ms-grid-row grid-column-start as -ms-grid-column align-self as -ms-grid-row-align justify-self as -ms-grid-column-align the ie version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span.
...in the example below, i have a simple media object.
...i am using floats for older browsers and grid for new ones.</div> </div> the image below shows the media object in a non-supporting browser on the left, and a supporting one on the right: using feature queries the above example is very simple, and we can get away without needing to write code that would be a problem to browsers that do not support grid, and legacy code is not an issue to our grid supporting browsers.
...And 2 more matches
Grid template areas - CSS: Cascading Style Sheets
for example, if i wish to create the layout shown below i can identify four main areas.
... grid-template the grid-template property sets the following properties: grid-template-rows grid-template-columns grid-template-areas the property is referred to as the explicit grid shorthand because it is setting those things that you control when you define an explicit grid, and not those which impact any implicit row or column tracks that might be created.
... the following code creates a layout using grid-template that is the same as the layout created earlier in this guide.
...And 2 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
class="box3">three</div> <div class="box4">four</div> </div> .box1 { grid-column-start: 1; grid-row-start: 1; grid-row-end: 4; } .box2 { grid-column-start: 3; grid-row-start: 1; grid-row-end: 3; } .box3 { grid-column-start: 2; grid-row-start: 1; } .box4 { grid-column-start: 2; grid-column-end: 4; grid-row-start: 3; } our shorthand would look like the following code, with no forward slash and second value for the items spanning one track only.
...the order of the values for grid-area are as follows.
...it may help to realize that this is due to grid using the flow-relative directions defined in the css writing modes specification.
...And 2 more matches
CSS selectors - CSS: Cascading Style Sheets
this means that the second element follows the first (though not necessarily immediately), and both share the same parent.
... syntax: a ~ b example: p ~ span will match all <span> elements that follow a <p>, immediately or not.
...this means that the second element directly follows the first, and both share the same parent.
...And 2 more matches
Inline formatting context - CSS: Cascading Style Sheets
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.
...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.
...And 2 more matches
align-self - CSS: Cascading Style Sheets
ign the item flush at the start */ align-self: self-end; /* align the item flush at the end */ align-self: flex-start; /* put the flex item at the start */ align-self: flex-end; /* put the flex item at the end */ /* baseline alignment */ align-self: baseline; align-self: first baseline; align-self: last baseline; align-self: stretch; /* stretch 'auto'-sized items to fit the container */ /* overflow alignment */ align-self: safe center; align-self: unsafe center; /* global values */ align-self: inherit; align-self: initial; align-self: unset; values auto computes to the parent's align-items value.
...if the cross-size of the item is larger than the flex container, it will overflow equally in both directions.
... safe if the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start.
...And 2 more matches
animation - CSS: Cascading Style Sheets
WebCSSanimation
keyframes duration | timing-function | delay | iteration-count | direction | fill-mode | play-state | name */ animation: 3s ease-in 1s 2 reverse both paused slidein; /* @keyframes name | duration | timing-function | delay */ animation: 3s linear 1s slidein; /* @keyframes name | duration */ animation: slidein 3s; <div class="grid"> <div class="col"> <div class="note"> given the following animation: <pre>@keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } }</pre> </div> <div class="row"> <div class="cell"> <button class="play" title="play"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s ease-in 1s 2 reverse both paused slidein;</div> <div class="animation a1"></...
...estart'); } .grid { width: 100%; height: 100%; display: flex; background: #eee; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; justify-content: space-between; } .col { display: flex; flex: 1 auto; flex-direction: column; } .cell { box-sizing: border-box; margin: .5em; padding: 0; background-color: #fff; overflow: hidden; text-align: left; } .flx { flex: 1 0; } .note { background: #fff3d4; padding: 1em; margin: .5em; font: .8em sans-serif; text-align: left; flex: none; } .overlay { padding: .5em; } @keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } } .a1 { animation: 3s ease-in 1s 2 reverse both paused slidein; } .a2 { animation: 3s linear 1s slidein;...
... constituent properties this property is a shorthand for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function syntax the animation property is specified as one or more single animations, separated by commas.
...And 2 more matches
background-size - CSS: Cascading Style Sheets
und-size: 3em 25%; background-size: auto 6px; background-size: auto auto; /* multiple backgrounds */ background-size: auto, auto; /* not to be confused with `auto auto` */ background-size: 50%, 25%, 25%; background-size: 6px, auto, contain; /* global values */ background-size: inherit; background-size: initial; background-size: unset; the background-size property is specified in one of the following ways: using the keyword values contain or cover.
...negative values are not allowed.
...negative values are not allowed.
...And 2 more matches
<basic-shape> - CSS: Cascading Style Sheets
syntax the <basic-shape> data type is defined with one of the basic shape functions listed below.
... shape functions the following shapes are supported.
...these arguments follow the syntax of the margin shorthand, that let you set all four insets with one, two or four values.
...And 2 more matches
break-inside - CSS: Cascading Style Sheets
to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence.
... if more than one of them are such a break, the value of the element that appears the latest in the flow is used.
... syntax the break-inside property is specified as one of the keyword values from the list below.
...And 2 more matches
contain - CSS: Cascading Style Sheets
WebCSScontain
the contain css property allows an author to indicate that an element and its contents are, as much as possible, independent of the rest of the document tree.
... this allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the dom and not the entire page, leading to obvious performance benefits.
... syntax /* keyword values */ contain: none; contain: strict; contain: content; contain: size; contain: layout; contain: style; contain: paint; /* multiple keywords */ contain: size paint; contain: size layout paint; /* global values */ contain: inherit; contain: initial; contain: unset; the contain property is specified as either one of the following: using a single none, strict, or content keyword.
...And 2 more matches
cursor - CSS: Cascading Style Sheets
WebCSScursor
word value */ cursor: pointer; cursor: auto; /* url, with a keyword fallback */ cursor: url(hand.cur), pointer; /* url and coordinates, with a keyword fallback */ cursor: url(cursor1.png) 4 12, auto; cursor: url(cursor2.png) 2 2, pointer; /* global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value.
... each <url> may be optionally followed by a pair of space-separated numbers, which represent <x><y> coordinates.
... bug 275173: on windows and mac os x, no-drop is the same as not-allowed.
...And 2 more matches
<display-inside> - CSS: Cascading Style Sheets
syntax valid <display-inside> values: flow the element lays out its contents using flow layout (block-and-inline layout).
... depending on the value of other properties (such as position, float, or overflow) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context (bfc) for its contents or integrates its contents into its parent formatting context.
... flow-root the element generates a block element box that establishes a new block formatting context, defining where the formatting root lies.
...And 2 more matches
float - CSS: Cascading Style Sheets
WebCSSfloat
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).
... syntax /* keyword values */ float: left; float: right; float: none; float: inline-start; float: inline-end; /* global values */ float: inherit; float: initial; float: unset; the float property is specified as a single keyword, chosen from the list of values below.
...And 2 more matches
hanging-punctuation - CSS: Cascading Style Sheets
/* 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-punctuatio...
... one-value syntax uses any one of the keyword values in the list below.
... two-value syntax uses one of the following: first together with any one of last, allow-end, or force-end last together with any one of first, allow-end, or force-end three-value syntax uses one of the following: first, allow-end, and last first, force-end, and last values none no character hangs.
...And 2 more matches
hyphens - CSS: Cascading Style Sheets
WebCSShyphens
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.
...see suggesting line break opportunities below for details.
... auto the browser is free to automatically break words at appropriate hyphenation points, following whatever rules it chooses.
...And 2 more matches
justify-items - CSS: Cascading Style Sheets
*/ justify-items: self-start; justify-items: self-end; justify-items: left; /* pack items from the left */ justify-items: right; /* pack items from the right */ /* baseline alignment */ justify-items: baseline; justify-items: first baseline; justify-items: last baseline; /* overflow alignment (for positional alignment only) */ justify-items: safe center; justify-items: unsafe center; /* legacy alignment */ justify-items: legacy right; justify-items: legacy left; justify-items: legacy center; /* global values */ justify-items: inherit; justify-items: initial; justify-items: unset; this property can take one of four different forms: basic keywords: one of the keyword va...
... legacy alignment: the legacy keyword, followed by one of left or right.
... safe if the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start.
...And 2 more matches
line-height - CSS: Cascading Style Sheets
syntax /* keyword value */ line-height: normal; /* unitless values: use this number multiplied by the element's font size */ line-height: 3.5; /* <length> values */ line-height: 3em; /* <percentage> values */ line-height: 34%; /* global values */ line-height: inherit; line-height: initial; line-height: unset; the line-height property is specified as any one of the following: a <number> a <length> a <percentage> the keyword normal.
...values given in em units may produce unexpected results (see example below).
...percentage values may produce unexpected results (see the second example below).
...And 2 more matches
margin-trim - CSS: Cascading Style Sheets
the margin-trim property allows the container to trim the margins of its children where they adjoin the container’s edges.
... in-flow for in-flow boxes contained by this box, block-axis margins adjacent to the box's edges are truncated to zero.
... all trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge.
...And 2 more matches
overscroll-behavior-x - CSS: Cascading Style Sheets
/* keyword values */ overscroll-behavior-x: auto; /* default */ overscroll-behavior-x: contain; overscroll-behavior-x: none; /* global values */ overscroll-behavior-x: inherit; overscroll-behavior-x: initial; overscroll-behavior-x: unset; syntax the overscroll-behavior-x 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.
...And 2 more matches
overscroll-behavior-y - CSS: Cascading Style Sheets
ll-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.
...And 2 more matches
overscroll-behavior - CSS: Cascading Style Sheets
syntax the overscroll-behavior property is specified as one or two keywords 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.
...And 2 more matches
<time-percentage> - CSS: Cascading Style Sheets
syntax refer to the documentation for <time> and <percentage> for details of the individual syntaxes allowed by this type.
... examples use in calc() where a <time-percentage> is specified as an allowable type, this means that the percentage resolves to a time and therefore can be used in a calc() expression.
... valid percentages 50% +50% optional plus sign -50% negative percentages are not valid for all properties that accept percentages invalid percentages 50 % space not allowed between the space and the percentage sign valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive, although capital letters are not recommended.
...And 2 more matches
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.
... 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.
... break-all to prevent overflow, word breaks should be inserted between any two characters (excluding chinese/japanese/korean text).
...And 2 more matches
Creating and triggering events - Developer guides
creating custom events events can be created with the event constructor as follows: const event = new event('build'); // listen for the event.
...for a more verbose approach (which works with internet explorer), see the old-fashioned way below.
... for example, the event could be created as follows: const event = new customevent('build', { detail: elem.dataset.time }); this will then allow you to access the additional data in the event listener: function eventhandler(e) { console.log('the time is: ' + e.detail); } the old-fashioned way the older approach to creating events uses apis inspired by java.
...And 2 more matches
Using HTML sections and outlines - Developer guides
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.
...if a significant percentage of your particular target audience is using internet explorer 8 or older, then you can follow the below instructions to make them behave as expected.
... next up, older ie versions do not allow styling of unsupported elements, unless you create an instance of them in the dom.
...And 2 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
perhaps the browser offers the ability to save encrypted credit card information, for autocompletion following an authentication procedure.
... "on" the browser is allowed to automatically complete the input.
...using "name" rather than breaking the name down into its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete values if you do need to break the name down into its components: "honorific-prefix" the prefix or title, such as "mrs.", "mr.", "miss", "ms.", "dr.", or "mlle.".
...And 2 more matches
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
<h1> is the highest section level and <h6> is the lowest.
... content categories flow content, heading content, palpable content.
... permitted parents any element that accepts flow content; don't use a heading element as a child of the <hgroup> element — it is now deprecated.
...And 2 more matches
<dfn>: The Definition element - HTML: Hypertext Markup Language
WebHTMLElementdfn
content categories flow content, phrasing content, palpable content.
... in html5, the title attribute has special meaning, as noted below.
... specifying the term being defined the term being defined is identified following these rules: if the <dfn> element has a title attribute, the value of the title attribute is considered to be the term being defined.
...And 2 more matches
<div>: The Content Division element - HTML: Hypertext Markup Language
WebHTMLElementdiv
the html content division element (<div>) is the generic container for flow content.
... content categories flow content, palpable content.
... permitted content flow content.
...And 2 more matches
<input type="button"> - HTML: Hypertext Markup Language
WebHTMLElementinputbutton
a simple button we'll begin by creating a simple button with a click event handler that starts our machine (well, it toggles the value of the button and the text content of the following paragraph): <form> <input type="button" value="start machine"> </form> <p>the machine is stopped.</p> const button = document.queryselector('input'); const paragraph = document.queryselector('p'); button.addeventlistener('click', updatebutton); function updatebutton() { if (button.value === 'start machine') { button.value = 'stop machine'; paragraph.textcontent = 'the machine h...
... the example below shows this in action.
... examples the below example shows a very simple drawing app created using a <canvas> element and some simple css and javascript (we'll hide the css for brevity).
...And 2 more matches
<input type="hidden"> - HTML: Hypertext Markup Language
WebHTMLElementinputhidden
note: there is a live example below the following line of code — if it is working correctly, you should see nothing!
... additional attributes in addition to the attributes common to all <input> elements, hidden inputs offer the following attributes: attribute description name like all input types, the name of the input to report when submitting the form; the special value _charset_ causes the hidden input's value to be reported as the character encoding used to submit the form name this is actually one of the common attributes, but it has a special meaning available for hidden inputs.
...a typical workflow looks like this: user decides to edit some content they have control over, such as a blog post, or a product entry.
...And 2 more matches
<li> - HTML: Hypertext Markup Language
WebHTMLElementli
permitted content flow content.
... tag omission the end tag can be omitted if the list item is immediately followed by another <li> element, or if there is no more content in its parent element.
...the only allowed value for this attribute is a number, even if the list is displayed with roman numerals or letters.
...And 2 more matches
<menu> - HTML: Hypertext Markup Language
WebHTMLElementmenu
content categories flow content.
... permitted content if the element is in the list menu state: flow content, or alternatively, zero or more occurrences of <li>, <script>, and <template>.
... permitted parents any element that accepts flow content.
...And 2 more matches
<ol>: The Ordered List element - HTML: Hypertext Markup Language
WebHTMLElementol
content categories flow content, and if the <ol> element's children include at least one <li> element, palpable content.
... permitted parents any element that accepts flow content.
...items will be numbered from high to low.
...And 2 more matches
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
WebHTMLElementpre
content categories flow content, palpable content.
... permitted parents any element that accepts flow content.
... wrap is a hint indicating how the overflow must happen.
...And 2 more matches
<textarea> - HTML: Hypertext Markup Language
WebHTMLElementtextarea
the html <textarea> element represents a multi-line plain-text editing control, useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.
... 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.
... rows and cols attributes to allow you to specify an exact size for the <textarea> to take.
...And 2 more matches
<th> - HTML: Hypertext Markup Language
WebHTMLElementth
permitted content flow content, but with no header, footer, sectioning content, or heading content descendants.
... the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element.
...it may have the following values: row: the header relates to all cells of the row it belongs to.
...And 2 more matches
<time> - HTML: Hypertext Markup Language
WebHTMLElementtime
it may include the datetime attribute to translate dates into machine-readable format, allowing for better search engine results or custom features such as reminders.
... it may represent one of the following: a time on a 24-hour clock.
... content categories flow content, phrasing content, palpable content.
...And 2 more matches
HTTP authentication - HTTP
the challenge and response flow works like this: the server responds to a client with a 401 (unauthorized) response status and provides information on how to authorize with a www-authenticate response header containing at least one challenge.
... the syntax for these headers is the following: www-authenticate: <type> realm=<realm> proxy-authenticate: <type> realm=<realm> here, <type> is the authentication scheme ("basic" is the most common scheme and introduced below).
...here, the <type> is needed again followed by the credentials, which can be encoded or encrypted depending on which authentication scheme is used.
...And 2 more matches
Content-Security-Policy-Report-Only - HTTP
the http content-security-policy-report-only response header allows web developers to experiment with policies by monitoring (but not enforcing) their effects.
... content-security-policy: default-src https:; report-uri /csp-violation-report-endpoint/ violation report syntax the report json object contains the following data: blocked-uri the uri of the resource that was blocked from loading by the content security policy.
...it uses the following policy, disallowing everything but stylesheets from cdn.example.com.
...And 2 more matches
Cross-Origin-Opener-Policy - HTTP
the http cross-origin-opener-policy (coop) response header allows you to ensure a top-level document does not share a browsing context group with cross-origin documents.
...this allows you to have more control over references to a window than rel=noopener, which only affects outgoing navigations.
... header type response header forbidden header name no syntax cross-origin-opener-policy: unsafe-none | same-origin-allow-popups | same-origin directives unsafe-none this is the default value.
...And 2 more matches
A typical HTTP session - HTTP
WebHTTPSession
note: the client-server model does not allow the server to send data to the client without an explicit request for it.
...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.
...as there is no content-length provided in an http header, this data block is presented empty, marking the end of the headers, allowing the server to process the request the moment it receives this empty line.
...And 2 more matches
HTTP
WebHTTP
http follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response.
...cors allows web developers to control how their site reacts to cross-site requests.
... a typical http session shows and explains the flow of a usual http session.
...And 2 more matches
CSS Houdini
houdini is a set of low-level apis that exposes parts of the css engine, giving developers the power to extend css by hooking into the styling and layout process of a browser’s rendering engine.
... li { background-image: paint(mycomponent, stroke, 10px); --highlights: blue; --lowlights: green; } note: with great power comes great responsibility!
... the houdini apis below you can find links to the main reference pages covering the apis that fall under the houdini umbrella, along with links to guides to help you if you need guidance in learning how to use them.
...And 2 more matches
Keyed collections - JavaScript
the following code shows some basic operations with a map.
...objects allow you to set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key.
...the following example is from nick fitzgerald's blog post "hiding implementation details with ecmascript 6 weakmaps".
...And 2 more matches
Character classes - JavaScript
types the following table is also duplicated on this cheatsheet.
... has one of the following meanings: matches any single character except line terminators: \n, \r, \u2028 or \u2029.
... es2018 added the s "dotall" flag, which allows the dot to also match line terminators.
...And 2 more matches
Memory Management - JavaScript
low-level languages like c, have manual memory management primitives such as malloc() and free().
...the first and last parts are explicit in low-level languages but are mostly implicit in high-level languages like javascript.
... low-level languages require the developer to manually determine at which point in the program the allocated memory is no longer needed and to release it.
...And 2 more matches
JavaScript error reference - JavaScript
below, you'll find a list of errors which are thrown by javascript.
...the pages below will provide additional details about these errors.
... errors displayed in the web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code.
...And 2 more matches
arguments.callee - JavaScript
(adapted from a stack overflow answer by olliej) early versions of javascript did not allow named function expressions, and for this reason you could not make a recursive function expression.
...e be necessary.) the other major issue is that the recursive call will get a different this value, e.g.: var global = this; var sillyfunction = function(recursed) { if (!recursed) { return arguments.callee(true); } if (this !== global) { alert('this is: ' + this); } else { alert('this is the global'); } } sillyfunction(); ecmascript 3 resolved these issues by allowing named function expressions.
...1 : factorial(n - 1)*n; }); this has numerous benefits: the function can be called like any other from inside your code it does not create a variable in the outer scope (except for ie 8 and below) it has better performance than accessing the arguments object another feature that was deprecated was arguments.callee.caller, or more specifically function.caller.
...And 2 more matches
Array.from() - JavaScript
the array.from() static method creates a new, shallow-copied array instance from an array-like or iterable object.
... array.from() has an optional parameter mapfn, which allows you to execute a map() function on each element of the array being created.
... in es2015, the class syntax allows sub-classing of both built-in and user-defined classes.
...And 2 more matches
Function.prototype.apply() - JavaScript
see below for browser compatibility information.
... const array = ['a', 'b']; const elements = [0, 1, 2]; array.push.apply(array, elements); console.info(array); // ["a", "b", 0, 1, 2] using apply and built-in functions clever usage of apply allows you to use built-in functions for some tasks that would probably have otherwise been written by looping over the array values.
... in the following example we will create a global function method called construct, which will enable you to use an array-like object with a constructor instead of an arguments list.
...And 2 more matches
Function.prototype.call() - JavaScript
description the call() allows for a function/method belonging to one object to be assigned and called for a different object.
... in the following example, the constructor for the product object is defined with two parameters: name and price.
...= [ { species: 'lion', name: 'king' }, { species: 'whale', name: 'fail' } ]; for (let i = 0; i < animals.length; i++) { (function(i) { this.print = function() { console.log('#' + i + ' ' + this.species + ': ' + this.name); } this.print(); }).call(animals[i], i); } using call to invoke a function and specifying the context for 'this' in the example below, when we call greet, the value of this will be bound to object obj.
...And 2 more matches
Intl.DateTimeFormat() constructor - JavaScript
the following unicode extension keys are allowed: nu numbering system.
... options optional an object with some or all of the following properties: datestyle the date formatting style to use when calling format().
...see the following paragraphs for information about the use of this property.
...And 2 more matches
Intl.Locale.prototype.caseFirst - JavaScript
certain locales use a character's case (uppercase or lowercase) in the collation process.
... 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.
...And 2 more matches
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
...the returned value is no lower than (and may possibly equal) min, and is less than (and not equal) max.
...the value is no lower than min (or the next integer greater than min if min isn't an integer), and is less than (but not equal to) max.
...And 2 more matches
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
...the returned value is no lower than (and may possibly equal) min, and is less than (and not equal) max.
...the value is no lower than min (or the next integer greater than min if min isn't an integer), and is less than (but not equal to) max.
...And 2 more matches
Number - JavaScript
returned on overflow.
...returned on overflow.
... number.prototype allows the addition of properties to the number object.
...And 2 more matches
Object.prototype.constructor - JavaScript
let o = {} o.constructor === object // true let o = new object o.constructor === object // true let a = [] a.constructor === array // true let a = new array a.constructor === array // true let n = new number(3) n.constructor === number // true examples displaying the constructor of an object the following example creates a constructor (tree) and an object of that type (thetree).
... function tree(name) { this.name = name } let thetree = new tree('redwood') console.log('thetree.constructor is ' + thetree.constructor) this example displays the following output: thetree.constructor is function tree(name) { this.name = name } changing the constructor of an object the following example shows how to modify the constructor value of generic objects.
...n () {}, math, new number(), 1, // remains unchanged new object(), {}, new regexp(), /(?:)/, new string(), 'test' // remains unchanged ] for (let i = 0; i < types.length; i++) { types[i].constructor = type types[i] = [types[i].constructor, types[i] instanceof type, types[i].tostring()] } console.log(types.join('\n')) this example displays the following output (comments added for reference): function type() {},false, // new array() function type() {},false, // [] function type() {},false,false // new boolean() function boolean() { [native code] },false,true // true function type() {},fals...
...And 2 more matches
handler.construct() - JavaScript
syntax const p = new proxy(target, { construct: function(target, argumentslist, newtarget) { } }); parameters the following parameters are passed to the construct() method.
... interceptions this trap can intercept these operations: new proxy(...args) reflect.construct() invariants if the following invariants are violated, the proxy will throw a typeerror: the result must be an object.
... examples trapping the new operator the following code traps the new operator.
...And 2 more matches
String.prototype.replaceAll() - JavaScript
a number of special replacement patterns are supported; see the "specifying a string as a parameter" section below.
...the arguments supplied to this function are described in the "specifying a function as a parameter" section below.
... specifying a string as a parameter the replacement string can include the following special replacement patterns: pattern inserts $$ inserts a "$".
...And 2 more matches
String - JavaScript
see "string primitives and string objects" below.
...if you wish to compare without regard to upper or lower case characters, use a function similar to this: function isequal(str1, str2) { return str1.touppercase() === str2.touppercase() } // isequal upper case is used instead of lower case in this function, due to problems with certain utf-8 character conversions.
... string.prototype.tolocalelowercase( [locale, ...locales]) the characters within a string are converted to lowercase while respecting the current locale.
...And 2 more matches
encodeURI() - JavaScript
the following example shows all the parts that a uri "scheme" can possibly contain.
...also, encodeuri() does not encode a few additional characters, known as "unreserved marks", which do not have a reserved purpose but are allowed in a uri "as is".
...~ * ' ( ) # examples encodeuri vs encodeuricomponent encodeuri() differs from encodeuricomponent() as follows: var set1 = ";,/?:@&=+$#"; // reserved characters var set2 = "-_.!~*'()"; // unreserved marks var set3 = "abc abc 123"; // alphanumeric characters + space console.log(encodeuri(set1)); // ;,/?:@&=+$# console.log(encodeuri(set2)); // -_.!~*'() console.log(encodeuri(set3)); // abc%20abc%20123 (the space gets encoded as %20) console.log(encodeuricomponent(set1)); // %3b%2c%2f%3f%3a%40%26%3d%2b%24%23 console.log(encodeuricomponent(set2)); // -_.!~*'() console.log(encodeuricomponent(set3)); // abc%20abc%20123 (the space gets encoded as %20) note that encodeuri()...
...And 2 more matches
Iteration protocols - JavaScript
these protocols can be implemented by any object by simply following some conventions.
... the iterable protocol the iterable protocol allows javascript objects to define or customize their iteration behavior, such as what values are looped over in a for...of construct.
... an object is an iterator when it implements a next() method with the following semantics: property value next() a zero-argument function that returns an object with at least the following two properties: done (boolean) has the value false if the iterator was able to produce the next value in the sequence.
...And 2 more matches
for - JavaScript
the for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement) to be executed in the loop.
...if the expression evaluates to false, execution skips to the first expression following the for construct.
... examples using for the following for statement starts by declaring the variable i and initializing it to 0.
...And 2 more matches
import - JavaScript
only single quoted and double quoted strings are allowed.
...below are examples to clarify the syntax.
...the following are some reasons why you might need to use dynamic import: when importing statically significantly slows the loading of your code and there is a low likelihood that you will need the code you are importing, or you will not need it until a later time.
...And 2 more matches
throw - JavaScript
each of the following throws an exception: throw 'error2'; // generates an exception with a string value throw 42; // generates an exception with the value 42 throw true; // generates an exception with the value true throw new error('required'); // generates an error object with the message of required also note that the throw statement is affected by automatic semicolon insertion (asi) as no line ter...
...minator between the throw keyword and the expression is allowed.
...the following example creates an object of type userexception and uses it in a throw statement.
...And 2 more matches
<mstyle> - MathML
WebMathMLElementmstyle
it accepts all attributes of all mathml presentation elements with some exceptions and additional attributes listed below.
...the values before, after and duplicate are allowed.
...in addition, the scriptlevel attribute can never reduce the font size below scriptminsize in order to avoid unreadable small font sizes and depends on the multiplier specified in scriptsizemultiplier.
...And 2 more matches
Optimizing startup performance - Web Performance
if the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slow script" notification.
...this allows html parsers to continue processing the document, instead of having to wait until the scripts have been downloaded and executed before continuing.
... emscripten provides an api to help with this refactoring; for example, you can use emscripten_push_main_loop_blocker() to establish a function to be executed before the main thread is allowed to continue.
...And 2 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
rsor direction display dominant-baseline enable-background fill fill-opacity fill-rule filter flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-orientation-horizontal glyph-orientation-vertical image-rendering kerning letter-spacing lighting-color marker-end marker-mid marker-start mask opacity overflow pointer-events shape-rendering solid-color solid-opacity stop-color stop-opacity stroke stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering transform unicode-bidi vector-effect visibility word-spacing writing-mode attributes alignment-baseline it specifies how an ob...
... value: auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical|inherit; animatable: yes baseline-shift it allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element.
... value: ltr|rtl|inherit; animatable: yes display it allows to control the rendering of graphical or container elements.
...And 2 more matches
begin - SVG: Scalable Vector Graphics
WebSVGAttributebegin
each individual value can be one of the following : <offset-value>, <syncbase-value>, <event-value>, <repeat-value>, <accesskey-value>, <wallclock-sync-value> or the keyword indefinite.
...each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event).
... a valid syncbase-value consists of an id reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element.
...And 2 more matches
stroke-linecap - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <path>, <polyline>, <line>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 6 6" xmlns="http://www.w3.org/2000/svg"> <!-- effect of the (default) "butt" value --> <line x1="1" y1="1" x2="5" y2="1" stroke="black" stroke-linecap="butt" /> <!-- effect of the "round" value --> <line x1="1" y1="3" x2="5" y2="3" stroke="black" stroke-linecap="round" /> <!-- effect of the "square"...
... value --> <line x1="1" y1="5" x2="5" y2="5" stroke="black" stroke-linecap="square" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4 m1,3 h4 m1,5 h4" stroke="pink" stroke-width="0.025" /> </svg> usage notes value butt | round | square default value butt animatable yes butt the butt value indicates that the stroke for each subpath does not extend beyond its two endpoints.
... example html,body,svg { height:100% } <svg viewbox="0 0 6 4" xmlns="http://www.w3.org/2000/svg"> <!-- effect of the "butt" value --> <path d="m1,1 h4" stroke="black" stroke-linecap="butt" /> <!-- effect of the "butt" value on a zero length path --> <path d="m3,3 h0" stroke="black" stroke-linecap="butt" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg> round the round value indicates that at the end of each subpath the stroke will be extended by a half circle wit...
...And 2 more matches
Namespaces crash course - SVG: Scalable Vector Graphics
consider the following example.
...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...
...the table below lists the dom1 methods that shouldn't be used in svg, along with their equivalent dom2 counterparts that should be used instead.
...And 2 more matches
Mixed content - Web security
in the case of passive content, the threat is lower (the page may contain misleading content, or the user's cookies may be stolen).
...to make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the security pane of the web console, as seen below: to fix this type of error, all requests to http content should be removed and replaced with content served over https.
... note: since firefox 55, the loading of mixed content is allowed on http://127.0.0.1/ (see bug 903966).
...And 2 more matches
Transport Layer Security - Web security
although tls can be used on top of any low-level transport protocol, the original goal of the protocol was to encrypt http traffic.
... to assist you in configuring your site, mozilla provides a helpful tls configuration generator that will generate configuration files for the following web servers: apache nginx lighttpd haproxy amazon web services cloudformation elastic load balancer using the configurator is a recommended way to create the configuration to meet your needs; then copy and paste it into the appropriate file on your server and restart the server to pick up the changes.
...for the web, tls 1.3 can be enabled without affecting compatibility with some rare exceptions (see below).
...And 2 more matches
Using shadow DOM - Web Components
as an example, consider the following html fragment: <!doctype html> <html> <head> <meta charset="utf-8"> <title>simple dom example</title> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will add a link to the <a href="https://www.mozilla.
...org/">mozilla homepage</a></p> </section> </body> </html> this fragment produces the following dom structure: shadow dom allows hidden dom trees to be attached to elements in the regular dom tree — this shadow dom tree starts with a shadow root, underneath which can be attached to any elements you want, in the same way as the normal dom.
...the difference is that none of the code inside a shadow dom can affect anything outside it, allowing for handy encapsulation.
...And 2 more matches
Web Components
web components is a suite of different technologies allowing you to create reusable custom elements — with their functionality encapsulated away from the rest of your code — and utilize them in your web apps.
... custom elements: a set of javascript apis that allow you to define custom elements and their behaviour, which can then be used as desired in your user interface.
... extensions for creating custom built-in elements the is global html attribute: allows you to specify that a standard html element should behave like a registered custom built-in element.
...And 2 more matches
XPath snippets - XPath
node-specific evaluator function the following custom utility function can be used to evaluate xpath expressions on given xml nodes.
...scripts in a web document which might be accessed by edge or internet explorer users should replace the call to new xpathevaluator() with the following fragment: // xpathevaluator is implemented on objects that implement document var xpe = anode.ownerdocument || anode; in that case the creation of the xpathnsresolver can be simplified as: var nsresolver = xpe.creatensresolver(xpe.documentelement); note however that creatensresolver should only be used if you are sure the namespace prefixes in the xpath expression match those in th...
... sample usage assume we have the following xml document (see also how to create a dom tree and parsing and serializing xml): example: an xml document to use with the custom evaluatexpath() utility function <?xml version="1.0"?> <people> <person first-name="eric" middle-initial="h" last-name="jung"> <address street="321 south st" city="denver" state="co" country="usa"/> <address street="123 main st" city="arlington" state="...
...And 2 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
WebXSLTIndex
the example allows sorting the content multiple times, alternating between ascending and descending order.
... 14 an overview needshelp, needsmarkupwork, transforming_xml_with_xslt, xml, xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that follows.
...sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet.
...And 2 more matches
Cross-domain Content Scripts - Archive of obsolete content
on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be allowed to access content served from https://example.com/.
... wildcards are not allowed.
... cross-domain iframes the following "main.js" creates a page-worker which loads a local html file called "page.html", attaches a content script called "page.js" to the page, waits for messages from the script, and logs the payload.
... cross-domain xmlhttprequest the following add-on creates a panel whose content is the summary weather forecast for shetland.
Content Scripts - Archive of obsolete content
there are five basic principles: the add-on's main code, including "main.js" and other modules in "lib", can use the sdk high-level and low-level apis, but can't access web content directly content scripts can't use the sdk's apis (no access to globals exports, require) but can access web content sdk apis that use content scripts, like page-mod and tabs, provide functions that enable the add-on's main code to load content scripts into web pages content scripts can be loaded in as strings, but are more often stored as separate file...
... a message-passing api allows the main code and content scripts to communicate with each other this complete add-on illustrates all of these principles.
...the content script simply replaces the content of the page: // main.js var tabs = require("sdk/tabs"); var contentscriptstring = 'document.body.innerhtml = "<h1>this page has been eaten</h1>";' tabs.activetab.attach({ contentscript: contentscriptstring }); the following high-level sdk modules can use content scripts to modify web pages: page-mod: enables you to attach content scripts to web pages that match a specific url pattern.
...the following add-on shows a content script added by page-mod receiving a customevent sent from a context-menu item when the context menu item is clicked.
Module structure of the SDK - Archive of obsolete content
low-level modules like heritage and namespace provide more powerful functionality, and are typically less stable and more complex.
...for high-level modules this is just sdk/<module_name>, and for low-level modules it is sdk/<path_to_module>/<module_name>: // load the high-level "tabs" module var tabs = require("sdk/tabs"); // load the low-level "uuid" module var uuid = require('sdk/util/uuid'); the path to specify for a low-level module is given along with the module name itself in the title of the module's documentation page (for example, system/environment).
... for example, the following add-on contains an additional module directly under "lib", and other modules under subdirectories of "lib": my-addon lib main.js password-dialog.js secrets hash.js storage password-store.js to import modules into main: // main.js code var dialog = require("./password-dialog"); var hash = ...
...just call the following: const { require } = cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}) this will import require() into your scope.
tabs - Archive of obsolete content
you can't attach style sheets to a tab using tab.attach(), but from firefox 34 onwards you can attach and detach them using the low-level stylesheet/style and content/mod apis.
... converting to xul tabs to convert from the high-level tab objects used in this api to the low-level xul tab objects used in the tabs/utils api and by traditional add-ons, use the viewfor() function exported by the viewfor module.
... here's an example converting from a high-level tab to a xul tab and then back the other way: var { modelfor } = require("sdk/model/core"); var { viewfor } = require("sdk/view/core"); var tabs = require("sdk/tabs"); var tab_utils = require("sdk/tabs/utils"); function maphighleveltolowlevel(tab) { // get the xul tab that corresponds to this high-level tab var lowleveltab = viewfor(tab); // now we can, for example, access the tab's content directly var browser = tab_utils.getbrowserfortab(lowleveltab); console.log(browser.contentdocument.body.innerhtml); // get the high-level tab back from the xul tab var highleveltab = modelfor(lowleveltab); console.log(highleve...
...ltab.url); } tabs.on("ready", maphighleveltolowlevel); note that directly accessing xul objects and web content like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis.
content/loader - Archive of obsolete content
loader adds code to initialize and validate a set of properties for managing content scripts: contenturl contentscript contentscriptfile contentscriptwhen contentscriptoptions allow when certain of these properties are set, the loader emits a propertychange event, enabling its users to take the appropriate action.
... example: the following code creates a wrapper on a hidden frame that reloads a web page in the frame every time the contenturl property is changed: var hiddenframes = require("sdk/frame/hidden-frame"); var { loader } = require("sdk/content/content"); var pageloader = loader.compose({ constructor: function pageloader(options) { options = options || {}; if (options.contenturl) this.contenturl = options.contenturl; this.on('propertychange', this._...
...this may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the...
... allow permissions for the content, with the following keys: ...
content/worker - Archive of obsolete content
worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with additional public properties that are listed below.
... properties port object that allows you to: send customized messages to the worker using the port.emit function receive events from the worker using the port.on function url the url of the content.
... events message this event allows the content worker to receive messages from its associated content scripts.
... error this event allows the content worker to react to an uncaught runtime script error that occurs in one of the content scripts.
core/promise - Archive of obsolete content
if (error) return ui.displayerror(error); twitter.gettweetsfor(handle, funtion continuewith(error, tweets) { if (error) return ui.displayerror(error); ui.showtweets(tweets); }); }); }); doing things in parallel is even harder: var tweets, answers, checkins; twitter.gettweetsfor(user, function continuewith(result) { tweets = result; somethingfinished(); }); stackoverflow.getanswersfor(question, function continuewith(result) { answers = result; somethingfinished(); }); foursquare.getcheckinsby(user, function continuewith(result) { checkins=result; somethingfinished(); }); var finished = 0; function somethingfinished() { if (++finished === 3) ui.show(tweets, answers, checkins); } this also makes error handling quite an adventure.
... in the add-on sdk we follow commonjs promises/a specification and model a promise as an object with a then method, which can be used to get the eventual return (fulfillment) value or thrown exception (rejection): foo().then(function success(value) { // ...
...in the following example we implement functions that take multiple promises and return one that resolves to first one being fulfilled: function race() { let { promise, resolve } = defer(); array.slice(arguments).foreach(function(promise) { promise.then(resolve); }); return promise; } var asyncaorb = race(readasync(urla), readasync(urlb)); note: that this implementation forgives failures and woul...
...in such cases it's useful to put a timer on such tasks: function timeout(promise, ms) { let deferred = defer(); promise.then(deferred.resolve, deferred.reject); delay(ms, 'timeout').then(deferred.reject); return deferred.promise; } var tweets = readasync(url); timeout(tweets, 20).then(function(data) { ui.display(data); }, function() { alert('network is being too slow, try again later'); }); alternative promise apis there may be cases where you will want to provide more than just then method on your promises.
lang/functional - Archive of obsolete content
this) as the first parameter, followed by any parameters passed into the method.
... compose(fn...) returns the composition of a list of functions, where each function consumes the return value of the function that follows.
... wrap(fn, wrapper) returns the first function passed as an argument to the second, allowing you to adjust arguments, run code before and after, and conditionally execute the original function.
...useful for speeding up slow-running computations.
ui/sidebar - Archive of obsolete content
events attach this event is emitted when a worker is attached to a sidebar, as a result of any of the following: calling the sidebar's show() method, when the sidebar is not shown in the currently active window changing the sidebar's url property the user switching the sidebar on using the "sidebar" submenu in firefox, when the sidebar is not shown in the currently active window the user opening a new window from a window that has the sidebar showing it is passed a worker as an argument, which d...
... detach this event is emitted when a worker is detached from a sidebar, as a result of either of the following: calling the sidebar's hide() method, when the sidebar is being shown in the currently active window the user switching the sidebar off using the "sidebar" submenu in firefox, when the sidebar is being shown in the currently active window the detach listener receives a worker object as a parameter.
...worker) { var index = workerarray.indexof(worker); if(index != -1) { workerarray.splice(index, 1); } } var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html"), onattach: attachworker, ondetach: detachworker }); show this event is emitted when the sidebar is shown, as a result of any of the following: calling the sidebar's show() method, when the sidebar is not shown in the currently active window changing the sidebar's url property the user switching the sidebar on using the "sidebar" submenu in firefox, when the sidebar is not shown in the currently active window the user opening a new window from a window that has the sidebar showing hide this event is emitted when the sidebar ...
...is hidden, as a result of either of the following: calling the sidebar's hide() method, when the sidebar is being shown in the currently active window the user switching the sidebar off using the "sidebar" submenu in firefox, when the sidebar is being shown in the currently active window ...
Creating Event Targets - Archive of obsolete content
this tutorial describes the use of low-level apis.
...then open "index.js" and add the following code: var {cc, ci} = require("chrome"); var { xpcomutils } = require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { console.log("added ", bookmarkservice.getbookmarkuri(aitemid).s...
... create a new file in "lib" called "bookmarks.js", and add the following code: var { emit, on, once, off } = require("sdk/event/core"); var {cc, ci} = require("chrome"); var { xpcomutils }= require("resource://gre/modules/xpcomutils.jsm"); var bookmarkservice = cc["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(ci.nsinavbookmarksservice); var bookmarkobserver = { onitemadded: function(aitemid, afolder, aindex) { emit(e...
...for example, we can adapt "index.js" as follows: var bookmarks = require("./bookmarks"); function logadded(uri) { console.log("added: " + uri); } function logvisited(uri) { console.log("visited: " + uri); } exports.main = function() { bookmarks.on("added", logadded); bookmarks.on("visited", logvisited); }; exports.onunload = function() { bookmarks.removelistener("added", logadded); bookmarks.removelistener("visited", logvisit...
Using XPCOM without chrome - Archive of obsolete content
using sdk xpcom with the low-level module sdk/platform/xpcom , it's possible to exclude chrome and xpcomutils in some cases.
... below is an example for the xpcom bookmark observer.
... examples bookmarks observer normally, a bookmark observer would require chrome components and xpcomutils as described in the following links: (observing changes to bookmarks and tags) , (creating event targets).
... below is an example, where we extend the xpcom module's unknown class with an nsinavbookmarkobserverinterface and one of its optional interface methods (onitemchanged).
Dialogs and Prompts - Archive of obsolete content
add ok and cancel buttons in an order that is consistent with os default (but the button set and layout is highly customizable, see below).
... simple dialog code the following xul code defines a simple dialog with two buttons, ok and cancel (buttons="accept,cancel" attribute on dialog).
...for example, to add an apply button to your dialog, use the following code: <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="..." buttons="accept,cancel,extra1" ondialogaccept="onaccept();" ondialogextra1="onapply();" buttonlabelextra1="apply" buttonaccesskeyextra1="a"> <!-- content --> </dialog> you can even get the element object for any of predefined buttons with gdialog.getbutton(dlgtype);, where gdialog is th...
... passing arguments and displaying a dialog the following code demonstrates how to pass custom arguments to a dialog, process those arguments in the dialog, and return user-modified arguments to the caller.
Finding window handles - Archive of obsolete content
os specific examples using javascript (js-ctypes) nsibasewindow -> nativehandle in all of the examples below, the native handle to the most recent navigator:browser is obtained and then it is focused.
... run the snippets below from the scratchpad in environment > browser.
... recall that nsibasewindow -> nativehandle returns the following in the different operating systems: windows - hwnd mac os x - nswindow* linux - gdkwindow* (it will be gdkwindow* no matter what desktop/window manager) is in use, for explanation why see the article: standard os libraries - unix section) windows components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.nsidocshelltreeitem) .treeowner ...
.../ return is a number of ms since the computer (xserver) was on // var rez_gwpwt = gtk_window_present_with_time(browserwindow_madeintogtkwindowptr, rez_gst); // console.info('rez_gwaf:', rez_gwpwt, uneval(rez_gwpwt)); var rez_gwp = gtk_window_present(browserwindow_madeintogtkwindowptr); console.info('rez_gwaf:', rez_gwaf, uneval(rez_gwaf)); gdk.close(); gtk.close(); x11 warning this example below does not focus a window yet, it does convert from a gdkwindow* to a xid and that's it, the code for focusing the window is soon to come.
Progress Listeners - Archive of obsolete content
progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
... in the examples below the progress listener is attached to the tabbrowser, which means you don't get any notifications for inactive tabs.
...s see related documentation onprogresschange: function(awebprogress, arequest, curself, maxself, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } attach the progress listener to a <browser> or a <tabbrowser> element using addprogresslistener, for example for firefox put the following code in a load listener of a main window: gbrowser.addprogresslistener(mylistener); when used with a browser, the second argument is a mask which determines the type of events that will be received.
...using the following code, you will get notified when user navigates to another page (by clicking a link, using the back/forward button, by typing an address in the location bar, etc.) and also when user switches tabs.
Displaying web content in an extension without security issues - Archive of obsolete content
the following article explains these security mechanisms, ideally an extension that needs to display web content (which is always potentially dangerous) will use all of them.
...for example, "chrome://foo/content/foo.xhtml" will have full privileges, "http://example.com/foo.xhtml" will be allowed to access example.com, "file:///c:/foo.xhtml" will be allowed to read files from disk (with some restrictions).
...it won’t harm disabling everything else as well unless it is really required: frame.docshell.allowauth = false; frame.docshell.allowimages = false; frame.docshell.allowjavascript = false; frame.docshell.allowmetaredirects = false; frame.docshell.allowplugins = false; frame.docshell.allowsubframes = false; but what about interactivity, for example if you want a certain reaction to mouse clicks?
...for example, your template document might have this code: <style type="text/css"> #entrytemplate { display: none; } </style> <div id="entrytemplate"> <div class="title"></div> <div class="description"></div> </div> now to insert a new entry in the document you would do the following: var template = doc.getelementbyid("entrytemplate"); var entry = template.clonenode(true); entry.removeattribute("id"); entry.getelementsbyclassname("title")[0].textcontent = title; entry.getelementsbyclassname("description")[0].textcontent = description; template.parentnode.appendchild(entry); the important difference here is that the result will always have the same structure as the templat...
Listening to events in Firefox extensions - Archive of obsolete content
simple dom events registering for a dom event is done using with code such as the following: function callback(evt) { // do your processing here.
...both browser and tabbrowser elements support the following: var progresslistener = { // add nsiwebprogressimplementation here } b.addprogresslistener(progresslistener); where b is the browser or tabbrowser you want to listen to events for.
...in order to listen to events from all browsers, including those not currently being displayed, the following example can be used: var tabsprogresslistener = { // add tabs progress listener implementation here } gbrowser.addtabsprogresslistener(tabsprogresslistener); this lets you receive events related to all tabs.
...it is used to detect when a webpage attempts to refresh itself and allow the user to block the attempt.
Adding sidebars - Archive of obsolete content
they allow you to stack content on top of other content and switch between different sections easily.
...in the following example, the second child will be displayed, not the first which would be the default.
...it allows you to decompose complex ui into individual layers, broadening the layout possibilities.
... it should be evident at this point that hand-coding a tree would take quite some time and yields a great deal of xml code that is hard to follow.
Appendix A: Add-on Performance - Archive of obsolete content
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.
... luckily, minimizing your startup time is easy, if you follow these guidelines: do not load or run code before it’s needed.
...this is what you should do first to make sure that you filter out all cases that don't interest you so that your add-on doesn't slow down other requests.
...even if it is not as important as other areas, firefox shutdown can also be slowed down because of add-ons.
Appendix F: Monitoring DOM changes - Archive of obsolete content
dom mutation events were introduced to html several years ago in order to allow web applications to monitor changes to the dom by other scripts.
...for instance, when you want to modify the result of dom mutations that you know are the result of the doawesomedomstuff() function, you can wrap it as follows: { let originaldoawesomedomstuff = doawesomedomstuff; doawesomedomstuff = function _doawesomedomstuff() { let res = originaldoawesomedomstuff.apply(this, arguments); doawesomerdomstuff(res, arguments); return res; }; } now, whenever doawesomedomstuff() is called, the original function will be called, followed by your own doawesomerdomstuff() fu...
...and because it is css-based, and is triggered when css is being applied anyway, it does not slow dom mutations.
... the code below contains an inefficient fallback implementation for older browsers.
Mozilla Documentation Roadmap - Archive of obsolete content
xulplanet allowed you to navigate between interfaces and their related components, which makes locating components very easy.
... there are several useful feeds that you can follow using a feed reader, such as thunderbird.
... here are some important feeds you should consider following: planet mozilla.
...it can be hard to follow due of the sheer mass of information coming out of it (dozens of posts per day), but you'll certainly be up to date with pretty much everything if you take the time to read at least part of it.
User Notifications and Alerts - Archive of obsolete content
they interrupt the user's workflow, demanding immediate action before anything else can be done.
...you should look for the level that better fits your message, and use the lowest applicable level, to prevent the user from getting used to dismissing high-level notifications.
...the 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.
Extensions support in SeaMonkey 2 - Archive of obsolete content
some urls are listed below: url in firefox url in seamonkey overlays chrome://browser/content/browser.xul chrome://navigator/content/navigator.xul main browser window chrome://browser/content/pageinfo/pageinfo.xul chrome://navigator/content/pageinfo/pageinfo.xul page info window chrome://browser/content/preferences/permissions.xul ...
...some important menu ids are listed below, menu ids are based on firefox 3 source code: menu id in firefox menu id in seamonkey 1.x and 2.0 seamonkey 2.1 overlays menu_filepopup menu_filepopup menu_filepopup file menu popup menu_editpopup menu_edit_popup menu_editpopup edit menu popup menu_viewpopup menu_view_popup menu_v...
... for example, if you overlay some chrome before the status bar, like this: <vbox id="browser-bottombox"> <something insertbefore="status-bar" /> </vbox> use the following technique to make your overlay work on both seamonkey 2 and firefox 3: <window id="main-window"> <vbox id="browser-bottombox" insertbefore="status-bar"> <something insertbefore="status-bar" /> </vbox> </window> thunderbird 3 gfolderdisplay api seamonkey 2.0 only supports a reduced set of methods: selectedcount selectedmessage selectedmessageisfeed selectedmessageisimap sele...
... in javascript code you can use the following technique to detect the application: const firefox_id = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; const thunderbird_id = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; const seamonkey_id = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}"; var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); if(appinfo.id == firefox_id) { ...
Session store API - Archive of obsolete content
after that, the following steps are taken for each tab being restored: either an existing tab is reused or a new tab is created.
... saving a value with a tab the following code will attach a key/value pair to a tab, so that when the tab is restored, that pair is still associated with it.
... fetching a saved value you can fetch a value associated with a tab at any time (whether the tab is in the process of being restored or not), using code similar to the following: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; var retrieveddata = ss.gettabvalue(currenttab, "key-name-here"); after this code executes, the variable retrieveddata contains the value saved for the key "key-name-here".
... deleting a value associated with a tab to delete a value from a tab, you can use code similar to the following: var ss = components.classes["@mozilla.org/browser/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); var currenttab = gbrowser.selectedtab; ss.deletetabvalue(currenttab, "key-name-here"); remarks the window value save and restore functions work exactly like the tab-based functions by similar names.
Setting up an extension development environment - Archive of obsolete content
it even allows the running of simultaneous versions, at the same time.
... in the following example, the described command starts a new instance of firefox, with a profile called dev; even if an instance of firefox is already running.
... 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.
...see below.
Signing an extension - Archive of obsolete content
the following instructions also apply to a theme and other xpi files.
... sudo port install nss export your certificate if you have your certificate in firefox, export it by following the steps below.
... sign the basic usage of the signing tool is as follows: nss-signtool \ -d (path to the directory that contains your certificate database files) \ -k (your certificate nickname) \ -p (your certificate password) \ -x -z (output path/name of signed file) \ (path to your extension working directory that contains chrome directory, chrome.manifest file, install.rdf file, etc.) writing your password directly in the script is dangerous.
... signing a firefox extension with a windows authenticode ssl certificate / key - note that some cas do not allow (or support) to divert an authenticode certificate to object signing.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
wired news redesign in a nutshell driven by xhtml 1.0 transitional and css; allows centralized control over layout and appearance for thousands of pages; simple markup allows for rapid changes to templates; average page weight dropped by almost half; page layout accomplished with simple css positioning; vastly increased accessibility without special coding or user agent detection.
... using absolute positioning for left and right columns allowed the markup for each column to fall in any order.
...but positioning did allow the center column to fall first in the markup.
...this allows us to temporarily display on screen the same formatting to be used for printing that page.
Localizing an extension - Archive of obsolete content
create a properties file the first thing we do is create a property file for the literal strings used by the javascript code in stockwatcher2.js: changestring=chg: openstring=open: lowstring=low: highstring=high: volumestring=vol: the stockwatcher2.properties file shown above maps five keys (changestring, openstring, lowstring, highstring, and volumestring) to the corresponding text in english.
...we do this by creating a string bundle, using the following code: <stringbundleset id="stringbundleset"> <stringbundle id="string-bundle" src="chrome://stockwatcher2/locale/stockwatcher2.properties"/> </stringbundleset> this establishes a new string bundle, referenced by the id "string-bundle", whose keys and values are to be loaded from the stockwatcher2.properties file we've already created.
...we add to refreshinformation() the following code: var stringsbundle = document.getelementbyid("string-bundle"); var changestring = stringsbundle.getstring('changestring') + " "; var openstring = stringsbundle.getstring('openstring') + " "; var lowstring = stringsbundle.getstring('lowstring') + " "; var highstring = stringsbundle.getstring('highstring') + " "; var volumestring = stringsbundle.getstring('volumestring') + " "; this ...
...then we replace any occurrences of the literal strings with the appropriate variables: samplepanel.tooltiptext = 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.
Bookmark Keywords - Archive of obsolete content
that's pretty interesting on its own, but mozilla takes it a step further by allowing the user to define an "entry point" for added information.
... with that done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's number into mozilla's address bar, and the browser will jump right to the bug with that number.
...thus we could type any of the following into the address bar and get back useful results: <tt>google geitost</tt> <tt>google mozilla keyword bookmark</tt> <tt>google bookmark site:developer.netscape.com</tt> <tt>google netscape xml support -site:netscape.com</tt> a few examples in the course of writing this article, a number of potentially useful bookmarks were considered as possible examples.
... instead of just throwing them away, we're providing them for you in the following table.
Structure of an installable bundle - Archive of obsolete content
basic structure of a bundle a bundle may include any of the following files: path from the root of the bundle description version information /install.rdf extension/theme install manifest /application.ini application launch manifest /bootstrap.js the bootstrap script for extensions not requiring a restart (those with <em:bootstrap>true</em:bootstrap> in their install.rdf).
... platform-specific files gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) removed support for platform-specific subdirectories, described below.
...for example, if a plugin vendor wanted to make a plugin available for consumer computers running linux(of the form: /platform/linux*/), macintosh(of the form: /platform/darwin*/), and windows(of the form: /platform/win*/), it would provide the following files: /platform/linux_x86-gcc3/plugins/libmyplugin.so /platform/winnt_x86-msvc/plugins/myplugin.dll /platform/darwin_ppc-gcc3/plugins/libmyplugin.dylib because xpt files are not platform-specific, any associated xpt files would go in the generic components directory: /components/myplugin.xpt if an extension has non-binary platform-specific code (such as code which uses the windows regis...
...tform/winnt/components/registerdoctype.js when platform-specific jar files are used, each platform directory should have its own chrome.manifest file: chrome.manifest chrome/mytheme-base.jar platform/darwin/chrome.manifest platform/darwin/chrome/mytheme-mac.jar platform/winnt/chrome.manifest platform/winnt/chrome/mytheme-win.jar the app/extension loader processes the base directory first, followed by the applicable platform directories (first /{os_target}/, then /{os_target}_{target_xpcom_abi}/).
Using Dehydra - Archive of obsolete content
example: printing the location of type declarations save the following c++ code dumptypes.cc: typedef int myint; struct foo { int i; char *c; }; save the following analysis script dumptypes.js: function process_type(t) { print("type found: " + t.name + " location: " + t.loc); } function input_end() { print("hello, world!"); } compile using the following command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/dumptypes.js -o/dev/null -c dumptypes.cc note:for g++4.5 and up use -fplugin-arg-gcc_dehydra-script= rather than -fplugin-arg it should print the following results: type f...
... see documentation for: process_type, input_end, print, .loc property example: using attributes to mark a class as "final" save the following code as final.cc: // this class should not be subclassed!
... class __attribute__((user("final"))) myclass { }; // this subclass should be an error class subclass : public myclass { }; save the following analysis script final.js: /** * helper function: returns true if a class is marked with the "final" attribute.
...*/ function isfinal(c) { if (!c.attributes) return false; for each (let a in c.attributes) if (a.name == 'user' && a.value == 'final') return true; return false; } function process_type(t) { if (t.bases) for each (let base in t.bases) if (isfinal(base.type)) error("class " + t.name + " extends final class " + base.type.name, t.loc); } compile using the following command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/final.js -o/dev/null -c final.cc it should print the following results and return with an error code: final.cc:8: error: class subclass extends final class myclass see documentation for: process_type, error, .bases property, .attributes property ...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects.
... if your code cannot find the gre and keeps throwing filenotfoundexceptions during the getgrepathwithproperties(...) call, check whether you already registered the gre on your system: gre registration the initembedding method kicks off the embedding process, allowing the java application to work with xpcom and mozilla.
...in addition to retrieving and calling methods on xpcom objects, javaxpcom allows the java application to pass java class objects to xpcom methods.
... following on from the above example, to create a new window, we would do the following: // first, get the event queue service.
Layout FAQ - Archive of obsolete content
how do you find out if there are any reflows that are pending and wait to show the view until afterwards, but if none are pending, show the view immediately?
... 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.
... what are the lowercase items called "line"?
Introducing the Audio API extension - Archive of obsolete content
this event has the following attributes: mozchannels: number of channels mozsamplerate: sample rate per second mozframebufferlength: number of samples collected in all channels this information is needed later to decode the audio data stream.
... the following example extracts the data from an audio element: <!doctype html> <html> <head> <title>javascript metadata example</title> </head> <body> <audio id="audio-element" src="song.ogg" controls="true" style="width: 512px;"> </audio> <script> function loadedmetadata() { channels = audio.mozchannels; rate = audio.mozsamplerate; framebufferlength = audio.mozframebufferlength; } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('loadedmetadata', loadedmetadata, false); </script> </body> </html> the mozaudioavailable event as the audio is played, sample data is made available to the audio layer and the audio buffer (size defined...
...you can see an example below: // write samples using a js array var samples = [0.242, 0.127, 0.0, -0.058, -0.242, ...]; var numbersampleswritten = audiooutput.mozwriteaudio(samples); // write samples using a typed array var samples = new float32array([0.242, 0.127, 0.0, -0.058, -0.242, ...]); var numbersampleswritten = audiooutput.mozwriteaudio(samples); in the following example, we create an audio pulse: <!doctype html...
...cript"> function playtone() { var output = new audio(); output.mozsetup(1, 44100); var samples = new float32array(22050); for (var i = 0; i < samples.length ; i++) { samples[i] = math.sin( i / 20 ); } output.mozwriteaudio(samples); } </script> </head> <body> <p>this demo plays a one second tone when you click the button below.</p> <button onclick="playtone();">play</button> </body> </html> the mozcurrentsampleoffset() method gives the audible position of the audio stream, meaning the position of the last heard sample.
Selection - Archive of obsolete content
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection");var textofsel = jetpack.selection.text;var htmlofsel = jetpack.selection.html; setting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection");jetpack.selection.text = 'hello';jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the following example will bold the html that you select.
Selection - Archive of obsolete content
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection"); var textofsel = jetpack.selection.text; var htmlofsel = jetpack.selection.html; setting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the following example will bold the html that you select.
Selection - Archive of obsolete content
ArchiveMozillaJetpackdocsUISelection
this api currently lives in the future and must be imported for use: jetpack.future.import("selection"); getting and setting the selection the current version of jetpack.selection includes these formats: .text and .html getting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection"); var textofsel = jetpack.selection.text; var htmlofsel = jetpack.selection.html; setting the selection the following is an example of getting the selection from the user.
... jetpack.import.future("selection"); jetpack.selection.text = 'hello'; jetpack.selection.html = '<b>hello</b>'; methods onselection(func function)this method allows you to execute an event function when a selection is made.
...function adding a selection event jetpack.selection.onselection( fn ); removal of a selection event jetpack.selection.onselection.unbind( fn ); verbose example the following example will bold the html that you select.
Plug-n-Hack - Archive of obsolete content
pnh allows security tools to declare the functionality that they support which is suitable for invoking directly from the browser.
... a browser that supports pnh can then allow the user to invoke such functionality without having to switch to and from the tool.
... while some of the pnh capabilities do have a fixed meaning, particularly around proxy configuration, most of the capabilities are completely generic, allowing tools to expose whatever functionality they want.
...plug-n-hack topics phase 1 this provides simplified integration and allows tools to advertize their capabilities to browsers phase 2 this will allow browsers to advertize their capabilities to security tools tools supporting pnh the browsers and tools known to support or be working on support for pnh get involved how to implement pnh in your tool or get involved with pnh development ...
Styling - Archive of obsolete content
prism allows for some client-side web application styling.
... the web application bundle is allowed to hold a css file named webapp.css (called the webapp style).
...this allows prism webapps to take on an os-specific look.
...the folder names must match the following: windows - winnt mac os x - darwin linux - linux the folder names are pulled from mozilla and are the same as those used in other mozilla projects, such as extension and xul applications.
Static Analysis for Windows Code under Linux - Archive of obsolete content
we highly recommend you to read the cross compiling manual and the dehydra build manual before you start the following reading.
...follow that instructions strictly for making a cross compiler.
...so, please follow this link exactly.
...just follow this and this to compile both dehydra and treehydra shared libraries.
Running Tamarin performance tests - Archive of obsolete content
to run performance tests on the android shell see 'testing the android shell' below.
... running the performance tests requires the following steps: set the avm environment variable to the path of the avmshell executable.
...performance test options there are a variety of options available with runtests.py - here is the help text followed by explanations for some options: $ ./runtests.py -h usage: runtests.py [options] [tests] -v --verbose enable additional output -e --avm avmplus command to use -a --asc compiler to use -g --globalabc deprecated but still works - use builtin.abc (used to be location of global.abc) -b --builtinabc location of builtin.abc -s --shellabc location of shell_toplev...
...just type the following commands after making sure you've set the environment variables correctly.
The life of an HTML HTTP request - Archive of obsolete content
if there are several frames created from a content node, then the first of these are called the "primary" node, and the following frames can be found by using the getnextinflow() method of nsiframe.
... the initial reflow is done by the nshtmlcontentsink::startlayout(), startlayout() calls presshell::initialreflow().
... todo: how are nsiframes reflowed after a change when they already exist?
...when the presshell [note: not true, who really does the call?] has layouted (reflowed) the frames it calls nsiframe::paint() method of all frames.
Example Sticky Notes - Archive of obsolete content
--> <constructor><![cdata[ /** * the code below will be called one time only after * the binding is successfully prepared and bound.
... */ // your code goes here ]]></constructor> <destructor><![cdata[ /** * the code below will be called one time only before * binding is unbound.
... say an attempt to assign this.innertext='something' will lead to circular setter call and stack overflow.
...nt="mouseover"><![cdata[ this.$bg = this.style.backgroundcolor || '#ffff00'; this.style.backgroundcolor = '#ffcc00'; ]]></handler> <handler event="mouseout"><![cdata[ this.style.backgroundcolor = this.$bg; ]]></handler> </handlers> </binding> </bindings> notes.css .sticker { position: relative; left: 0px; right: 0px; float: left; clear: none; width: 10em; height: 10em; overflow: visible; margin: 1em 1em; padding: 0.5em 0.5em; border: 2px solid blue; background-color: yellow; font: 1em normal "times new roman",serif; font-style: italic; cursor: default; } view this example ...
browser.type - Archive of obsolete content
« xul reference home type type: one of the values below.
...the content that is loaded inside the browser is not allowed to access the chrome above it.
...the content that is loaded inside the browser is not allowed to access the chrome above it.
...the content that is loaded inside the browser is not allowed to access the chrome above it.
mousethrough - Archive of obsolete content
« xul reference home mousethrough type: one of the values below determines whether mouse events are passed to the element or not.
... the mousethrough attribute is typically used in conjunction with a stack to allow elements to be stacked above other elements yet allow mouse events to be sent to lower elements.
... in the following example, the image appears above the button, yet the mousethrough attribute specified on the image causes mouse events to be ignored on the image and instead fall through to the button.
... <stack> <button label="below"/> <image src="happy.png" mousethrough="always"/> </stack> ...
resizeafter - Archive of obsolete content
« xul reference home resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned.
... closest the element immediately to the right or below the splitter resizes.
... farthest the element that is the farthest away from the splitter to the right or below the splitter resizes.
... grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size.
Accessing Files - Archive of obsolete content
this allows files to used in a portable way.
...the following example will retrieve a reference to a file named sample.txt located in the profile directory.
...for a full list of starting directories, see starting directories below.
...there are several other values which may be used as the first argument to nsiscriptableio.getfile(), listed in the following table.
Working With Directories - Archive of obsolete content
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.
...the result is a subdirectory three levels below the desktop directory.
...see creating directories below for information about this.
...the following example returns an array of all of a directory's subdirectories: function getsubdirs() { var arr = []; var items = io.getfile("home", "").directoryentries; while (items.hasmoreelements()) { var item = items.getnext(); if (item.isdirectory()) arr.push(item); } return arr; } ...
Reading from Files - Archive of obsolete content
the default character encoding is utf-8 which means that characters below value 128 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.
...note that binary streams do not interpret characters within the stream, so the returned string will only have characters below 256, if you expect to use the data as text.
...the following methods are available: readboolean will read a single byte from a stream and return false if the byte is zero and true if the byte has a non-zero value.
PopupEvents - Archive of obsolete content
an overview of these is listed below: contextmenu this event is fired when a request is made to open a context menu, whether by the keyboard or mouse.
...<menu label="edit"> <menupopup onpopupshowing="if (gdisallowed) event.preventdefault();"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> in this example, a global variable gdisallowed is checked and the preventdefault method is called.
...this technique, as shown in the following example, is needed if you wish to open a submenu programmatically.
...when a chain of menus is opened, that is, when a menu and at least one level of submenus is opened, first the popuphiding event will be fired on the lowest level of submenu.
Popup Guide - Archive of obsolete content
a brief overview of each type is listed here; more details for each type can be found by following the corresponding links.
...specifically, the first two types in the list below are menus.
...for example, a popup search field could be used to allow searching and will disappear when a search term has been entered.
... working with popups the following additional information is available about manipulating menus and popups.
Providing Command-Line Options - Archive of obsolete content
see also: xulrunner:commandline overview the code below is an example of writing a javascript xpcom component to handle command line parameters.
... example the below example component implements two command line parameters: firefox.exe -myapp opens a chrome window for my application.
... using the example to use this sample code, save the commandline.js file into the components directory and add the following lines to your chrome.manifest file: component {2991c315-b871-42cd-b33f-bfee4fcbf682} components/commandline.js contract @mozilla.org/commandlinehandler/general-startup;1?type=myapp {2991c315-b871-42cd-b33f-bfee4fcbf682} category command-line-handler m-myapp @mozilla.org/commandlinehandler/general-startup;1?type=myapp the javascript code const cc = components.classes; const ci = components.interfaces; components.utils.import("resource://gre/modules/xpcomutils.jsm"); components.utils.import("resource://gre/modules/services.jsm"); // changeme: to the chrome uri of...
... } } catch (e) { components.utils.reporterror("incorrect parameter passed to -viewapp on the command line."); } // changeme: change "myapp" to your command line flag (no argument) if (cmdline.handleflag("myapp", false)) { openwindow(chrome_uri, null); cmdline.preventdefault = true; } }, // changeme: change the help info as appropriate, but // follow the guidelines in nsicommandlinehandler.idl // specifically, flag descriptions should start at // character 24, and lines should be wrapped at // 72 characters with embedded newlines, // and finally, the string should end with a newline helpinfo : " -myapp open my application\n" + " -viewapp <uri> view and edit the uri in my application,\n" + ...
Building Menus With Templates - Archive of obsolete content
this allows for better performance as the entire content of a complex menu does not need to be created until the user needs to use the menu.
...after the first level of the menu has been generated, the content will be equivalent to the following (ignoring the template related content): <button label="houses in my neighbourhood" type="menu"> <menupopup> <menu uri="http://www.xulplanet.com/rdf/marion" label="marion street"/> <menu uri="http://www.xulplanet.com/rdf/garden" label="garden avenue"/> </menupopup> </button> the inner pass through the data handles the houses.
...there's nothing special about the way menus are handled -- the builder follows the same method for any type of content.
... however, the nature of menus can make this tricky to follow.
XML Templates - Archive of obsolete content
for this and the following examples, we are going to use the following xml document containing a list of people: <people> <person name="napoleon bonaparte" gender="male"/> <person name="cleopatra" gender="female"/> <person name="julius caesar" gender="male"/> <person name="ferdinand magellan" gender="male"/> <person name="laura secord" gender="female"/> </people> xml query syntax the query syntax is fairly ...
...when a question mark character followed by a string appears in an attribute value, the label value is not directly, but instead the value of an attribute for the source xml is used.
... for each node generated by the xpath expression used in the query, the attribute on the generated xml node is taken and substituted for the question mark and following string.
...for instance, the following query returns only those results for female people.
Tree Widget Changes - Archive of obsolete content
the constants below have been changed, and their integer values are different: nsitreeview.indropbefore -> nsitreeview.drop_before (-1) nsitreeview.indropon -> nsitreeview.drop_on (0) nsitreeview.indropafter -> nsitreeview.drop_after (1) nsitreeview.progressnormal -> nsitreeview.progress_normal (1) nsitreeview.progressundetermined ...
...it should return true if a drop is allowed on a row.
...in this case, disable editing for that cell by setting editable to false for that cell, as in the following: <treecell value="true" editable="false"/> or, for custom views, return false from the iseditable method.
... treechildren::-moz-tree-cell-text { cursor: pointer; } this allows you to create separate cursors for cells.
Adding Buttons - Archive of obsolete content
syntax of buttons the button tag has the following syntax: <button id="identifier" class="dialog" label="ok" image="images/image.jpg" disabled="true" accesskey="t"/> the attributes are as follows, all of which are optional: id a unique identifier so that you can identify the button with.
...the example code below shows how to do this.
... <button id="find-button" label="find"/> note: firefox does not allow you to open chrome windows from web pages, so the view links in the tutorial will open in normal browser windows.
...the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button id="find-button" label="find"/> <button id="cancel-button" label="cancel"/> </window> you'll notice that the cancel button was added also.
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
the general handler syntax is as follows: <binding id="binding-name"> <handlers> <handler event="event-name" action="script"/> </handlers> </binding> place all of your handlers within the handlers element.
...this should be set to one of the values set below: alt the user must press the alt key.
...the following alternate syntax can be used when the code in a handler is more complex: <binding id="binding-name"> <handlers> <handler event="event-name"> -- handler code goes here -- </handler> </handlers> </binding> handlers example the following example adds some key handlers to create a very primitive local clipboard: example 1 : source <binding id="clipbox"> <content> <xul:text...
...the code works as follows: this.clipboard=document.getanonymousnodes(this)[0].value; the first element of the anonymous content array is retrieved which gives a reference to the textbox element, which happens to be the first (and only) element within the content element.
Adding Labels and Images - Archive of obsolete content
an example is shown below: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed.
...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.
...</description> you can set the text via script using the textcontent property, as in the following example: <description id="text" width="200"/> document.getelementbyid('text').textcontent = "some lengthy word wrapped text goes here."; internally, both the label element and the description elements are the same.
...the example below shows this: <image src="images/banner.jpg"/> although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url.
Adding Style Sheets - Archive of obsolete content
in this file, we'll add the style declarations, as shown below: #find-text { min-width: 15em; } #progmeter { margin: 4px; } .springspace { width: 10px; } .titlespace { height: 10px; } notice how these styles are equivalent to the styles we had before.
...an example is shown below: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> this might be the first lines of a bookmarks window.
...this can be done with the code below, allowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> style import from css: @import url(chrome://global/skin/); the second syntax is preferred because it reduces the number of dependencies within the xul file itself.
...the following list summarizes some of the selectors available: button matches all button tags.
Cross Package Overlays - Archive of obsolete content
below, we'll add a find files toolbar to the browser.
...mozilla allows you to add a list of overlays to the contents.rdf file that you use to list chrome packages, skins and locales.
...the code below should be added into contents.rdf just before the closing rdf tag.
...the following example shows how: <rdf:seq about="urn:mozilla:stylesheets"> <rdf:li resource="chrome://messenger/content/messenger.xul"/> </rdf:seq> <rdf:seq about="chrome://messenger/content/messenger.xul"> <rdf:li>chrome://blueswayedshoes/skin/myskinfile.css</rdf:li> </rdf:seq> next, we'll see how to create an installer for a xul application.
Custom Tree Views - Archive of obsolete content
for instance, 5000 rows of treeitems would load too slowly.
...the following example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="name" flex="1"/> <treecol id="datecol" label="date" flex="1"/> </treecols> <treechildren/> </tree> to assign data to be displayed in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information.
...three methods that you should implement are listed below.
... function setview(){ document.getelementbyid('my-tree').view = treeview; } the following presents the example together.
Manipulating Lists - Archive of obsolete content
the syntax is as follows: list.insertitemat(3, "thursday", "thu"); list.removeitemat(3); the insertitemat() function takes an additional argument, the position to insert the new item.
... getting the selected item these two properties are commonly inspected during a select event, as in the following example: example 2 : source view <listbox id="thelist" onselect="alert(this.selecteditem.label);"> <listitem label="short"/> <listitem label="medium"/> <listitem label="tall"/> </listbox> the select event is fired for a listbox when an item in the list is selected.
... deleting selected items the following example shows a method of deleting the selected items properly: example 4 : source view <script> function deleteselection(){ var list = document.getelementbyid('thelist'); var count = list.selectedcount; while (count--){ var item = list.selecteditems[0]; list.removeitemat(list.getindexofitem(item)); } } </script> <button label="delete" oncommand="deleteselection();"/> <list...
... list scrolling if there are more rows in the listbox than can be displayed, a scroll bar will appear to allow the user to scroll the list.
Modifying a XUL Interface - Archive of obsolete content
for example, the following will add a button to a xul window: example 1 : source view <script> function addbutton(){ var abox = document.getelementbyid("abox"); var button = document.createelement("button"); button.setattribute("label","a new button"); abox.appendchild(button); } </script> <box id="abox" width="200"> <button label="add" oncommand="addbutton();"/> </box> this example has two parts ...
...the syntax of these functions is as follows: parent.appendchild(child); parent.insertbefore(child, referencechild); parent.replacechild(newchild, oldchild); parent.removechild(child); it should be fairly straightforward from the function names what these functions do.
...you can also retrieve the current label or value using these properties, as in the following example: example 5 : source view <button label="hello" oncommand="alert(this.label);"/> toggling a checkbox checkboxes have a checked property which may be used to check or uncheck the checkbox.
...for example, in a preferences dialog, one might have the choice of several possibilities, but one choice allows additional customization.
More Tree Features - Archive of obsolete content
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.
...you do this by adding the container attribute to it as follows: <treeitem container="true" /> this allows the user to click on the row that corresponds to the treeitem to expand and collapse the inner rows.
...example hierarchical tree the following is a simple example: example 1 : source view <tree rows="6"> <treecols> <treecol id="firstname" label="first name" primary="true" flex="3" /> <treecol id="lastname" label="last name" flex="7" /> </treecols> <treechildren> <treeitem container="true" open="true"> <treerow> <treecell label="guys" /> </treerow> <treechildren> <treeitem>...
...you will need to save a number of attributes as indicated in the example below: example 2 : source view <tree enablecolumndrag="true" flex="1"> <treecols> <treecol id="runner" label="runner" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="city" label="home city" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="starttime" label="start time" flex="1" persist="width ordin...
The Chrome URL - Archive of obsolete content
« previousnext » the following section will describe how to refer to xul documents and other chrome files.
...the basic syntax of a chrome url is as follows: chrome://<package name>/<part>/<file.xul> the text <package name> is the package name, such as messenger or editor.
... all package names are case insensitive, but lowercase names are preferred.
...the following url will refer to the bookmarks window, listed for firefox: chrome://browser/content/bookmarks/bookmarksmanager.xul you can enter chrome urls anywhere normal urls can be used.
XBL Attribute Inheritance - Archive of obsolete content
inherited attributes xbl allows us to build composite widgets while hiding their actual implementation.
...this allows both the flexibility of the textbox and the label of the button to be different for each use of the binding.
...the following demonstrates this: xul: <box class="labeledtextbox" title="enter some text:" value="ok"/> css: box.labeledtextbox { -moz-binding: url('chrome://example/skin/example.xml#labeledtextbox'); } xbl: <binding id="labeledtextbox"> <content> <xul:label xbl:inherits="value=title"/> <xul:textbox xbl:inherits="value"/> </content> </binding> the textbox inherits the value attribute d...
...the result is as follows: <box class="okcancel" oktitle="ok" canceltitle="cancel" image="happy.png"> <button label="ok" image="happy.png"/> <button label="cancel"/> </box> note that the attributes are duplicated on the inner (anonymous) content.
XBL Example - Archive of obsolete content
navigation buttons along the bottom will allow the user to cycle through the objects while a text widget between the buttons will display the current page.
... the following xul file produces the result in the image.
...the label element could be changed to a field where the user could enter the page to go to, or a popup could be added to allow selection of the page from a menu.
... the final code the final code is as follows: example 2 : source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedindex" selectedindex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext" oncommand="parentnode.parentnode.parentnode.page--;"/> <xul:description flex="1"/> <xul:button xbl:inherits="label=nexttext" oncommand="parentnode.parentnode.parentnode.page++;"/> </xul:hbox> </xul:vbox> </content> <implementation> <constructor> var totalpages=this.childnodes.length; document.getanonymousnodes(this)[0].c...
Using Remote XUL - Archive of obsolete content
this also means you can't load xul using file:// urls unless you set the preference dom.allow_xul_xbl_for_file to true.
...the remote xul manager extension lets you manage this whitelist, which is maintained using nsipermissionmanager, by creating entries of type "allowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.nsipermissionmanager) .add(uri, 'allowxulxbl', components.interfaces.nsipermissionmanager.allow_action); xul (pronounced like "zool"), which is short for xml-based user interface language, is an xml-based language for describing application interfaces.
...html-based navigation bars take up too much space, dhtml menus are slow and buggy, and site maps make you go to an intermediate page to find the information you want.
...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.
XUL accessibility tool - Archive of obsolete content
the version currently on xulplanet is compatible with the following xul applications: firefox 1.5+ thunderbird 3.0a+ recent sunbird builds recent songbird builds.
... 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...
... known bugs: test for lowercase i or l as accesskey (sometimes?) flags upppercase i and l too.
... possible false positives in some of the other tests processing is slower than we would like.
XML - Archive of obsolete content
you must be very careful about your syntax, and in particular about these four cardinal rules of xul: all events and attributes must be written in lowercase.
...all of the events and attributes -- even the javascript event listeners normally formatted in the javascript world with uppercase verbs (e.g., onclick, onload) -- must be lowercase or they are invalid.
... html allows some elements, such as <br> and <hr>, to be neither closed nor matched with a closing element.
...as the figure below indicates, xul is an amalgam of these different standards: css for styling or "skinning", dom for the object model and scriptable access, javascript for the linking and behavior, rdf for resources, xml for the structure, and html for the content and some little extras.
description - Archive of obsolete content
ption value="this is a long section of text that will not word wrap"> </description> this is a long section of dynamically controlled text that will word wrap <description id="desc" style="width: 300px"></description> document.getelementbyid('desc').textcontent = "this is a long section of dynamic message text that will word wrap"; attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
... value type: string the string attribute allows you to associate a data value with an element.
dialog - Archive of obsolete content
buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box.
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
... properties buttons type: comma-separated list of the values below a comma-separated list of buttons to appear on the dialog box.
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
label - Archive of obsolete content
ArchiveMozillaXULlabel
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
...odes(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element.
listcell - Archive of obsolete content
attributes crop, disabled, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
menupopup - Archive of obsolete content
attributes ignorekeys, left, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, top properties accessibletype, anchornode, popupboxobject, position, state, triggernode methods hidepopup, moveto, openpopup, openpopupatscreen, setconsumerollupevent, showpopup, sizeto examples the following example shows how a menupopup may be attached to a menulist.
... <menulist> <menupopup> <menuitem label="mozilla" value="http://mozilla.org"/> <menuitem label="slashdot" value="http://slashdot.org"/> <menuitem label="sourceforge" value="http://sf.net"/> <menuitem label="freshmeat" value="http://freshmeat.net"/> </menupopup> </menulist> the following example shows how a menupopup can be used as a context menu for an element.
...this allows you to place the popup on one side of a button.
...this is what you might do to show a popup below a button, for example.
notificationbox - Archive of obsolete content
this element is used, for example, to implement the yellow information bar in various firefox windows.
... properties currentnotification, allnotifications, notificationshidden methods appendnotification, getnotificationwithvalue, removeallnotifications, removecurrentnotification, removenotification, removetransientnotifications, 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, sortd...
... priority levels (defined as properties of notificationbox) : priority_info_low priority_info_medium priority_info_high priority_warning_low priority_warning_medium priority_warning_high priority_critical_low priority_critical_medium priority_critical_high priority_critical_block buttons : the buttons argument is an array of button descriptions.
... each description is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated.
resizer - Archive of obsolete content
ze;"/> <resizer dir="bottomleft" height="2" style="cursor: sw-resize;"/> </vbox> <vbox flex="1"> <resizer dir="top" height="2" style="background-color: grey; cursor: n-resize;"/> <browser flex="1" id="browser" type="content-primary"/> <resizer dir="bottom" height="2" style="background-color: grey; cursor: s-resize;"/> </vbox> <vbox width="2" style="background-color: grey; overflow: hidden;"> <resizer dir="topright" height="2" style="cursor: ne-resize;"/> <resizer dir="right" flex="1" style="cursor: e-resize;"/> <resizer dir="bottomright" height="2" style="cursor: se-resize;"/> </vbox> </hbox> </window> resizing an element <stack style="border: 1px solid black;"> <button id="button" label="resizable" left="18" top="18" right="18" bottom="18"/> <resizer di...
..."0" top="0" width="16" height="16"/> <resizer dir="bottomleft" style="background: black; -moz-appearance: none;" element="button" left="0" bottom="0" width="16" height="16"/> <resizer dir="bottomright" style="background: black; -moz-appearance: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> attributes dir type: one of the values below the direction that the window is resized.
... 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
richlistbox - Archive of obsolete content
the disabled attribute is allowed only for form controls.
... seltype type: one of the values below used to indicate whether multiple selection is allowed.
...(default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column.
... value type: string the string attribute allows you to associate a data value with an element.
separator - Archive of obsolete content
attributes orient style classes groove, groove-thin, thin examples <separator class="groove-thin"/> attributes orient type: one of the values below used to specify whether the separator is a horizontal or vertical separator.
... inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherite...
...d properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, getuserda...
...es(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata style classes the following classes may be used to style the element.
titlebar - Archive of obsolete content
if you don't want this behavior, you can override it by setting allowevents="true" on the titlebar element.
... style="background: rgba(30, 30, 30, 0.9); -moz-border-radius: 10px; -moz-box-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); margin: 8px 12px 16px;"/> </window> it can be opened from the error console like this: open("file:///users/markus/sites/hudwindow.xul", "", "chrome=1, titlebar=0") 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width note: the allowevents attribute did not work for title bars prior to firefox 3.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamen...
tooltip - Archive of obsolete content
reen, showpopup, sizeto examples <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <label value="click here to see more information"/> <label value="really!" style="color: red;"/> </tooltip> <vbox> <button label="simple" tooltiptext="a simple popup"/> <button label="more" tooltip="moretip"/> </vbox> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } default type: boolean if true, the tooltip is used as the default popup for displaying tooltips in the window.
...this allows you to place the popup on one side of a button.
...this is what you might do to show a popup below a button, for example.
treecell - Archive of obsolete content
attributes editable, label, mode, properties, ref, src, value attributes editable type: boolean allows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">.
... mode type: one of the values below for columns that are progress meters, this determines the type of progress meter to use.
... value type: string the string attribute allows you to associate a data value with an element.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
Application Update - Archive of obsolete content
getting started you will need the following utility scripts from http://lxr.mozilla.org/mozilla/sourc...ate-packaging/ (or local source of xulrunner) common.sh make_full_update.sh you will need mar / mar.exe to build a complete update patch.
... application settings you will need to configure the following settings in your application: branding the update process uses branding information, setup branding for your application as described here: xulrunner tips icons the updater process for linux systems requires updater.png to be in your <application folder>/icons/, see https://bugzilla.mozilla.org/show_bug.cgi?id=706846 preferences // whether or not app updates are enabled pref("app.update.
...enabled", true); // this preference turns on app.update.mode and allows automatic download and // install to take place.
...pref("app.update.incompatible.mode", 0); update server follow the instructions here to setup an update server for your xulrunner application to query.
Building XULRunner with Python - Archive of obsolete content
you will also want to disable any virus scanner resident monitoring as that will slow builds.
... set cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot having created amozilla project directory (e.g.c:\projects\mozilla or/c/projects/mozilla in msys) create the following .mozconfig file.
...ons --disable-activex ac_add_options --disable-activex-scripting ac_add_options --disable-tests ac_add_options --enable-optimize to check out all the required source code and build it the first time with no local client.mk file, execute cd /c/projects cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk cd mozilla make -f client.mk for subsequent updates from cvs followed by a build, use cd /c/projects/mozilla make -f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options.
... using python in xul applications add the following to yourprefs.js during development pref("browser.dom.window.dump.enabled", true); pref("javascript.options.showinconsole", true); pref("javascript.options.strict", true); pref("nglayout.debug.disable_xul_cache", true); pref("nglayout.debug.disable_xul_fastload", true); html <script> tags specify that python is used withtype="application/x-python" attribute.
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
my app's example follows.
... my app's .iss file sample as follows: ; script generated by the inno setup script wizard.
... [setup] appname=my app appvername=my app 1.0 apppublisher=mark finkle apppublisherurl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner appsupporturl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner appupdatesurl=http://developer.mozilla.org/en/docs/getting_started_with_xulrunner defaultdirname={pf}\my app defaultgroupname=my app allownoicons=yes outputdir=..\build\output outputbasefilename=myapp-1.0-win32 ; setupiconfile= compression=lzma solidcompression=yes [languages] name: english; messagesfile: compiler:default.isl [components] name: main; description: my app; types: full compact custom; flags: fixed name: runtime; description: xul runner runtime; types: full custom [tasks] name: desktopicon; description: {cm:createdes...
...ns] name: {group}\my app; filename: {app}\myapp.exe name: {group}\{cm:uninstallprogram,xul explorer}; filename: {uninstallexe} name: {userdesktop}\my app; filename: {app}\myapp.exe; tasks: desktopicon name: {userappdata}\microsoft\internet explorer\quick launch\my app; filename: {app}\myapp.exe; tasks: quicklaunchicon [run] filename: {app}\myapp.exe; description: {cm:launchprogram,my app}; onlybelowversion: 0,6; flags: nowait postinstall skipifsilent step 4: building an installer once your script is ready, start the inno setup compiler, load the script file, and compile it.
Deploying XULRunner - Archive of obsolete content
the installed files should be arranged in the following directory structure: installdir/ application.ini components/ ...
...copy xulrunner/ to this directory when deploying with xulrunner 2.0 and above do the following: move chrome.manifest to the root directory, and adjust resource paths inside chrome.manifest accordingly with xulrunner 9.0 or 10.0 you may need to copy "mozutils.dll" and/or "mozcrt19.dll" from the xulrunner directory to the root directory.
...the complete bundle structure is as follows: myapp.app/ contents/ info.plist pkginfo frameworks/ xul.framework/ files copied from /library/frameworks/xul.framework/versions/1.8/...
...the archive should be structured as follows: appname/ application.ini components/ ...
calICalendarView - Archive of obsolete content
this allows lack of required predictability allows calicalendarview implementations to be re-used in a variety of sitatuations.
...this link allows the calicalendarview to have a way of creating, modifying, and deleting events based on user interaction with the dom nodes it controls, often without requiring any other user interaction.
... supportsdisjointdates consumers of calicalendarview should check this attribute to determine whether or not the implementation allows for calls to setdatelist.
... if an implementation returns true for this attribute, it must allow for any arbitrary set of dates to be displayed.
nsIContentPolicy - Archive of obsolete content
this interface can be very useful if you are developing a content-aware plugin (blocking ads or altering the look of content, for example), or if you want to stop or allow user-browsed urls.
...this means that implementers of this method must not do any of the following: modify the dom in any way (e.g., setting attributes is a no-no).
...for instance, shouldprocess could be used to allow a response from a server to be handled or ignored depending on the mime type of the response.
...see example below.
2006-11-17 - Archive of obsolete content
reflow branch testing wanted l.
... david baron would like users to test the reflow branch as it is coming close to being merged with the trunk.
... nightly builds, instructions and the current list of known regressions on the branch can be found at: http://wiki.mozilla.org/gecko:reflow...ng#quick_links.
...if bugs are filed, "[reflow branch]" should be placed at the beginning of the summary.
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
this greatly bloats the size of contents but is necessary since certain characters are no allowed in xml.
...it is not actually allowed.
... the rss 2.0 specification clearly states that “entity-encoded html is allowed“ and even provides examples showing exactly the syntax above (using cdata and unencoded html).
... an example using the most popular element of the rss content module is shown below: <?xml version="1.0"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" > <channel> <title>example</title> <description>an rss example with slash</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>a link in here</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/114</guid> <pubdate>sun, 15 may 2005 13:02:08 -0500</pubdate> <link>http://www.example.com/blog/2005/05/15/114</link> <content:encode...
Theme changes in Firefox 3 - Archive of obsolete content
filename css file details changes to the default theme the table below lists changes made in the default theme for firefox 3; you can use this information as a starting point for figuring out the changes you need to make.
... changes in browser --- changes in global all platforms the yellow background for the location bar has been deprecated; instead, themes should style the new #identity-box element depending on its verifieddomain/verifiedidentity class.
...the rule that's needed to show and hide the go button and other location bar icons is: #urlbar[pageproxystate="invalid"] > #urlbar-icons > :not(#go-button) , #urlbar[pageproxystate="valid"] > #urlbar-icons > #go-button { visibility: collapse; } images to add add the following images: chrome://global/skin/icons/information-16.png used when presenting information notices.
... images to remove the following images were removed: chrome://mozapps/skin/extensions/question.png no longer used.
Using SSH to connect to CVS - Archive of obsolete content
the following command should generate a suitable key pair: ssh-keygen -t dsa this will take a moment, followed by a prompt for a passphrase.
... download, build, and install corkscrew by following the instructions in the install file in the corkscrew source distribution.
... make sure you have a ~/.ssh/config file that has at least the following directives preferredauthentications hostbased,publickey,password host cvs.mozilla.org proxycommand corkscrew <i>proxyserver.foo.com</i> <i>port</i> %h %p replaceproxyserver.foo.com with the hostname of your proxy server, andport with the numeric tcp port on which the http tunnel is running.
...assuming you use a shell script or batch file to set things up, just add the commands below to the end of your file.
Using the W3C DOM - Archive of obsolete content
unsupported dom-related properties the following ie proprietary document object properties are not supported in the w3c document object model: document.layers[] id_attribute_value document.all document.all.id_attribute_value document.all[id_attribute_value] the following form related properties (originally from internet explorer) are not supported in the w3c document object model: formname.inputname.value inputname.value formct...
...for example, the following short sample dynamically sets the left margin of a <div> element with an id of "inset" to half an inch: // in the html: <div id="inset">sample text</div> document.getelementbyid("inset").style.marginleft = ".5in"; note: internet explorer 5 through 7 have a flawed implementation of getelementbyid(), which returns the first element with a matching name or id (id versus name when using getelem...
... manipulating document style and content changing an element's style using the dom the following table describes standards-based methods for accessing and updating style rules defined for various html elements in a web page.
... the following examples show how to modify the text of a span element that already exists in the html file.
-ms-block-progression - Archive of obsolete content
top-to-bottom block flow.
... rl right-to-left block flow.
... bt bottom-to-top block flow.
... lr left-to-right block flow.
-ms-hyphenate-limit-zone - Archive of obsolete content
initial value0applies toblock container elementsinheritedyespercentagescalculated with respect to the width of the line boxcomputed valueas specifiedanimation typediscrete syntax values <percentage> an integer followed by a percent sign (%), which specifies the width of the hyphenation zone, calculated with respect to the line box.
... negative values are not allowed.
... <length> a floating-point number, followed by a relative units designator, that indicates the width of the hyphenation zone.
... negative values are not allowed.
-ms-scroll-snap-points-y - Archive of obsolete content
snapinterval( <length-percentage>, <length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points.
... the second value specifies the distance between subsequent snap-points both above and below the initial snap-point.
...(the -ms-scroll-snap-points-y property behaves identically to the -ms-scroll-snap-points-x property, but along the y-axis.) .container { overflow-x: auto; overflow-y: hidden; -ms-scroll-snap-type: mandatory; -ms-scroll-snap-points-y: snapinterval(0%, 100%); width: 480px; height: 270px; } .imagecontainer { -ms-scroll-chaining: chained; -ms-overflow-style: none; -ms-content-zooming: zoom; -ms-scroll-rails: none; -ms-scroll-limit-y-min: 100%; -ms-scroll-limit-y-max: 500%; -ms-scroll-snap-type: proximity; -ms-scroll-...
...snap-points-y: snaplist(100%, 200%, 300%, 400%, 500%); -ms-overflow-style: none; width: 480px; height: 270px; overflow: auto; } specifications not part of any specification.
::-ms-fill - Archive of obsolete content
all allowable properties except animation-name apply to a determinate progress bar.
... -ms-bar shows animated dots that flow in a bar pattern.
... -ms-ring shows animated 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.
Generator comprehensions - Archive of obsolete content
the generator comprehension syntax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object.
... syntax (for (x of iterable) x) (for (x of iterable) if (condition) x) (for (x of iterable) for (y of iterable) x + y) description inside generator comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component.
... multiple for-of iterations or if statements are allowed.
... examples simple generator comprehensions (for (i of [1, 2, 3]) i * i ); // generator function which yields 1, 4, and 9 [...(for (i of [1, 2, 3]) i * i )]; // [1, 4, 9] var abc = ['a', 'b', 'c']; (for (letters of abc) letters.tolowercase()); // generator function which yields "a", "b", and "c" generator comprehensions with if statement var years = [1954, 1974, 1990, 2006, 2010, 2014]; (for (year of years) if (year > 2000) year); // generator function which yields 2006, 2010, and 2014 (for (year of years) if (year > 2000) if (year < 2010) year); // generator function which yields 2006, the same as below: (for (year of ...
Error.number - Archive of obsolete content
the upper 16-bit word is the facility code, and the lower word is the error code.
... example the following example causes an exception to be thrown and displays the error code that is derived from the error number.
... var x = y; } catch(e) { document.write ("error code: "); document.write (e.number & 0xffff) document.write ("<br />"); document.write ("facility code: ") document.write(e.number>>16 & 0x1fff) document.write ("<br />"); document.write ("error message: ") document.write (e.message) } example the output of this code is as follows.
... error code: 5009 facility code: 10 error message: 'y' is undefined requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
GetObject - Archive of obsolete content
some applications allow you to activate part of a file.
... to do so, add an exclamation point (!) to the end of the file name and follow it with a string that identifies the part of the file you want to activate.
...you could use the following code to activate a layer within a drawing called schema.cad: var layerobject = getobject("c:\\cad\\schema.cad!layer3"); if you do not specify the object's class, automation determines which application to start and which object to activate, based on the file name you provide.
... requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, and internet explorer 8 standards.
New in JavaScript 1.3 - Archive of obsolete content
the following is a changelog for javascript from netscape navigator 4.0 to 4.5.
...additional features of version 1.2, at the time not specified by ecma-262 were kept in the javascript language (see below for a list of differences).
... non-ecma-262 features of javascript 1.3 the following is a comparison between the june 1998 version of ecma-262 and javascript 1.3.
... the following features were not part of the standard at that time, but implemented in javascript 1.3.
handler.enumerate() - Archive of obsolete content
syntax var p = new proxy(target, { enumerate(target) { } }); parameters the following parameter is passed to the enumerate method.
... interceptions this trap can intercept these operations: property enumeration / for...in: for (var name in proxy) {...} reflect.enumerate() invariants if the following invariants are violated, the proxy will throw a typeerror: the enumerate method must return an object.
... examples the following code traps for...in statements.
... var p = new proxy({}, { enumerate(target) { console.log('called'); return ['a', 'b', 'c'][symbol.iterator](); } }); for (var x in p) { // "called" console.log(x); // "a" } // "b" // "c" the following code violates the invariant.
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
<div class="card"> <img src="thumb_clown_trigger.jpg" alt="clown trigger" border="0" width="150" height="115"> <h3>clown trigger</h3> <p> our clown trigger is a bold little fish, though for a few weeks he slept a lot and didn't look well in general.
... unfortunately, a few browsers don't get this right, and end up flowing the cards as a single vertical column instead of putting the fish side by side.
... after a bit of fiddling to try to fix this, i decided that trying to overcome this error in document flow wasn't worth the effort.
...rather than try to fight it or push the image below the h3's element box, i let the image mostly overlap the h3, but with a slight offset.
XForms Select Element - Archive of obsolete content
introduction allows the user to choose one or more selections from a list of pre-defined items (see the spec).
...this attribute, when set to 'open', allows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model.
... representations the xforms select element can be represented by the following widgets for the specified appearance attribute values: list - default representation (xhtml/xul) check group- used when appearance = 'full' (xhtml/xul) list displaying a listbox is the default representation (xhtml/xul).
XForms Select1 Element - Archive of obsolete content
introduction allows the user to choose a single value from a list of pre-defined values (see the spec).
... single-node binding special selection - this attribute, when set to 'open', allows the user to provide free entry to the list.
...the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an xforms model.
... representations the xforms select1 element can be represented by the following widgets for the specified appearance attribute values: combobox - default representation (xhtml/xul) listbox - used when appearance = 'compact' (xhtml/xul) radio group - used when appearance = 'full' (xhtml/xul) combobox displaying a combobox is the default representation (xhtml/xul).
Describing microformats in JavaScript - Archive of obsolete content
microformat definition format the microformat definition must contain the following entries: mfversion specifies the version number of the microformat api to which the definition was written.
...the adr microformat is defined as follows: var adr_definition = { mfversion: 0.8, mfobject: adr, classname: "adr", properties: { "type" : { plural: true, types: ["work", "home", "pref", "postal", "dom", "intl", "parcel"] }, "post-office-box" : { }, "street-address" : { plural: true }, "extended-address" : { }, "locality" : { }, "region" : { }, "postal-code" :...
...this allows an address to be marked as being, for example, a work address for receiving parcels.
...this allows multiple lines of address information to be contained in the street-address array.
Popup Window Controls - Archive of obsolete content
mozilla and firefox allow users to control most unsolicited attempts to open new windows such as popup and popunder windows.
... popup window controls configuration using the preference for privacy & security > popup windows, users can: allow all sites to open popup windows except for sites which the user has explicity denied permission what popup windows are suppressed?
... mozilla will attempt to suppress all calls to window.open() which occur in the following circumstances: global script which is executed as the document is loading script executed as part of a onload event handler script executed in settimeout() or setinterval() what popup windows are not suppressed?
...empt to open an unsolicited window var popup = window.open('about:blank', 'popup'); if (!popup) { // the user has suppressed the popup } // --> </script> </head> <body> <!-- your page here --> </body> </html> if your popup window is crucial to the operation of your web site you can notify the user and ask them to add your site to the list of sites which are allowed to use unsolicited popup windows.
Game distribution - Game development
you've followed a tutorial or two and created an html5 game — that's great!
...this can range from low-end smartphones or tablets, through laptops and desktop computers, to smart tvs, watches or even a fridge if it can handle a modern enough browser.
... google play's requirements are less strict, so the store is polluted with low quality games.
...it's more like an excellent promotional opportunity than a way to earn a lot of money, however, as the prices paid for the games in a bundle are usually quite low.
Explaining basic 3D theory - Game development
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.
...applying textures onto objects during the fragment processing stage of the rendering pipeline allows us to adjust it by wrapping and filtering it if necessary.
... texture wrapping allows us to repeat the 2d image around the 3d object.
...if you want to move on to practice and see some demos in action, follow up with the tutorials below: building up a basic demo with three.js building up a basic demo with babylon.js building up a basic demo with playcanvas building up a basic demo with a-frame go ahead and create some cool cutting-edge 3d experiments yourself!
Implementing game control mechanisms - Game development
in the following articles we will show how to implement various different control mechanisms for captain rogers to support different platforms — from touch on mobile, through keyboard/mouse/gamepad on desktop, to more unconventional ones like tv remote, shouting to or waving your hand in front of the laptop, or squeezing bananas.
...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 truly multiplatform; all of the following articles focus on the apis provided for interfacing with different control mechanisms: mobile touch controls — the first article will kick off with touch, as the mobile first approach is very popular.
... desktop gamepad controls — the gamepad api rather usefully allows gamepads to be used for controlling web apps on desktop/laptop, for that console feel.
Build the brick field - Game development
add the following lines to your code below the variables which you have previously declared in your program.
...add the following just below your variables: var bricks = []; for(var c=0; c<brickcolumncount; c++) { bricks[c] = []; for(var r=0; r<brickrowcount; r++) { bricks[c][r] = { x: 0, y: 0 }; } } the code above will loop through the rows and columns and create the new bricks.
... the final version of the drawbricks() function, after assigning the brickx and bricky values as the coordinates instead of (0,0) each time, will look like this — add this into your code below the drawpaddle() function: function drawbricks() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var brickx = (c*(brickwidth+brickpadding))+brickoffsetleft; var bricky = (r*(brickheight+brickpadding))+brickoffsettop; bricks[c][r].x = brickx; bricks[c][r].y = bricky; ctx.beginpath(); ...
...add the following just above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : exercise: try changing the number of bricks in a row or a column, or their positions.
Create the Canvas and draw on it - Game development
using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev canvas workshop</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascript code goes here </script> </body> </html> we have a char...
...the <canvas> element has an id of mycanvas to allow us to easily grab a reference to it, and it is 480 pixels wide and 320 pixels high.
...add the following below your opening <script> tag.
...add this below your previous lines of javascript, then load your index.html in a browser to try it out.
Finishing up - Game development
let's first add a variable to store the number of lives in the same place where we declared our other variables: var lives = 3; drawing the life counter looks almost the same as drawing the score counter — add the following function to your code, below the drawscore() function: function drawlives() { ctx.font = "16px arial"; ctx.fillstyle = "#0095dd"; ctx.filltext("lives: "+lives, canvas.width-65, 20); } instead of ending the game immediately, we will decrease the number of lives until they are no longer available.
...so, in the draw() function replace the following three lines: alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game with this, we can add slightly more complex logic to it as given below: lives--; if(!lives) { alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } else { x = canvas.width/2; y = canvas.height-30; dx = 2; dy = -2; paddlex = (canvas.width-paddlewidth)/2; } now, when the ball hits the bottom edge of the screen, we're subtracting one life from the lives variable.
... rendering the lives display now you need to add a call to drawlives() inside the draw() function and add it below the drawscore() call.
...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()...
Mouse controls - Game development
add the following line in the same place as the other event listeners, just below the keyup event: document.addeventlistener("mousemove", mousemovehandler, false); anchoring the paddle movement to the mouse movement we can update the paddle position based on the pointer coordinates — the following handler function will do exactly that.
... add the following function to your code, below the previous line you added: function mousemovehandler(e) { var relativex = e.clientx - canvas.offsetleft; if(relativex > 0 && relativex < canvas.width) { paddlex = relativex - paddlewidth/2; } } in this function we first work out a relativex value, which is equal to the horizontal mouse position in the viewport (e.clientx) minus the distance between the left edge of the canvas and left edge of the viewport (canvas.offsetleft) — effectively this is equal to the distance between the canvas left edge and the mouse pointer.
... if the relative x pointer position is greater than zero and lower than the canvas width, the pointer is within the canvas boundaries, and the paddlex position (anchored on the left edge of the paddle) is set to the relativex value minus half the width of the paddle, so that the movement will actually be relative to the middle of the paddle.
... the paddle will now follow the position of the mouse cursor, but since we're restricting the movement to the size of the canvas, it won't disappear completely off either side.
Buttons - Game development
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.
...add the following lines to the bottom of your create() function: startbutton = game.add.button(game.world.width*0.5, game.world.height*0.5, 'button', startgame, this, 1, 0, 2); startbutton.anchor.set(0.5); the button() method's parameters are as follows: the button's x and y coordinates the name of the graphic asset to be displayed for the button a callback function that will be executed when the button is pressed a reference to this to specify the execution context the frames that will be used for the over, out and down events.
... compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps the last thing we will do in this article series is make the gameplay even more interesting by adding some randomization to the way the ball bounces off the paddle.
Extra lives - Game development
new variables add the following new variables below the existing ones in your code: var lives = 3; var livestext; var lifelosttext; these respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives.
...add the following lines below the existing scoretext definition inside your create() function: livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, { font: '18px arial', fill: '#0095dd' }); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', { font: '18px arial', fill: '#0095dd' }); lifelosttext.anchor.set(0.5); lifelosttext.visible = false; the livestext and lifelosttext objects look very similar to the scoretext one — they define a position on the screen, the actual text to display, and the font styling.
...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.
... 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 lives made the game more forgiving — if you lose one life, you still have two more left and can continue to play.
Physics - Game development
add the physics.startsystem() method at the beginning of the create function (make it the first line inside the function), as shown below: game.physics.startsystem(phaser.physics.arcade); next, we need to enable our ball for the physics system — phaser object physics is not enabled by default.
... 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.
... 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 can move to the next lesson and see how to make the ball bounce off the walls.
Randomizing gameplay - Game development
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.
... 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: summary you've finished all the lessons — congratulations!
... exercises to follow you can do a lot more in the game — add whatever you feel would be best to make it more fun and interesting.
...below are some suggestions as to how you could expand our little game, to get you started: add a second ball or paddle.
Visual JS GE - Game development
installing modules navigate to server_instance/, then in the node.js command prompt or console enter the following installation commands: npm install mysql npm install delivery npm install express npm install mkdirp npm install socket.io npm install nodemailer@0.7.0 setting up config.js you will find config.js in the server_instance folder: all node.js applications use the same folder — server_instance.
...you need to edit the config file to include the correct paths to the node app and project instance, as indicated below: module.exports = { version : "0.5", path_of_node_app : "d:/path_to_server_instance_folder/server/" , // edit here path_of_www : "d:/xamp/htdocs/project_instance/", // path_to_www edit here editor_port : "1013", reg_path : "users/", account_port : 3666 , destroy_session_after_x_mseconds : 20000, }; local node.js application tools (uses in developer mode only) the following section provides information about the tools involved in visual-js game engine.
... after this has finished processing, restart the web page by entering the following in the console: resource.test_res.
...contains the following tools.
Gecko FAQ - Gecko Redirect 1
gecko has been known previously by the code names "raptor" and "nglayout"; the new name was chosen following a trademark infringement dispute.
... by the end of calendar year 2000, gecko is expected to support the following recommended open internet standards fully except for the areas noted below and open bugs documented in bugzilla: html 4.0 - full support except for: elements: bdo, basefont attributes: shape attribute on the a element, abbr, axis, headers, scope-row, scope-col, scope-rowgroup, scope-colgroup, charoff, datasrc, datafld, dataformat, datapagesize, summary, event, dir, align on table c...
...so long as qa testing and test case development continues, there will always be known bugs at any given point in time in the open-source gecko codebase, and it follows that every commercial product that has ever shipped and ever will ship based on gecko will have known bugs at the time of its release.
... gecko includes the following components: document parser (handles html and xml) layout engine with content model style system (handles css, etc.) javascript runtime (spidermonkey) image library networking library (necko) platform-specific graphics rendering and widget sets for win32, x, and mac user preferences library mozilla plug-in api (npapi) to support the navigator plug-in interface open java interface (...
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
in the following example there is a grid with three column tracks and two row tracks.
...the image below shows the line numbers of the grid, assuming the language is left-to-right.
...in the following example the item is positioned from column line 1 to column line 3, and from row line 1 to row line 3.
...when placing an item, you can then use these names instead of the line number, as demonstrated below.
Network throttling - MDN Web Docs Glossary: Definitions of Web-related terms
network throttling is an intentional slowing down of internet speed.
... in web performance, network throttling, or network condition emulation, it is used to emulate low bandwidth conditions experienced by likely a large segment of a site's target user base.
...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.
... browser developer tools generally have network throttling options, to allow you to test your app under slow network conditions.
Quality values - MDN Web Docs Glossary: Definitions of Web-related terms
it is a special syntax allowed in some http headers and in html.
... the importance of a value is marked by the suffix ';q=' immediately followed by a value between 0 and 1 included, with up to three decimal digits, the highest value denoting the highest priority.
... examples the following syntax text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 indicates the order of priority: value priority text/html and application/xhtml+xml 1.0 application/xml 0.9 */* 0.8 if there is no priority defined for the first two values, the order in the list is irrelevant.
... nevertheless, with the same quality, more specific values have priority over less specific ones: text/html;q=0.8,text/*;q=0.8,*/*;q=0.8 value priority text/html 0.8 (but totally specified) text/* 0.8 (partially specified) */* 0.8 (not specified) some syntax, like the one of accept, allow additional specifiers like text/html;level=1.
Thread - MDN Web Docs Glossary: Definitions of Web-related terms
because these things are all happening in one thread, a slow website or app script slows down the entire browser; worse, if a site or app script enters an infinite loop, the entire browser will hang.
...this allows slow, complex, or long-running tasks to be executed independently of the main thread, preserving the overall performance of the site or app—as well as that of the browser overall.
... this also allows individuals to take advantage of modern multi-core processors.
...they help minimise the context switching time, enables more efficient communication and allows further use of the multiprocessor architecture.
Test your skills: CSS and JavaScript accessibility - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
...clicking one of the animal names causes a further description of that animal to appear in a box below the list.
Accessibility - Learn web development
the following video provides a nice introduction to it: looking to become a front-end web developer?
... 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.
... 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.
... 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.
Test your skills: backgrounds and borders - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
Test your skills: values and units - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
... 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.
Test your skills: Multicol - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
... 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.
Test your skills: position - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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?
... position two in the below example if you scroll the box the sidebar scrolls with the 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.
How do you make sure your website works properly? - Learn web development
you might be surprised at how many problems come up: images don't show up, pages don't load or load slowly, and so on.
... 403: forbidden you aren't allowed to display the resource.
...we'll discuss how to solve this below.
...resources like webpagetest.org or browser add-ons like yslow can tell you a few interesting things: grades go from a to f.
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.
...the tabindex attribute allows you to define this order.
... <a href="somepage.html" accesskey="s">some page</a> skip links to aid tabbing, you can supply links that allow users to jump over chunks of your web page.
... you might want to allow someone to jump over a plethora of navigation links, for example, so they can just read a page’s main content rather than cycle through all of the links.
How do you set up a local testing server? - Learn web development
if the web address path starts with file:// followed by the path to the file on your local hard drive, a local file is being used.
...if you are a windows user, you can get an installer from the python homepage and follow the instructions to install it: go to python.org under the download section, click the link for python "3.xxx".
...to check python is installed, enter the following command: python -v # or you might have the py command available, # in which case try py -v this should return a version number.
... note: if you already have something running on port 8000, you can choose another port by running the server command followed by an alternative port number, e.g.
Example 2 - Learn web development
<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> <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; } /* ------------ */ /* fanc...
... 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 */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); result for js no js html content <form class="no-widget"> <select name="m...
... <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> <form> css content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } result for no js ...
Test your skills: HTML5 controls - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...create appropriate inputs for a user to update their details for: email website phone number favourite color try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... html5 controls 2 next, we want you to implement a slider control to allow the user to choose a maximum number of people to invite to their party.
... 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.
Publishing your website - Learn web development
all registrars will have a feature to allow you to check if the domain name you want is available.
...it allows you to upload code repositories for storage in the git version control system.
...github has a very useful feature called github pages, which allows you to expose website code live on the web.
... using a web-based ide such as codepen there are a number of web apps that emulate a website development environment, allowing you to enter html, css and javascript, and then display the result of that code as a website — all in one browser tab.
Add a hitmap on top of an image - Learn web development
the image must make it clear what happens when people follow image links.
... for a circle, provide the center's x and y coordinates, followed by the length of the radius.
...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.
...try following links with your keyboard alone.
Debugging HTML - Learn web development
for example, the following shows an error reported when trying to compile a simple program written in the rust language.
... note: html is parsed permissively because when the web was first created, it was decided that allowing people to get their content published was more important than making sure the syntax was absolutely correct.
... you will know when all your errors are fixed when you see the following banner in your output: summary so there we have it, an introduction to debugging html, which should give you some useful skills to count on when you start to debug css, javascript, and other types of code later on in your career.
... this also marks the end of the introduction to html module learning articles — now you can go on to testing yourself with our assessments: the first one is linked below.
Test your skills: Advanced HTML text - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor.
... advanced html text 2 in this task we want you to add some semantics to the provided html as follows: turn the second paragraph into a block-level quote, and semantically indicate that the quote is taken from accessibility.
... 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.
Test your skills: HTML text basics - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
...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.
... 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.
... 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.
Test your skills: HTML images - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
... 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.
Mozilla splash page - Learn web development
the following subsections detail what you need to do: preparing images using your favourite image editor, create 400px wide and 120px wide versions of: firefox_logo-only_rgb.png firefox-addons.jpg mozilla-dinosaur-head.png call them something sensible, e.g.
... adding a video to the main article content just inside the <article> element (right below the opening tag), embed the youtube video found at https://www.youtube.com/watch?v=ojcncvb1olg, using the appropriate youtube tools to generate the code.
... example the following screenshots show what the splash page should look like after being correctly marked up, on a wide and narrow screen display.
...glitch is probably better for this example, as it allows you upload assets like images, whereas some of the other tools don't.
Test your skills: Multimedia and embedding - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
... 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 - Learn web development
guides this module contains the following articles which will take you through all the fundamentals of embedding multimedia on webpages.
... from <object> to <iframe> — other embedding technologies at this point we'd like to take somewhat of a sideways step, looking at a couple of elements that allow you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements.
... <iframe>s are for embedding other web pages, and the other two allow you to embed pdfs, svg, and even flash — a technology on its way out, but which you may still see semi-regularly.
... assessments the following assessments will test your understanding of the html basics covered in the guides above: mozilla splash page in this assessment, we'll test your knowledge of some of the techniques discussed in this module's articles, getting you to add some images and video to a funky splash page all about mozilla!
Silly story generator - Learn web development
project brief you have been provided with some raw html/css and a few text strings and javascript functions; you need to write the necessary javascript to turn this into a working program, which does the following: generates a silly story when the "generate random story" button is pressed.
... will generate another random silly story if you press the button again (and again...) the following screenshot shows an example of what the finished program should output: to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do.
...what you need to do is as follows: look up the formulae for converting pounds to stone, and fahrenheit to centigrade.
...the following for example turns the background of the <html> element red — so the entire browser window should go red if the javascript is applied properly: document.queryselector('html').style.backgroundcolor = 'red'; math.round() is a built-in javascript method that simply rounds the result of a calculation to the nearest whole number.
Test your skills: Math - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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).
... so, try updating the live code below to recreate the finished example, following these steps: create four variables that contain numbers.
... 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.
What is web performance? - Learn web development
previous overview: performance next web performance is all about making web sites fast, including making slow processes seem fast.
... does the site load quickly, allow the user to start interacting with it quickly, and offer reassuring feedback if something is taking time to load (e.g.
...this includes the following major areas: reducing overall load time: how long does it take the files required to render the web site to download on to the user's computer?
...the browser follows a well-defined set of steps, and optimizing the critical rendering path to prioritize the display of content that relates to the current user action will lead to significant improvements in content rendering time.
The business case for web performance - Learn web development
a performance budget is a set of limits that are set to specify limits, such as maximum number of http requests allowed, the maximum total size of all the assets combined, the minimum allowable fps on a specific device, etc, that must be maintained.
...when a business site is slow, it can prevent users from completing their intended task.
... this can lead to low conversion rates.
...when a site performance slowly, users are more likely to abandon the site prematurely which can lead to low time on site metrics.
Ember resources and troubleshooting - Learn web development
for framework-specific things, there is the ember-inspector add-on, which allows inspection of: routes & controllers components services promises data (i.e: from a remote api — from ember-data, by default) deprecation information render performance for general javascript debugging, check out our guides on javascript debugging as well as interacting with the browser's other debugging tools.
...the intentional minimalism forces certain decisions, and allows for more consistent code, while keeping the template more structural rather than having them filled with bespoke logic.
... mut was not covered in this tutorial and is really baggage from a transitional time when ember was moving from two-way bound data to the more common and easier-to-reason-about one-way bound data flow.
... more concretely, using mut allows for template-only settings functions to be declared: <checkbox @value={{this.somedata}} @ontoggle={{fn (mut this.somedata) (not this.somedata)}} /> whereas, without mut, a component class would be needed: import component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; export default class example extends component { @tracked somedata = false; @action setdata(newvalue) { this.somedata = newvalue; } } which would then be called in the template like so: <checkbox @data={{this.somedata}} @onchange={{this.setdata}} /> due to the conciseness of using mut, it may be desireable to r...
Using Vue computed properties - Learn web development
adding a summary counter add the following code to your app component object, below the methods property.
... add the described <h2> and update the <ul> inside your app's template as follows: <h2 id="list-summary">{{listsummary}}</h2> <ul aria-labelledby="list-summary" class="stack-large"> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> you should now see the list summary in your app, and the total number of items update as you add more todo items!
... in app.vue, add a new method called updatedonestatus(), below your addtodo() method.
...update your <to-do-item></to-do-item> call as follows: <to-do-item :label="item.label" :done="item.done" :id="item.id" @checkbox-changed="updatedonestatus(item.id)"> </to-do-item> now if you check a todoitem, you should see the summary update appropriately!
Focus management with Vue refs - Learn web development
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.
...the list of lifecycle methods are below, in the order that they fire.
... inside app.vue, update your <h2> as follows: <h2 id="list-summary" ref="listsummary" tabindex="-1">{{listsummary}}</h2> note: tabindex is a really powerful tool for handling certian accessibility problems.
...you should also almost never use tabindex > = 0, as it can cause problems for users since it can make the dom flow and the tab-order mismatch, and/or add non-interactive elements to the tab order.
Mozilla accessibility architecture
for example, this allows the msaa client to invalidate parts of its own cache or data model based on dom mutation events.
... this architecture allows us to quickly wipe away an entire document's worth of cached nodes when a document goes away, simply by destroying the document accessible's cache.
...the member variables keeping track of the number of children, parent, first child and next sibling allow us to have instant traversal around accessible nodes that have already been visited.
...in other words, the lowest common denominator for objects we must cache is nsaccessnode.
Accessibility information for UI designers and developers
your content can then be better consumed by users with low vision and people with color deficiencies.
...ensure your design is flexible enough to allow for this.
... text spacing users should be able to make the following changes to their text spacing: set line height (leading) to at least 1.5 times the font size set spacing following paragraphs to at least 2 times the font size set letter spacing (tracking) to at least 0.12 times the font size set word spacing to at least 0.16 times the font size this does not mean that your page needs to offer controls to make such changes, merely that if someone does these things in a custom stylesheet, they should not break the interface.
...placeholders are best avoided for this, as they are often too low in contrast.
Multiprocess on Windows
when an incoming rpc invokes a method on an interceptor, the interceptor dispatches a callback that allows us to do whatever we want with that request.
...the required steps are as follows: ensure that you generate typelibs for all of your com interfaces; ensure that those interfaces are registered; register any outparams that consist of arrays of interfaces.
...for example, if interface ifoo inherits from iunknown, the lowest possible mmethodindex for ifoo could be 3, because indices 0, 1, and 2 are occupied by the functions that ifoo inherited from iunknown.
...there is also a mozilla::mscom::getter_addrefs() function that allows these pointers to receive outparams.
Index
found 689 pages: # page tags and summary 1 add-ons add-ons, extension, extensions, landing, mozilla add-ons allow developers to extend and modify the functionality of firefox.
... 680 resources for publishers add-ons, 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.
... 684 themes add-ons, look & feel, themes themes allow you to change the look and feel of the user interface and personalize it to your tastes.
Adding a new event
this type of event allows c++ code to handle it easier.
... each event class should implement following methods manually.
...e.g., if your event shouldn't cause dom event, you need to modify widgetevent::isallowedtodispatchdomevent().
...if all information of the event is stored by its internal event, c++ event handlers can access them with following code: ns_imethodimp aneventlistener::handleevent(nsidomevent* aevent) { internalfooevent* internalevent = aevent->getinternalnsevent()->asfooevent(); if (ns_warn_if(!internalevent)) { return ns_error_unexpected; } dosomethingwith(internalevent->mbar); aevent->preventdefault(); return ns_ok; } implement dom event class generate dom event implementation if it's possible ...
What to do and what not to do in Bugzilla
getting/upgrading bugzilla privileges if you want to get bugzilla privileges (as described below), please see this page.
... canconfirm privilege the canconfirm privilege allows you to confirm bugs and also to start your bug reports in the confirmed state (new).
...when verifying a bug, you should remember the following: verifying duplicates is the easiest task, so start with that.
...when performing bug reassignments, keep the following things in mind: always remember to check the reassign to default owner and qa contact radio button under the comment textbox.
Building SpiderMonkey with UBSan
save the following bash script, fixing llvm_root to point to your installation.
.../bin/sh if [ -z $1 ] ; then echo "usage: $0 <dirname>" elif [ -d $1 ] ; then echo "directory $1 already exists" else autoconf2.13 autoconf213 mkdir $1 cd $1 llvm_root="$home/llvm" sanflag="-fsanitize=undefined -fno-sanitize=alignment,float-cast-overflow,float-divide-by-zero,vptr -dxmalloc=myxmalloc" \ cc="$llvm_root/build/release+asserts/bin/clang" \ cxx="$llvm_root/build/release+asserts/bin/clang++" \ cflags="$sanflag" \ cxxflags="$sanflag" \ moz_llvm_hacks=1 \ ../configure --enable-debug --disable-optimize make -j 8 fi 3.
...this enables all the cheap undefined behavior checks other than: alignment, which hits known bugs in spidermonkey, and is more implementation-defined (slow on x86 / crash on arm) than undefined behavior float-cast-overflow, which hits known bugs in spidermonkey, and isn't exploited by today's compilers float-divide-by-zero, which jesse doesn't think is actually undefined behavior (aside from the question of whether cpu overflow flags are set) vptr, a check that requires rtti, which is disabled by default in spidermonkey 4.
...[-fsanitize=float-cast-overflow] in the status whiteboard.
Makefile - variables
local_includes allow use of moz_objdir in .mozconfig with older gnu gcc on beos.
... moz_url_classifier moz_widget_toolkit android, beos, cocoa, gtk2, os2, qt, windows moz_xpctools moz_xul moz_x11 test variable description enable_tests boolean value that should wrapper all unit tests to allow disabling on demand[1].
... sdk_headers makefile generation description no_makefile_rule [pending] inhibit makefile.in deps that would allow $obj/makefile to be generated.
... l10nbasedir moz_chrome_multilocale a list of locale names to process moz_chrome_file_format both, file, jar, omni, symlink packager_no_libs hack to allow one makefile to include another without pulling in libs:: target definitions.
Simple Instantbird build
build prerequisites hardware requirements: while you can build instantbird on older hardware it can take quite a bit of time to compile on slower machines, and having 8gb of ram is recommended (though you can probably still get away with 4gb).
...so firstly complete the instructions for your os and then continue following these build instructions.
...linux builds on a fast box may take under 15 minutes, but windows builds on a slow box may take several hours.
... 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).
Contributing to the Mozilla code base
if you're having any trouble following this documentation, or hit a barrier you can't get around, please contact mike hoye at mhoye@mozilla.com.
... mozilla is a large project and we are thrilled to have contributors with very diverse skills below is a table with our currently available projects to contribute to, along with the skills needs and links to their documentation.
... when you commit your code, please use the following format for your commit message: `bug number - what your patch does; r?reviewer` for example, a commit message may look like `bug 1234567 - remove reflow by caching element size.
... step 4b: follow it up once you've asked for a review, a reviewer will often respond within a day or two, reviewing the patch, or saying when they will be able to review it, perhaps due to a backlog.
mach
mach's logic for determining which mozconfig to use is effectively the following: if a .mozconfig file (some say it is the file mozconfig without the dot) exists in the current directory, use that.
... for example: $ cd devtools/client $ mach build webconsole # rebuild only the files in the devtools/client/webconsole directory $ mach mochitest webconsole/test # run mochitests in devtools/client/webconsole/test enable tab completion to enable tab completion in bash, run the following command.
...if you don't use mach, you have to find another solution for the following problems: discovering what commands or make targets are available (mach exposes everything through mach help while inside "mozilla-central" , else you'll just get a cryptic error message) making more sense out of command output (mach offers terminal colorization and structured logging) getting productive tools in the hands of others (mach "advertises" tools to people through mach help (un...
... even if a mach module were established, mach command modules (see below) would likely never belong to it.
Performance
the following examples omit some boilerplate code for the sake of brevity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics.
... decoratebutton(button, message.data.num) } tabmm.addmessagelistener("my-addon:paragraph-count", callback); tabmm.loadframescript("data:,sendasyncmessage('my-addon:paragraph-count', {num: content.document.queryselectorall('p').length})", false) } function decoratebutton(button, count) { // do stuff with result } this executes the script only when it is needed and only in one tab and allows it to be garbage-collected immediately after execution.
... if(resultlist.every((r) => r == true)) return ci.nsicontentpolicy.accept; return ci.nsicontentpolicy.reject_request; } }); // more boilerplate code here this example is a (somewhat condensed) content policy which gets triggered for every network request in a child process to either allow or deny the request.
... since the code calls to the parent process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests.
Embedding Tips
alternatively, implement a nsiuricontentlistener as described below.
...the nsiauthprompt interface allows the networking layer to pose a user / password prompt to obtain the values needed for authentication.
...are called, allowing the embedder to know what is happening.
...deny the drop by setting the return value of the allowdrop() function.
Gecko SDK
in addition to the below versions, you can find other versions (including beta) here: xulrunner releases (files include "sdk" in the name).
... the sdk follows the same release schedule as firefox/thunderbird.
... once 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.
... contents of the sdk the sdk contains the following: 1.9.2 idl files for frozen interfaces (under idl/) header files for frozen interfaces, xpcom functions, and nspr functions (under include/) import libraries or shared libraries (under lib/) static utility libraries (under lib/) various tools (under bin/) for more information about safely linking xpcom components using the xpcom "glue" library, see xpcom glue.
How Mozilla determines MIME Types
it does the following: checks the start of the file for "magic numbers"; this can currently detect pdf and postscript.
...this should allow reliable detection of all image types mozilla supports.
...this allows extensions to register additional mappings.
...the extension must be lowercase.
Downloads.jsm
alternatively, may be an nsiuri, a downloadsource object, or an object with the following properties: url: string containing the uri for the download source.
...alternatively, may be an nsifile, a downloadtarget object, or an object with the following properties: path: string containing the path of the target file.
...you may pass an object with a subset of the following fields: isprivate: optional indicates whether the download originated from a private window.
...in general, you should be aware of the following highlights: there is no difference between active downloads and finished downloads.
Using JavaScript code modules
details on doing this are in the "extending resource: urls" section below.
... unloading code modules requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) components.utils.unload() allows you to unload a previously imported code module.
...the basic syntax of a resource url is as follows: resource://<alias>/<relative-path>/<file.js|jsm> the <alias> is an alias to a location, usually a physical location relative to the application or xul runtime.
...just call the following: const { require } = cu.import("resource://gre/modules/commonjs/toolkit/require.js", {}) this will import require() into your scope.
Mozilla Content Localized in Your Language
the content here should be what you and your localization team have decided, together, to follow when localizing mozilla products and web sites.
...formal and informal forms, and separators (, or .) date format what are the date formats for weeks and months are expressed in the following forms: 1)fully spelled out, 2).
...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.
Patching a Localization
the steps below are fairly generic; for the most part they apply to creating l10n patches for firefox, thunderbird, seamonkey, or calendar.
... i'll use firefox in the example below to help you understand the general steps to creating a l10n patch.
...start bash and do the following: create a clean directory for your work.
... alternatively, you can select specific files for diff to evaluate and print (see below).
Release phase
depending on which branch you work on, the url of your repository might look like this: http://hg.mozilla.org/releases/l10n-central/x-testing if you followed the koala or plain text approach, you probably already have a local clone of the repository.
... add the following lines to your ~/.ssh/config file, replacing user@host.domain with your mozilla ldap account name: host hg.mozilla.org user user@host.domain if you have already cloned the remote repository using the http protocol using this command: $ hg clone http://hg.mozilla.org/releases/l10n-central/x-testing then you will need to edit the .hg/hgrc file (inside the x-testing local clone) to tell mercur...
...next, try issuing the following command: $ ssh hg.mozilla.org if ssh is working fine, you should see the following message: no interactive shells allowed here!
... there is a specific process to follow in bugzilla for requesting these reviews: file a bug requesting the review.
MathML Demo: <mtable> - tables and matrices
1 22 333 4444 x 55555 666666 a b c 7777777 11 ...--- , cols arg is "|r|c|l|", \hline's above and below.
...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).
...contrast it with the following which has align="bottom" ---...
... and making floating elements do a multiplication such as the following one which is anchored at a baseline is made simple by using align="baseline1" on both tables [ a b c d ] [ a b c d ] to multiply a matrix a by a vector x, each row of the matrix has to be multiplied to the vector.
Using the viewport meta tag to control layout on mobile browsers
viewport basics a typical mobile-optimized site contains something like the following: <meta name="viewport" content="width=device-width, initial-scale=1"> the width property controls the size of the viewport.
...the maximum-scale, minimum-scale, and user-scalable properties control how users are allowed to zoom the page in or out.
... usage of user-scalable=no can cause accessibility issues to users with visual impairments such as low vision.
...for example, if your layout needs at least 500 pixels of width then you can use the following markup.
Mozilla Quirks Mode Behavior
the following is a rough list of the differences that exist between mozilla's standards mode and quirks mode behavior.
... in quirks mode, the css parser allows {} around the contents of style attributes (bug 99554).
... maybe (firefox 3) when computing the minimum intrinsic width of an inline flow directly in a table cell (no blocks in between), it is assumed that it is not possible to break before and after an image (when otherwise it would be).
...i don't follow the code in nscssrenderingborders well enough to tell, though.] in quirks mode a fixed width specified on a table cell resets the nowrap attribute.
Build Metrics
lower is better.
...lower is better here, especially on space-restricted platforms like android.
...lower is better.
...lower is better.
Leak-hunting strategies and tips
sometimes these cycles extend through js objects (discussed further below), and since js is garbage-collected, every pointer acts like an owning pointer and the potential for fan-out is larger.
...xpconnect allows an xpcom object to be exposed to javascript, and it allows certain javascript objects to be exposed to c++ code as normal xpcom objects.
...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 balance trees (which are much smaller) through the post-processing.
... tips disabling arena allocation with many lower-level leak tools (particularly trace-malloc based ones, like leaksoup) it can be helpful to disable arena allocation of objects that you're interested in, when possible, so that each object is allocated with a separate call to malloc.
Leak Gauge
getting a log file to get a log file, run the browser with the following environment variables set.
...the browser will run with negligible slowdown.
... if there are no leaks, output will look like the following.
... results of processing log leak.log : summary: leaked 0 out of 11 dom windows leaked 0 out of 44 documents leaked 0 out of 3 docshells leaked content nodes in 0 out of 0 documents if there are leaks, output will look like the following.
Profiling with Xperf
the standard symbol path that includes both mozilla's and microsoft's symbol server configuration is as follows: _nt_symcache_path: c:\symbols _nt_symbol_path: srv*c:\symbols*http://msdl.microsoft.com/download/symbols;srv*c:\symbols*http://symbols.mozilla.org/firefox/ to add symbols from your own builds, add c:\path\to\objdir\dist\bin to _nt_symbol_path.
...tips in the summary views, the yellow bar can be dragged left and right to change the grouping -- for example, drag it to the left of the module column to have grouping happen only by process (stuff that's to the left), so that you get symbols in order of weight, regardless of what module they're in.
...also experiment with turning columns on and off; removing a column will allow data to be aggregated without considering that column's contributions.
... building firefox to get good data from a firefox build, it is important to build with the following options in your mozconfig: export cflags="-oy-" export cxxflags="-oy-" this disables frame-pointer optimization which lets xperf do a much better job unwinding the stack.
Midas editor module security preferences
add these lines to user.js: user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.sites", "https://www-archive.mozilla.org"); user_pref("capability.policy.allowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); change the url https://www.mozilla.org to the site for which you want to enable this function.
...for example: user_pref("capability.policy.allowclipboard.sites", "http://www-archive.mozilla.org") is not the same as: user_pref("capability.policy.allowclipboard.sites", "https://www-archive.mozilla.org") this is because the first uses http while the second uses https.
... if you want to allow multiple urls to access the paste operation, separate the urls with a space.
... for example: user_pref("capability.policy.allowclipboard.sites", "https://www-archive.mozilla.org https://developer.mozilla.org") again, keep in mind the security risks involved here and be sure to remove permission to access the clipboard once you no longer need it enabled.
Cached Monitors
this arrangement allows a cached monitor to be associated with another object without preallocating a monitor for all objects.
... important cached monitors are slower to use than their uncached counterparts.
... cached monitors functions cached monitors allow the client to associate monitoring protection and state change synchronization in a lazy fashion.
... the monitoring capability is associated with the protected object only during the time it is required, allowing the monitor object to be reused.
NSPR Error Handling
pr_connect_refused_error the peer has refused to allow the connection to be established.
... pr_buffer_overflow_error the value retrieved is too large to be stored in the buffer provided.
... pr_name_too_long_error filename is longer than allowed by the host operating system.
... pr_max_directory_entries_error attempt to add new filename to directory would exceed the limit allowed.
NSPR LOG MODULES
syntax modulename:level[, modulename:level]* modulename is the name specified in a pr_newlogmodule call or one of the handy magic names listed below.
... level is a numeric value between 0 and 5, with the values having the following meanings: 0 = pr_log_none: nothing should be logged 1 = pr_log_always: important; intended to always be logged 2 = pr_log_error: errors 3 = pr_log_warning: warnings 4 = pr_log_debug: debug messages, notices 5: everything!
...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.
... this ensures that all log messages are flushed to the operating system as they are written, but may slow the program down.
PRIntervalTime
important note the counters used for interval times are allowed to overflow.
...the proper coding style to test the expiration of an interval is as follows: if ((printervaltime)(now - epoch) > interval) <...
... interval has expired ...> as long as the interval and the elapsed time (now - epoch) do not exceed half the namespace allowed by a printervaltime (231-1), the expression shown above provides the expected result even if the signs of now and epoch differ.
...at that rate, a 32-bit register will overflow in approximately 28 hours, making the maximum useful interval approximately 6 hours.
PRThreadPriority
syntax #include <prthread.h> typedef enum prthreadpriority { pr_priority_first = 0, pr_priority_low = 0, pr_priority_normal = 1, pr_priority_high = 2, pr_priority_urgent = 3, pr_priority_last = 3 } prthreadpriority; enumerators pr_priority_first placeholder.
... pr_priority_low the lowest possible priority.
... pr_priority_last placeholder description in general, an nspr thread of higher priority has a statistically better chance of running relative to threads of lower priority.
...at best they are intended to specify a preference in the amount of cpu time that a higher-priority thread might expect relative to a lower-priority thread.
PR_Open
syntax #include <prio.h> prfiledesc* pr_open( const char *name, printn flags, printn mode); parameters the function has the following parameters: name the pathname of the file to be opened.
...it is a bitwise or of the following bit flags.
...possible values of the mode parameter are listed in the table below.
... permission, group pr_ixgrp 0010 execute/search permission, group pr_irwxo 0007 read, write, execute/search by others pr_iroth 0004 read permission, others pr_iwoth 0002 write permission, others pr_ixoth 0001 execute/search permission, others returns the function returns one of the following values: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file.
PR_Poll
syntax #include <prio.h> print32 pr_poll( prpolldesc *pds, printn npds, printervaltime timeout); parameters the function has the following parameters: pds a pointer to the first element of an array of prpolldesc structures.
... the prpolldesc structure is defined as follows: struct prpolldesc { prfiledesc* fd; print16 in_flags; print16 out_flags; }; typedef struct prpolldesc prpolldesc; the structure has the following fields: fd a pointer to a prfiledesc object representing a socket or a pollable event.
... in_flags a bitwise or of the following bit flags: pr_poll_read: fd is readable.
... out_flags a bitwise or of the following bit flags: pr_poll_read pr_poll_write pr_poll_except pr_poll_err: fd has an error.
PR_Writev
syntax #include <prio.h> print32 pr_writev( prfiledesc *fd, priovec *iov, print32 size, printervaltime timeout); #define pr_max_iovector_size 16 parameters the function has the following parameters: fd a pointer to a prfiledesc object for a socket.
...if it is, the function will fail and the error will be set to pr_buffer_overflow_error.
... returns one of the following values: a positive number indicates the number of bytes successfully written.
... this is the type definition for priovec: typedef struct priovec { char *iov_base; int iov_len; } priovec; the priovec structure has the following fields: iov_base a pointer to the beginning of the buffer.
Building NSS
to check out the latest sources for nss and nspr--which may not be part of a stable release--use the following commands: hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss to get the source of a specific release, see nss releases.
... this supports some alternative options, but can be a lot slower.
...below are some of the variables, along with possible values they may be set to.
... if you don't have a domain suffix you can add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as follows: 127.0.0.1 localhost.localdomain validate this opening a command shell and typing: ping localhost.localdomain.
NSS 3.16.4 release notes
the bug fixes in nss 3.16.4 are described in the "bugs fixed" section below.
...nss 3.16.4 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_4_rtm/src/ new in nss 3.16.4 this release consists primarily of ca certificate changes as listed below, and includes a small number of bug fixes.
... notable changes in nss 3.16.4 the following 1024-bit root ca certificate was restored to allow more time to develop a better transition strategy for affected sites.
...the inclusion of the intermediate certificate is a temporary measure to allow those sites to function, by allowing them to find a trust path to another 2048-bit root ca certificate.
NSS 3.18.1 release notes
the bug fixes in nss 3.18.1 are described in the "bugs fixed" section below.
... notable changes in nss 3.18.1 the following ca certificate had the websites and code signing trust bits restored to their original state to allow more time to develop a better transition strategy for affected sites.
... ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the following ca certificate was removed after discussion about it in the mozilla.dev.security.policy forum.
... cn = e-guven kok elektronik sertifika hizmet saglayicisi sha1 fingerprint: dd:e1:d2:a9:01:80:2e:1d:87:5e:84:b3:80:7e:4b:b1:fd:99:41:34 the following intermediate ca certificate has been added as actively distrusted because it was misused to issue certificates for domain names the holder did not own or control.
NSS 3.25 release notes
nss 3.25 source distributions are available on ftp.mozilla.org for secure https download at the following location.
... removed the limitation that allowed nss to only support certificate_verify messages that used the same signature hash algorithm as the prf when using tls 1.2 client authentication.
... new functions in nssckfw.h nssckfwslot_getslotid nssckfwsession_getfwslot nssckfwinstance_destroysessionhandle nssckfwinstance_findsessionhandle notable changes in nss 3.25 an ssl socket can no longer be configured to allow both tls 1.3 and ssl v3.
... the following ca certificate was removed cn = sonera class1 ca sha-256 fingerprint: cd:80:82:84:cf:74:6f:f2:fd:6e:b5:8a:a1:d5:9c:4a:d4:b3:ca:56:fd:c6:27:4a:89:26:a7:83:5f:32:31:3d the following ca certificates were added cn = hellenic academic and research institutions rootca 2015 sha-256 fingerprint: a0:40:92:9a:02:ce:53:b4:ac:f4:f2:ff:c6:98:1c:e4:49:6f:75:5e:6d:45:fe:0b:2a:69:2b:cd:52:52:3f:36 cn = hellenic academic and research institutions ecc rootca 2015 sha-256 fingerprint: 44:b5:45:aa:8a:25:e6:5a:73:ca:15:dc:27:fc:36:d2:4c:1c:b9:95:3a:06:65:39:b...
NSS 3.48 release notes
because using an iteration count higher than 1 with the legacy dbm (key3.db) storage creates files that are incompatible with previous versions of nss, applications that wish to enable it for key3.db are required to set environment variable nss_allow_legacy_dbm_iteration_count=1.
... applications may set environment variable nss_min_mp_pbe_iteration_count to request a higher iteration count than the library's default, or nss_max_mp_pbe_iteration_count to request a lower iteration count for test environments.
... certificate authority changes the following ca certificates were added: bug 1591178 - entrust root certification authority - g4 cert sha-256 fingerprint: db3517d1f6732a2d5ab97c533ec70779ee3270a62fb4ac4238372460e6f01e88 upcoming changes in nss 3.49 the legacy dbm database, libnssdbm, will no longer be built by default.
... bugs fixed in nss 3.48 bug 1600775 - require nspr 4.24 for nss 3.48 bug 1593401 - fix race condition in self-encrypt functions bug 1599545 - fix assertion and add test for early key update bug 1597799 - fix a crash in nssckfwobject_getattributesize bug 1591178 - add entrust root certification authority - g4 certificate to nss bug 1590001 - prevent negotiation of versions lower than 1.3 after helloretryrequest bug 1596450 - added a simplified and unified mac implementation for hmac and cmac behind pkcs#11 bug 1522203 - remove an old pentium pro performance workaround bug 1592557 - fix prng known-answer-test scripts bug 1586176 - encryptupdate should use maxout not block size (cve-2019-11745) bug 1593141 - add `notbefore` or similar "beginning-of-validity-period" ...
NSS Config Options
nss config options format the specified ciphers will be allowed by policy, but an application may allow more by policy explicitly: config="allow=curve1:curve2:hash1:hash2:rsa-1024..." only the specified hashes and curves will be allowed: config="disallow=all allow=sha1:sha256:secp256r1:secp384r1" only the specified hashes and curves will be allowed, and rsa keys of 2048 or more will be accepted, and dh key exchange with 1024-bit primes or more: config="disallow=all allow=sha1:sha256:secp256r1:secp384r1:min-rsa=2048:min-dh=1024" a policy that enables the aes ciphersuites and the secp256/384 curves: config="allow=aes128-cbc:aes128-gcm::hmac-sha1:sha1:sha256:sha384:rsa:ecdhe-rsa:secp256r1:secp384r1" turn off md5 config="disallow=md5" turn off md5 and sha1 only for ssl con...
...fig="disallow=md5(ssl):sha1(ssl)" disallow values are parsed first, and then allow values, independent of the order in which they appear.
...disable: turn off ciphersuites by default without disallowing them by policy.
... flags: turn on the following flags: ssl-lock: turn off the ability for applications to change policy with the ssl_setcipherpolicy (or ssl_setpolicy).
NSS Developer Tutorial
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.
... 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.
... variable, and function parameter names, always start with a lowercase letter.
...unfortunately, this can be a source of integer overflow bugs on 64-bit systems.
nss tech note4
cert); some info is readily available cert->subjectname (char*) cert->issuername (char*) cert->emailaddr (char*) or char *cert_getcertificateemailaddress(certcertificate *cert); cert->keyusage (unsigned int) to break the issuer and subject names into components pass &(cert->issuer) or &(cert->subject) to the following functions char *cert_getcommonname(certname *name); char *cert_getcertemailaddress(certname *name); char *cert_getcountryname(certname *name); char *cert_getlocalityname(certname *name); char *cert_getstatename(certname *name); char *cert_getorgname(certname *name); char *cert_getorgunitname(certname *name); char *cert_getdomaincomponentname(...
...certname *name); char *cert_getcertuid(certname *name); example code to illustrate access to the info is given below.
... background on cert extensions an extension has the following attributes object id (oid) : a unique oid represents an algorithm, a mechanism, a piece of information, etc.
... { sec_asn1decodercontext * context = sec_asn1decoderstart(null, &data, mycertexttemplate); rv = sec_asn1decoderupdate( context, (const char *)(myextvalue.data), myextvalue.len); if (rv == secsuccess) { /* now you can extract info from secitem fields of your extension data structure */ /* see "misc helper functions" below */ .......
Overview of NSS
nss provides a complete open-source implementation of the crypto libraries used by aol, red hat, google, and other companies in a variety of products, including the following: mozilla products, including firefox, thunderbird, seamonkey, and firefox os.
... interoperability and open standards you can use nss to support a range of security standards in your application, including the following: ssl v3.
... the secure sockets layer (ssl) protocol allows mutual authentication between a client and server and the establishment of an authenticated and encrypted connection.
...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.
PKCS11 Implement
currently pkcs #12 isn't allowed to import onto a token.
...to do so, the user should follow these steps: click the security icon near the top of any communicator window.
... random-number generation and simple digesting the nss requires that the following functions operate without authenticating to the token: c_seedrandom, c_generaterandom, and c_digest (for sha, md5, and md2).
... read/write and read-only requirements the nss assumes that the following operations always require a read/write session: creating a token object, such as with c_createobject (token) or c_destroyobject (token) changing a password initializing a token creating session objects must work with a read-only session.
NSS tools : modutil
this directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory.
...renableflags{0x0001} files { unix/fort.so { relativepath{%root%/lib/fort.so} absolutepath{/usr/local/netscape/lib/fort.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, allowing lists, key-value pairs, strings, and combinations of all of them.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type.
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.
...functions used in the initialization part of an application can include the following: pr_init.
... callbacks and helper functions allow you to specify such things as how authentication is accomplished and what happens if it fails.
... functions that can be used by both clients and servers during communication include the following: pr_send or pr_write pr_read or pr_recv pr_geterror pr_getpeername pr_sleep pr_malloc pr_free pr_poll pr_now pr_intervaltomilliseconds pr_millisecondstointerval pr_shutdown pr_close ssl_invalidatesession after establishing a connection, an application first calls pr_send, pr_recv, pr_read, pr_write, or ssl_forcehandshake to initiate the handshake.
TLS Cipher Suite Discovery
tls does not allow all possible combinations of choices from those categories to be used.
... instead, tls allows only certain well-defined combinations of those choices, known as cipher suites, defined in the ietf rfc standards.
...the table and the number of entries are declared in "ssl.h", as follows: /* constant table enumerating all implemented ssl 2 and 3 cipher suites.
...this function is declared in "ssl.h" as follows: ssl_import secstatus ssl_getciphersuiteinfo( pruint16 ciphersuite, sslciphersuiteinfo *info, pruintn len); the application provides the cipher suite number for which it wants information, the address of a block of memory allocated to receive that information, and the size in bytes of that block of memory.
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
this directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory.
...al/netscape/lib/fort.so} filepermissions{555} } xplat/instr.html { relativepath{%root%/docs/inst.html} absolutepath{/usr/local/netscape/docs/inst.html} filepermissions{555} } } } irix:6.2:mips { equivalentplatform { sunos:5.5.1:sparc } } } script grammar the script is basic java, allowing lists, key-value pairs, strings, and combinations of all of them.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type.
Necko Architecture
necko provides the following libraries: necko - core networking functionality.
... handlers & channels nsichannel provides a data access interface which allows you to read or write data from or to a uri.
...streams provide a generic interface to the data and allow for many underlying implementations that permit multiple data sources to be used.
... dependencies necko requires the following libraries for linking: nspr xpcom original document information author(s): jud valeski last updated date: november 8, 1999 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details.
GC Rooting Guide
if you use these types directly, or create classes, structs or arrays that contain them, you must follow the rules set out in this guide.
...::rootedscript js::rooted<jsid> js::rootedid for example, instead of this: jsobject* localobj = js_getobjectofsomesort(cx); you would write this: js::rootedobject localobj(cx, js_getobjectofsomesort(cx)); spidermonkey makes it easy to remember to use js::rooted<t> types instead of a raw pointer because all of the api methods that may gc take a js::handle<t>, as described below, and js::rooted<t> autoconverts to js::handle<t> but a bare pointer does not.
...lass typedef js::handle<js::value> js::handlevalue js::handle<jsobject*> js::handleobject js::handle<jsstring*> js::handlestring js::handle<jsscript*> js::handlescript js::handle<jsid> js::handleid you should use js::handle<t> for all function parameters taking gc thing pointers (except out-parameters, which are described below).
... js::heap<t> pointers must also continue to be traced in the normal way, which is covered below.
Invariants
in particular, native objects' fields are protected by property locking (below); and several things are protected by the request model, such that there may be either one writer (in gc) or many readers (in requests).
...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.
...jsop_bindname performs this lookup.) the rules below (not exactly invariants) govern the bytecode emitted for nameexpressions.
...failing that, jsop_{get,call,set}local and jsop_{get,call,set}arg are the fastest, followed by jsop_{get,call}upvar, jsop_{get,call}dslot, jsop_{get,call,set}gvar, and lastly jsop_{,call,set}name.
SpiderMonkey Internals
if (eval(sumofdivisors[divisor]) == divisor) { print("" + divisor + " = " + sumofdivisors[divisor]); } } delete sumofdivisors; print("that's all."); } the line number to pc and back mappings can be tested using the js program with the following script: load("perfect.js"); print(perfect); dis(perfect); print(); for (var ln = 0; ln <= 40; ln++) { var pc = line2pc(perfect, ln); var ln2 = pc2line(perfect, pc); print("\tline " + ln + " => pc " + pc + " => line " + ln2); } the result of the for loop over lines 0 to 40 inclusive is: line 0 => pc 0 => line 16 line 1 => pc 0 => line 16 line 2 => pc 0 => line 16 line 3 => pc 0 ...
...all of the following happen here: creating objects by class and prototype, and finalizing objects; defining, looking up, getting, setting, and deleting properties; creating and destroying properties and binding names to them.
... jsarena.cpp, jsarena.h last-in-first-out allocation macros that amortize malloc costs and allow for en-masse freeing.
...certain assertions are followed by run-time tests that cope with assertion failure, but only where i'm too smart or paranoid to believe the assertion will never fail...
Property attributes
the jsapi expresses property attributes as a value of type unsigned, the bitwise or of zero or more of the jsprop flags described below.
...in javascript 1.2 and lower, it is an error to attempt to assign a value to a read-only property.
...in javascript 1.2 and lower, it is an error to attempt to delete a permanent property.
...added in spidermonkey 17 mxr id search for jsfun_constructor jsprop_redefine_nonconfigurable if set, will allow redefining a non-configurable property, but only on a non-dom global.
SpiderMonkey 24
it also contains new language and api features described in detail below.
... the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
... typedef changes the fixed-size integer types introduced in spidermonkey 17 are defined in one of the following ways (xxx update for msvc<10 deprecation): if the environment variable moz_custom_stdint_h is set, that file will be included to provide definitions for these types.
Running Automated JavaScript Tests
for a smoke test or if you are not changing language-level functionality, you may wish to use jstests.py path_to_js_shell --exclude=test262 other options allow you to show the test command lines being run, command output and return codes, run tests named in a given file, exclude tests named in a given file, hide the progress bar, change the timeout, run skipped tests, print output in tinderbox format, run a test in the debugger, or run tests in valgrind.
... running jstest in a browser jstests also runs on browser, with the following command: ./mach jstestbrowser to run specific test, you can use --filter=pattern command-line argument, where pattern is a regexp pattern that is tested against file:///{path_to_obj_dir}/dist/test-stage/jsreftest/tests/jsreftest.html?test={relative_path_to_test_from_js/src/tests} string: ./mach jstestbrowser --filter=pattern running jstests on treeherder when viewing treeherder after a push to the mozilla repositories, jstests run in the browser are shown as r(j) meaning "ja...
...basic usage is the same: jit_test.py path_to_js_shell developers will usually want to run like this to skip the slow tests and cover the most important options: jit_test.py --no-slow path_to_js_shell you can select specific tests to run in the same way as the jstests shell harness.
... the --jitflags option allows you to test the js executable with different flags.
TPS Tests
set up an environment and run a test to run tps, you should create a new firefox account using a restmail.net email address (strictly speaking, restmail isn't required, but it will allow tps to automatically do account confirmation steps for you.
... tps tests tend to be broken down into three sections, in the following order (we'll cover these out of order, for the sake of simplicity) phase declarations (mandatory).
...tps iterates through the phase blocks in alphanumeric order, and for each phase, it does the following: launches firefox with the profile from the phases object that corresponds to this test phase.
... otherwise, a special sync can be performed if one of the following are passed: sync_wipe_server, sync_wipe_client, sync_reset_client.
Mozilla Projects
mccoy is an application that allows add-on authors to provide secure updates to their users.
...this information allows c++ to be automatically rewritten in a precise way.
... web replay web replay allows firefox content processes to record their behavior, replay it later, and rewind to earlier states.
...the low level, yet flexible architecture (described here) provides an extremely powerful platform for implementing debugging and analysis features.
Components.utils.Sandbox
principal the security principal defined for a sandbox determines what code running in that sandbox will be allowed to do.
...this parameter is an object with the following optional properties: freshzone if true creates a new gc region separate from both the calling context's and the sandbox prototype's region.
...this helps to improve memory usage by allowing sandboxes to be discarded when that zone goes away.
... the following objects are supported: -promise (removed in firefox 37) css indexeddb (web worker only) xmlhttprequest textencoder textdecoder url urlsearchparams atob btoa blob file crypto rtcidentityprovider fetch (added in fir...
Components.utils.cloneInto
options : object this optional parameter is an object with the following optional properties: clonefunctions: a boolean value that determines if functions should be cloned.
...see cloning objects that have functions below.
...see cloning objects that contain dom elements below.
...if you pass the {wrapreflectors:true} flag, then the object you clone is allowed to contain these objects: // add-on script var addonscriptobject = { body: contentwindow.document.body }; contentwindow.addonscriptobject = cloneinto(addonscriptobject, contentwindow, {wrapreflectors: true}); // page script var test = document.getelementbyid("test"); test.addeventlistener("click", functi...
Observer Notifications
observer topics the following are topics that you can observe during the course of an application.
... profile-before-change-qm called to shut down the quotamanager; this is separated from profile-before-change to allow everything inside profile-before-change to continue using it.
... profile-before-change-telemetry called to shut down telemetry, again separated to allow everything before this event to continue using it.
...the channel is available to allow you to modify headers and such.
operator+=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
nsDependentCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
... parameters nsacstring_internal& str assertvalid void assertvalid() - source verify restrictions rebind void rebind(const char*) - source allow this class to be bound to a different string...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsDependentString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...- source parameters prunichar* data pruint32 length void nsdependentstring(const prunichar*) - source parameters prunichar* data void nsdependentstring(const nsastring_internal&) - source parameters nsastring_internal& str void nsdependentstring() - source assertvalid void assertvalid() - source verify restrictions rebind void rebind(const prunichar*) - source allow this class to be bound to a different string...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
operator=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
IAccessibleTable2
the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full column of cells the behavior should be as follows: first any selected columns in the table are unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full row of cells the behavior should be as follows: first any selected rows in the table are unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full column of cells the behavior should be as follows: the entire column of cells for the specified column is unselected.
...the behavior should mimic that of the application, but for those applications which do not have a means in the gui to unselect a full row of cells the behavior should be as follows: the entire row of cells for the specified row is unselected.
imgIContainer
constants constant value description type_raster 0 enumerated values for the 'type' attribute (below).
... asubimage the area of the image, in pixels, that we are allowed to sample from.
...if the lock count drops to zero, the image is allowed to discard its frame data to save memory.
...in other words, the lock count is not allowed to be negative.
nsIAccessibleStates
more than 1 allowed.
... state_selected 0x00000002 the object is selected, that is it 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.
... state_alert_low 0x04000000 this information is of low priority.
... state_required state_alert_low state_important state_alert_medium currently unused.
nsIAlertsService
however, certain notification systems (such as growl on mac os x) allow the user to disable alerts by name.
... example simple usage the following code was used to display the above notification.
...s.wm.getmostrecentwindow('navigator:firefox'), 'focus firefox', 'will now focus fireox and then focus the tab'); } else if (atopic == 'alertshow') { console.log('just showed notification'); } else if (atopic == 'alertfinished') { console.log('just alertfinished') } } }; as.showalertnotification('chrome://branding/content/icon64.png', 'stackoverflow - new messages', 'there are ## new messages.
... click here to focus the tab', true, null, notiflistener, 'stackoverflow notifier'); closealert() closes alerts created by the service.
nsIBinaryOutputStream
xpcom/io/nsibinaryoutputstream.idlscriptable this interface allows writing of primitive data types (integers, floating-point values, booleans, and so on.) to a stream in a binary, untagged, fixed-endianness format.
...the output data consists of a 32-bit length field, followed by that many 8-bit characters.
...the output data consists of a 32-bit length field, followed by that many 8-bit characters.
...the output data consists of a 32-bit length field, followed by that many prunichars.
nsIDragService
this was changed in gecko 43, see the following section.
... aactiontype specified which of copy/move/link are allowed.
... aactiontype specified which of copy/move/link are allowed.
... aactiontype specified which of copy/move/link are allowed adragevent the drag gesture event that initiated the drag.
nsILocalFile
followlinks prbool determines whether or not the nsilocalfile will automatically resolve symbolic links.
... note: the value of the followlinks attribute is not encoded in the persistent descriptor.
... a bitwise combination of the following open flags: pr_rdonly open for reading only.
...see the note in the remarks below.
nsINavBookmarksService
constants constant value description default_index -1 this is the default index; this value should be used for apis that allow passing in an index where the index is not known or is not required to be specified, such as when appending an item to a folder.
...for example, if i bookmark "mozilla.org" by manually typing it in, and follow the bookmark, i will get redirected to "www.mozilla.org".
...if this is set to true, ui will not allow the user to add, remove, or reorder children in this folder.
...if this is set to true, ui will not allow the user to add, remove, or reorder children in this folder.
nsIPermissionManager
allows access to nsipermission objects.
... allow_action 1 permission is allowed.
... prompt_action 3 prompt user if the permission is allowed.
... remarks this service broadcasts the following notification when the permission list is changed: topic : "perm-changed" (perm_change_notification) broadcast whenever the permission list changes in some way.
nsIPromptService
n acheckstate); boolean promptpassword(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring apassword, in wstring acheckmsg, inout boolean acheckstate); boolean select(in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in pruint32 acount, [array, size_is(acount)] in wstring aselectlist, out long aoutselection); constants the following flags are combined to form the abuttonflags parameter passed to confirmex.
... button_pos_2 65536 this button can be used to give the user a choice of options, but still allowing the user to cancel the prompt.
...the following example creates a dialog with an ok button and a custom button description.
... abuttonflags abuttonflags is a combination of button flags as described in using the button flags below.
nsIRequest
the following flags control the flow of data into the cache.
... the following flags control what happens when the cache contains data that could perhaps satisfy this request.
... the following flags control the frequency of cached content validation when neither load_bypass_cache or load_from_cache are set.
... note: most nsirequest implementations expect astatus to be a failure code; however, some implementations may allow astatus to be a success code such as ns_ok.
nsISound
event_prompt_dialog_open 3 a prompt dialog (one that allows the user to enter data, such as an authentication dialog) is opened.
... event_editor_max_len 7 more characters than the maximum allowed are typed into a text field.
...similarly, if you specify "blow", you can play the mac os x "blow" system sound, but, similarly, it's played only on the macintosh.
... _moz_promptdialog the system sound when a prompt dialog (one that allows the user to enter data, such as an authentication dialog) is opened.
nsISupports proxies
xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom calls to a different thread on arbitrary xpcom interfaces.
... the following interface is now obsolete: nsiproxyobjectmanager.
... the api has changed in mozilla 1.9, but the prose below hasn't been updated yet.
... *x = 0; <----- you will blow up here.
nsITextInputProcessor
you can create an instance of this interface with the following code: var tip = components.classes["@mozilla.org/text-input-processor;1"].
... the following example sets "foo-bar-buzz", "bar" is selected clause to convert, and caret position is the end of the selected clause: // first, sets composition string.
... you should/can specify following attribute values at creating a keyboardevent instance.
... sharing modifier state during multiple instances sharemodifierstateof() allows to share modifier state between multiple instances: var shiftkey = new keyboardevent("", { key: "shift", code: "shiftleft" }); var ctrlkey = new keyboardevent("", { key: "control", code: "controlleft" }); var altkey = new keyboardevent("", { key: "alt", code: "altleft" }); tip1.keydown(shiftkey); // tip1's shift state becomes active.
nsITransport
flags have the following meaning: open_blocking if specified, then the resulting stream will have blocking stream semantics.
...this interface allows the consumer of the stream to be notified when the stream can again be read.
...flags have the following meaning: open_blocking if specified, then the resulting stream will have blocking stream semantics.
...this interface allows the consumer of the stream to be notified when the stream can again accept more data.
nsIWebBrowserPersist
persist_flags_force_allow_cookies 65536 force relevant cookies to be sent with this load even if normally they wouldn't be.
... encode_flags_format_flowed 64 for plain text output.
... output for format flowed (rfc 2646).
...see below for other flags which might likely do what you want.
nsIXULTemplateQueryProcessor
the query is expected to consist of either text or dom nodes that, when executed by a call to the generateresults() method, will allow the generation of a list of results.
...for example, a query might have the following syntax: (?id, ?name, ?url) from bookmarks where parentfolder = ?start this query might generate a result for each bookmark within a given folder.
...a binding allows an additional variable to be set for a result, outside of those defined within the query.
...this allows all levels to be generated using objects that all implement the nsixultemplateresult interface.
nsIAbCard/Thunderbird3
in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible.
...larnumbertype jobtitle, department, company _aimscreenname dates: anniversaryyear, anniversarymonth, anniversaryday birthyear, birthmonth, birthday webpage1 (work), webpage2 (home) custom1, custom2, custom3, custom4 notes integral properties: lastmodifieddate popularityindex prefermailformat (see nsiabprefermailformat) boolean properties: allowremotecontent inherits from: nsiabitem method overview nsivariant getproperty(in autf8string name, in nsivariant defaultvalue); [noscript] astring getpropertyasastring(in string name); [noscript] autf8string getpropertyasautf8string(in string name); [noscript] pruint32 getpropertyasuint32(in string name); [noscript] boolean getpropertyasbool(in...
... a value must be convertible to a string; if this convention is not followed, consumers of cards may fail unpredictably or return incorrect results.
...the following types are supported: base64xml xml vcard autf8string translateto(in autf8string atype); parameters atype the type of item to translate the card into.
Storage
the latter will allow all ongoing transactions to complete before closing the connection, and will optionally notify you via callback when the connection is closed.
...the example below uses mozistoragestatement.bindint32parameter().
...if your code needs to work with applications based on gecko 1.8 or 1.9, you should the technique covered in the section synchronously below.
...this function allows you to enumerate all the results produced by the statement.
Using nsIDirectoryService
this implementation will allow you to get(), set(), define(), and undefine() nsifile.
...in the example below, prop is a string that references your requested file locations.
...apart from this interface there is a function, registerprovider which will allow you to register a nsidirectoryserviceprovider, which implements the getfile callback function: var provider = { getfile : function(prop, persistant) { // return an nsifile }, } components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsidirectoryservice).registerprovider(provider); when the callback is called, it will be passed the string key, and shoul...
...the persistant flag allows you to specify if you want the nsdirectoryservice to cache this value.
Working with out parameters
when working with xpcom components, you might come across method declarations like the following one: [scriptable, uuid(8b5314bc-db01-11d2-96ce-0060b0fb9956)] interface nsitransferable : nsisupports { ...
...usage in order to use such a method from javascript via xpconnect, you have to follow a specific rule.
...assuming you have an object called transferable, you would invoke gettransferdata() as follows: var adata = {}; var adatalen = {}; transferable.gettransferdata("text/unicode", adata, adatalen); var data = adata.value; var datalen = adatalen.value; as you can see, after the call to gettransferdata(), the out values are then contained in the value properties of adata and adatalen.
...you would implement gettransferdata() as follows: gettransferdata: function(aflavor, adata, adatalen) { ..
xptcall FAQ
xptcall is a small low level xpcom method call library.
...the information in the typelibs allows xpconnect to convert function parameters and build the nsxptcvariant array required to make this call.
... the stubs (or impersonation) facility of xptcall allows for implementing a class which can, at runtime, pretend to be any xpcom interface.
...non-functional stub code exists to allow building xptcall on non-supported platforms.
Xptcall Porting Guide
the invoke functionality requires the implementation of the following on each platform (from xptcall/public/xptcall.h): xptc_public_api(nsresult) ns_invokebyindex(nsisupports* that, pruint32 methodindex, pruint32 paramcount, nsxptcvariant* params); calling code is expected to supply an array of nsxptcvariant structs.
...#include "xptcstubsdecl.inc" // the following methods must be provided by inheritor of this class.
...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.
Address book sync client design
the general architecture for the sync component is the following: mozilla ui ab sync logic mork ab database sync protocol encoding sync protocol decoding http "post" api mozilla networking c...
... // // the client keeps a sync mapping table which holds the following: // // serverrecordid - unique id for a record provided by the // uab server.
...this interface is defined in mozilla/mailnews/addrbook/public/nsiabsyncdriver.idl #include "nsrootidl.idl" #include "nsiabsynclistener.idl" [scriptable, uuid(91fdfee1-efbc-11d3-8f97-000073757374)] interface nsiabsyncdriver : nsiabsynclistener { void kickit(); }; as you can see, this is a very simple interface which allows for the starting of the address book sync operation.
...this interface is as follows: #include "nsisupports.idl" #include "nsrootidl.idl" #include "nsifilespec.idl" [scriptable, uuid(e0ed29e0-098a-11d4-8fd6-00a024a7d144)] interface nsiabsynclistener : nsisupports { /** * notify the observer that the ab sync authorization operation has begun.
The libmime module
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.
... }; then, in the corresponding .c file, the following structure is used: class definition first we pull in the appropriate include file (which includes all necessary include files for the parent classes) and then we define the class object using the mimedefclass macro: #include "foobar.h" #define mime_superclass parentlclass mimedefclass(foobar, foobarclass, foobarclass, &mime_superclass); the definition of mime_superclass is ju...
...st to move most of the knowlege of the exact class hierarchy up to the file's header, instead of it being scattered through the various methods; see below.
... the easiest way to do this is to make use of the mime_superclass macro that was defined at the top of the file, as shown below.
Theme Packaging
theme file layout thunderbird themes are packaged in an xpi file with the following structure: theme.xpi: install.rdf preview.png icon.png chrome/ browser/files communicator/files global/files mozapps/files ...
...nstall.rdf your install.rdf manifest will look something like this: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:type>4</em:type> more properties </description> </rdf> required install.rdf properties your install.rdf file must have the following properties.
... <em:name>new theme 1</em:name> <em:description>a test theme for thunderbird</em:description> <em:creator>ben goodger</em:creator> <em:contributor>john doe</em:contributor> <em:homepageurl>http://www.bengoodger.com/</em:homepageurl> <!-- front end integration hooks (used by theme manager)--> <em:internalname>newtheme1</em:internalname> </description> </rdf> the following are some common target application guids that you can use in your targetapplication properties: thunderbird {3550f703-e582-4d05-9a08-453d09bdfdc6} seamonkey {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} pale moon {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4} official references for toolkit api official references.
...note that this page is included from the pages listed below.
Using the Multiple Accounts API
in the above example, the list of identities would be as follows: alec flett <alecf@mywork.com>) alec flett <alecf@myisp.com>) alec flett <alecfnospam@myisp.com>) relevant api calls: nsimsgaccount.identities nsimsgaccountmanager.allservers: a list of all servers across all accounts storage the accounts are stored in the preferences.
... to create accounts using the api, you should do the following: create a fresh identity with createidentity(); assign values to the various identity properties as necessary.
...- boolean, should we download new messags on biff (true) or just alert user that there is new mail (false) preference: mail.server.server.directory - local platform-specific path to store messages and folder indexes preference: mail.server.server.name - user-visible name of server the following are specific to imap: preference: mail.server.server.admin_url - administration url for server preference: mail.server.server.using_subscription - boolean, should we use subscriptions?
...ference: mail.server.server.capability - list of capabilities of this server preference: mail.server.server.namespace.public - the server's namespace for public folders preference: mail.server.server.namespace.personal - the server's namespace for personal folders preference: mail.server.server.namespace.other_users - the server's namespace for other user's folders the following are specific to pop: the following are specific to news: preference: mail.server.server.leave_on_server - boolean, should we leave messages on the server after we have downloaded them?
Toolkit version format
versions in at least the following places must conform to this format: addon's and target application's version in install and update manifests.
... the following preferences: app.extensions.version, extensions.lastappversion versions returned by nsixulappinfo.
... see older version formats below for description of the older version format used in firefox/thunderbird 1.0.
...note, that since missing version parts are treated as if they were 0, the following version strings are equal: 1, 1.0, 1.0., 1.0.0, and even 1.0...
Using the Mozilla symbol server
this allows debugging of those builds without forcing all users to download large debugging files.
...in the examples below, a local cache directory is used to avoid repeatedly fetching the pdb from the server.
...to use only the mozilla symbol server, add the following entry to your symbol path (note: you can replace c:\symcache\ with any writable directory on your computer, if you'd prefer a different location for downloaded symbols): srv*c:\symcache\*https://symbols.mozilla.org/ set this string as _nt_symbol_path in the environment, using the windbg menus, or by typing the .sympath command.
... symbol indices are named like so: symbols.mozilla.org/{lowercased:name}/{lowercased:name}-{version}-{platform}-{buildid}-symbols.txt.
Type conversion
var buffer = ctypes.char.array(10)(); var somecfunction = library.declare("somecfunction", ctypes.default_abi, ctypes.void_t, ctypes.char.ptr); somecfunction(buffer); // here ctypes.char.array(10)() is converted to ctypes.char.ptr type implicit conversion can be tested in the following way: var mystruct = ctypes.structtype("mystructtype", [ { "v": ctypes.bool } ])(); mystruct.v = 1; console.log(mystruct.v.tostring()); // 'true' boolean type target type source converted value ctypes.bool js boolean src js number (0 or 1) if src == 0: false if src == 1: true var mystruct = ctypes.structtype("mystructtype", [ { "v...
... note that the following table does not contain environment dependent types (ctypes.long, etc.).
...type("mystructtype", [ { "v": ctypes.int16_t.ptr } ])(); mystruct.v = ctypes.int16_t.array(10)(); console.log(mystruct.v.tostring()); // 'ctypes.int16_t.ptr(ctypes.uint64("0x11d6ff400"))' mystruct.v = null; console.log(mystruct.v.tostring()); // 'ctypes.int16_t.ptr(ctypes.uint64("0x0"))' mystruct.v = ctypes.int32_t.array(10)(); // throws error only in functiontype argument, the following rules are also applied: target type source converted value ctypes.char.ptr js string pointer to temporary allocated null-terminated utf8 string ctypes.signed_char.ptr ctypes.unsigned_char.ptr ctypes.char16.ptr js string pointer to temporary allocated null-terminated utf16 string any pointer types any arraybuffer object...
... (only if the object has properties for all fields and no other properties) implicitly convert each enumerable property to corresponding field explicit convert in js-ctypes, data could be converted explicitly, when passing to cdata constructor: ctypes.int32_t("123"); // string "123" is parsed as 10-base string explicit convert tries implicit convert first, and if it fails, the following rules are applied: boolean type target type source converted value ctype.bool js value toboolean(src) console.log(ctypes.bool("123").tostring()); // 'ctypes.bool(true)' console.log(ctypes.bool("").tostring()); // 'ctypes.bool(false)' integer types target type source converted value any integer types js number except -infin...
js-ctypes
js-ctypes allows application and extension code to call back and forth to native code written in c.
...unlike binary xpcom components, it allows developers to ship a single binary for use with multiple versions of firefox.
... documentation if you are brand new to js-ctypes, and have no idea about it, the pages you should read first is - ctypes.open followed by standard os libraries.
... mailing list newsgroup rss feed stackoverflow - jsctypes related topics xpcom in gecko 2 - binary components ...
DOM Inspector FAQ - Firefox Developer Tools
the file menu contains approaches which will allow you to inspect a document.
... inspect a url this just focuses the dom inspector's address bar, which allow you to inspect arbitrary documents which can be accessed via a url.
... dom inspector allows you to force the :hover, :active, and :focus pseudo-classes to apply to a given node.
...you should notice the set pseudo-classes menu item, which will allow you to set the content state for the aforementioned pseudo-classes.
Debugging service workers - Firefox Developer Tools
when you open the application panel’s service workers view on a page that doesn't have a service worker registered, you'll get the following output shown: this gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered!
... the server worker’s status, which can be one of the following: stopped: the service worker is installed, but not currently running.
... when the service worker is stopped, a start button is provided to start it running, allowing you to trigger the service worker lifecycle.
...below the list of installed extensions you'll find a list of all the service workers you have registered.
Debugger.Environment - Firefox Developer Tools
this allows the code using each debugger instance to place whatever properties it likes on its own debugger.object instances, without worrying about interfering with other debuggers.) if a debugger.environment instance’s referent is not a debuggee environment, then attempting to access its properties (other than inspectable) or call any its methods throws an instance of error.
... accessor properties of the debugger.environment prototype object a debugger.environment instance inherits the following accessor properties from its prototype: inspectable true if this environment is a debuggee environment, and can therefore be inspected.
... type the type of this environment object, one of the following values: “declarative”, indicating that the environment is a declarative environment record.
... function properties of the debugger.environment prototype object the methods described below may only be called with a this value referring to a debugger.environment instance; they may not be used as methods of other kinds of objects.
Inspecting web sockets - Firefox Developer Tools
this allows you to capture only the frames that you are interested in.
... the following filters are available: all displays all messages (by default, except control messages).
... columns in the response pane in the response pane, you can choose to show the following information about each frame: data size time opcode maskbit finbit the data and time columns are visible by default, but you can customize the interface to see more columns by choosing which ones to show from the context menu that is opened by right-clicking in the table header.
... supported ws protocols the inspector currently supports the following web socket protocols: plain json socket.io sockjs signalr wamp the payload based on those protocols is parsed and displayed as an expandable tree for easy inspection, although you can of course still see the raw data (as sent over the wire) as well.
Throttling - Firefox Developer Tools
the network monitor allows you to throttle your network speed to emulate various connection speeds so you can see how your app will behave under different connection types.
... throttling the toolbar includes a throttling dropdown, which allows you to throttle your network speed to emulate various different network speed conditions.
... the characteristics emulated are: download speed upload speed minimum latency the table below lists the numbers associated with each network type, but please do not rely on this feature for exact performance measurements; it's intended to give an approximate idea of the user experience in different conditions.
...gprs 50 kbps 20 kbps 500 regular 2g 250 kbps 50 kbps 300 good 2g 450 kbps 150 kbps 150 regular 3g 750 kbps 250 kbps 100 good 3g 1.5 mbps 750 kbps 40 regular 4g/lte 4 mbps 3 mbps 20 dsl 2 mbps 1 mbps 5 wi-fi 30 mbps 15 mbps 2 network monitor features the following articles cover different aspects of using the network monitor: toolbar network request list network request details network traffic recording performance analysis ...
Page inspector 3-pane mode - Firefox Developer Tools
when activated, this allows you to see the following simultaneously: the html pane on the left hand side, as usual.
... note: at narrower browser window widths, the tabs appear below the css rules pane.
... having the css rules in their own pane is very useful because it allows you to not only inspect your html and edit the css applied to it, but also see the effect this has on css features such as computed styles and grids in real time.
... enabling the 3-pane inspector pre-firefox 62 in earlier versions of firefox (since firefox 59/60), you can enable 3 pane mode in release/beta by going to about:config and flipping the following prefs to true: devtools.inspector.split-rule-enabled — this switches 3-pane mode on and off.
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
the flexbox inspector allows you to examine css flexbox layouts using the firefox devtools, which is useful for discovering flex containers on a page, examining and modifying them, debugging layout issues, and more.
... in the html pane in the html pane, an element laid out with flexbox has the word flex next to it as shown in the following image: click the word flex in the html pane to keep the overlay visible when you move the mouse away from the container.
...you can find out more about those in the section below.
...the above and below screenshots should give you further hints on how to get to this.
Animating CSS properties - Firefox Developer Tools
the css rendering waterfall the process the browser uses to update the page when a css property has changed can be described as a waterfall consisting of the following steps: recalculate style: every time a css property for an element changes, the browser must recalculate computed styles.
...this operation is labeled "layout" but is also sometimes called "reflow".
...for a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow.
...average frame rate here is 46.67fps, well below the target of 60fps.
Web Console Helpers - Firefox Developer Tools
:block (starting in firefox 80) followed by an unquoted string, blocks requests where the url contains that string.
...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.
...if you don't supply a filename, the image file will be named with the following format: screen shot yyy-mm-dd at hh.mm.ss.png the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard.
... :unblock (starting in firefox 80) followed by an unquoted string, removes blocking for urls containing that string.
AbortController - Web APIs
the abortcontroller interface represents a controller object that allows you to abort one or more web requests as and when desired.
... examples in the following snippet, we aim to download a video using the fetch api.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener.
AbortSignal - Web APIs
the abortsignal interface represents a signal object that allows you to communicate with a dom request (such as a fetch) and abort it if required via an abortcontroller object.
... examples in the following snippet, we aim to download a video using the fetch api.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener.
AudioContext.createMediaStreamSource() - Web APIs
next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode.
... the range slider below the <video> element controls the amount of gain given to the lowpass filter — increase the value of the slider to make the audio sound more bass heavy!
...ction(e) { video.play(); video.muted = true; }; // create a mediastreamaudiosourcenode // feed the htmlmediaelement into it var audioctx = new audiocontext(); var source = audioctx.createmediastreamsource(stream); // create a biquadfilter var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new...
... mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
AudioNode.channelInterpretation - Web APIs
when the number of channels doesn't match between an input and an output, up- or down-mixing happens according the following rules.
...as it is mixed down to two channels, it is mixed at a lower power: in each case it is multiplied by √2/2.
...as it is mixed down to two channels, it is mixed at a lower power: in each case it is multiplied by √2/2.
... the specification explicitly allows the future definition of new speaker layouts.
AudioParam.setValueCurveAtTime() - Web APIs
the setvaluecurveattime() method of the audioparam interface schedules the parameter's value to change following a curve defined by a list of values.
...if this value is lower than audiocontext.currenttime, it is clamped to currenttime.
... duration a double representing the total time (in seconds) over which the parameter's value will change following the specified curve.
... usage notes when the parameter's value finishes following the curve, its value is guaranteed to match the last value in the set of values specified in the values parameter.
AudioWorkletProcessor.process - Web APIs
however, plans are already in place to revise the specification to allow the size of the audio blocks to be changed depending on circumstances (for example, if the audio hardware or cpu utilization is more efficient with larger block sizes).
... this size may even be allowed to change over time, so you mustn't look at just the first block and assume the sample buffers will always be the same size.
... returning true forces the web audio api to keep the node alive, while returning false allows the browser to terminate the node if it is neither generating new audio data nor receiving data through its inputs that it is processing.
...a processor implementing such a node should return false from the process method to allow the presence of active input nodes and references to the node to determine whether it can be garbage-collected.
BaseAudioContext.createScriptProcessor() - Web APIs
if specified, the buffersize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384.
...lower values for buffersize will result in a lower (better) latency.
...it is recommended for authors to not specify this buffer size and allow the implementation to pick a good buffer size to balance between latency and audio quality.
... example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
BasicCardRequest - Web APIs
those are: amex cartebancaire diners discover jcb mastercard mir unionpay visa examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object that describes what data is needed to fullfil the payment (e.g., a shipping ad...
... the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary.
... // call show() to trigger the browser's payment flow.
...} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse - Web APIs
examples in the following example, the paymentrequest() constructor is used to create a new payment request, which takes three objects as parameters — one containing details of the payment methods that can be used for the payment, one containing details of the actual order (such as items bought and shipping options), and an optional object containing further options.
... the first of these three (supportedinstruments in the example below) contains a data property that has to conform to the structure defined by the basiccardrequest dictionary.
... // call show() to trigger the browser's payment flow.
...} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BeforeUnloadEvent - Web APIs
when a non-empty string is assigned to the returnvalue event property, a dialog box appears, asking the users for confirmation to leave the page (see example below).
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignme...
...pointer-events: all;} bubbles no cancelable yes target objects defaultview interface event examples window.addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't follow the spec for the dialog box.
... an almost-cross-browser working example would be close to the below example.
CSS.registerProperty() - Web APIs
the css.registerproperty() method registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value.
... registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is.
... syntax css.registerproperty(propertydefinition); parameters a propertydefinition dictionary object, which can contain the following members: name a domstring indicating the name of the property being defined.
... examples the following will register a custom property, --my-color, using registerproperty(), as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); in this example, the custom property --my-color has been registered using the syntax <color> .
Using dynamic styling information - Web APIs
the css object model (cssom), part of the dom, exposes specific interfaces allowing manipulation of a wide amount of information regarding css.
...however, there are cases where actually obtaining or manipulating the rules can be useful (whether for whole stylesheets or individual elements), and that is described in further detail below.
... 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.
... to change a particular element's style, you can adapt the following example for the element(s) you want to style.
CSS Painting API - Web APIs
the css painting api — part of the css houdini umbrella of apis — allows developers to write javascript functions that can draw directly into an element's background, border, or content.
... concepts and usage essentially, the css painting api contains functionality allowing developers to create custom values for paint(), a css <image> function.
... we create our paintworklet called 'hollowhighlights' using the registerpaint() function: registerpaint('hollowhighlights', class { static get inputproperties() { return ['--boxcolor']; } static get inputarguments() { return ['*','<length>']; } static get contextoptions() { return {alpha: true}; } paint(ctx, size, props, args) { const x = 0; const y = size.height * 0.3; const blockwidth = size.width * 0.33; const bloc...
...i> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); then we can use the <image> with the css paint() function: li { --boxcolor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowhighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxcolor: hsla(255, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 1px); } we've included a custom property in the selector block defining a boxcolor.
Using the CSS properties and values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows the registration of css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value.
... registering a custom property registering a custom property allows you to tell the browser how the custom property should behave; what are allowed types, whether the custom property inherits its value, and what the default value of the custom property is.
... css.registerproperty the following will register a css custom properties, --my-prop, using css.registerproperty, as a color, give it a default value, and have it not inherit its value: window.css.registerproperty({ name: '--my-prop', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); @property the same registration can take place in css.
... the following will register a css custom properties, --my-prop, using @property, as a color, give it a default value, and have it not inherit its value: @property --my-prop { syntax: '<color>'; inherits: false; initial-value: #c0ffee; } using registered custom properties one of the advantages of registering a property is that the browser now knows how it should handle your custom property through things like transitions!
CanvasRenderingContext2D.filter - Web APIs
syntax ctx.filter = "<filter-function1> [<filter-function2>] [<filter-functionn>]"; ctx.filter = "none"; values the filter property accepts a value of "none" or one or more of the following filter functions in a domstring.
...a drop shadow is effectively a blurred, offset version of the drawing's alpha mask drawn in a particular color, composited below the drawing.
...negative values are not allowed.
... examples to view these examples, make sure to use a browser that supports this feature; see the compatibility table below.
Advanced animations - Web APIs
the following code will set us up.
...to do so, we add the following checks to the draw method: if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) { ball.vy = -ball.vy; } if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } first demo let's see how it looks in action so far.
... } raf = window.requestanimationframe(draw); } canvas.addeventlistener('mouseover', function(e) { raf = window.requestanimationframe(draw); }); canvas.addeventlistener('mouseout', function(e) { window.cancelanimationframe(raf); }); ball.draw(); acceleration to make the motion more real, you can play with the velocity like this, for example: ball.vy *= .99; ball.vy += .25; this slows down the vertical velocity each frame, so that the ball will just bounce on the floor in the end.
...s.width || ball.x + ball.vx < 0) { ball.vx = -ball.vx; } raf = window.requestanimationframe(draw); } canvas.addeventlistener('mouseover', function(e) { raf = window.requestanimationframe(draw); }); canvas.addeventlistener('mouseout', function(e) { window.cancelanimationframe(raf); }); ball.draw(); adding mouse control to get some control over the ball, we can make it follow our mouse using the mousemove event, for example.
Drawing text - Web APIs
the following diagram from the whatwg demonstrates the various baselines supported by the textbaseline property.
... a textbaseline example edit the code below and see your changes update live in the canvas: ctx.font = '48px serif'; ctx.textbaseline = 'hanging'; ctx.stroketext('hello world', 0, 100); 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"> ctx.font = "48px serif"; ctx.textbaseline = "hanging"; ctx.stroketext("hello world", 0, 100);</textarea> var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var textarea = document.getelementbyid('code'); var reset = document.getelementbyid('reset'); var edit = document.getelementbyid('edit'); var code...
...dth, canvas.height); eval(textarea.value); } reset.addeventlistener('click', function() { textarea.value = code; drawcanvas(); }); edit.addeventlistener('click', function() { textarea.focus(); }) textarea.addeventlistener('input', drawcanvas); window.addeventlistener('load', drawcanvas); advanced text measurements in the case you need to obtain more details about the text, the following method allows you to measure it.
... the following code snippet shows how you can measure a text and get its width.
Hit regions and accessibility - Web APIs
the following guidelines can help to make it more accessible.
...the hit region api allows you to define an area of your canvas and provides another possibility to expose interactive content on a canvas to accessibility tools.
... it allows you to make hit detection easier and lets you route events to dom elements.
... the api has the following three methods (which are still experimental in current web browsers; check the browser compatibility tables).
DOMError - Web APIs
WebAPIDOMError
properties domerror.name read only returns a domstring representing one of the error type names (see below).
... error types type description indexsizeerror the index is not in the allowed range (e.g.
... nomodificationallowederror the object can not be modified.
... namespaceerror the operation is not allowed by namespaces in xml invalidaccesserror the object does not support the operation or argument.
DOMMatrixReadOnly - Web APIs
the dommatrix interrface—which is based upon dommatrixreadonly—adds mutability, allowing you to alter the matrix after creating it.
... this interface should be available inside web workers, though some implementations doesn't allow it yet.
...these are aliases for specific components of a 4×4 matrix, as shown below.
...none of the following methods alter the original matrix.
DOMTokenList - Web APIs
domtokenlist.entries() returns an iterator, allowing you to go through all key/value pairs contained in this object.
... domtokenlist.keys() returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object.
... domtokenlist.values() returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
... examples in the following simple example, we retrieve the list of classes set on a <p> element as a domtokenlist using element.classlist, add a class using domtokenlist.add(), and then update the node.textcontent of the <p> to equal the domtokenlist.
DataTransfer.dropEffect - Web APIs
on setting, if the new value is one of the values listed below, then the property's current value will be set to the new value and other values will be ignored.
... example this example shows the use of the dropeffect and effectallowed properties.
.../p> </div> <div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">drop zone</div> css content div { margin: 0em; padding: 2em; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } javascript content function dragstart_handler(ev) { console.log("dragstart: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed)...
...; ev.preventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.preventdefault(); // set the dropeffect to move ev.datatransfer.dropeffect = "move" } specifications specification status comment html living standardthe definition of 'dropeffect' in that specification.
DataTransferItem.webkitGetAsEntry() - Web APIs
<p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
...in chromium-based browsers, the following example will only return a max of 100 entries.
...any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth.
... result you can see how this works by trying it out below.
DirectoryReaderSync - Web APIs
about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011.
... example in the following code snippet from html5rocks, we create web workers and pass data from it to the main app.
... console.log(fileentry.name); }); }); }; worker.postmessage({'cmd': 'list'}); the following is worker.js code that gets the contents of the directory.
... entrysync readentries ( ) raises (fileexception); returns parameter none exceptions this method can raise a fileexception with the following codes: exception description not_found_err the directory does not exist.
Document.createElement() - Web APIs
when called on an html document, createelement() converts tagname to lower case before creating the element.
...("div"); // and give it some content const newcontent = document.createtextnode("hi there and greetings!"); // add the text node to the newly created div newdiv.appendchild(newcontent); // add the newly created element and its content into the dom const currentdiv = document.getelementbyid("div1"); document.body.insertbefore(newdiv, currentdiv); } web component example the following example snippet is taken from our expanding-list-web-component example (see it live also).
... } } // 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.getElementsByTagNameNS() - Web APIs
syntax elements = document.getelementsbytagnamens(namespace, name) elements is a live nodelist (but see the note below) of found elements in the order they appear in the tree.
... example in the following example getelementsbytagnamens starts from a particular parent element, and searches topdown recursively through the dom from that parent element, looking for child elements matching the tag name parameter.
... to use the following example, just copy/paste it into a new file saved with the .xhtml extension.
...(to accommodate explorer, one could call an xpath wrapper instead of the xpath in the function below (as explorer supports xpath with a different api), such as this wrapper class.) function getelementsbytagnamenswrapper (ns, elname, doc, context) { if (!doc) { doc = document; } if (!context) { context = doc; } var result = doc.evaluate('//*[local-name()="'+elname+'" and namespace-uri() = "'+ns+'"]', context, null, xpathresult.ordered_node_snapshot_type, null); var a = []; ...
Document - Web APIs
WebAPIDocument
<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...
... properties included from documentorshadowroot the document interface includes the following properties defined on the documentorshadowroot mixin.
... document.mozsetimageelement() allows you to change the element being used as the background image for a specified element id.
... methods included from documentorshadowroot the document interface includes the following methods defined on the documentorshadowroot mixin.
Element.innerHTML - Web APIs
WebAPIElementinnerHTML
nomodificationallowederror an attempt was made to insert the html into a node whose parent is a document.
...doing so causes the user agent to follow these steps: the specified value is parsed as html or xml (based on the document type), resulting in a documentfragment object representing the new set of dom nodes for the new elements.
... css the following css styles our example content.
... .box { width: 600px; height: 300px; border: 1px solid black; padding: 2px 4px; overflow-y: scroll; overflow-x: auto; } .log { margin-top: 8px; font-family: monospace; } result the resulting content looks like this.
Element.scrollHeight - Web APIs
the element.scrollheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overflow.
... padding-bottom left top right bottom margin-top margin-bottom border-top border-bottom problems and solutions determine if an element has been totally scrolled the following equivalence returns true if an element is at the end of its scroll, false if it isn't.
... element.scrollheight - element.scrolltop === element.clientheight when the container does not scroll, but has overflowing children, these checks determine if the container can scroll: window.getcomputedstyle(element).overflowy === 'visible' window.getcomputedstyle(element).overflowy !== 'hidden' scrollheight demo associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrolltop and element.clientheight properties).
..."thank you." : "please, scroll and read the following text."; } onload = function () { var otoberead = document.getelementbyid("rules"); checkreading.noticebox = document.createelement("span"); document.registration.accept.checked = false; checkreading.noticebox.id = "notice"; otoberead.parentnode.insertbefore(checkreading.noticebox, otoberead); otoberead.parentnode.insertbefore(document.createelement("br"), otoberead); otoberead.o...
Element.scrollWidth - Web APIs
the element.scrollwidth read-only property is a measurement of the width of an element's content, including content not visible on the screen due to overflow.
... example <!doctype html> <html> <head> <title>example</title> <style> div { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } #adiv { width: 100px; } button { margin-bottom: 2em; } </style> </head> <body> <div id="adiv"> foobar-foobar-foobar-foobar </div> <button id="abutton"> check for overflow </button> <div id="...
...anotherdiv"> foobar-foobar-foobar-foobar </div> <button id="anotherbutton"> check for overflow </button> </body> <script> var buttonone = document.getelementbyid('abutton'), buttontwo = document.getelementbyid('anotherbutton'), divone = document.getelementbyid('adiv'), divtwo = document.getelementbyid('anotherdiv'); //check to determine if an overflow is happening function isoverflowing(element) { return (element.scrollwidth > element.offsetwidth); } function alertoverflow(element) { if (isoverflowing(element)) { alert('contents are overflowing the container.'); } else { alert('no overflows!'); } } buttonone.addeventlistener('click', function() { alertoverflow...
...(divone); }); buttontwo.addeventlistener('click', function() { alertoverflow(divtwo); }); </script> </html> result specification specification status comment css object model (cssom) view modulethe definition of 'element.scrollwidth' in that specification.
Event.eventPhase - Web APIs
WebAPIEventeventPhase
the eventphase read-only property of the event interface indicates which phase of the event flow is currently being evaluated.
... syntax let phase = event.eventphase; value returns an integer value which specifies the current evaluation phase of the event flow.
... constants event phase constants these values describe which phase the event flow is currently being evaluated.
... for more details, see section 3.1, event dispatch and dom event flow, of the dom level 3 events specification.
FeaturePolicy - Web APIs
featurepolicy methods featurepolicy.allowsfeature returns a boolean that indicates whether or not a particular feature is enabled in the specified context.
...feature whose name appears on the list might not be allowed by the feature policy of the current execution context and/or might not be accessible because of user's permissions.
... featurepolicy.allowedfeatures returns a list of names of all features supported by the user agent and allowed by the feature policy.
... featurepolicy.getallowlistforfeature returns the allow list for the specified feature.
FileException - Web APIs
when errors occur, forward them to the main app using postmessage() as in the following: function onerror(e) { postmessage('error:' + e.tostring()); } try { //error is thrown if "log.txt" already exists.
... invalid_modification_err 9 the modification requested is not allowed.
... no_modification_allowed_err 6 the state of the underlying file system prevents any writing to a file or a directory.
... 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.
FileSystemDirectoryReader.readEntries() - Web APIs
<p>drag files and/or directories to the box below!</p> <div id="dropzone"> <div id="boxtitle"> drop files here </div> </div> <h2>directory tree:</h2> <ul id="listing"> </ul> css content the styles used by the example are shown here.
...in chromium-based browsers, the following example will only return a max of 100 entries.
...any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth.
... result you can see how this works by trying it out below.
Using the Geolocation API - Web APIs
note: by default, getcurrentposition() tries to answer as fast as possible with a low accuracy result.
...the callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you.
... this object allows you to specify whether to enable high accuracy, a maximum age for the returned position value (up until this age it will be cached and reused if the same position is requested again; after this the browser will request fresh position data), and a timeout value that dictates how long the browser should attempt to get the position data for, before it times out.
... you could use it like so: function errorcallback(error) { alert(`error(${error.code}): ${error.message}`); }; examples in the following example the geolocation api is used to retrieve the user's latitude and longitude.
HTMLAnchorElement - Web APIs
this interface corresponds to <a> element; not to be confused with <link>, which is represented by htmllinkelement) <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... living standard the following property has been added: download.
... the following properties are now obsolete: charset, coords, name, rev, and shape.
... the following properties have been added: hash, host, hostname, media, pathname, port, protocol, rellist, search, and text.
HTMLAreaElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"...
... living standard the following property has been added: download.
... the following property is now obsolete: nohref.
... the following properties have been added: rel, rellist, media, hreflang, type, host, hostname, pathname, port, protocol, search, and hash.
HTMLElement.hidden - Web APIs
javascript document.getelementbyid("okbutton") .addeventlistener("click", function() { document.getelementbyid("welcome").hidden = true; document.getelementbyid("awesome").hidden = false; }, false); this code sets up a handler for the welcome panel's "ok" button that hides the welcome panel and makes the follow-up panel—with the curious name "awesome"—visible in its place.
... the follow-up panel once the user clicks the "ok" button in the welcome panel, the javascript code swaps the two panels by changing their respective values for hidden.
... the follow-up panel looks like this in html: <div id="awesome" class="panel" hidden> <h1>thanks!</h1> <p>thank you <strong>so</strong> much for agreeing to be awesome today!
... now get out there and do awesome things awesomely to make the world more awesome!</p> </div> css the content is styled using the css below.
HTMLImageElement.align - Web APIs
syntax htmlimageelement.align = alignmode; alignmode = htmlimageelement.align; value a domstring specifying one of the following strings which set the alignment mode for the image.
...instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image.
...any text that follows will flow against the image's right edge.
...subsequent text will flow along the image's left edge.
HTMLImageElement.loading - Web APIs
preventing element shift during image lazy loads when an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made to the element to fit the image.
... to prevent this reflow from occurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes.
... by establishing the intrinsic aspect ratio in this manner, you prevent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows.
... example the addimagetolist() function shown below adds a photo thumbnail to a list of items, using lazy-loading to avoid loading the image from the network until it's actually needed.
HTMLLinkElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... living standard adds the following properties: crossorigin, referrerpolicy, and as.
... recommendation the following properties are now obsolete: charset, rev, and shape.
... the following properties have been added: rellist, and sizes.
HTMLObjectElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... the following properties are now obsolete: align, archive, border, code, codebase, codetype, declare, hspace, standby, and vspace.
... the following properties have been added: typemustmatch, contentwindow, willvalidate, validity, and validationmessage.
... the following methods have been added: checkvalidity() and setcustomvalidity().
HTMLOptionsCollection - Web APIs
<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/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" t...
...e="#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 allows this, while other implementations could potentially throw a domexception.
HTMLOrForeignElement.dataset - Web APIs
it must contain only letters, numbers, and the following characters: dash (-), dot (.), colon (:), underscore (_)—but not any ascii capital letters (a to z).
... in addition to the information below, you'll find a how-to guide for using html data attributes in our article using data attributes.
... name conversion dash-style to camelcase conversion a custom data attribute name is transformed to a key for the domstringmap entry with the following rules the prefix data- is removed (including the dash); for any dash (u+002d) followed by an ascii lowercase letter a to z, the dash is removed, and the letter is transformed into its uppercase counterpart; other characters (including other dashes) are left unchanged.
... camelcase to dash-style conversion the opposite transformation, which maps a key to an attribute name, uses the following rules: restriction: before the transformation, a dash must not be immediately followed by an ascii lowercase letter a to z; the prefix data- is added; any ascii uppercase letter a to z is transformed into a dash, followed by its lowercase counterpart; other characters are left unchanged.
HTMLTableElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="midd...
... obsolete properties warning: the following properties are obsolete.
...it reflects the obsolete frame attribute and can take one of the following values: "void", "above", "below", "hsides", "vsides", "lhs", "rhs", "box", or "border".
...it reflects the obsolete rules attribute and can take one of the following values: "none", "groups", "rows", "cols", or "all".
HashChangeEvent - Web APIs
the fragment identifier is the part of the url that follows (and includes) the # symbol.
... <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/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" tar...
... examples syntax options for a hash change you can listen for the hashchange event using any of the following options: window.onhashchange = funcref; or <body onhashchange="funcref();"> or window.addeventlistener("hashchange", funcref, false); basic example function locationhashchanged() { if (location.hash === '#somecoolfeature') { somecoolfeature(); } } window.addeventlistener('hashchange', locationhashchanged); polyfill there are several fallback scripts listed on the moder...
...here is a version that allows only one handler to be bound to the onhashchange property: ;(function(window) { // exit if the browser implements that event if ( "onhashchange" in window.document.body ) { return; } var location = window.location, oldurl = location.href, oldhash = location.hash; // check the location hash on a 100ms interval setinterval(function() { var newurl = location.href, newhash = location.hash; // if the hash has changed and a handler has been bound...
IDBIndex.unique - Web APIs
WebAPIIDBIndexunique
the unique read-only property returns a boolean that states whether the index allows duplicate keys.
... syntax var isunique = idbindex.unique; value a boolean: value effect true the current index does not allow duplicate values for a key.
... false the current index allows duplicate key values.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBObjectStore.delete() - Web APIs
either a key or an idbkeyrange can be passed, allowing one or multiple records to be deleted from a store.
... exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this object store's transaction is inactive.
... example in the following code snippet, we open a read/write transaction on our database and delete one specific record out of our object store using delete() — a sample record with the key "walk dog".
...this is used a lot below db = dbopenrequest.result; // run the deletedata() function to delete a record from the database deletedata(); }; function deletedata() { // open a read/write db transaction, ready for deleting the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction ...
IDBTransaction.abort() - Web APIs
syntax transaction.abort(); exceptions this method may raise a domexception of the following type: exception description invalidstateerror the transaction has already been committed or aborted.
... example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
...this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transactio...
IDBTransaction.objectStore() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description notfounderror the requested object store is not in this transaction's scope.
... example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction...
Browser storage limits and eviction criteria - Web APIs
note: the information below should be fairly accurate for most modern browsers, but browser specifics are called out where known.
... in firefox, the following technologies make use of browser data storage to store data when required.
...here's the actual mapping to directories under a user's firefox profile (other browsers may differ slightly): <profile>/storage — the main top-level directory for storages maintained by the quota manager (see below) <profile>/storage/permanent — persistent data storage repository <profile>/storage/temporary — temporary data storage repository <profile>/storage/default — default data storage repository note: after introducing storage api, the "permanent" folder can be considered obsolete; the "permanent" folder only stores indexeddb persistent-type databases.
...if you had a really low memory situation where the global limit was, say, 8 mb, then the group limit would also be 8 mb.
KeyframeEffect.KeyframeEffect() - Web APIs
the keyframeeffect() constructor of the web animations api returns a new keyframeeffect object instance, and also allows you to clone an existing keyframe effect object instance.
... keyframeoptions optional either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the following: delay optional the number of milliseconds to delay the start of the animation.
...its parameter is as follows: sourcekeyframes a keyframeeffect object that you want to clone.
... examples in the follow the white rabbit example, the keyframeeffect constructor is used to create a set of keyframes that dictate how the white rabbit should animate down the hole: var rabbitdownkeyframes = new keyframeeffect( whiterabbit, // element to animate [ { transform: 'translatey(0%)' }, // keyframe { transform: 'translatey(100%)' } // keyframe ], { duration: 3000, fill: 'forwards' } // keyframe options ); specifications specification status comment web animations level 2the definition of 'keyframeeffectoptions.iterationcomposite' in that specification.
KeyframeEffect.setKeyframes() - Web APIs
the easing to apply between keyframes can be specified by providing an easing value as illustrated below.
... element.animate({ opacity: [ 0, 1 ], // offset: 0, 1 backgroundcolor: [ "red", "yellow", "green" ], // offset: 0, 0.5, 1 }, 2000); the special keys offset, easing, and composite (described below) may be specified alongside the property values.
... offset, which must be written as cssoffset since "offset" represents the keyframe offset as described below.
... the following special attributes may also be specified: offset the offset of the keyframe specified as a number between 0.0 and 1.0 inclusive or null.
LocalFileSystemSync - Web APIs
about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011.
... exceptions this method can raise an fileexception with the following code: exception description security_error the application does not have permission to access the file system interface.
... resolvelocalfilesystemsyncurl() allows the user to look up the entry for a file or directory referred to by a local url.
... exceptions this method can raise a fileexception with the following codes: exception description encoding_err the syntax of the url was invalid.
Location - Web APIs
WebAPILocation
-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 {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.ha...
... location.pathname is a usvstring containing an initial '/' followed by the path of the url.
... location.search is a usvstring containing a '?' followed by the parameters or "querystring" of the url.
... location.hash is a usvstring containing a '#' followed by the fragment identifier of the url.
MediaStreamConstraints.audio - Web APIs
examples for browsers with feature policy enabled, the samples below need the microphone feature enabled.
... html content <p>click the start button below to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-align: center; padding-top: 2px; padding-bottom: ...
... result using a mediatrackconstraints object now let's look at a similar example that uses a set of constraints based on the mediatrackconstraints dictionary: html content <p>click the start button below to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <audio id="audio" autoplay controls></audio><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } audio { margin-top: 20px; border: 1px solid black; width: 160px; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-a...
...as long as an audio input device is available and the user allows it to be used, an audio track will be included in the resulting stream, and it will match the specified constraints as well as possible.
MediaStreamTrackAudioSourceNode - Web APIs
next, we feed this source audio into a low pass biquadfilternode (which effectively serves as a bass booster), then a audiodestinationnode.
... the range slider below the <video> element controls the amount of gain given to the lowpass filter — increase the value of the slider to make the audio sound more bass heavy!
...ction(e) { video.play(); video.muted = true; }; // create a mediastreamaudiosourcenode // feed the htmlmediaelement into it var audioctx = new audiocontext(); var source = audioctx.createmediastreamsource(stream); // create a biquadfilter var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; // connect the audiobuffersourcenode to the gainnode // and the gainnode to the destination, so we can play the // music and adjust the volume using the mouse cursor source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); // get new...
... mouse pointer coordinates when mouse is moved // then set new gain value range.oninput = function() { biquadfilter.gain.value = range.value; } }) .catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('getusermedia not supported on your browser!'); } // dump script to pre element pre.innerhtml = myscript.innerhtml; note: as a consequence of calling createmediastreamsource(), audio playback from the media stream will be re-routed into the processing graph of the audiocontext.
NDEFWriter.write() - Web APIs
WebAPINDEFWriterwrite
signal -- optional abortsignal that allows to cancell this write operation.
... exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: aborterror the write operation was aborted with abortsignal passed in options.
... notallowederror the permission for this operation was rejected or overwrite is false and there are already records on the tag.
... notreadableerror the ua is not allowed to access underlying nfc adapter (e.g., due to user preference).
Navigator.getBattery() - Web APIs
exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: securityerror the user agent does not expose battery information to insecure contexts and this method was called from insecure context.
... note: old versions of some user agents might allow use of this feature in insecure contexts.
... notallowederror note: no user agent currently throws this exception, but the specification describes the following behaviors: this document is not allowed to use this feature.
... for example, it might not be explicitly allowed or restricted via feature-policy battery feature.
Navigator.msLaunchUri() - Web APIs
this proprietary method is specific to internet explorer, and microsoft edge versions 18 and lower.
... to help protect a user's privacy, windows displays a prompt for the user to allow the service or app to be launched.
...if a handler doesn't exist, and the developer doesn't provide a nohandlercallback, then internet explorer displays a dialog that asks the user if they want to allow the action.
... if the user allows it, the user is then prompted to look in the windows store for an app to handle the protocol.
Navigator - Web APIs
WebAPINavigator
it allows scripts to query it and to register themselves to carry on some activities.
... navigator.geolocation read only returns a geolocation object allowing accessing the location of the device.
... navigator.registercontenthandler() obsolete since gecko 59 allows web sites to register themselves as a possible handler for a given mime type.
... navigator.registerprotocolhandler() allows web sites to register themselves as a possible handler for a given protocol.
Notifications API - Web APIs
the notifications api allows web pages to control the display of system notifications to the end user.
...this should be done in response to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { let promise = notification.requestpermission(); // wait for permission }) this is not only best practice — you should not be spamming users with notifications they didn't agree to — but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture.
... 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.
... in addition, the notifications api spec specifies a number of additions to the serviceworker api, to allow service workers to fire notifications.
PaymentRequest.show() - Web APIs
if this is provided, show() will not allow the user to interact with the payment interface until the promise is fulfilled, so that data can be updated prior to the user engaging with the payment process.
... the validateresponse() method, below, is called once show() returns, in order to look at the returned response and either submit the payment or reject the payment as failed: async function validateresponse(response) { try { if (await checkallvalues(response)) { await response.complete("success"); } else { await response.complete("fail"); } } catch(err) { await response.complete("fail"); } } here,...
... examples in the following example, a paymentrequest object is instantiated before the show() method is called.
... // paymentresponse.methodname contains the selected payment method // paymentresponse.details contains a payment method specific response await response.complete("success"); } catch (err) { console.error("uh oh, something bad happened", err.message); } } the following example shows how to update the payment sheet as it's being presented to the end-user.
PaymentResponse.complete() - Web APIs
it must be one of the following: success the payment was successfully processed.
...see the browser compatibility section below for details.
...if an error occurs, the promise instead rejects, returning one of the exceptions listed below.
... examples the following example sends payment information to a secure server using the fetch api.
Using the Payment Request API - Web APIs
in the following snippet, a merchant page performs this check, and if it returns true updates the checkout button to use paymentrequest instead of legacy web forms.
... in the following snippet we do just this — depending on whether the user can make a fast payment or needs to add payment credentials first, the title of the checkout button changes between "fast checkout with w3c" and "setup w3c checkout".
... 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().
... }); the payment handler would include the following code: self.addeventlistener('canmakepayment', function(evt) { // pre-authorize here.
PerformanceNavigationTiming - Web APIs
<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/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"...
...="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".
... this interface also extends following performanceresourcetiming properties for navigation performance entry types by qualifying and constraining them as follows: performanceresourcetiming.initiatortyperead only returns "navigation".
... the interface also supports the following properties: performancenavigationtiming.domcomplete read only a domhighrestimestamp representing a time value equal to the time immediately before the browser sets the current document readiness of the current document to complete.
Performance Timeline - Web APIs
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 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.
... performance observers the performance observer interfaces allow an application to register an observer for specific performance event types, and when one of those event types is recorded, the application is notified of the event via the observer's callback function that was specified when the observer was created.
... implementation status a summary of the interfaces' implementation status is provided below, including a link to more detailed information.
RTCPeerConnection.setRemoteDescription() - Web APIs
this lets you simplify code such as the following: mypeerconnection.setremotedescription(new rtcsessiondescription(description)) .then(function () { return createmystream(); }) to simply be: mypeerconnection.setremotedescription(description) .then(function () { return createmystream(); }) using async/await syntax, you can further simplify this to: await mypeerconnection.setremotedescription(description); createmystream(); since it'...
... exceptions the following exceptions are reported to the rejection handler for the promise returned by setremotedescription(): invalidaccesserror the content of the description is invalid.
...the parameters for the older form of setremotedescription() are described below, to aid in updating existing code.
... exceptions when using the deprecated callback-based version of setremotedescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place.
RTCRtpSender.setParameters() - Web APIs
the default value is low.
... exceptions if an error occurs, the returned promise is rejected with the appropriate exception from the list below.
... invalidmodificationerror one of the following problems was detected: the number of encodings specified in the parameters object's encodings property does not match the number of encodings currently listed for the rtcrtpsender.
... rangeerror the value specified for scaleresolutiondownby is less than 1.0, which would result in scaling up rather than down, which is not allowed; or one or more of the specified encodings' maxframerate values is less than 0.0.
Reporting API - Web APIs
there are a few ways to use it, which are detailed in the sections below.
...the callback runs when observation starts an options dictionary that allows you to specify the type of reports to collect, and whether the reports that were generated before the observer was able to be created should be observable (buffered: true).
... reporting api dictionaries reportingobserveroptions allows options to be set in the constructor when creating a reporting observer.
... available report types the spec defines the following report types: deprecation report indicates that a webapi or other browser feature being used in the website is expected to stop working in a future release.
Response.redirected - Web APIs
see the example disallowing redirects, which shows this being done.
...in the code below, a textual message is inserted into an element when a redirect occurred during the fetch operation.
... note, however, that this isn't as safe as outright rejecting redirects if they're unexpected, as described under disallowing redirects below.
...e-picture.jpg").then(function(response) { let elem = document.getelementbyid("warning-message-box"); if (response.redirected) { elem.innerhtml = "unexpected redirect"; } else { elem.innerhtml = ""; } return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); document.getelementbyid("img-element-id").src = imgobjecturl; }); disallowing redirects because using redirected to manually filter out redirects can allow forgery of redirects, you should instead set the redirect mode to "error" in the init parameter when calling fetch(), like this: fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) { return response.blob(); }).then(function(imageblob) { let imgobjecturl = url.createobjecturl(imageblob); ...
SVGAngle - Web APIs
WebAPISVGAngle
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGLength - Web APIs
WebAPISVGLength
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGStyleElement - Web APIs
<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"/...
... svg 1.1 defined that a domexception is raised with code no_modification_allowed_err on an attempt to change the value of a read-only attribute.
... svg 1.1 defined that a domexception is raised with code no_modification_allowed_err on an attempt to change the value of a read-only attribute.
... svg 1.1 defined that a domexception is raised with code no_modification_allowed_err on an attempt to change the value of a read-only attribute.
ServiceWorkerContainer.register() - Web APIs
the following example uses the default value of scope (by omitting it).
... navigator.serviceworker.register('/sw.js').then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } the following code, if included in example.com/index.html, at the root of a site, would apply to exactly the same pages as the example above.
... the following code, if included in example.com/index.html, at the root of a site, would only apply to resources under example.com/product.
...serviceworker.register('/sw.js', {scope: '/product/'}).then(function(registration) { console.log('service worker registration succeeded:', registration); }, /*catch*/ function(error) { console.log('service worker registration failed:', error); }); } else { console.log('service workers are not supported.'); } however, servers can remove this restriction by setting a service-worker-allowed header on the service worker script, and then you can specify a max scope for that service worker above the service worker's location.
ServiceWorkerGlobalScope - Web APIs
additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 12.142857142857142%; vertical-align: middle; overflow: hidden;"><svg style="display: 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">eventtar...
... methods serviceworkerglobalscope.skipwaiting() allows the current service worker registration to progress from waiting to active state while service worker clients are using it.
...therefore it also has the following property available to it: globalfetch.fetch() starts the process of fetching a resource.
ServiceWorkerRegistration.showNotification() - Web APIs
syntax ​serviceworkerregistration.shownotification(title, [options]); parameters title the title that must be shown within the notification options optional an object that allows configuring the notification.
... it can have the following properties: actions: an array of actions to display in the notification.
...it may contain the following values: action: a domstring identifying a user action to be displayed on the notification.
... tag: an id for a given notification that allows you to find, replace, or remove the notification using a script if necessary.
Service Worker API - Web APIs
they will also allow access to push notifications and background sync apis.
...if successful, your service worker will be downloaded to the client and attempt installation/activation (see below) for urls accessed by the user inside the whole origin, or inside a subset specified by you.
... download, install and activate at this point, your service worker will observe the following lifecycle: download install activate the service worker is immediately downloaded when a user first accesses a service worker–controlled site/page.
...it contains information about the request and resulting response, and provides the fetchevent.respondwith() method, which allows us to provide an arbitrary response back to the controlled page.
Storage API - Web APIs
the diagram below shows a site storage pool with three storage units within, showing how storage units can have different data types stored within and may have different quotas (maximum storage limits).
...this origin, however, has a lower quota than the other two do.
... it may be a less-visited site, or one known to have lower data storage requirements.
...there are two modes: "best-effort" the user agent will try to retain the data contained in the box for as long as it can, but will not warn users if storage space runs low and it becomes necessary to clear the box in order to relieve the storage pressure.
SubtleCrypto.deriveKey() - Web APIs
note that the key usages must be allowed by the algorithm set in derivedkeyalgorithm.
... exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the master key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey.
... it's not designed to derive keys from relatively low-entropy inputs such as passwords.
...it's designed to derive key material from some relatively low-entropy input, such as a password.
SubtleCrypto - Web APIs
the subtlecrypto interface of the web crypto api provides a number of low-level cryptographic functions.
... warning: this api provides a number of low-level cryptographic primitives.
...the subtlecrypto api provides the following cryptography functions: * sign() and verify(): create and verify digital signatures.
... the table below summarises which algorithms are suitable for which cryptographic operations: sign() verify() encrypt() decrypt() digest() derivebits() derivekey() wrapkey() unwrapkey() rsassa-pkcs1-v1_5 ✓ rsa-pss ✓ ecdsa ✓ hmac ...
Using Touch Events - Web APIs
interfaces touch events consist of three interfaces (touch, touchevent and touchlist) and the following event types: touchstart - fired when a touch point is placed on the touch surface.
...this interface's attributes include the state of several modifier keys (for example the shift key) and the following touch lists: touches - a list of all of the touch points currently on the screen.
... together, these interfaces define a relatively low-level set of features, yet they support many kinds of touch-based interaction, including the familiar multi-touch gestures such as multi-finger swipe, rotation, pinch and zoom.
... examples and demos the following documents describe how to use touch events and include example code: touch events overview implement custom gestures introduction to touch events in javascript add touch screen support to your website (the easy way) touch event demonstrations: paint program (by rick byers) touch/pointer tests and demos (by patrick h.
USB.requestDevice() - Web APIs
WebAPIUSBrequestDevice
calling this function triggers the user agent's pairing flow.
...each filter object can have the following properties: vendorid productid classcode subclasscode protocolcode serialnumber return value a promise that resolves with an instance of usbdevice.
... example the following example looks for one of two usb devices.
...this triggers a user-agent flow that prompts the user to select a device for pairing.
WebGLRenderingContext.getParameter() - Web APIs
see below for possible values.
... parameter names webgl 1 you can query the following pname parameters when using a webglrenderingcontext.
...ltexture or null gl.unpack_alignment glint gl.unpack_colorspace_conversion_webgl glenum gl.unpack_flip_y_webgl glboolean gl.unpack_premultiply_alpha_webgl glboolean gl.vendor domstring gl.version domstring gl.viewport int32array (with 4 elements) webgl 2 you can query the following pname parameters when using a webgl2renderingcontext.
... webgl extensions you can query the following pname parameters when using webgl extensions: constant returned type extension description ext.max_texture_max_anisotropy_ext glfloat ext_texture_filter_anisotropic maximum available anisotropy.
WebGLRenderingContext.pixelStorei() - Web APIs
see below for possible values.
...see below for possible values.
... pixel storage parameters parameter name (for pname) description type default value allowed values (for param) specified in gl.pack_alignment packing of pixel data into memory glint 4 1, 2, 4, 8 opengl es 2.0 gl.unpack_alignment unpacking of pixel data from memory.
... glenum gl.browser_default_webgl gl.browser_default_webgl, gl.none webgl when using a webgl 2 context, the following values are available additionally: constant description type default value allowed values (for param) specified in gl.pack_row_length number of pixels in a row.
WebGLRenderingContext.texSubImage2D() - Web APIs
xoffset a glint specifying the lower left texel x coordinate of a width-wide by height-wide rectangular subregion of the texture array.
... yoffset a glint specifying the lower left texel y coordinate of a width-wide by height-wide rectangular subregion of the texture array..
... when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available additionally: gl.red gl.rg gl.red_integer gl.rg_integer gl.rgb_integer gl.rgba_integer type a glenum specifying the data type of the texel data.
... when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: gl.half_float_oes when using a webgl 2 context, the following values are available additionally: gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_rev (pixels must be null) pixels one of the following objects can be used...
Color masking - Web APIs
so, by masking off the blue and green channels, you are only allowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass.
... color masking allows us to demonstrate some basics of color theory.
...masking only the blue channel would give us shades of yellow (including shades of orange, brown, olive and yellow-green), the complementary of blue.
...it allows us to setup webgl in a single initialization phase, and then just execute drawing commands for each frame.
Using shaders to apply color in WebGL - Web APIs
we'll do that by adding the following code to our initbuffers() function: function initbuffers(){ ...
... to use these colors, the vertex shader needs to be updated to pull the appropriate color from the color buffer: const vssource = ` attribute vec4 avertexposition; attribute vec4 avertexcolor; uniform mat4 umodelviewmatrix; uniform mat4 uprojectionmatrix; varying lowp vec4 vcolor; void main(void) { gl_position = uprojectionmatrix * umodelviewmatrix * avertexposition; vcolor = avertexcolor; } `; the key difference here is that for each vertex, we pass its color using a varying to the fragment shader.
... coloring the fragments as a refresher, here's what our fragment shader looked like previously: const fssource = ` void main() { gl_fragcolor = vec4(1.0, 1.0, 1.0, 1.0); } `; in order to pick up the interpolated color for each pixel, we need to change this to fetch the value from the vcolor varying: const fssource = ` varying lowp vec4 vcolor; void main(void) { gl_fragcolor = vcolor; } `; each fragment receives the interpolated color based on its position relative to the vertex positions instead of a fixed value.
... then, drawscene() can have the following added to it so it actually uses these colors when drawing the square: // tell webgl how to pull out the colors from the color buffer // into the vertexcolor attribute.
Using textures in WebGL - Web APIs
note: it's important to note that the loading of textures follows cross-domain rules; that is, you can only load textures from sites for which your content has cors approval.
... see cross-domain textures below for details.
...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.
Taking still photos with WebRTC - Web APIs
listen for the video to start playing after calling htmlmediaelement.play() on the <video>, there's a (hopefully brief) period of time that elapses before the stream of video begins to flow.
... handle clicks on the button to capture a still photo each time the user clicks the startbutton, we need to add an event listener to the button, to be called when the click event is issued: startbutton.addeventlistener('click', function(ev){ takepicture(); ev.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.
...when the promise is fulfilled with an array of mediadeviceinfo objects describing the available devices, find the ones that you want to allow and specify the corresponding deviceid or deviceids in the mediatrackconstraints object passed into getusermedia().
Using DTMF with WebRTC - Web APIs
these will be initialized when the call starts up, in our connectanddial() function, as shown in starting the connection process below.
...see initialization below.
...as previously mentioned, our example is simplified somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required calls together for both the caller and receiver, as shown below.
...the handlereceivertrackevent() and handlereceiveraddstreamevent() methods, shown below, handle these.
Using WebRTC data channels - Web APIs
see security below for more information.
... automatic negotiation often, you can allow the peer connection to handle negotiating the rtcdatachannel connection for you.
...while there's no way to control the size of the buffer, you can learn how much data is currently buffered, and you can choose to be notified by an event when the buffer starts to run low on queued data.
... <<<write more about using bufferedamount, bufferedamountlowthreshold, onbufferedamountlow, and bufferedamountlow here>>> ...
Writing a WebSocket server in C# - Web APIs
it allows usage of a namespace's classes without typing the full namespace every time.
...if it is 126, the following 2 bytes (16-bit unsigned integer) are the length.
... if it is 127, the following 8 bytes (64-bit unsigned integer) are the length.
...offset + i] ^ masks[i % 4]); string text = encoding.utf8.getstring(decoded); console.writeline("{0}", text); } else console.writeline("mask bit not set"); console.writeline(); } } } } client.html <!doctype html> <style> textarea { vertical-align: bottom; } #output { overflow: auto; } #output > p { overflow-wrap: break-word; } #output span { color: blue; } #output span.error { color: red; } </style> <h2>websocket test</h2> <textarea cols=60 rows=6></textarea> <button>send</button> <div id=output></div> <script> // http://www.websocket.org/echo.html var button = document.queryselector("button"), output = document.queryselector("#output"), ...
Using bounded reference spaces - Web APIs
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.
...this is demonstrated in the diagram below.
...by their very nature, bounded reference spaces have special hardware requirements, since they need to allow for the user to physically move around in space while their movements are tracked.
...you can create a session that supports a bounded-floor reference space if available by using code such as the following: async function onactivatexrbutton(event) { if (!xrsession) { navgator.xr.requestsession("immersive-vr"), { requiredfeatures: ["local-floor"], optionalfeatures: ["bounded-floor"] }).then((session) => { xrsession = session; startsessionanimation(); }); } } this function, called when the user clicks on a button to start the xr experience, works as usual...
WebXR permissions and security - Web APIs
once that check is passed, the request to enter immersive-vr mode is allowed if all of the following are true: the requestsession() call was issued by code executing within the handler for a user event, or the from the startup code for a user-launched web application.
... the user's intent to enter immersive vr mode is well understood; see user intent below for details.
... 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.
... implicit user intent (implicit user consent) is assumed if either of the following scenarios is the case: the user has interacted with the document in some way which has in turn caused your request to occur.
Window.openDialog() - Web APIs
WebAPIWindowopenDialog
if the features parameter is a zero-length string, or contains only one or more of the behavior features (chrome, dependent, dialog and modal) the chrome features are assumed "os' choice." that is, window creation code is not given specific instructions, but is instead allowed to select the chrome that best fits a dialog on that operating system.
... to access these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code.
... var retvals = { address: null, delivery: null }; opendialog("http://example.tld/zzz.xul", "dlg", "modal", "pizza", 6.98, retvals); if you set the properties of the retvals object in the dialog code as described below, you can now access them via the retvals array after the opendialog() call returns.
... inside the dialog code, you can set the properties as follows: var retvals = window.arguments[2]; retvals.address = enteredaddress; retvals.delivery = "immediate"; specification this is not part of any specification.
XRInputSourceArray - Web APIs
in addition to being able to access the input sources in the list using standard array notation (that is, with index numbers insize square brackets), methods are available to allow the use of iterators and the foreach() method is also available.
... properties the following properties are available on xrinputsourcearray objects.
... methods the following methods are available on xrinputsourcearray objects.
... in addition to these methods, you may use array notation to access items in the list by index for example, the snippet of code below calls a function handleinput(), passing into it the first item in the input source list, if the list isn't empty.
XRSession.requestAnimationFrame() - Web APIs
the specified callback is executed once before the next repaint; if you wish for it to be executed for the following repaint, you must call requestanimationframe() again.
... syntax requestid = xrsession.requestanimationframe(animationframecallback); parameters animationframecallback a function which is called before the next repaint in order to allow you to update and render the xr scene based on elapsed time, animation, user input changes, and so forth.
... example the following example requests xrsession with "inline" mode so that it can be displayed in an html element (without the need for a separate ar or vr device).
... } }) }) the following example was taken directly from the spec draft.
XRSession.requestReferenceSpace() - Web APIs
the "interface" column in the table below indicates which of the two types is returned for each reference space type constant..
... reference space descriptors the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point.
... exceptions rather than throwing true exceptions, requestreferencespace() rejects the returned promise with a domexception whose name is found in the list below: notsupportederror the requested reference space is not supported.
XRSession: selectend event - Web APIs
examples the following example uses addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select.
... this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onselectionevent() function below dispatch the action out to a specialized function to handle things.
XRSession: selectstart event - Web APIs
examples the following example uses addeventlistener() to establish handlers for the selection events: selectstart, selectend, and select.
... this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onselectionevent() function below dispatch the action out to a specialized function to handle things.
XRSession: squeezeend event - Web APIs
examples the following example uses addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze.
... this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onsqueezeevent() function below dispatch the action out to a specialized function to handle things.
XRSession: squeezestart event - Web APIs
examples the following example uses addeventlistener() to establish handlers for the squeezeion events: squeezestart, squeezeend, and squeeze.
... this snippet is the core of an event handler to allow the user to grab objects in the scene and move them around.
... in this case, a single function is used to handle all three events, allowing them to share certain code that's the same regardless of which of the three events is received.
... only after completing those tasks does the onsqueezeevent() function below dispatch the action out to a specialized function to handle things.
XRSession.updateRenderState() - Web APIs
the specified object may have any combination of the following fields.
... exceptions this method may throw any of the following exceptions.
... invalidstateerror this may occur for one of the following reasons: the xrsession has already ended, so you cannot change its render state.
... the inlineverticalfieldofview property was set, but the session is immersive and therefore does not allow this property to be used.
Using the group role - Accessibility
possible effects on user agents and assistive technology when the group role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a group role in the operating system's accessibility api.
...following this the focused control may be announced.
... examples example 1: using the group role with a html tree view the snippet below shows how the group role is added directly into the html source code.
...if" /> <span role="treeitem" tabindex="0">cats</span> </div> <div id="catgroup" role="group"> <div id="siamese" role="treeitem"> <span tabindex="-1">siamese</span> </div> <div id="tabby" role="treeitem"> <span tabindex="-1">tabby</span> </div> </div> </div> </div> example 2: using the group role with a html drop-down menu the snippet below shows how the group role is added directly into the html source code.
ARIA: feed role - Accessibility
implementing the feed pattern allows a screen reader to reliably read and trigger the loading of feed content while in reading mode.
...see keyboard interactions below.
... the feed pattern enables reliable assistive technology reading mode interaction by establishing the following interoperability agreement between the web page and assistive technologies: in the context of a feed, the web page code is responsible for: appropriate visual scrolling of the content based on which article contains dom focus.
... keyboard interaction supporting the following, or a similar, interface is recommended when focus is inside the feed: page down: move focus to next article.
ARIA: Main role - Accessibility
skip navigation skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.).
... this allows the user to access the main content of the page faster.
... adding an id attribute to the element with a declaration of role="main" allows it to be a target of a skip navigation link.
... <body> <a href="#main-content">skip to main content</a> <!-- navigation and header content --> <div id="main-content" role="main"> <!-- main page content --> </div> </body> webaim: "skip navigation" links added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: dialog role - Accessibility
additionally, the following needs to be done: the dialog must be properly labeled keyboard focus must be managed correctly the sections below describe how these two requirements can be met.
...this approach is shown in the code snippet below: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> keep in mind that a dialog's title and description text do not have to be focusable in order to be perceived b...
...note that for non-modal dialogs there will have to be a global keyboard shortcut that allows focus to be moved between opened dialogs and the main page.
... possible effects on user agents and assistive technology when the dialog role is used, the user agent should do the following: expose the element as a dialog in the operating system's accessibility api.
ARIA: listbox role - Accessibility
if an option or item is focused within the list, it gets announced next, followed by an indication of the item's position with the list if the screen reader supports this.
... required javascript features selecting an option in a single select listbox when the user selects an option, the following must occur: deselect the previously selected option, setting the aria-selected to false, or removing the attribute altogether, changing the appearance of the newly unselected option to appear not selected.
... update the aria-activedescendant value on the listbox to the id of the newly selected option visually handle the blur, focus, and selected states of the option toggling the state of an option in a multi select listbox when the user clicks on an option, hits space when focused on an option, or otherwise toggles the state of an option, the following must occur: toggle the aria-selected state of the currently focused option, changing the state of the aria-selected to true if it was false or false if it was true.
... examples example 1: a single select listbox that uses aria-activedescendant the snippet below shows how the listbox role is added directly into the html source code.
Basic form hints - Accessibility
the example below shows a simple form with labels.
... the example below shows a radio button group implemented using an unordered list.
... the example below shows a <button> element that is described by a sentence in a separate <div> element.
... the example below shows a simple form with three fields.
Alerts - Accessibility
this notifies the user of the error, but allows for them continue modifying the form without losing focus (caused by the “onblur” handler in javascript's default ‘alert’ function).
... below is example javascript code which could be inserted above the closing “head” tag: <script type="application/javascript"> function removeoldalert() { var oldalert = document.getelementbyid("alert"); if (oldalert){ document.body.removechild(oldalert); } } function addalert(amsg) { removeoldalert(); var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var msg = document.createtextnode(amsg); newalert.appendchild(msg); document.body.appendchild(newalert); } function checkvalidity(aid, asearchterm, amsg) { var elem = document.getelementbyid(aid); var invalid = (elem.value.indexof(asearchterm) < 0); if (invalid) { elem.setattribute("aria-invalid", "true"); ...
...the two inputs for e-mail and name for this: <input name="name" id="name" aria-required="true" onblur="checkvalidity('name', ' ', 'invalid name entered!');"/> <br /> <input name="email" id="email" aria-required="true" onblur="checkvalidity('email', '@', 'invalid e-mail address');"/> testing the example if you use firefox 3 and a currently-supported screen reader, try the following: enter only your first name as the name.
...because this is not allowed by the windows api specs, and possibly others.
Keyboard-navigable JavaScript widgets - Accessibility
the following table describes tabindex behavior in modern browsers: tabindex attribute focusable with mouse or javascript via element.focus() tab navigable not present follows the platform convention of the element (yes for form controls, links, etc.).
... follows the platform convention of the element.
...(for a full description of the keyboard support that is normally expected for typical widgets, see the wai-aria authoring practices.) the example below shows this technique used with a nested menu control.
...for techniques for managing focus within widgets, see "managing focus inside groups" below.
-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.
... 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.
...the css overflow module level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues.
...</p> css p { width: 300px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; } result specifications specification status comment css overflow module level 3the definition of '-webkit-line-clamp' in that specification.
:placeholder-shown - CSS: Cascading Style Sheets
html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way.
... you can use the text-overflow property to alter the way overflowing text is displayed.
... html <input id="input1" placeholder="name, rank, and serial number"> <br><br> <input id="input2" placeholder="name, rank, and serial number"> css #input2:placeholder-shown { text-overflow: ellipsis; } result customized input field the following example highlights the branch and id code fields with a custom style.
.../label> <input id="branch" placeholder="student branch"/> </p> <p> <label for="sid">enter student id:</label> <input type="number" pattern="[0-9]{8}" title="8 digit id" id="sid" class="studentid" placeholder="8 digit id"/> </p> <input type="submit"/> </form> css input { background-color: #e8e8e8; color: black; } input.studentid:placeholder-shown { background-color: yellow; color: red; font-style: italic; } result specifications specification status comment selectors level 4the definition of ':placeholder-shown' in that specification.
font-style - CSS: Cascading Style Sheets
the font-style css descriptor allows authors to specify font styles for the fonts specified in the @font-face rule.
... oblique with angle range selects a font classified as oblique, and additionally specifies a range of allowable angle for the slant of the text.
... note that a range is only supported when the font-style is oblique; for font-style: normal or italic, no second value is allowed.
... formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax normal | italic | oblique <angle>{0,2} examples specifying an italic font style as an example, consider the garamond font family, in its normal form, we get the following result: @font-face { font-family: garamond; src: url('garamond.ttf'); } the italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.
@font-face - CSS: Cascading Style Sheets
font-feature-settings allows control over advanced typographic features in opentype fonts.
... font-variation-settings allows low-level control over opentype or truetype font variations, by specifying the four letter axis names of the features to vary, along with their variation values.
... by allowing authors to provide their own fonts, @font-face makes it possible to design content without being limited to the so-called "web-safe" fonts (that is, the fonts which are so common that they're considered to be universally available).
...for example, the following will not work: .classname { @font-face { font-family: myhelvetica; src: local("helvetica neue bold"), local("helveticaneue-bold"), url(mgopenmodernabold.ttf); font-weight: bold; } } formal syntax @font-face { [ font-family: <family-name>; ] | [ src: <src>; ] | [ unicode-range: <unicode-range>; ] | [ font-variant: <font-variant>; ] | [ font-fea...
prefers-contrast - CSS: Cascading Style Sheets
the prefers-contrast css media feature is used to detect if the user has requested that the web content is presented with a higher (or lower) contrast.
... less indicates that user has notified the system that they prefer an interface that has a lower level of contrast.
... 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.
Border-radius generator - CSS: Cascading Style Sheets
roup:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* for ie 6/7 (trigger haslayout) */ } /* grid column setup * ========================================================================== */ .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-si...
...zing: 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; cursor: pointer; background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; 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:hov...
...ainer { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /******************************************************************************/ /******************************************************************************/ /* * preview area */ #preview { height: 500px; border: 1px solid #ccc; border-radius: 3px; text-align: center; overflow: hidden; position: relative; } #preview .content { width: 100%; height: 100%; display: block; } #preview input { color: #333; border: 1px solid #ccc; border-radius: 3px; } #subject { width: 400px; height: 150px; margin: 0 auto; border: 3px solid #c60; background: #fff; position: relative; } .radius { width: 50%; height: 50%; border: 1px solid #ccc; display: none; position: a...
...gin: 30px 30px 0 0; padding: 30px; border: 3px solid #555; border-radius: 10px; position: relative; float: right; } #unit-selection .info { height: 20%; width: 100%; line-height: 20%; font-size: 20px; text-align: center; position: relative; top: 40%; } #unit-selection .dropdown { width: 50px; height: 20px; margin: 10px; padding: 0; border-radius: 3px; position: absolute; overflow: hidden; } #unit-selection select { width: 50px; height: 20px; marign: 0; padding: 0 0 0 10px; background: #555; border: 1px solid #555; border: none; color: #fff; float: left; } #unit-selection select option { background: #fff; color: #333; } #unit-selection select:hover { cursor: pointer; } #unit-selection .dropdown:before { content: ""; width: 18px; height: 20px; display: b...
Resizing background images with background-size - CSS: Cascading Style Sheets
try resizing the example below to see this in action.
... html <div class="bgsizecontain"> <p>try resizing this element!</p> </div> css .bgsizecontain { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: contain; width: 160px; height: 160px; border: 2px solid; color: pink; resize: both; overflow: scroll; } result cover the cover value specifies that the background image should be sized so that it is as small as possible while ensuring that both dimensions are greater than or equal to the corresponding size of the container.
... try resizing the example below to see this in action.
... html <div class="bgsizecover"> <p>try resizing this element!</p> </div> css .bgsizecover { background-image: url(https://www.mozilla.org/media/img/logos/firefox/logo-quantum.9c5e96634f92.png); background-size: cover; width: 160px; height: 160px; border: 2px solid; color: pink; resize: both; overflow: scroll; } result see also background-size background scaling of svg backgrounds ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
this allows specifying arbitrary images as mouse cursors — any image format supported by gecko can be used.
... syntax the basic (css 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> this means that zero or more urls may be specified (comma-separated), which must be followed by one of the keywords defined in the css specification, such as auto or pointer.
... for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur.
..., ]* <keyword> it allows specifying the coordinates of the cursor's hotspot, which will be clamped to the boundaries of the cursor image.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
the ad panel is below the sidebar, so starts at grid row line 4.
... i can cause a grid to backfill those gaps by setting grid-auto-flow: dense on the grid container.
...you should only do this if your items do not have a set order – and be aware of the issues of the tab order following the source and not your reordered display.
...; margin: 0; padding: 20px; } .listing li { border: 1px solid #ffe066; border-radius: 5px; display: flex; flex-direction: column; } .listing .cta { margin-top: auto; border-top: 1px solid #ffe066; padding: 10px; text-align: center; } .listing .body { padding: 10px; } .listing { list-style: none; margin: 2em; display: grid; grid-gap: 20px; grid-auto-flow: dense; grid-template-columns: repeat(auto-fill,minmax(200px, 1fr)); } .listing .wide { grid-column-end: span 2; } this technique of using auto-placement with some rules applied to certain items is very useful, and can help you to deal with content that is being output by a cms for example, where you have repeated items and can perhaps add a class to certain ones as they are rendered into...
CSS Logical Properties and Values - CSS: Cascading Style Sheets
inline logical properties and values use the abstract terms block and inline to describe the direction in which they flow.
... 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.
... 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.
...g-block-start padding-inline padding-inline-end padding-inline-start properties for floating and positioning clear (inline-end and inline-start keywords) float (inline-end and inline-start keywords) inset inset-block inset-block-end inset-block-start inset-inline inset-inline-end inset-inline-start other properties caption-side (inline-end and inline-start keywords) overflow-block overflow-inline overscroll-behavior-block overscroll-behavior-inline resize (block and inline keywords) text-align (end and start keywords) deprecated properties offset-block-end (now inset-block-end ) offset-block-start (now inset-block-start ) offset-inline-end (now inset-inline-end ) offset-inline-start (now inset-inline-start ) guides basic conce...
Shapes From Images - CSS: Cascading Style Sheets
in the example below i am using a similar image to the initial example, however in this image the background of the star is not fully transparent, it has a 20% opacity as created in my graphics programme.
...many demos do this as it helps to show the shape we are following, however the shape-outside property is not related to the image that is displayed on the page and so you do not need to display an image to use an image to create a shape.
... you do need something to float, but that could be some generated content as in the below example.
...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.
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
also, this method of switching animation off according to the user's preference can also benefit users with low battery or low-end phones or computers.
... this will help not only users with low vision and contrast sensitivity issues but also users that are working on a computer or phone with direct sunlight.
... syntax the -ms-high-contrast media feature is specified as one of the following values.
... example the following declarations will match applications that are being displayed in high contrast mode with any color variation, a black-on-white color variation, and a white-on-black color variation, respectively.
Privacy and the :visited selector - CSS: Cascading Style Sheets
before about 2010, the css :visited selector allowed websites to uncover a user's browsing history and figure out what sites the user had visited.
...only the following styles can be applied to visited links: color background-color border-color (and its sub-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 keywor...
...*/ } :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 background images to style links based on whether they've been visited will no longer work, since only colors can be used to style visited links.
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
textfield div { color: black; -moz-appearance: textfield; -webkit-appearance: textfield; } <div>lorem</div> firefox chrome safari edge the following values are treated as equivalent to auto: button div { color: black; -moz-appearance: button; -webkit-appearance: button; } <div>lorem</div> firefox chrome safari edge the element is drawn like a button.
... chrome safari edge square-button div{ color: black; -moz-appearance: square-button; -webkit-appearance: square-button; } <div>lorem</div> chrome safari edge textarea div{ color: black; -webkit-appearance: textarea; } <div>lorem</div> firefox chrome safari edge non-standard keywords the following values are implemented only for one or both of the prefixed properties, but not on the standard appearance property.
...available on the web starting in ios 10.1 and macos 10.12.1 obsolete values the following values were at some point implemented for a prefixed property, but are no longer supported.
... formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | auto | button | textfield | menulist-button | <compat-auto>where <compat-auto> = searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar examples the following would make an element look like a menulist button: .exampleone { appearance: menulist-button; } see also this jsfiddle for an example showing how you might use appearance: none to apply custom styling to radio buttons and checkboxes.
border-style - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-bottom-style border-left-style border-right-style border-top-style syntax /* keyword values */ border-style: none; border-style: hidden; border-style: dotted; border-style: dashed; border-style: solid; border-style: double; border-style: groove; border-style: ridge; border-style: inset; border-style: outset; /* vertical | horizontal */ border-style: dotted solid; ...
... each value is a keyword chosen from the list below.
...it can have the following values: none like the hidden keyword, displays no border.
...in the case of table cell and border collapsing, the none value has the lowest priority: if any other conflicting border is set, it will be displayed.
box-shadow - CSS: Cascading Style Sheets
box-shadow generator is an interactive tool allowing you to generate a box-shadow.
...inset shadows are drawn inside the border (even transparent ones), above the background, but below content.
...negative values are not allowed.
...the specification does not include an exact algorithm for how the blur radius should be calculated, however, it does elaborate as follows: …for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow’s edge, and that ranges from the full shadow color at the radius endpoint inside the shadow to fully transparent at the endpoint outside it.
box-sizing - CSS: Cascading Style Sheets
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.
... on the other hand, when using position: relative or position: absolute, use of box-sizing: content-box allows the positioning values to be relative to the content, and independent of changes to border and padding sizes, which is sometimes desirable.
... syntax the box-sizing property is specified as a single keyword chosen from the list of values below.
... html <div class="content-box">content box</div> <br> <div class="border-box">border box</div> css div { width: 160px; height: 80px; padding: 20px; border: 8px solid red; background: yellow; } .content-box { box-sizing: content-box; /* total width: 160px + (2 * 20px) + (2 * 8px) = 216px total height: 80px + (2 * 20px) + (2 * 8px) = 136px content box width: 160px content box height: 80px */ } .border-box { box-sizing: border-box; /* total width: 160px total height: 80px content box width: 160px - (2 * 20px) - (2 * 8px) = 104px content box heigh...
caption-side - CSS: Cascading Style Sheets
syntax /* directional values */ caption-side: top; caption-side: bottom; /* warning: non-standard values */ caption-side: left; caption-side: right; caption-side: top-outside; caption-side: bottom-outside; /* global values */ caption-side: inherit; caption-side: initial; caption-side: unset; the caption-side property is specified as one of the keyword values listed below.
... bottom the caption box should be positioned below the table.
... bottom-outside the caption box should be positioned below the table, while the width and horizontal alignment behavior are not bound to the table's horizontal layout.
... formal definition initial valuetopapplies totable-caption elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax top | bottom | block-start | block-end | inline-start | inline-end examples setting captions above and below html <table class="top"> <caption>caption above the table</caption> <tr> <td>some data</td> <td>some more data</td> </tr> </table> <br> <table class="bottom"> <caption>caption below the table</caption> <tr> <td>some data</td> <td>some more data</td> </tr> </table> css .top caption { caption-side: top; } .bottom caption { caption-side: bottom; } table { b...
clear - CSS: Cascading Style Sheets
WebCSSclear
the clear css property sets whether an element must be moved below (cleared) floating elements that precede it.
... when applied to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats.
...when applied to floating elements, the margin edge of the bottom element is moved below the margin edge of all relevant floats.
... 1chrome android full support 18firefox android full support 4opera android full support 10.1safari ios full support 1samsung internet android full support 1.0flow-relative values inline-start and inline-endchrome no support noedge no support nofirefox full support 55ie no support noopera no support nosafari no support ...
clip-path - CSS: Cascading Style Sheets
WebCSSclip-path
0% 0%, 100% 50%, 50% 100%, 0% 50%); clip-path: path('m0.5,1 c0.5,1,0,0.7,0,0.3 a0.25,0.25,1,1,1,0.5,0.3 a0.25,0.25,1,1,1,1,0.3 c1,0.7,0.5,1,0.5,1 z'); /* box and shape values combined */ clip-path: padding-box circle(50px at 0 100px); /* global values */ clip-path: inherit; clip-path: initial; clip-path: unset; the clip-path property is specified as one or a combination of the values listed below.
...the geometry box can be one of the following values: margin-box uses the margin box as the reference box.
... viewbox"> <svg viewbox="0 0 192 192"> <g class="none"> <rect x="24" y="24" width="144" height="144" /> <text x="96" y="91">i love</text> <text x="96" y="109" class="em">clipping</text> </g> </svg> </div> </div> </div> <div class="note">clip-path: url(#mypath)<br><br> assuming the following clippath definition: <pre> &lt;svg&gt; &lt;clippath id="mypath" clippathunits="objectboundingbox"&gt; &lt;path d="m0.5,1 c 0.5,1,0,0.7,0,0.3 a 0.25,0.25,1,1,1,0.5,0.3 a 0.25,0.25,1,1,1,1,0.3 c 1,0.7,0.5,1,0.5,1 z" /&gt; &lt;/clippath&gt; &lt;/svg&gt;</pre> </div> <div class="row"> <div class="cell"> <span>html</span> <div class="conta...
... </div> </div> </div> </div> </div> html,body { height: 100%; box-sizing: border-box; background: #eee; } .grid { width: 100%; height: 100%; display: flex; font: 1em monospace; } .row { display: flex; flex: 1 auto; 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: ...
cross-fade() - CSS: Cascading Style Sheets
the two following are lines (almost) identical: cross-fade( url(red.png), url(yellow.png), url(blue.png)); /* all three will be 33.3333% opaque */ cross-fade( url(red.png) 33.33%, url(yellow.png) 33.33%, url(blue.png) 33.33%); older, implemented syntax cross-fade( <image, <image>, <percentage> ) the specification for the cross-fade() function allows for multiple images and for each image to have transparenc...
...the original syntax, which has been implemented in some browsers, only allowed for two images, with the sum of the transparency of those two images being exactly 100%.
.../* fully black */ cross-fade(url(white.png), url(black.png), 25%); /* 25% white, 75% black */ cross-fade(url(white.png), url(black.png), 50%); /* 50% white, 50% black */ cross-fade(url(white.png), url(black.png), 75%); /* 75% white, 25% black */ cross-fade(url(white.png), url(black.png), 100%); /* fully white */ in the implemented syntax, the two comma-separated images are declared first, followed by a comma and required percent value.
... the green/red example (with the percentages totalling 150%) and the yellow/red/blue example (with three images) from the specification syntax section, are not possible in this implementation.
flex-wrap - CSS: Cascading Style Sheets
WebCSSflex-wrap
if wrapping is allowed, it sets the direction that lines are stacked.
... 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.
..."> <div class="red">1</div> <div class="green">2</div> <div class="blue">3</div> </div> css /* common styles */ .content, .content1, .content2 { color: #fff; font: 100 24px/100px sans-serif; height: 150px; text-align: center; } .content div, .content1 div, .content2 div { height: 50%; width: 300px; } .red { background: orangered; } .green { background: yellowgreen; } .blue { background: steelblue; } /* flexbox styles */ .content { display: flex; flex-wrap: wrap; } .content1 { display: flex; flex-wrap: nowrap; } .content2 { display: flex; flex-wrap: wrap-reverse; } results specifications specification status comment css flexible box layout modulethe definition of 'flex-wrap' in that speci...
font-family - CSS: Cascading Style Sheets
the font-family property specifies a list of fonts, from highest priority to lowest.
... the example below lists two font families, the first with a <family-name> and the second with a <generic-name>: font-family: gill sans extrabold, sans-serif; values <family-name> the name of a font family.
...the following keywords are defined: serif glyphs have finishing strokes, flared or tapering ends, or have actual serifed endings.
... for example, the following declarations are valid: font-family: gill sans extrabold, sans-serif; font-family: "goudy bookletter 1911", sans-serif; the following declarations are invalid: font-family: goudy bookletter 1911, sans-serif; font-family: red/black, sans-serif; font-family: "lucida" grande, sans-serif; font-family: ahem!, sans-serif; font-family: test@foo, sans-serif; font-family: #pound, sans-serif; font-fa...
font-style - CSS: Cascading Style Sheets
syntax font-style: normal; font-style: italic; font-style: oblique; font-style: oblique 10deg; /* global values */ font-style: inherit; font-style: initial; font-style: unset; the font-style property is specified as a single keyword chosen from the list of values below, which can optionally include an angle if the keyword is oblique.
... for the example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-style: oblique can accept an <angle>.
... html <header> <input type="range" id="slant" name="slant" min="-90" max="90" /> <label for="slant">slant</label> </header> <div class="container"> <p class="sample">...it would not be wonderful to meet a megalosaurus, forty feet long or so, waddling like an elephantine lizard up holborn hill.</p> </div> css /* amstelvaralpha-vf is created by david berlow (https://github.com/typenetwork/amstelvar) and is used here under the terms of its license: https://github.com/typenetwork/amstelvar/blob/master/ofl.txt */ @font-face { src: url('https://mdn.mozillademos.org/files/16044/amstelvaralpha-vf.ttf'); font-family:'amstelvaralpha'; font-style: normal; } label { font: 1rem monospace; } .container { max-height: 150px; overflow: scroll; } .sample { font: 2rem 'amst...
...elvaralpha', sans-serif; } html, body { max-height: 100vh; max-width: 100vw; overflow: hidden; } body { display: flex; flex-direction: column; } header { margin-bottom: 1.5rem; } .container { flex-grow: 1; } .container > p { margin-top: 0; margin-bottom: 0; } javascript let slantlabel = document.queryselector('label[for="slant"]'); let slantinput = document.queryselector('#slant'); let sampletext = document.queryselector('.sample'); function update() { 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 w...
font - CSS: Cascading Style Sheets
WebCSSfont
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.
... line-height must immediately follow font-size, preceded by "/", like this: "16px/3" font-family must be the last value specified.
...*/ p { font: bold italic large serif } /* use the same font as the status bar of the window */ p { font: status-bar } live sample html <p> change the radio buttons below to see the generated shorthand and it's effect.
...</div> <br/><br/><br/><br/><br/><br/> css body, input { font: 14px arial; overflow: hidden; } .propinputcont { float: left; text-align: center; margin-right: 5px; width: 80px; } .setpropcont { float: left; margin-right: 5px; width: 120px; } .propinputs, .setpropcont { margin-bottom: 1em; } .curcss { border: none; border-bottom: 1px solid black; text-align: center; width: 80px; } .mandatory { border-bottom-color: red; } .cf:before, .cf:after { c...
<frequency-percentage> - CSS: Cascading Style Sheets
description use in calc() where a <frequency-percentage> is specified as an allowable type, this means that the percentage resolves to a frequency and therefore can be used in a calc() expression.
... examples valid percentage values 90% positive percentage +90% positive percentage with leading + -90% negative percentage — not valid for all properties that use percentages invalid percentage values 90 % no space is allowed between the number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended.
...7 hz no space is allowed between the number and the unit.
... 0 although unitless zero is an allowable <length>, it's an invalid <frequency>.
grid-template - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: grid-template-areas grid-template-columns grid-template-rows syntax /* keyword value */ grid-template: none; /* grid-template-rows / grid-template-columns values */ grid-template: 100px 1fr / 50px 1fr; grid-template: auto 1fr / auto 1fr auto; grid-template: [linename] 100px / [columnname1] 30% [columnname2] 70%; grid-template: fit-content(100px) / fit-content(40%); /* ...
... 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).
... note: the repeat() function isn’t allowed in these track listings, as the tracks are intended to visually line up one-to-one with the rows/columns in the “ascii art”.
...d; width: 100%; height: 200px; grid-template: [header-left] "head head" 30px [header-right] [main-left] "nav main" 1fr [main-right] [footer-left] "nav foot" 30px [footer-right] / 120px 1fr; } header { background-color: lime; grid-area: head; } nav { background-color: lightblue; grid-area: nav; } main { background-color: yellow; grid-area: main; } footer { background-color: red; grid-area: foot; } html <section id="page"> <header>header</header> <nav>navigation</nav> <main>main area</main> <footer>footer</footer> </section> result specifications specification status comment css grid layoutthe definition of 'grid-template' in that specification.
justify-self - CSS: Cascading Style Sheets
*/ justify-self: self-start; justify-self: self-end; justify-self: left; /* pack item from the left */ justify-self: right; /* pack item from the right */ /* baseline alignment */ justify-self: baseline; justify-self: first baseline; justify-self: last baseline; /* overflow alignment (for positional alignment only) */ justify-self: safe center; justify-self: unsafe center; /* global values */ justify-self: inherit; justify-self: initial; justify-self: unset; this property can take one of three different forms: basic keywords: one of the keyword values normal, auto, or stretch.
... safe if the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start.
... formal definition initial valueautoapplies toblock-level boxes, absolutely-positioned boxes, and grid itemsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | normal | stretch | <baseline-position> | <overflow-position>?
...baseline<overflow-position> = unsafe | safe<self-position> = center | start | end | self-start | self-end | flex-start | flex-end examples simple demonstration in the following example we have a simple 2 x 2 grid layout.
<length-percentage> - CSS: Cascading Style Sheets
syntax refer to the documentation for <length> and <percentage> for details of the individual syntaxes allowed by this type.
... examples length-percentage examples the following simple example demonstrates several properties that use <length-percentage> values.
... /* 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 values are acceptable for width: width: 200px; width: 20%; width: calc(100% - 200px); specifications specification status comment css values and units module level 4the definition of '<length-percentage>' in that specification.
<number> - CSS: Cascading Style Sheets
WebCSSnumber
followed by one or more decimal digits, and may be appended to an integer.
... decimal points must be followed by at least one digit.
... +-12.2 only one leading +/- is allowed.
... 12.1.1 only one decimal point is allowed.
offset-path - CSS: Cascading Style Sheets
the offset-path css property specifies a motion path for an element to follow and defines the element's positioning within the parent container or svg coordinate system.
... description this property defines a path an animated element can follow.
... <svg xmlns="http://www.w3.org/2000/svg" width="700" height="450" viewbox="350 0 1400 900"> <title>house and scissors</title> <rect x="595" y="423" width="610" height="377" fill="blue" /> <polygon points="506,423 900,190 1294,423" fill="yellow" /> <polygon points="993,245 993,190 1086,190 1086,300" fill="red" /> <path id="house" d="m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190" fill="none" stroke="black" stroke-width="13" stroke-...
...oke-width="5" stroke-linejoin="round" stroke-linecap="round" fill-rule="evenodd" /> </svg> css .scissorhalf { offset-path: path('m900,190 l993,245 v201 a11,11 0 0,1 1004,190 h1075 a11,11 0 0,1 1086,201 v300 l1294,423 h1216 a11,11 0 0,0 1205,434 v789 a11,11 0 0,1 1194,800 h606 a11,11 0 0,1 595,789 v434 a11,11 0 0,0 584,423 h506 l900,190'); animation: followpath 4s linear infinite; } @keyframes followpath { to { motion-offset: 100%; offset-distance: 100%; } } result specifications <body> specification status comment motion path module level 1the definition of 'offset-path' in that specification.
place-self - CSS: Cascading Style Sheets
the place-self css shorthand property allows you to align an individual item in both the block and inline directions at once (i.e.
... constituent properties this property is a shorthand for the following css properties: align-self justify-self syntax /* keyword values */ place-self: auto center; place-self: normal start; /* positional alignment */ place-self: center normal; place-self: start auto; place-self: end normal; place-self: self-start auto; place-self: self-end normal; place-self: flex-start auto; place-self: flex-end normal; place-self: left auto; place-self: right normal; /...
...if the cross-size of the item is larger than the flex container, it will overflow equally in both directions.
... examples simple demonstration in the following example we have a simple 2 x 2 grid layout.
repeat() - CSS: Cascading Style Sheets
WebCSSrepeat
the repeat() css function represents a repeated fragment of the track list, allowing a large number of columns or rows that exhibit a recurring pattern to be written in a more compact form.
... auto-fill if the grid container has a definite or maximal size in the relevant axis, then the number of repetitions is the largest possible positive integer that does not cause the grid to overflow its grid container.
...if any number of repetitions would overflow, then the repetition is 1.
...an empty track is one with no in-flow grid items placed into or spanning across it.
scroll-behavior - CSS: Cascading Style Sheets
user agents are allowed to ignore this property.
... syntax /* keyword values */ scroll-behavior: auto; scroll-behavior: smooth; /* global values */ scroll-behavior: inherit; scroll-behavior: initial; scroll-behavior: unset; the scroll-behavior property is specified as one of the keyword values listed below.
...user agents should follow platform conventions, if any.
...age 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: center; height: 100%; font-size: 5em; } result specifications specification status comment css object model (cssom) view modulethe definition of 'scroll-behavior' in that specification.
table-layout - CSS: Cascading Style Sheets
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.
... html <table> <tr><td>ed</td><td>wood</td></tr> <tr><td>albert</td><td>schweitzer</td></tr> <tr><td>jane</td><td>fonda</td></tr> <tr><td>william</td><td>shakespeare</td></tr> </table> css table { table-layout: fixed; width: 120px; border: 1px solid red; } td { border: 1px solid blue; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } result specifications specification status comment css level 2 (revision 1)the definition of 'table-layout' in that specification.
<time> - CSS: Cascading Style Sheets
WebCSStime
syntax the <time> data type consists of a​ ​​​​​​<number> followed by one of the units listed below.
... note: conversion between s and ms follows the logical 1s = 1000ms.
...+0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s.
...7 ms no space is allowed between the number and the unit.
transition-delay - CSS: Cascading Style Sheets
ze 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 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; t...
...t-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-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; tran...
...t-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:2s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay: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 top color; -webkit-transition-duration:2s; -webkit-transition-delay:2s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; tran...
...t top color; -webkit-transition-duration:2s; -webkit-transition-delay:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:4s; transition-timing-function: ease-in-out; } .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:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top color; transition-duration:2s; ...
transition-duration - CSS: Cascading Style Sheets
:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:0.5s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); 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 transform -webkit-transform color; -webkit-transition-duration:0.5s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transformv color; t...
...it-transition-duration:1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform color; transition-duration:1s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); 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 -webkit-transform transform color; -webkit-transition-duration:1s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
...tion:2s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:2s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); 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 transform -webkit-transform color; -webkit-transition-duration:2s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
...tion:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; transition-duration:4s; transition-timing-function: ease-in-out; } .box1{ transform: rotate(270deg); -webkit-transform: rotate(270deg); 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 transform -webkit-transform color; -webkit-transition-duration:4s; -webkit-transition-timing-function: ease-in-out; transition-property: width height background-color font-size left top transform -webkit-transform color; tran...
white-space - CSS: Cascading Style Sheets
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.
... the following table summarizes the behavior of the various white-space values: new lines spaces and tabs text wrapping end-of-line spaces normal collapse collapse wrap remove nowrap collapse collapse no wrap remove pre preserve preserve no wrap preserve pre-wrap preserve preserve wrap hang ...
... excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </div> .box { width: 300px; padding: 16px; border-radius: 10px; } #css-code { background-color: rgb(220, 220, 220); font-size: 16px; font-family: monospace; } #css-code select { font-family: inherit; } #results { background-color: rgb(230, 230, 230); overflow-x: scroll; height: 400px; white-space: normal; font-size: 14px; } var select = document.queryselector("#css-code select"); var results = document.queryselector("#results p"); select.addeventlistener("change", function(e) { results.setattribute("style", "white-space: "+e.target.value); }) <p> lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut l...
will-change - CSS: Cascading Style Sheets
some of the stronger optimizations that are likely to be tied to will-change end up using a lot of a machine’s resources, and when overused like this can cause the page to slow down or consume a lot of resources.
... the <animateable-feature> can be one of the following values: scroll-position indicates that the author expects to animate or change the scroll position of the element in the near future.
...it cannot be one of the following values: unset, initial, inherit, will-change, auto, scroll-position, or contents.
...this will let browser prepare the transition ahead of time and allow for snappy transitions between the pages as soon as the key is pressed.
WAI ARIA Live Regions/API Support - Developer guides
le object about to go away) object shown or inserted children_changed::add (fired on the parent, with event data pointing to the child index of the inserted accessible object) event_object_show* (fired on the actual new accessible object) object replaced with different object (this happens especially if an object's interfaces or role changes) children_changed::remove followed immediately by children_change::add event_object_hide followed immediately by event_object_show text removed text_changed::delete ia2_event_text_removed (use iaccessibletext::get_oldtext to retrieve the offsets and removed text) text inserted text_changed::insert ia2_event_text_inserted (use iaccessibletext::get_newtext to retrieve the offsets and inserted text)...
... text replaced text_changed::delete followed immediately by text_changed::insert ia2_event_text_removed followed immediately by ia2_event_text_inserted * we do not use msaa's create/destroy at the request of screen reader vendors, who avoid those events because they cause crashes on some important system -- show/hide are the equivalent of those events.
... retrieving author-supplied aria live region semantics from an event for any mutation event in a page, the author can get the following object attributes from the event object, if they are defined on some ancestor element (closest ancestor wins): object attribute name possible values default value if not specified meaning aria markup if required container-live "off" | "polite" | "assertive" "off" interruption policy aria-live on ancestor element container-relevant "[additions] [removals] [text]" | "all" "additions text" what types of mutations are possibly relevant?
... aria-atomic on ancestor element event-from-input "true" | "false" (described more below) browser could not calculate this was the root cause of this event explicit user input?
Setting up adaptive streaming media sources - Developer guides
this article explains how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) choosing formats in terms of adaptive streaming formats, there are many to choose from; we decided to choose the following two as between them we can support most modern browsers.
... other reasons to use live profile over ondemand for vod content may be: your client or server does not support range requests your server cannot cache range requests efficiently your server cannot prefetch range requests efficiently the sidx* is large and having to load it first slows down startup a little you want to use the original files for both dash and other forms of delivery (such as microsoft smooth streaming) as a transition strategy you can use the same media files for both live transmission and vod at a later stage *sidx or segmentindexbox is a structure describing a segment by giving its earliest presentation time and other meta-data and can often make up a la...
... ondemand profile this profile will allow switching between streams 'on demand' - that is to say that you only need provide a set of contiguous files and specify the bandwidth for each one and the appropriate file will be chosen automatically.
...apple uses the .m3u8 format (an extension of its .m3u playlist format) for index files — see below for an example: #ext-x-version:3 #extm3u #ext-x-targetduration:10 #ext-x-media-sequence:1 # old-style integer duration; avoid for newer clients.
Making content editable - Developer guides
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.
... if you want to use a different paragraph separator, the above browsers all support document.execcommand, which provides a defaultparagraphseparator command to allow you to change it.
...you can enable them by setting the preferences shown below using about:config: user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.sites", "https://www.mozilla.org"); user_pref("capability.policy.allowclipboard.clipboard.cutcopy", "allaccess"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); example: a simple but complete rich text editor <!doctype html> <html> <head> <t...
...win.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body onload="initdoc();"> <form name="compform" method="post" action="sample.php" onsubmit="if(validatemode()){this.mydoc.value=odoc.innerhtml;return true;}return false;"> <input type="hidden" name="mydoc"> <div id="toolbar1"> <select oncha...
HTML5 Parser - Developer guides
WebGuideHTMLHTML5HTML5 Parser
calling document.write() during parsing prior to html5, gecko and webkit allowed calls to document.write() during parsing to insert content into the source stream.
...this change has the following consequences for web developers: if you omit the closing tag for <title>, <style>, <textarea>, or <xmp>, the page will fail to be parsed.
...(there are also some element whose end tags can be omitted in some cases, such as <p> in the example below, but it's simpler to always use end tags for those elements than to make sure that the end tags are only omitted when they aren't necessary.) for example, the following code writes a balanced sub-tree: <script> document.write("<div>"); document.write("<p>some content goes here.</p>"); document.write("</div>"); </script> <!-- non-script html goes here.
... --> in contrast, the following code contains two scripts with unbalanced sub-trees, which causes speculative parsing to fail and therefore the time to parse the document is longer.
A hybrid approach - Developer guides
this keeps the complexity of altering content on the server side, but still allows our layouts to benefit from the flexibility and future-readiness of responsive design.
... using user-agent detection specifically for content and not layout also allows you to have a single url for each piece of content, so that the content can adapt its layout to the user’s browser.
...web applications that want to heavily modify the content or user flow for mobile users should probably go for a separate mobile site.
... approaches to mobile web development see the following articles for background and other approaches to developing for mobile platforms.
Writing forward-compatible websites - Developer guides
it's not always possible to follow all of these, but following as many of them as possible will help future-proof your website.
... 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 you are following the advice given above so that you have a single code path for all current and unknown browsers, testing that this single code path works in all the major engines makes it extremely probable that your code won't break in the future.
...missing those can lead to unexpected situations due to a following tag name being treated as an attribute on a previous tag.
HTML attribute: max - HTML: Hypertext Markup Language
WebHTMLAttributesmax
if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will prevent form submission.
... if the value exceeds the max value allowed, the validitystate.rangeoverflow will be true, and the the control will be matched by the :out-of-range and :invalid pseudo-classes.
... number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information.
... syntax for max values for other elements input type syntax example <progress> <number> <progress id="file" max="100" value="70"> 70% </progress> <meter> <number> <meter id="fuel" min="0" max="100" low="33" high="66" optimum="80" value="40"> at 40/100</meter> ...
Block-level elements - HTML: Hypertext Markup Language
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.
...while the "inline" category roughly corresponds to the category of phrasing content, the "block-level" category doesn't directly correspond to any html5 content category, but "block-level" and "inline" elements combined together correspond to the flow content in html5.
... elements the following is a complete list of all html "block-level" elements (although "block-level" is not technically defined for elements that are new in html5).
... see also inline elements display block and inline layout in normal flow ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
WebHTMLElementapplet
content categories flow content, phrasing content, embedded content, interactive content, palpable 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.
... mayscript in the netscape implementation, this attribute allows access to an applet by programs in a scripting language embedded in the document.
... vspace this attribute specifies additional vertical space, in pixels, to be reserved above and below the applet.
<area> - HTML: Hypertext Markup Language
WebHTMLElementarea
content categories flow content, phrasing content.
...allowed values are determined by bcp47.
... ping contains a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
... the following keywords have special meanings: _self (default): show the resource in the current browsing context.
<aside>: The Aside element - HTML: Hypertext Markup Language
WebHTMLElementaside
content categories flow content, sectioning content, palpable content.
... permitted content flow content.
... permitted parents any element that accepts flow content.
... usage notes do not use the <aside> element to tag parenthesized text, as this kind of text is considered part of the main flow.
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
content categories flow content, sectioning root, palpable content.
... permitted content flow content.
... permitted parents any element that accepts flow content.
... <blockquote cite="https://tools.ietf.org/html/rfc1149"> <p>avian carriers can provide high delay, low throughput, and low altitude service.
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
WebHTMLElementcanvas
content categories flow content, phrasing content, embedded content, palpable content.
...the following is some data we've collected from various tests and other sources (e.g.
... stack overflow): browser maximum height maximum width maximum area chrome 32,767 pixels 32,767 pixels 268,435,456 pixels (i.e., 16,384 x 16,384) firefox 32,767 pixels 32,767 pixels 472,907,776 pixels (i.e., 22,528 x 20,992) safari 32,767 pixels 32,767 pixels 268,435,456 pixels (i.e., 16,384 x 16,384) ie 8,192 pixels 8,192 pixels ?
...the following guides can help to make it more accessible.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
WebHTMLElementdetails
this might look like the following: here we see a standard disclosure widget with the label "system requirements", in its default closed state.
... content categories flow content, sectioning root, interactive content, palpable content.
... permitted content one <summary> element followed by flow content.
... permitted parents any element that accepts flow content.
<dl>: The Description List element - HTML: Hypertext Markup Language
WebHTMLElementdl
content categories flow content, and if the <dl> element's children include one name-value group, palpable content.
... permitted content either: zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements.
... permitted parents any element that accepts flow content.
... <dl> <dt>name</dt> <dd>godzilla</dd> <dt>born</dt> <dd>1952</dd> <dt>birthplace</dt> <dd>japan</dd> <dt>color</dt> <dd>green</dd> </dl> tip: it can be handy to define a key-value separator in the css, such as: dt::after { content: ": "; } wrapping name-value groups in <div> elements whatwg html allows wrapping each name-value group in a <dl> element in a <div> element.
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
WebHTMLElementfieldset
it takes few attributes, the most notable of which are form, which can contain the id of a <form> on the same page, allowing you to make the <fieldset> part of that <form> even if it is not nested inside it, and disabled, which allows you to disable the <fieldset> and all its contents in one go.
... <form action="#"> <fieldset disabled> <legend>disabled fieldset</legend> <div> <label for="name">name: </label> <input type="text" id="name" value="chris"> </div> <div> <label for="pwd">archetype: </label> <input type="password" id="pwd" value="wookie"> </div> </fieldset> </form> technical summary content categories flow content, sectioning root, listed, form-associated element, palpable content.
... permitted content an optional <legend> element, followed by flow content.
... permitted parents any element that accepts flow content.
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
WebHTMLElementfigure
content categories flow content, sectioning root, palpable content.
... permitted content a <figcaption> element, followed by flow content; or flow content followed by a <figcaption> element; or flow content.
... permitted parents any element that accepts flow content.
... 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.
<form> - HTML: Hypertext Markup Language
WebHTMLElementform
content categories flow content, palpable content permitted content flow content, but not containing <form> elements tag omission none, both the starting and ending tag are mandatory.
... permitted parents any element that accepts flow content implicit aria role form if the form has an accessible name, otherwise no corresponding role permitted aria roles search, none or presentation dom interface htmlformelement attributes this element includes the global attributes.
... attributes for form submission the following attributes control behavior during form submission.
...the following keywords have special meanings: _self (default): load into the same browsing context as the current one.
<header> - HTML: Hypertext Markup Language
WebHTMLElementheader
content categories flow content, palpable content.
... permitted content flow content, but with no <header> or <footer> descendant.
... permitted parents any element that accepts flow content.
...this allowed <header> to be free to fill a different role later on.
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
WebHTMLElementkbd
content categories flow content, phrasing content, palpable content.
...see representing keystrokes within an input below.
...see echoed input, below, for an example.
...see the example under representing onscreen input options below.
<keygen> - HTML: Hypertext Markup Language
WebHTMLElementkeygen
content categories flow content, phrasing content, interactive content, listed, labelable, submittable, resettable form-associated element, palpable content.
... the element is written as follows: <keygen name="name" challenge="challenge string" keytype="type" keyparams="pqg-params"> the keytype parameter is used to specify what type of key is to be generated.
...the user may be given a choice of dsa key sizes, allowing the user to choose one of the sizes defined in the dsa standard.
...(note that only a subset of the curves named there may actually be supported in any particular browser.) if the keyparams parameter string is not a recognized curve name string, then a curve is chosen according to the user's chosen key strength (low, medium, high), using the curve named "secp384r1" for high, and the curve named "secp256r1" for medium keys.
<main> - HTML: Hypertext Markup Language
WebHTMLElementmain
content categories flow content, palpable content.
... permitted content flow content.
... permitted parents where flow content is expected, but only if it is a hierarchically correct main element.
... skip navigation skip navigation, also known as "skipnav", is a technique that allows an assistive technology user to quickly bypass large sections of repeated content (main navigation, info banners, etc.).
<p>: The Paragraph element - HTML: Hypertext Markup Language
WebHTMLElementp
see “tag omission” below.
... content categories flow content, palpable content.
...the end tag may be omitted if the <p> element is immediately followed by an <address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element.
... permitted parents any element that accepts flow content.
<picture>: The Picture element - HTML: Hypertext Markup Language
WebHTMLElementpicture
this lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions.
... content categories flow content, phrasing content, embedded content permitted content zero or more <source> elements, followed by one <img> element, optionally intermixed with script-supporting elements.
... permitted parents any element that allows embedded content.
... a width descriptor, followed by a w (such as 300w); or a pixel density descriptor, followed by an x (such as 2x) to serve a high-res image for high-dpi screens.
<select>: The HTML Select element - HTML: Hypertext Markup Language
WebHTMLElementselect
warning: the mechanism for selecting multiple non-contiguous items via the keyboard described below currently only seems to work in firefox.
... for more useful information on styling <select>, see: styling html forms advanced styling for html forms examples basic select the following example creates a very simple dropdown menu, the second option of which is selected by default.
... <!-- the second value will be selected initially --> <select name="choice"> <option value="first">first value</option> <option value="second" selected>second value</option> <option value="third">third value</option> </select> advanced select with multiple features the follow example is more complex, showing off more features you can use on a <select> element: <label>please choose one or more pets: <select name="pets" multiple size="4"> <optgroup label="4-legged pets"> <option value="dog">dog</option> <option value="cat">cat</option> <option value="hamster" disabled>hamster</option> </optgroup> <optgroup label="flying pets"> <option value="parrot">parrot</option> <option value="macaw">macaw</option> <option value="albatross">albat...
... technical summary content categories flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element permitted content zero or more <option> or <optgroup> elements.
<shadow>: The obsolete Shadow Root element - HTML: Hypertext Markup Language
WebHTMLElementshadow
content categories transparent content permitted content flow content tag omission none, both the starting and ending tag are mandatory.
... permitted parents any element that accepts flow content.
... // the previous markup will not be displayed unless // <shadow> is used below.
... shadowroot2.innerhtml = '<shadow></shadow> <p>younger shadow root, displayed because it is the youngest.</p>'; </script> </body> </html> if you display this in a web browser it should look like the following.
<style>: The Style Information element - HTML: Hypertext Markup Language
WebHTMLElementstyle
in the same manner as <link> elements, <style> elements can include media attributes that contain media queries, allowing you to selectively apply internal stylesheets to your document depending on media features such as viewport width.
... examples a simple stylesheet in the following example, we apply a very simple stylesheet to a document: <!doctype html> <html> <head> <style> p { color: red; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> multiple style elements in this example we've included two <style> elements — notice how the conflicting declarations in the later <style> element override those in the earlier one, if t...
... <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style> p { color: blue; background-color: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> including a media query in this example we build on the previous one, including a media attribute on the second <style> element so it is only applied when the viewport is less than 500px in width.
... <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: yellow; } </style> </head> <body> <p>this is my paragraph.</p> </body> </html> technical summary content categories metadata content, and if the scoped attribute is present: flow content.
<template>: The Content Template element - HTML: Hypertext Markup Language
WebHTMLElementtemplate
content categories metadata content, flow content, phrasing content, script-supporting element permitted content no restrictions tag omission none, both the starting and ending tag are mandatory.
...also allowed as a child of a <colgroup> element that does not have a span attribute.
...note that directly using the value of the content could lead to unexpected behavior, see avoiding documentfragment pitfall section below.
... consider the following html and javascript: html <div id="container"></div> <template id="template"> <div>click me</div> </template> javascript const container = document.getelementbyid("container"); const template = document.getelementbyid("template"); function clickhandler(event) { alert("clicked a div"); } const firstclone = template.content.clonenode(true); firstclone.addeventlistener("click", clickha...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
using as to specify the type of content to be preloaded allows the browser to: prioritize resource loading more accurately.
...these can accept media types or full-blown media queries, allowing you to do responsive preloading!
...in addition, browsers will give prefetch resources a lower priority than preload ones — the current page is more important than the next.
... <link rel="subresource"> was supported in chrome a while ago, and was intended to tackle the same issue as preload, but it had a problem: there was no way to work out a priority for the items (as didn't exist back then), so they all got fetched with fairly low priority.
Choosing between www and non-www URLs - HTTP
in an http url, the first substring that follows the initial http:// or https:// is called the domain name.
...but even so, you can still have the other domain working: http allows two techniques so that it is clear for your users, or search engines, which domain is the canonical one, while still allowing the non-canonical domain to work and provide the expected pages.
...there are two techniques below to allow the non-canonical domain to work still.
...this way, search engines don't index the same page several times, potentially leading to it being considered as duplicate content or spam, and even removing or lowering your page from the search engine result pages.
HTTP caching - HTTP
WebHTTPCaching
for more details see the information about the vary header below.
... for more details, see also the freshness section below.
...for more details, see the validation section below.
... the expiration time is computed as follows: expirationtime = responsetime + freshnesslifetime - currentage where responsetime is the time at which the response was received according to the browser.
CSP: plugin-types - HTTP
not setting this allows anything.
... examples disallowing plugins to disallow all plugins, the object-src directive should be set to 'none' which will disallow plugins.
... the plugin-types directive is only used if you are allowing plugins with object-src at all.
... <meta http-equiv="content-security-policy" content="object-src 'none'"> allowing flash content the content security policy content-security-policy: plugin-types application/x-shockwave-flash will allow to load flash objects: <object data="https://example.com/flash" type="application/x-shockwave-flash"></object> allowing java applets to load an <applet> you must specify application/x-java-applet: content-security-policy: plugin-types application/x-java-applet specifications specification status comment content security policy level 3the definition of 'plugin-types' in that specification.
Expect-CT - HTTP
ct requirements can be satisfied via any one of the following mechanisms: x.509v3 certificate extension to allow embedding of signed certificate timestamps issued by individual logs a tls extension of type signed_certificate_timestamp sent during the handshake supporting ocsp stapling (that is, the status_request tls extension) and providing a signedcertificatetimestamplist when a site enables the expect-ct header, they are requesting that the browser check that any certificate for that site appears in public ct logs.
...certificates before march 2018 were allowed to have a lifetime of 39 months, those will all be expired in june 2021.
... if a cache receives a value greater than it can represent, or if any of its subsequent calculations overflows, the cache will consider this value to be either 2,147,483,648 (231) or the greatest positive integer it can represent.
... example the following example specifies enforcement of certificate transparency for 24 hours and reports violations to foo.example.
OPTIONS - HTTP
WebHTTPMethodsOPTIONS
request has body no successful response has body yes safe yes idempotent yes cacheable no allowed in html forms no syntax options /index.html http/1.1 options * http/1.1 examples identifying allowed request methods to find out which request methods a server supports, one can use the curl command-line program to issue an options request: curl -x options https://example.org -i the response then contains an allow header that holds the allowed methods: http/1.1 204 no content allow: options, get, head, post cache-control: max...
...in this example, the server response says that: access-control-allow-origin the https://foo.example origin is permitted to request the bar.example/resources/post-here/ url via the following: access-control-allow-methods post, get, and options are permitted methods for the url.
... (this header is similar to the allow response header, but used only for cors.) access-control-allow-headers any script inspecting the response is permitted to read the values of the x-pingother and content-type headers.
... http/1.1 204 no content date: mon, 01 dec 2008 01:15:39 gmt server: apache/2.0.61 (unix) access-control-allow-origin: https://foo.example access-control-allow-methods: post, get, options access-control-allow-headers: x-pingother, content-type access-control-max-age: 86400 vary: accept-encoding, origin keep-alive: timeout=2, max=100 connection: keep-alive specifications specification title rfc 7231, section 4.3.7: options hypertext transfer protocol (http/1.1): semantics and content ...
PATCH - HTTP
WebHTTPMethodsPATCH
to find out whether a server supports patch, a server can advertise its support by adding it to the list in the allow or access-control-allow-methods (for cors) response headers.
... another (implicit) indication that patch is allowed, is the presence of the accept-patch header, which specifies the patch document formats accepted by the server.
... request has body yes successful response has body yes safe no idempotent no cacheable no allowed in html forms no syntax patch /file.txt http/1.1 example request patch /file.txt http/1.1 host: www.example.com content-type: application/example if-match: "e0023aa4e" content-length: 100 [description of changes] response a successful response is indicated by any 2xx status code.
... in the example below a 204 response code is used, because the response does not carry a payload body.
Proxy servers and tunneling - HTTP
forward proxies can also be anonymous proxies and allow users to hide their ip address while browsing the web or using other internet services.
...a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request.
...http tunneling is using a protocol of higher level (http) to transport a lower level protocol (tcp).
...the example below will work in an environment where the internal dns server is set up so that it can only resolve internal host names, and the goal is to use a proxy only for hosts that aren't resolvable: function findproxyforurl(url, host) { if (isresolvable(host)) return "direct"; else return "proxy proxy.mydomain.com:8080"; } see proxy auto-configuration (pac) for more examples.
HTTP range requests - HTTP
http range requests allow to send only a portion of an http message from a server to a client.
... multipart ranges the range header also allows you to get multiple ranges at once in a multipart document.
... curl http://www.example.com -i -h "range: bytes=0-50, 100-150" the server responses with the 206 partial content status and a content-type: multipart/byteranges; boundary=3d6b6a416f9b5 header, indicating that a multipart byterange follows.
... comparison to chunked transfer-encoding the transfer-encoding header allows chunked encoding, which is useful when larger amounts of data are sent to the client and the total size of the response is not known until the request has been fully processed.
Redirections in HTTP - HTTP
[1] the specification did not intend to allow method changes, but there are existing user agents that do change their method.
... [2] the specification did not intend to allow method changes, but there are existing user agents that do change their method.
...in this case, the response is a 303 (see other) redirect that links to a page indicating that the action has been scheduled, and eventually informs about its progress, or allows to cancel it.
... redirection loops redirection loops happen when additional redirections follow the one that has already been followed.
Meta programming - JavaScript
« previousnext » starting with ecmascript 2015, javascript gains support for the proxy and reflect objects allowing you to intercept and define custom behavior for fundamental language operations (e.g.
... proxies introduced in ecmascript 6, proxy objects allow you to intercept certain operations and to implement custom behaviors.
... terminology the following terms are used when talking about the functionality of proxies.
... handlers and traps the following table summarizes the available traps available to proxy objects.
Quantifiers - JavaScript
types the following table is also duplicated on this cheatsheet.
... note: in the following, item refers not only to singular characters, but also includes character classes, unicode property escapes, groups and ranges.
...letterword)); // ["i"] console.table(sentence.match(notsolongword)); // [ "why", "do", "i", "have", "to", "learn", "table" ] console.table(sentence.match(loooongword)); // ["multiplication"] optional character var britishtext = "he asked his neighbour a favour."; var americantext = "he asked his neighbor a favor."; var regexpending = /\w+ou?r/g; // \w+ one or several letters // o followed by an "o", // u?
... optionally followed by a "u" // r followed by an "r" console.table(britishtext.match(regexpending)); // ["neighbour", "favour"] console.table(americantext.match(regexpending)); // ["neighbor", "favor"] greedy versus non-greedy var text = "i must be getting somewhere near the centre of the earth."; var greedyregexp = /[\w ]+/; // [\w ] a letter of the latin alphabet or a whitespace // + one or several times console.log(text.match(greedyregexp)[0]); // "i must be getting somewhere near the centre of the earth" // almost all of the text matches (leaves out the dot character) var nongreedyregexp = /[\w ]+?/; // notice the question mark console.log(text.match(nongreedyregexp)); // "i" // the match is the smallest one possible specifications specification ...
Unicode property escapes - JavaScript
unicode property escapes regular expressions allows for matching characters based on their unicode properties.
... syntax the following section is also duplicated on this cheatsheet.
... unicodepropertyname the name of a non-binary property: unicodepropertyvalue one of the tokens listed in the values section, below.
...the script and script_extensions unicode properties allow regular expression to match characters according to the script they are mainly used with (script) or according to the set of scripts they belong to (script_extensions).
Using Promises - JavaScript
read the following example: new promise((resolve, reject) => { console.log('initial'); resolve(); }) .then(() => { throw new error('something failed'); console.log('do this'); }) .catch(() => { console.error('do that'); }) .then(() => { console.log('do this, no matter what happened before'); }); this will output the following text: initial do that do this, no matter what happened be...
...best practice is to wrap problematic functions at the lowest possible level, and then never call them directly again: const wait = ms => new promise(resolve => settimeout(resolve, ms)); wait(10*1000).then(() => saysomething("10 seconds")).catch(failurecallback); basically, the promise constructor takes an executor function that lets us resolve or reject a promise manually.
...specifically, a nested catch only catches failures in its scope and below, not errors higher up in the chain outside the nested scope.
...several of these mistakes manifest in the following example: // bad example!
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
string.split is deprecated; use string.prototype.split instead warning: string.startswith is deprecated; use string.prototype.startswith instead warning: string.substr is deprecated; use string.prototype.substr instead warning: string.substring is deprecated; use string.prototype.substring instead warning: string.tolocalelowercase is deprecated; use string.prototype.tolocalelowercase instead warning: string.tolocaleuppercase is deprecated; use string.prototype.tolocaleuppercase instead warning: string.tolowercase is deprecated; use string.prototype.tolowercase instead warning: string.touppercase is deprecated; use string.prototype.touppercase instead warning: string.trim is deprec...
...string generics provide string instance methods on the string object allowing string methods to be applied to any object.
... examples deprecated syntax var num = 15; string.replace(num, /5/, '2'); standard syntax var num = 15; string(num).replace(/5/, '2'); shim the following is a shim to provide support to non-supporting browsers: /*globals define*/ // assumes all supplied string instance methods already present // (one may use shims for these if not available) (function() { 'use strict'; var i, // we could also build the array of methods with the following, but the // getownpropertynames() method is non-shimable: // object.getownpropertynames(string).filter(function(methodname) { // return typeof string[methodname] === 'function'; // }); methods = [ 'contains', 'substring', 'tolowercase', 'touppercase', 'charat', 'charcodeat', 'indexof', 'lastindexof', 'start...
...swith', 'endswith', 'trim', 'trimleft', 'trimright', 'tolocalelowercase', 'normalize', 'tolocaleuppercase', 'localecompare', 'match', 'search', 'slice', 'replace', 'split', 'substr', 'concat', 'localecompare' ], methodcount = methods.length, assignstringgeneric = function(methodname) { var method = string.prototype[methodname]; string[methodname] = function(arg1) { return method.apply(arg1, array.prototype.slice.call(arguments, 1)); }; }; for (i = 0; i < methodcount; i++) { assignstringgeneric(methods[i]); } }()); ...
getter - JavaScript
description sometimes it is desirable to allow access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method calls.
... note the following when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() { }, get x() { } } and { x: ..., get x() { } } are forbidden).
...this is useful in the following situations: if the calculation of a property value is expensive (takes much ram or cpu time, spawns worker threads, retrieves remote file, etc).
... in the following example, the object has a getter as its own property.
Array.prototype.reduce() - JavaScript
it is the accumulated value previously returned in the last invocation of the callback—or initialvalue, if it was supplied (see below).
... it is almost always safer to provide an initialvalue, because there can be up to four possible output types without initialvalue, as shown in the following example: let maxcallback = ( acc, cur ) => math.max( acc.x, cur.x ); let maxcallback2 = ( max, cur ) => math.max( max, cur ); // reduce without initialvalue [ { x: 2 }, { x: 22 }, { x: 42 } ].reduce( maxcallback ); // nan [ { x: 2 }, { x: 22 } ].reduce( maxcallback ); // 22 [ { x: 2 } ].reduce( maxcallback ); // { x: 2 } [ ].red...
...uce( maxcallback ); // typeerror // map & reduce with initialvalue; better solution, also works for empty or larger arrays [ { x: 22 }, { x: 42 } ].map( el => el.x ) .reduce( maxcallback2, -infinity ); how reduce() works suppose the following use of reduce() occurred: [0, 1, 2, 3, 4].reduce(function(accumulator, currentvalue, currentindex, array) { return accumulator + currentvalue }) the callback would be invoked four times, with the arguments and return values in each call being as follows: callback iteration accumulator currentvalue currentindex array return value first call 0 1 1 [0, 1, 2, 3, 4] 1 second call 1 2 2 [0, 1, 2, 3, 4] 3 third call 3 3 3 [0, 1, 2, ...
...the code below will produce the same output as the code in the block above: [0, 1, 2, 3, 4].reduce( (accumulator, currentvalue, currentindex, array) => accumulator + currentvalue ) if you were to provide an initialvalue as the second argument to reduce(), the result would look like this: [0, 1, 2, 3, 4].reduce((accumulator, currentvalue, currentindex, array) => { return accumulator + currentvalue }, 10) callback iteration accumulator currentvalue currentindex array return value first call 10 0 0 [0, 1, 2, 3, ...
Array.prototype.reduceRight() - JavaScript
(see below.) currentvalue the current element being processed in the array.
... some example run-throughs of the function would look like this: [0, 1, 2, 3, 4].reduceright(function(accumulator, currentvalue, index, array) { return accumulator + currentvalue; }); the callback would be invoked four times, with the arguments and return values in each call being as follows: callback accumulator currentvalue index array return value first call 4 3 3 [0, 1, 2, 3, 4] 7 second call 7 2 2 [0, 1, 2, 3, 4] 9 third call 9 1 1 [0, 1, 2, 3, 4] 10 fourth call 10 0 0 [0, 1, 2, 3, 4] 10 the value returned by reduceright would be that of the last c...
...you can work around this by inserting the following code at the beginning of your scripts, allowing use of reduceright in implementations which do not natively support it.
...it’s a flowing right-to-left, calling each function with the output of the last one.
Array.prototype.slice() - JavaScript
the slice() method returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included) where start and end represent the index of items in that array.
...it returns a shallow copy of elements from the original array.
... elements of the original array are copied into the returned array as follows: for object references (and not the actual object), slice copies object references into the new array.
... examples return a portion of an existing array let fruits = ['banana', 'orange', 'lemon', 'apple', 'mango'] let citrus = fruits.slice(1, 3) // fruits contains ['banana', 'orange', 'lemon', 'apple', 'mango'] // citrus contains ['orange','lemon'] using slice> in the following example, slice creates a new array, newcar, from mycar.
Array.prototype.splice() - JavaScript
in this case, you should specify at least one new element (see below).
... examples remove 0 (zero) elements before index 2, and insert "drum" let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2, 0, 'drum') // myfish is ["angel", "clown", "drum", "mandarin", "sturgeon"] // removed is [], no elements removed remove 0 (zero) elements before index 2, and insert "drum" and "guitar" let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2, 0, 'drum', 'guitar') // myfish is ["angel", "clown", "drum", "gui...
...tar", "mandarin", "sturgeon"] // removed is [], no elements removed remove 1 element at index 3 let myfish = ['angel', 'clown', 'drum', 'mandarin', 'sturgeon'] let removed = myfish.splice(3, 1) // myfish is ["angel", "clown", "drum", "sturgeon"] // removed is ["mandarin"] remove 1 element at index 2, and insert "trumpet" let myfish = ['angel', 'clown', 'drum', 'sturgeon'] let removed = myfish.splice(2, 1, 'trumpet') // myfish is ["angel", "clown", "trumpet", "sturgeon"] // removed is ["drum"] remove 2 elements from index 0, and insert "parrot", "anemone" and "blue" let myfish = ['angel', 'clown', 'trumpet', 'sturgeon'] let removed = myfish.splice(0, 2, 'parrot', 'anemone', 'blue') // myfish is ["parrot", "anemone", "blue", "trumpet", "sturgeon"] // removed is ["angel", "clown"] re...
...move 2 elements from index 2 let myfish = ['parrot', 'anemone', 'blue', 'trumpet', 'sturgeon'] let removed = myfish.splice(2, 2) // myfish is ["parrot", "anemone", "sturgeon"] // removed is ["blue", "trumpet"] remove 1 element from index -2 let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(-2, 1) // myfish is ["angel", "clown", "sturgeon"] // removed is ["mandarin"] remove all elements from index 2 let myfish = ['angel', 'clown', 'mandarin', 'sturgeon'] let removed = myfish.splice(2) // myfish is ["angel", "clown"] // removed is ["mandarin", "sturgeon"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype.splice' in that specification.
Date() constructor - JavaScript
individual date and time component values given at least a year and month, this form of date() returns a date object whose component values (year, month, day, hour, minute, second, and millisecond) all come from the following parameters.
... any missing fields are given the lowest possible value (1 for day and 0 for every other component).
...see the example below.
... examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
Date.prototype.toLocaleString() - JavaScript
in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: let date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // formats below assume the local time zone of the locale; // america/los_angeles for the us // us english uses month-day-year order and 12-hour time with am/pm console.log(date.tolocalestring('en-us')); // → "12/19/2012, 7:00:00 pm" // british english uses day-month-year order and 24-hour time without am/pm console.log(date.tolocalestring('en-gb')); // → "20/12/2012 03:00:00" // korean uses year-month-day...
...however, this might change in the future, and isn't guaranteed for all languages; output variations are by design, and allowed by the specification.
... most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text.
... for this reason, you cannot expect to be able to compare the results of tolocalestring() to a static value: "1/1/2019, 01:00:00" === new date("2019-01-01t01:00:00z").tolocalestring("en-us"); // true in firefox and others // false in ie and edge note: see also this stackoverflow thread for more details and examples.
Error.prototype.stack - JavaScript
argument values in the stack: prior to firefox 14, the function name would be followed by the argument values converted to string in parentheses immediately before the at (@) sign.
... examples using the stack property the following html markup demonstrates the use of stack property.
...-8"> <title>stack trace example</title> <body> <script> function trace() { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n', undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is saved as c:\example.html on a windows file system it produces an alert message box with the following text: starting with firefox 30 and later containing the column number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to firefox 29: trace@file:///c:/example.html:9 b@file:///c:/example.html:16 a@file:///c:/example.html:19 @file:///c:/example.html:21 firefox 13 and earlier would instead produce th...
...e following text: error("myerror")@:0 trace()@file:///c:/example.html:9 b(3,4,"\n\n",(void 0),[object object])@file:///c:/example.html:16 a("first call, firstarg")@file:///c:/example.html:19 @file:///c:/example.html:21 stack of eval'ed code starting with firefox 30, the error stack of code in function() and eval() calls, now produces stacks with more detailed information about the line and column numbers inside these calls.
Intl.Locale.prototype.numberingSystem - JavaScript
a table of the standard unicode numeral systems can be seen below.
... value description adlm adlam digits ahom ahom digits arab arabic-indic digits arabext extended arabic-indic digits armn armenian upper case numerals — algorithmic armnlow armenian lower case numerals — algorithmic bali balinese digits beng bengali digits bhks bhaiksuki digits brah brahmi digits cakm chakma digits cham cham digits cyrl cyrillic numerals — algorithmic deva devanagari digits ethi ethiopic numerals — algorithmic finance financial numerals — may be algorithmic fullwide full width digits geor georgian numerals — algorithmic gong gun...
...jala gondi digits gonm masaram gondi digits grek greek upper case numerals — algorithmic greklow greek lower case numerals — algorithmic gujr gujarati digits guru gurmukhi digits hanidays han-character day-of-month numbering for lunar/other traditional calendars hanidec positional decimal system using chinese number ideographs as digits hans simplified chinese numerals — algorithmic hansfin simplified chinese financial numerals — algorithmic hant traditional chinese numerals — algorithmic hantfin traditional chinese financial numerals — algorithmic hebr hebrew numerals — algorithmic hmng pahawh hmong digits hmnp n...
...anmar digits mymrshan myanmar shan digits mymrtlng myanmar tai laing digits native native digits newa newa digits nkoo n'ko digits olck ol chiki digits orya oriya digits osma osmanya digits rohg hanifi rohingya digits roman roman upper case numerals — algorithmic romanlow roman lowercase numerals — algorithmic saur saurashtra digits shrd sharada digits sind khudawadi digits sinh sinhala lith digits sora sora_sompeng digits sund sundanese digits takr takri digits talu new tai lue digits taml tamil numerals — algorithmic tamldec modern tamil...
Intl.RelativeTimeFormat() constructor - JavaScript
an object with some or all of the following properties: localematcher the locale matching algorithm to use.
...the "auto" value allows to not always have to use numeric values in the output.
... examples basic format usage the following example shows how to create a relative time formatter using the english language.
...this allows to not always have to use numeric values in the output.
JSON.stringify() - JavaScript
replacer optional a function that alters the behavior of the stringification process, or an array of string and number that serve as an allowlist for selecting/filtering the properties of the value object to be included in the json string.
... it should return the value that should be added to the json string, as follows: if you return a number, string, boolean, or null, the stringified version of that value is used as the property's value.
... therefore, if compatibility with older javascript engines is required, it is perilous to directly substitute the string returned by json.stringify into a javascript string to be passed to eval or new function or as part of a jsonp url, and the following utility can be used: function jsfriendlyjsonstringify (s) { return json.stringify(s).
...":"quux"}' var b = json.stringify({ baz: "quux", foo: "bar" }) //'{"baz":"quux","foo":"bar"}' console.log(a !== b) // true // some memoization functions use json.stringify to serialize arguments, // which may cause a cache miss when encountering the same object like above example of using json.stringify() with localstorage in a case where you want to store an object created by your user and allowing it to be restored even after the browser has been closed, the following example is a model for the applicability of json.stringify(): // creating an example of json var session = { 'screens': [], 'state': true }; session.screens.push({ 'name': 'screena', 'width': 450, 'height': 250 }); session.screens.push({ 'name': 'screenb', 'width': 650, 'height': 350 }); session.screens.push({ 'name':...
Object.defineProperties() - JavaScript
data descriptors and accessor descriptors may optionally contain the following keys: configurable true if and only if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
... a data descriptor also has the following optional keys: value the value associated with the property.
... an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or undefined if there is no getter.
... polyfill assuming a pristine execution environment with all names and properties referring to their initial values, object.defineproperties is almost completely equivalent (note the comment in iscallable) to the following reimplementation in javascript: function defineproperties(obj, properties) { function converttodescriptor(desc) { function hasproperty(obj, prop) { return object.prototype.hasownproperty.call(obj, prop); } function iscallable(v) { // nb: modify as necessary if other values than functions are callable.
Object.freeze() - JavaScript
he friendly duck'; // in strict mode such attempts will throw typeerrors function fail(){ 'use strict'; obj.foo = 'sparky'; // throws a typeerror delete obj.foo; // throws a typeerror delete obj.quaxxor; // returns true since attribute 'quaxxor' was never added obj.sparky = 'arf'; // throws a typeerror } fail(); // attempted changes through object.defineproperty; // both statements below throw a typeerror.
... object.defineproperty(obj, 'ohai', { value: 17 }); object.defineproperty(obj, 'foo', { value: 'eit' }); // it's also impossible to change the prototype // both statements below will throw a typeerror.
...the following example shows that a frozen object is not constant (freeze is shallow).
... what is "shallow freeze"?
Object.prototype.toString() - JavaScript
the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and undefined returns [object undefined], as defined in the 5th edition of ecmascript and subsequent errata.
... by using radix you can also convert base 10 numbers (like 1,2,3,4,5,.........) to another base numbers, in example below we are converting base 10 number to a base 2 (binary) number let basetenint = 10; console.log(basetenint.tostring(2)); // expected output is "1010" and same for big integers let bignum = bigint(20); console.log(bignum.tostring(2)); // expected output is "10100" some common radix are 2 for binary numbers, 8 for octal numbers, 10 for decimal numbers, 16 for hexadecimal numbers.
... the following code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); if you call the tostring() method on this custom object, it returns the default value inherited from object: thedog.tostring(); // returns [object object] the following code creates and ass...
... + ' is a ' + this.sex + ' ' + this.color + ' ' + this.breed; return ret; } or, using es6 template strings: dog.prototype.tostring = function dogtostring() { return `dog ${this.name} is a ${this.sex} ${this.color} ${this.breed}`; } with the preceding code in place, any time thedog is used in a string context, javascript automatically calls the dogtostring() function, which returns the following string: "dog gabby is a female chocolate lab" using tostring() to detect object class tostring() can be used with every object and (by default) allows you to get its class.
handler.defineProperty() - JavaScript
syntax const p = new proxy(target, { defineproperty: function(target, property, descriptor) { } }); parameters the following parameters are passed to the defineproperty() method.
... interceptions this trap can intercept these operations: object.defineproperty() reflect.defineproperty() invariants if the following invariants are violated, the proxy will throw a typeerror: a property cannot be added, if the target object is not extensible.
... examples trapping of defineproperty the following code traps object.defineproperty().
...p = new proxy({}, { defineproperty: function(target, prop, descriptor) { console.log('called: ' + prop); return true; } }); const desc = { configurable: true, enumerable: true, value: 10 }; object.defineproperty(p, 'a', desc); // "called: a" when calling object.defineproperty() or reflect.defineproperty(), the descriptor passed to defineproperty() trap has one restriction—only following properties are usable (non-standard properties will be ignored): enumerable configurable writable value get set const p = new proxy({}, { defineproperty(target, prop, descriptor) { console.log(descriptor); return reflect.defineproperty(target, prop, descriptor); } }); object.defineproperty(p, 'name', { value: 'proxy', type: 'custom' }); // { value: 'proxy' } speci...
handler.get() - JavaScript
syntax const p = new proxy(target, { get: function(target, property, receiver) { } }); parameters the following parameters are passed to the get() method.
... interceptions this trap can intercept these operations: property access: proxy[foo]and proxy.bar inherited property access: object.create(proxy)[foo] reflect.get() invariants if the following invariants are violated, the proxy will throw a typeerror: the value reported for a property must be the same as the value of the corresponding target object property if the target object property is a non-writable, non-configurable own data property.
... examples trap for getting a property value the following code traps getting a property value.
... const p = new proxy({}, { get: function(target, property, receiver) { console.log('called: ' + property); return 10; } }); console.log(p.a); // "called: a" // 10 the following code violates an invariant.
handler.getOwnPropertyDescriptor() - JavaScript
syntax const p = new proxy(target, { getownpropertydescriptor: function(target, prop) { } }); parameters the following parameters are passed to the getownpropertydescriptor() method.
... interceptions this trap can intercept these operations: object.getownpropertydescriptor() reflect.getownpropertydescriptor() invariants if the following invariants are violated, the proxy will throw a typeerror: getownpropertydescriptor() must return an object or undefined.
... examples trapping of getownpropertydescriptor the following code traps object.getownpropertydescriptor().
... const p = new proxy({ a: 20}, { getownpropertydescriptor: function(target, prop) { console.log('called: ' + prop); return { configurable: true, enumerable: true, value: 10 }; } }); console.log(object.getownpropertydescriptor(p, 'a').value); // "called: a" // 10 the following code violates an invariant.
handler.has() - JavaScript
syntax const p = new proxy(target, { has: function(target, prop) { } }); parameters the following parameters are passed to has() method.
... interceptions this trap can intercept these operations: property query: foo in proxy inherited property query: foo in object.create(proxy) with check: with(proxy) { (foo); } reflect.has() invariants if the following invariants are violated, the proxy will throw a typeerror: a property cannot be reported as non-existent, if it exists as a non-configurable own property of the target object.
... examples trapping the in operator the following code traps the in operator.
... const p = new proxy({}, { has: function(target, prop) { console.log('called: ' + prop); return true; } }); console.log('a' in p); // "called: a" // true the following code violates an invariant.
handler.isExtensible() - JavaScript
syntax const p = new proxy(target, { isextensible: function(target) { } }); parameters the following parameter is passed to the isextensible() method.
... interceptions this trap can intercept these operations: object.isextensible() reflect.isextensible() invariants if the following invariants are violated, the proxy will throw a typeerror: object.isextensible(proxy) must return the same value as object.isextensible(target).
... examples trapping of isextensible the following code traps object.isextensible().
... const p = new proxy({}, { isextensible: function(target) { console.log('called'); return true; } }); console.log(object.isextensible(p)); // "called" // true the following code violates the invariant.
handler.ownKeys() - JavaScript
syntax const p = new proxy(target, { ownkeys: function(target) { } }); parameters the following parameter is passed to the ownkeys() method.
... interceptions this trap can intercept these operations: object.getownpropertynames() object.getownpropertysymbols() object.keys() reflect.ownkeys() invariants if the following invariants are violated, the proxy will throw a typeerror: the result of ownkeys() must be an array.
... examples trapping of getownpropertynames the following code traps object.getownpropertynames().
... const p = new proxy({}, { ownkeys: function(target) { console.log('called'); return ['a', 'b', 'c']; } }); console.log(object.getownpropertynames(p)); // "called" // [ 'a', 'b', 'c' ] the following code violates an invariant.
handler.preventExtensions() - JavaScript
syntax const p = new proxy(target, { preventextensions: function(target) { } }); parameters the following parameter is passed to the preventextensions() method.
... interceptions this trap can intercept these operations: object.preventextensions() reflect.preventextensions() invariants if the following invariants are violated, the proxy will throw a typeerror: object.preventextensions(proxy) only returns true if object.isextensible(proxy) is false.
... examples trapping of preventextensions the following code traps object.preventextensions().
... const p = new proxy({}, { preventextensions: function(target) { console.log('called'); object.preventextensions(target); return true; } }); console.log(object.preventextensions(p)); // "called" // false the following code violates the invariant.
RegExp - JavaScript
the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated.
... for example, the following are equivalent: let re = /\w+/ let re = new regexp('\\w+') perl-like regexp properties note that several of the regexp properties have both long and short (perl-like) names.
... examples using a regular expression to change data format the following script uses the replace() method of the string instance to match a name in the format first last and output it in the format last, first.
...�сском языке' let regex = /[\u0400-\u04ff]+/g let match = regex.exec(text) console.log(match[0]) // logs 'Образец' console.log(regex.lastindex) // logs '7' let match2 = regex.exec(text) console.log(match2[0]) // logs 'на' [did not log 'text'] console.log(regex.lastindex) // logs '15' // and so on the unicode property escapes feature introduces a solution, by allowing for a statement as simple as \p{scx=cyrl}.
String.prototype.repeat() - JavaScript
rangeerror: repeat count must be less than infinity and not overflow maximum string size.
...however, you can polyfill string.prototype.repeat() with the following snippet: if (!string.prototype.repeat) { string.prototype.repeat = function(count) { 'use strict'; if (this == null) throw new typeerror('can\'t convert ' + this + ' to object'); var str = '' + this; // to convert string to integer.
... count = +count; // check nan if (count != count) count = 0; if (count < 0) throw new rangeerror('repeat count must be non-negative'); if (count == infinity) throw new rangeerror('repeat count must be less than infinity'); count = math.floor(count); if (str.length == 0 || count == 0) return ''; // ensuring count is a 31-bit integer allows us to heavily optimize the // main part.
... but anyway, most current (august 2014) browsers can't handle // strings 1 << 28 chars or longer, so: if (str.length * count >= 1 << 28) throw new rangeerror('repeat count must not overflow maximum string size'); var maxcount = str.length * count; count = math.floor(math.log(count) / math.log(2)); while (count) { str += str; count--; } str += str.substring(0, maxcount - str.length); return str; } } examples using repeat 'abc'.repeat(-1) // rangeerror 'abc'.repeat(0) // '' 'abc'.repeat(1) // 'abc' 'abc'.repeat(2) // 'abcabc' 'abc'.repeat(3.5) // 'abcabcabc' (count will be converted to integer) 'abc'.repeat(1/0) // rangeerror ({ tostring: () => 'abc', repeat: string.prototype.repeat }).repeat(2) // 'abcabc' (repeat() ...
String.prototype.substring() - JavaScript
if indexstart is greater than indexend, then the effect of substring() is as if the two arguments were swapped; see example below.
... examples using substring() the following example uses substring() to display characters from the string 'mozilla': let anystring = 'mozilla' // displays 'm' console.log(anystring.substring(0, 1)) console.log(anystring.substring(1, 0)) // displays 'mozill' console.log(anystring.substring(0, 6)) // displays 'lla' console.log(anystring.substring(4)) console.log(anystring.substring(4, 7)) console.log(anystring.substring(7, 4)) // displays 'mozilla' console.log(anystring.substring(0, 7)) console.log(anystring.substring(0, 10)) using substring() with length property the following example use...
... replacing a substring within a string the following example replaces a substring within a string.
... a better method for replacing strings is as follows: function replacestring(olds, news, fulls) { return fulls.split(olds).join(news) } the code above serves as an example for substring operations.
WebAssembly.Memory() constructor - JavaScript
syntax new webassembly.memory(memorydescriptor); parameters memorydescriptor an object that can contain the following members: initial the initial size of the webassembly memory, in units of webassembly pages.
... maximum optional the maximum size the webassembly memory is allowed to grow to, in units of webassembly pages.
...the following example creates a new webassembly memory instance with an initial size of 10 pages (640kib), and a maximum size of 100 pages (6.4mib).
...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.
Destructuring assignment - JavaScript
examples array destructuring basic variable assignment const foo = ['one', 'two', 'three']; const [red, yellow, green] = foo; console.log(red); // "one" console.log(yellow); // "two" console.log(green); // "three" assignment separate from declaration a variable can be assigned its value via destructuring separate from the variable's declaration.
... without destructuring assignment, swapping two values requires a temporary variable (or, in some low-level languages, the xor-swap trick).
...destructuring assignment allows you to unpack the parts out of this array easily, ignoring the full match if it is not needed.
...say you want the third element in the array props below, and then you want the name property in the object, you can do the following: const props = [ { id: 1, name: 'fizz'}, { id: 2, name: 'buzz'}, { id: 3, name: 'fizzbuzz'} ]; const [,, { name }] = props; console.log(name); // "fizzbuzz" the prototype chain is looked up when the object is deconstructed when deconstructing an object, if a property is not accessed in itself, it will contin...
Object initializer - JavaScript
the following code creates an object with three properties and the keys are "foo", "age" and "baz".
... function havees2015duplicatepropertysemantics() { 'use strict'; try { ({prop: 1, prop: 2}); // no error thrown, duplicate property names allowed in strict mode return true; } catch(e) { // error thrown, duplicates prohibited in strict mode return false; } } method definitions a property of an object can also refer to a function or a getter or setter method.
...that allows you to put an expression in brackets [], that will be computed and used as the property name.
... shallow-cloning (excluding prototype) or merging objects is now possible using a shorter syntax than object.assign().
yield - JavaScript
description the yield keyword pauses generator function execution and the value of the expression following the yield keyword is returned to the generator's caller.
...each time the generator's next() method is called, the generator resumes execution, and runs until it reaches one of the following: a yield, which causes the generator to once again pause and return the generator's new value.
... unfortunately, next() is asymmetric, but that can’t be helped: it always sends a value to the currently suspended yield, but returns the operand of the following yield.
... examples using yield the following code is the declaration of an example generator function.
let - JavaScript
description let allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope.
... the other difference between var and let is that the latter is initialized to a value only when a parser evaluates it (see below).
... function test(){ var foo = 33; if(foo) { let foo = (foo + 55); // referenceerror } } test(); this phenomenon may confuse you in a situation like the following.
... var a = 1; var b = 2; if (a === 1) { var a = 11; // the scope is global let b = 22; // the scope is inside the if-block console.log(a); // 11 console.log(b); // 22 } console.log(a); // 11 console.log(b); // 2 however, this combination of var and let declaration below is a syntaxerror due to var being hoisted to the top of the block.
with - JavaScript
see the "ambiguity contra" paragraph in the "description" section below for details.
...therefore all identifiers that aren't members of the specified object will be found more slowly in a 'with' block.
... examples using with the following with statement specifies that the math object is the default object.
... the statements following the with statement refer to the pi property and the cos and sin methods, without specifying an object.
MathML attribute reference - MathML
the values block and inline are allowed.
... unimplemented overflow <math> if an expression is too long to fit in the allowed width, this attribute sets the preferred handling.
... scriptminsize <mstyle> specifies a minimum font size allowed due to changes in scriptlevel.
... subscriptshift <mmultiscripts>, <msub>, <msubsup> the minimum space by which to shift the subscript below the baseline of the expression.
Digital video concepts - Web media technologies
doing so allows color data to be represented using fewer total bits of space in a video stream.
... as our eyes capture a scene, they essentially take two photos at once: a finely-detailed greyscale image and a somewhat fuzzy, lower-resolution map of the colors of light received across the retina at the same time.
... since the color data is being encoded at a lower resolution than the luma, when decoding the video to draw it to the screen each pixel's color is computed by calculating an appropriate color given the u and v values for the 4x2 block of 8 pixels in which the pixel resides.
... the table below shows examples of three chroma subsampling models.
CSS and JavaScript animation performance - Web Performance
css animations, on the other hand, allow developers to make animations between a set of starting property values and a final set rather than between two states.
... running the performance test initially in the test seen below, a total of 1000 <div> elements are transformed by css animation.
...the key is that as long as the properties we want to animate do not trigger reflow/repaint (read css triggers for more information), we can move those sampling operations out of the main thread.
... note: in nightly/developer edition, you should see that omta is enabled by default, so you might have to do the tests the other way around (test with it enabled first, then disable to test without omta.) summary browsers are able to optimize rendering flows.
Critical rendering path - Web Performance
understanding and optimizing the critical rendering path is important to ensure reflows and repaints can happen at 60 frames per second, to ensure performant user interactions and avoid jank.
... the greater the number of nodes, the longer the following events in the critical rendering path will take.
...specificity is likely not your low hanging fruit.
...while painting is a very fast process, and therefore likely not the most impactful place to focus on in improving performance, it is important to remember to allow for both layout and re-paint times when measuring how long an animation frame may take.
How to make PWAs installable - Progressive web apps (PWAs)
previous overview: progressive next in the last article, we read about how the example application, js13kpwa, works offline thanks to its service worker, but we can go even further and allow users to install the web app on mobile and desktop browers that support doing so.
... 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.
... 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 servi...
... 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.
Media - Progressive web apps (PWAs)
to specify rules that are specific to a type of media, use @media followed by the media type, followed by curly braces that enclose the rules.
...this css (below) removes the navigation area when printing the document: @media print { #nav-area {display: none;} } some common media types are: screen color device display print printed paged media projection projected display all all media (the default) more details there are other ways to specify the media type for a set of rules.
... the document's markup language might allow the media type to be specified when the stylesheet is linked to the document.
... the cursor property specifies the shape of the pointer: some of the common shapes are as follows.
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.
... 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.
... <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.
end - SVG: Scalable Vector Graphics
WebSVGAttributeend
each value can be one of the following: <offset-value> this value defines a clock-value that represents a point in time relative to the beginning of the svg document (usually the load or domcontentloaded event).
... a valid syncbase-value consists of an id reference to another animation element followed by a dot and either begin or end to identify whether to synchronize with the beginning or active end of the referenced animation element.
... a valid event-value consists of an element id followed by a dot and one of the supported events for that element.
... a valid repeat value consists of an element id followed by a dot and the function repeat() with an integer value specifying the number of repetitions as parameter.
font-size-adjust - SVG: Scalable Vector Graphics
« svg attribute reference home the font-size-adjust attribute allows authors to specify an aspect value for an element that will preserve the x-height of the first choice font in a substitute font.
... as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg width="600" height="80" viewbox="0 0 500 80" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="times, serif" font-size="10px"> this text uses the times font (10px), which is hard to read in small sizes.
... </text> <text y="40" font-family="verdana, sans-serif" font-size="10px"> this text uses the verdana font (10px), which has relatively large lowercase letters.
... <number> choose the size of the font so that its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size.
preserveAspectRatio - SVG: Scalable Vector Graphics
because the aspect ratio of an svg image is defined by the viewbox attribute, if this attribute isn't set, the preserveaspectratio attribute has no effect (with one exception, the <image> element, as described below).
...viewbox="0 0 100 100" width="10" height="25" 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 valu...
...the alignment value must be one of the following keywords: none do not force uniform scaling.
... meet or slice reference the meet or slice reference is optional and, if provided, must be one of the following keywords: meet (the default) - scale the graphic such that: aspect ratio is preserved the entire viewbox is visible within the viewport the viewbox is scaled up as much as possible, while still meeting the other criteria in this case, if the aspect ratio of the graphic does not match the viewport, some of the viewport will extend beyond the bounds of the viewbox (i.e...
SVG Attribute reference - SVG: Scalable Vector Graphics
WebSVGAttribute
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.
... svg attributes a to z a accent-height accumulate additive alignment-baseline allowreorder alphabetic amplitude arabic-form ascent attributename attributetype autoreverse 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-s...
...unitlength kerning keypoints keysplines keytimes l lang lengthadjust letter-spacing lighting-color limitingconeangle local m marker-end marker-mid marker-start markerheight markerunits markerwidth mask maskcontentunits maskunits mathematical max media method min mode n name numoctaves o offset opacity operator order orient orientation origin overflow overline-position overline-thickness p panose-1 paint-order path pathlength patterncontentunits patterntransform patternunits ping pointer-events points pointsatx pointsaty pointsatz preservealpha preserveaspectratio primitiveunits r r radius referrerpolicy refx refy rel rendering-intent repeatcount repeatdur requiredextensions requiredfeatures restart resul...
...rsor, direction, display, dominant-baseline, enable-background, fill, fill-opacity, fill-rule, filter, flood-color, flood-opacity, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight, glyph-orientation-horizontal, glyph-orientation-vertical, image-rendering, kerning, letter-spacing, lighting-color, marker-end, marker-mid, marker-start, mask, opacity, overflow, pointer-events, shape-rendering, stop-color, stop-opacity, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, text-anchor, text-decoration, text-rendering, transform, transform-origin, unicode-bidi, vector-effect, visibility, word-spacing, writing-mode filters attributes filter primitive attributes height, result, wid...
<a> - SVG: Scalable Vector Graphics
WebSVGElementa
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.
... value type: <string> ; default value: none; animatable: yes ping a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
...-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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role 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>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<a>' in that specification.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
source here is the source to the example: <html> <head> <title>xtech svg demo</title> <style> stop.begin { stop-color:yellow; } stop.end { stop-color:green; } body.invalid stop.end { stop-color:red; } #err { display:none; } body.invalid #err { display:inline; } </style> <script> function signalerror() { document.getelementbyid('body').setattribute("class", "invalid"); } </script> </head> <body id="body" style="position:absolute; z-index:0; border:1px solid black; left:5%; top:5%; width:90%; height:90%;"> <form> <fieldset> ...
...(another style rule makes an error message appear.) this approach has the following points in its favor: we have taken a regular html form that could have been part of an existing web site, and added an attractive, interactive background the approach is backwards compatible to browsers that do not support svg; simply, no background appears in them it's very simple and performs very well the picture dynamically sizes itself to the required size in an intelligent way we ...
...like in the following example: var img = document.createelementns("http://www.w3.org/2000/svg", "image"); img.setattributens("http://www.w3.org/1999/xlink", "xlink:href", "move.png"); details the viewbox attribute establishes a logical coordinate system which the svg picture's coordinates are relative to.
... the preserveaspectratio attribute specifies that the aspect ratio must be preserved by centering the picture in the available size, sizing to the maximum of the height or width and then cutting off any overflow.
Texts - SVG: Scalable Vector Graphics
WebSVGTutorialTexts
the attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text flows from this point.
...each of the following properties can be set as an attribute or via a css declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration.
...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.
...it is meant to allow the rendering engine to fine-tune the positions of the glyphs when its own measured text length doesn't meet the one provided here.
Using templates and slots - Web Components
let's look at a trivial quick example: <template id="my-paragraph"> <p>my paragraph</p> </template> this won't appear in your page until you grab a reference to it with javascript and then append it to the dom, using something like the following: let template = document.getelementbyid('my-paragraph'); let templatecontent = template.content; document.body.appendchild(templatecontent); although trivial, you can already start to see how this could be useful.
... slots are identified by their name attribute, and allow you to define placeholders in your template that can be filled with any markup fragment you want when the element is used in the markup.
... the following set of code snippets show how to use <slot> together with <template> and some javascript to: create a <element-details> element with named slots in its shadow root design the <element-details> element in such a way that, when used in documents, it is rendered from composing the element’s content together with content from its shadow root—that is, pieces of the element’s content are u...
... screenshotlive sample notice the following points about this rendered result: even though the instances of the <element-details> element in the document do not directly use the <details> element, they get rendered using <details> because the shadow root causes them to get populated with that.
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementsort
syntax <xsl:sort select=expression order="ascending" | "descending" case-order="upper-first" | "lower-first" lang=xml:lang-code data-type="text" | "number" /> required attributes none.
... case-order indicates whether upper- or lowercase letters are to be ordered first.
... the allowable values are "upper-first" and "lower-first".
...the allowable values are "text" and "number" with "text" being the default.
An Overview - XSLT: Extensible Stylesheet Language Transformations
« transforming xml with xslt the extensible stylesheet language/transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of netscape's capabilities that follows.
... <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> the xmlns pseudo-attribute maps the shorthand name xsl onto the full namespace for use throughout the document that follows.
...below the root node are its children, which can be elements, comments, processing instructions and so on.
...a fuller description of the parts of xpath most commonly used in xslt follows in the reference section.
Converting WebAssembly text format to wasm - WebAssembly
a first look at the text format let’s look at a simple example of this — the following program imports a function called imported_func from a module called imports, and exports a function called exported_func: (module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i32.const 42 call $i ) ) the webassembly function exported_func is exported for use in our environment (e.g.
...go to https://github.com/webassembly/wabt — follow the instructions on this page to set up the tool.
... next, execute the wat2wasm program, passing it the path to the input file, followed by an -o parameter, followed by the path to the output file: wat2wasm simple.wat -o simple.wasm this will convert the wasm into a file called simple.wasm, which contains the .wasm assembly code.
...try this: wat2wasm simple.wat -v this will give you an output in your terminal in the following way: ...
Interacting with page scripts - Archive of obsolete content
clicking "i will not work" fails, and the following message is logged: permission denied to access property 'greeting' expose functions to page scripts the structured clone algorithm is a bit more powerful than simple json serialization, but not much: in particular, functions aren't cloned.
...see the section below on using postmessage() before firefox 31.
...require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/listen.html", contentscriptfile: data.url("talk.js") }); the "talk.js" content script uses window.postmessage() to send the message to the page: // talk.js window.postmessage("message from content script", "http://my-domain.org/"); the second argument may be '*' which will allow communication with any domain.
Working with Events - Archive of obsolete content
for example, the following add-on registers a listener with the tabs module to listen for the ready event, and logs a string to the console reporting the event: var tabs = require("sdk/tabs"); tabs.on("ready", function () { console.log("tab loaded"); }); it is not possible to enumerate the set of listeners for a given event.
... the following add-on creates a button and assigns a listener to the onclick property of the options object supplied to the button's constructor.
... in the following add-on, we add two listeners to the tabs module's ready event.
context-menu - Archive of obsolete content
if the total number of menu items in the main context menu from all add-ons exceeds a certain number (normally 10 but configurable with the extensions.addon-sdk.context-menu.overflowthreshold preference) all of the menu items will instead appear in an overflow menu to avoid making the context menu too large.
...the example above works because <img> elements can't contain other elements, but in the example below, node.nodename is not guaranteed to be "p" - for example, it won't be "p" if the user context-clicked a link inside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + ...
... targetname the name of the dom element that the menu was invoked on, in lower-case.
url - Archive of obsolete content
for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.hostname); // developer.mozilla.org pathname an initial '/' followed by the path of the url, as a string.
...for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.pathname); // /add-ons hash a '#' followed by the fragment identifier of the url, as a string.
...for example: var url = require("sdk/url").url("https://developer.mozilla.org/add-ons?example=true&visible=yes#top"); console.log(url.protocol); // https: search if any parameters are present, a '?' followed by the parameters of the url, as a string.
util/match-pattern - Archive of obsolete content
for other schemes like file, resource, or data, use a scheme followed by an asterisk, as below.
... example pattern example matching urls example non-matching urls "*.example.com" http://example.com/ http://foo.example.com/ https://example.com/ http://example.com/foo ftp://foo.example.com/ ldap://example.com http://example.foo.com/ a url followed by an asterisk matches that url and any url prefixed with the pattern.
... example pattern example matching urls example non-matching urls "https://foo.com/*" https://foo.com/ https://foo.com/bar http://foo.com/ https://foo.com https://bar.foo.com/ a scheme followed by an asterisk matches all urls with that scheme.
window/utils - Archive of obsolete content
options : object options for the function, with the following properties: name type parent nsidomwindow parent for the new window.
... parameters options : object options for the function, with the following properties: name type url string uri of the document to be loaded into the window.
... options : object options object containing the following property: name type includeprivate boolean whether to include private windows.
Creating annotations - Archive of obsolete content
$('*').mouseenter(function() { if (!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yellow'); $(matchedelement).bind('click.annotator', function(event) { event.stoppropagation(); event.preventdefault(); self.port.emit('show', [ document.location.tostring(), $(ancestor).attr("id"), $(matchedelement).text() ] ); }); }); conversely, the add-on resets the matched element on mouseout: $('*').mouseout(function() { resetmatchedelement...
...activate the annotator by clicking the widget and load a page: the screenshot below uses http://blog.mozilla.com/addons/2011/02/04/ overview-amo-review-process/.
...first, import the panel module: var panels = require('sdk/panel'); then add the following code to the main() function: var annotationeditor = panels.panel({ width: 220, height: 220, contenturl: data.url('editor/annotation-editor.html'), contentscriptfile: data.url('editor/annotation-editor.js'), onmessage: function(annotationtext) { if (annotationtext) { console.log(this.annotationanchor); console.log(annotationtext); } annotationeditor.hide(); ...
Getting Started (jpm) - Archive of obsolete content
open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("http://www.mozilla.org/"); } note that "entry point" def...
...this will bring up a file selection dialog: navigate to the "@my-addon.xpi" file, open it and follow the prompts to install the add-on.
...there's reference documentation for all the high-level and low-level apis in the sdk.
Listening for Load and Unload - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... options.loadreason options.loadreason is one of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade exports.onunload() if your add-on exports a function called onunload(), that function will be called when the add-on is unloaded.
... exports.onunload = function (reason) {}; reason reason is one of the following strings describing the reason your add-on was unloaded: uninstall disable shutdown upgrade downgrade if your add-on is disabled, then uninstalled, your onunload listener will only be called once, with the disable reason.
Logging - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... 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!
...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.
Modifying Web Pages Based on URL - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... a simple code snippet where content script is supplied as contentscript option and url pattern is given as include option is as follows: // import the page-mod api var pagemod = require("sdk/page-mod"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscript: 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";' }); do as follows: create a new directory and naviga...
... below is what you should see.
HTML in XUL for rich tooltips - Archive of obsolete content
dynamic html in xul tooltip insert the appropriate code from below into your xul overlay.
...tooltip(event)" tooltip="myhtmltip" /> <menuitem id="htmltip2" label="foo2" onmouseover="htmltip.onmousetooltip(event)" tooltip="myhtmltip" /> </popup> <popupset id="mainpopupset"> <tooltip id="myhtmltip"> <html:div id="myhtmltipdiv" type="content"/> </tooltip> </popupset> </overlay> insert your version of the following into the javascript overlay.
...our enhanced xul tooltip is an element that is written ahead of time, and it contains an html div element whose type attribute lowers its privileges to being that content element, although it is an element of chrome.
JS XPCOM - Archive of obsolete content
ctor("@mozilla.org/file/local;1", "nsifile", "initwithpath"); var file = new nsfile(filepath); they can also be created and initialized manually: var file = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsifile); file.initwithpath(filepath); this creates a new instance of the object with contract id @mozilla.org/file/local;1 and allows you to call methods from the nsifile interface on it.
...with the preferences service from the previous example we can do the following: var preferences = preferences.queryinterface(components.interfaces.nsiprefbranch2); this allows you to use the methods in the nsiprefbranch2 interface.
... determining which interfaces an xpcom component supports to display a list of all interfaces that an xpcom component supports, do the following: // |c| is the xpcom component instance for each (i in components.interfaces) { if (c instanceof i) { alert(i); } } in this context, instanceof is the same as queryinterface except that it returns false instead of throwing an exception when |c| doesn't support interface |i|.
JavaScript Debugger Service - Archive of obsolete content
in firefox versions prior to gecko 33 (firefox 33 / thunderbird 33 / seamonkey 2.30), the javascript debugger service (or simply jsd) used to be an xpcom component that allows the tracking of javascript while it was being executed in the browser.
...urns false // it is not well-known why debughook sometimes fails to trigger jsd.debughook = { onexecute: function(frame, type, rv) { stacktrace = ""; for (var f = frame; f; f = f.callingframe) { stacktrace += f.script.filename + "@" + f.line + "@" + f.functionname + "\n"; } dump(stacktrace); return components.interfaces.jsdiexecutionhook.return_continue; } }; filters jsd also allows the use of filters to track which scripts should trigger the hooks.
... jsd.clearfilters(); // clear the list of filters // we exclude the scripts with the following filenames from being tracked jsd.appendfilter(createfilter("*/firefox/components/*")); jsd.appendfilter(createfilter("*/firefox/modules/*")); jsd.appendfilter(createfilter("xstringbundle")); jsd.appendfilter(createfilter("chrome://*")); jsd.appendfilter(createfilter("x-jsd:ppbuffer*")); jsd.appendfilter(createfilter("xpcsafejsobjectwrapper.cpp")); jsd.appendfilter(createfilter("file://*")); ...
On page load - Archive of obsolete content
progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
... creating an overlay first, you need to create an overlay to one (or more, depending on which applications you target) of the following xul documents: application uri to overlay firefox chrome://browser/content/browser.xul thunderbird chrome://messenger/content/messenger.xul navigator from seamonkey chrome://navigator/content/navigator.xul attaching a script attach a script to your overlay (see "attaching a script to an overlay") that adds a load event listener to appcontent element (browsers) or messagepane (mail): window.addeventlistener("load", function load(event){ window.removeeventlistener("load", load, false); //remove listener, no longer needed myexten...
... // doc.location is a location object (see below for a link).
View Source for XUL Applications - Archive of obsolete content
the object can include the following properties: url (required) a string url for the document to view the source of.
... 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 retrieved from the network cache.
Windows - Archive of obsolete content
example window.open(); //this open a pop-up window that could be "blocked" client-side //the following code generate an error as describe in the following warning box var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var newwindow = wm.getmostrecentwindow("navigator:browser"); var b = newwindow.gbrowser; the code generate a typeerror from firefox console.
...the following code does not care which element is clicked on, simply responding to all mousedown events equally.
...for example, the following code will add a horizontal rule.
How to convert an overlay extension to restartless - Archive of obsolete content
the resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded script/data).
... a file:// uri to the install location, or .xpi file, is available in installpath property of the bootstrap data structure passed to the startup(), shutdown(), install(), and uninstall() functions in what will be your bootstrap.js file (see below).
...branch : services.prefs; branch.setcomplexvalue(prefname, components.interfaces.nsisupportsstring, string); } just grab the above, move your default preferences file to your chrome mapping, and then do the following line once during your startup: services.scriptloader.loadsubscript("chrome://myaddon/content/defaultprefs.js", {pref:setdefaultpref} ); that's it.
Inline options - Archive of obsolete content
options file the xul allowed for the inline options is limited to a few new tags.
... 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 must also specify the optionstype as 2: <em:optionsurl>chrome://myaddon/content/name_of_my_file_to_use_for_inline_opts.xul</em:optionsurl> <em:optionstype>2</em:optionstype> your chrome.manifest file should contain the following, otherwise the path chrome://myaddon/content/name_of_my_file_to_use_for_inline_opts.xul will not exist content myaddon ./ this method allows you to maintain compatibility with previous versions of firefox by adding an override to your chrome.manifest: ...
Migrating raw components to add-ons - Archive of obsolete content
historically, firefox has allowed third party contributions to be added to the application's components/ directory, but beginning with firefox 3.6, this is no longer permitted.
...the firefox extension mechanism allows you to do everything that you could do through direct component drops, but also gives you and your users extra flexibility and more sophisticated versioning support.
...it allows javascript code to load functions from dlls on windows, and should allow you to eliminate your dependence on binary components entirely.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
someexistingobject.someproperty = "abc"; // we already demonstrated with with functions in a previous example alternative: object.defineproperty() for most objects it is possible to (re-)define properties with the object.defineproperty() api, which allows to not override values, but also lets you define getters and setters.
...consider the following xul fragment throughout the rest of this section.
... alternative: using bracket-access to object properties object properties can always accessed using the bracket syntax: obj["property"] === obj.property hence the following will work just fine without having to resort to eval.
Useful Mozilla Community Sites - Archive of obsolete content
it allows you to upload, search and download all types of add-ons for mozilla applications.
...amo has a review process that prevents malicious, insecure or low quality extensions to make it to the public site.
...just be patient and make sure your extension follows amo's policies when you nominate it.
Security best practices in extensions - Archive of obsolete content
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.
... frame.docshell.allowimages = false; frame.docshell.allowjavascript = false; frame.docshell.allowplugins = false; there are more examples listed in the document listed above in this section.
... non-chrome urls in chrome xul or html such as the following example are not allowed: <script type="text/javascript" src="http://mysite.greatsite.com/js/wow-content.js" /> in general, scripts that are from remote sources that run in the chrome context are not acceptable, as many times the source of the script can never be 100% guaranteed, and they are vulnerable to man-in-the-middle attacks.
Using the Stylesheet Service - Archive of obsolete content
the stylesheet service allows extensions to manage user and ua stylesheets without having to touch usercontent.css or userchrome.css files.
... using the api the string "chrome://myext/content/myext.css" in the examples below is just an example.
... note that ua stylesheets are allowed to do certain unsafe things that user stylesheets are not allowed to do.
Underscores in class and ID Names - Archive of obsolete content
note: browser support for underscores in css has greatly improved since this article was originally published in 2001 and the following recommendation is no longer accurate for most circumstances.
... the css1 specification, published in its final form in 1996, did not allow for the use of underscores in class and id names unless they were "escaped." an escaped underscore would look something like this: p.urgent\_note {color: maroon;} this was not well supported by browsers at the time, however, and the practice has never caught on.
... internet explorer 4.x and 5.x for windows erroneously allowed underscores, and so were both non-conformant on this point until the errata was published.
Creating a dynamic status bar extension - Archive of obsolete content
or, if you've already got the code from the creating a status bar extension sample, you can follow this tutorial to update that existing code with new features.
...the following sections will examine these one by one.
...om the end of the string; // this gets rid of the end-of-line characters output = output.replace(/\w*$/, ''); // build the tooltip string var fieldarray = output.split(','); // assert that fieldarray[0] == 'goog' samplepanel.label = 'goog: ' + fieldarray[1]; samplepanel.tooltiptext = 'chg: ' + fieldarray[4] + ' | ' + 'open: ' + fieldarray[5] + ' | ' + 'low: ' + fieldarray[6] + ' | ' + 'high: ' + fieldarray[7] + ' | ' + 'vol: ' + fieldarray[8]; } } the first thing we do here is get the status bar panel into the variable samplepanel by calling the document.getelementbyid() dom function.
Making a Mozilla installation modifiable - Archive of obsolete content
mozilla's user interface is made up of xul (described below), xbl (a topic for another tutorial), javascript, css, and image files.
...on unix-like operating systems with bash-like shells, you can run the following command within that directory to accomplish this task: for file in *.jar; do unzip $file; done on operating systems with dos-like shells, the following command accomplishes this task: for %file in (*.jar); do unzip %file note that there are platform-specific files — en-mac.jar, en-unix.jar, and en-win.jar — in that directory.
...if you have perl on your system, you can do this with the following command: perl -pi.orig -e 's/(jar:)|(\/[^.\/]+\.jar!)//g' chrome.rdf installed-chrome.txt for example, to convert the url jar:resource:/chrome/comm.jar!/content/necko/, change it to resource:/chrome/content/necko/.
Getting Started - Archive of obsolete content
skin\classic classic contains the following directories.
...you will also have to update the minimum and maximum compatible versions for the target application (seamonkey) in the following section: <em:targetapplication> <description> <!-- seamonkey's uuid --> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>min_sm_version</em:minversion> <em:maxversion>max_sm_version</em:maxversion> </description> </em:targetapplication> establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of se...
...more after i get done with some tests repackaging jar now all you need to do is repackage a jar file with the following directory structure, using your favorite archive manager to create a zip archive: /chrome/my_theme.jar!/communicator/* /chrome/my_theme.jar!/editor/* /chrome/my_theme.jar!/global/* /chrome/my_theme.jar!/help/* /chrome/my_theme.jar!/messenger/* /chrome/my_theme.jar!/messenger-newsblog/* /chrome/my_theme.jar!/mozapps/* /chrome/my_theme.jar!/navigator/* /chrome.manifest /install.rdf /icon.png /pr...
Creating a Microsummary - Archive of obsolete content
in each step of revising the transform sheet and other code in this tutorial, new material added will be shown in boldface so you can follow along more easily.
... for example, if we put the generator file on the web at http://people.mozilla.com/~myk/micro...-generator.xml, and we wanted users to be able to install it from http://people.mozilla.com/~myk/micro...ial/index.html, we might add the following code to the index.html page: <button onclick="window.sidebar.addmicrosummarygenerator('http://people.mozilla.com/~myk/microsummaries/tutorial/sfx-generator.xml')">install the spread firefox home page microsummary!</button> clicking that button will generate a javascript error on browsers that don't support microsummaries, however, so to improve the experience for those users, we should chec...
...we might do so via the following code: <script> const warning = "sorry, you need a microsummary-enabled browser like firefox 2.0 to install and use microsummary generators."; function addgenerator(url) { if (typeof window.sidebar == "object" && typeof window.sidebar.addmicrosummarygenerator == "function") window.sidebar.addmicrosummarygenerator(url); else alert(warning); } </script> <button onclick="addgenerator('http://people.mozilla.com/~myk/microsummaries/tutorial/sfx-generator.xml')">install the spread firefox home page microsummary!</button> note that due to bug 341283, addmicrosummarygenerator() will not accept a relative url.
In-Depth - Archive of obsolete content
mozilla css properties mozilla.org created their own css properties to allow them to use the technology for the ui of mozilla.
... all of the properties follow the w3c's standards for vendor extensions, which is why they all begin with -moz.
...what appears in a tree view below is the actual code for the interface.
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
skin\classic classic contains the following directories.
... you will also have to update the minimum and maximum compatible versions for the target application (firefox) in the following section: <em:targetapplication> <description> <!-- firefox's uuid --> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minversion>min_ff_version</em:minversion> <em:maxversion>max_ff_version</em:maxversion> </description> </em:targetapplication> establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of fi...
... repackaging jar now all you need to do is repackage a jar file with the following directory structure, using your favorite archive manager to create a zip archive: /browser/* /communicator/* /global/* /help/* /mozapps/* /contents.rdf /install.rdf /icon.png /preview.png make sure not to just zip up the my_theme parent directory since that will cause the drag and drop install in the next section to fail without error messages.
Using microformats - Archive of obsolete content
microformats allow web sites to provide semantic data to the browser in order to make it possible to present summaries of the information on a page without having to know how to parse the document itself.
...if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search.
...if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames that reference external content are included in the search.
importUserCertificates - Archive of obsolete content
if the string is null and no certificate with the same dn exists in the user's certificate store, personal security manager uses the following pattern to derive the nickname: <tt><common name>'s <issuer name> id</tt>.
...it allows the ca or ra to indicate to the client whether to force the user to back up a newly issued certificate (pkcs #12).
...if it fails, one of the following error strings will be returned: error string description "error:usercancel" the user canceled the import operation "error:invalidcertificate" one of the certificate packages was incorrectly formatted "error:internalerror" the software encountered some internal error, such as out of memory "error:invalidrequestid" the request id in the...
popChallengeResponse - Archive of obsolete content
see below for the current implementation.
... the resultstring will either be a base-64 encoded popodeckeyrespcontent message, or one of the following error strings: error string description "error:invalidparameter:xxx" the parameter xxx was an invalid value.
... this will allow -- the client to find the appropriate key to do the decryption.
LIR - Archive of obsolete content
lir stands for low-level intermediate representation.
...bit truncate quad to int (removes the high 32 bits) 111 i2d double convert int to double 112 ui2d double convert unsigned int to double 113 d2i integer convert double to int (no exceptions raised) 114 dasq quad 64 bit interpret the bits of a double as a quad 115 qasd double 64 bit interpret the bits of a quad as a double overflow arithmetic 116 addxovi integer add int and exit on overflow 117 subxovi integer subtract int and exit on overflow 118 mulxovi integer multiply int and exit on overflow 119 addjovi integer add int and branch on overflow 120 subjovi integer subtract int and branch on overflow 121 muljovi integer multiply int and branc...
...h on overflow 122 addjovq quad 64 bit add quad and branch on overflow 123 subjovq quad 64 bit subtract quad and branch on overflow softfloat 124 dlo2i integer softfloat get the low 32 bits of a double as an int 125 dhi2i integer softfloat get the high 32 bits of a double as an int 126 ii2d double softfloat join two ints (1st arg is low bits, 2nd is high) 127 hcalli integer lir_hcalli is a hack that's only used on 32-bit platforms that use softfloat.
Porting NSPR to Unix Platforms - Archive of obsolete content
you can build the <tt>gencfg</tt> tool as follows: cd mozilla/nsprpub/pr/include gmake gencfg gencfg > foo.bar then you use the macro values in <tt>foo.bar</tt> as a basis for the <tt>_xxxos.cfg</tt> file.
... <tt>mozilla/nsprpub/pr/src/md/unix/netbsd.c</tt> you need to modify the following existing files: <tt>mozilla/nsprpub/pr/include/md/makefile</tt> <tt>mozilla/nsprpub/pr/include/md/_unixos.h</tt>: just fix the compiling errors, usually pointed out by the <tt>#error</tt> preprocessor directives we inserted.
...tt>mozilla/nsprpub/pr/include/md/prosdep.h</tt> <tt>mozilla/nsprpub/pr/src/md/prosdep.c</tt> <tt>mozilla/nsprpub/pr/src/md/unix/makefile</tt> <tt>mozilla/nsprpub/pr/src/md/unix/objs.mk</tt> <tt>mozilla/nsprpub/pr/src/md/unix/unix.c</tt>: just fix the compiling errors, usually pointed out by the <tt>#error</tt> preprocessor directives we inserted for a pthreads port, you need to modify the following files: <tt>mozilla/nsprpub/pr/include/md/_pth.h</tt> files in 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>.
Proxy UI - Archive of obsolete content
(wpad) network.proxy.type=4 manual proxy configuration (manual) network.proxy.type=1 automatic proxy configuration url (pac) network.proxy.type=2 manual manual allows the entry of a proxy server hostname name and server.
...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...
...selecting an enabled item sets the menu selection and the proxy mode (network.proxy.type) selecting a disabled item is not allowed.
RDF Datasource How-To - Archive of obsolete content
the first question that you must answer is "should i use an existing vocabulary, or invent my own?" a reasonable answer is, "use an existing vocabulary unless you absolutely must invent your own." this will allow your datasource to be integrated with other datasources with a minimum of effort.
...for example, the above datasource would be accessable as follows: nsirdfservice* rdf; rv = nsservicemanager::getservice(krdfservicecid, kirdfserviceiid, (nsisupports**) &rdf); if (ns_succeeded(rv)) { nsirdfdatasource* mydatasource; rv = rdf->getdatasource("rdf:my-datasource", &mydatasource); if (ns_succeeded(rv)) { // ...do something to mydatasource here...
...the following xul fragment illustrates how to instantiate a tree control whose body is "rooted" to a resource (http://foo.bar.com/) that your datasource describes: <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/tr/wd-rdf-syntax#" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <tree datasources="rdf:my-datasource" ref="http://foo.bar.com/"> <templa...
Frequently Asked Questions - Archive of obsolete content
to be valid the root <svg> tag in svg files must have at least the following two "namespace bindings".
...this is (almost certainly) because the 'xmlns:xlink' attribute has been used in the file without including the following two namespace bindings on the root <svg> tag.
... there are reports that it does, but that it's slower than the adobe plug-in.
SpiderMonkey coding conventions - Archive of obsolete content
naming conventions public function names begin with js_ followed by capitalized "intercaps", e.g.
... but static native methods of js objects have lowercase, underscore-separated or intercaps names, e.g., str_indexof.
... scalar type names are lowercase and js-prefixed: jsdouble.
Table Cellmap - Archive of obsolete content
in this low level cellmap the row count begins every time with 0.
...below follows the dump for the 2x2 table.
...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.
Table Layout Regression Tests - Archive of obsolete content
execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
...++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\html\tests\block\rtest.lst.
...++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 verify test for e:\moz_src\mozilla\layout\html\tests\block\rtest.lst.
Actionscript Acceptance Tests - Archive of obsolete content
7093 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 placed in a _support dir (see additional files below).
...below is a sample file that covers the 4 main us timezones: # place all timezones that this file applies to.
... if you do not wish to have shell.as included when compiling, you must create a dir.asc_args file with an override parameter: # the following line will override all compile arguments and just compile a .as file with -import builtin.abc override| ...
Running Tamarin acceptance tests - Archive of obsolete content
to run acceptance tests on the android shell see the "testing the android shell" heading below.
... running the tamarin test suite requires the following steps: set the avm environment variable to the path of the avmplus executable (avmshell).
...for help on runtests.py options, see below or use python runtests.py -h.
Tamarin Build System Documentation - Archive of obsolete content
the page is divided into the phase table at the top and the waterfall table below the phase table shows all phases at the top of the page, each slave is shown as a box with a red,green, or yellow color: red means failed, green passed, and yellow has warnings.
...compile, smoke, or test to show the build slaves from the most recent phase run or click on an individual box to display the test result below the phase table the waterfall displays each buildstep and result the left side contains the time column and the user/revision link to represent the revision triggering a build, mouse over the user to see the revision and submission notes each buildstep run on a slave is a box with color indicating status, red is failed, green passed, yellow has warnings click the stdio link to see the output click on the build yellow box at the bottom of a set of buildsteps to see the result of all of the buildsteps for a build and the time each buildstep took scroll down to see previous builds triggered a...
... the list of smoke tests are located in the tamarin-repository, test/run-smokes.txt, assume the start directory is test format is cd testdir; command to run test above the test should be a # comment describing why the test in the smokes, when test failed, possibly a bugzilla bug the tests can be run by following the above instructions for running buildbot scripts locally and executing the all/run-smoke-tests.sh as a rule any test failure should be immediately added to the top of the smoke test list so the list is prioritized how to exclude tests from acceptance or mark them as known failures?
Using gdb on wimpy computers - Archive of obsolete content
if you don't allow those libraries to be loaded then gdb will not be able to properly debug threads on linux.
...from there you can allow the program to continue running.
...versions of gdb earlier than 5 use a very slow algorithm for walking the list of already loaded symbols as it adds symbols to its symbol table.
Venkman - Archive of obsolete content
this allows the user interface be written in javascript and xul, which allows venkman to be fully cross-platform.
... source code the source code for venkman may be found in mercurial at the following url: http://hg.mozilla.org/venkman/summary community view mozilla forums...
... mailing list newsgroup rss feed irc: #venkman on irc.mozilla.org report a bug in venkman if you find a problem with venkman, please follow directives mentioned at venkman faq section 5.4 and then you may report a bug on javascript debugger component.
Binding Implementations - Archive of obsolete content
the following is currently not implemented in mozilla, it seems.
... note: the following paragraphs suggest a syntax for how javascript might enable access to base class methods and properties.
... for example, given a binding with an implementation colorpickergrid that derives from an implementation colorpicker where the two implementations both specify the setcolor method, a caller could invoke colorpicker's method with the following syntax: ...
Install script template - Archive of obsolete content
/** doron rosenberg -- doronatnospamallowedherenetscape.com arun k.
... ranganathan -- aruneratnospamallowedherenetscape.com petter ericson -- petteratnospamallowedherecycore.com this is an install.js file that does the following -- 1.
... the keys are written according to the specification: http://mozilla.org/projects/plugins/first-install-problem.html and follows the plid specification: http://mozilla.org/projects/plugins/plugin-identifier.html **/ // define some global variables var plugin_file = "npmyplugin.dll"; // this plugin consists of an xpt file because it is scriptable // http://mozilla.org/projects/plugins/scripting-plugins.html var component_file = "npmypluginscriptable.xpt"; var plugin_size = 2000; // (dll file) reserve a lit...
compareTo - Archive of obsolete content
method of installversion object syntax compareto ( installversion version); compareto ( string version); compareto ( int major, int minor, int release, int build); parameters the compareto method has the following parameters: maj the major version number.
...in particular, this method returns one of the following values: -4 this version object has a smaller (earlier) major number than version.
... the following constants are defined and available for checking the value returned by compareto: installversion.major_diff installversion.minor_diff installversion.rel_diff installversion.bld_diff installversion.equal installversion.major_diff_minus installversion.minor_diff_minus installversion.rel_diff_minus installversion.bld_diff_minus exam...
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.
... be aware that the parameter specifies the file within the xpi and not on the file system, as the following example demonstrates.
... the following lines retrieve the properties as a javascript object and make the values accessible with the familiar "dot property" syntax: reseg2obj = loadresources("bin/res_eg_2.properties"); dump( reseg2obj.title ) ...
textbox.type - Archive of obsolete content
« xul reference home type type: one of the values below you can set the type attribute to one of the values below for a more specialized type of textbox.
...for more information about autocomplete textboxes, see the autocomplete documentation (xpfe [thunderbird/seamonkey]) (firefox) number a textbox that only allows the user to enter numbers.
...there are several attributes that allow the number textbox to be configured, including decimalplaces, min, max, increment, wraparound, hidespinbuttons, and textbox.value.
Building accessible custom components in XUL - Archive of obsolete content
role declarations are a little confusing at first glance, but they all follow the same pattern.
...the start_edit function replaces the label with a textbox, which allows the user to change the cell value.
...this would allow xul developers to add a single spreadsheet element to their xul applications (for example), with rowheader, columnheader, and cell elements as children, without requiring them to manage the accessibility support for each spreadsheet control.
Deprecated and defunct markup - Archive of obsolete content
{many elements on this page are wrongly marked as deprecated, this page needs review} the following xul tags and attribute should be considered deprecated, if not defunct.
... the list below may include a few elements which are actually in use, but at a deeper level in the code.
... even some of the information on the tags below may be out of date, but is provided here for historical reference and to help anyone who comes across them in old code or documentation.
IO - Archive of obsolete content
ArchiveMozillaXULFileGuideIO
the following example will retrieve a reference to a file located in the profile directory named sample.txt.
...open and save dialogs you can show a dialog to the user to allow them to select a file to open or enter a filename for saving.
...for instance, in the following example, a subdirectory is retrieved.
Moving, Copying and Deleting Files - Archive of obsolete content
this allows an entire directory and its contents to be copied from one location to another.
...the following example moves a file 'myfile.txt' in the user's home directory into the temporary directory.
...for instance, the following example renames a file within the same directory: file.moveto(null, "hello.txt"); if the destination file already exists, nsifile.moveto() replaces the existing file.
loadOneTab - Archive of obsolete content
« xul reference home loadonetab( url, referreruri, charset, postdata, loadinbackground, allowthirdpartyfixup ) loadonetab( url, { referreruri: ..., charset: ..., postdata: ..., inbackground: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
...this method works the same as addtab except for the loadinbackground parameter which allows you to choose whether to open the new tab in foreground or background.
... firefox 3.6 note the second form of this method was added in firefox 3.6; it adds the relatedtocurrent parameter, and allows the parameters to be specified by name, in any order.
MoveResize - Archive of obsolete content
for instance, the following example will move a popup to the upper left corner of the screen: popup.moveto(0, 0); the position may be shifted so as not to cover user interface elements provided by the operating system, such as the menu bar or the task bar.
...for instance, instead of appearing below the menu label, the menu popup might appear above the label.
...arrows will appear on the ends of the menu to allow a user to scroll through the items.
PopupKeys - Archive of obsolete content
this allows items within the menu to be navigated with the cursor keys.
... the following table lists the keys that are checked, and what the menu keyboard listener does in response: cursor up/down move the highlight within the menu up or down, wrapping around if necessary.
...this allows the focus to be shifted to elements within the panel.
Building Trees - Archive of obsolete content
however, the content builder becomes slower as the amount of data increases.
...for instance, consider the following css: treechildren::-moz-tree-cell(dave) { background-color: lightgreen; } this would set the background color of a cell to green for any cell with the “dave” property.
...object="?country"/> <triple subject="?country" predicate="http://purl.org/dc/elements/1.1/title" object="?countrytitle"/> </query> <action> <treechildren> <treeitem uri="?photo"> <treerow properties="?countrytitle"> <treecell src="?photo"/> </treerow> </treeitem> </treechildren> </action> </rule> you might use the following css to change the border around rows listing a particular country: treechildren::-moz-tree-row(netherlands) { border: green 1px solid; } the result of this example is a tree where one row has a green border around it.
Containment Properties - Archive of obsolete content
this allows you to iterate over a non-container.
...effectively, the containment attribute allows you to specify additional predicates that provide children.
...for example, the following is equivalent to the previous example, except that the full query syntax is used.
Simple Example - Archive of obsolete content
this will result in the following: <member container="http://www.xulplanet.com/rdf/myphotos" child="?photo"/> as with processing a triple, the builder will now try to find as many values for the ?photo variable as possible and create potential results using them.
...in the end, the network will contain the following data: (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/palace.jpg, ?title = 'palace from above') (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/canal.jpg, ?title = 'canal') (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ...
...the action body might look like the following, which displays the image using its url and title in a label.
Simple Query Syntax - Archive of obsolete content
at its simplest, the simple query syntax is equivalent to the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> </query> the template builder uses the simple query syntax whenever a template does not have a <query> element.
...it is still possible to do filtering using simple query and we'll look at this below.
...it allows you to filter for results that have certain predicates with specific values.
The Joy of XUL - Archive of obsolete content
the key features and benefits of xul will be explored followed by an examination of supporting mozilla technologies.
...the work flow of these interdependent activities is more easily coordinated than with html-based web applications, with less impact on the overall stability and quality of the system.
...xpconnect allows javascript objects to transparently access and manipulate xpcom objects.
Creating a Wizard - Archive of obsolete content
buttons appear at the bottom of the dialog to allow navigation between pages.
...this allows you to validate the input entered on each page before the user continues.
...the following is a summary of attribute functions that are called when the user presses next, in the order that they will be checked.
Groupboxes - Archive of obsolete content
a simple groupbox example the example below shows a simple groupbox: example 1 : source view <groupbox> <caption label="answer"/> <description value="banana"/> <description value="tangerine"/> <description value="phone booth"/> <description value="kiwi"/> </groupbox> this will cause four pieces of text to be displayed surrounded by a box with the label answer.
...the additional checkbox appears below the textbox because of the vertical orientation of the groupbox.
...this could be used to add extra elements within the structure, such as in the following example: example 3 : source view <radiogroup> <radio id="no" value="no" label="no number"/> <radio id="random" value="random" label="random number"/> <hbox> <radio id="specify" value="specify" label="specify number:"/> <textbox id="specificnumber"/> </hbox> </radiogroup> note that the radiogroup element does not draw a border around it.
More Menu Features - Archive of obsolete content
the example below creates a simple submenu inside the file menu example 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menu id="new-menu" label="new"> <menupopup id="new-popup"> <menuitem label="window"/> <menuitem label="message"/> </menupopup> </menu> ...
...the example below creates a menu with a checked item.
...the example below demonstrates this: example 3 : source view <toolbox> <menubar id="planets-menubar"> <menu id="planet-menu" label="planet"> <menupopup> <menuitem id="jupiter" label="jupiter" type="radio" name="ringed"/> <menuitem id="saturn" label="saturn" type="radio" name="ringed" checked="true"/> <menuitem id="uranus" label="uranus" type="radio" name="ringed"/> <menu...
Persistent Data - Archive of obsolete content
xul allows you to save the state of any element.
...persist attribute to allow the saving of state, you simply add a persist attribute to the element which holds a value you want to save.
...for example, to save the size of a window, you would do the following: <window id="somewindow" width="200" height="300" persist="width height" .
Stacks and Decks - Archive of obsolete content
they are all special types of boxes and allow all of the attributes of boxes on them.
...the first child of the stack is drawn underneath, the second child is drawn next, followed by the third and so on.
...for example, you could create an effect similar to the text-shadow property with the following: example 1 : source view <stack> <description value="shadowed" style="padding-left: 1px; padding-top: 1px; font-size: 15pt"/> <description value="shadowed" style="color: red; font-size: 15pt;"/> </stack> both description elements create text with a size of 15 points.
Tree Box Objects - Archive of obsolete content
this makes it easy to pass event coordinates directly to these functions, as in the following example of the getcellat() function.
... the following line is used so that the example above will work in all versions.
...it takes seven arguments, as described below.
Tree Selection - Archive of obsolete content
the syntax of the onselect() event handler is shown below.
...multiple selection for trees that allow multiple selection, getting the list of selected rows is a bit more complicated.
...for example, the following code will select the row at index 5: tree.view.selection.select(5); note that you should not just change the tree's currentindex property to change the selection.
Tree View Details - Archive of obsolete content
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.
...the code above uses a brute force method which simply iterates over the rows looking for one, returning true if a row exists with the same level and false once it finds a row that has a lower level.
... the following code is used to delete rows when a row is closed.
XUL Changes for Firefox 1.5 - Archive of obsolete content
a set of icons will appear across the top of the dialog allowing the user to switch panels.
... <menulist> items in a <menulist> support the description attribute to allow for extra descriptive text to appear beside an item's label.
... draggable tabs the tabbrowser now allows the user to rearrange tabs by dragging them.
XUL Template Primer - Bindings - Archive of obsolete content
we'll use a the following data model to illustrate how bindings work.
... see the rdf/xml file friends.rdf, below, a simple database with name and address information for some of my good friends.
...ource="#doghouse"/> </rdf:description> </rdf:li> <rdf:li> <rdf:description nc:name="lumpy"/> </rdf:li> </rdf:seq> </nc:friends> </rdf:description> <rdf:description id="home" nc:street="437 hoffman"/> <rdf:description id="doghouse" nc:street="435 hoffman"/> </rdf:rdf> the rdf model that this file creates can be represented with the following graph.
action - Archive of obsolete content
variables are a question mark followed by a name.
... 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, tooltipte...
...xt, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelement...
arrowscrollbox - Archive of obsolete content
attributes clicktoscroll, disabled, smoothscroll, tabindex properties disabled, scrollboxobject, scrollincrement, smoothscroll, tabindex methods ensureelementisvisible, scrollbyindex, scrollbypixels examples <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yellow"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/> <button label="turquoise"/> <button label="peach"/> <button label="maroon"/> <button label="black"/> </arrowscrollbox> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, contex...
... the disabled attribute is allowed only for form controls.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width disabled type: boolean ...
checkbox - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
colorpicker - Archive of obsolete content
the disabled attribute is allowed only for form controls.
...a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
... the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascript"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </script> <textbox id="find-text" onchange="return myfunction(event);"/> </window> preference type: id connects the element to a corresponding preference.
command - Archive of obsolete content
see also: command attribute, commandset element attributes disabled, label, oncommand,reserved examples the following code will send a paste command (cmd_paste) to the currently focused element: // first include chrome://global/content/globaloverlay.js godocommand("cmd_paste"); example with two buttons <commandset><command id="cmd_openhelp" oncommand="alert('help');"/></commandset> <button label="help" command="cmd_openhelp"/> <button label="more help" command="cmd_openhelp"/> attributes disabled ...
... the disabled attribute is allowed only for form controls.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
datepicker - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a datepicker allows the user to enter a date.
... the disabled attribute is allowed only for form controls.
... type type: one of the values below you can set the type attribute to one of the values below to specify the type of datepicker to use normal a datepicker with three fields for entering the year, month and date.
dialogheader - Archive of obsolete content
examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <dialogheader title="my dialog" description="example dialog"/> <!-- other widgets --> </dialog> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } description type: string descriptive text to appear in addition to the dialog title.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattr...
editor - Archive of obsolete content
to enable editing on an editor, do either of the following: set the src attribute on the editor after the outer window has loaded, for example, in the onload handler.
... attributes editortype type: one of the values below the type of editor to use.
... editortype type: one of the values below the type of editor to use.
image - Archive of obsolete content
ArchiveMozillaXULimage
validate type: one of the values below this attribute indicates whether to load the image from the cache or not.
...the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded.
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(),...
keyset - Archive of obsolete content
attributes disabled examples <keyset> <key id="sample-key" modifiers="shift" key="r"/> </keyset> 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, sortd...
... the disabled attribute is allowed only for form controls.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
listhead - Archive of obsolete content
the disabled attribute is allowed only for form controls.
... 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener...
listheader - Archive of obsolete content
the disabled attribute is allowed only for form controls.
... 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
preferences - Archive of obsolete content
note: it's not clear which of the following methods and properties are public.
... 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods void firechangedevent(in domelement preference); creates and dispatches a changed (non-bubbling) event to the specified preference element.
progressmeter - Archive of obsolete content
mode type: one of the values below a determinedprogressmeter is used in cases where you know how long an operation will take.
... 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
radiogroup - Archive of obsolete content
tes disabled, focused, preference, tabindex, value properties accessibletype, disabled, focuseditem, itemcount, selectedindex, selecteditem, tabindex, value methods appenditem, checkadjacentelement, getindexofitem, getitematindex, insertitemat, removeitemat examples <radiogroup> <radio id="orange" label="red"/> <radio id="violet" label="green" selected="true"/> <radio id="yellow" label="blue"/> </radiogroup> attributes disabled type: boolean indicates whether the element is disabled or not.
... the disabled attribute is allowed only for form controls.
... value type: string the string attribute allows you to associate a data value with an element.
rows - Archive of obsolete content
ArchiveMozillaXULrows
however, nesting rows elements allows groups of rows to have a separate appearance such as a different border, or separate scrolling may be defined for these rows.
... attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait...
...-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), ge...
toolbar - Archive of obsolete content
the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer".
... mode not in seamonkey 1.x type: one of the values below how the toolbarbuttons on the toolbar are displayed.
...for spacers, separators, and flexible spacers the following strings are used instead of ids: "spacer", "separator", "spring".
where - Archive of obsolete content
ArchiveMozillaXULwhere
rel type: one of the values below the type of comparison to perform.
... 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
wizard - Archive of obsolete content
set to false to disallow moving to the next page.
...set to false to disallow moving to the previous page.
...the pageid argument allows you to specify the index of the page to which to jump.
XUL Explorer - Archive of obsolete content
double-click or drag-and-drop to insert a snippet file > new allows user to pick any “template” snippet, as well as blank.
...it checks for legal element and attribute names, including allowed attributes for a given element.
...e” checks such as: using of commands and keys, strings in dtds and so on - xul checker multi-tabbed editor support support wizards to generate common projects - extensions support extension testing using firefox extension test mode venkman support dom inspector support future: support more “best practice” checks such as: more a11y checks, strings in dtds and so on - xul checker allow users to add snippets on the fly add sidebars for more functionality - property sidebar and project sidebar support wizards to generate common projects - xul files, js xpcom, and xulrunner applications for more detailed information, see the xul_explorer:planning#feature_planning_for_xul_explorer.
application/http-index-format specification - Archive of obsolete content
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.
...all lines must be terminated by a carriage return followed by a line feed.
... file-type one of the following keywords to represent a special status for a file: file directory symbolic-link sym-file (a symbolic link to a file) sym-directory (a symbolic link to a directory) permissions unix type file permission syntax.
2006-11-10 - Archive of obsolete content
this feature consists of creating buttons using a small program, that allows you to create shortcuts to a particular address.
... reflow branch build failed with vc 7.1 sp1 november 8th: roy received an error when he tried to reflow a branch build using vc 7.1 sp1.
... 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 error: /usr/bin/ld: testtarray.o(.text+0x2237): unresolvable relocation against symbol `nstarray_base::semptyhdr' /usr/bin/ld: final link failed: nonrepresentable section on output collect2: ld returned 1 exit status gma...
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.builds - november 10th to november 17th 2006 how to build in yellowdog linux 4.1?
... november 11th: bryan wellander is trying to build mozilla 1.7.13 using yellowdog linux 4.1.
... however he has been unsuccessful and gets the following errors: checking for gtk - version >= 1.2.0...
2006-11-03 - Archive of obsolete content
summary: mozilla.dev.tech.layout - october 28 - november 3, 2006 announcements new reflow branch off of trunk l.
... david baron announced that he merged the reflow branch to a new branch (reflow_20061031_branch) off of the trunk.
... perf question (reflow branch) a look into bug #352367 and the mention of possibly reducing the number of times nsframe::intrinsicwidthoffsets is called for each cell within a table.
NPN_GetURL - Archive of obsolete content
syntax #include <npapi.h> nperror npn_geturl(npp instance, const char* url, const char* target); parameters the function has the following parameters: instance pointer to the current plug-in instance.
... target name of the target window or frame, or one of the following special target names.
...the following recommendations about target choice apply to other methods that handle urls as well.
NPN_SetValueForURL - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary 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.) syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_setvalueforurl(npp instance, npnurlvariable variable, const char *url, const char *value, uint32_t len); parameters this function has the following parameters: instance pointer to the current plug-in instance.
... description this entry point is designed to allow plugins to affect the cookies sent by the browser back to the server.
NPP_SetWindow - Archive of obsolete content
syntax #include <npapi.h> nperror npp_setwindow(npp instance, npwindow *window); parameters the function has the following parameters: instance pointer to the current plug-in instance.
...the window structure contains a window handle and values for top left corner, width, height, and clipping rectangle (see note on unix below).
... description the browser calls npp_setwindow after creating the instance to allow drawing to begin.
NPP_WriteReady - Archive of obsolete content
syntax #include <npapi.h> int32 npp_writeready(npp instance, npstream* stream); parameters the function has the following parameters: instance pointer to the current plug-in instance.
...this function allows the browser to send only as much data to the instance as it can handle at one time, making resource use more efficient for both the browser and plug-in.
...if the browser receives a value of zero, the data flow temporarily stops.
NPVariant - Archive of obsolete content
syntax typedef struct _npvariant { npvarianttype type; union { bool boolvalue; int32_t intvalue; double_t doublevalue; npstring stringvalue; npobject *objectvalue; } value; } npvariant; fields the data structure has the following fields: type a member of the npvarianttype enumeration specifying the data type contained in the npvariant.
... javascript type to npvarianttype enumeration mapping when using npvariants to access javascript objects in the browser, or vise versa, the mapping of javascript values to npvariants is as follows: javascript type npvarianttype undefined npvarianttype_void null npvarianttype_null boolean npvarianttype_bool number npvarianttype_int32 or npvarianttype_double string npvarianttype_string all other types npvarianttype_object functions npn_releasevariantvalue() npn_getstringidentifier(...
...) npn_getstringidentifiers() npn_getintidentifier() npn_identifierisstring() npn_utf8fromidentifier() npn_intfromidentifier() macros plugin developers are not expected to directly manipulate or access the members of the npvariant instance, instead, the function npn_releasevariantvalue(), and the following macros are provided: npvariant_is_void() evaluates to true if v is of type npvarianttype_void.
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
plugin packages should only need to package a small set of files in the following structure in the xpi file: install.rdf plugins/ pluginlib.dll plugintypes.xpt the install.rdf file contains an install manifest that describes the plugin to the user.
...in the xpi you can use the following structure: platform/ linux_x86-gcc3/ plugins/ libplugin.so darwin_ppc-gcc3/ plugins/ libplugin.dylib more specific information can be found in the platform-specific subdirectories documentation.
...this allows a remote update file to be read periodically and an updated version of the plugin offered to the user or to mark the plugin as compatible with a wider range of applications.
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
more information is included on this below.
... hosting using gtk2.x included below are a couple of code snippits that should help you get started as well as some hints on building a successful plugin.
... please use the following diagram as a reference: as you can see from the diagram above, it's pretty easy to set up a plugin using gtk2.
Proposal - Archive of obsolete content
rss proposal list below is a list of proposals people or companies have made for rss.
... note: those in the list below that are marked "in development" should not be implemented.
...draft exists source guid when an rss item is posted in response to a previous item (called the source item) rss 2.0 offers the source element which allows the item to refer to the rss feed which contains the source item.
SAX - Archive of obsolete content
to create one, use the following code: var xmlreader = components.classes["@mozilla.org/saxparser/xmlreader;1"] .createinstance(components.interfaces.nsisaxxmlreader); after you created the sax parser, you need to set the handlers for the events you're interested in and fire off the parsing process.
...the following handlers are available: interface purpose nsisaxcontenthandler receive notification of the logical content of a document (e.g.
...below is an example of parsing from a string: xmlreader.parsefromstring("<f:a xmlns:f='g' d='1'><bbq/></f:a>", "text/xml"); this call results in the following output (assuming the content handler from the example above is used): startdocument startelement: namespace='g', localname='a', qname='f:a', attributes={d='1'} startelement: namespace='', localname='bbq', qname='bbq', attributes={} endelement...
Using IO Timeout And Interrupt On NT - Archive of obsolete content
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.
... limitations this seemingly harsh way to force the completion of outstanding overlapped io request has the following limitations: it is difficult for threads to shared a file descriptor.
...following the rule of thumb, both threads would close the socket.
Browser Feature Detection - Archive of obsolete content
browser sniffing via api name detection the following tables list the api names defined for specific w3c dom apis and lists the percentage of names that your browser actually defines followed by a list of each of the api names tested along with an indication of whether the name was defined for your browser.
... 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 pause true false true pauseafter true false true pausebefore true false true pitch true false false pitchran...
...me: '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: 'pause', 'supported': false}, {name: 'pauseafter', 'supported': false}, {name: 'pausebefore', 'supported': false}, {name: 'pitch', 'supported': false}, {name: 'pitchrange', 's...
-ms-content-zoom-limit - Archive of obsolete content
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.
...smaller values zoom out.-ms-content-zoom-limit-min: the smallest allowed zoom factor.
...smaller values zoom out.computed valueas each of the properties of the shorthand:-ms-content-zoom-limit-max: as specified-ms-content-zoom-limit-min: as specifiedanimation typediscrete syntax the -ms-content-zoom-limit shorthand property is specified as one or both of the following content zoom limit values, in order, separated by spaces.
-ms-hyphenate-limit-chars - Archive of obsolete content
initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto corresponds to a value of 5 2 2, indicating a 5-character word limit, 2 characters required before a hyphenation break, and 2 characters required following a hyphenation break.
... <integer>{1,3} one to three integer values, corresponding to the word limit, the minimum number of characters required before a hyphenation break, and the minimum number of characters required following a hyphenation break, respectively.
... negative values are not allowed.
-ms-ime-align - Archive of obsolete content
ime candidate lists are positioned on the screen with sufficient size to allow basic text input.
... in the case of -ms-ime-align: after, an ime might adjust the candidate window and keyboard input behavior to provide a better user experience, such as using a horizontal candidate list and allowing some keys to be sent to the app for suggestion list navigation.
... after the ime should attempt to align the candidate window below the element (in left-to-right and right-to-left layouts).
-ms-scroll-snap-points-x - Archive of obsolete content
snapinterval( <length-percentage>, <length-percentage> ) specifies a starting snap-point followed by the interval between all snap-points.
...(the -ms-scroll-snap-points-x property behaves identically to the -ms-scroll-snap-points-y property, but along the x-axis.) .container { overflow-x: auto; overflow-y: hidden; -ms-scroll-snap-type: mandatory; -ms-scroll-snap-points-x: snapinterval(0%, 100%); width: 480px; height: 270px; } .imagecontainer { -ms-scroll-chaining: chained; -ms-overflow-style: none; -ms-content-zooming: zoom; -ms-scroll-rails: none; -ms-scroll-limit-x-min: 100%; -ms-scroll-limit-x-max: 500%; -ms-scroll-snap-type: proximity; -ms-scroll-...
...snap-points-x: snaplist(100%, 200%, 300%, 400%, 500%); -ms-overflow-style: none; width: 480px; height: 270px; overflow: auto; } specifications not part of any specification.
-ms-scrollbar-arrow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to use -ms-scrollbar-arrow-color and -ms-scrollbar-face-color to display a scroll bar with a blue scroll box and arrows, and a scroll bar with a green scroll box and arrows.
... div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> <div class="bluescrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
... </div> </body> the following image shows the result: specifications not part of any specification.
ArrayBuffer.transfer() - Archive of obsolete content
description the arraybuffer.transfer() method allows you to grow and detach arraybuffer objects.
...(buf1)[0] = 42; var buf2 = arraybuffer.transfer(buf1, 80); buf1.bytelength; // 0 but if you use the polyfill then the value is still 40 buf2.bytelength; // 80 new int32array(buf2)[0]; // 42 var buf3 = arraybuffer.transfer(buf2, 0); buf2.bytelength; // 0 but if you use the polyfill then the value is still 80 buf3.bytelength; // 0 polyfill you can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of transfer() in browsers that do not natively support it.
... this is not the exact equivalent of this api because browsers that natively support it are be able to internally use the c++ function realloc() which extends the length of the memory and only copies it to a new location as-needed as opposed to the following pollyfill which always copies the whole thing to a new space of memory, but this function transfers data from one arraybuffer to another arraybuffer.
Debug.setNonUserCodeExceptions - Archive of obsolete content
example the following code shows how to set this property.
... } })(); requirements supported in the following document modes: internet explorer 10 standards and internet explorer 11 standards.
... not supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards.
Debug.writeln - Archive of obsolete content
the debug.writeln function sends strings to the script debugger, followed by a newline character.
... remarks the debug.writeln function sends strings, followed by a newline character, to the immediate window of the microsoft script debugger at run time.
... var counter = 42; debug.writeln("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
VBArray.toArray - Archive of obsolete content
for example, a vbarray with three dimensions and three elements in each dimension is converted into a javascript array as follows: suppose the vbarray contains: (1, 2, 3), (4, 5, 6), (7, 8, 9).
... example the following example consists of three parts.
...rray = a end function --> </script> <script type="text/javascript"> <!-- function vbarraytest(vbarray) { var a = new vbarray(vbarray); var b = a.toarray(); var i; for (i = 0; i < 9; i++) { document.writeln(b[i]); } } --> </script> </head> <body> <script type="text/javascript"> <!-- vbarraytest(createvbarray()); --> </script> </body> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
VBArray - Archive of obsolete content
example the following example consists of three parts.
... vbarray.lbound returns the lowest index value used in the specified dimension of a vbarray.
... requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
New in JavaScript 1.5 - Archive of obsolete content
the following is a changelog for javascript 1.5.
...and {} — can now be followed by a ?
...both assert a match depending on what follows the string being matched.
New in JavaScript 1.8.5 - Archive of obsolete content
the following is a changelog for javascript 1.8.5.
...bug 492849 object.isextensible() determines if extending of an object is allowed.
...bug 429507 new ecmascript5 features get and set operators now allows the identifier to be numeric or a string.
New in JavaScript 1.8 - Archive of obsolete content
the following is a changelog for javascript 1.8.
...allowing you to simply create generators (which were introduced in javascript 1.7).
... typically you would have to create a custom function which would have a yield in it, but this addition allows you to use array comprehension-like syntax to create an identical generator statement.
Object.prototype.__noSuchMethod__ - Archive of obsolete content
while __nosuchmethod__ has been dropped, the ecmascript 2015 specification has the proxy object, with which you can achieve the below (and more).
... __nosuchmethod__ var o = { __nosuchmethod__: function(id, args) { console.log(id, '(' + args.join(', ') + ')'); } }; o.foo(1, 2, 3); o.bar(4, 5); o.baz(); // output // foo (1, 2, 3) // bar (4, 5) // baz () using __nosuchmethod__ to simulate multiple inheritance an example of code that implements a primitive form of multiple inheritance is shown below.
... // if we get here, the method hasn't been found throw new typeerror; } // used to add a parent for multiple inheritance function addparent(obj, parent) { // if the object isn't initialized, initialize it if (!obj.__parents_) { obj.__parents_ = []; obj.__nosuchmethod__ = nomethod; } // add the parent obj.__parents_.push(parent); } an example of using this idea is shown below.
Archived JavaScript Reference - Archive of obsolete content
this property has been removed and no longer works.array comprehensionsthe array comprehension syntax was a javascript expression which allowed you to quickly assemble a new array based on an existing one.
...it has been removed from firefox starting with version 58.generator comprehensionsthe generator comprehension syntax was a javascript expression which allowed you to quickly assemble a new generator function based on an existing iterable object.
...hapter contains information about javascript's version history and implementation status for mozilla/spidermonkey-based javascript applications, such as firefox.number.tointeger()the number.tointeger() method used to evaluate the passed value and convert it to an integer, but its implementation has been removed.object.getnotifier()the object.getnotifer() method was used to create an object that allows to synthetically trigger a change, but has been deprecated and removed in browsers.object.observe()the object.observe() method was used for asynchronously observing the changes to an object.
JSException - Archive of obsolete content
constructor summary the netscape.javascript.jsexception class has the following constructors: jsexception deprecated constructors optionally let you specify a detail message and other information.
... method summary the netscape.javascript.jsexception class has the following methods: getwrappedexception instance method getwrappedexception.
... declaration public int getwrappedexceptiontype() description getwrappedexceptiontype() returns an int that matches one of the following static ints declared by the jsexception class: exception_type_empty exception_type_void exception_type_object exception_type_function exception_type_string exception_type_number exception_type_boolean ...
JSObject - Archive of obsolete content
jsobject allows java to manipulate javascript objects.
... method summary the netscape.javascript.jsobject class has the following methods: call calls a javascript method.
... the netscape.javascript.jsobject class has the following static method: getwindow gets a jsobject for the window containing the given applet.
Packages - Archive of obsolete content
for example, you can access a constructor of the frame class as follows: var theframe = new packages.java.awt.frame(); for convenience, javascript provides the top-level netscape, sun, and java objects that are synonyms for the packages properties with the same names.
... consequently, you can access java classes in these packages without the packages keyword, as follows: var theframe = new java.awt.frame(); the classname property represents the fully qualified path name of any other java class that is available to javascript.
... examples example: javascript function to create a java dialog box the following javascript function creates a java dialog box: function createwindow() { var theowner = new packages.java.awt.frame(); var thewindow = new packages.java.awt.dialog(theowner); thewindow.setsize(350, 200); thewindow.settitle("hello, world"); thewindow.setvisible(true); } in the previous example, the function instantiates thewindow as a new packages object.
Building Mozilla XForms - Archive of obsolete content
the following table gives you an overview of which version you want to build: firefox version gecko/toolkit version source code notes status firefox 2.0 gecko 1.8.1 cvs, branch mozilla_1_8_branch not developed any more last release: 0.8.5ff2 firefox 3.0 gecko 1.9.0 cvs, branch head not developed any more last release: 0.8.5ff3 firefox 3.5 gecko 1.9.1 xforms/schema-validation code does not build...
...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.
...the following scheme usually works (replace {geckoversion} with the used gecko/toolkit version): <em:minversion>{geckoversion}.0</em:minversion> <em:maxversion>{geckoversion}.*</em:maxversion> for example, for the firefox 3.5 version of the extension, it might look like that: <em:minversion>1.9.1.0</em:minversion> <em:maxversion>1.9.1.*</em:maxversion> then zip the files again (or use an editor like vim t...
Requests For Enhancement - Archive of obsolete content
ArchiveWebXFormsRFE
if you have an idea that might improve mozilla's xforms implementation then you should choose one of the following rfe categories and put your request there.
...our custom control interfaces allows for the exchange of data between any xml element and and an xforms model.
...this section could be of particular interest to people using custom controls in xul documents for the following reasons: xul, in many cases, is much better suited for application development than xhtml.
XForms Output Element - Archive of obsolete content
representations the xforms output element can be represented by the following widgets for the specified data types (or types derived from these data types): text - default representation for instance data of most types, especially static text (xhtml/xul).
...characteristics text is presented to the user when there is no type given for the bound node or a type is specified that is not handled by one of the other widgets (as documented below).
... analogous widgets are <xhtml:span/> and <xul:description/> calendar a form author may notice a xforms output element represented by a calendar widget in the mozilla xforms processor if the control meets the following criteria (xhtml/xul).
XForms Range Element - Archive of obsolete content
introduction allows the user to choose a value from within a specific range of values (see the spec).
... single-node binding special incremental - supported, default value is false start - lower bound of possible values end - upper bound of possible values step - is used for incrementing/decrementing values start/end/step attributes if the value of the bound instance node is outside the range of values specified by the start and end attributes, then the range element receives a xforms-out-of-range event.
...start specifies the lower bound of possible values, i.e.
Examples - Game development
volumetric particle flow physics simulation of flowing liquid.
... fire walk with me billowing fire cloud effect.
... realistic water simulation flowing water, like the waves on the ocean.
GLSL Shaders - Game development
this allows the cpu to focus its processing power on other tasks, like executing code.
... the vertex shader code let's continue by writing a simple vertex shader — add the code below inside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projection matrices by each vector to get the final vertex position, in each case.
... the texture shader code now we'll add the texture shader to the code — add the code below to the body's second <script> tag: void main() { gl_fragcolor = vec4(0.0, 0.58, 0.86, 1.0); } this will set an rgba color to recreate the current light blue one — the first three float values (ranging from 0.0 to 1.0) represent the red, green, and blue channels while the fourth one is the alpha transparency (ranging from 0.0 — fully transparent — to 1.0 — fully opaque).
Desktop gamepad controls - Game development
the connect() and disconnect() functions are bound to the following events: window.addeventlistener("gamepadconnected", gamepadapi.connect); window.addeventlistener("gamepaddisconnected", gamepadapi.disconnect); they are fired when the gamepad is connected and disconnected respectively.
... on-screen instructions when the game is started, some introductory text is shown that shows you available controls — we are already detecting if the game is launched on desktop or mobile then showing a relevant message for the device, but we can go even further, to allow for the presence of a gamepad: create() { // ...
... and desktop, and adding gamepad controls is just as straightforward — in the update() function, we check to see if the current state status is paused — if so, the relevant actions are enabled: if(gamepadapi.buttons.pressed('start')) { this.managepause(); } if(gamepadapi.buttons.pressed('back')) { this.stateback(); } similarly, when the gameover state status is active, then we can allow the user to restart the game instead of continuing it: if(gamepadapi.buttons.pressed('start')) { this.staterestart(); } if(gamepadapi.buttons.pressed('back')) { this.stateback(); } when the game over screen is visible, the start button restarts the game while the back button helps us get back to the main menu.
Square tilemaps implementation: Scrolling maps - Game development
cameras can either be free-form, controlled by the player (such as in strategy games) or follow an object (such as the main character in platform games.) regardless of the type of camera, we would always need information regarding its current position, viewport size, etc.
... maxx and maxy: the limit for the camera's position — the lower limit will nearly always be (0,0), and in this case the upper limit is equal to the size of the world minus the size of the camera's viewport.
... there's another demo available, that shows how to make the camera follow a character.
Game over - Game development
here's the piece of code from the third lesson where we made the ball bounce off the walls: if(x + dx > canvas.width-ballradius || x + dx < ballradius) { dx = -dx; } if(y + dy > canvas.height-ballradius || y + dy < ballradius) { dy = -dy; } instead of allowing the ball to bounce off all four walls, let's only allow three now — left, top and right.
... first, replace where you initially called setinterval() setinterval(draw, 10); with: var interval = setinterval(draw, 10); then replace the second if statement with the following: if(y + dy < ballradius) { dy = -dy; } else if(y + dy > canvas.height-ballradius) { alert("game over"); document.location.reload(); clearinterval(interval); // needed for chrome to end game } letting the paddle hit the ball the last thing to do in this lesson is to create some kind of collision detection between the ball and the paddle, so it can bounce off it and get back ...
...update the last bit of code you modified again, to the following: if(y + dy < ballradius) { dy = -dy; } else if(y + dy > canvas.height-ballradius) { if(x > paddlex && x < paddlex + paddlewidth) { dy = -dy; } else { alert("game over"); document.location.reload(); clearinterval(interval); } } if the ball hits the bottom edge of the canvas we need to check whether it hits the paddle .
Collision detection - Game development
first, add a new line inside your update() function that checks for collision detection between ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, paddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the positions of all the bricks in the group.
...create this new function as the bottom of your code, just before the closing </script> tag, as follows: function ballhitbrick(ball, brick) { brick.kill(); } and that's it!
... compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps we can hit the bricks and remove them, which is a nice addition to the gameplay already.
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.
...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.
... 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 the basic gameplay is in place let's make it more interesting by introducing bricks to smash — it's time to build the brick field.
Move the ball - Game development
add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } the code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame.
... 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.
Scaling - Game development
update your existing preload() function as follows: function preload() { game.scale.scalemode = phaser.scalemanager.show_all; game.scale.pagealignhorizontally = true; game.scale.pagealignvertically = true; } scalemode has a few different options available for how the canvas can be scaled: no_scale — nothing is scaled.
... 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.
...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.
The score - Game development
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 works: next steps we now have a scoring system, but what's the point of playing and keeping score if you can't win?
... let's see how we can add a victory state, allowing us to win the game.
CORS-safelisted request header - MDN Web Docs Glossary: Definitions of Web-related terms
a cors-safelisted request header is one of the following http headers: accept, accept-language, content-language, content-type.
... when containing only these headers (and values that meet the additional requirements laid out below), a requests doesn't need to send a preflight request in the context of cors.
... you can safelist more headers using the access-control-allow-headers header and also list the above headers there to circumvent the following additional restrictions: additional restrictions cors-safelisted headers must also fulfill the following requirements in order to be a cors-safelisted request header: for accept-language and content-language: can only have values consisting of 0-9, a-z, a-z, space or *,-.;=.
Developer Tools - MDN Web Docs Glossary: Definitions of Web-related terms
developer tools (or "development tools" or short "devtools") are programs that allow a developer to create, test and debug software.
... current browsers provide integrated developer tools, which allow to inspect a website.
... they let users inspect and debug the page's html, css, and javascript, allow to inspect the network traffic it causes, make it possible to measure it's performance, and much more.
Effective connection type - MDN Web Docs Glossary: Definitions of Web-related terms
the values of 'slow-2g', '2g', '3g', and '4g' are determined using observed round-trip times and downlink values.
... table of effective connection types ect minimum rtt maximum downlink explanation slow-2g 2000ms 50 kbps the network is suited for small transfers only such as text-only pages.
...to see your effective connection type, open the console of the developer tools of a supporting browser and enter the following: navigator.connection.effectivetype; see also: network information api networkinformation networkinformation.effectivetype ...
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
learn more technical example one of the advantages of javascript putting function declarations into memory before it executes any code segment is that it allows you to use a function before you declare it in your code.
...for example: console.log(num); // returns undefined, as only declaration was hoisted, no initialization has happened at this stage var num; // declaration num = 6; // initialization the example below only has initialization.
... console.log(num); // throws referenceerror exception num = 6; // initialization below are more examples demonstrating hoisting.
QUIC - MDN Web Docs Glossary: Definitions of Web-related terms
as tcp is built into the kernel of many operating systems being able to experiment with changes, test them and implement modifications is an extremely slow process.
... the creation of quic allows developers to conduct experiments and try new things faster.
...it provides multiplexing, flow control, security and congestion control.
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
search engines crawl the web, following links from page to page, and index the content found.
...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).
SQL Injection - MDN Web Docs Glossary: Definitions of Web-related terms
how it works after entering username and password, behind the gui the sql queries work as follows: "select count(*) from users where username=' " + txt.user.text+" ' and password=' "+ txt.password.text+" ' "; now suppose user enters the username: admin and password: passwd123, so after clicking on the log in button, sql query will run as follows: "select count(*) from users where username=' admin ' and password=' passwd123 ' "; if the credentials are correct, then the user is allowed t...
... hackers use a simple string called a magical string, for example: username: admin password: anything 'or'1'='1 after clicking on the login button, the sql query will work as follows: "select count(*) from users where username=' admin ' and password=' anything 'or'1'='1 ' "; just take a closer look at the above query's password section.
... how to prevent before executing the queries for the user credentials, make some changes like the following: $id = $_get['id'] (1) $id = stripslashes($id) (2) $id = mysql_real_escape_string($id) so due to (1) each single quote (') in the input string is replaced with double quotes ("), and due to (2) before every (') it adds (/).
MDN Web Docs Glossary: Definitions of Web-related terms
r encoding character set chrome cia cipher cipher suite ciphertext class client hints closure cms code splitting codec compile compile time computer programming conditional constant constructor continuous media control flow cookie copyleft cors cors-safelisted request header cors-safelisted response header crawler crlf cross axis cross-site scripting crud cryptanalysis cryptographic hash function cryptography csp csrf css css object model (cssom) css pixel ...
... proxy server pseudo-class pseudo-element pseudocode public-key cryptography python q quality values quaternion quic r rail random number generator raster image rdf real user monitoring (rum) recursion reference reflow regular expression rendering engine repo reporting directive request header resource timing response header responsive web design rest rgb ril robots.txt round trip time (rtt) routers rss rtcp (rtp control protocol) rtf rtl (right to lef...
... statement static method static typing strict mode string stun style origin stylesheet svg svn symbol symmetric-key cryptography synchronous syntax syntax error synthetic monitoring t tag tcp tcp handshake tcp slow start telnet texel thread three js time to first byte time to interactive tld tofu transmission control protocol (tcp) transport layer security (tls) tree shaking trident truthy ttl turn type type coercion type conversion u ...
About Scriptable Interfaces - Interfaces
most of the information of this document is based on http://www.mozilla.org/scriptable/ and creating xpcom components scriptable interfaces interfaces allow xpcom components to expose their functionality to the outside world while hiding the inner details of the component implementation.
... xpconnect xpconnect is a technology that allows scriptable interfaces to be used/implemented from/in javascript scripts.
... python there's an extension extensions/python that bridges the gap between xpcom and python, allowing scriptable interfaces to be used/implemented from/in python scripts.
Creating fancy letterheaded paper - Learn web development
now comment out the filter and implement the drop shadow in a different (slightly more cross-browser compatible) way, which still follows the shape of the round image.
... hints and tips remember that you can create a fallback for older browsers by putting the fallback version of a declaration first, followed by the version that works across newer browsers only.
... 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.
Test your skills: tables - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... our finished table will look like the image below.
... there are a number of ways that you can achieve this, but i suggest following similar patterns as used in the tutorial to do the following things.
Using your new knowledge - Learn web development
starting point you can work in the live editor below, or you can download the starting point to work with in your own editor.
... 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 you more examples of its use.
Use CSS to solve common problems - Learn web development
LearnCSSHowto
the following links provide solutions to common problems you may face when working with css.
...ct elements via attribute name and content how to use pseudo-classes how to use pseudo-elements how to apply multiple selectors to the same rule how to specify colors in css how to debug css in the browser css and text how to style text how to customize a list of elements how to style links how to add shadows to text boxes and layouts how to size css boxes how to control overflowing content how to control the part of a css box that the background is drawn under how do i define inline, block, and inline-block?
... how to change the box model completely using box-sizing how to control backgrounds how to control borders how to style an html table how to add shadows to boxes uncommon and advanced techniques css allows some advanced design techniques.
Typesetting a community school homepage - Learn web development
you are to write your css additions below the comment at the bottom of the css file, to make sure it is easy to mark the bits you have done.
... give your headings a little bit of letter-spacing to make them not too too squashed, and allow the letters to breathe a bit.
... 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.
Styling text - Learn web development
guides this module contains the following articles, which will teach you all of the essentials behind styling html text content.
... web fonts here we will explore web fonts in detail — these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling.
... assessments the following assessments will test your understanding of the text styling techniques covered in the guides above.
How can we design for all types of users? - Learn web development
we would advise the following: describe fonts in rem units, most browsers will be very happy with them; let older browsers display fonts with their own internal engine.
...if you want an elastic/responsive website, and you don't know what the browser's default width is, you can use the max-width property to allow up to 70 characters per line and no more: div.container { max-width:70em; } alternative content for images, audio, and video websites often include stuff besides plain text.
... your readers may have disabled images to save bandwidth, especially on mobile devices (see below).
Example 3 - Learn web development
<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> </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; } /* ------------ */ /* fanc...
... 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 */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deac...
Example 4 - Learn web development
<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> </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; } /* ------------ */ /* fanc...
... 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 */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deac...
Example 5 - Learn web development
role="option" aria-selected="true">cherry</li> <li class="option" role="option">lemon</li> <li class="option" role="option">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; } /* ------------ */ /* fanc...
... 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 */ top : 0; right : 0; padding-top : .1em; -moz-box-sizing : border-box; box-sizing : border-box; text-align : center; border-left : .2em solid #000; border-radius: 0...
...background-color : #000; color : #fff; } .select .optlist { z-index : 2; list-style: none; margin : 0; padding: 0; background: #f0f0f0; border: .2em solid #000; border-top-width : .1em; border-radius: 0 0 .4em .4em; box-shadow: 0 .2em .4em rgba(0,0,0,.4); -moz-box-sizing : border-box; box-sizing : border-box; min-width : 100%; max-height: 10em; /* 100px */ overflow-y: auto; overflow-x: hidden; } .select .option { padding: .2em .3em; } .select .highlight { background: #000; color: #ffffff; } javascript content // ------- // // helpers // // ------- // nodelist.prototype.foreach = function (callback) { array.prototype.foreach.call(this, callback); } // -------------------- // // function definitions // // -------------------- // function deac...
Test your skills: Advanced styling - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... 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.
... 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.
Dealing with files - Learn web development
an aside on casing and spacing you'll notice that throughout this article, we ask you to name folders and files completely in lowercase with no spaces.
...for these reasons, it is best to get into the habit of writing your folder and file names lowercase with no spaces and with words separated by dashes, at least until you know what you're doing.
... open up your index.html file, and insert the following code into the file exactly as shown.
How the Web works - Learn web development
there are many other parts involved, and we'll describe them below.
... in addition to the client and the server, we also need to say hello to: your internet connection: allows you to send and receive data on the web.
...the browser needs to find out which server the website lives on, so it can send http messages to the right place (see below).
Define terms with HTML - Learn web development
the matching description follows immediately, contained within one or more <dd> elements.
...if two or more terms occur in a row, the following description applies to all of them.
...the css font-weight property is what you need here: dt { font-weight: bold; } this produces the slightly more readable result below: learn more <dfn> <dl> <dt> <dd> how to use the aria-describedby attribute ...
Marking up a letter - Learn web development
the letter is a response from a research fellow to a prospective phd student concerning their application to the university.
... in general, the letter should be marked up as an organization of headings and paragraphs, with the following exception.
... example the following screenshot shows an example of what the letter might look like after being marked up.
Structuring a page of content - Learn web development
the title and logo appear side by side once styling is applied, and the navigation appears below those two items.
... you need to add a suitable wrapper for: the header the navigation menu the main content the welcome text the image sidebar the footer you should also: apply the provided css to the page by adding another <link> element just below the existing one provided at the start.
... example the following screenshot shows an example of what the homepage might look like after being marked up.
Assessment: Structuring planet data - Learn web development
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 html data table would be ideal — you need to take the raw data you have available and turn it into a table, following the steps below.
... the finished table should look like this: you can also see the example live here (no looking at the source code — don't cheat!) steps to complete the following steps describe what you need to do to complete the table example.
Image gallery - Learn web development
to give you more of an idea, have a look at the finished example (no peeking at the source code!) steps to complete the following sections describe what you need to do.
... you need to: put the section of code below the "looping through images" comment inside a loop that loops through all 5 images — you just need to loop through five numbers, one representing each image.
... the following lines provide a basis for achieving the changes stipulated in points 2 and 3 above.
Test your skills: Loops - Learn web development
note: you can try out solutions for the tasks below by downloading the code, putting it in an online tool such as codepen, jsfiddle, or glitch, then working on the tasks.
... dom manipulation: considered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them inside existing elements on the page — all via javascript.
... 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.
Client-side web APIs - Learn web development
provide apis allowing developers to make use of their data (e.g.
...this article provides an introduction to the canvas api, and further resources to allow you to learn more.
... 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.
Test your skills: JSON - Learn web development
note: you can try out the solution in the interactive editor below.
... note: in the example 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).
... 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.
JavaScript — Dynamic client-side scripting - Learn web development
javascript is a programming language that allows you to implement complex things on web pages.
...start by working through the following modules: getting started with the web introduction to html introduction to css having previous experience with other programming languages might also help.
... after getting familiar with the basics of javascript, you should be in a position to learn about more advanced topics, for example: javascript in depth, as taught in our javascript guide web apis modules this topic contains the following modules, in a suggested order for working through them.
Properly configuring server MIME types - Learn web development
some other web browsers, such as microsoft® internet explorer, try to allow for misconfigured web servers and applications by guessing what the correct mime type should be.
... 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 ignores the reported mime type, web administrators and authors no longer have control over how their content is to be processed.
Server-side website programming - Learn web development
we recommend that you first read the following topics: what is a web server what software do i need to build a website?
... modules this topic contains the following modules.
... you should start with the first module, then go on to one of the following modules, which show how to work with two very popular server-side languages using appropriate web frameworks.
Rendering a list of Vue components - Learn web development
add a few sample to-do items, along the lines of those seen below.
... update the label="my todo item" attribute to :label="item.label", and the :done="false" attribute to :done="item.done", as seen in context below: <ul> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done"></to-do-item> </li> </ul> now when you look at your running app, it'll show the todo items with their proper names, and if you inspect the source code you'll see that the inputs all have unique ids, taken from the object in the app component.
... what we really need next is the ability to allow our users to enter their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data.
Chrome Worker Modules
this defines a global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now use module core.
...to make the value public, you just have to add it to either global value exports, as follows: /* file mymodule.js */ let secretkey = "this is a secret"; let publickey = "this is public"; exports.key = publickey; // secretkey is not exported // publickey is exported with name "key" alternatively, if you prefer that style, you may write // variable |module| is a special global introduced by require() module.exports = { key: publickey }; once this is done, we may load the module and ...
...that is, the following will not show human-readable stacks: try { mymodule.foo(); } catch (ex) { log("exception raised at " + ex.filename) log("stack: " + ex.stack); } rather, you should use properties modulename and modulestack, as follows: try { mymodule.foo(); } catch (ex) { log("exception raised at " + ex.modulename) log("stack: " + ex.modulestack); } subtleties you shouldn’t mix bo...
Accessible Toolkit Checklist
some low vision users will be running your software with high contrast or large font themes.
...implement true usability for everyone, and make your toolkit follow the guidelines for each platform.
...since the individual widgets predominately come from the operating system, they already implement standard keyboard commands and follow the operating system's visual theme.
Application cache implementation overview
the following loading process decisions are then the same as for the top level load with one addition: when the entry is neither found in the cache nor matches any namespace in that cache we fail the resource load with document_not_found.
...this new cache version is now pending to be activated after all following long and complicated download process passes.
...nsofflinecacheupdate::loadcompleted() is called for each finished entry load, including the manifest and is the main place handling each update state as following: on checking state, a state the update is at after manifest parsing has been done, loadcompleted checks whether the new hash, i.e.
Benchmarking
debug builds debug builds (--enable-debug) and non-optimized builds (--disable-optimize) are much slower.
...add the following to your mozconfig in order to build with level 2: ac_add_options rustc_opt_level=2 gc poisoning many firefox builds have a diagnostic tool that causes crashes to happen sooner and produce much more actionable information, but also slow down regular usage substantially.
... it also lacks features such as instruction level profiling which can be helpful in low level profiling, or finding the hot loop inside a large function, etc.
Browser chrome tests
the browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using javascript.
... it currently allows you to run javascript code in the same scope as the main firefox browser window and report results using the same functions as the mochitest test framework.
... for example, to run the tests in browser/base/content/test the command would be: ./mach mochitest -f browser browser/base/content/test/ or without mach test_path=<path_to_the_tests> make -c <objdir> mochitest-browser-chrome to run tests in debugger the following should work ./mach mochitest -f browser --debugger gdb browser/base/content/test/ run ./mach help mochitest-browser for more options.
Continuous Integration
below is a list of the most common.
... talos is used to execute several suites for desktop firefox and firefox for android; these suites are denoted using lower-case letters, e.g., t(c d g1 o s tp).
... games benchmarking (firefox) under development, the games benchmarking harness (aka mozbench) will allow a number of games-related benchmarks to be run against firefox and chrome.
Debugging JavaScript
go to about:config and set the following two prefs: devtools.chrome.enabled: true devtools.debugger.remote-enabled: true after you restart the browser, you can access the browser debugger through tools > web developer > browser toolbox.
... dump() the dump() function allows you to print text on the native console.
... under microsoft windows you additionally need to start firefox via the following command to have a native console : firefox.exe -console using normal javascript object inspection, you can write a function that dumps a whole object, similar to this ddumpobject().
Simple Sunbird build
you can build a bleeding-edge, development version of sunbird using the commands below.
...installing build tools if your system is not listed below, see the build prerequisites page.
...c:\ ) before doing the following steps.
Reviewer Checklist
following these best practices will lead to a smoother, more rapid process of review and acceptance.
...[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.
Frame script environment
the frame script's global is a contentframemessagemanager, giving it the following environment: content the dom window of the content loaded in the browser.
... may be null (see below) docshell the nsidocshell associated with the browser.
... events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload fires when the frame script environment is shut down, i.e.
Communicating with frame scripts
the example below sends a message named "my-e10s-extension-message", with a data payload containing details and tag properties, and exposes the event.target object as a cpow: // frame script addeventlistener("click", function (event) { sendasyncmessage("my-addon@me.org:my-e10s-extension-message", { details : "they clicked", tag : event.target.tagname }, { target : event.target }); }, false); ...
... the message passed to the listener is an object containing the following properties: name string containing the message name.
... objects an object whose properties are any cpows exposed by the sender as the third argument to sendasyncmessage() in the example below the listener just logs all the messages details: // chrome script messagemanager.addmessagelistener("my-addon@me.org:my-e10s-extension-message", listener); function listener(message) { console.log(message.name); console.log(message.sync); console.log(message.data); console.log(message.target); console.log(message.objects); } so combining this message listener with the message above ...
Process scripts
the following code uses the global parent process message manager, which will load the script into the the chrome process and any child processes: // chrome code let ppmm = cc["@mozilla.org/parentprocessmessagemanager;1"] .getservice(ci.nsiprocessscriptloader); ppmm.loadprocessscript("chrome://whatever/process-script.js", true); ppmm.addmessagelistener("hello", function(msg) { ...
... in just about every respect, using process scripts is like using frame scripts: you can pass the allowdelayedload to loadprocessscript().
... this can be achieved by traversing the docshell tree up to the top window and then retrieving its content message manager, as follows: function contentmmfromcontentwindow(window) { let tree = window.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsidocshelltreeitem); let top = tree.sametyperoottreeitem; let iface = queryinterface(ci.nsidocshell).queryinterface(ci.nsiinterfacerequestor); return iface.getinterface(ci.nsicontentframemessagemanager); } this is intended for unprivileged pages running in a cont...
Message manager overview
it's a chromemessagebroadcaster object, which implements the following interfaces: nsiframescriptloader nsimessagelistenermanager nsimessagebroadcaster you can access the global message manager like this: // chrome script let globalmm = cc["@mozilla.org/globalmessagemanager;1"] .getservice(ci.nsimessagelistenermanager); window message manager the window message manager is associated with a specific browser window, and operates on every <browser> (that...
... it's a chromemessagebroadcaster object, which implements the following interfaces: nsiframescriptloader nsimessagelistenermanager nsimessagebroadcaster the window message manager can be accessed as a property of the browser window: // chrome script let windowmm = window.messagemanager; browser message manager the browser message manager is specific to a single xul <browser> element (which essentially corresponds to a single tab): loadframescript() loads the given script only into its <browser> sendasyncmessage() sends the message only to that <browser>.
... it's a chromemessagesender object, which implements the following interfaces: nsiprocesschecker nsiframescriptloader nsimessagelistenermanager nsimessagesender the browser message manager can be accessed as a property of the xul <browser> element: // chrome script let browsermm = gbrowser.selectedbrowser.messagemanager; process message managers process message managers correspond to process boundaries, and enable code running in different processes to communicate.
Tracking Protection
if tracking cookies were present, you would be able to view the list by clicking on "blocking tracking cookies" in the above image to view the following popup: you can click "manage content blocking" to change the blocking settings: how does firefox choose what to block?
... for example, you should not use google analytics in the following way: <a href="http://www.example.com" onclick="tracklink('http://www.example.com', event);"> visit example.com </a> <script> function tracklink(url,event) { event.preventdefault(); ga('send', 'event', 'outbound', 'click', url, { 'transport': 'beacon', 'hitcallback': function() { document.location = url; } }); } </script> instead, you should account for the...
... note: depending on a third party in this way is not a good practice anyway, because then your site can be broken if the third party is slow or unavailable, or if the tracker has been blocked by an add-on.
Security best practices for Firefox front-end engineers
we use our built-in sanitizer with the following flags: sanitizerallowstyle sanitizerallowcomments sanitizerdropforms sanitizerlogremovals the sanitizer removes all scripts (script tags, event handlers) and form elements (form, input, keygen, option, optgroup, select, button, datalist).
... linter rules against unsanitized dom interaction the security assurance team maintains an eslint rule that disallows unsafe uses of innerhtml and similar dom apis.
... appendix list of disallowed dom apis innerhtml outerhtml insertadjacenthtml() createcontextualfragment() document.write() document.writeln() please take a look at the repository for an updated list ...
Firefox UI considerations for web developers
each site is represented by an icon and, below it, a name for the site.
... examples consider again the example top sites box shown at the top of the page, repeated below: let's look at some examples among the icons shown here (note that this discussion is based on the site designs as of early january, 2019).
...the favicon is rendered in a small box in the lower-right corner of the icon box to further identify the site.
Getting from Content to Layout
changes to a document originate in the content tree (from dom modification by scripting, insertion of elements from the parser, etc.) and are propogated to the layout tree through magic that primarily resides in //github.com/realityripple/uxp/blob/master/layout/base/nscssframeconstructor.cpp the frame constructor implements nsimutationobserver which allows it to "watch" the content tree.
... the frame constructor takes these notifications and does the following: dispatches "restyle events" which trigger the reprocessing of relevant css selectors and any restyling that needs to occur.
... the restyles accumulated in the restyletracker are dispensed with from various method on the presshell that involve reflow and flushing notifications.
Infallible memory allocation
choosing a memory allocator as you write new code that needs to allocate memory, there are some simple rules to follow to help you decide whether to use a fallible or an infallible memory allocator: if you're allocating what may be a large chunk of memory, you should allocate the memory fallibly (using malloc() for example), and check the result to be sure it's not null.
... you should do this for large memory allocations because in extremely low memory conditions, as described in how can memory allocation be infallible?, the application may terminate if an infallible allocator can't find the memory you requested.
... explicitly infallible memory allocators the following memory allocators are explicitly infallible, and will remain so; they are guaranteed to return a valid memory pointer.
Interfacing with the Add-on Repository
starting a request to start a search of the repository, you can use either of the following methods: searchaddons() queries the add-on repository for add-ons matching given search criteria.
... when the user clicks a toolbar button to initiate the query, the following code gets run to start the request: addonrepository.retrieverecommendedaddons(10, this); this asks the repository to fetch up to 10 add-ons, using the object this as the target for callbacks.
...for example: searchfailed: function() { this.shownotification("i have no recommendations for you right now!", "oh noes!", null); }, here, we call a shownotification() method with some parameters that we'll look at shortly when we get to our shownotification() method below.
Log.jsm
debug detailed information on the flow through the system.
... leveldesc logger(); length: 2 keys of prototype: addappender(); level logstructured(); name parent removeappender(); updateappenders(); and the methods mentioned below: logger methods loggerrepository(); length: 0 keys of prototype: getlogger(); rootlogger storagestreamappender(); length: 1 keys of prototype: doappend(); getinputstream(); newoutputstream(); outputstream ...
... reset(); structuredformatter(); length: 0 keys of prototype: format(); method overview enumerateinterfaces(); length: 0 enumerateproperties(); length: 2 member fields variable type description level object contains the following fields: field name value all 0 config 30 debug 20 desc { 0: "all", 10: "trace", 20: "debug", 30: "config", 40: "info", 50: "warn", 60: "error", 70: "fatal" } error 30 fatal 70 info ...
NetUtil.jsm
nsichannel newchannel( awhattoload, [optional] aorigincharset, [optional] abaseuri ); parameters return value an nsichannel allowing access to the specified data source.
...the returned method will allow access to the specified data.
... options the aoptions parameter is a javascript object which can have any or all of the following fields: field name description charset the character encoding to use when interpreting the input stream.
Examples
in the example below we try alerting an undefined variable.
...consider the following cases: function f() { return promise.reject(new error("boom!")); // if nobody catches the error, how will it be reported?
...} we adopt the following strategy: if a promise is rejected at the time of its garbage-collection and if the promise is at the end of a promise chain (i.e.
Promise
see handling errors and common pitfalls below.
...if this value is a promise, then the associated promise will be resolved to the passed promise, and follow the state as the provided promise (including any future transitions).
... promise catch( function onreject ); the following calls are therefore identical: p.then(undefined, logerror); p.catch(logerror); debugging by design, the instant state and value of a promise cannot be inspected synchronously from code, without calling the then() method.
Encodings for localization files
see the table below for appropriate values.
...see the table below for appropriate values for the charset= parameter.
... browser/installer/installer.inc utf-8 toolkit/installer/unix/install.it utf-8 native windows encodings the following table lists native windows encodings, and the win_installer_charset and charset= values for each: encoding name win_installer_charset (charset.mk) charset= (windows/install.it) ansi_charset cp1252 0 baltic_charset cp1257 186 chinesebig5_charset cp950 136 easteurope_charset cp1250 238 gb2312_charset cp936 134 greek_charset cp1253 161 hangul_charset cp949 129 russian_charset cp1251 204 shiftjis_charset cp932 128 turkish_charset cp1254 162 vietnamese_charset cp125...
L10n Checks
it allows mozilla localizers to easily check their work.
...you pass both the path to the ini file and the parent directory of the localizations as first arguments, followed by the locale codes of the locales you want to compare.
...you pass the path to the xpi file (optionally) followed by the locale codes of the locales you want to compare.
Localizing extension metadata on addons.mozilla.org
step 4 allows you to translate any of the above fields into any other language amo supports.
... getting translation help you are kindly advised not to use any automatic online translation, which can bring unpleasant low-quality output to users.
...create an account and then, using the “basic open-ended question” template, follow the instructions to upload the text of your amo page.
Initial setup
at that point, you must visit the mozilla committer page and follow the process outlined there.
... wget wget is a command-line utility that allows you to retrieve files using internet protocols.
...you can install either by searching for them in firefox's add-ons manager or following these links.
Setting up the infrastructure
first, make your project's file type decision (see localization formats for details): html/php .lang gettext (.po) assuming you chose gettext, you'll need to follow the steps below to set up the infrastructure for localizing your web application.
... review the english content following the web content localizability guidelines.
... review your code following the web applications localizability guidelines.
What every Mozilla translator should know
all these groups are pretty low traffic.
... bugzilla, the bug-tracking system you do need an account in bugzilla you should configure the account to watch the following addresses: firefoxl10n@hotmail.com calendar-l10n@mozilla.bugs (specific for calendar related bugs) this way you will receive mail for bugs affecting many or even all locales.
... when you create a bug, if you want the person in charge of the l10n to follow up your bug you should cc: l10n@mozilla.com if you choose to make changes to your localization, you should make the changes local to your disk, push them to your hg repository on merucial, test the changes on a nightly/tinderbox build, fix any errors if some are found and test again, and send the new changeset id as your "opt-in" revisions to the l10-drivers.
MathML Demo: <mspace> - space
mathml demo: <mspace> - space the background color of <mspace> elements has been set to yellow for easier viewing.
...interactive sizing html content <p> use the control buttons below to adjust the parameters of the <code>mspace</code> element and see the effects.
...pwidth();" title="increase width">+</a>/ <a class="control" href="javascript:downwidth();" title="decrease width">-</a> depth <a class="control" href="javascript:updepth();" title="increase depth">+</a>/ <a class="control" href="javascript:downdepth();" title="decrease depth">-</a> <math display="block"> <mstyle displaystyle="true"> <msqrt> <mrow> <mn>3</mn> <mspace style="background-color: yellow" id="thespace" height="0.1ex" depth="0.1ex" width="0.1em" /> <mi>x</mi> </mrow> </msqrt> </mstyle> </math> </p> javascript content var height=0; var width=0; var depth=0; function upheight() { height++; document.getelementbyid("thespace").setattribute("height",height+".1ex"); } function downheight() { height--; document.getelementbyid("thespace").setattribute("height",height+".1ex")...
Mozilla Style System
the methods on nsistyleruleprocessor allow the front end to ask the back ends for the style data that applies to a given element or pseudo-element, in the form of style rules.
...the style contexts then provide the api for computed style data by allowing retrieval of a set of style structs, each of which contains the computed values of a set of css properties.
... the grouping of properties into structs follows two rules: any properties in the same style struct must also be in the same css struct all of the properties in a style struct must be inherited or they must all be non-inherited (see inheritance for an explanation of the difference) the first of these rules is no longer important (in fact, the separation of the specified values into nscss* structs is no longer important).
JS::PerfMeasurement
the current implementation can measure eleven different types of low-level hardware and software events: events that can be measured bitmask passed to constructor counter variable what it measures perfmeasurement::cpu_cycles .cpu_cycles raw cpu clock cycles ::instructions .instructions total instructions executed ::cache_references .cache_references total number of memory accesses ::cache_misses .cac...
...perfmeasurement::all in a constructor call, this special value means "measure everything that can possibly be measured." perfmeasurement::num_measurable_events this constant equals the total number of events defined by the api - not necessarily the total number of events that a particular os allows you to measure.
... (at time of writing, linux allows all the above events to be measured, and we don't have back ends for any other operating system.
perf
the following example shows how to invoke it for this purpose.
... the output will look like the following.
... performance counter stats for 'system wide': 51.58 joules power/energy-pkg/ [100.00%] 14.80 joules power/energy-cores/ [100.00%] 9.93 joules power/energy-gpu/ [100.00%] 27.38 joules power/energy-ram/ [100.00%] 5.003049064 seconds time elapsed it's not clear from the output, but the following relationship holds.
Performance
they are slow and not particular easy to use, and thus most suitable for use by expert developers.
...valgrind is used as part of mozilla's continuous integration testing, though the coverage is limited because valgrind is slow.
...that log can then be replayed against firefox's default memory allocator independently or through another replace-malloc library, allowing the testing of other allocators under the exact same workload.
A brief guide to Mozilla preferences
this file allows preference locking via the lock_pref() function.
... preferences loading and resolution on application launch, the application loads preferences in the following order: load all default pref files.
...this allows system administrators to know quickly if there is a configuration error in the installation.
Patches and pushes
below you'll find instructions on creating a patch and pushing it to your repository.
.../gossip?output=fxjson&amp;command={searchterms}" />*** <url type="text/html" method="get" template="http://search.yahoo.com/search"> <param name="p" value="{searchterms}"/> <param name="ei" value="utf-8"/> <mozparam name="fr" condition="pref" pref="yahoo-fr" /> </url> <searchform>http://search.yahoo.com/</searchform> </searchplugin> create xml files for each search plugin preference following the above example.
... 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.
Research and prep
ensure that your suggestions follow these parameters: search there are typically five search plug-ins listed for firefox desktop (only four for firefox mobile): generic search the default option should expose the quickest path to the best result on the world wide web for the user (indexing a large portion of the global www).
... e-commerce search these search engines should allow users to get connected to new and used products they want to buy as quickly and painlessly as possible in a "trusted" site -- for example, choosing the most popular auction, general shopping, or classified type sites that have the desired user experience are good choices.
...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.
Leak And Bloat Tests
aim to provide a continuous check within mailnews and its sub-components for the following items: total memory leaks.
... manually running tests setting up build set up build thunderbird or seamonkey with your standard mozconfig file, but with the following options set: ac_add_options --enable-debug ac_add_options --enable-trace-malloc running the tests in your <objdir> run the following command: make mailbloat this will run the tests and produce some result files.
...entral/source/mailnews/test/performance these files consist of: overlays (used to provide the hooks for the javascript): bloat/bloataddroverlay.xul bloat/bloatcomposeoverlay.xul bloat/bloatmainoverlay.xul javascript files (used to drive the tests): bloat/bloataddroverlay.js bloat/bloatcomposeoverlay.js bloat/bloatmainoverlay.js preference settings (used to provide a defined profile, see below): common/mailnewstestprefs.js python scripts (used to set up the profile and run the test): bloat/setupbloattest.py bloat/runtest.py common/setupcommonmailnews.py pre-defined profile initial setup: one pop3 account (mails tbd) one identity one smtp server defined (not used) future requirements/possibilities: one address book where pab has ~1000 entries large message folders imap nntp ...
NSPR Contributor Guide
license under mpl or gpl when you contribute material to nspr, you agree to allow your contribution to be licensed under the mpl or gpl.
...your proposed api should encapsulate a relatively low level capability as would be found in a system call or libc.
...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.
I/O Functions
differences include the following: the blocking socket functions in nspr take a timeout parameter.
...psocket pr_connect pr_connectcontinue pr_accept pr_bind pr_listen pr_shutdown pr_recv pr_send pr_recvfrom pr_sendto pr_transmitfile pr_acceptread pr_getsockname pr_getpeername pr_getsocketoption pr_setsocketoption converting between host and network addresses pr_ntohs pr_ntohl pr_htons pr_htonl pr_familyinet memory-mapped i/o functions the memory-mapped i/o functions allow sections of a file to be mapped to memory regions, allowing read-write accesses to the file to be accomplished by normal memory accesses.
...for example, the following lines of code are equivalent: rv = pr_pushiolayer(stack, pr_top_io_layer, my_layer); rv = pr_pushiolayer(stack, pr_getlayersidentity(stack), my_layer); pr_getuniqueidentity pr_getnameforidentity pr_getlayersidentity pr_getidentitieslayer pr_getdefaultiomethods pr_createiolayerstub pr_pushiolayer pr_popiolayer ...
Named Shared Memory
shared memory allows multiple processes to access one or more common shared memory regions, using it as an interprocess communication channel.
... pr_attachsharedmemory should be called following pr_opensharedmemory to map the memory segment to an address in the application's address space.
...following a call to pr_closesharedmemory, the prsharedmemory object is invalid and cannot be reused.
PR_Access
syntax #include <prio.h> prstatus pr_access( const char *name, praccesshow how); parameters the function has the following parameters: name the pathname of the file whose accessibility is to be determined.
...use one of the following values: pr_access_read_ok.
... returns one of the following values: if the requested access is permitted, pr_success.
PR_CreateFileMap
syntax #include <prio.h> prfilemap* pr_createfilemap( prfiledesc *fd, print64 size, prfilemapprotect prot); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the file that is to be mapped to memory.
...this parameter consists of one of the following options: pr_prot_readonly.
... description the prfilemapprotect enumeration used in the prot parameter is defined as follows: typedef enum prfilemapprotect { pr_prot_readonly, pr_prot_readwrite, pr_prot_writecopy } prfilemapprotect; pr_createfilemap only prepares for the mapping a file to memory.
PR_Interrupt
syntax #include <prthread.h> prstatus pr_interrupt(prthread *thread); parameter pr_interrupt has the following parameter: thread the thread whose interrupt request you want to set.
... returns the function returns one of the following values: if the specified thread is currently blocked, pr_success.
... bugs pr_interrupt has the following limitations and known bugs: there can be a delay for a thread to be interrupted from a blocking i/o function.
PR_ReadDir
syntax #include <prio.h> prdirentry* pr_readdir( prdir *dir, prdirflags flags); parameters the function has the following parameters: dir a pointer to a prdir object that designates an open directory.
...values can include the following: pr_skip_none.
... description pr_readdir returns a pointer to a directory entry structure: struct prdirentry { const char *name; }; typedef struct prdirentry prdirentry; the structure has the following field: name name of entry, relative to directory name.
PR_Seek
syntax #include <prio.h> print32 pr_seek( prfiledesc *fd, print32 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object.
...the value for the whence parameter can be one of the following: pr_seek_set.
... returns the function returns one of the following values: if the function completes successfully, it returns the resulting file pointer location, measured in bytes from the beginning of the file.
PR_Seek64
syntax #include <prio.h> print64 pr_seek64( prfiledesc *fd, print64 offset, prseekwhence whence); parameters the function has the following parameters: fd a pointer to a prfiledesc object.
...the value for the whence parameter can be one of the following: pr_seek_set.
... returns the function returns one of the following values: if the function completes successfully, it returns the resulting file pointer location, measured in bytes from the beginning of the file.
PR_TransmitFile
syntax #include <prio.h> print32 pr_transmitfile( prfiledesc *networksocket, prfiledesc *sourcefile, const void *headers, print32 hlen, prtransmitfileflags flags, printervaltime timeout); parameters the function has the following parameters: networksocket a pointer to a prfiledesc object representing the connected socket to send data over.
... flags one of the following flags: pr_transmitfile_keep_open indicates that the socket will be kept open after the data is sent.
... the enumeration prtransmitfileflags, used in the flags parameter, is defined as follows: typedef enum prtransmitfileflags { pr_transmitfile_keep_open = 0, pr_transmitfile_close_socket = 1 } prtransmitfileflags; ...
PR_Wait
syntax #include <prmon.h> prstatus pr_wait( prmonitor *mon, printervaltime ticks); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor.
... returns the function returns one of the following values: pr_success means the thread is being resumed from the pr_wait call either because it was explicitly notified or because the time specified by the parameter ticks has expired.
... in pseudo-code, the sequence is as follows: pr_entermonitor(&ml); while (!expression) wait; ...
FIPS Mode - an explanation
it may not do any cryptographic operations that involve the use of cryptographic keys, nor allow any of the keys or certificates it holds to be seen or used, except when a user has successfully authenticated to it.
... except for "public keys", it must not allow any keys to leave it (to get outside of it) unless they are encrypted ("wrapped") in a special way.
... in normal non-fips mode, the "master password" is optional and is allowed to be a weak short password.
4.3.1 Release Notes
release date: 2009-12-02 introduction network security services for java (jss) 4.3.1 is a minor release with the following new features: support for ssl3 & tls renegotiation vulnerablity support to explicitly set the key usage for the generated private key jss 4.3.1 is tri-licensed under mpl 1.1/gpl 2.0/lgpl 2.1.
...this default setting can also be changed within the application by using the following jss methods: sslserversocket.enablerenegotiation(int mode) sslsocket.enablerenegotiation(int mode) sslsocket.enablerenegotiationdefault(int mode) the mode of renegotiation that the peer must use can be set to the following: sslsocket.ssl_renegotiate_never - never renegotiate at all.
... 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.
4.3 Release Notes
release date: 01 april 2009 introduction network security services for java (jss) 4.3 is a minor release with the following new features: sqlite-based shareable certificate and key databases libpkix: an rfc 3280 compliant certificate path validation library pkcs11 needslogin method support hmacsha256, hmacsha384, and hmacsha512 support for all nss 3.12 initialization options jss 4.3 is tri-licensed under mpl 1.1/gpl 2.0/lgpl 2.1.
...alert ssl_error_bad_cert_hash_value_alert new tls cipher suites (see http://mxr.mozilla.org/security/sour...sslsocket.java): tls_rsa_with_camellia_128_cbc_sha tls_dhe_dss_with_camellia_128_cbc_sha tls_dhe_rsa_with_camellia_128_cbc_sha tls_rsa_with_camellia_256_cbc_sha tls_dhe_dss_with_camellia_256_cbc_sha tls_dhe_rsa_with_camellia_256_cbc_sha note: the following tls cipher suites are declared but are not yet implemented: tls_dh_dss_with_camellia_128_cbc_sha tls_dh_rsa_with_camellia_128_cbc_sha tls_dh_anon_with_camellia_128_cbc_sha tls_dh_dss_with_camellia_256_cbc_sha tls_dh_rsa_with_camellia_256_cbc_sha tls_dh_anon_with_camellia_256_cbc_sha tls_ecdh_anon_with_null_sha tls_ecdh_anon_with_rc4_128_sha tls_ecdh_anon_w...
...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.
NSS_3.11.10_release_notes.html
the bug fixes in nss 3.11.10 are described in the "bugs fixed" section below.
... bugs fixed the following bugs have been fixed in nss 3.11.10.
...new and revised documents available since the release of nss 3.9 include the following: build instructions for nss 3.11.4 and above compatibility nss 3.11.10 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS_3.12.1_release_notes.html
the bug fixes in nss 3.12.1 are described in the "bugs fixed" section below.
... levels of standards conformance strictness for cert_nametoasciiinvertible (see certt.h) cert_n2a_readable (maximum human readability) cert_n2a_strict (strict rfc compliance) cert_n2a_invertible (maximum invertibility) bugs fixed the following bugs have been fixed in nss 3.12.1.
...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.
NSS_3.12.2_release_notes.html
the bug fixes in nss 3.12.2 are described in the "bugs fixed" section below.
... new in nss 3.12.2 new functions in the nss shared library: sec_pkcs12addcertorchainandkey (see p12.h) new pkcs11 errors (see secerr.h) sec_error_pkcs11_general_error sec_error_pkcs11_function_failed sec_error_pkcs11_device_error bugs fixed the following bugs have been fixed in nss 3.12.2.
...new and revised documents available since the release of nss 3.11 include the following: build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.2 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.12.9 release notes
the bug fixes in nss 3.12.9 are described in the "bugs fixed" section below.
... new in nss 3.12.9 removed functions new ssl options new error codes bugs fixed the following bugs have been fixed in nss 3.12.9.
...new and revised documents available since the release of nss 3.11 include the following:</for> build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.9 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.14.3 release notes
the bug fixes in nss 3.14.3 are described in the "bugs fixed" section below.
... notable changes in nss 3.14.3 cve-2013-1620 recent research by nadhem alfardan and kenny patterson has highlighted a weakness in the handling of cbc padding as used in ssl, tls, and dtls that allows an attacker to exploit timing differences in mac processing.
... acknowledgements the nss development team would like to thank nadhem alfardan and kenny patterson (royal holloway, university of london) for responsibly disclosing the issue by providing advance copies of their research.
NSS 3.15.1 release notes
the bug fixes in nss 3.15.1 are described in the "bugs fixed" section below.
...hmac-sha256 cipher suites (rfc 5246 and rfc 5289) are supported, allowing tls to be used without md5 and sha-1.
... note the following limitations.
NSS 3.17.3 release notes
the bug fixes in nss 3.17.3 are described in the "bugs fixed" section below.
... the following ca certificates were removed cn = gte cybertrust global root sha1 fingerprint: 97:81:79:50:d8:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74 cn = thawte server ca sha1 fingerprint: 23:e5:94:94:51:95:f2:41:48: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:f...
...3: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 public primary certification authority - g2 sha1 fingerprint: 85:37:1c:a6:e5:50:14:3d:ce:28:03:47:1b:de:3a:09:e8:f8:77:0f cn = equifax secure ebusiness ca-1 sha1 fingerprint: da:40:18:8b:91:89:a3:ed:ee:ae:da:97:fe:2f:9d:f5:b7:d1:8a:41 the following ca certificates were added cn = comodo rsa certification authori...
NSS 3.19.3 release notes
the bug fixes in nss 3.19.3 are described in the "bugs fixed" section below.
... notable changes in nss 3.19.3 the following ca certificates were removed cn = buypass class 3 ca 1 sha1 fingerprint: 61:57:3a:11:df:0e:d8:7e:d5:92:65:22:ea:d0:56:d7:44:b3:23:71 cn = tÜrktrust elektronik sertifika hizmet sağlayıcısı sha1 fingerprint: 79:98:a3:08:e1:4d:65:85:e6:c2:1e:15:3a:71:9f:ba:5a:d3:4a:d9 cn = sg trust services racine sha1 fingerprint: 0c:62:8f:5c:55:7...
...0:b1:c9:57:fa:fd:38:3f:b0:3d:7b:7d:d7:b9:c6 cn = tc trustcenter universal ca i sha-1 fingerprint: 6b:2f:34:ad:89:58:be:62:fd:b0:6b:5c:ce:bb:9d:d9:4f:4e:39:f3 cn = tc trustcenter class 2 ca ii sha-1 fingerprint: ae:50:83:ed:7c:f4:5c:bc:8f:61:c6:21:fe:68:5d:79:42:21:15:6e the following ca certificate had the websites trust bit turned off cn = comsign secured ca sha1 fingerprint: f9:cd:0e:2c:da:76:24:c1:8f:bd:f0:f0:ab:b6:45:b8:f7:fe:d5:7a the following ca certificates were added cn = tÜrktrust elektronik sertifika hizmet sağlayıcısı h5 sha1 fingerprint: c4:18:f6:4d:46:d1:df:00:3d:27:30:13:72:43:a9:12:11:c6:75:fb cn = tÜrktrust elektronik sertifika hizmet sağlayıcısı h...
NSS 3.20 release notes
new functions in ssl.h ssl_dhegroupprefset - configure the set of allowed/enabled dhe group parameters that can be used by nss for a server socket.
... support for the following ciphersuites has been added: tls_dhe_dss_with_aes_128_gcm_sha256 tls_dhe_dss_with_aes_128_cbc_sha256 tls_dhe_dss_with_aes_256_cbc_sha256 by default, the server side tls implementation will use dhe parameters with a size of 2048 bits when using dhe ciphersuites.
... a new api ssl_dhegroupprefset has been added to nss, which allows a server application to select one or multiple of the embedded dhe parameters as the preferred parameters.
NSS 3.23 release notes
the following ca certificates were removed cn = staat der nederlanden root ca sha-256 fingerprint: d4:1d:82:9e:8c:16:59:82:2a:f9:3f:ce:62:bf:fc:de:26:4f:c8:4e:8b:95:0c:5f:f2:75:d0:52:35:46:95:a3 cn = netlock minositett kozjegyzoi (class qa) tanusitvanykiado sha-256 fingerprint: e6:06:dd:ee:e2:ee:7f:5c:de:f5:d9:05:8f:f8:b7:d0:a9:f0:42:87:7f:6a:17:1e:d8:ff:69:60:e4:cc:5e:...
...4f:a3:29:c2:cc:f0:e2:fa:1b:14:03:05 friendly name: verisign class 3 public pca – g2 sha-256 fingerprint: 83:ce:3c:12:29:68:8a:59:3d:48:5f:81:97:3c:0f:91:95:43:1e:da:37:cc:5e:36:43:0e:79:c7:a8:88:63:8b cn = ca disig sha-256 fingerprint: 92:bf:51:19:ab:ec:ca:d0:b1:33:2d:c4:e1:d0:5f:ba:75:b5:67:90:44:ee:0c:a2:6e:93:1f:74:4f:2f:33:cf the following ca certificates were added cn = szafir root ca2 sha-256 fingerprint: a1:33:9d:33:28:1a:0b:56:e5:57:d3:d3:2b:1c:e7:f9:36:7e:b0:94:bd:5f:a7:2a:7e:50:04:c8:de:d7:ca:fe cn = certum trusted network ca 2 sha-256 fingerprint: b6:76:f2:ed:da:e8:77:5c:d3:6c:b0:f6:3c:d1:d4:60:39:61:f4:9e:62:65:ba:01:3a:2f:03:07:b6:d0:b8:04 the following ca certificate...
... had the email trust bit turned on cn = actalis authentication root ca sha-256 fingerprint: 55:92:60:84:ec:96:3a:64:b9:6e:2a:be:01:ce:0b:a8:6a:64:fb:fe:bc:c7:aa:b5:af:c1:55:b3:7f:d7:60:66 security fixes in nss 3.23 bug 1245528 / cve-2016-1950 - fixed a heap-based buffer overflow related to the parsing of certain asn.1 structures.
NSS 3.28.1 release notes
the bug fixes in nss 3.28.1 are described in the "bugs fixed" section below.
... notable changes in nss 3.28.1 the following ca certificates were removed cn = buypass class 2 ca 1 sha-256 fingerprint: 0f:4e:9c:dd:26:4b:02:55:50:d1:70:80:63:40:21:4f:e9:44:34:c9:b0:2f:69:7e:c7:10:fc:5f:ea:fb:5e:38 cn = root ca generalitat valenciana sha-256 fingerprint: 8c:4e:df:d0:43:48:f3:22:96:9e:7e:29:a4:cd:4d:ca:00:46:55:06:1c:16:e1:b0:76:42:2e:f3:42:ad:63:0e ou = rsa security 20...
...48 v3 sha-256 fingerprint: af:8b:67:62:a1:e5:28:22:81:61:a9:5d:5c:55:9e:e2:66:27:8f:75:d7:9e:83:01:89:a5:03:50:6a:bd:6b:4c the following ca certificates were added ou = ac raiz fnmt-rcm sha-256 fingerprint: eb:c5:57:0c:29:01:8c:4d:67:b1:aa:12:7b:af:12:f7:03:b4:61:1e:bc:17:b7:da:b5:57:38:94:17:9b:93:fa cn = amazon root ca 1 sha-256 fingerprint: 8e:cd:e6:88:4f:3d:87:b1:12:5b:a3:1a:c3:fc:b1:3d:70:16:de:7f:57:cc:90:4f:e1:cb:97:c6:ae:98:19:6e cn = amazon root ca 2 sha-256 fingerprint: 1b:a5:b2:aa:8c:65:40:1a:82:96:01:18:f8:0b:ec:4f:62:30:4d:83:ce:c4:71:3a:19:c3:9c:01:1e:a4:6d:b4 cn = amazon root ca 3 sha-256 fingerprint: 18:ce:6c:fe:7b:f1:4e:60:b2:e3:47:b8:df:e8:68:cb:31:d0:2e:bb:3a:da:27:15:...
NSS 3.28.5 release notes
the bug fixes in nss 3.28.5 are described in the "bugs fixed" section below.
... notable changes in nss 3.28.5 the following ca certificates were removed: o = japanese government, ou = applicationca sha-256 fingerprint: 2d:47:43:7d:e1:79:51:21:5a:12:f3:c5:8e:51:c7:29:a5:80:26:ef:1f:cc:0a:5f:b3:d9:dc:01:2f:60:0d:19 cn = wellssecure public root certificate authority sha-256 fingerprint: a7:12:72:ae:aa:a3:cf:e8:72:7f:7f:b3:9f:0f:b3:d1:e5:42:6e:90:60:b0:6e:e6:f1:3e:9a:3c:58:33:cd:4...
...3 cn=tÜrktrust elektronik sertifika hizmet sağlayıcısı h6 sha-256 fingerprint: 8d:e7:86:55:e1:be:7f:78:47:80:0b:93:f6:94:d2:1d:36:8c:c0:6e:03:3e:7f:ab:04:bb:5e:b9:9d:a6:b7:00 cn=microsec e-szigno root sha-256 fingerprint: 32:7a:3d:76:1a:ba:de:a0:34:eb:99:84:06:27:5c:b1:a4:77:6e:fd:ae:2f:df:6d:01:68:ea:1c:4f:55:67:d0 the following ca certificates were added: cn = d-trust root ca 3 2013 sha-256 fingerprint: a1:a8:6d:04:12:1e:b8:7f:02:7c:66:f5:33:03:c2:8e:57:39:f9:43:fc:84:b3:8a:d6:af:00:90:35:dd:94:57 trust flags: email cn = tubitak kamu sm ssl kok sertifikasi - surum 1 sha-256 fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 ...
NSS 3.30.2 release notes
the bug fixes in nss 3.30.2 are described in the "bugs fixed" section below.
... notable changes in nss 3.30.2 the following ca certificates were removed: o = japanese government, ou = applicationca sha-256 fingerprint: 2d:47:43:7d:e1:79:51:21:5a:12:f3:c5:8e:51:c7:29:a5:80:26:ef:1f:cc:0a:5f:b3:d9:dc:01:2f:60:0d:19 cn = wellssecure public root certificate authority sha-256 fingerprint: a7:12:72:ae:aa:a3:cf:e8:72:7f:7f:b3:9f:0f:b3:d1:e5:42:6e:90:60:b0:6e:e6:f1:3e:9a:3c:58:33:cd:4...
...3 cn=tÜrktrust elektronik sertifika hizmet sağlayıcısı h6 sha-256 fingerprint: 8d:e7:86:55:e1:be:7f:78:47:80:0b:93:f6:94:d2:1d:36:8c:c0:6e:03:3e:7f:ab:04:bb:5e:b9:9d:a6:b7:00 cn=microsec e-szigno root sha-256 fingerprint: 32:7a:3d:76:1a:ba:de:a0:34:eb:99:84:06:27:5c:b1:a4:77:6e:fd:ae:2f:df:6d:01:68:ea:1c:4f:55:67:d0 the following ca certificates were added: cn = d-trust root ca 3 2013 sha-256 fingerprint: a1:a8:6d:04:12:1e:b8:7f:02:7c:66:f5:33:03:c2:8e:57:39:f9:43:fc:84:b3:8a:d6:af:00:90:35:dd:94:57 trust flags: email cn = tubitak kamu sm ssl kok sertifikasi - surum 1 sha-256 fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 ...
NSS 3.31 release notes
nss 3.31 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_31_rtm/src/ new in nss 3.31 new functionality allow certificates to be specified by rfc7512 pkcs#11 uris.
... allow querying a certificate object for its temporary or permanent storage status in a thread safe way.
... previously, ssl_versionrangeset and ssl_versionrangesetdefault returned a failure if the requested version range wasn't fully allowed by the systemwide crypto policy.
NSS 3.43 release notes
new in nss 3.43 new functionality new functions in sechash.h hash_gethashoidtagbyhashtype - convert type hash_hashtype to type secoidtag in sslexp.h ssl_sendcertificaterequest - allow server to request post-handshake client authentication.
...note that while the mechanism is present, post-handshake authentication is currently not tls 1.3 compliant due to bug 1532312 notable changes in nss 3.43 the following ca certificates were added: cn = emsign root ca - g1 sha-256 fingerprint: 40f6af0346a99aa1cd1d555a4e9cce62c7f9634603ee406615833dc8c8d00367 cn = emsign ecc root ca - g3 sha-256 fingerprint: 86a1ecba089c4a8d3bbe2734c612ba341d813e043cf9e8a862cd5c57a36bbe6b cn = emsign root ca - c1 sha-256 fingerprint: 125609aa301da0a249b97a8239cb6a34216f44dcac9f3954b14292f2e8c8608f cn = emsign ecc root ca - c3 sha-256 fingerprint: bc4d809b15189d78db3e1d8cf4f9726a795da1643ca5f1358e1ddb0edc0d7eb3 ...
... cn = hongkong post root ca 3 sha-256 fingerprint: 5a2fc03f0c83b090bbfa40604b0988446c7636183df9846e17101a447fb8efd6 the following ca certificates were removed: none bugs fixed in nss 3.43 bug 1528669 and bug 1529308 - improve gyp build system handling bug 1529950 and bug 1521174 - improve nss s/mime tests for thunderbird bug 1530134 - if docker isn't installed, try running a local clang-format as a fallback bug 1531267 - enable fips mode automatically if the system fips mode flag is set bug 1528262 - add a -j option to the strsclnt command to specify sigschemes bug 1513909 - add manual for nss-policy-check bug 1531074 - fix a deref after a null check in seckey_setpublicvalue bug 1517714 - properly handle esni with hrr bug 1529813 - expose hkdf-expan...
NSS 3.47 release notes
notable changes in nss 3.47 bug 1152625 - support aes hw acceleration on armv8 bug 1267894 - allow per-socket run-time ordering of the cipher suites presented in clienthello bug 1570501 - add cmac to freebl and pkcs #11 libraries bugs fixed in nss 3.47 bug 1459141 - make softoken cbc padding removal constant time bug 1589120 - more cbc padding tests bug 1465613 - add ability to distrust certificates issued after a certain date for a specified root cert bug 1588557 - bad debug statemen...
...ys bug 1586456 - unnecessary conditional in pki3hack, pk11load and stanpcertdb bug 1576307 - check mechanism param and param length before casting to mechanism-specific structs bug 1577953 - support longer (up to rfc maximum) hkdf outputs bug 1508776 - remove refcounting from sftk_freesession (cve-2019-11756) bug 1494063 - support tls exporter in tstclnt and selfserv bug 1581024 - heap overflow in nss utility "derdump" bug 1582343 - soft token mac verification not constant time bug 1578238 - handle invald tag sizes for ckm_aes_gcm bug 1576295 - check all bounds when encrypting with seed_cbc bug 1580286 - nss rejects tls 1.2 records with large padding with sha384 hmac bug 1577448 - create additional nested s/mime test messages for thunderbird bug 1399095 - allow nss-try to be used ...
...to test nspr changes bug 1267894 - libssl should allow selecting the order of cipher suites in clienthello bug 1581507 - fix unportable grep expression in test scripts bug 1234830 - [cid 1242894][cid 1242852] unused values bug 1580126 - fix build failure on aarch64_be while building freebl/gcm bug 1385039 - build nspr tests as part of nss continuous integration bug 1581391 - fix build on openbsd/arm64 after bug #1559012 bug 1581041 - mach-commands -> mach-completion bug 1558313 - code bugs found by clang scanners.
nss tech note6
the following applies to nss 3.8 through 3.10 : on 32-bit solaris sparc (i.e., not x86, and not 64-bit sparc) and 32-bit hp-ux pa-risc (i.e., not itanium, and not 64-bit pa-risc), there are two more .chk files: libfreebl_pure32_3.chk and libfreebl_hybrid_3.chk.
... the following applies to nss 3.11 : the low-level freebl cryptographic code has been separated from softoken on all platforms.
...if you still decide to make unsupported changes, you can allow the softoken to come up in fips 140 mode of operation by regenerating the .chk files yourself.
nss tech note8
every ssl socket has two function pointers, ss->sec.cache and ss->sec.uncache, which have the following types: typedef void (*sslsessionidcachefunc) (sslsessionid *sid); typedef void (*sslsessioniduncachefunc)(sslsessionid *sid); there are two separate implementations of each function, one for clients and one for servers.
... the objectives were to make the server session cache faster, and to fix bugs that caused corruption in multi-process servers, and also to allow separate virtual servers to have their own session caches.
... the new approach was to use shared memory for the server session cache, and to allow multiple different server session caches to coexist.
Notes on TLS - SSL 3.0 Intolerant Servers
it is designed to permit a server to detect a man-in-the-middle that is altering the ssl client hello (connection) requests as they pass from the client to the server, altering them by changing the protocol version number to a lower version number.
... servers currently known to exhibit this intolerant behavior as of this writing, this problem has been reported for the following servers: (wherever there is an upgraded version which fixes the problem, it is indicated by an asterisked remark in the parentheses.
...but if you're running netscape 6.0/6.01/6.1 pr 1 or mozilla build (prior to 6/11/2001), you should look out for the symptom described below.
FC_InitToken
syntax ck_rv fc_inittoken( ck_slot_id slotid, ck_char_ptr ppin, ck_ulong ulpinlen, ck_char_ptr plabel ); parameters fc_inittoken() has the following parameters: slotid the id of the token's slot ppin the password of the security officer (so) ulpinlen the length in bytes of the so password plabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated description fc_inittoken() initializes a brand new token or re-initializes a token that was initialized before.
...(user certs are the certificates that have their associated private keys in the key database.) a user must be able to call fc_inittoken() without logging into the token (to assume the nss user role) because either the user's password hasn't been set yet or the user forgets the password and needs to blow away the password-encrypted private key database and start over.
... return value fc_inittoken() returns the following return codes.
NSS Key Functions
syntax include <key.h> include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following parameter: key a pointer to the private key structure to destroy.
...when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
...if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems.
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.
...the options and arguments for the cmsutil command are defined as follows: -d decode a message.
...arguments option arguments modify an action and are lowercase.
NSS tools : pk12util
this allows the certificates to be fed to another application that supports .p12 files.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type.
sslkey.html
syntax #include <key.h> #include <keyt.h> void seckey_destroyprivatekey(seckeyprivatekey *key); parameter this function has the following parameter: key a pointer to the private key structure to destroy.
...when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy.
...if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems.
NSS tools : cmsutil
MozillaProjectsNSStoolscmsutil
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.
...the options and arguments for the cmsutil command are defined as follows: -d decode a message.
... arguments option arguments modify an action and are lowercase.
NSS tools : pk12util
this allows the certificates to be fed to another application that supports .p12 files.
...nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type.
Installing Pork
build and install mcpp mcpp generates macro expansion comments that allow pork's elsa to undo macros, which is necessary in order to get exact position information.
... svn co https://mcpp.svn.sourceforge.net/svnroot/mcpp/trunk mcpp cd mcpp ./configure --enable-replace-cpp make sudo make install note: if you followed the dehydra installation instructions for linux and compiled your own gcc, then you should not need to "sudo" make install.
... hg clone http://hg.mozilla.org/rewriting-and-analysis/pork/ cd pork hg clone http://hg.mozilla.org/rewriting-and-analysis/elsa ./configure make building mozilla with mcpp to build mozilla with mcpp to generate annotated .ii files, use the following configure command: ac_cv_visibility_hidden=no cc="gcc34 -save-temps -wp,-w0,-k" cxx="g++ -save-temps -wp,-w0,-k" cppflags=-dns_disable_literal_template $srcdir/configure --enable-debug --disable-optimize --disable-accessibility --enable-application=browser --disable-crashreporter building will probably require disabling warnings_as_errors: make warnings_as_errors= "-wp,-w0,-k" are option...
Tutorial: Embedding Rhino
the javascript feature calledliveconnect allows javascript programs to interact with java objects: $ java runscript "java.lang.system.out.println(3)" 3.0 undefined implementing interfaces using rhino, javascript objects can implement arbitrary java interfaces.
...f("my args") = my arg using javascript variables to print out the value of x, we add the following code: object x = scope.get("x", scope); if (x == scriptable.not_found) { system.out.println("x is not defined."); } else { system.out.println("x = " + context.tostring(x)); } calling javascript functions to get the function f, call it, and print the result, we add this code: object fobj = scope.get("f", scope); if (!(fobj instanceof function)) { system.out.println("f is undefi...
...we'll go through it method by method below.
Rhino license
license for portions of the rhino debugger additionally, some files (currently the contents of toolsrc/org/mozilla/javascript/tools/debugger/treetable/) are available under the following license: * copyright 1997, 1998 sun microsystems, inc.
... * * redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.
... * * - redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution.
Performance Hints
not only is it good programming practice, it can speed up your code by allowing the compiler to generate special code to access the variables.
...calls to eval are slow because the script being executed must be compiled.
... constructing a new function object can be slow for the same reason, while function expressions are more efficient because the function can be compiled.
Shumway
it is expected to be included in firefox at some point to allow plugin-free compatibility with swf-based games and animations.
...users who disable flash because of security or performance concerns can still see content through shumway because it cannot be forced to behave worse than javascript (and webgl, etc.) allows.
...several methods exist to allow inspector access to your swf file.
SpiderMonkey compartments
javascript objects (including javascript functions, which are objects also) are only allowed to touch objects in the same compartment.
...the javascript engine enforces this requirement at a very low level.
...this allows the garbage collecting of individual compartments, in addition to global collection.
Functions
this is slow, not only because walking the scope chain is a drag, but also because we'd rather avoid actually creating the scope chain at all, if possible.
...flat closures and null closures have been removed: https://bugzilla.mozilla.org/show_bug.cgi?id=730497 https://bugzilla.mozilla.org/show_bug.cgi?id=739808 name lookups in order of speed, fastest to slowest.
...otherwise the gvar instructions are as slow as name instructions.
Garbage collection
this allows compartments to be used for security checks: objects in the same compartment have the same access requirements, so no checks are needed, but checks may be done when traversing cross-compartment wrappers.
... todo decent diagrams the basic problem is as follows (see dictionary for color terms).
...see also: gray, below.
JSClass.flags
the jsclass.flags field allows an application to enable optional jsclass features on a per-class basis.
...its value is the logical or of zero or more of the following constants: flag meaning jsclass_has_private this class uses private data.
... an object obj that emulates undefined behaves like any other object, except in the following ways: typeof obj === "undefined" obj converts to false when obj is converted to a boolean when used in boolean contexts (if conditions, loop continuation/termination conditions [for/while/do { } while], the condition in a ternary ?: expression, and so on) (obj == undefined) is true, and (obj != undefined) is false (obj == null) is true, and (obj != null) is false ...
JSDeletePropertyOp
jsclass hooks jsclass offers the following hook: jsclass.delproperty is called during most property deletions, even when obj has no property named id.
... if no error occurred, but the deletion attempt wasn't allowed (perhaps because the property was non-configurable), set *succeeded to false and return true.
... if no error occurred and the deletion wasn't disallowed (this is *not* the same as saying that a deletion actually occurred -- deleting a non-existent property, or an inherited property, is allowed -- it's just pointless), set *succeeded to true and return true.
JSErrorReport
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 the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents.
... flags unsigned the logical or of zero or more of the following flags: jsreport_warning this "error" is really only a warning.
JSNewEnumerateOp
see the description below.
...see the description below.
...see the description below.
JSPropertyDescriptor
properties a descriptor is an object that can have the following key values field name description getter the get syntax binds an object property to a function that will be called when that property is looked up.
... examples the following example demonstrates how to use the object.defineproperty() function to create a property under an object in a javascript via a descriptor.
... in other words, the above code is equivalent to the following code.
JSPropertyOp
the meaning of this variable is different for each of the hooks; see below.
...these different cases are described in more detail in the sections below.
... jsclass hooks jsclass offers following hooks: jspropertyop jsclass.addproperty is called just after a new property is added to an object.
JS_GetLocaleCallbacks
callback functions struct jslocalecallbacks { jslocaletouppercase localetouppercase; jslocaletolowercase localetolowercase; jslocalecompare localecompare; // not used #if expose_intl_api jslocaletounicode localetounicode; }; typedef bool (* jslocaletouppercase)(jscontext *cx, js::handlestring src, js::mutablehandlevalue rval); typedef bool (* jslocaletolowercase)(jscontext *cx, js::handlestring src, js::mutablehandlevalue rval); typedef bool (* jslocalecompare)(jsc...
... jslocaletolowercase implementation of string.prototype.tolocalelowercase() function.
...see also mxr id search for js_getlocalecallbacks mxr id search for js_setlocalecallbacks mxr id search for jslocalecallbacks mxr id search for jslocaletouppercase mxr id search for jslocaletolowercase mxr id search for jslocalecompare mxr id search for jslocaletounicode ...
JS_GetSecurityCallbacks
callback structure struct jssecuritycallbacks { jscspevalchecker contentsecuritypolicyallows; // added in spidermonkey 1.8.5 jssubsumesop subsumes; // added in spidermonkey 31 jscheckaccessop checkobjectaccess; // obsolete since jsapi 29 jsprincipalstranscoder principalstranscoder; // obsolete since jsapi 13 jsobjectprincipalsfinder findobjectprincipals; // obsolete since jsapi 13 }; name type description cont...
...entsecuritypolicyallows jscspevalchecker a pointer to the function which checks if a csp instance wants to disable eval() and friends.
...it allows the embedding to control certain aspects of js code execution based on security settings of the global object the code is executed in.
JS_LookupProperty
see flags below.
...flags js_lookuppropertywithflags and js_lookuppropertywithflagsbyid allow the caller to specify flags requesting special lookup behavior.
...otherwise, flags must be the logical or of one or more of the following bits: jsresolve_qualified behave as though the property name appeared to the right of a dot, as in alert(obj.name).
JS_ReportOutOfMemory
syntax void js_reportoutofmemory(jscontext *cx); void js_reportallocationoverflow(jscontext *cx); // added in spidermonkey 1.8 name type description cx jscontext * the context in which to report the error.
... call js_reportallocationoverflow if an operation fails because it tries to use more memory (or more of some other resource) than the application is designed to handle.
... see also mxr id search for js_reportoutofmemory mxr id search for js_reportallocationoverflow bug 422348 ...
JS_SET_TRACING_DETAILS
printer jstracenameprinter a callback function, described below; or null.
... description set debugging information about a reference to a traceable thing to prepare for the following call to js_calltracer.
...the storage for name or callback's arguments needs to live only until the following call to js_calltracer returns.
JS_SetGCCallback
status jsgcstatus one of the jsgcstatus constants, described below, indicating the stage of gc.
...sometimes several gc cycles happen in a row, so jsgc_begin is followed by alternating jsgc_mark_end and jsgc_finalize_end callbacks, followed at last by jsgc_end.
...some quirky behavior follows from this: the javascript engine can call the gc callback reentrantly on a single thread.
JS_SetNativeStackQuota
this article covers features introduced in spidermonkey 17 enable or disable checks to avoid overflowing the c stack.
... spidermonkey allows for a distinction between system code (such as gcs, which may incidentally be triggered by script but are not strictly performed on behalf of such script), trusted script (as determined by js_settrustedprincipals), and untrusted script.
... each kind of code may have a different stack quota, allowing embedders to keep higher-priority machinery running in the face of scripted stack exhaustion by something else.
JS_SetProperty
if the lookup found no property with the given name, or if it found that obj inherits such a property from a non-native object, then a new own property is added to obj, as described below.
... otherwise, if obj has an own property with the given name, then the existing property's value is set as described below.
...this is done as follows.
SpiderMonkey 1.8
it is much faster than spidermonkey 1.7 and contains a few new language features and api features, described in detail below.
... js_reportallocationoverflow can be used (instead of js_reportoutofmemory) to indicate that the script is trying to do something that would require more memory than the implementation is designed to handle.
... the main difference is that js_reportallocationoverflow throws an exception which the application may catch.
SpiderMonkey 31
it also contains new language and api features described in detail below.
... the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
SpiderMonkey 38
it also contains new language and api features described in detail below.
... the following features in earlier versions of spidermonkey have been dropped.
... these and other changes are explained in detail below.
Setting up CDT to work on SpiderMonkey
please follow those instructions up until the point of invoking configure.
...due to a bug in cdt, you have to make a small change to cdt's build configuration as explained in step 3 below for that to work, though.
... step 2 - installing eclipse and setting up the project the following run-down is a condensed and updated version of what is explained in much more detail for the entire mozilla codebase.
TPS History Lists
the history list used for operations other than delete has the following properties: uri: required.
...an array of objects representing visits to the page, each object has the following properties: type: required.
...an object with begin and end properties, which should have integer values that express time since the present in hours (see date above) for example: var history_to_delete = [ { uri: "http://www.cnn.com/" }, { begin: -24, end: -1 }, { host: "www.google.com" } ]; history lists and phase actions history lists cannot be modified, they can only be added, deleted, and verified, using the following functions: history.add history.delete history.verify history.verifynot ...
Thread Sanitizer
adjusting the build configuration create the build configuration file .mozconfig with the following content in your mozilla-central directory: mk_add_options moz_objdir=@topsrcdir@/objdir-ff-tsan mk_add_options moz_make_flags=-j12 # enable llvm specific code and build workarounds ac_add_options --enable-thread-sanitizer # if clang is already in your $path, then these can simply be: # export cc=clang # export cxx=clang++ export cc="/path/to/clang" export cxx="/path/to/clang++" # llvm-s...
... building only the javascript shell if you want to build only the javascript shell instead of doing a full firefox build, the build script below will probably help you to do so.
...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 immediately output symbolized traces much faster.
XUL Accessibility
name the following rules to generate accessible name are applied: check aria-labelledby attribute, name is generated from elements pointed by aria-labelledby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-labelledby="descr1 descr2" /> if the element implements nsidomxullabeledcontrolelement or nsidomxulselectcontrolitemelement interface the...
..."it's label for control" control="control" /> <hbox role="grouping" id="control" /> get tooltiptext attribute if the element is anonymous child of the element that is the direct child of toolbaritem element or the element is direct child of toolbaritem element then title attribute of toolbaritem element is used (currently it's used in firefox ui only) if the element has aria role and the role allows to aggregate name from subtree of element then generate name from subtree of the element description the following rules to generate accessible description are applied: check aria-describedby attribute, description is generated from elements pointed by aria-describedby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-describ...
... <description value="it's label for control" control="control" /> <hbox role="grouping" id="control" /> get tooltiptext attribute value if the aria role is used and it allows to have accessible value then aria-valuetext or aria-valuenow are used if the element is xlink then value is generated from link location actions if the element is xlink then jump action is exposed if the element has registered click event handler then click action is exposed xul elements notification used to display an informative message.
Embedded Dialog API
posing gecko dialogs in embedding applications problem statement an application embedding gecko cannot tightly control its own windows and still allow gecko to be a fully functional web browser.
...but it must be allowed to create additional windows at times perhaps unexpected by the containing appliction.
...its simplest requirements are that the app must allow gecko to create new browser windows and new simple, empty windows.
Mork
MozillaTechMork
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.
...the grammar for mork is as follows: file = header ( dictionary | table | group | row )* header = '// <!-- <mdb:mork:z v="1.4"/> -->' dictionary = '<' ( metadictionary | alias )* '>' table = '{' '-'?
...expanding refers to taking a '^' hex buffer and replacing it with the alias value for the hex key (explained below).
Using the Places keywords API
using the places keywords api the places keywords api allows to assign a keyword to an url.
...it has the following properties: keyword: string representing the keyword url: either a url or spec represeting the url to associate to postdata: optional post data string.
... fetching an entry by keyword the fetch() method acceps a keyword string (or an object having a keywords property) and might resolve to a keyword entry with the following properties: keyword: string representing the keyword url: the url represeted by the keyword postdata: optional post data string.
The Publicity Stream API
this spawns a doorhanger which allows the user to specify which users can view the activity, and (following successful login and authorization with the stream server) registers the activity in a stream at [address].
...possible error codes include: denied - if the user refuses to publicize the activity permissiondenied - if the publicizing site is not allowed to post to the publicity stream networkerror - if the publicity server is unreachable activityparseerror - if the activity contains syntax errors (not proper json) invalidactivity - if the activity contains semantic errors (i.e.
...possible error codes include: denied - if the user does not log in correctly permissiondenied - if the site is not allowed to access the publicity stream networkerror - if the publicity server is unreachable for_apps is a json list of apps that this store has (each represented as its origin url), so that stream events not relating to applications in a given presentation context can be excluded from the return value.
XPCOM Stream Guide
MozillaTechXPCOMGuideStreams
this is also a synchronous (blocking) operation, so if you're in javascript, consider using netutil.jsm as described below.
...a request will have one .onstartrequest(request, context) call, followed by at least one .ondataavailable(...) call, followed by one .onstoprequest(request, context) call.
... the following stream types are known to implement nsiseekablestream: nsstorageinputstream nsstringinputstream nsmultiplexinputstream nspipeinputstream nsfileinputstream nsbufferedinputstream nsfileoutputstream nsbufferedoutputstream complex stream types several stream types leverage primitive stream types to do specialized work.
Components.utils.importGlobalProperties
the following strings are supported: string/object xpcom component atob blob btoa crypto css fetch file nsidomfile indexeddb nodefilter firefox 60 nsidomnodefilter obsolete since gecko 60 rtcidentityprovider textdecoder textenco...
...knowing that, we can just get a valid blob by importing a known module that has the objects, such as services.jsm const {blob, file, services} = cu.import("resource://gre/modules/services.jsm", {}); reference: stackoverflow :: use blob on firefox add-on hiddendomwindow the hidden domwindow has all of these objects automatically imported.
... var domfile = services.appshell.hiddendomwindow.file('/path/to/file'); xpcom components some objects have an xpcom alternative, which typically allows more flexibility then the dom version here is an example of how to use the dom xmlhttprequest through xpcom interface of nsixmlhttprequest: var oreq = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(ci.nsixmlhttprequest); ...
Components.utils
the object currently has the following members: editors!
... exportfunction() export a javascript function from a more-privileged to a less-privileged scope, allowing it to be called in the less-privileged scope.
... getcomponentsforscope() this seemingly-paradoxical api allows privileged code to explicitly give unprivileged code a reference to its own components object (whereas it's normally hidden away on a scope chain visible only to xbl methods).
NS_ConvertASCIItoUTF16
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
NS_ConvertUTF16toUTF8
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
NS_ConvertUTF8toUTF16
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
NS_LossyConvertUTF16toASCII
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
operator+=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
nsACString_internal
eloper.mozilla.org/en/nsadoptingcstring" shape="rect" title="nsadoptingcstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
operator=
return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
... return values this operator returns a reference back to the object being modified to allow operator chaining.
nsAString_internal
eveloper.mozilla.org/en/nsadoptingstring" shape="rect" title="nsadoptingstring"> </map> method overview constructors beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsAdoptingCString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsAdoptingString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsAutoString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsCAutoString
appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut ...
... parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsDependentCSubstring
entsubstring for wide characters nsdependentcsubstring for narrow characters method overview constructors rebind beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsDependentSubstring
entsubstring for wide characters nsdependentcsubstring for narrow characters method overview constructors rebind beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char operator= adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutab...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsFixedCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsFixedString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsPromiseFlatCString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsPromiseFlatString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsString
ubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat operator[] first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsXPIDLCString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
nsXPIDLString
ar replacesubstring trim compresswhitespace assignwithconversion appendwithconversion appendint appendfloat beginreading endreading beginwriting endwriting data length isempty isvoid isterminated charat first last countchar findchar equals equalsascii equalsliteral(const char equalsliteral(char lowercaseequalsascii lowercaseequalsliteral(const char lowercaseequalsliteral(char assign assignascii assignliteral(const char assignliteral(char adopt replace replaceascii append appendascii appendliteral(const char appendliteral(char operator+= insert cut setcapacity setlength truncate getdata getmutabledata set...
...parameters char* data equalsliteral(const char prbool equalsliteral(const char (&)[n]) const - source equalsliteral(char prbool equalsliteral(char (&)[n]) const - source lowercaseequalsascii prbool lowercaseequalsascii(const char*, pruint32) const - source parameters char* data pruint32 len prbool lowercaseequalsascii(const char*) const - source parameters char* data lowercaseequalsliteral(const char prbool lowercaseequalsliteral(const char (&)[n]) const - source lowercaseequalsliteral(char prbool lowercaseequalsliteral(char (&)[n]) const - s...
... @returns the length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
IAccessibleText
three" object would be 4, matching the embed character</li> the caretoffset for "two" would be 2, matching the "o" the caret position/offset is that of the character logically following it, for example to the right of it in a left to right language.
...the caret position/offset is that of the character logically following it, for example to the right of it in a left to right language.
...if endoffset is lower than startoffset, the result is the same as a call with the two arguments being exchanged.
IAccessibleValue
this interface lets you access the value and its upper and lower bounds.
...if this object has no lower bound then an empty object is returned.
...the argument is clipped to the valid interval whose upper and lower bounds are returned by the methods maximumvalue() and minimumvalue(), that is if it is lower than the minimum value the new value will be the minimum and if it is greater than the maximum then the new value will be the maximum.
mozIRegistry
the information below is intended to tell you everything you need to know about how to do that.
...much more information about nsrepository can be found below.
...it will also facilitate building a browser-based application that will allow people to display and edit its contents.
mozIStorageVacuumParticipant
/storage/public/mozistoragevacuumparticipant.idlscriptable components can implement this interface to provide information to allow a database to be periodically vacuumed by the storage service.
...note: if the database is using the wal journal node and the current page size is not the expected one, the journal node will be changed to truncate because wal doesn't allow page size changes.
...return value return true to allow the vacuum operation to proceed, or false if you don't want the database to be vacuumed.
nsIBinaryInputStream
xpcom/io/nsibinaryinputstream.idlscriptable this interface allows consumption of primitive data types from a "binary stream" containing untagged, big-endian binary data, that is as produced by an implementation of nsibinaryoutputstream.
...32-bit length field, followed by length 8-bit chars.
...32-bit length field, followed by length prunichars.
nsIChromeFrameMessageManager
1.0 66 introduced gecko 2.0 inherits from: nsiframemessagemanager last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void loadframescript(in astring aurl, in boolean aallowdelayedload); void removedelayedframescript(in astring aurl); methods loadframescript() loads a script into the remote frame.
... void loadframescript( in astring aurl, in boolean aallowdelayedload ); parameters aurl the url of the script to load into the frame; this must be an absolute url, but data: urls are supported.
... aallowdelayedload if true, the script will be loaded when the remote frame becomes available; otherwise, the script will only be loaded if the frame is already available.
nsIClipboard
hasdatamatchingflavors() this method provides a way to give correct ui feedback about, for instance, whether a paste should be allowed.
... supportsselectionclipboard() this method allows clients to determine if the implementation supports the concept of a separate clipboard for selection.
... supportsfindclipboard() this method allows clients to determine if the implementation supports the concept of a separate clipboard for find search strings.
nsIContentViewer
istabmodalpromptallowed boolean read only.
...if it is non-null, the document will not be destroyed, and the following actions will happen when destroy() is called: sanitize() will be called on the viewer's document the content viewer will set the contentviewer property on the history entry, and release its reference (ownership reversal).
... return value true if the document will allow unloading; otherwise false.
nsIDOMMozNetworkStatsManager
you can test for the presence of the service as follows, for example: if ("moznetworkstats" in navigator) { /* networkstats is available */ } else { alert("i'm sorry, but networkstats services are not supported."); } method overview nsidomdomrequest getsamples(in nsisupports network, in jsval start, in jsval end, [optional] in jsval option...
...it contains the following fields: starttime a date object representing the start time.
...it contains the following fields: appmanifesturl a string used to filter network stats by app.
getFile
see symbolic names below for a list of accepted values.
...the following sections cover these.
... c constant string value notes ns_unix_local_dir "locl" ns_unix_lib_dir "libd" ns_unix_home_dir ns_os_home_dir the following locations are provided only on os/2 builds of gecko.
nsIDownloadManager
also notifies observers of the "download-manager-remove-download" topic with a null subject to allow any download manager consumers to react to the removals.
... also notifies observers of the "download-manager-remove-download" topic with the download id as the subject to allow any download manager consumers to react to the removal.
... exceptions thrown ns_error_failure if the download is not in the following states: download_canceled or download_failed.
nsIFocusManager
void windowlowered(in nsidomwindow awindow); native code only!
...void windowhidden( in nsidomwindow awindow ); parameters awindow native code only!windowlowered called when a window has been lowered.
... void windowlowered( in nsidomwindow awindow ); parameters awindow native code only!windowraised called when a window has been raised.
nsIHttpChannelInternal
forceallowthirdpartycookie boolean force relevant cookies to be sent with this load even if normally they would not be.
... httpupgrade() allows for the use of http to bootstrap another protocol via the rfc 2616 upgrade request header in conjunction with a 101 level response.
...the arguments to nsihttpupgradelistener.ontransportavailable() provide to the new protocol the low level transport streams that are no longer used by http.
nsIINIParserWriter
nsiiniparserwriter xpcom/ds/nsiiniparser.idlscriptable allows 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.
nsIMsgIdentity
replyontop long should replies appear above or below the quoted message.
...0 - replies appear below the quoted message.
... signaturedate long escapedvcard astring dofcc boolean fccfolder astring fccfolderpickermode astring fccreplyfollowsparent boolean draftsfolderpickermode astring tmplfolderpickermode astring bccself boolean note: don't call bccself, bccothers, and bcclist directly, they are only used for migration and backward compatability.
nsIMsgWindow
method overview void displayhtmlinmessagepane(in astring title, in astring body, in boolean clearmsghdr); void stopurls(); void closewindow(); attributes attribute type description windowcommands nsimsgwindowcommands this allows the backend code to send commands to the ui, such as clearmsgpane.
... statusfeedback nsimsgstatusfeedback this allows the backend code to send status feedback to the ui.
... msgheadersink nsimsgheadersink this allows the backend code to send message header information to the ui.
nsINavBookmarkObserver
when a new item is created, all the items following it in the same folder will have their index shifted down, but no additional notifications will be sent.
...when an item is removed, all the items following it in the same folder will have their index shifted down, but no additional notifications will be sent.
... using onbeforeitemremoved() in gecko 1.9.1 if you wish to support onbeforeitemremoved() in applications based on gecko 1.9.1, you must implement your observer's queryinterface() method to match on both nsinavbookmarkobserver and nsinavbookmarkobserver_mozilla_1_9_1_additions, as shown below.
nsINavHistoryObserver
batch delete operations take place in two steps; the notifications come first, followed by a bulk delete.
...batch delete operations take place in two steps; the notifications come first, followed by a bulk delete.
... using onbeforedeleteuri() in gecko 1.9.1 if you wish to support onbeforedeleteuri() in applications based on gecko 1.9.1, you must implement your observer's queryinterface() method to match on both nsinavhistoryobserver and nsinavhistoryobserver_mozilla_1_9_1_additions, as shown below.
nsINavHistoryQueryOptions
expandqueries boolean when set, allows items with "place:" uris to appear as containers, with the container's contents filled in from the stored query.
...note: re-sorting is slower, as is sorting by title or when you have a host name.
...to specify the tag you need to add a folder=tag_folder_id to the query, and only one folder is allowed.
nsIOutputStream
flush() this method may be called to instruct the output stream to write out the contents of any internal buffers to a low-level data sink, such as a file on disk.
... note: this method is defined by this interface in order to allow the output stream to efficiently copy the data from the input stream into its internal buffer (if any).
... native code only!writesegments low-level write method that has access to the stream's underlying buffer.
nsIPermission
the nsipermission interface defines a "permission" object, which is used to allow or block objects (for example cookies, images) from certain sites based on user preferences.
... last changed in gecko 2 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports attributes attribute type description capability pruint32 the permission to set: allow, deny, or unknown (which is the default).
... see nsipermissionmanager.permission_type_constants for allowed values.
nsIProtocolProxyService
after filters have been run, any disabled or disallowed proxies will be removed from the list.
...a proxy is disallowed, for example, if it is a http proxy and the nsiprotocolhandler for the queried uri does not permit proxying via http.
... if a nsiprotocolhandler disallows all proxying, then filters will never have a chance to intercept proxy requests for such urls.
nsIProxyInfo
the value of this attribute is the bit-wise combination of the proxy flags defined below.
... some special values for this attribute include (but are not limited to) the following: "http" - http proxy (or ssl connect for https) "socks" - socks v5 proxy "socks4" - socks v4 proxy "direct" - no proxy "unknown" - unknown proxy (see nsiprotocolproxyservice.resolve()) a future version of this interface may define additional types.
... constants the following "proxy flags" may be bit-wise combined to construct the flags attribute defined on this interface.
nsIScriptableIO
this properly allows platform-independent path construction.
...this should be one of the following types: nsifile: an object returned by getfile() or getfilewithpath(), or any object implementing the nsifile interface.
...this should be one of the following types: nsifile: an object returned by getfile() or getfilewithpath(), or any object implementing the nsifile interface.
nsIWebNavigation
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2 note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead.
... load_flags_allow_third_party_fixup 8192 this flag specifies that the uri may be submitted to a third-party server for correction.
... load_flags_allow_popups 32768 this flag specifies that the load should not be subject to popup blocking checks.
nsIWindowWatcher
it maintains a list of open top-level windows, and allows some operations on them.
...for example the following code will block the system because it will open windows continuously: function mywindowobserver() { this.observe=function(asubject, atopic, adata) { alert("window event: " + atopic) //and this is where the bugs origins because opening this alert will cause a window-open //event and the call of this method again (forever) } } var ww = components.classes["@mozilla.org/embedcomp/...
...aobserver should implement an observe method, which will be called with the following parameters: asubject - the window being opened or closed, sent as an nsisupports which can be nsisupports.queryinterface() (queryinterfaced) to an nsidomwindow.
nsIXPCScriptable
uterobject(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); jsobjectptr innerobject(in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj); void postcreateprototype(in jscontextptr cx, in jsobjectptr proto); attributes attribute type description classname string scriptableflags pruint32 the bitwise or'd set of flags (define below) that indicate the behavior of this object.
...checkaccess 1 << 12 want_call 1 << 13 want_construct 1 << 14 want_hasinstance 1 << 15 want_trace 1 << 16 use_jsstub_for_addproperty 1 << 17 use_jsstub_for_delproperty 1 << 18 use_jsstub_for_setproperty 1 << 19 dont_enum_static_props 1 << 20 dont_enum_query_interface 1 << 21 dont_ask_instance_for_scriptable 1 << 22 classinfo_interfaces_only 1 << 23 allow_prop_mods_during_resolve 1 << 24 allow_prop_mods_to_prototype 1 << 25 dont_share_prototype 1 << 26 dont_reflect_interface_names 1 << 27 want_equality 1 << 28 want_outer_object 1 << 29 want_inner_object 1 << 30 reserved 1 << 31 the high order bit is reserved for consumers of these flags.
... it allows the object to implement the for..in enumeration in javascript.
nsIXULWindow
zlevel unsigned long one of the z level constants below.
... on some platforms, windows with a higher zlevel will be kept above windows with a lower zlevel.
... constants constant value description lowestz 0 loweredz 4 the z level of an independent window opened with the "alwayslowered" chrome flag.
nsIZipReader
set this parameter to null (javascript) or emptycstring() (c++) to get all entries; otherwise, use the following syntax: * matches anything.
...the characters a and z must either both be letters or both be numbers, with the character represented by 'a' having a lower ascii value than the character represented by 'z'.
...it is allowed to open with another file, but it needs to be closed first with close().
NS_CStringContainerInit2
flag values are defined below.
... flag values the aflags parameter is a bit-wise combination of the following values: ns_cstring_container_init_depend data passed into ns_cstringcontainerinit2 is not copied.
...this is significant as it allows the programmer to be certain that ns_cstringgetdata will return a null-terminated character array.
XPCOM reference
in a big change from the original nsiabcard, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible.nsicookie2 mozilla 1 8 branchnsimsgsearchvaluedefined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchvalue.idl nsmsgmessageflagsthe nsmsgmessageflags interface describes possible flags for messages.
...for example, to request the 'show all threads' view use the constant:nsstaticmoduleinfothis data structure is used by ns_initxpcom3 to specify static xpcom modules.standard xpcom componentsthere are a number of components provided in the standard implementation of xpcom; these are as follows.xpcom glue classesthese "glue" classes are provided to make it easier to use xpcom from c++ code.xpcom interface referencethis is a reference to the xpcom interfaces provided by the mozilla platform.xpcom interface reference by groupingthis page lists the current (as of dec.
...all xpcom primitives are scriptable, and they all implement an xpcom interface from the table below.xpcom string functionsxpcom provides these low-level string functions to let you work with strings; however, it's often better to use one of the string classes rather than directly using these functions.
Using nsIPasswordManager
zachlipton 22:52, 18 july 2006 (pdt) the code on this page will work with applications using toolkit 1.8 and below such as firefox 2.0.0.x and thunderbird 2.0.0.x.
...getting nsipasswordmanager to get a component implementing nsipasswordmanager, use the following: var passwordmanager = components.classes["@mozilla.org/passwordmanager;1"] .getservice(components.interfaces.nsipasswordmanager); storing a password to store a password in the password manager, you need three things: a hostname/url (you'll need this to retrieve the password again later), a username, and a password.
...the example below should serve as a starting point: // the host name of the password we are looking for var querystring = 'http://www.example.com'; // ask the password manager for an enumerator: var e = passwordmanager.enumerator; // step through each password in the password manager until we find the one we want: while (e.hasmoreelements()) { try { // get an nsipassword object out of the password mana...
Working with Multiple Versions of Interfaces
fortunately there is a plan of action that we can follow to rectify this.
...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, 0x65, 0x04, 0xa0, 0xa1, 0xce, 0xb6 }}; then follow the recipe.
...to include both retrieval interfaces (and remember the old iid without having to cut and paste) i followed the kind advice of mike shaver and did: #define nsiaccessibleretrieval nsiaccessibleretrieval_old #include "accessibility/nsiaccessibleretrieval_old.h" static const nsiid ns_iaccessibleretrieval_iid_old = ns_iaccessibleretrieval_iid; #undef nsiaccessibleretrieval #undef __gen_nsiaccessibleretrieval_h__ #include "accessibility/nsiaccessibleretrieval.h" and following the identical principle for...
XPIDL Syntax
MozillaTechXPIDLSyntax
this may be followed by the language, as in `%{c++', to output the raw fragment only in the specified language.
...ype_spec ident "=" expr op_decl = [prop_list] (type_spec / "void") parameter_decls raise_list parameter_decls = "(" [*(param_decl ",") param_decl] ")" param_decl = [prop_list] ("in" / "out" / "inout") type_spec ident attr_decl = [prop_list] ["readonly"] "attribute" type_spec *(ident ",") ident ; descending order of precedence expr /= expr ("|" / "^" / "&") expr ; unequal precedence "|" is lowest expr /= expr ("<<" / ">>") expr expr /= expr ("+" / "-") expr expr /= expr ("*" / "/" / "%") expr expr /= ["-" / "+" / "~"] (scoped_name / literal / "(" expr ")" ) ; numeric literals: quite frankly, i'm sure you know how these kinds of ; literals work, and these are annoying to specify in abnf.
...the following is a list of potential features which are parseable but may not result in expected code: struct, union, and enumerated types array declarators (appears to be supported in xpidl_header.c but not xpidl_typelib.c) exception declarations module declarations variable arguments (that makes the abnf get more wonky) sequence types max-length strings fixed-point numbers "any" and "long double...
Mozilla technologies
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.
...it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.xpidlxpidl is an interface description language used to specify xpcom interface classes.xray visiongecko runs javascript from a variety of different sources and at a variety of different privilege levels.xslt 2.0although xslt 2.0 is not natively supported in firefox, it is possible via saxon-b (java)...
... or, more recently, saxon-ce (javascript) to perform xslt 2.0.xtfthe extensible tag framework (xtf) allows adding support for new namespaces using xpcom components to mozilla (written in javascript or c++).
Creating a gloda message query
gloda.daterange([lowerdate1, upperdate1], [lowerdate2, upperdate2], ...): add the constraint that the message date (per the message's date header) must fall within one of the specified inclusive ranges.
... more constraints can be found in the three js files given further below.
...an nsimsgdbhdr is the low-level, old-school, thunderbird xpcom representation of a message.
LDAP Support
this can be accomplished by setting the following preferences: user_pref("mail.autocomplete.commentcolumn", 2); user_pref("ldap_2.servers.directoryname.autocomplete.commentformat", "[ou]"); the first preference tells us to use a comment column in the type down (the default value is 0 for no comment), and that the value for the comment is a custom string unique to each directory.
...it expects the following format: the desired ldap attribute should be wrapped in square brackets.
... ldap schema the following table summarizes the schema used by thunderbird to map between ldap attributes and attributes within the the address book.
Adding items to the Folder Pane
the following code snippet listens for that event: let gnumbersext = { load: function gne_load() { window.removeeventlistener("load", gnumbersext.load, false); let tree = document.getelementbyid("foldertree"); tree.addeventlistener("maprebuild", gnumbersext._insert, false); }, _insert: function gne__insert() { // this function is called when a rebuild occurs } }; window.addeventlis...
...each item in this array satisfies the following interface: id (attribute) a unique string for this object.
...css attributes here }, command: function gne_command() { // just going to alert, to do something here components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice) .alert(window, null, this.text); } }; second, our child items (the numbers 1, 2, and 3) are copies of the following prototype: function numberrow(anumber) { this._number = anumber; } numberrow.prototype = { get id() { return "numbers-child-row-" + this._number; }, get text() { return this._number; }, level: 1, open: false, children: [], getproperties: function gne_kid_getprops() {}, // no-op command: function gne_kid_command() { // just go...
Building a Thunderbird extension 3: install manifest
open the file called install.rdf that you created at the top of your extension's directory hierarchy and paste the following text into the file: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>myfirstext@jen.zed</em:id> <em:name>my first extension</em:name> <em:version>1.0</em:version> <em:creator>jenzed</em:creator> <em:targetapplication> <description> <em:id>{3550f...
...703-e582-4d05-9a08-453d09bdfdc6}</em:id> <em:minversion>1.5</em:minversion> <em:maxversion>5.0.*</em:maxversion> </description> </em:targetapplication> </description> </rdf> the following items (shown in bold) should be customized for your application: <em:id>myfirstext@jen.zed</em:id>: this is the id of the extension.
... the first portion is the short name of the extension and must be in lowercase; the last portion is a two-part period-delimited value such as your first and last name or the top-level domain of your website.
Creating a Custom Column
the following step through will get you well on the road to creating your own columns and populating them with custom data.
...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.
...the following is a list of functions that must be implemented to ensure that your extension works well with thunderbird.
customDBHeaders Preference
as you follow along the step-by-step guide in creating a custom column, you may want to consider a preference setting that exposes custom header data for use in a custom column within thunderbird's main view.
...in addition to the preference outlined in setting up extension development environment, you'll want to add the following preferences: // this allows you to add extra headers while composing messages user_pref("mail.compose.other.header", "x-superfluous,x-other,x-whatever"); // this enables the preservation of custom headers as incoming mail is processed user_pref( "mailnews.customdbheaders", "x-superfluous,x-other"); important: please pay careful attention to the case of the mailnews.customdbheaders preferenc...
...because comparisons are case-insensitive, all of the custom headers get set to lowercase when the data gets migrated to the message database.
libmime content type handlers
the following xp-com interface is implemented by libmime and is necessary for content type handler plugin development.
...the primary * purpose of these handlers will be to represent the attached data in a * viewable html format 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-00a0...
... sample content type handler plugin to see an example of a content type handler plugin, the source for the handler of the content type "text/calendar" can be viewed at the following link: calendar plugin note: this plugin simply creates a blue table in the output stream to identify the fact that it is operational, but the basic constructs of what is needed to build a functional content type handler can be seen.
Using tab-modal prompts
ou can force a prompt to be tab-modal using code like this: var thewindow = gbrowser.contentwindow; let prompt = components.classes["@mozilla.org/prompter;1"] .getservice(components.interfaces.nsipromptfactory) .getprompt(thewindow, components.interfaces.nsiprompt); let bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); the var "thewindow" is a reference to the dom window.
...for example: var factory = components.classes["@mozilla.org/prompter;1"] .getservice(components.interfaces.nsipromptfactory); var prompt = factory.getprompt(gbrowser.contentwindow, components.interfaces.nsiprompt); var bag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); bag.setpropertyasbool("allowtabmodal", true); var promptargs = ["devmo alert", "omg!
...then apply it, like in the example below, here we apply the prompt with a checkbox: var window = gbrowser.contentwindow; var promptfact = components.classes['@mozilla.org/prompter;1'].getservice(components.interfaces.nsipromptfactory); var prompt = promptfact.getprompt(window, components.interfaces.nsiprompt); var promptbag = prompt.queryinterface(components.interfaces.nsiwritablepropertybag2); promptbag.setpropertyasbool('allowtabmodal', true); var ch...
Using COM from js-ctypes
speech synthesis example let's start with following c++ code, which invokes microsoft speech api and says "hello, firefox!" with system default voice, then wait until the speaking done.
... iid_ispvoice, (void**)&pvoice); if (succeeded(hr)) { pvoice->speak(l"hello, firefox!", spf_default, null); pvoice->release(); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code, save it as test.cpp, and run following command in the directory (needs visual studio).
... &iid_ispvoice, (void**)&pvoice); if (succeeded(hr)) { pvoice->lpvtbl->speak(pvoice, l"hello, firefox!", 0, null); pvoice->lpvtbl->release(pvoice); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code, save it as test.c, and run following command in the directory.
Debugging Tips
running the following code shows only partial value information.
... let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p); let pp = p.address(); console.log(pp); the result will be as following: cdata { value: 10 } cdata { x: 10, y: 20 } cdata { contents: cdata } to see more descriptive information, you can use .tosource().
... let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i.constructor.tosource()); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p.constructor.tosource()); let pp = p.address(); console.log(pp.constructor.tosource()); the result will be as per the following: ctypes.int32_t ctypes.structtype("point", [{ "x": ctypes.int32_t }, { "y": ctypes.int32_t }]) ctypes.structtype("point", [{ "x": ctypes.int32_t }, { "y": ctypes.int32_t }]).ptr ...
Declaring and Using Callbacks
in these cases, js-ctypes allows you to pass a regular javascript function as the callback.
... this is very powerful, since it allows native code to transparently call into javascript.
...consider the following code: function myjscallback(foo, bar) { ....
ctypes
large integer types because javascript doesn't support large (64-bit) integers, js-ctypes provides two data types allowing access to 64-bit integer data.
... credit for this example is to nmaier (stackoverflow :: getting tb_button is crashing and not working) example of cast and functiontype on windows components.utils.import("resource://gre/modules/ctypes.jsm"); var kernel = ctypes.open("kernel32.dll"); var hmodule = ctypes.uint32_t; var hwnd = ctypes.uint32_t; var lpctstr = ctypes.jschar.ptr; var lpcstr = ctypes.char.ptr; var loadlibrary = kernel.declare("loadlibraryw", ctypes.winapi_abi, hmodule,...
..."user32"); var funcptr = getprocaddress(huser, "messageboxw"); // now we have a pointer to a function, let's cast it to the right type var messageboxtype = ctypes.functiontype(ctypes.winapi_abi, ctypes.int32_t, [hwnd, lpctstr, lpctstr, ctypes.uint32_t]); funcptr = ctypes.cast(funcptr, messageboxtype.ptr); funcptr(0, "test1", "test2", 0); credit for this example is to wladimir palant (stackoverflow :: how to call a function using pointer in js-ctypes) ...
Flash Activation: Browser Comparison - Plugins
the user can click on the flash object or the location bar icon to activate flash: users have the choice to allow flash just for the current session, or to remember their choice: google chrome in-page ui is displayed when the site attempts to use flash without fallback content: a user can click the plugin element to show a prompt for allowing flash: if the site provides fallback content for an object element, chrome will display that content and will not prompt the user to enable flash.
... a user can click the information icon on the left side of the location bar on any site to open the site information and allow flash on that site: microsoft edge in-page ui is displayed when the site attempts to use flash.
...the user can click the flash object to show activation options: users have the choice to allow flash just for the current session, or to remember their choice: site authoring tips if a flash element is very small, hidden, or covered by other content, users will probably not notice that flash is required and will become confused.
Plugin Roadmap for Firefox - Plugins
below is the roadmap of past and future support for plugins in firefox.
...users choose which sites are allowed to activate each plugin.
... august 2017 starting with firefox 55 in august 2017, users must choose which sites are allowed to activate the flash plugin.
Color vision simulation - Firefox Developer Tools
in the simulate menu, you can choose one option at a time from the following list: none — choose this to return to normal display protanomaly (low red) deuteranomaly (low green) tritanomaly (low blue) protanopia (no red) deuteranopia (no green) tritanopia (no blue) contrast loss these simulations are not completely medically accurate.
... the following table shows a colorful image of a cat's face, and what it looks like in the various simulations.
... simulation image displayed none protanomaly (low red) deuteranomaly (low green) tritanomaly (low blue) protanopia (no red) deuteranopia (no green) tritanopia (no blue) contrast loss ...
Using the Debugger map scopes feature - Firefox Developer Tools
if you want to follow along, use this example.
... 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 the source code and the context menu now includes an option to jump to original location as shown below.
Aggregate view - Firefox Developer Tools
for example, in the screenshot above you can see that javascript objects account for most memory, followed by strings.
...if we click the star-triangle, we'll see all four array instances: for each instance, you can see the retained size and shallow size of that instance.
... in this case, you can see that the first three arrays have a fairly large shallow size (5% of the total heap usage) and a much larger retained size (26% of the total).
Network monitor toolbar - Firefox Developer Tools
the network monitor provides two toolbar areas, one above the main section, and another below.
... a set of tool icons: pause (or resume) recording network log search the log request blocking an array of buttons to filter the network request list by type: by the content type of the response xhr requests websocket upgrades and messages (labeled ws) other requests a checkbox that allows you to disable caching.
... network monitor features the following articles cover different aspects of using the network monitor: network request list network request details network traffic recording performance analysis throttling ...
Paint Flashing Tool - Firefox Developer Tools
this can then cause a site to be slow responding to user input (also known as "janky").
...the example below shows two different ways to move an element using a css transition.
...width:20%; margin: 2%; padding: 2%; background-color: blue; color: white; font-size: 24px; } #moving-box-left-margin { transition: margin-left 4s; } #moving-box-transform { transition: transform 4s; } body:hover #moving-box-left-margin{ margin-left: 74%; } body:hover #moving-box-transform { transform: translate(300%); } to see the transition, move the mouse into the space below: now switch paint flashing on, and try it again.
Call Tree - Firefox Developer Tools
you can find the specific profile we discuss here - just import it to the performance tool to follow along.
... the screenshot below shows the output of a program that compares three sorting algorithms - bubble sort, selection sort, and quicksort.
...each row represents a function in which at least one sample was taken, and the rows are ordered by the number of samples taken while in that function, highest to lowest.
Cookies - Firefox Developer Tools
the cookies table has the following columns: name — the name of the cookie.
...same-site cookies allow servers to mitigate the risk of csrf and information leakage attacks by asserting that a particular cookie should only be sent with requests initiated from the same registrable domain.
... context menu the context menu for each cookie includes the following commands: add item - add a new cookie.
IndexedDB - Firefox Developer Tools
databases have the following details: database name — the name of the database.
...any object store has the following details: object store name — the name of the object store.
... indexes — array of indexes present in the object store as shown below.
AbortController.AbortController() - Web APIs
examples in the following snippet, we aim to download a video using the fetch api.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener.
AbortController.abort() - Web APIs
examples in the following snippet, we aim to download a video using the fetch api.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener.
AbortController.signal - Web APIs
examples in the following snippet, we aim to download a video using the fetch api.
... when the fetch request is initiated, we pass in the abortsignal as an option inside the request's options object (see {signal}, below).
... this associates the signal and controller with the fetch request and allows us to abort it by calling abortcontroller.abort(), as seen below in the second event listener.
AnalyserNode - Web APIs
it is an audionode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations.
... number of inputs 1 number of outputs 1 (but may be left unconnected) 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" f...
... basic usage the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
Attr - Web APIs
WebAPIAttr
<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...
... deprecated properties and methods the following properties have been deprecated.
... the following methods have been deprecated: appendchild() obsolete since gecko 14 modify the value of attr.value instead.
AudioContext.getOutputTimestamp() - Web APIs
the two values are as follows: audiotimestamp.contexttime: the time of the sample frame currently being rendered by the audio output device (i.e., output audio stream position), in the same units and origin as the context's audiocontext.currenttime.
... returns an audiotimestamp object, which has the following properties.
... performancetime: a point in the time coordinate system of a performance interface; the time after the document containing the audio context was first rendered examples in the following code we start to play an audio file after a play button is clicked, and start off a requestanimationframe loop running, which constantly outputs the contexttime and performancetime.
AudioNode - Web APIs
WebAPIAudioNode
a filter like biquadfilternode or convolvernode), or volume control (like gainnode) <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...
... audionode.connect() allows us to connect the output of this node to be input into another node, either as audio data or as the value of an audioparam.
... audionode.disconnect() allows us to disconnect the current node from another one it is already connected to.
Using the Beacon API - Web APIs
the following example specifies a handler for the load and beforeunload events.
...ction analytics(event) { if (!navigator.sendbeacon) return; var url = "https://example.com/analytics"; // create the data to send var data = "state=" + event.type + "&location=" + location.href; // send the beacon var status = navigator.sendbeacon(url, data); // log the data and result console.log("sendbeacon: url = ", url, "; data = ", data, "; status = ", status); }; the following example creates a submit handler and when that event is fired, the handler calls sendbeacon().
... in the following example, a worker sends a beacon using the url and data from the global context.
BeforeInstallPromptEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
...this is provided for user agents that want to present a choice of versions to the user such as, for example, "web" or "play" which would allow the user to chose between a web version or an android version.
... methods beforeinstallpromptevent.prompt() allows a developer to show the install prompt at a time of their own choosing.
Blob.type - Web APIs
WebAPIBlobtype
var i, fileinput, files, allowedfiletypes; // fileinput is a htmlinputelement: <input type="file" multiple id="myfileinput"> fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (simliar to nodelist) files = fileinput.files; // our application only allows gif, png, and jpeg images allowedfiletypes = ["image/png", "image/jpeg", "image/gif"]; for (i = 0; i < files.length; i++) { // test if file.type is an ...
...allowed file type.
... if (allowedfiletypes.indexof(files[i].type) > -1) { // file type matched is one of allowed file types.
Blob - Web APIs
WebAPIBlob
for example, to construct a blob from a json string: const obj = {hello: 'world'}; const blob = new blob([json.stringify(obj, null, 2)], {type : 'application/json'}); creating a url representing the contents of a typed array the following code creates a javascript typed array and creates a new blob containing the typed array's data.
...the following code reads the content of a blob as a typed array: const reader = new filereader(); reader.addeventlistener('loadend', () => { // reader.result contains the contents of blob as a typed array }); reader.readasarraybuffer(blob); another way to read content from a blob is to use a response.
... the following code reads the content of a blob as text: const text = await (new response(blob)).text(); or by using blob.prototype.text(): const text = await blob.text(); by using other methods of filereader, it is possible to read the contents of a blob as a string or a data url.
BroadcastChannel - Web APIs
it allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin.
... <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="middle">eventtarget</text></a><polyline poi...
... broadcastchannel.close() closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected.
Broadcast Channel API - Web APIs
the broadcast channel api allows basic communication between browsing contexts (that is, windows, tabs, frames, or iframes) and workers on the same origin.
...this disconnects the object from the underlying channel, allowing garbage collection.
... // disconnect the channel bc.close(); conclusion the broadcast channel api's self-contained interface allows cross-context communication.
CSS Typed Object Model API - Web APIs
generally, css values can be read and written in javascript as strings, which can be slow and cumbersome.
... css typed om both allows for the performant manipulation of values assigned to css properties while enabling maintainable code that is both more understand and easier to write.
... cssstylevalue.parse(property, csstext) the parse() method of the cssstylevalue interface allows a cssnumericvalue to be constructed from a css string.
Finale - Web APIs
WebAPICanvas APITutorialFinale
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 tagged with "canvas".
Transformations - Web APIs
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.
... ctx.save(); ctx.scale(10, 3); ctx.fillrect(1, 10, 10, 10); ctx.restore(); // mirror horizontally ctx.scale(-1, 1); ctx.font = '48px serif'; ctx.filltext('mdn', -135, 120); } <canvas id="canvas" width="150" height="150"></canvas> draw(); screenshotlive sample transforms finally, the following transformation methods allow modifications directly to the transformation matrix.
Using channel messaging - Web APIs
the channel messaging api allows two separate scripts running in different browsing contexts attached to the same document (e.g., two iframes, or the main document and an iframe, or two documents via a sharedworker) to communicate directly, passing messages between one another through two-way channels (or pipes) with a port at each end.
... message channels on the other hand can provide a secure channel that allows you to pass data between different browsing contexts.
... receiving the port and message in the iframe over in the iframe, we have the following javascript: var list = document.queryselector('ul'); var port2; // listen for the initial port transfer message window.addeventlistener('message', initport); // setup the transferred port function initport(e) { port2 = e.ports[0]; port2.onmessage = onmessage; } // handle messages received on port2 function onmessage(e) { var listitem = document.createelement('li'); listitem.textcon...
Channel Messaging API - Web APIs
the channel messaging api allows two separate scripts running in different browsing contexts attached to the same document (e.g., two iframes, or the main document and an iframe, two documents via a sharedworker, or two workers) to communicate directly, passing messages between one another through two-way channels (or pipes) with a port at each end.
... messageport controls the ports on the message channel, allowing sending of messages from one port and listening out for them arriving at the other.
... portcollection an array of messageports; an experimental solution to allow broadcasting of a message to multiple ports simultaneously.
Clients - Web APIs
WebAPIClients
an options argument allows you to control the types of clients returned.
... clients.claim() allows an active service worker to set itself as the controller for all clients within its scope.
... examples the following example shows an existing chat window or creates a new one when the user clicks a notification.
ContentIndex.getAll() - Web APIs
contentdescription each item returned is an object containing the following data: id: a unique string identifier.
... homepage article video audio icons: optional an array of image resources, defined as an object with the following data: src: a url string of the source image.
... examples the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
ContentIndex - Web APIs
the contentindex interface of the content index api allows developers to register their offline enabled content with the browser.
...to add indexed content async function registercontent(data) { const registration = await navigator.serviceworker.ready; // feature detect content index if (!registration.index) { return; } // register content try { await registration.index.add(data); } catch (e) { console.log('failed to register content: ', e.message); } } retrieving items within the current index the below example shows an asynchronous function that retrieves items within the content index and iterates over each entry, building a list for the interface.
... listelem = document.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorelem.setattribute('href', entry.url); listelem.append(listitem); } readinglistelem.append(listelem); } } unregistering indexed content below is an asynchronous function, that removes an item from the content index.
Credential Management API - Web APIs
these capabilities allow users to sign in without typing passwords, see the federated account they used to sign in to a site, and resume a session without the explicit sign-in flow of an expired session.
...this give users capabilities such as seeing the federated account they used to sign on to a site, or resuming a session without the explicit sign-in flow of an expired session.
... subdomain-shared credentials later version of the spec allow credentials to be retrieved from a different subdomain.
CredentialsContainer.get() - Web APIs
this method collects credentials by calling the "collectfromcredentialstore" method for each credential type allowed by the options argument.
...the options include criteria that the credentials are required or allowed to have, and options for interacting with the user.
... it can contain the following properties: password: a boolean indicating that returned credential instances should include user (as opposed to federated) credentials.
DOMMatrix - Web APIs
WebAPIDOMMatrix
this interface should be available inside web workers, though some implementations don't allow it yet.
...these are aliases for specific components of a 4×4 matrix, as shown below.
... 2d 3d equivalent a m11 b m12 c m21 d m22 e m41 f m42 methods this interface includes the following methods, as well as the methods it inherits from dommatrixreadonly.
DOMParser - Web APIs
WebAPIDOMParser
the possible values are the following: mimetype doc.constructor text/html document text/xml xmldocument application/xml xmldocument application/xhtml+xml xmldocument image/svg+xml xmldocument examples parsing xml once you have created a parser object, you can parse xml from a string using the parsefromstring() met...
... error handling note that if the parsing process fails, the domparser does not throw an exception, but instead returns an error document: <parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml"> (error description) <sourcetext>(a snippet of the source xml)</sourcetext> </parsererror> the parsing errors are also reported to the error console, with the document uri (see below) as the source of the error.
...row errors on unsupported types try { // webkit returns null on unsupported types if ((new domparser()).parsefromstring("", "text/html")) { // text/html parsing is natively supported return; } } catch (ex) {} proto.parsefromstring = function(markup, type) { if (/^\s*text\/html\s*(?:;|$)/i.test(type)) { var doc = document.implementation.createhtmldocument(""); if (markup.tolowercase().indexof('<!doctype') > -1) { doc.documentelement.innerhtml = markup; } else { doc.body.innerhtml = markup; } return doc; } else { return nativeparse.apply(this, arguments); } }; }(domparser)); specifications specification status comment html living standardthe definition of 'dom parsing' in that specification.
DOMTokenList.replace() - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
... first, the html: <span class="a b c"></span> now the javascript: let span = document.queryselector("span"); let classes = span.classlist; let result = classes.replace("c", "z"); console.log(result); if (result) { span.textcontent = classes; } else { span.textcontent = 'token not replaced successfully'; } the output looks like this: polyfill the following polyfill will add the replace method to the domtokenlist class.
... the following code will only work with ie10-11.
Document.getElementsByTagName() - Web APIs
syntax var elements = document.getelementsbytagname(name); elements is a live htmlcollection (but see the note below) of found elements in the order they appear in the tree.
... example in the following example, getelementsbytagname() starts from a particular parent element and searches top-down recursively through the dom from that parent element, building a collection of all descendant elements which match the tag name parameter.
...ome outer text</p> <p>some outer text</p> <button onclick="getallparaelems();"> show all p elements in document</button><br /> <button onclick="div1paraelems();"> show all p elements in div1 element</button><br /> <button onclick="div2paraelems();"> show all p elements in div2 element</button> </body> </html> notes when called on an html document, getelementsbytagname() lower-cases its argument before proceeding.
DocumentFragment - Web APIs
changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made.
... <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="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" ...
...because all of the nodes are inserted into the document at once, only one reflow and render is triggered instead of potentially one for each node inserted if they were inserted separately.
Using the W3C DOM Level 1 Core - Web APIs
for example, the following document <html> <head> <title>my document</title> </head> <body> <h1>header</h1> <p>paragraph</p> </body> </html> has a dom tree that looks like this: (note that, although the above tree is similar to the above document's dom tree, it's not identical, as the actual dom tree preserves whitespace.) when a web browser parses an html document, it builds a dom tree and then uses it to ...
... the w3c dom level 1 core allows you to change a dom tree in any way you want.
...the following script would do the job: html content <body> <input type="button" value="change this document." onclick="change()"> <h2>header</h2> <p>paragraph</p> </body> javascript content function change() { // document.getelementsbytagname("h2") returns a nodelist of the <h2> // elements in the document, and the first is number 0: var header = document.getelementsbytagname("h2").item(...
EffectTiming.easing - Web APIs
ease a decelerated rate of change, going from fast to slow.
... ease-in an accelerated rate of change, going from slow to fast.
... ease-out another decelerated rate of change, going from fast to slow.
Element.clientTop - Web APIs
WebAPIElementclientTop
this is because the offsettop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, (client area includes padding.) therefore, the clienttop value will always equal the integer portion of the .getcomputedstyle() value for "border-top-width".
... syntax var top = element.clienttop; example in the following illustration, the client area is show in white.
...have no significance regarding the client area.) the clienttop value is the distance from where the margin (yellow) area ends and the padding and content areas (white) begin.
Element.requestFullscreen() - Web APIs
the rejection handler receives one of the following exception values: typeerror the typeerror exception may be delivered in any of the following situations: the document containing the element isn't fully active; that is, it's not the current active document.
... it must either be located within the top-level document or in an <iframe> which has the allowfullscreen attribute applied to it.
... detecting full-screen activation you can determine whether or not your attempt to switch to full-screen mode is successful by using the promise returned by requestfullscreen(), as seen in the example below.
Element.setAttribute() - Web APIs
the attribute name is automatically converted to all lower-case when setattribute() is called on an html element in an html document.
...see the example below for a practical demonstration.
... example in the following example, setattribute() is used to set attributes on a <button>.
EventSource - Web APIs
when not used over http/2, sse suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6).
...(from stackoverflow).
... const sse = new eventsource('/api/v1/sse'); /* this will listen only for events * similar to the following: * * event: notice * data: useful data * id: someid * */ sse.addeventlistener("notice", function(e) { console.log(e.data) }) /* similarly, this will listen for events * with the field `event: update` */ sse.addeventlistener("update", function(e) { console.log(e.data) }) /* the event "message" is a special case, as it * will capture events withou...
File - Web APIs
WebAPIFile
the file interface provides information about files and allows javascript in a web page to access their content.
... <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/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-ancho...
... file implements blob, so it also has the following properties available to it: file.prototype.size read only returns the size of the file in bytes.
FileEntrySync - Web APIs
inherits from: entrysync about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011.
... returns filewritersync exceptions this method can raise a fileexception with the following codes: exception description not_found_err the file does not exist.
... returns file exceptions this method can raise a fileexception with the following codes: exception description not_found_err the file does not exist.
FileList - Web APIs
WebAPIFileList
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.
... <!doctype html> <html> <head> </head> <body> <!--multiple is set to allow multiple files to be selected--> <input id="myfiles" multiple type="file"> </body> <script> var pullfiles=function(){ // love the query selector var fileinput = document.queryselector("#myfiles"); var files = fileinput.files; // cache files.length var fl = files.length; var i = 0; while ( i < fl) { // localize file var in the loop var file = files[...
FileReaderSync.readAsArrayBuffer() - Web APIs
the readasarraybuffer() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an arraybuffer.
... exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
FileReaderSync.readAsBinaryString() - Web APIs
the readasbinarystring() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an domstring.
... exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
FileReaderSync.readAsDataURL() - Web APIs
the readasdataurl() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an domstring representing a data url.
... exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
FileReaderSync.readAsText() - Web APIs
the readastext() method of the filereadersync interface allows to read file or blob objects in a synchronous way into an domstring.
... exceptions the following exceptions can be raised by this method: notfounderror is raised when the resource represented by the dom file or blob cannot be found, e.g.
... securityerror is raised when one of the following problematic situation is detected: the resource has been modified by a third party; too many read are performed simultaneously; the file pointed by the resource is unsafe for a use from the web (like it is a system file).
FileSystemDirectoryEntry.getDirectory() - Web APIs
options optional an object based on the filesystemflags dictionary, which allows you to specify whether or not to create the entry if it's missing and if it's an error if the file already exists.
...the fileerror.code specifies what type of error occurred, as follows: fileerror.not_found_err the create option was not specified (or was specified as false), and the directory doesn't exist.
... values and results the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
FileSystemDirectoryEntry.getFile() - Web APIs
options optional an object based on the filesystemflags dictionary, which allows you to specify whether or not to create the entry if it's missing and if it's an error if the file already exists.
...the {domxref("fileerror.code")}} specifies what type of error occurred, as follows: fileerror.not_found_err the create option was not specified (or was specified as false), and the file doesn't exist.
... values and results the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
FileSystemEntry - Web APIs
the snippet below shows you how you can remove a file by name.
... // opening a file system with temporary storage window.requestfilesystem(temporary, 1024*1024 /*1mb*/, function(fs) { fs.root.getfile('log.txt', {}, function(fileentry) { fileentry.remove(function() { console.log('file removed.'); }, onerror); }, onerror); }, onerror); properties this interface provides the following properties.
... methods this interface defines the following methods.
File and Directory Entries API support in Firefox - Web APIs
ry filesystemdirectoryentrysync directoryentrysync filesystemdirectoryreader directoryreader filesystemdirectoryreadersync directoryreadersync filesystementry entry filesystementrysync entrysync filesystemfileentry fileentry filesystemfileentrysync fileentrysync be sure to account for this in your code by allowing for both names.
... to ensure your code will work in both chrome and other browsers, you can include code similar to the following: var filesystemdirectoryentry = window.filesystemdirectoryentry || window.directoryentry; var filesystementry = window.filesystementry || window.entry; limitations in firefox next, let's look at limitations of the firefox implementation of the api.
... in broad strokes, those limitations can be summarized as follows: content scripts can't create file systems or initiate access to a file system.
Using FormData Objects - Web APIs
mplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /><br /> <label>custom file label:</label> <input type="text" name="filelabel" size="12" maxlength="32" /><br /> <label>file to stash:</label> <input type="file" name="file" required /> <input type="submit" value="stash the file!" /> </form> <div></div> then you can send it using code like the following: var form = document.forms.nameditem("fileinfo"); form.addeventlistener('submit', function(ev) { var ooutput = document.queryselector("div"), odata = new formdata(form); odata.append("customfield", "this is some extra data"); var oreq = new xmlhttprequest(); oreq.open("post", "stash.php", true); oreq.onload = function(oevent) { if (oreq.status == 200) { ooutput.in...
... this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself.
..., then invoke a formdata constructor to trigger the formdata event: formelem.addeventlistener('submit', (e) => { // on form submission, prevent default e.preventdefault(); // construct a formdata object, which fires the formdata event new formdata(formelem); }); when the formdata event fires we can access the formdata object using formdataevent.formdata, then do what we like with it (below we post it to the server using xmlhttprequest).
FormData - Web APIs
WebAPIFormData
formdata.entries() returns an iterator allowing to go through all key/value pairs contained in this object.
... formdata.keys() returns an iterator allowing to go through all keys of the key/value pairs contained in this object.
... formdata.values() returns an iterator allowing to go through all values contained in this object.
Guide to the Fullscreen API - Web APIs
let's consider this <video> element: <video controls id="myvideo"> <source src="somevideo.webm"></source> <source src="somevideo.mp4"></source> </video> we can put that video into full-screen mode as follows: var elem = document.getelementbyid("myvideo"); if (elem.requestfullscreen) { elem.requestfullscreen(); } this code checks for the existence of the requestfullscreen() method before calling it.
...for example, <iframe> elements have the allowfullscreen attribute in order to opt-in to allowing their content to be displayed in fullscreen mode.
... document.fullscreenenabled the fullscreenenabled property tells you whether or not the document is currently in a state that would allow fullscreen mode to be requested.
GamepadButton - Web APIs
the gamepadbutton interface defines an individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device.
... example the following code is taken from my gamepad api button demo (you can view the demo live, and find the source code on github.) note the code fork — in chrome navigator.getgamepads needs a webkit prefix and the button values are stored as an array of double values, whereas in firefox navigator.getgamepads doesn't need a prefix, and the button values are stored as an array of gamepadbutton objects; it is the...
...in this simple example i've just allowed either.
Geolocation API - Web APIs
the geolocation api allows the user to provide their location to web applications if they so desire.
...the user's operating system will prompt the user to allow location access the first time it is requested.
... examples in the following example the geolocation api is used to retrieve the user's latitude and longitude.
GlobalEventHandlers.onmousemove - Web APIs
examples tooltips this example creates link tooltips that follow your mouse.
... data-tooltip="second link">&hellip; or here!</a></p> css .tooltip { position: absolute; z-index: 9999; padding: 6px; background: #ffd; border: 1px #886 solid; border-radius: 5px; } javascript const tooltip = new (function() { const node = document.createelement('div'); node.classname = 'tooltip'; node.setattribute('hidden', ''); document.body.appendchild(node); this.follow = function(event) { node.style.left = event.clientx + 20 + 'px'; node.style.top = event.clienty + 10 + 'px'; }; this.show = function(event) { node.textcontent = event.target.dataset.tooltip; node.removeattribute('hidden'); }; this.hide = function() { node.setattribute('hidden', ''); }; })(); const links = document.queryselectorall('a'); links.foreach(link => { ...
...link.onmouseover = tooltip.show; link.onmousemove = tooltip.follow; link.onmouseout = tooltip.hide; }); result draggable elements we also have an example available showing the use of the onmousemove event handler with draggable objects — view the example in action.
GlobalEventHandlers.ontransitioncancel - Web APIs
this could also be used to trigger animations or other effects, to allow chaining of reactions.
... html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such.
... <div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size change, and causes the box to rotate, while the mouse cursor hovers over it.
GlobalEventHandlers.ontransitionend - Web APIs
this could also be used to trigger animations or other effects, to allow chaining of reactions.
... html this simply creates a <div> which we'll style with css below to make into a box that resizes and changes color and such.
... <div class="box"></div> css the css below styles the box and applies a transition effect which makes the box's color and size change, and causes the box to rotate, while the mouse cursor hovers over it.
HTMLAudioElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="mi...
... obsolete mozilla-only methods the following methods are non-standard and should not be used.
... mozsetup() sets up the audio stream to allow writing, given the number of audio channels (1 or 2) and the sample rate in khz.
HTMLBodyElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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,...
... recommendation the following properties are now obsolete: alink, bgcolor, background, link, text, and vlink.
... the following properties have been added: onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload.
HTMLCanvasElement.getContext() - Web APIs
failifmajorperformancecaveat: boolean that indicates if a context will be created if the system performance is low or if no hardware gpu is available.
... "low-power": prioritizes power saving over rendering performance.
... examples given this <canvas> element: <canvas id="canvas" width="300" height="300"></canvas> you can get a 2d context of the canvas with the following code: var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); console.log(ctx); // canvasrenderingcontext2d { ...
HTMLCanvasElement.toBlob() - Web APIs
the code snippet below, for example, takes the image in the <canvas> element whose id is "canvas", obtains a copy of it as a png image, then appends a new <img> element to the document, whose source image is the one created using the canvas.
... 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 a = document.createelement('a'); a.textcontent = 'download'; document.body.appendchild(a); a.style.display = 'block'; a.download = iconname + '.ico'; a.href = window.url.createobjecturl(b); } } canvas.toblob(blobcallback('passthisstring'), 'image/vnd.microsoft.icon', '-moz-parse-opt...
... 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.
HTMLDialogElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/htmldialogelement" target="_top"><rect x="1" y="1" width="170" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="86" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmldialogelement</text></a></svg></div>...
...still allowing interaction with content outside of the dialog.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the htmldialogelement.showmodal() function.
HTMLFieldSetElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" alignme...
... recommendation the following properties have been added: disabled, elements, name, type, valdiationmessage, validity, and willvalidate.
... the following methods have been added: checkvalidity(), setcustomvalidity().
HTMLImageElement.decode() - Web APIs
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 the full-resolution one that's now available.
... examples the following example shows how to use the decode() method to control when an image is appended to the dom.
HTMLImageElement.longDesc - Web APIs
for example, if the image is a png of a flowchart.
... the longdesc property could be used to provide an explanation of the flow of control represented by the chart, using only text.
... consider the following older html: <img src="taco-tuesday.jpg" longdesc="image-descriptions/taco-tuesday.html"> here, the longdesc is used to indicate that the user should be able to access a detailed description of the image taco-tuesday.jpg in the html file image-descriptions/taco-tuesday.html.
HTMLImageElement.sizes - Web APIs
the htmlimageelement property sizes allows you to specify the layout width of the image for each of a list of media conditions.
... syntax let sizes = htmlimageelement.sizes; htmlimageelement.sizes = sizes; value a usvstring containing a comma-separated list of source size descriptors followed by an optional fallback size.
... note: the source size value must not be specified as a percentage of the container size; that is, lengths such as 50% or 100% are not allowed, as there would be uncertainty as to what the specified value is a percentage of.
HTMLImageElement.x - Web APIs
in the diagram below, the left border edge is the left edge of the blue padding area.
... example the example below demonstrates the use of the htmlimageelement properties x and y.
..."2" class="group1"> <col> </colgroup> <tr> <th>userid</th> <th>name</th> <th>avatar</th> </tr> <tr> <td>12345678</td> <td>johnny rocket</td> <td><img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below.
HTMLImageElement.y - Web APIs
in the diagram below, the top border edge is the top edge of the blue padding area.
... example the example below demonstrates the use of the htmlimageelement properties x and y.
..."2" class="group1"> <col> </colgroup> <tr> <th>userid</th> <th>name</th> <th>avatar</th> </tr> <tr> <td>12345678</td> <td>johnny rocket</td> <td><img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg"</td> </th> </table> <pre id="log"> </pre> javascript the javascript code that fetches the image from the table and looks up its x and y values is below.
HTMLInputElement.stepDown() - Web APIs
the method will not cause the value to go below the min value set or defy the constraints set by the step attribute.
...throws an invalid_state_err exception: if the method is not applicable to for the current type value, if the element has no step value, if the value cannot be converted to a number, if the resulting value is above the max or below the min.
...the stepdown() method will not allow the input to go out of range, in this case stopping when it reaches 0 and rounding down and floats that are passed as a parameter.
HTMLLegendElement - Web APIs
the htmllegendelement is an interface allowing to access properties of the <legend> elements.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"...
... the following property is now obsolete: align.
HTMLMediaElement.play() - Web APIs
possible errors include: notallowederror the user agent (browser) or operating system doesn't allow playback of media in the current context or situation.
... if the user agent is configured not to allow automatic or script-initiated playback of media, calling play() will cause the returned promise to be immediately rejected with a notallowederror.
...see the example below for more information.
HTMLMediaElement.playbackRate - Web APIs
this is used to implement user controls for fast forward, slow motion, and so forth.
... the audio is muted when the fast forward or slow motion is outside a useful range (for example, gecko mutes the sound outside the range 0.25 to 5.0).
...1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster.
HTMLMediaElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 30%; vertical-align: middle; overflow: hidden;"><svg style="display: 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=...
... htmlmediaelement.disableremoteplayback a boolean that sets or returns the remote playback state, indicating whether the media element is allowed to have a remote playback ui.
... the mozframebufferlength property can be set to a new value for lower latency, larger amounts of data, etc.
HTMLScriptElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... examples dynamically importing scripts let's create a function that imports new scripts within a document creating a <script> node immediately before the <script> that hosts the following code (through document.currentscript).
... recommendation the following properties are now obsolete: htmlfor,.
HTMLStyleElement - Web APIs
this interface doesn't allow to manipulate the css it contains (in most case).
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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,3...
... recommendation the following property has been added: scoped.
The HTML DOM API - Web APIs
event handlers for document events defined by the html standard to allow access to mouse and keyboard events, drag and drop, media control, and more.
...this way, the structural features implemented by the node interface are also available to html elements, allowing them to be nested within each other, created and deleted, moved around, and so forth.
... html the html for the form looks like this: <p>please provide the information below.
IDBCursorSync - Web APIs
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.
... remove() deletes the record at the cursor's position, without changing the cursor's position void delete ( ) raises (databaseexception); exceptions this method can raise an idbdatabaseexception with the following code: 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.
IDBDatabase - Web APIs
<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...
... idbdatabase.createmutablefile() creates a file handle, allowing files to be stored inside an indexeddb database.
... example in the following code snippet, we open a database asynchronously (idbfactory), handle success and error cases, and create a new object store in the case that an upgrade is needed (idbdatabase).
IDBDatabaseException - Web APIs
non_transient_err 2 an operation was not allowed on an object.
... not_allowed_err 6 an operation was called on an object where it is not allowed or at a time when it is not allowed.
... ver_err 12 a request to open a database with a version lower than the one it already has.
IDBFactory.open() - Web APIs
WebAPIIDBFactoryopen
exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative number or not a number.
... example 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.
IDBKeyRange.includes() - Web APIs
exceptions this method may raise a domexception of the following type: attribute description dataerror the supplied key was not a valid key.
...for browsers that do not support it, the following polyfill can be used.
... idbkeyrange.prototype.includes = idbkeyrange.prototype.includes || function(key) { var r = this, c; if (r.lower !== undefined) { c = indexeddb.cmp(key, r.lower); if (r.loweropen && c <= 0) return false; if (!r.loweropen && c < 0) return false; } if (r.upper !== undefined) { c = indexeddb.cmp(key, r.upper); if (r.upperopen && c >= 0) return false; if (!r.upperopen && c > 0) return false; } return true; }; specification specification status comment indexed database api draftthe definition of 'includes()' in that specification.
IDBKeyRange.only() - Web APIs
WebAPIIDBKeyRangeonly
exceptions this method may raise a domexception of the following types: exception description dataerror the value parameter passed was not a valid key.
... example the following example illustrates how you'd use an only key range.
... note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.only("a"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = function(event) { var cursor = event.target.result; ...
IDBKeyRange.upper - Web APIs
WebAPIIDBKeyRangeupper
syntax var upper = mykeyrange.upper value the upper bound of the key range (can be any type.) example the following example illustrates how you'd use a key range.
... here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true).
... note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.upper); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = function(event) { var cursor = event.target.result; if(cursor)...
IDBKeyRange.upperBound() - Web APIs
exceptions this method may raise a domexception of the following type: exception description dataerror the value parameter passed was not a valid key.
... example the following example illustrates how you'd use an upper bound key range.
... note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.upperbound("f"); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = function(event) { var cursor = event...
IDBKeyRange.upperOpen - Web APIs
example the following example illustrates how you'd use a key range.
... here we declare keyrangevalue = idbkeyrange.upperbound("f", "w", true, true); — a range that includes everything between "f" and "w" but not including them — since both the upper and lower bounds have been declared as open (true).
... note: for a more complete example allowing you to experiment with key range, have a look at our idbkeyrange-example repo (view the example live too.) function displaydata() { var keyrangevalue = idbkeyrange.bound("f", "w", true, true); console.log(keyrangevalue.upperopen); var transaction = db.transaction(['fthings'], 'readonly'); var objectstore = transaction.objectstore('fthings'); objectstore.opencursor(keyrangevalue).onsuccess = f...
IDBObjectStore.autoIncrement - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = ...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.autoincrement); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; ...
IDBObjectStore.clear() - 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.
... example in the following code snippet, we open a read/write transaction on our database and clear all the current data out of the object store using clear().
... // this is used a lot below db = dbopenrequest.result; // clear all the data form the object store cleardata(); }; function cleardata() { // open a read/write db transaction, ready for clearing the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { note.innerhtml += '<li>transaction completed.</li>'; }; ...
IDBObjectStore.deleteIndex() - Web APIs
return value undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback.
... example in the following example you can see the idbopendbrequest.onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded.
...this is used a lot below db = this.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...
IDBObjectStore.get() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive.
... example in the following code snippet, we open a read/write transaction on our database and get one specific record from object store using get() — a sample record with the key "walk dog".
... // this is used a lot below db = dbopenrequest.result; // run the getdata() function to get the data from the database getdata(); }; function getdata() { // open a read/write db transaction, ready for retrieving the data var transaction = db.transaction(["todolist"], "readwrite"); // report on the success of the transaction completing, when everything is done transaction.oncomplete = function(event) { n...
IDBObjectStore.indexNames - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
... // this is used a lot below db = this.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = db.transa...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.indexnames); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specifica...
IDBObjectStore.keyPath - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = ...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.keypath); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; spec...
IDBObjectStore.name - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = ...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.name); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; }; specifi...
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.
... 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.
... example the following example requests a given record title; when that request is successful the onsuccess function gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request with put().
IDBObjectStore.transaction - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store using add().
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready to insert into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var transaction = ...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); console.log(objectstore.transaction); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of our request note.innerhtml += '<li>request successful.</li>'; }; };...
IDBOpenDBRequest - Web APIs
<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...
... example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded.
...this is used a lot below db = dbopenrequest.result; // run the displaydata() function to populate the task // listwith 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 on...
IDBRequest.error - Web APIs
WebAPIIDBRequesterror
the following error codes are returned under certain conditions: error explanation aborterror if you abort the transaction, then all requests still in progress receive this error.
... versionerror if you try to open a database with a version lower than the one it already has.
... example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store.
IDBTransaction.db - Web APIs
WebAPIIDBTransactiondb
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
...duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need transaction...
IDBTransactionSync - Web APIs
void abort( ) raises (idbdatabaseexception); exceptions this method can raise an idbdatabaseexception with the following code: non_transient_err if this transaction has already been committed or aborted.
... void commit( ) raises (idbdatabaseexception); exceptions this method can raise an idbdatabaseexception with the following codes: non_transient_err if this transaction has already been committed or aborted.
... exceptions the method can raise an idbdatabaseexception with the following code: not_found_err if the requested object store is not in this transaction's scope.
ImageCapture - Web APIs
methods the imagecapture interface is based on eventtarget, so it includes the methods defined by that interface as well as the ones listed below.
... example the following code is taken from chrome's grab frame - take photo sample.
... since imagecapture requires some place to capture an image from, the example below starts with a device's media device (in other words a camera).
Checking when a deadline is due - Web APIs
duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // add our newitem object to the object store var request = objectstore.add(newitem[0]); in this section we create an object called newitem that stores the data in the format required to insert it into the database.
...here we fetch the current minutes (gives an easy numerical value), hours (gives an easy numerical value), day of the month (getdate() is needed for this, as getday() returns the day of the week, 1-7), month (returns a number from 0-11, see below), and year (getfullyear() is needed; getyear() is deprecated, and returns a weird value that is not much use to anyone!) var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if(cursor) { next we create another indexeddb objectstore, and use the opencursor() met...
...when a notification is fired for each item object, its notification property is set to "yes" so this check will not pass on the next iteration, via the following code inside the createnotification() function (read using indexeddb for an explanation): // now we need to update the value of notified to "yes" in this particular data object, so the // notification won't be set off on it again // first open up a tranaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do lis...
compareVersion - Web APIs
method of installtrigger object syntax int compareversion ( string registryname, installversion version); int compareversion ( string registryname, string version); int compareversion ( string registryname, int major, int minor, int release, int build); parameters the compareversion method has the following parameters: registryname the pathname in the client version registry for the component whose version is to be compared.
...in particular, this method returns one of the following values: -5 component not present or not registered.
... the following constants can be used to check the value returned by compareversion: int major_diff = 4; int minor_diff = 3; int rel_diff = 2; int bld_diff = 1; int equal = 0; in communicator 4.5, the following constants are defined and available for checking the value returned by compareversion: <code>installtrigger.major_diff installtrigger.minor_diff installtrigger.rel_diff installtrigger.bld_diff inst...
KeyboardEvent.code - Web APIs
px solid black; } javascript window.addeventlistener("keydown", function(event) { let str = "keyboardevent: key='" + event.key + "' | code='" + event.code + "'"; let el = document.createelement("span"); el.innerhtml = str + "<br/>"; document.getelementbyid("output").appendchild(el); }, true); try it out to ensure that keystrokes go to the sample, click in the output box below before pressing keys.
... "arrowleft": // handle "turn left" angle -= turnrate; break; case "keyd": case "arrowright": // handle "turn right" angle += turnrate; break; } refresh(); // consume the event so it doesn't get handled twice event.preventdefault(); }, true); try it out to ensure that keystrokes go to the sample code, click inside the black game play field below before pressing keys.
...that would allow both smoother and faster movement, but would also allow the player to be moving and steering at the same time.
KeyboardEvent.key - Web APIs
WebAPIKeyboardEventkey
its value is determined as follows: key values see a full list of key values.
...for a given key press, the sequence of keyboardevents fired is as follows assuming that event.preventdefault is not called: a keydown event is first fired.
... try experimenting using the following two test cases: press and hold the shift key, then press 2 and release it.
Keyboard API - Web APIs
the following example demonstrates how to get the location-specific or layout-specific string associated with the key labeled w on an english qwerty keyboard.
...those keys and key combinations are typically captured by the user agent or the underlying operating system, as illustrated in the following example.
...these keys are shown below.
LargestContentfulPaint - Web APIs
may not be available if the element is a cross-origin image loaded without the timing-allow-origin header.
... examples the following example shows how to create a performanceobserver that listens for largest-contentful-paint entries and logs the lcp value to the console.
...(note: `rendertime` may not be available on // image elements loaded cross-origin without the `timing-allow-origin` header.) lcp = lastentry.rendertime || lastentry.loadtime; }); po.observe({type: 'largest-contentful-paint', buffered: true}); // send data to the server.
LockManager.request() - Web APIs
this shared/exclusive lock pattern is common in database transaction architecture, for example to allow multiple simultaneous readers (each requests a "shared" lock) but only one writer (a single "exclusive" lock).
... examples general example the following example shows the basic use of the request() method with an asynchronous function as the callback.
...}); mode example the following example shows how to use the mode option for readers and writers.
LockedFile.getMetadata() - Web APIs
summary the getmetadata method allows to retrieve some metadata about the locked file.
...the following metadata are supported: size : will provide the size of the file lastmodified : will provide the date when the file was last modified return a filerequest object.
...they have the following format: size : a number lastmodified : a date object specifications specification status comment filesystem api editor's draft draft proposal ...
MediaDevices.getDisplayMedia() - Web APIs
possible errors are: aborterror an error or failure that doesn't match any of the other exceptions below occurred.
... notallowederror permission to access a screen area was denied by the user, or the current browsing instance is not permitted access to screen sharing.
... example in the example below, a startcapture() method is created which initiates screen capture given a set of options specified by the displaymediaoptions parameter.
MediaDevices.ondevicechange - Web APIs
html content <p>click the start button below to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <video id="video" width="160" height="120" autoplay></video><br> <div class="left"> <h2>audio devices:</h2> <ul class="devicelist" id="audiolist"></ul> </div> <div class="right"> <h2>video devices:</h2> <ul class="devicelist" id="videolist"></ul> </div> <div id="log"></div> css content body { font: ...
... text-align: center; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; } h2 { margin-bottom: 4px; } .left { float:left; width: 48%; margin-right: 2% } .right { float:right; width: 48%; margin-left: 2% } .devicelist { border: 1px solid black; list-style-type: none; margin-top: 2px; padding: 6px; } javascript content other code below is other code which, while needed to make this example work, isn'tt related directly to ondevicechange, so we won't go into any detail.
...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".
MediaList - Web APIs
WebAPIMediaList
note: medialist is a live list; updating the list using properties or methods listed below will immediately update the behavior of the document.
... properties medialist.mediatext a stringifier that returns a domstring representing the medialist as text, and also allows you to set a new medialist.
... examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document.
MediaRecorder.onerror - Web APIs
in addition to other general errors that might occur, the following errors are specifically possible when using the mediastream recording api; to determine which occurred, check the value of mediarecordererrorevent.error.name.
... securityerror the mediastream is configured to disallow recording.
...try again later."); break; case securityerror: shownotification("recording the specified source " + "is not allowed due to security " + "restrictions."); break; default: shownotification("a problem occurred while trying " + "to record the video."); break; } }; /* this would be a good place to create a worker to handle writing the buffers to disk periodically */ recorder.start(100); /* 100ms time slices per buffe...
MediaRecorder.start() - Web APIs
a final dataavailable event is sent to the mediarecorder, followed by a stop event.
... note: if the browser is unable to start recording or continue recording, it will raise a domerror event, followed by a mediarecorder.dataavailable event containing the blob it has gathered, followed by the mediarecorder.stop event.
... securityerror the mediastream is configured to disallow recording.
MediaSession.setActionHandler() - Web APIs
further details on the action types can be found below under media session actions.
...implement support for each of these in order to allow that type of action to be performed.
... the following strings identify the currently available types of media session action: nexttrack advances playback to the next track.
MediaSession - Web APIs
the mediasession interface of the media session api allows a web page to provide custom behaviors for standard media playback interactions, and to report metadata that can be sent by the user agent to the device or operating system for presentation in standardized user interface elements.
... examples the following example creates a new media session and assigns action handlers to it: if ('mediasession' in navigator){ navigator.mediasession.metadata = new mediametadata({ title: "podcast episode title", artist: "podcast host", album: "podcast name", artwork: [{src: "podcast.jpg"}] }); navigator.mediasession.setactionhandler('play', function() {}); navigator.mediasession.setactionh...
...andler('pause', function() {}); navigator.mediasession.setactionhandler('seekbackward', function() {}); navigator.mediasession.setactionhandler('seekforward', function() {}); navigator.mediasession.setactionhandler('previoustrack', function() {}); navigator.mediasession.setactionhandler('nexttrack', function() {}); } the following example sets up event handlers for pausing and playing: var audio = document.queryselector("#player"); audio.src = "song.mp3"; navigator.mediasession.setactionhandler('play', play); navigator.mediasession.setactionhandler('pause', pause); function play() { audio.play(); navigator.mediasession.playbackstate = "playing"; } function pause() { audio.pause(); navigator.mediasession.playbackstate = "paused"; } specifications specification ...
MediaSessionActionDetails - Web APIs
see media action types below for possible values.
...implement support for each of these in order to allow that type of action to be performed.
... the following strings identify the currently available types of media session action: nexttrack advances playback to the next track.
MediaStreamConstraints.video - Web APIs
html content <p>click the start button below to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <video id="video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-a...
... result using a mediatrackconstraints object now let's look at a similar example that uses a set of constraints based on the mediatrackconstraints dictionary: html content <p>click the start button below to begin the demonstration.</p> <div id="startbutton" class="button"> start </div> <video id="video" width="160" height="120" autoplay></video><br> <div id="log"></div> css content body { font: 14px "open sans", "arial", sans-serif; } video { margin-top: 20px; border: 1px solid black; } .button { cursor: pointer; width: 160px; border: 1px solid black; font-size: 16px; text-a...
...as long as a video input device is available and the user allows it to be used, a video track will be included in the resulting stream, and it will match the specified constraints as well as possible.
MediaStreamTrack - Web APIs
properties in addition to the properties listed below, mediastreamtrack has constrainable properties which can be set using applyconstraints() and accessed using getconstraints() and getsettings().
... mediastreamtrack.enabled a boolean whose value of true if the track is enabled, that is allowed to render the media source stream; or false if it is disabled, that is not rendering the media source stream but silence and blackness.
...this will be one of the following values: "live" which indicates that an input is connected and does its best-effort in providing real-time data.
MediaTrackSupportedConstraints.frameRate - Web APIs
the framerate constraint can be used to establish acceptable upper and lower bounds on the video frame rate for a new video track, or to specify an exact frame rate that must be provided for the request to succeed.
... checking the value of this property lets you determine if the user agent allows constraining the video track configuration by frame rate.
...if the property isn't present, the user agent doesn't allow specifying limits on the frame rate for video tracks.
Media Capabilities API - Web APIs
the media capabilities api allows developers to determine decoding and encoding abilities of the device, exposing information such as whether media is supported and whether playback should be smooth and power efficient, with real time feedback about playback to better enable adaptive streaming, and access to display property information.
... mediadecodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.decodinginfo().
... mediaencodingconfiguration defines the valid values for allowed types of media when the media configuration is submitted as the parameter for mediacapabilities.encodinginfo().
msRealTime - Web APIs
msrealtime is a read/write property which specifies whether or not to enable low-latency playback on the media element.
... syntax ptr = object.msrealtime; value boolean value set to true indicates that low-latency playback will be enabled on the media element.
... low-latency playback is useful in communication and some gaming scenarios, but is more demanding on power consumption and less reliable for smooth media playback.
NDEFReader.scan() - Web APIs
WebAPINDEFReaderscan
signal -- optional abortsignal that allows to cancell this scan() operation.
... exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: aborterror the scan operation was aborted with abortsignal passed in options.
... notallowederror the permission for this operation was rejected.
Navigator.getUserMedia() - Web APIs
your callback can then assign the stream to the desired object (such as an <audio> or <video> element), as shown in the following example: function(stream) { var video = document.queryselector('video'); video.srcobject = stream; video.onloadedmetadata = function(e) { // do something with the video here.
...see {anch("errors")}} below for a list of the errors which can occur.
... navigator.mozgetusermedia; if (navigator.getusermedia) { navigator.getusermedia({ audio: true, video: { width: 1280, height: 720 } }, function(stream) { var video = document.queryselector('video'); video.srcobject = stream; video.onloadedmetadata = function(e) { video.play(); }; }, function(err) { console.log("the following error occurred: " + err.name); } ); } else { console.log("getusermedia not supported"); } ...
Web-based protocol handlers - Web APIs
web-based protocol handlers allow web-based applications to participate in the process too.
... when a browser executes this code, it should display a prompt to the user, asking permission to allow the web application to register as a handler for the protocol.
...therefore, it is a good idea to guard your call to register the protocol handler with a check to see if it is already registered, such as in the example below.
NavigatorID.userAgent - Web APIs
opera 6+ allows users to set the browser identification string via a menu.
... safari and icab allow users to change the browser user agent string to predefined internet explorer or netscape strings via a menu.
...gecko-based browsers comply with the following general structure: useragent = appcodename/appversion number (platform; security; os-or-cpu; localization; rv: revision-version-number) product/productsub application-name application-name-version example alert(window.navigator.useragent) // alerts "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape6/6.1" specifications specification status commen...
Navigator.onLine - Web APIs
the update occurs when the user follows links or when a script requests a remote page.
... to check if you are online, query window.navigator.online, as in the following example: if (navigator.online) { console.log('online'); } else { console.log('offline'); } if the browser doesn't support navigator.online the above example will always come out as false/undefined.
... to see changes in the network state, use addeventlistener to listen for the events on window.online and window.offline, as in the following example: window.addeventlistener('offline', function(e) { console.log('offline'); }); window.addeventlistener('online', function(e) { console.log('online'); }); specifications specification status comment html living standardthe definition of 'navigator.online' in that specification.
Node.nextSibling - Web APIs
WebAPINodenextSibling
the node.nextsibling read-only property returns the node immediately following the specified one in their parent's childnodes, or returns null if the specified node is the last child in the parent element.
...', el.nodename); el = el.nextsibling; i++; } console.groupend(); </script> /************************************************** the console displays the following: siblings of div-1 1.
... the possible inclusion of text nodes must be allowed for when traversing the dom using nextsibling.
NodeList - Web APIs
WebAPINodeList
nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection.
... nodelist.keys() returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection.
... (in this case, the keys are numbers starting from 0.) nodelist.values() returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.
Notification.requestPermission() - Web APIs
possible values for this string are: granted denied default examples assume this basic html: <button onclick="notifyme()">notify me!</button> it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification.
...} we no longer show a live sample on this page, as chrome and firefox no longer allow notification permissions to be requested from cross-origin <iframe>s, with other browsers to follow.
...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.
Notification - Web APIs
examples assume this basic html: <button onclick="notifyme()">notify me!</button> it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification.
...} we no longer show a live sample on this page, as chrome and firefox no longer allow notification permissions to be requested from cross-origin <iframe>s, with other browsers to follow.
...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.
OrientationSensor - Web APIs
interfaces based on orientationsensor below is a list of interfaces based on the orientationsensor interface.
...the rotation maxtrix is shown below.
... examples basic example the following example, which is loosely based on intel's orientation phone demo, instantiates an absoluteorientationsensor with a frequency of 60 times a second.
OscillatorNode - Web APIs
properties inherits properties from its parent, audioscheduledsourcenode, and adds the following properties: oscillatornode.frequency an a-rate audioparam representing the frequency of oscillation in hertz (though the audioparam returned is read-only, the value it represents is not).
... methods inherits methods from its parent, audioscheduledsourcenode, and adds the following: oscillatornode.setperiodicwave() sets a periodicwave which describes a periodic waveform to be used instead of one of the standard waveforms; calling this sets the type to custom.
... examples the following example shows basic usage of an audiocontext to create an oscillator node and to start playing a tone on it.
Page Visibility API - Web APIs
this operates in a similar way across modern browsers, with the details being as follows: in firefox, windows in background tabs each have their own time budget in milliseconds — a max and a min value of +50 ms and -150 ms, respectively.
... the example, which pauses the video when you switch to another tab and plays again when you return to its tab, was created with the following code: // set the name of the hidden property and the change event for visibility var hidden, visibilitychange; if (typeof document.hidden !== "undefined") { // opera 12.10 and firefox 18 and later support hidden = "hidden"; visibilitychange = "visibilitychange"; } else if (typeof document.mshidden !== "undefined") { hidden = "mshidden"; visibilitychange = "msvisibilitychange"; } else ...
... videoelement.addeventlistener("play", function(){ document.title = 'playing'; }, false); } properties added to the document interface the page visibility api adds the following properties to the document interface: document.hidden read only returns true if the page is in a state considered to be hidden to the user, and false otherwise.
PaintWorklet - Web APIs
examples the following three examples go together to show creating, loading, and using a paintworklet.
... create a paintworklet the following shows an example worklet module.
...eom.height/size; y++) { for(let x = 0; x < geom.width/size; x++) { const color = colors[(x + y) % colors.length]; ctx.beginpath(); ctx.fillstyle = color; ctx.rect(x * size, y * size, size, size); ctx.fill(); } } } } // register our class under a specific name registerpaint('checkerboard', checkerboardpainter); load a paintworklet the following example demonstrates loading the above worklet from its js file and does so by feature detection.
PannerNode.PannerNode() - Web APIs
the default is 1, and negative values are not allowed.
...the default is 10000, and non-positive values are not allowed.
...the default is 1, and negative values are not allowed.
PerformanceEventTiming - Web APIs
the performanceeventtiming interface of the event timing api provides timing information for the event types listed below.
... examples the following example shows how to use the api for all events: const observer = new performanceobserver(function(list) { const perfentries = list.getentries().foreach(entry => { // full duration const inputduration = entry.duration; // input delay (before processing event) const inputdelay = entry.processingstart - entry.starttime; // synchronous event processing...
...entries that occurred before calling `observe()` below.
PerformancePaintTiming - Web APIs
<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/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"...
...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".
...e; let performanceentries = performance.getentriesbytype('paint'); performanceentries.foreach( (performanceentry, i, entries) => { console.log("the time to " + performanceentry.name + " was " + performanceentry.starttime + " milliseconds."); }); } else { console.log('performance timing isn\'t supported.'); } } the code above produces console output something like the following: the time to first-paint was 2785.915 milliseconds.
PerformanceResourceTiming - Web APIs
<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/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"...
... properties this interface extends the following performanceentry properties for resource performance entry types by qualifying and constraining them as follows: performanceentry.entrytyperead only returns "resource".
... the interface also supports the following properties which are listed in the order in which they are recorded for the fetching of a single resource.
Pinch zoom gestures - Web APIs
// global vars to cache event state var evcache = new array(); var prevdiff = -1; register event handlers event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup.
...or changes to lightblue if the pinch is closing (zoom out).</div> <!-- ui for logging/debugging --> <button id="log" onclick="enablelog(event);">start/stop event logging</button> <button id="clearlog" onclick="clearlog(event);">clear the log</button> <p></p> <output></output> </body> miscellaneous functions these functions support the application but aren't directly involved in the event flow.
... function remove_event(ev) { // remove this event from the target's cache for (var i = 0; i < evcache.length; i++) { if (evcache[i].pointerid == ev.pointerid) { evcache.splice(i, 1); break; } } } event logging these functions are used to send event activity to the application's window (to support debugging and learning about the event flow).
RTCIceServer - Web APIs
older versions of the webrtc specification included an url property instead of urls; this was changed in order to let you specify multiple addresses for each server in the list, as shown in the example below.
... obsolete properties the following properties have been removed from the specification and should not be used.
... example the configuration below establishes two ice servers.
RTCInboundRtpStreamStats.pliCount - Web APIs
this may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since lost data may be an irrecoverable situation for decoding media.
... however, the primary purpose of this message is to allow the sender to consider techniques to mitigate network performance issues.
... this is often achieved by methods such as increasing the compression, lowering resolution, or finding other ways to reduce the bit rate of the stream.
RTCOutboundRtpStreamStats.pliCount - Web APIs
usage notes upon receiving a pli packet, the sender may have responded by sending a full frame to the remote peer to allow it to re-synchronize with the media.
... however, the primary purpose of a pli packet is to allow the rtcrtpsender for which this rtcoutboundrtpstreamstats object provides statistics to consider techniques to mitigate network performance issues.
... this is often achieved by methods such as increasing the compression or lowering resolution, although the mechanisms available to reduce the bit rate of the stream vary from codec to codec.
RTCPeerConnection.createOffer() - Web APIs
voiceactivitydetection optional some codecs and hardware are able to detect when audio begins and ends by watching for "silence" (or relatively low sound levels) to occur.
...for example, in the case of music or other non-voice transmission, this can cause loss of important low-volume sounds.
...the parameters for this form of createoffer() are described below, to aid in updating existing code.
RTCPeerConnection.setLocalDescription() - Web APIs
the parameters for the older form of setlocaldescription() are described below, to aid in updating existing code.
... deprecated exceptions when using the deprecated callback-based version of setlocaldescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place.
... providing your own offer or answer the example below shows the implementation of a handler for the negotiationneeded event that explicitly creates an offer, rather than letting setlocaldescription() do it.
RTCRtpEncodingParameters.maxBitrate - Web APIs
the rtcrtpencodingparameters dictionary's maxbitrate property specifies the maximum number of bits per second to allow a track encoded with this encoding to use.
...other parameters may further reduce the bandwidth used by the track; for example, maxframerate will, if set low enough, constrain the bandwidth as well.
... in addition, there's no guarantee that the network interface can support the specified bandwidth, in which case the actual bandwidth will be lower.
RTCRtpSender.replaceTrack() - Web APIs
see the example switching cameras below.
...the promise is rejected if the track cannot be replaced for any reason; this is commonly because the change would require renegotiation of the codec, which is not allowed (see things that require negotiation).
... exceptions if the returned promise is rejected, one of the following exceptions is provided to the rejection handler: invalidmodificationerror replacing the rtcrtpsender's current track with the new one would require negotiation.
RTCRtpStreamStats.pliCount - Web APIs
this may trigger the sender to send a full frame in order to allow the receiver to re-synchronize, since lost data may be an irrecoverable situation for decoding media.
... however, the primary purpose of this message is to allow the sender to consider techniques to mitigate network performance issues.
... this is often achieved by methods such as increasing the compression, lowering resolution, or finding other ways to reduce the bit rate of the stream.
ReadableStreamDefaultReader - Web APIs
properties readablestreamdefaultreader.closed read only allows you to write code that responds to an end to the streaming process.
... examples in the following example, an artifical response is created to stream html fragments fetched from another resource to the browser.
... fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" return reader.read().then(({ done, value }) => { // is there no more data to read?
Request.clone() - Web APIs
WebAPIRequestclone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) if intend to modify the request, you may prefer the request constructor.
... example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then clone the request.
... var myrequest = new request('flowers.jpg'); var newrequest = myrequest.clone(); // a copy of the request is now stored in newrequest specifications specification status comment fetchthe definition of 'clone' in that specification.
Resize Observer API - Web APIs
the resize observer api provides a solution to exactly these kinds of problems, and more besides, allowing you to easily observe and respond to changes in the size of an element’s content or border box in a performant way.
...a callback function set up inside the constructor then runs every time the size changes, providing access to the new dimensions and allowing you to do anything you like in response to those changes.
... the code will usually follow this kind of pattern (taken from resize-observer-border-radius.html): const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { entry.target.style.borderradius = math.min(100, (entry.contentboxsize.inlinesize/10) + (entry.contentboxsize.blocksize/10)) + 'px'; } else { ...
Response - Web APIs
WebAPIResponse
body interface properties response implements body, so it also has the following properties available to it: body.body read only a simple getter exposing a readablestream of the body contents.
... body interface methods response implements body, so it also has the following methods available to it: body.arraybuffer() takes a response stream and reads it to completion.
... const image = document.queryselector('.my-image'); fetch('flowers.jpg').then(function(response) { return response.blob(); }).then(function(blob) { const objecturl = url.createobjecturl(blob); image.src = objecturl; }); you can also use the response.response() constructor to create your own custom response object: const response = new response(); specifications specification status comment fetchthe definition of 'response...
Screen.availHeight - Web APIs
for instance, on a mac whose dock is located at the bottom of screen (which is the default), the value of availheight is approximately the value of height (the total height of the screen in css pixels) minus the heights of the dock and menu bar, as seen in the diagram below.
... in the main window, when it's time to open the panels, code like the following is used.
...that code handles resizing the window based on the available space: window.outerheight = window.screen.availheight; the result is something similar to the below.
Screen Capture API - Web APIs
additions to existing dictionaries the screen capture api adds properties to the following dictionaries defined by other specifications.
... dictionaries the following dictionaries are defined by the screen capture api.
... feature policy validation user agents that support feature policy (either using http's feature-policy header or the <iframe> attribute allow) can specify a desire to use the screen capture api using the policy control directive display-capture: <iframe allow="display-capture" src="/some-other-document.html"> the default allow list is self, which lets the any content within the document use screen capture.
ScriptProcessorNode - Web APIs
the scriptprocessornode interface allows the generation, processing, or analyzing of audio using javascript.
...small numbers lower the latency, but large number may be necessary to avoid audio breakup and glitches.
... examples the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
Selection.rangeCount - Web APIs
gecko browsers allow multiple selections across table cells.
... firefox allows to select multiple ranges in the document by using ctrl+click (unless the click within an element with display: table-cell).
... syntax value = sel.rangecount example the following example will show the rangecount every second.
Selection.setBaseAndExtent() - Web APIs
note: if the focus position appears before the anchor position in the document, the direction of the selection is reversed — the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow.
... next, we have two form inputs that allow you to set the anchoroffset and focusoffset — they both have a default value of 0.
...nt.queryselector('button'); var output = document.queryselector('.output'); var selection; button.onclick = function() { try { selection = document.getselection(); selection.setbaseandextent(one, aoffset.value, two, foffset.value); var text = selection.tostring(); output.textcontent = text; } catch(e) { output.textcontent = e.message; } } play with the live example below, setting different offset values to see how this affects the selection.
Selection - Web APIs
WebAPISelection
typically, it holds only one range, accessed as follows: var selobj = window.getselection(); var range = selobj.getrangeat(0); selobj is a selection object range is a range object as the selection api specification notes, the selection api was initially created by netscape and allowed multiple ranges (for instance, to allow the user to select a column from a <table>).
... the behavior is as follows: an editing host gains focus if the previous selection was outside of it.
... the above behavior applies to selections made using the following methods: selection.collapse() selection.collapsetostart() selection.collapsetoend() selection.extend() selection.selectallchildren() selection.addrange() selection.setbaseandextent() and when the range is modified using the following methods: range.setstart() range.setend() range.setstartbefore() range.setstartafter() range.setendbefore() range.setendafter() range.collapse() range.selectnode() range.selectnodecontents() glossar...
ShadowRoot - Web APIs
properties included from documentorshadowroot the shadowroot interface includes the following properties defined on the documentorshadowroot mixin.
... methods the shadowroot interface includes the following methods defined on the documentorshadowroot mixin.
... examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes.
SharedWorker() - Web APIs
available properties are as follows: type: a domstring specifying the type of worker to create.
... exceptions a securityerror is raised if the document is not allowed to start workers, for example if the url has an invalid syntax or if the same-origin policy is violated.
... examples the following code snippet shows creation of a sharedworker object using the sharedworker() constructor and subsequent usage of the object: var myworker = new sharedworker('worker.js'); myworker.port.start(); first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } myworker.port.onmessage = function(e) { result1.textcontent = e.data; console.log('message received from worker'); } for a full example, see...
SpeechRecognitionError.error - Web APIs
not-allowed the user agent disallowed any speech input from occurring for reasons of security, privacy or user preference.
... service-not-allowed the user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference.
... in this case it would allow another more suitable speech recognition service to be used instead.
SpeechRecognitionErrorEvent.error - Web APIs
not-allowed the user agent disallowed any speech input from occurring for reasons of security, privacy or user preference.
... service-not-allowed the user agent disallowed the requested speech recognition service, either because the user agent doesn't support it or because of reasons of security, privacy or user preference.
... in this case it would allow another more suitable speech recognition service to be used instead.
URLUtilsReadOnly - Web APIs
urlutilsreadonly.pathname read only is a domstring containing an initial '/' followed by the path of the url.
... urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url.
... urlutilsreadonly.hash read only is a domstring containing a '#' followed by the fragment identifier of the url.
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.
... the mark's performance entry will have the following property values: entrytype - set to "mark".
... the measure's performance entry will have the following property values: entrytype - set to "measure".
WaveShaperNode.curve - Web APIs
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.
... example the following example shows basic usage of an audiocontext to create a wave shaper node.
...we found the below distortion curve code on stack overflow.
WaveShaperNode.oversample - Web APIs
this leads to better results by avoiding some aliasing, but comes at the expense of a lower precision shaping curve.
... example the following example shows basic usage of an audiocontext to create a wave shaper node.
...we found the below distortion curve code on stack overflow.
WebGLRenderingContext.blendFunc() - Web APIs
for possible values, see below.
...for possible values, see below.
... constants the following constants can be used for sfactor and dfactor.
WebGLRenderingContext.bufferData() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
... when using a webgl 2 context, the following values are available additionally: gl.static_read: the contents are intended to be specified once by reading data from webgl, and queried many times by the application.
... a gl.invalid_enum error is thrown if target or usage are not one of the allowed enums.
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values can be returned additionally: gl.framebuffer_incomplete_multisample: the values of gl.renderbuffer_samples are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures.
... when using the ovr_multiview2 extension, the following value can be returned additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete.
WebGLRenderingContext.framebufferRenderbuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl.color_attachment13 gl.color_at...
... a gl.invalid_enum error is thrown if attachment is not one of the allowed enums.
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.color_attachment1 gl.color_attachment2 gl.color_attachment3 gl.color_attachment4 gl.color_attachment5 gl.color_attachment6 gl.color_attachment7 gl.color_attachment8 gl.color_attachment9 gl.color_attachment10 gl.color_attachment11 gl.color_attachment12 gl.color_attachment13 gl.color_at...
... when using a webgl 2 context, the following values are available additionally: gl.framebuffer_attachment_alpha_size gl.framebuffer_attachment_blue_size gl.framebuffer_attachment_color_encoding gl.framebuffer_attachment_component_type gl.framebuffer_attachment_depth_size gl.framebuffer_attachment_green_size gl.framebuffer_attachment_red_size gl.framebuffer_attachment_stencil_size gl.framebuffer_att...
Basic scissoring - Web APIs
although the clear() drawing command writes the clear color (set by clearcolor()) to all pixels in the drawing buffer, scissor() defines a mask that only allows pixels inside the specified rectangular area to be updated.
... : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } window.addeventlistener("load", function setupwebgl (evt) { "use strict" window.removeeventlistener(evt.type, setupwebgl, false); var paragraph = document.queryselector("p"); var canvas = document.queryselector("canvas"); // the following two lines set the size (in css pixels) of // the drawing buffer to be identical to the size of the // canvas html element, as determined by css.
... gl.enable(gl.scissor_test); gl.scissor(40, 20, 60, 130); // clear the drawing buffer solid yellow.
Adding 2D content to a WebGL context - Web APIs
our vertex shader below receives vertex position values from an attribute we define called avertexposition.
...the code below creates the two shaders by calling loadshader(), passing the type and source for the shader.
...); // see if it compiled successfully if (!gl.getshaderparameter(shader, gl.compile_status)) { alert('an error occurred compiling the shaders: ' + gl.getshaderinfolog(shader)); gl.deleteshader(shader); return null; } return shader; } the loadshader() function takes as input the webgl context, the shader type, and the source code, then creates and compiles the shader as follows: a new shader is created by calling gl.createshader().
A simple RTCDataChannel sample - Web APIs
while that's obviously a contrived scenario, it's useful for demonstrating the flow of connecting two peers.
... <div class="messagebox" id="receivebox"> <p>messages received:</p> </div> the javascript code while you can just look at the code itself on github, below we'll review the parts of the code that do the heavy lifting.
...instead, we set up a datachannel event handler; this will be called when the data channel is opened; this handler will receive an rtcdatachannel object; you'll see this below.
Writing WebSocket client applications - Web APIs
this should use the url scheme wss://, although some software may allow you to use the insecure ws:// for local connections.
... the constructor will throw a securityerror if the destination doesn't allow access.
...most browsers now only allow secure websocket connections, and no longer support using them in insecure contexts.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
for example, given an xrsession whose reference space is worldrefspace, the following line of code would request the first frame of animation to be scheduled: animationframerequestid = xrsession.requestanimationframe(mydrawframe); then, the mydrawframe() function—the callback executed when it's time to draw the frame—might be something like this: function mydrawframe(currentframetime, frame) { let session = frame.session; let viewerpose = frame.getviewerpose(viewerr...
...e) { if (!previousviewerpose) { previousviewerpose = viewerpose; } let offsetmatrix = mat4.create(); mat4.sub(offsetmatrix, previousviewerpose.transform.matrix, viewerpose.transform.matrix); previousviewerpose = viewerpose; } } continuity and recovery after tracking loss sometimes, while the user is actively using their xr hardware with your app, the flow of data containing updates as to the user's position and orientation might be lost for a period of time.
...if your app provides a way for the user to move through the virtual world without physically moving in the real world (a so-called teleportation mechanic), you can simply accept the new position and continue, allowing the jump from your previously-assumed position to be immediately corrected with the new position.
Web Animations API Concepts - Web APIs
now we’ve got the waapi for future animation specifications to piggyback on, allowing them to to remain consistent and play well together.
... 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.
...(read more about how to use element.animate() in using the web animations api.) uses the api allows for the creation of dynamic animations that can be updated on the fly as well as more straightforward, declarative animations like those css creates.
Controlling multiple parameters with ConstantSourceNode - Web APIs
the diagram below shows how this works; an input value, n, is set as the value of the constantsourcenode.offset property.
...see stopping the oscillators below for that code.
...that code is covered under starting the oscillators below.
Visualizations with Web Audio API - Web APIs
creating a waveform/oscilloscope to create the oscilloscope visualisation (hat tip to soledad penadés for the original code in voice-change-o-matic), we first follow the standard pattern described in the previous section to set up the buffer: analyser.fftsize = 2048; var bufferlength = analyser.frequencybincount; var dataarray = new uint8array(bufferlength); next, we clear the canvas of what had been drawn on it before to get ready for the new visualization display: canvasctx.clearrect(0, 0, width, height); we now define the draw() function: function dra...
...however, we are also multiplying that width by 2.5, because most of the frequencies will come back as having no audio in them, as most of the sounds we hear every day are in a certain lower frequency range.
... draw(); this code gives us a result like the following: note: the examples listed in this article have shown usage of analysernode.getbytefrequencydata() and analysernode.getbytetimedomaindata().
Using the Web Storage API - Web APIs
the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores).
...testing for availability is necessary only if you must support very old browsers, such as internet explorer 6 or 7, or in the limited circumstances described below.
... on the events page (see events.js) the only javascript is as follows: window.addeventlistener('storage', function(e) { document.queryselector('.my-key').textcontent = e.key; document.queryselector('.my-old').textcontent = e.oldvalue; document.queryselector('.my-new').textcontent = e.newvalue; document.queryselector('.my-url').textcontent = e.url; document.queryselector('.my-storage').textcontent = json.stringify(e.storagearea); }); here we add an even...
Web Workers API - Web APIs
the advantage of this is that laborious processing can be performed in a separate thread, allowing the main (usually the ui) thread to run without being blocked/slowed down.
...they will also allow access to push notifications and background sync apis.
... worker represents a running worker thread, allowing you to pass messages to the running worker code.
Window.captureEvents() - Web APIs
syntax window.captureevents(eventtype) eventtype is a combination of the following values: event.abort, event.blur, event.click, event.change, event.dblclick, event.dragddrop, event.error, event.focus, event.keydown, event.keypress, event.keyup, event.load, event.mousedown, event.mousemove, event.mouseout, event.mouseover, event.mouseup, event.move, event.reset, event.resize, event.select, event.submit, event.unload.
... when you call the captureevents() method on the window, events of the type you specify (for example, event.click) no longer pass through to "lower" objects in the hierarchy.
... note that you can pass a list of events to this method using the following syntax: window.captureevents(event.keypress | event.keydown | event.keyup).
Window.devicePixelRatio - Web APIs
see the example below.
...other values may be returned as well in the case of unusually low resolution displays or, more often, when a screen has a higher pixel depth than simply double the standard resolution of 96 or 76 dpi.
... use window.devicepixelratio to determine how much extra pixel density should be added to allow for a sharper image.
Window.localStorage - Web APIs
the read-only localstorage property allows you to access a storage object for the document's origin; the stored data is saved across browser sessions.
... example the following snippet accesses the current domain's local storage object and adds a data item to it using storage.setitem().
... localstorage.setitem('mycat', 'tom'); the syntax for reading the localstorage item is as follows: const cat = localstorage.getitem('mycat'); the syntax for removing the localstorage item is as follows: localstorage.removeitem('mycat'); the syntax for removing all the localstorage items is as follows: localstorage.clear(); note: please refer to the using the web storage api article for a full example.
window.postMessage() - Web APIs
normally, scripts on different pages are allowed to access each other if and only if the pages they originate from share the same protocol, port number, and host (also known as the "same-origin policy").
... the dispatched event otherwindow can listen for dispatched messages by executing the following javascript: window.addeventlistener("message", receivemessage, false); function receivemessage(event) { if (event.origin !== "http://example.org:8080") return; // ...
...this string is the concatenation of the protocol and "://", the host name if one exists, and ":" followed by a port number if a port is present and differs from the default port for the given protocol.
Window.print() - Web APIs
WebAPIWindowprint
meedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprintchrome full support 1notes full support 1notes notes starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 5opera full support 6notes full support 6notes notes starting with opera 33, this method is blocked inside a...
...n <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1.1webview android full support 1notes full support 1notes notes starting with webview 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18notes full support 18notes notes starting with chrome 46, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support nonotes no support ...
... nonotes notes see bug 1247609.opera android full support 10.1notes full support 10.1notes notes starting with opera 33, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0notes full support 1.0notes notes starting with samsung internet 5.0, this method is blocked inside an <iframe> unless its sandbox attribute has the value allow-modals.legend full support full support...
Window - Web APIs
WebAPIWindow
<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/window" target="_top"><rect x="1" y="1" width="75" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-...
...for overriding the prototype of built-in elements) are listed in a separate section below.
... also available via the ongamepaddisconnected property history events hashchange fired when the fragment identifier of the url has changed (the part of the url beginning with and following the # symbol).
Worker() - Web APIs
WebAPIWorkerWorker
available properties are as follows: type: a domstring specifying the type of worker to create.
... exceptions a securityerror is raised if the document is not allowed to start workers, e.g.
... examples the following code snippet shows creation of a worker object using the worker() constructor and subsequent usage of the object: var myworker = new worker('worker.js'); first.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } for a full example, see our basic dedicated worker example (run dedicated worker).
WorkerLocation - Web APIs
urlutilsreadonly.pathname read only is a domstring containing an initial '/' followed by the path of the url of the script executed in the worker.
... urlutilsreadonly.search read only is a domstring containing a '?' followed by the parameters of the url of the script executed in the worker.
... urlutilsreadonly.hash read only is a domstring containing a '#' followed by the fragment identifier of the url of the script executed in the worker.
Worklet.addModule() - Web APIs
WebAPIWorkletaddModule
options optional an object with any of the following options: credentials: a requestcredentials value that indicates whether to send credentials (e.g.
... exceptions if addmodule() fails, it rejects the promise, delivering one of the following errors to the rejection handler.
...orklet.addmodule('modules/bypassfilter.js', { credentials: 'omit', }); paintworklet example css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); once a paintworklet is included, the css paint() function can be used to include the image created by the worklet: @supports (background-image: paint(id)) { h1 { background-image: paint(hollowhighlights, filled, 3px); } } specifications specification status comment worklets level 1the definition of 'addmodule()' in that specification.
WritableStream.WritableStream() - Web APIs
underlyingsink can contain the following: start(controller) optional this is a method, called immediately when the object is constructed.
...this method will be called only after previous writes have succeeded, and never after the stream is closed or aborted (see below).
... examples the following example illustrates several features of this interface.
HTML in XMLHttpRequest - Web APIs
this feature allows web apps to obtain an html resource as a parsed dom using xmlhttprequest.
... function htmlinxhr() { if (!window.xmlhttprequest) return false; var req = new window.xmlhttprequest(); req.open('get', window.location.href, false); try { req.responsetype = 'document'; } catch(e) { return true; } return false; } view on jsfiddle this method is synchronous, does not rely on external assets though it may not be as reliable as method 2 described below since it does not check the actual feature but an indication of that feature.
...this test file is small and is not well-formed xml: <title>&amp;&<</title> if the file is named detect.html, the following function can be used for detecting html parsing support: function detecthtmlinxhr(callback) { if (!window.xmlhttprequest) { window.settimeout(function() { callback(false); }, 0); return; } var done = false; var xhr = new window.xmlhttprequest(); xhr.onreadystatechange = function() { if (this.readystate == 4 && !done) { done = true; callback(!!(this.responsexm...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
the function is passed the channel property of an xmlhttprequest to extract the following information: was the connection secure?
... try { errorclass = nsserrorsservice.geterrorclass(status); } catch (ex) { //catching security protocol exception errorclass = 'securityprotocol'; } if (errorclass == nsinsserrorsservice.error_class_bad_cert) { errtype = 'securitycertificate'; } else { errtype = 'securityprotocol'; } // nss_sec errors (happen below the base value because of negative vals) if ((status & 0xffff) < math.abs(nsinsserrorsservice.nss_sec_error_base)) { // the bases are actually negative, so in our positive numeric space, we // need to subtract the base off our value.
...var req = cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createinstance(); req.open('get', url, true); req.addeventlistener("error", function(e) { var error = createtcperrorfromfailedxhr(req); dumpsecurityinfo(req, error); }, false); req.onload = function(e) { dumpsecurityinfo(req); }; req.send(); } then test("https://addons.mozilla.org"); produced the following output in my console: connection status: succeeded security info: security state: secure common name (cn) = addons.mozilla.org organisation = mozilla corporation issuer = verisign, inc.
XMLHttpRequest.responseType - Web APIs
the values supported by responsetype are the following: "" an empty responsetype string is treated the same as "text", the default type.
... ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer.
...for additional details, see synchronous xhr restrictions below.
XPathEvaluator - Web APIs
the xpathevaluator interface allows to compile and evaluate xpath expressions.
... xpathevaluator.creatensresolver() adapts any dom node to resolve namespaces allowing the xpath expression to be evaluated relative to the context of the node where it appeared within the document.
... example the following example shows the use of the xpathevaluator interface.
XRPermissionDescriptor.optionalFeatures - Web APIs
the "interface" column in the table below indicates which of the two types is returned for each reference space type constant..
... reference space descriptors the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point.
XRReferenceSpaceType - Web APIs
the "interface" column in the table below indicates which of the two types is returned for each reference space type constant..
... reference space descriptors the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point.
XRSession - Web APIs
WebAPIXRSession
properties in addition to the properties listed below, xrsession inherits properties from its parent interface, eventtarget.
... methods xrsession provides the following methods in addition to those inherited from its parent interface, eventtarget.
... events the following events are delivered to xrsession objects.
XRSystem: requestSession() - Web APIs
exceptions this method doesn't throw true exceptions; instead, it rejects the returned promise, passing into it a domexception whose name is one of the following: invalidstateerror the requested session mode is immersive-vr but there is already an immersive vr session either currently active or in the process of being set up.
... examples creating an immersive vr session the following example calls requestsession() requesting an "immersive-vr" session.
... xrsession.requestanimationframe(onxranimationframe); }).catch(function(error) { // "immersive-vr" sessions are not supported console.warn("'immersive-vr' isn't supported, or an error occurred activating vr!"); }); verifying webxr support and using a button to start vr mode the following example shows how to use both issessionsupported() and requestsession().
Introduction - Web APIs
this would allow the same style to be reused for multiple content, as well as simplify maintenance and allow a quick (only modify one file) way to change the look of content.
... xsl (extensible stylesheet language) transformations are composed of two parts: xsl elements, which allow the transformation of an xml tree into another markup tree and xpath, a selection language for trees.
...this allows xslt to add, remove and reorganize elements from the original xml document and thus allows more fine-grain control of the resulting document's structure.
ARIA live regions - Accessibility
below is a list of each related aria live region property with a description.
... here is a screenshot of voiceover on mac announcing the update (via subtitles) to the live region: preferring specialized live region roles in the following well-known predefined cases it is better to use a specific provided "live region role": role description compatibility notes log chat, error, game or other type of log to maximize compatibility, add a redundant aria-live="polite" when using this role.
...this is the most commonly used value, as interrupting the user with "assertive" might interrupt their flow.
Using the aria-describedby attribute - Accessibility
the examples section below provides more information about how to use the attribute in these cases.
... examples example 1: application landmark descriptions in the example below, an introductory paragraph describes a calendar application.
... </div> </div> example 2: a close button in the example below, a link that functions as a 'close' button on a dialog is described elsewhere in the document.
Using the aria-invalid attribute - Accessibility
examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event.
... the snippet below shows a very simple validation function, which only checks for the presence of a particular character (in the real world, validation will likely be more sophisticated): function checkvalidity(aid, asearchterm, amsg){ var elem = document.getelementbyid(aid); var invalid = (elem.value.indexof(asearchterm) < 0); if (invalid) { elem.setattribute("aria-invalid", "true"); u...
...pdatealert(amsg); } else { elem.setattribute("aria-invalid", "false"); updatealert(); } } the snippet below shows the alert functions, which add (or remove) the error message: function updatealert(msg) { var oldalert = document.getelementbyid("alert"); if (oldalert) { document.body.removechild(oldalert); } if (msg) { var newalert = document.createelement("div"); newalert.setattribute("role", "alert"); newalert.setattribute("id", "alert"); var content = document.createtextnode(msg); newalert.appendchild(content); document.body.appendchild(newalert); } } note that the alert has the aria role attribute set to "alert." working examples: alert role example (uses the aria-invalid attribute) n...
ARIA: Comment role - Accessibility
examples in the following example we have a document section that has been commented.
... <p>the last half of the song is a slow-rising crescendo that peaks at the <span role="mark" aria-details="thread-1">end of the guitar solo</span>, before fading away sharply.</p> <div role="comment" id="thread-1" data-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> to associate the comment with the text being commented, we need to wrap the commented text with an element containing the aria-details attribute, the value of which should be the id of the comment.
... multiple comments since aria-details can now accept multiple ids, we can associate multiple comments with the same annotation, like so: <p>the last half of the song is a slow-rising crescendo that peaks at the <mark aria-details="thread-1 thread-2">end of the guitar solo</mark>, before fading away sharply.</p> <div role="comment" id="thread-1" data-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> <div role="comment" id="thread-2" data-author="chris"> <h3>marcus said</h3> <p class="comment-text">the guitar solo could do with a touch more chorus, and a slightly lower volume.</p> <p><time datetime="2019-03-29t15:35">march 29 2019, 15:...
ARIA: figure role - Accessibility
a figure is generally considered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.
... see best practices below.
...for example, our above example should be rewritten as follows: <figure> <img src="diagram.png" alt="diagram showing the four layers of awesome and their relative priority order — music, cats, nature, and ice cream"> <pre><code> let awesome = ['music', 'cats', 'nature', 'ice cream']; </code></pre> <figcaption>figure 1: the four layers of awesome.</figcaption> </figure> specifications specification status a...
ARIA: gridcell role - Accessibility
aria-colindex is being used to describe the rows' position and allows a person using assistive technology to infer that certain rows have been removed: <div role="grid" aria-colcount="6"> <div role="rowgroup"> <div role="row"> <div role="columnheader" aria-colindex="1">first name</div> <div role="columnheader" aria-colindex="2">last name</div> <div role="columnheader" aria-colindex="5">city</div> <div role="columnheader" aria-colinde...
... by referencing the parent elements with roles of rowheader or columnheader applied to them via aria-describedby, it allows assistive technology to understand the position and relationship of the gridcell element to the rest of the table-style grouping of content.
... examples the following example creates a table-style grouping of information: <h3 id="table-title">jovian gas giant planets</h3> <div role="grid" aria-describedby="table-title"> <div role="rowgroup"> <div role="row"> <div role="columnheader">name</div> <div role="columnheader">diameter (km)</div> <div role="columnheader">length of day (hours)</div> <div role="columnheader">distance fro...
ARIA: switch role - Accessibility
the assistive technology, if it supports the switch role, responds by doing the following: screen readers should announce the element as a switch, optionally providing instructions as to how to activate the switch.
... examples the following examples should help you understand how to apply and use the switch role.
...the switch has two child elements containing the "off" and "on" labels and is followed by a <label> identifying the switch.
ARIA: checkbox role - Accessibility
ing the value of the aria-checked attribute and the appearance of the checkbox so it appears checked or unchecked to the sighted user onkeypress handle the case where the user presses the space key to change the state of the checkbox by changing the value of the aria-checked attribute and the appearance of the checkbox so it appears checked or unchecked to the sighted user examples the following example creates a simple checkbox element using css and javascript to handle the checked or unchecked status of the element.
...et item = document.getelementbyid('chkpref'); switch(item.getattribute('aria-checked')) { case "true": item.setattribute('aria-checked', "false"); break; case "false": item.setattribute('aria-checked', "true"); break; } } accessibility concerns when the checkbox role is added to an element, the user agent should do the following: expose the element as having a checkbox role in the operating system's accessibility api.
... assistive technology products should do the following: screen readers should announce the element as a checkbox, and optionally provide instructions on how to activate it.
WAI-ARIA Roles - Accessibility
a figure is generally considered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.aria: form rolethe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that contains one or more rows of cells.
...ivated, displays its associated tabpanel.aria: table rolethe table value of the aria role attribute identifies the element containing the role as having a non-interactive table structure containing data arranged in rows and columns, similar to the native <table> html element.aria: tabpanel rolethe aria tabpanel role indicatesaria: textbox rolethe textbox role is used to identify an element that allows the input of free-form text.
...ones for which the first draft is completed have been removed from the below list.
Accessibility and Spacial Patterns - Accessibility
the two images below are from nasa research, specifically, from the article, "designing with blue" "spatial localization.
...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?
... adobe illustrator, for example, allows one to typeset ada braille for printing out.
Accessibility Information for Web Authors - Accessibility
guidelines and regulations section 508 guidelines for web authors these guidelines must be followed by u.s.
...other organizations such as schools are starting to follow these guidelines as well.
...(...) about one-third complained about low contrast between text and background." top ten web design mistakes of 2005: 1.
Accessibility
this article starts off the module with a good look at what accessibility actually is — this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow.
... css and javascript accessibility best practices css and javascript, when used properly, also have the potential to allow for accessible web experiences ...
... 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.
-moz-image-rect - CSS: Cascading Style Sheets
description this property allows you to, for example, use different parts of one larger image as backgrounds in different parts of your content.
... the other corners follow a similar pattern: #box3 { background-image: -moz-image-rect(url(https://mdn.mozillademos.org/files/12053/firefox.png), 50%, 50%, 100%, 0%); width:133px; height:136px; position:absolute; } #box4 { background-image: -moz-image-rect(url(https://mdn.mozillademos.org/files/12053/firefox.png), 50%, 100%, 100%, 50%); width:133px; height:136px; position:absolute; } html the html is q...
...r i=1; i<=4; i++) { var curid = "box" + i; // shift the background images var curstyle = window.getcomputedstyle(document.getelementbyid(curid), null).getpropertyvalue("background-image"); document.getelementbyid(curid).style.backgroundimage = prevstyle; prevstyle = curstyle; } } this uses window.getcomputedstyle() to fetch the style of each element, shifting it to the following element.
-webkit-box-reflect - CSS: Cascading Style Sheets
/* 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.
... syntax values above, below, right, left are keywords indicating in which direction the reflection is to happen.
... formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ above | below | right | left ]?
::cue - CSS: Cascading Style Sheets
WebCSS::cue
::cue { color: yellow; font-weight: bold; } the properties are applied to the entire set of cues as if they were a single unit.
... syntax ::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 translucent black box.
::first-line (:first-line) - CSS: Cascading Style Sheets
allowable properties only a small subset of css properties can be used with the ::first-line pseudo-element: all font-related properties: font, font-kerning, font-style, font-variant, font-variant-numeric, font-variant-position, font-variant-east-asian, font-variant-caps, font-variant-alternates, font-variant-ligatures, font-synthesis, font-feature-settings, font-language-override, font-weight, fon...
... generalizes allowed properties to typesetting, text decoration, and inline layout properties and opacity.
... candidate recommendation allows the use of text-shadow with ::first-letter.
::selection - CSS: Cascading Style Sheets
::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.
... 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.
:host-context() - CSS: Cascading Style Sheets
in other words, this allows a custom element, or anything within that custom element's shadow dom, to apply different styles based on its position within the outer dom or classes/attributes applied to ancestor elements.
... another typical use would be to allow inner elements to react to classes or attributes on any anscestor elements - for example, applying a different text color when a .dark-theme class is applied to <body>.
...'='<attr-modifier> = i | s examples selectively styling shadow hosts the following snippets are taken from our host-selectors example (see it live also).
:valid - CSS: Cascading Style Sheets
WebCSS:valid
this allows to easily make valid fields adopt an appearance that helps the user confirm that their data is formatted properly.
...syntax :valid examples indicating valid and invalid form fields in this example, we use structures like this, which include extra <span>s to generate content on; we'll use these to provide indicators of valid/invalid data: <div> <label for="fname">first name *: </label> <input id="fname" name="fname" type="text" required> <span></span> </div> to provide these indicators, we use the following css: input + span { position: relative; } input + span::before { position: absolute; right: -20px; top: 5px; } input:invalid { border: 2px solid red; } input:invalid + span::before { content: '✖'; color: red; } input:valid + span::before { content: '✓'; color: green; } we set the <span>s to position: relative so that we can position the generated content relative to...
... you can try it below: notice how the required text inputs are invalid when empty, but valid when they have something filled in.
:where() - CSS: Cascading Style Sheets
WebCSS:where
take the following html: <article> <h2>:is()-styled links</h2> <section class="is-styling"> <p>here is my main content.
... to make selecting the links inside them simpler, but still distinct, we could use :is() or :where(), in the following manner: html { font-family: sans-serif; font-size: 150%; } :is(section.is-styling, aside.is-styling, footer.is-styling) a { color: red; } :where(section.where-styling, aside.where-styling, footer.where-styling) a { color: orange; } however, what if we later want to override the color of links in the footers using a simple selector?
... you can see the result below (although bear in mind that currently :is() and :where() are currently only enabled by default in firefox nightly, version 77+.
inverted-colors - CSS: Cascading Style Sheets
syntax the inverted-colors feature is specified as a keyword value chosen from the list below.
... examples html <p>if you're using inverted colors, this text should be blue on white (the inverse of yellow on black).
... if you're not, it should be red on light gray.</p> <p>if the text is gray, your browser doesn't support the `inverted-colors` media feature.</p> css p { color: gray; } @media (inverted-colors: inverted) { p { background: black; color: yellow; } } @media (inverted-colors: none) { p { background: #eee; color: red; } } result specifications specification status comment media queries level 5the definition of 'inverted-colors' in that specification.
Attribute selectors - CSS: Cascading Style Sheets
[attr|=value] represents elements with an attribute name of attr whose value can be exactly value or can begin with value immediately followed by a hyphen, - (u+002d).
... [attr$=value] represents elements with an attribute name of attr whose value is suffixed (followed) by value.
...*/ ol[type="a"] { list-style-type: lower-alpha; background: red; } ol[type="a" s] { list-style-type: lower-alpha; background: lime; } ol[type="a" s] { list-style-type: upper-alpha; background: lime; } html <ol type="a"> <li>example list</li> </ol> result specifications specification status comment selectors level 4the definition of 'attribute selectors' in that specification.
Using CSS animations - CSS: Cascading Style Sheets
this does not configure the actual appearance of the animation, which is done using the @keyframes at-rule as described in defining the animation sequence using keyframes below.
...to avoid this problem put the element to be animated in a container, and set overflow:hidden on the container.
... receiving the events the events get delivered to the listener() function, which is shown below.
Handling content breaks in multicol - CSS: Cascading Style Sheets
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.
...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.
... in the example below, we are using the orphans property to control the number of lines left at the bottom of a column.
CSS Multi-column Layout - CSS: Cascading Style Sheets
support is included for establishing the number of columns in a layout, as well as how content should flow from column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance.
... basic example in the following example the column-count property has been applied to the element with a class of container.
... handling overflow in multicol what happens when an item overflows the column it is in and what happens when there is too much columned content to fit a container.
CSS Flexible Box Layout - CSS: Cascading Style Sheets
in the flex layout model, the children of a flex container can be laid out in any direction, and can “flex” their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent.
... basic example in the following example a container has been set to display: flex, which means that the three child items become flex items.
... reference css properties flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap order alignment properties the properties align-content, align-self, align-items and justify-content initially appeared in the flexbox specification, but are now defined in box alignment.
CSS Fonts - CSS: Cascading Style Sheets
WebCSSCSS Fonts
basic example the following example shows a simple use of basic font properties to style a paragraph of text.
... p { width: 600px; margin: 0 auto; font-family: "helvetica neue", "arial", sans-serif; font-style: italic; font-weight: 100; font-variant-ligatures: normal; font-size: 2rem; letter-spacing: 1px; } <p>three hundred years ago<br> i thought i might get some sleep<br> i stretched myself out onna antique bed<br> an' my spirit did a midnite creep</p> the result is as follows: variable fonts examples you can find a number of variable fonts examples at v-fonts.com and axis-praxis.org; see also our variable fonts guide for more information and usage information.
...these are all referred to as opentype features, and are made available to use on the web via specific properties and a low-level control property — font-feature-settings.
Layout using named grid lines - CSS: Cascading Style Sheets
the code below would create an eight track grid, with a narrower 1fr width column named col1-start followed by a wider 3fr column named col2-start.
...the following definition, creates four 1fr tracks, which each have a start and end line.
...for example, to create a three column layout with a header and footer, i might have the following markup.
Stacking without the z-index property - CSS: Cascading Style Sheets
when the z-index property is not specified on any element, elements are stacked in the following order (from bottom to top): the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html descendant positioned elements, in order of appearance in the html keep in mind, when the order property alters rendering from the "order of appearance in the html" within flex containers, it similarly affects the order for stacking context.
... in the example below, elements #1 through #4 are positioned elements.
... element #5 is static, and so is drawn below the other four elements, even though it comes later in the html markup.
Comments - CSS: Cascading Style Sheets
WebCSSComments
syntax comments can be placed wherever white space is allowed within a style sheet.
... /* 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.
...in other words, the first instance of */ that follows an instance of /* closes the comment.
Sticky footers - CSS: Cascading Style Sheets
requirements the sticky footer pattern needs to meet the following requirements: footer sticks to the bottom of the viewport when content is short.
... if the content of the page extends past the viewport bottom, the footer then sits below the content as normal.
... the recipe download this example note: in this example and the following one we are using a wrapper set to min-height: 100% in order that our live example works.
Layout mode - CSS: Cascading Style Sheets
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.
... 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.
Mozilla CSS extensions - CSS: Cascading Style Sheets
oz-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-metric(scrollbar-start-backward) :-moz-system-metric(scrollbar-start-forward) :-moz-system-metric(scrollbar-thumb-...
...proportional) :-moz-system-metric(touch-enabled) :-moz-system-metric(windows-default-theme) -moz-user-focus -moz-user-input -moz-user-modify -moz-window-dragging -moz-window-shadow formerly proprietary properties that are now standard note: to maximize the compatibility of your css, you should use the unprefixed standard properties instead of the prefixed ones listed below.
...ame-ti-et -moz-ethiopic-numeric -moz-gujarati -moz-gurmukhi -moz-hangul -moz-hangul-consonant -moz-japanese-formal -moz-japanese-informal -moz-kannada -moz-khmer -moz-lao -moz-malayalam -moz-myanmar -moz-oriya -moz-persian -moz-simp-chinese-formal -moz-simp-chinese-informal -moz-tamil -moz-telugu -moz-thai -moz-trad-chinese-formal -moz-trad-chinese-informal -moz-urdu overflow -moz-scrollbars-none -moz-scrollbars-horizontal -moz-scrollbars-vertical -moz-hidden-unscrollable text-align -moz-center -moz-left -moz-right text-decoration -moz-anchor-decoration -moz-user-select -moz-all -moz-none width, min-width, and max-width -moz-min-content -moz-fit-content -moz-max-content -moz-available pseudo-elements and pseudo-cla...
background-repeat - CSS: Cascading Style Sheets
round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room (space left >= half of the image width) for another one to be added.
... when the next image is added, all of the current ones compress to allow room.
... 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.
<blend-mode> - CSS: Cascading Style Sheets
syntax the <blend-mode> data type is defined using a keyword value chosen from the list below.
... 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.
border-block-end - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-block-end-color border-block-end-style border-block-end-width syntax border-block-end: 1px; border-block-end: 2px dotted; border-block-end: medium dashed blue; border-block-end can be used to set the values for one or more of border-block-end-width, border-block-end-style, and border-block-end-color.
... values the border-block-end is specified with one or more of the following, in any order: <'border-width'> the width of the border.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block-end: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-end' in that specification.
border-block-start - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-block-start-color border-block-start-style border-block-start-width syntax border-block-start: 1px; border-block-start: 2px dotted; border-block-start: medium dashed blue; border-block-start can be used to set the values for one or more of border-block-start-width, border-block-start-style, and border-block-start-color.
... values the border-block-start is specified with one or more of the following, in any order: <'border-width'> the width of the border.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block-start: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-block-start' in that specification.
border-image-slice - CSS: Cascading Style Sheets
it also applies to ::first-letter.inheritednopercentagesrefer to the size of the border imagecomputed valueone to four percentage(s) (as specified) or absolute length(s), plus the keyword fill if specifiedanimation typeby computed value type formal syntax <number-percentage>{1,4} && fill?where <number-percentage> = <number> | <percentage> examples adjustable border width and slice the folowing example shows a simple <div> with a border image set on it.
... the source image for the borders is as follows: the diamonds are 30px across, therefore setting 30 pixels as the value for both border-width and border-image-slice will get you complete and fairly crisp diamonds in your border: border-width: 30px; border-image-slice: 30; these are the default values we have used in this example.
... however, we have also provided two sliders to allow you to dynamically change the values of the above two properties, allowing you to appreciate the effect they have: border-image-slice changes the size of the image slice sampled for use in each border and border corner (and the content area, if the fill keyword is used) — varying this away from 30 causes the border to look somewhat irregular, but can have some interesting effects.
border-inline-end - CSS: Cascading Style Sheets
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.
...orthand:border-bottom-style: as specifiedborder-left-style: as specifiedborder-right-style: as specifiedborder-top-style: as specifiedborder-inline-end-color: computed coloranimation typeas each of the properties of the shorthand:border-inline-end-color: a colorborder-inline-end-style: discreteborder-inline-end-width: a length values the border-inline-end is specified with one or more of the following, in any order: <'border-width'> the width of the border.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline-end: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-end' in that specification.
border-inline-start - CSS: Cascading Style Sheets
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.
... values the border-inline-start is specified with one or more of the following, in any order: <'border-width'> the width of the border.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline-start: 5px dashed blue; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-start' in that specification.
border-radius - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-bottom-left-radius border-bottom-right-radius border-top-left-radius border-top-right-radius syntax /* the syntax of the first radius allows one to four values */ /* radius is set for all 4 sides */ border-radius: 10px; /* top-left-and-bottom-right | top-right-and-bottom-left */ border-radius: 10px 5%; /* top-left | top-right-and-bottom-left | bottom-right */ ...
...border-radius: 2px 4px 2px; /* top-left | top-right | bottom-right | bottom-left */ border-radius: 1px 0 3px 4px; /* the syntax of the second radius allows one to four values */ /* (first radius values) / radius */ border-radius: 10px / 20px; /* (first radius values) / top-left-and-bottom-right | top-right-and-bottom-left */ border-radius: 10px 5% / 20px 30px; /* (first radius values) / top-left | top-right-and-bottom-left | bottom-right */ border-radius: 10px 5px 2em / 20px 25px 30%; /* (first radius values) / top-left | top-right | bottom-right | bottom-left */ border-radius: 10px 5% / 20px 25em 30px 35em; /* global values */ border-radius: inherit; border-radius: initial; border-radius: unset; the border-radius property is specified as: one, two, three, or four <length> or <perc...
... followed optionally by "/" and one, two, three, or four <length> or <percentage> values.
border-width - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-bottom-width border-left-width border-right-width border-top-width syntax /* keyword values */ border-width: thin; border-width: medium; border-width: thick; /* <length> values */ border-width: 4px; border-width: 1.2rem; /* vertical | horizontal */ border-width: 2px 1.5em; /* top | horizontal | bottom */ border-width: 1px 2em 1.5cm; /* top | right | bottom | left */ border-width: 1px 2...
...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 denoted by each keyword, the precise result when 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.
box-flex-group - CSS: Cascading Style Sheets
if the box would overflow after the preferred space of the children has been computed, then space is removed from flexible elements in a manner similar to that used when adding extra space.
...elements do not shrink below their minimum widths.
... formal definition initial value1applies toin-flow children of box elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples simple usage example in the original flexbox spec, box-flex-group could be used to assign flex children to different groups to distribute flexible space between: article:nth-child(1) { -webkit-box-flex-group: 1; } article:nth-child(2) { -webkit-box-flex-group: 2; } this was only ever supported in webkit-based browsers, with a prefix, and in subsequent versions of the spec this functionality does not have an equivalent.
box-ordinal-group - CSS: Cascading Style Sheets
when the computed box-direction is normal, a box will display its elements starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (for vertical boxes) of the container.
... elements with the same ordinal group are flowed in the order they appear in the source document tree.
... formal definition initial value1applies tochildren of box elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples basic usage example in an older version of the spec, box-ordinal-group was included to allow you to change the display order of flex children inside a flex container: article:nth-child(1) { -webkit-box-ordinal-group: 2 -moz-box-ordinal-group: 2 box-ordinal-group: 2 } article:nth-child(2) { -webkit-box-ordinal-group: 1 -moz-box-ordinal-group: 1 box-ordinal-group: 1 } the modern flexbox equivalent is order.
color - CSS: Cascading Style Sheets
WebCSScolor
accessibility concerns 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.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples making text red the following are all ways to make a paragraph's text red: p { color: red; } p { color: #f00; } p { color: #ff0000; } p { color: rgb(255,0,0); } p { color: rgb(100%, 0%, 0%); } p { color: hsl(0, 100%, 50%); } /* 50% translucent */ p { color: #ff000080; } p { color: rgba(255, 0, 0, 0.5); } p { color: hsla(0, 100%, 50%, 0.5); } specifications specification status comment cs...
...allows alpha values in rgb() and hsl(), turning rgba() and hsla() into (deprecated) aliases for them.
column-span - CSS: Cascading Style Sheets
syntax the column-span property is specified as one of the keyword values listed below.
...content in the normal flow that appears before the element is automatically balanced across all columns before the element appears.
... formal definition initial valuenoneapplies toin-flow block-level elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax none | all examples making a heading span columns in this example, the heading is made to span across all the columns of the article.
columns - CSS: Cascading Style Sheets
WebCSScolumns
constituent properties this property is a shorthand for the following css properties: column-count column-width syntax /* column width */ columns: 18em; /* column count */ columns: auto; columns: 2; /* both column width and count */ columns: 2 auto; columns: auto 12em; columns: auto auto; /* global values */ columns: inherit; columns: initial; columns: unset; the columns property may be specified as one or two of the values listed below, in any order.
... <'column-count'> the ideal number of columns into which the element's content should be flowed, defined as an <integer> or the keyword auto.
... if neither this value nor the column's width are auto, it merely indicates the maximum allowable number of columns.
direction - CSS: Cascading Style Sheets
WebCSSdirection
the direction css property sets the direction of text, table columns, and horizontal overflow.
...it also sets the default alignment of text, block-level elements, and the direction that cells flow within a table row.
... unlike the dir attribute in html, the direction property is not inherited from table columns into table cells, since css inheritance follows the document tree, and table cells are inside of rows but not inside of columns.
<display-legacy> - CSS: Cascading Style Sheets
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.
... examples in the below example, we are creating an inline flex container with the legacy keyword inline-flex.
env() - CSS: Cascading Style Sheets
WebCSSenv
originally provided by the ios browser to allow developers to place their content in a safe area of the viewport, the safe-area-inset-* values defined in the specification can be used to help ensure content is visible even to viewers using non‑rectangular displays.
...) examples the below example makes use of the optional second parameter of env(), which allows you to provide a fallback value in case the environment variable is not available.
...v(safe-area-inset-bottom, 50px); /* 50px because ua properties are case sensitive */ padding: env(x, 50px 20px); /* as if padding: '50px 20px' were set because x is not a valid environment variable */ padding: env(x, 50px, 20px); /* ignored because '50px, 20px' is not a valid padding value and x is not a valid environment variable */ the syntax of the fallback, like that of custom properties, allows commas.
drop-shadow() - CSS: Cascading Style Sheets
a drop shadow is effectively a blurred, offset version of the input image's alpha mask, drawn in a specific color and composited below the image.
... syntax drop-shadow(offset-x offset-y blur-radius color) the drop-shadow() function accepts a parameter of type <shadow> (defined in the box-shadow property), with the exception that the inset keyword and spread parameters are not allowed.
...negative values are not allowed.
<filter-function> - CSS: Cascading Style Sheets
syntax the <filter-function> data type is specified using one of the filter functions listed below.
... examples filter function comparison this example provides a simple graphic, along with a select menu to allow you to choose between the different types of filter function, and a slider to allow you to vary the values used inside the filter function.
... updating the controls updates the filter effect in real time, allowing you to investigate the effects of different filters.
flex-direction - CSS: Cascading Style Sheets
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.
...this will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader.
...sinheritednocomputed valueas specifiedanimation typediscrete formal syntax row | row-reverse | column | column-reverse examples reversing flex container columns and rows html <h4>this is a column-reverse</h4> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> </div> <h4>this is a row-reverse</h4> <div id="content1"> <div class="box1" style="background-color:red;">a</div> <div class="box1" style="background-color:lightblue;">b</div> <div class="box1" style="background-color:yellow;">c</div> </div> css #content { width: 200px; height: 200px; border: 1px solid #c3c3c3; display: flex; flex-direction: column-reverse; } .box { ...
font-size - CSS: Cascading Style Sheets
WebCSSfont-size
-size: medium; font-size: large; font-size: x-large; font-size: xx-large; font-size: xxx-large; /* <relative-size> values */ font-size: smaller; font-size: larger; /* <length> values */ font-size: 12px; font-size: 0.8em; /* <percentage> values */ font-size: 80%; /* global values */ font-size: inherit; font-size: initial; font-size: unset; the font-size property is specified in one of the following ways: as one of the absolute-size or relative-size keywords as a <length> or a <percentage>, relative to the parent element's font size values xx-small, x-small, small, medium, large, x-large, xx-large, xxx-large absolute-size keywords, based on the user's default font size (which is medium).
...take the following html and css: html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6em; } <div> <span>outer <span>inner</span> outer</span> </div> the result is: assuming that the browser's default font-size is 16px, the words “outer” would be rendered at 16px, but the word “inner” would be rendered at 25.6px.
... the css below is nearly identical to the previous example.
font-stretch - CSS: Cascading Style Sheets
negative values are not allowed for this property.
... keyword to numeric mapping the table below shows the mapping between keyword values and numeric percentages: keyword percentage ultra-condensed 50% extra-condensed 62.5% condensed 75% semi-condensed 87.5% normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% description some...
... the table below demonstrates the effect of supplying various different percentage values of font-stretch on two different fonts: 50% 62.5% 75% 87.5% 100% 112.5% 125% 150% 200% helvetica neue league mono variable helvetica neue, which is installed by default on macos, has a ...
font-variant-alternates - CSS: Cascading Style Sheets
this property allows those human-readable names (defined in @font-feature-values) in the stylesheet.
... syntax this property may take one of two forms: either the keyword normal or one or more of the other keywords and functions listed below, space-separated, in any order.
...be aware that some existing fonts don't follow this advice.
<frequency> - CSS: Cascading Style Sheets
WebCSSfrequency
syntax the <frequency> data type consists of a <number> followed by one of the units listed below.
...7 hz no space is allowed between the number and the unit.
... 0 although unitless zero is an allowable <length>, it's an invalid <frequency>.
<gradient> - CSS: Cascading Style Sheets
WebCSSgradient
syntax the <gradient> data type is defined with one of the function types listed below.
... <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; height: 80px; } .radial-gradient { background: radial-gradient(red, yellow, rgb(30, 144, 255)); } repeating gradient examples simple repeating linear and radial gradient examples.
ident - CSS: Cascading Style Sheets
WebCSSident
it consists of one or more characters, where characters can be any of the following: any alphabetical character (a to z, or a to z), any decimal digit (0 to 9), a hyphen (-), an underscore (_), an escaped character (preceded by a backslash, \), a unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its unicode code point) note that id1, id1, id1 and id1 are all different identifiers as they are case-sensitive.
... examples valid identifiers nono79 a mix of alphanumeric characters and numbers ground-level a mix of alphanumeric characters and a dash -test a dash followed by alphanumeric characters --toto a custom-property like identifier _internal an underscore followed by alphanumeric characters \22 toto a unicode character followed by a sequence of alphanumeric characters bili\.bob a correctly escaped period invalid identifiers 34rem it must not start with a decimal digit.
... -12rad it must not start with a dash followed by a decimal digit.
<image> - CSS: Cascading Style Sheets
WebCSSimage
syntax the <image> data type can be represented with any of the following: an image denoted by the <url> data type a <gradient> data type a part of the webpage, defined by the element() function an image, image fragment or solid patch of color, defined by the image() function a blending of two or more images defined by the cross-fade() function.
... description css can handle the following kinds of images: images with intrinsic dimensions (a natural size), like a jpeg, png, or other raster format.
...if supported, the browser-defined size matching the usual cursor size on the client's system content for a pseudo-element (::after/::before) a 300px × 150px rectangle the concrete object size is calculated using the following algorithm: if the specified size defines both the width and the height, these values are used as the concrete object size.
ime-mode - CSS: Cascading Style Sheets
WebCSSime-mode
syntax the ime-mode property is specified using one of the keyword values listed below.
... description unlike internet explorer, firefox's implementation of ime-mode allows this property on <input type="password">.
...users may correct the inappropriate behavior of sites that don't follow this recommendation by placing the following css into their user stylesheet: input[type=password] { ime-mode: auto !important; } the mac version of gecko 1.9 (firefox 3) can't recover the previous state of the ime when a field for which it is disabled loses focus, so mac users may get grumpy when you use the disabled value.
line-height-step - CSS: Cascading Style Sheets
/* point values */ line-height-step: 18pt; syntax the line-height-step property is specified as any one of the following: a <length>.
... 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.
... :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.
mask-composite - CSS: Cascading Style Sheets
the mask-composite css property represents a compositing operation used on the current mask layer with the mask layers below it.
... /* keyword values */ mask-composite: add; mask-composite: subtract; mask-composite: intersect; mask-composite: exclude; /* global values */ mask-composite: inherit; mask-composite: initial; mask-composite: unset; syntax one or more of the keyword values listed below, separated by commas.
... values for the composition the current mask layer is referred to as source, while all layers below it are referred to as destination.
mask-size - CSS: Cascading Style Sheets
WebCSSmask-size
negative lengths are not allowed.
...negative percentages are not allowed.
... the rendered size of the mask image is then computed as follows: if both components of mask-size are specified and are not auto: the mask image renders at the specified size.
mask - CSS: Cascading Style Sheets
WebCSSmask
as well as the properties listed below, the mask shorthand also resets mask-border to its initial value.
...this will ensure that mask-border has also been reset to allow the new styles to take effect.
... constituent properties this property is a shorthand for the following css properties: mask-clip mask-composite mask-image mask-mode mask-origin mask-position mask-repeat mask-size syntax /* keyword values */ mask: none; /* image values */ mask: url(mask.png); /* pixel image used as mask */ mask: url(masks.svg#star); /* element within svg graphic used as mask */ /* combined values */ mask: url(masks.svg#star) luminance; /* element within svg graphic used as luminance mask */ mask: url(masks.svg#star) 40px 20px; /* element within svg graphic used as mask positioned 40px from the top and 20px from the left */ mask: url(masks.svg#star) 0 0/50px 50px; /* element within svg graphic used as mask with a width and height of 50px */...
max() - CSS: Cascading Style Sheets
WebCSSmax
the max() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.
... formal syntax max( <calc-sum># )where <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) examples setting a minimum size for a font another use case for css functions is allow a font size to grow while ensuring it is at least a mimum size, enabling responsive font sizes while ensuring legibility.
...this ensure it is legible and ensures accessibility <h1>this text is always legible, but doesn't change size</h1> <h1 class="responsive">this text is always legible, and is responsive, to a point</h1> think of the max() function as finding the minimum value allowed for a property.
opacity - CSS: Cascading Style Sheets
WebCSSopacity
for example: background: rgba(0, 0, 0, 0.4); accessibility concerns if text opacity is adjusted, 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.
...tsinheritednocomputed valuethe specified value, clipped in the range [0,1]animation typea number formal syntax <alpha-value>where <alpha-value> = <number> | <percentage> examples setting background opacity html <div class="light">you can barely see this.</div> <div class="medium">this is easier to see.</div> <div class="heavy">this is very easy to see.</div> css div { background-color: yellow; } .light { opacity: 0.2; /* barely see the text over the background */ } .medium { opacity: 0.5; /* see the text more clearly over the background */ } .heavy { opacity: 0.9; /* see the text very clearly over the background */ } result setting opacity on hover html <img src="//developer.mozilla.org/static/img/opengraph-logo.png" alt="mdn logo" width="128" height="146" class="opac...
...ity"> css img.opacity { opacity: 1; filter: alpha(opacity=100); /* ie8 and lower */ zoom: 1; /* triggers "haslayout" in ie 7 and lower */ } img.opacity:hover { opacity: 0.5; filter: alpha(opacity=50); zoom: 1; } result specifications specification status comment css color module level 4the definition of 'opacity' in that specification.
perspective-origin - CSS: Cascading Style Sheets
syntax /* one-value syntax */ perspective-origin: x-position; /* two-value syntax */ perspective-origin: x-position y-position; /* when both x-position and y-position are keywords, the following is also valid */ perspective-origin: y-position x-position; /* global values */ perspective-origin: inherit; perspective-origin: initial; perspective-origin: unset; values x-position indicates the position of the abscissa of the vanishing point.
... it can have one of the following values: <length-percentage> indicating the position as an absolute length value or relative to the width of the element.
...it can have one of the following values: <length-percentage> indicating the position as an absolute length value or relative to the height of the element.
<ratio> - CSS: Cascading Style Sheets
WebCSSratio
syntax in media queries level 3, the <ratio> data type consisted of a strictly positive <integer> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <integer>.
... in media queries level 4, the <ratio> date type is updated to consist of a strictly positive <number> followed by a forward slash ('/', unicode u+002f solidus) and a second strictly positive <number>.
... in addition a single <number> as a value is allowable.
scroll-margin-inline - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: scroll-margin-inline-end scroll-margin-inline-start syntax /* <length> values */ scroll-margin-inline: 10px; scroll-margin-inline: 1em .5em ; /* global values */ scroll-margin-inline: inherit; scroll-margin-inline: initial; scroll-margin-inline: unset; values <length> an outset from the corresponding edge of the scroll container.
...the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > 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.
scroll-margin - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: scroll-margin-bottom scroll-margin-left scroll-margin-right scroll-margin-top syntax /* <length> values */ scroll-margin: 10px; scroll-margin: 1em .5em 1em 1em; /* global values */ scroll-margin: inherit; scroll-margin: initial; scroll-margin: unset; values <length> an outset from the corresponding edge of the scroll container.
...the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points.
scrollbar-width - CSS: Cascading Style Sheets
the scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown.
...it must be one of the following values: auto the default scrollbar width for the platform.
...ag, guideline 2.1 explanations mdn understanding wcag, guideline 2.5 explanations understanding success criterion 2.1.1 | w3c understanding wcag 2.1 understanding success criterion 2.5.5 | w3c understanding wcag 2.1 formal definition initial valueautoapplies toscrolling boxesinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | thin | none examples sizing overflow scrollbars css .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-width: thin; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
text-emphasis-position - CSS: Cascading Style Sheets
the informative table below summarizes the preferred emphasis mark positions for chinese, mongolian and japanese: preferred emphasis mark and ruby position language preferred position illustration horizontal vertical japanese over right korean mongolian chinese under right note: the text-emphasis-position cannot be set, and ...
...in html, this can be done with the following style rule: ruby { text-emphasis: none; } preferring emphasis marks over ruby some other editors prefer to hide ruby when they conflict with emphasis marks.
... in html, this can be done with the following pattern: em { text-emphasis: dot; /* set text-emphasis for <em> elements */ } em rt { display: none; /* hide ruby inside <em> elements */ } specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification.
text-underline-position - CSS: Cascading Style Sheets
under forces the line to be set below the alphabetic baseline, at a position where it won't cross any descenders.
... below forces the line to be below the text.
...in the horizontal text we use text-underline-position: under; to put the underline below all the descenders.
matrix3d() - CSS: Cascading Style Sheets
a1a2a3a4b1b2b3b4c1c2c3c4d1d2d3d4 examples cube squashing example the following example shows a 3d cube created from dom elements and transforms, which can be hovered/focused to apply a matrix3d() transform to it.
...</div> css html { width: 100%; } body { height: 100vh; /* centering content */ display: flex; flex-flow: row wrap; justify-content: center; align-content: center; } .foo { width: 50%; padding: 1em; color: white; background: #ff8c66; border: 2px dashed black; text-align: center; font-family: system-ui, sans-serif; font-size: 14px; /* setting up animation for better demonstration */ animation: motionscale 2s alternate linear infinite; } @keyframes motionscale { from { ...
... 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, -50,-100,0,1.1 ); } 50% { transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,0.9 ); } to { transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, 50,100,0,1.1 ) } } result specifications specification status comment css transforms level 2the definition of 'matrix3d()' in that specification.
<transform-function> - CSS: Cascading Style Sheets
syntax the <transform-function> data type is specified using one of the transformation functions listed below.
... 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.
...the cube's starting state is slightly rotated using transform3d(), to allow you to see the effect of all the transforms.
EXSLT
there are a number of modules; those that are supported by firefox are listed below: common (exsl)the exslt common package provides basic functions that expand upon the capabilities of xslt.math (math)the exslt math package provides functions for working with numeric values and comparing nodes.regular expressions (regexp)the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions.sets (set)the exslt sets package offers functions that let you perform set manipulation.strings (str)the exslt strings package provides functions that allow the manipulation of strings.
... functions math:highest() math:lowest() math:max() math:min() regular expressions the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions.
... functions set:difference() set:distinct() set:intersection() set:has-same-node() set:leading() set:trailing() strings the exslt strings package provides functions that allow the manipulation of strings.
Web Audio playbackRate explained - Developer guides
the playbackrate property of the <audio> and <video> elements allows us to change the speed, or rate, at which a piece of web audio or video is playing.
... </form> and apply some javascript to it: window.onload = function () { var v = document.getelementbyid("myvideo"); var p = document.getelementbyid("pbr"); var c = document.getelementbyid("currentpbr"); p.addeventlistener('input',function(){ c.innerhtml = p.value; v.playbackrate = p.value; },false); }; finally, we listen for the input event firing on the <input> element, allowing us to react to the playback rate control being changed.
... so defaultplaybackrate allows us to set the playback rate before playing the media, while playbackrate allows us to change it during media playback.
DOM onevent handlers - Developer guides
in order to allow multiple handlers to be installed for the same event on a given object, you can call its addeventlistener() method, which manages a list of handlers for the given event on the object.
... when an event occurs that applies to an element, each of its event handlers is called to allow them to handle the event, one after another.
...(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.
Mutation events - Developer guides
performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!).
... mutation events list the following is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified mutation observers alternatives examples domnoderemovedfromdocument var isdescendant = function (desc, root...
...& (desc === root || isdescendant(desc.parentnode, root)); }; var onremove = function (element, callback) { var observer = new mutationobserver(function (mutations) { _.foreach(mutations, function (mutation) { _.foreach(mutation.removednodes, function (removed) { if (isdescendant(element, removed)) { callback(); // allow garbage collection observer.disconnect(); observer = undefined; } }); }); }); observer.observe(document, { childlist: true, subtree: true }); }; usage you can register a listener for mutation events using element.addeventlistener as follows: element.addeventlistener("domnodeinserted", functi...
Orientation and motion data explained - Developer guides
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.
...we use lower-case letters ("x", "y", and "z") to describe the axes of the device coordinate frame.
Localizations and character encodings - Developer guides
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.
... finding canonical encoding names the text below refers to canonical names of encodings.
...(be sure to use a browser installation that has its settings left to the defaults when investigating!) for locales where firefox has more market share than internet explorer, it's probably best not to change the fallback encoding even if it doesn't follow the guidance given above.
Separate sites for mobile and desktop - Developer guides
finally, it also allows for completely different user experiences on desktop and mobile — they’re two different sites, after all!
...when it is right to choose this option firstly, if your target audience includes users on older or low-end feature phones, it is worth noting that you may need to employ this strategy to some degree no matter what.
...approaches to mobile web development see the following articles for background and other approaches to developing for mobile platforms.
Printing - Developer guides
using a print style sheet add the following to your <head> tag.
...=150'); my_window.document.write('<html><head><title>print me</title></head>'); my_window.document.write('<body onafterprint="self.close()">'); my_window.document.write('<p>when you print this window, it will close afterward.</p>'); my_window.document.write('</body></html>'); } </script> </head> <body> <p>to try out the <code>afterprint</code> event, click the link below to open the window to print.
...the following is a possible example which will print a file named externalpage.html: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>mdn example</title> <script type="text/javascript"> function closeprint () { document.body.removechild(this.__container__); } function setprint () { this.contentwindow.__container__ = this; this.contentwindow.o...
HTML attribute: min - HTML: Hypertext Markup Language
WebHTMLAttributesmin
-12-25t19:30"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the min value set, the value is considered invalid in contraint validation and will match the :invalid pseudoclass see client-side validation and rangeunderflow for more information.
... for the <meter> element, the min attribute defines the lower numeric bound of the measured range.
... syntax for min values for other elements input type syntax example <meter> <number> <meter id="fuel" min="0" max="100" low="33" high="66" optimum="80" value="40"> at 40/100</meter> impact on step the value of min and step define what are valid values, even if the step attribute is not included, as step defaults to 0.
HTML attribute: pattern - HTML: Hypertext Markup Language
examples given the following: <p> <label>enter your phone number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit prefix" size="2"/> - <input name="tel3" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size=...
... the example below restricts the value to 4-8 characters and requires that it contain only lower-case letters.
... <form> <div> <label for="uname">choose a username: </label> <input type="text" id="uname" name="name" required size="45" pattern="[a-z]{4,8}" title="4 to 8 lowercase letters"> <span class="validity"></span> <p>usernames must be lowercase and 4-8 characters in length.</p> </div> <div> <button>submit</button> </div> </form> div { margin-bottom: 10px; position: relative; } p { font-size: 80%; color: #999; } input + span { padding-right: 30px; } input:invalid+span:after { position: absolute; content: '✖'; padding-left: 5px; } input:valid+span:after { position: absolute; content: '✓'; padding-left: 5px; } this renders like so: accessibility concerns when a control has a pattern attribute, the title attribute, if used, m...
HTML attribute: step - HTML: Hypertext Markup Language
WebHTMLAttributesstep
the value can must be a positive number - integer or float -- or the special value any, which means no stepping is implied, and any value is allowed (barring other constraints, such as min and max).
... the default stepping value for number inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer.
...if providing instructions outside of labels, which allows more flexible positioning and design, consider using aria-labelledby or aria-describedby.
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
WebHTMLElementabbr
content categories flow content, phrasing content, palpable content permitted content phrasing content tag omission none, both the starting and ending tag are mandatory.
...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.
...see the example defining an abbreviation below.
<address>: The Contact Address element - HTML: Hypertext Markup Language
WebHTMLElementaddress
content categories flow content, palpable content.
... permitted content flow content, but with no nested <address> element, no heading content (<hgroup>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>), no sectioning content (<article>, <aside>, <section>, <nav>), and no <header> or <footer> element.
... permitted parents any element that accepts flow content, but always excluding <address> elements (according to the logical principle of symmetry, if <address> tag, as a parent, can not have nested <address> element, then the same <address> content can not have <address> tag as its parent).
<base>: The Document Base URL element - HTML: Hypertext Markup Language
WebHTMLElementbase
if either of the following attributes are specified, this element must come before other elements with attribute values of urls, such as <link>’s href attribute.
...absolute and relative urls are allowed.
... the following keywords have special meanings: _self (default): show the result in the current browsing context.
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementblink
the html blink element (<blink>) is a non-standard element which causes the enclosed text to flash slowly.
...blinking text is frowned upon by several accessibility standards and the css specification allows browsers to ignore the <blink> element.
... css polyfill if you really do need a polyfill, then you can use the following css polyfill.
<button>: The Button element - HTML: Hypertext Markup Language
WebHTMLElementbutton
content categories flow content, phrasing content, interactive content, listed, labelable, and submittable form-associated element, palpable content.
...the following keywords have special meanings: _self: load the response into the same browsing context as the current one.
... if overridden, it is important to ensure that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it.
<col> - HTML: Hypertext Markup Language
WebHTMLElementcol
<col> allows styling columns using css, but only a few properties will have an effect on the column (see the css 2.1 specification for a list).
... deprecated attributes the following attributes are deprecated and should not be used.
... they are documented below for reference when updating existing code and for historical interest only.
<colgroup> - HTML: Hypertext Markup Language
WebHTMLElementcolgroup
the end tag may be omitted, if it is not followed by a space or a comment.
... deprecated attributes the following attributes are deprecated and should not be used.
... they are documented below for reference when updating existing code and for historical interest only.
<content>: The Shadow DOM Content Placeholder element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementcontent
permitted content flow content.
... permitted parent elements any element that accepts flow content.
... shadowroot.innerhtml = '<h2>inserted heading</h2> <content select="p"></content>'; </script> </body> </html> if you display this in a web browser it should look like the following.
<dt>: The Description Term element - HTML: Hypertext Markup Language
WebHTMLElementdt
it is usually followed by a <dd> element; however, multiple <dt> elements in a row indicate several terms that are all defined by the immediate next <dd> element.
... permitted content flow content, but with no <header>, <footer>, sectioning content or heading content descendants.
...the end tag may be omitted if this element is immediately followed by another <dt> or a <dd> element, or if there is no more content in the parent element.
<embed>: The Embed External Content element - HTML: Hypertext Markup Language
WebHTMLElementembed
content categories flow content, phrasing content, embedded content, interactive content, palpable content.
...this must be an absolute value; percentages are not allowed.
...this must be an absolute value; percentages are not allowed.
<footer> - HTML: Hypertext Markup Language
WebHTMLElementfooter
content categories flow content, palpable content.
... permitted content flow content, but with no <footer> or <header> descendants.
... permitted parents any element that accepts flow content.
<nav>: The Navigation Section element - HTML: Hypertext Markup Language
WebHTMLElementnav
content categories flow content, sectioning content, palpable content.
... permitted content flow content.
... permitted parents any element that accepts flow content.
<section>: The Generic Section element - HTML: Hypertext Markup Language
WebHTMLElementsection
content categories flow content, sectioning content, palpable content.
... permitted content flow content.
... permitted parents any element that accepts flow content.
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
WebHTMLElementsource
permitted parents a media element—<audio> or <video>—and it must be placed before any flow content or <track> element.
... a width descriptor, which consists of a string containing a positive integer directly followed by "w", such as 300w.
... a pixel density descriptor, that is a positive floating number directly followed by "x".
<sub>: The Subscript element - HTML: Hypertext Markup Language
WebHTMLElementsub
subscripts are typically rendered with a lowered baseline using smaller text.
... content categories flow content, phrasing content, palpable content.
...se case for <sub>: <p>according to the computations by nakamura, johnson, and mason<sub>1</sub> this will result in the complete annihilation of both particles.</p> the resulting output looks like this: variable subscripts in mathematics, families of variables related to the same concept (such as distances along the same axis) are represented using the same variable name with a subscript following.
<sup>: The Superscript element - HTML: Hypertext Markup Language
WebHTMLElementsup
content categories flow content, phrasing content, palpable content.
...see exponents under examples below.
...g is the presentation of certain abbreviations in french: <p>robert a présenté son rapport à m<sup>lle</sup> bernard.</p> the resulting output: ordinal numbers ordinal numbers, such as "fourth" in english or "quinto" in spanish may be abbreviated using numerals and language-specific text rendered in superscript: <p>the ordinal number "fifth" can be abbreviated in various languages as follows:</p> <ul> <li>english: 5<sup>th</sup></li> <li>french: 5<sup>ème</sup></li> </ul> the output: specifications specification status comment html living standardthe definition of '<sub> and <sup>' in that specification.
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
WebHTMLElementtd
permitted content flow content.
... the end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element.
...if characters don't descend below the baseline, the baseline value achieves the same effect as bottom.
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementtt
content categories flow content, phrasing content, palpable content.
... <p>enter the following at the telnet command prompt: <code>set localecho</code><br /> the telnet client should display: <tt>local echo is on</tt></p> result overriding the default font you can override the browser's default font—if the browser permits you to do so, which it isn't required to do—using css: css tt { font-family: "lucida console", "menlo", "monaco", "courier", monospace; }...
... html <p>enter the following at the telnet command prompt: <code>set localecho</code><br /> the telnet client should display: <tt>local echo is on</tt></p> result usage notes the <tt> element is, by default, rendered using the browser's default non-proportional font.
contenteditable - HTML: Hypertext Markup Language
if so, the browser modifies its widget to allow editing.
... the attribute must take one of the following values: true or an empty string, which indicates that the element is editable.
... note that although its allowed values include true and false, this attribute is an enumerated one and not a boolean one.
Basics of HTTP - HTTP
http is an extensible protocol that relies on concepts like resources and uniform resource identifiers (uris), simple message structure, and client-server communication flow.
... flow of an http session this fundamental article describes a typical http session: what happens under the hood when you click on a link in your browser.
...this article explains how http frames allow multiplexing and solve the 'head-of-line' blocking problem of former http versions.
Compression in HTTP - HTTP
for some documents, size reduction of up to 70% lowers the bandwidth capacity needs.
...do not use the two following techniques for files in a compressed format.
...te and transfer-encoding are mostly used to send a response by chunks, allowing to start transmitting a resource without knowing its length.
Configuring servers for Ogg media - HTTP
html <audio> and <video> elements allow media presentation without the need for the user to install any plug-ins or other software to do so.
... for apache, you can add the following to your configuration: addtype audio/ogg .oga addtype video/ogg .ogv addtype application/ogg .ogg you can find specific information about possible media file types and the codecs used within them in our comprehensive guide to media types and formats on the web.
... another probelm with allowing http compression for media streaming: apache servers don't send the content-length response header if gzip encoding is used.
Cache-Control - HTTP
header type general header forbidden header name no cors-safelisted response header yes syntax caching directives have the following rules to be valid: case-insensitive, but lowercase is recommended.
...it therefore forbids a proxy or browser feature, such as google’s web light, from converting images to minimize data for a cache store or slow connection.
... examples preventing caching to disable caching of a resource, you can send the following response header: good: cache-control: no-store bad: cache-control: private,no-cache,no-store,max-age=0,must-revalidate,pre-check=0,post-check=0 caching static assets for the files in the application that will not change, you can usually add aggressive caching by sending the response header below.
CSP: report-uri - HTTP
content-security-policy: default-src https:; report-uri /csp-violation-report-endpoint/ /csp-violation-report-endpoint/ could for example run a php something like the following that logs the json detailing the violation and, if the violation is the first one added to the log file, sends an email to an administrator: <?php // start configure $log_file = dirname(__file__) .
...$current_domain; http_response_code(204); // http 204 no content $json_data = file_get_contents('php://input'); // we pretty print the json before adding it to the log file if ($json_data = json_decode($json_data)) { $json_data = json_encode($json_data, json_pretty_print | json_unescaped_slashes); if (!file_exists($log_file)) { // send an email $message = "the following content-security-policy violation occurred on " .
... "\n\nfurther cps violations will be logged to the following log file, but no further email notifications will be sent until this log file is deleted:\n\n" .
CSP: trusted-types - HTTP
this allows authors to define rules guarding writing values to the dom and thus reducing the dom xss attack surface to small, isolated parts of the web application codebase, facilitating their monitoring and code review.
... syntax content-security-policy: trusted-types; content-security-policy: trusted-types <policyname>; content-security-policy: trusted-types <policyname> <policyname> 'allow-duplicates'; <domstring> any string can be a trusted type policy name.
... 'allow-duplicates' allows for creating policies with a name that was already used examples todo polyfill a polyfill for trusted types is available on github.
Referer - HTTP
WebHTTPHeadersReferer
the referer request header contains the address of the previous web page from which a link to the currently requested page was followed.
... the referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example.
... header type request header forbidden header name yes syntax referer: <url> directives <url> an absolute or partial address of the previous web page from which a link to the currently requested page was followed.
Save-Data - HTTP
this could be for reasons such as high transfer costs, slow connection speeds, etc.
... a value of on indicates explicit user opt-in into a reduced data usage mode on the client, and when communicated to origins allows them to deliver alternative content to reduce the data downloaded such as smaller image and video resources, different markup and styling, disabled polling and automatic updates, and so on.
... examples the vary header ensures that the content is cached properly (for instance ensuring that the user is not served a lower-quality image from the cache when save-data header is no longer present [e.g.
Strict-Transport-Security - HTTP
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.
...by following the guidelines and successfully submitting your domain, browsers will never connect to your domain using an insecure connection.
... strict-transport-security: max-age=31536000; includesubdomains in the following example, max-age is set to 2 years, raised from what was a former limit max-age of 1 year.
Trailer - HTTP
WebHTTPHeadersTrailer
the trailer response header allows the sender to include additional fields at the end of chunked messages in order to supply metadata that might be dynamically generated while the message body is sent, such as a message integrity check, digital signature, or post-processing status.
... the te request header needs to be set to "trailers" to allow trailer fields.
...these header fields are disallowed: message framing headers (e.g., transfer-encoding and content-length), routing headers (e.g., host), request modifiers (e.g., controls and conditionals, like cache-control, max-forwards, or te), authentication headers (e.g., authorization or set-cookie), or content-encoding, content-type, content-range, and trailer itself.
X-Frame-Options - HTTP
the x-frame-options http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>.
... allow-from uri this is an obsolete directive that no longer works in modern browsers.
... x-frame-options works only by setting through the http header, as in the examples below.
Network Error Logging - HTTP
this experimental header allows web sites and applications to opt-in to receive reports about failed (and, if desired, successful) network fetches from supporting browsers.
... the following object keys can be specified in the nel header: report_to the reporting api group to send network error reports to (see below).
...ttps://example.com/previous-page", "body": { "elapsed_time": 18, "method": "post", "phase": "dns", "protocol": "http/1.1", "referrer": "https://example.com/previous-page", "sampling_fraction": 1, "server_ip": "", "status_code": 0, "type": "dns.name_not_resolved", "url": "https://example-host.com/" } } the type of the network error may be one of the following pre-defined values from the specification, but browsers can add and send their own error types: dns.unreachable the user's dns server is unreachable dns.name_not_resolved the user's dns server responded but was unable to resolve an ip address for the requested uri.
Protocol upgrade mechanism - HTTP
note also that http/2 explicitly disallows the use of this mechanism; it is specific to http/1.1.
...this means that a typical request that includes upgrade would look something like: get /index.html http/1.1 host: www.example.com connection: upgrade upgrade: example/1, foo/2 other headers may be required depending on the requested protocol; for example, websocket upgrades allow additional headers to configure details about the websocket connection as well as to offer a degree of security in opening the connection.
...after creating the initial http/1.1 session, you need to request the upgrade by adding to a standard request the upgrade and connection headers, as follows: connection: upgrade upgrade: websocket websocket-specific headers the following headers are involved in the websocket upgrade process.
HTTP response status codes - HTTP
WebHTTPStatus
the below status codes are defined by section 10 of rfc 2616.
... 405 method not allowed the request method is known by the server but has been disabled and cannot be used.
... 422 unprocessable entity (webdav) the request was well-formed but was unable to be followed due to semantic errors.
Enumerability and ownership of properties - JavaScript
there are a number of built-in means of detecting, iterating/enumerating, and retrieving object properties, with the chart showing below which are available.
... some sample code follows which demonstrates how to obtain the missing categories.
...this._enumerableandnotenumerable); }, // private static property checker callbacks _enumerable: function(obj, prop) { return obj.propertyisenumerable(prop); }, _notenumerable: function(obj, prop) { return !obj.propertyisenumerable(prop); }, _enumerableandnotenumerable: function(obj, prop) { return true; }, // inspired by http://stackoverflow.com/a/8024294/271577 _getpropertynames: function getallpropertynames(obj, iterateselfbool, iterateprototypebool, includepropcb) { var props = []; do { if (iterateselfbool) { object.getownpropertynames(obj).foreach(function(prop) { if (props.indexof(prop) === -1 && includepropcb(obj, prop)) { props.push(pr...
Equality comparisons and sameness - JavaScript
the equality comparison is performed as follows for operands of the various types: operand b undefined null number string boolean object operand a undefined true true false false false false null true true false false false false number false false a === b a === tonumber(b) a === tonumber(b) a == toprimitive(b)...
...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".
...we can see from the sameness comparisons table below that this is due to the way that object.is handles nan.
Concurrency model and the event loop - JavaScript
runtime concepts the following sections explain a theoretical model.
...a good practice to follow is to make message processing short and if possible cut down one message into several messages.
...in the example below, the message ''this is just a message'' will be written to the console before the message in the callback gets processed, because the delay is the minimum time required for the runtime to process the request (not a guaranteed time).
Iterators and generators - JavaScript
it allows creation of a simple range iterator which defines a sequence of integers from start (inclusive) to end (exclusive) spaced step apart.
...generator functions provide a powerful alternative: they allow you to define an iterative algorithm by writing a single function whose execution is not continuous.
... for (let value of ['a', 'b', 'c']) { console.log(value); } // "a" // "b" // "c" [...'abc']; // ["a", "b", "c"] function* gen() { yield* ['a', 'b', 'c']; } gen().next(); // { value: "a", done: false } [a, b, c] = new set(['a', 'b', 'c']); a; // "a" advanced generators generators compute their yielded values on demand, which allows them to efficiently represent sequences that are expensive to compute (or even infinite sequences, as demonstrated above).
JavaScript technologies overview - JavaScript
among other things, ecmascript defines: language syntax (parsing rules, keywords, control flow, object literal initialization, ...) error handling mechanisms (throw, try...catch, ability to create user-defined error types) types (boolean, number, string, function, object, ...) the global object.
... webworkers allows parallel computation.
... websockets allows low-level bidirectional communication.
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number.
...with ecmascript 6 and later, the syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o).
... examples invalid octal numbers 08; 09; // syntaxerror: 08 is not a legal ecma-262 octal constant // syntaxerror: "0"-prefixed octal literals and octal escape sequences // are deprecated valid octal numbers use a leading zero followed by the letter "o"; 0o755; 0o644; ...
SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated - JavaScript
message syntaxerror: octal numeric literals and escape characters not allowed in strict mode (edge) syntaxerror: "0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead error type syntaxerror in strict mode only.
...with ecmascript 2015 and later, the standardized syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o).
... examples "0"-prefixed octal literals "use strict"; 03; // syntaxerror: "0"-prefixed octal literals and octal escape sequences // are deprecated octal escape sequences "use strict"; "\251"; // syntaxerror: "0"-prefixed octal literals and octal escape sequences // are deprecated valid octal numbers use a leading zero followed by the letter "o" or "o": 0o3; for octal escape sequences, you can use hexadecimal escape sequences instead: '\xa9'; ...
SyntaxError: a declaration in the head of a for-of loop can't have an initializer - JavaScript
this is not allowed in for-of loops.
...this is not allowed in for-of loops.
... you might want a for loop that does allow an initializer.
SyntaxError: missing name after . operator - JavaScript
these will allow you to compute an expression.
...please see the examples below.
...square brackets allow computed property access.
SyntaxError: Unexpected token - JavaScript
examples expression expected for example, when chaining expressions, trailing commas are not allowed.
... for (let i = 0; i < 5,; ++i) { console.log(i); } // syntaxerror: expected expression, got ')' correct would be omitting the comma or adding another expression: for (let i = 0; i < 5; ++i) { console.log(i); } not enough brackets sometimes, you leave out brackets around if statements: function round(n, upperbound, lowerbound){ if(n > upperbound) || (n < lowerbound){ throw 'number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } // syntaxerror: expected expression, got '||' the brackets may look correct at first, but note how the || is outside the brackets.
... correct would be putting brackets around the ||: function round(n, upperbound, lowerbound){ if((n > upperbound) || (n < lowerbound)){ throw 'number ' + string(n) + ' is more than ' + string(upperbound) + ' or less than ' + string(lowerbound); }else if(n < ((upperbound + lowerbound)/2)){ return lowerbound; }else{ return upperbound; } } ...
Default parameters - JavaScript
default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
... 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.
... the following function will throw a referenceerror when invoked, because the default parameter value does not have access to the child scope of the function body: function f(a = go()) { // throws a `referenceerror` when `f` is invoked.
Rest parameters - JavaScript
the rest parameter syntax allows us to represent an indefinite number of arguments as an array.
... function myfun(a, b, ...manymoreargs) { console.log("a", a) console.log("b", b) console.log("manymoreargs", manymoreargs) } myfun("one", "two", "three", "four", "five", "six") // a, one // b, two // manymoreargs, [three, four, five, six] below...
... // using the same function definition from example above myfun("one", "two", "three") // a, one // b, two // manymoreargs, [three] below, the third argument isn't provided, but manymoreargs is still an array (albeit an empty one).
Array.prototype.every() - JavaScript
you can work around this by inserting the following code at the beginning of your scripts, allowing use of every in implementations which do not natively support it.
... if (!testresult) { return false; } } k++; } return true; }; } examples testing size of all array elements the following example tests whether all elements in the array are bigger than 10.
... [12, 5, 8, 130, 44].every(x => x >= 10); // false [12, 54, 18, 130, 44].every(x => x >= 10); // true​ affecting initial array (modifying, appending, and deleting) the following examples tests the behaviour of the every method when the array is modified.
Array.prototype.find() - JavaScript
however, you can polyfill array.prototype.find with the following snippet: // https://tc39.github.io/ecma262/#sec-array.prototype.find if (!array.prototype.find) { object.defineproperty(array.prototype, 'find', { value: function(predicate) { // 1.
...(inventory.find(ischerries)); // { name: 'cherries', quantity: 5 } using arrow function and destructuring const inventory = [ {name: 'apples', quantity: 2}, {name: 'bananas', quantity: 0}, {name: 'cherries', quantity: 5} ]; const result = inventory.find( ({ name }) => name === 'cherries' ); console.log(result) // { name: 'cherries', quantity: 5 } find a prime number in an array the following example finds an element in the array that is a prime number (or returns undefined if there is no prime number): function isprime(element, index, array) { let start = 2; while (start <= math.sqrt(element)) { if (element % start++ < 1) { return false; } } return element > 1; } console.log([4, 6, 8, 12].find(isprime)); // undefined, not found console.log([4, 5, 8, 12].fin...
...d(isprime)); // 5 the following examples show that nonexistent and deleted elements are visited, and that the value passed to the callback is their value when visited: // declare array with no elements at indexes 2, 3, and 4 const array = [0,1,,,,5,6]; // shows all indexes, not just those with assigned values array.find(function(value, index) { console.log('visited index ', index, ' with value ', value); }); // shows all indexes, including deleted array.find(function(value, index) { // delete element 5 on first iteration if (index === 0) { console.log('deleting array[5] with value ', array[5]); delete array[5]; } // element 5 is still visited even though deleted console.log('visited index ', index, ' with value ', value); }); // expected output: // deleting array[5] w...
Array.prototype.flatMap() - JavaScript
it is identical to a map() followed by a flat() of depth 1, but flatmap() is often quite useful, as merging both into one method is slightly more efficient.
...the flatmap method is identical to a map followed by a call to flat of depth 1.
...in other words, it allows you to map many items to many items (by handling each input item separately), rather than always one-to-one.
Array.prototype.indexOf() - JavaScript
you can work around this by utilizing the following code at the beginning of your scripts.
... this will allow you to use indexof() when there is still no native support.
... if (k in o && o[k] === searchelement) return k; } return -1; }; } examples using indexof() the following example uses indexof() to locate values in an array.
Array.prototype.lastIndexOf() - JavaScript
you can work around this by inserting the following code at the beginning of your scripts, allowing use of lastindexof in implementations which do not natively support it.
... examples using lastindexof the following example uses lastindexof to locate values in an array.
... var numbers = [2, 5, 9, 2]; numbers.lastindexof(2); // 3 numbers.lastindexof(7); // -1 numbers.lastindexof(2, 3); // 3 numbers.lastindexof(2, 2); // 0 numbers.lastindexof(2, -2); // 0 numbers.lastindexof(2, -1); // 3 finding all the occurrences of an element the following example uses lastindexof to find all the indices of an element in a given array, using push to add them to another array as they are found.
Array.prototype.pop() - JavaScript
examples removing the last element of an array the following code creates the myfish array containing four elements, then removes its last element.
... var myfish = ['angel', 'clown', 'mandarin', 'sturgeon']; var popped = myfish.pop(); console.log(myfish); // ['angel', 'clown', 'mandarin' ] console.log(popped); // 'sturgeon' using apply( ) or call ( ) on array-like objects the following code creates the myfish array-like object containing four elements and a length parameter, then removes its last element and decrements the length parameter.
... var myfish = {0:'angel', 1:'clown', 2:'mandarin', 3:'sturgeon', length: 4}; var popped = array.prototype.pop.call(myfish); //same syntax for using apply( ) console.log(myfish); // {0:'angel', 1:'clown', 2:'mandarin', length: 3} console.log(popped); // 'sturgeon' specifications specification ecmascript (ecma-262)the definition of 'array.prototype.pop' in that specification.
Array.prototype.shift() - JavaScript
examples removing an element from an array the following code displays the myfish array before and after removing its first element.
... it also displays the removed element: var myfish = ['angel', 'clown', 'mandarin', 'surgeon']; console.log('myfish before:', json.stringify(myfish)); // myfish before: ['angel', 'clown', 'mandarin', 'surgeon'] var shifted = myfish.shift(); console.log('myfish after:', myfish); // myfish after: ['clown', 'mandarin', 'surgeon'] console.log('removed this element:', shifted); // removed this element: angel using shift() method in while loop the shift() method is often used in condition inside while loop.
... in the following example every iteration will remove the next element from an array, until it is empty: var names = ["andrew", "edward", "paul", "chris" ,"john"]; while( (i = names.shift()) !== undefined ) { console.log(i); } // andrew, edward, paul, chris, john specifications specification ecmascript (ecma-262)the definition of 'array.prototype.shift' in that specification.
Array.prototype.some() - JavaScript
you can work around this by inserting the following code at the beginning of your scripts, allowing use of some() in implementations which do not natively support it.
...peerror('array.prototype.some called on null or undefined'); } if (typeof fun !== 'function') { throw new typeerror(); } var t = object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(thisarg, t[i], i, t)) { return true; } } return false; }; } examples testing value of array elements the following example tests whether any element in the array is bigger than 10.
...ts = ['apple', 'banana', 'mango', 'guava']; function checkavailability(arr, val) { return arr.some(arrval => val === arrval); } checkavailability(fruits, 'kela'); // false checkavailability(fruits, 'banana'); // true converting any value to boolean const truthy_values = [true, 'true', 1]; function getboolean(value) { 'use strict'; if (typeof value === 'string') { value = value.tolowercase().trim(); } return truthy_values.some(function(t) { return t === value; }); } getboolean(false); // false getboolean('false'); // false getboolean(1); // true getboolean('true'); // true specifications specification ecmascript (ecma-262)the definition of 'array.prototype.some' in that specification.
Date.parse() - JavaScript
examples using date.parse() the following calls all return 1546300800000.
... the first according to es5 will imply utc time, and the others are specifying utc timezone via the iso date specification (z and +00:00) date.parse("2019-01-01") date.parse("2019-01-01t00:00:00.000z") date.parse("2019-01-01t00:00:00.000+00:00") the following call, which does not specify a time zone will be set to 2019-01-01 at 00:00:00 in the local timezone of the system.
... if ipodate is an existing date object, it can be set to august 9, 1995 (local time) as follows: ipodate.settime(date.parse('aug 9, 1995')); some other examples of parsing non-standard date strings: date.parse('aug 9, 1995'); returns 807937200000 in time zone gmt-0300, and other values in other time zones, since the string does not specify a time zone and is not iso format, therefore the time zone defaults to local.
Date - JavaScript
date.prototype.toisostring() converts a date to a string following the iso 8601 extended format.
... examples several ways to create a date object the following examples show several ways to create javascript dates: note: parsing of date strings with the date constructor (and date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.
... let date = new date(98, 1) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) // deprecated method; 98 maps to 1998 here as well date.setyear(98) // sun feb 01 1998 00:00:00 gmt+0000 (gmt) date.setfullyear(98) // sat feb 01 0098 00:00:00 gmt+0000 (bst) calculating elapsed time the following examples show how to determine the elapsed time between two javascript dates in milliseconds.
Error - JavaScript
see below for standard built-in error types.
... see "what's a good way to extend error in javascript?" on stackoverflow for an in-depth discussion.
...otherwise, old versions of babel and other transpilers will not correctly handle the following code without additional configuration.
Function.caller - JavaScript
the special property __caller__, which returned the activation object of the caller thus allowing to reconstruct the stack, was removed for security reasons.
...consider: function f(n) { g(n - 1); } function g(n) { if (n > 0) { f(n); } else { stop(); } } f(2); at the moment stop() is called the call stack will be: f(2) -> g(1) -> f(1) -> g(0) -> stop() the following is true: stop.caller === g && f.caller === g && g.caller === f so if you tried to get the stack trace in the stop() function like this: var f = stop; var stack = 'stack trace:'; while (f) { stack += '\n' + f.name; f = f.caller; } the loop would never stop.
... examples checking the value of a function's caller property the following code checks the value a function's caller property.
Function.name - JavaScript
" you can define a function with a name in a function expression: let object = { somemethod: function object_somemethod() {} }; console.log(object.somemethod.name); // logs "object_somemethod" try { object_somemethod } catch(e) { console.log(e); } // referenceerror: object_somemethod is not defined the name property is read-only and cannot be changed by the assigment operator: example below contradicts with what is said at the beginning of this section and doesn't work as described.
... let o = { get foo(){}, set foo(x){} }; var descriptor = object.getownpropertydescriptor(o, "foo"); descriptor.get.name; // "get foo" descriptor.set.name; // "set foo"; function names in classes you can use obj.constructor.name to check the "class" of an object (but be sure to read the warnings below): function foo() {} // es2015 syntax: class foo {} var fooinstance = new foo(); console.log(fooinstance.constructor.name); // logs "foo" warning: the script interpreter will set the built-in function.name property only if a function does not have an own property called name (see section 9.2.11 of the ecmascript2015 language specification).
...above class definition in es2015 syntax will behave in chrome or firefox similar to the following snippet in es5 syntax: function foo() {} object.defineproperty(foo, 'name', { writable: true }); foo.name = function() {}; trying to obtain the class of fooinstance via fooinstance.constructor.name won't give us the class name at all but a reference to the static class method.
Intl.DateTimeFormat.prototype.format() - JavaScript
however, this might change in the future and isn't guaranteed for all the languages — output variations are by design and allowed by the specification.
... most notably, the ie and edge browsers insert bidirectional control characters around dates, so the output text will flow properly when concatenated with other text.
...esults of format() to a static value: let d = new date("2019-01-01t00:00:00.000000z"); let formatteddate = intl.datetimeformat(undefined, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }).format(d); "1.1.2019, 01:00:00" === formatteddate; // true in firefox and others // false in ie and edge note: see also this stackoverflow thread for more details and examples.
Intl.ListFormat() constructor - JavaScript
an object with some or all of the following properties: localematcher the locale matching algorithm to use.
...when style is short or narrow, unit is the only allowed value for the type option.
... examples using format the following example shows how to create a list formatter using the english language.
Intl.NumberFormat() constructor - JavaScript
the following unicode extension key is allowed: nu the numbering system to be used.
... options optional an object with some or all of the following properties: compactdisplay only used when notation is "compact".
... the following properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other.
Math.hypot() - JavaScript
math.hypot also avoids overflow/underflow problems if the magnitude of your numbers is very large.
... polyfill a naive approach that does not handle overflow/underflow issues: if (!math.hypot) math.hypot = function() { var y = 0, i = arguments.length, containsinfinity = false; while (i--) { var arg = arguments[i]; if (arg === infinity || arg === -infinity) containsinfinity = true y += arg * arg } return containsinfinity ?
... infinity : math.sqrt(y) } a polyfill that avoids underflows and overflows: if (!math.hypot) math.hypot = function () { var max = 0; var s = 0; var containsinfinity = false; for (var i = 0; i < arguments.length; ++i) { var arg = math.abs(number(arguments[i])); if (arg === infinity) containsinfinity = true if (arg > max) { s *= (max / arg) * (max / arg); max = arg; } s += arg === 0 && max === 0 ?
Math.imul() - JavaScript
description math.imul() allows for 32-bit integer multiplication with c-like semantics.
...asmjs allows for jist-optimizers to more easily implement internal integers in javascript.
... polyfill this can be emulated with the following function: if (!math.imul) math.imul = function(a, b) { var ahi = (a >>> 16) & 0xffff; var alo = a & 0xffff; var bhi = (b >>> 16) & 0xffff; var blo = b & 0xffff; // the shift by 0 fixes the sign on the high part // the final |0 converts the unsigned value into a signed value return ((alo * blo) + (((ahi * blo + alo * bhi) << 16) >>> 0) | 0); }; however, the following function is more performant because it is likely that browsers in which this polyfill would be used do not optimize with an internal integer type in javascript, instead usi...
Object.prototype.__proto__ - JavaScript
warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, a very slow operation, in every browser and javascript engine.
...it is deprecated in favor of object.getprototypeof/reflect.getprototypeof and object.setprototypeof/reflect.setprototypeof (though still, setting the [[prototype]] of an object is a slow operation that should be avoided if performance is a concern).
...(that is, if the constructor didn't return an other object explicitly, or the fun.prototype has been reassigned since the instance was created.) the __proto__ setter allows the [[prototype]] of an object to be mutated.
Object - JavaScript
object.isextensible() determines if extending of an object is allowed.
... object.prototype.__nosuchmethod__ allows a function to be defined that will be executed when an undefined object member is called as a method.
... examples using object given undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(undefined) let o = new object(null) using object to create boolean objects the following examples store boolean objects in o: // equivalent to o = new boolean(true) let o = new object(true) // equivalent to o = new boolean(false) let o = new object(boolean()) object prototypes when altering the be...
handler.apply() - JavaScript
syntax const p = new proxy(target, { apply: function(target, thisarg, argumentslist) { } }); parameters the following parameters are passed to the apply() method.
... interceptions this trap can intercept these operations: proxy(...args) function.prototype.apply() and function.prototype.call() reflect.apply() invariants if the following invariants are violated, the proxy will throw a typeerror.
... examples trapping a function call the following code traps a function call.
handler.deleteProperty() - JavaScript
syntax const p = new proxy(target, { deleteproperty: function(target, property) { } }); parameters the following parameters are passed to the deleteproperty() method.
... interceptions this trap can intercept these operations: property deletion: delete proxy[foo] and delete proxy.foo reflect.deleteproperty() invariants if the following invariants are violated, the proxy will throw a typeerror: a property cannot be deleted, if it exists as a non-configurable own property of the target object.
... examples trapping the delete operator the following code traps the delete operator.
handler.set() - JavaScript
syntax const p = new proxy(target, { set: function(target, property, value, receiver) { } }); parameters the following parameters are passed to the set() method.
... interceptions this trap can intercept these operations: property assignment: proxy[foo] = bar and proxy.foo = bar inherited property assignment: object.create(proxy)[foo] = bar reflect.set() invariants if the following invariants are violated, the proxy will throw a typeerror: cannot change the value of a property to be different from the value of the corresponding target object property if the corresponding target object property is a non-writable, non-configurable data property.
... examples trap setting of a property value the following code traps setting a property value.
handler.setPrototypeOf() - JavaScript
syntax const p = new proxy(target, { setprototypeof: function(target, prototype) { } }); parameters the following parameters are passed to the setprototypeof() method.
... interceptions this trap can intercept these operations: object.setprototypeof() reflect.setprototypeof() invariants if the following invariants are violated, the proxy will throw a typeerror: if target is not extensible, the prototype parameter must be the same value as object.getprototypeof(target).
... examples if you want to disallow setting a new prototype for your object, your handler's setprototypeof() method can either return false, or it can throw an exception.
RangeError - JavaScript
the rangeerror object indicates an error when a value is not in the set or range of allowed values.
... description a rangeerror is thrown when trying to pass a value as an argument to a function that does not allow a range that includes the value.
... this can be encountered when: passing a value that is not one of the allowed string values to string.prototype.normalize(), or when attempting to create an array of an illegal length with the array constructor, or when passing bad values to the numeric methods number.prototype.toexponential(), number.prototype.tofixed() or number.prototype.toprecision().
RegExp() constructor - JavaScript
flags may contain any combination of the following characters: g (global match) find all matches rather than stopping after the first match.
... s ("dotall") allows .
... the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated.
RegExp.prototype.dotAll - JavaScript
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 flags in conjunction allows the dot to match any unicode character, without exceptions.
RegExp.prototype.exec() - JavaScript
return value if the match succeeds, the exec() method returns an array (with extra properties index and input; see below) and updates the lastindex property of the regular expression object.
... description consider the following example: // match "quick brown" followed by "jumps", ignoring characters in between // remember "brown" and "jumps" // ignore case let re = /quick\s(brown).+?(jumps)/ig; let result = re.exec('the quick brown fox jumps over the lazy dog'); the following table shows the results for this script: object property/index description example result [0] the full string of characters matched "quick brown fox jumps" [1], ...[n] the parenthesized substring matches, if any.
...'; msg += 'next match starts at ' + myre.lastindex; console.log(msg); } this script displays the following text: found abb.
RegExpInstance.lastIndex - JavaScript
the following rules apply: if lastindex is greater than the length of the string, test() and exec() fail, then lastindex is set to 0.
... otherwise, lastindex is set to the next position following the most recent match.
... examples using lastindex consider the following sequence of statements: var re = /(hi)?/g; matches the empty string.
RegExp.$1-$9 - JavaScript
the example below illustrates this.
... examples using $n with string.replace the following script uses the replace() method of the string instance to match a name in the format first last and output it in the format last, first.
... var re = /(\w+)\s(\w+)/; var str = 'john smith'; str.replace(re, '$2, $1'); // "smith, john" regexp.$1; // "john" regexp.$2; // "smith" using $n with regexp.test the following script uses the test() method of the regexp instance to grab a number in a generic string.
RegExp.prototype.test() - JavaScript
to get more information (but with slower execution), use the exec() method.
... const str = 'hello world!'; const result = /^hello/.test(str); console.log(result); // true the following example logs a message which depends on the success of the test: function testinput(re, str) { let midstring; if (re.test(str)) { midstring = 'contains'; } else { midstring = 'does not contain'; } console.log(`${str} ${midstring} ${re.source}`); } using test() on a regex with the "global" flag when a regex has the global flag set, test() will advance the lastindex of the ...
... the following example demonstrates this behaviour: const regex = /foo/g; // the "global" flag is set // regex.lastindex is at 0 regex.test('foo') // true // regex.lastindex is now at 3 regex.test('foo') // false // regex.lastindex is at 0 regex.test('barfoo') // true // regex.lastindex is at 6 regex.test('foobar') //false // regex.lastindex is at 0 // (...and so on) specifications ...
Planned changes to shared memory - JavaScript
if they are set, postmessage() on window objects and dedicated workers will function and allow for memory sharing.
... webassembly shared memory the webassembly threads proposal allows webassembly.memory objects to be created with a new shared constructor flag.
...just as sharedarraybuffer and its methods are unconditionally enabled (and only sharing between threads is gated on the new headers), the webassembly atomic instructions are also unconditionally allowed.
String.prototype.anchor() - JavaScript
also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup.
...also, the html specification no longer allows the <a> element to have a name attribute, so this method doesn't even create valid markup.
... examples using anchor() var mystring = 'table of contents'; document.body.innerhtml = mystring.anchor('contents_anchor'); will output the following html: <a name="contents_anchor">table of contents</a> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.anchor' in that specification.
TypedArray.from() - JavaScript
typedarray.from() has the optional parameter mapfn, which allows you to execute a map() function on each element of the typed array (or subclass object) that is being created.
... this means that the following are equivalent: typedarray.from(obj, mapfn, thisarg) typedarray.from(array.prototype.map.call(obj, mapfn, thisarg)).
... polyfill you can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of from() in implementations that do not natively support it.
TypedArray - JavaScript
instead, there are a number of different global properties, whose values are typed array constructors for specific element types, listed below.
... on the following pages you will find common properties and methods that can be used with any typed array containing elements of any type.
...ray(2); int16[0] = 42; console.log(int16[0]); // 42 // indexed properties on prototypes are not consulted (fx 25) int8array.prototype[20] = 'foo'; (new int8array(32))[20]; // 0 // even when out of bound int8array.prototype[20] = 'foo'; (new int8array(8))[20]; // undefined // or with negative integers int8array.prototype[-1] = 'foo'; (new int8array(8))[-1]; // undefined // named properties are allowed, though (fx 30) int8array.prototype.foo = 'bar'; (new int8array(32)).foo; // "bar" specifications specification ecmascript (ecma-262)the definition of 'typedarray objects' in that specification.
WebAssembly.Table() constructor - JavaScript
syntax new webassembly.table(tabledescriptor); parameters tabledescriptor an object that can contain the following members: element a string representing the type of value to be stored in the table.
... maximum optional the maximum number of elements the webassembly table is allowed to grow to.
... examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements.
Comma operator (,) - JavaScript
examples if a is a 2-dimensional array with 10 elements on each side, the following code uses the comma operator to increment i and decrement j at once.
... the following code prints the values of the diagonal elements in the array: for (var i = 0, j = 9; i <= 9; i++, j--) console.log('a[' + i + '][' + j + '] = ' + a[i][j]); note that the comma operators in assignments may appear not to have the normal effect of comma operators because they don't exist within an expression.
... in the following example, a is set to the value of b = 3 (which is 3), but the c = 4 expression still evaluates and its result returned to console (i.e., 4).
Property accessors - JavaScript
document['createelement']('pre') a space before bracket notation is allowed.
... for example, the following syntax is often seen in many scripts.
... x = eval('document.forms.form_name.elements.' + strformcontrol + '.value') eval() is slow and should be avoided whenever possible.
Spread syntax (...) - JavaScript
spread syntax (...) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected, or an object expression to be expanded in places where zero or more key-value pairs (for object literals) are expected.
...therefore, it may be unsuitable for copying multidimensional arrays, as the following example shows.
... shallow-cloning (excluding prototype) or merging of objects is now possible using a shorter syntax than object.assign().
void operator - JavaScript
syntax void expression description this operator allows evaluating expressions that produce a value into places where an expression that evaluates to undefined is desired.
... it should be noted that the precedence of the void operator should be taken into account and that parentheses can help clarify the resolution of the expression following the void operator: void 2 == '2'; // (void 2) == '2', returns false void (2 == '2'); // void (2 == '2'), returns undefined examples immediately invoked function expressions when using an immediately-invoked function expression, void can be used to force the function keyword to be treated as an expression instead of a declaration.
... javascript uris when a browser follows a javascript: uri, it evaluates the code in the uri and then replaces the contents of the page with the returned value, unless the returned value is undefined.
Expressions and operators - JavaScript
...obj spread syntax allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected.
... [a, b] = [1, 2] {a, b} = {a:1, b:2} destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals.
... comma operator , the comma operator allows multiple expressions to be evaluated in a single statement and returns the result of the last expression.
empty - JavaScript
the opposite behavior, where you want multiple statements, but javascript only allows a single one, is possible using a block statement, which combines several statements into a single one.
...see the following example with an empty loop body: let arr = [1, 2, 3]; // assign all array values to 0 for (let i = 0; i < arr.length; arr[i++] = 0) /* empty statement */ ; console.log(arr); // [0, 0, 0] unintentional usage it is a good idea to comment intentional use of the empty statement, as it is not really obvious to distinguish from a normal semicolon.
... in the following example, the usage is probably not intentional: if (condition); // caution, this "if" does nothing!
continue - JavaScript
the continue statement can include an optional label that allows the program to jump to the next iteration of a labeled loop statement instead of the current loop.
... examples using continue with while the following example shows a while loop that has a continue statement that executes when the value of i is 3.
... var i = 0; var n = 0; while (i < 5) { i++; if (i === 3) { continue; } n += i; } using continue with a label in the following example, a statement labeled checkiandj contains a statement labeled checkj.
export - JavaScript
note: the following is syntactically invalid despite its import equivalent: import defaultexport from 'bar.js'; // valid export defaultexport from 'bar.js'; // invalid the correct way of doing this is to rename the export: export { default as defaultexport } from 'bar.js'; examples using named exports in a module my-module.js, we could include the following code: // module "my-module.js" function cube(...
... function() { console.log('from graph draw function'); } } export { cube, foo, graph }; then in the top-level module included in your html page, we could have: import { cube, foo, graph } from './my-module.js'; graph.options = { color:'blue', thickness:'3px' }; graph.draw(); console.log(cube(3)); // 27 console.log(foo); // 4.555806215962888 it is important to note the following: you need to include this script in your html with a <script> element of type="module", so that it gets recognised as a module and dealt with appropriately.
...we want to export a single value or to have a fallback value for your module, you could use a default export: // module "my-module.js" export default function cube(x) { return x * x * x; } then, in another script, it is straightforward to import the default export: import cube from './my-module.js'; console.log(cube(3)); // 27 using export from let's take an example where we have the following hierarchy: childmodule1.js: exporting myfunction and myvariable childmodule2.js: exporting myclass parentmodule.js: acting as an aggregator (and doing nothing else) top level module: consuming the exports of parentmodule.js this is what it would look like using code snippets: // in childmodule1.js let myfunction = ...; // assign something useful to myfunction let myvariable = ...; // ...
for...of - JavaScript
iterable) { console.log(value); } // 1 // 2 // 3 iterating over the arguments object you can iterate over the arguments object to examine all of the parameters passed into a javascript function: (function() { for (const argument of arguments) { console.log(argument); } })(1, 2, 3); // 1 // 2 // 3 iterating over a dom collection iterating over dom collections like nodelist: the following example adds a read class to paragraphs that are direct descendants of an article: // note: this will only work in platforms that have // implemented nodelist.prototype[symbol.iterator] const articleparagraphs = document.queryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.add('read'); } closing iterators in for...of loops, abrupt iteration t...
... const gen = (function *(){ yield 1; yield 2; yield 3; })(); for (const o of gen) { console.log(o); break; // closes iterator } // the generator should not be re-used, the following does not make sense!
... the following example shows the difference between a for...of loop and a for...in loop when used with an array.
return - JavaScript
for example, the following function returns the square of its argument, x, where x is a number.
... 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.
try...catch - JavaScript
for example, when the exception occurs in the following code, control transfers to the catch-block.
... function isvalidjson(text) { try { json.parse(text); return true; } catch { return false; } } the finally-block the finally-block contains statements to execute after the try-block and catch-block(s) execute, but before the statements following the try...catch...finally-block.
... the following example shows one use case for the finally-block.
Statements and declarations - JavaScript
control flow block a block statement is used to group zero or more statements.
... break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement.
... for creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop.
JavaScript shells - JavaScript
a javascript shell allows you to quickly test snippets of javascript code without having to reload a web page.
... standalone javascript shells the following javascript shells are stand-alone environments, like perl or python.
... shelljs - portable unix shell commands for node.js list of javascript shells the following javascript shells work with mozilla.
JavaScript
the complete modules available there are as follows: javascript first steps answers some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", along with discussing key javascript features such as variables, strings, numbers, and arrays.
... javascript shells a javascript shell allows you to quickly test snippets of javascript code.
... stack overflow stack overflow questions tagged with "javascript".
icons - Web app manifests
examples "icons": [ { "src": "icon/lowres.webp", "sizes": "48x48", "type": "image/webp" }, { "src": "icon/lowres", "sizes": "48x48" }, { "src": "icon/hd_hi.ico", "sizes": "72x72 96x96 128x128 256x256" }, { "src": "icon/hd_hi.svg", "sizes": "72x72" } ] values image objects may contain the following values: member description sizes a string containing space-sep...
...the purpose of this member is to allow a user agent to quickly ignore images with media types it does not support.
... purpose can have one or more of the following values, separated by spaces: monochrome: a user agent can present this icon where a monochrome icon with a solid fill is needed.
<math> - MathML
WebMathMLElementmath
attributes in addition to the following attributes, the <math> element accepts any attributes of the <mstyle> element.
...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.
... overflow specifies how an expression behaves if it is too long to fit in the allowed width.
<mmultiscripts> - MathML
the mathml <mmultiscripts> element allows you to create tensor-like objects.
...prescripts are optional and are separated by the empty tag <mprescripts/> (only one <mprescripts /> element is allowed, otherwise you will get an duplicatemprescripts error in the error console and "invalid-markup" in your rendering).
... subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a css length.
<semantics> - MathML
the rules of determining the visible child in a <semantics> element are the following: if no rule other rule applies: by default only the first child is rendered, which is supposed to be presentation markup.
... beware that <annotation-xml> elements are only recognized, if the encoding attribute is set to one of the following: "application/mathml-presentation+xml" "mathml-presentation" "svg1.1" "text/html" "image/svg+xml" "application/xml".
... attributes the following attributes can be set on <annotation> and <annotation-xml>: definitionurl the location of the annotation key symbol.
Handling media support issues in web content - Web media technologies
a similar concept can be applied to still images; if an image you wish to present is very large and may take time to download (especially for slower devices or connections), you can offer a lower-resolution or alternate version that will be displayed until the full-quality version is available to be displayed.
...however, there are ways to present an image in low quality while it's still loading.
... <img src="/images/stafff-photo-huge-progressive.jpg" alt="staff photo, taken in january of 1972"> when using a progressive image, the data is stored in such a way that the browser is able to render a low-quality representation of the image as soon as possible, then update the image as it loads—or after it's finished loading—to present it in full quality.
OpenSearch description format
opensearch description file the xml file that describes a search engine follows the basic template below.
... to support autodiscovery, add a <link> element for each plugin to the <head> of your web page: <link rel="search" type="application/opensearchdescription+xml" title="searchtitle" href="pluginurl"> replace the bolded items as explained below: searchtitle the name of the search to perform, such as "search mdc" or "yahoo!
...if the error message isn't be helpful, the following tips could help you find the problem.
Recommended Web Performance Timings: How long is too long? - Web Performance
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 16.7 milliseconds includes scripting, reflow, and repaint.
...while a slower than 100ms reaction may create a disconnect between the user interaction and the response, a 100 to 200ms transition for a response may help the user notice the response their interaction initiated, such as a menu opening.
Navigation and resource timings - Web Performance
the general performance timings below have been deprecated in favor of the performance entry api, which provides for marking and measuring times along the navigation and resource loading process.
...as displayed in the image below, the navigation process goes from navigationstart, unloadeventstart, unloadeventend, redirectstart, redirectend, fetchstart, domainlookupstart, domainlookupend, connectstart , connectend, secureconnectionstart, requeststart, responsestart, responseend, domloading, dominteractive, domcontentloadedeventstart, domcontentloadedeventend, domcomplete, loadeventstart, and loadeventend.
...in the above image, we see via the name property that the file being timed is this document for the rest of this explanation, we use the following variable: let timing = performance.getentriesbytype('navigation')[0]; protocol we can check the protocol used by querying: let protocol = timing.nexthopprotocol it returns the network protocol used to fetch the resource: in this case h2 for http/2.
Performance budgets - Web Performance
the warning level allows you to be proactive and plan any tech debt, while not blocking development or deploys.
... bundlesize, allows you to define and run file size checks in your ci pipeline.
...they are meant to reflect your ongoing goals but allow risks and experiments.
Understanding latency - Web Performance
low latency implies that there are no or almost no delays.
... on a connection with low latency, requested resources will appear almost immediately.
... network throttling to emulate the latency of a low bandwidth network, you can use developer tools and switch to a lower end network connection.
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
installation the api allows us to add event listeners for key events we are interested in — the first one is the install event: self.addeventlistener('install', (e) => { console.log('[service worker] install'); }); in the install listener, we can initialize the cache and add files to it for offline use.
...this is very useful, as it allows us to intercept requests and respond to them with custom responses.
...this allows us to respond to every single request with any response we want: prepared by the service worker, taken from cache, modified if needed.
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.
... from the server-side, the whole process has to be encrypted with public and private keys for security reasons — allowing everyone to send push messages unsecured using your app would be a terrible idea.
...you can use the following ones:"); console.log(webpush.generatevapidkeys()); return; } webpush.setvapiddetails( 'https://serviceworke.rs/', process.env.vapid_public_key, process.env.vapid_private_key ); next, a module defines and exports all the routes an app needs to handle: getting the vapid public key, registering, and then sending notifications.
Graphic design for responsive sites - Progressive web apps (PWAs)
css media queries allow us to serve different css rules dependant on viewport dimensions, and you should consider using mobile first media queries where possible.
... high res and low res image copies one option here is to create a hi res and a low res set of images, then use resolution media queries to serve the hi res images only to hi res devices.
... css as well as adding programmatic graphical effects to links (and anywhere else you might want them), css3 also allows you to write declarative animations and transitions.
Web API reference - Web technology reference
WebReferenceAPI
document object model the dom is an api that allows access to and modification of the current document.
... it allows manipulation of document node and element.
... device apis this set of apis allows access to various hardware features available to web pages and applications.
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
example: masking for example, you can make a gradient mask for html content using svg and css code similar to the following, inside your html document: <svg height="0"> <mask id="mask-1"> <lineargradient id="gradient-1" y2="1"> <stop stop-color="white" offset="0"/> <stop stop-opacity="0" offset="1"/> </lineargradient> <circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/> <rect x="0.5" y="0.2" width="300" height="100" fill="url(#gradient-1)"/> </mask> </svg> .target { m...
...ask: url(#mask-1); } p { width: 300px; border: 1px solid #000; display: inline-block; } note that in the css, the mask is specified using a url to the id #mask-1, which is the id of the svg mask specified below it.
...ponent="10" lighting-color="white"> <fepointlight x="-5000" y="-10000" z="20000"/> </fespecularlighting> </filter> <filter id="f5"> <fecolormatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0" style="color-interpolation-filters:srgb"/> </filter> </svg> the five filters are applied using the following css: p.target { filter:url(#f3); } p.target:hover { filter:url(#f5); } b.target { filter:url(#f1); } b.target:hover { filter:url(#f4); } pre.target { filter:url(#f2); } pre.target:hover { filter:url(#f3); } view this example live example: blurred text in order to blur text, webkit based browsers have a (prefixed) css filter called blur (see also css filter).
SVG Core Attributes - SVG: Scalable Vector Graphics
WebSVGAttributeCore
value: any valid language id; animatable: no tabindex the tabindex svg attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation.
... value type: <iri>; animatable: no xml:lang it is a universal attribute allowed in all xml dialects to mark up the natural human language that an element contains.
... it's almost identical in usage to html's lang, but in conforming xml 1.0 documents, it does not allow the use of a null attribute value (xml:lang="") to indicate an unknown language.
class - SVG: Scalable Vector Graphics
WebSVGAttributeclass
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.
... } circle.circleclass { stroke: #006600; fill: #cc0000; } ]]> </style> <rect class="rectclass" x="10" y="10" width="100" height="100"/> <circle class="circleclass" cx="40" cy="50" r="26"/> </svg> </body> </html> elements the following elements can use the class attribute: <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>...
clip-rule - SVG: Scalable Vector Graphics
the following fragment of code will cause an evenodd clipping rule to be applied to the clipping path because clip-rule is specified on the <path> element that defines the clipping shape: <g> <clippath id="myclip"> <path d="..." clip-rule="evenodd" /> </clippath> <rect clip-path="url(#myclip)" ...
... /> </g> whereas the following fragment of code will not cause an evenodd clipping rule to be applied because the clip-rule is specified on the referencing element, not on the object defining the clipping shape: <g> <clippath id="myclip"> <path d="..." /> </clippath> <rect clip-path="url(#myclip)" clip-rule="evenodd" ...
...-> <clippath id="emptystar"> <use xlink:href="#star" clip-rule="evenodd" /> </clippath> <rect clip-path="url(#emptystar)" width="50" height="90" fill="blue" /> <!-- right: nonzero --> <clippath id="filledstar"> <use xlink:href="#star" clip-rule="nonzero" /> </clippath> <rect clip-path="url(#filledstar)" width="50" height="90" x="50" fill="red" /> </svg> elements the following elements can use the clip-rule attribute, but only if they are inside a <clippath> element.
display - SVG: Scalable Vector Graphics
WebSVGAttributedisplay
html, body, svg { height: 100%; } <svg viewbox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- here the yellow rectangle is displayed --> <rect x="0" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="20" y="20" width="60" height="60" fill="yellow"></rect> <!-- here the yellow rectangle is not displayed --> <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect> </svg> usage notes ...
... default value inline value [ <display-outside> | <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>where <display-outside> = block | inline | run-in<display-inside> = flow | flow-root | table | flex | grid | ruby<display-listitem> = <display-outside>?
... && [ flow | flow-root ]?
pointer-events - SVG: Scalable Vector Graphics
the pointer-events attribute is a presentation attribute that allows defining whether or when an element may be the target of a mouse event.
... to change the color of the rect underneath you have to click outside the circle --> <rect x="0" y="0" height="10" width="10" fill="black" /> <circle cx="5" cy="5" r="4" fill="white" pointer-events="visiblepoint" /> <!-- the circle below will never catch a mouse event.
...between #000000 and #ffffff const color = math.round(math.random() * 0xffffff) // let's format the color to fit css requirements const fill = '#' + color.tostring(16).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 ...
writing-mode - SVG: Scalable Vector Graphics
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> usage notes default value horizontal-tb value horizontal-tb | vertical-rl | vertical-lr animatable yes horizontal-tb this value defines a top-to-bottom block flow direction.
... vertical-rl this value defines a right-to-left block flow direction.
... vertical-lr this value defines a left-to-right block flow direction.
<circle> - SVG: Scalable Vector Graphics
WebSVGElementcircle
a value lower or equal to zero disables rendering of the circle.
...fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<circle>' in that specification.
<symbol> - SVG: Scalable Vector Graphics
WebSVGElementsymbol
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role 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>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> note: a <symbol> element itself is not meant to be rendered.
... candidate recommendation allowed geometry properties to be specified on a symbol scalable vector graphics (svg) 1.1 (second edition)the definition of '<symbol>' in that specification.
<tspan> - SVG: Scalable Vector Graphics
WebSVGElementtspan
it allows for adjustment of the style and/or position of that subtext as needed.
...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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<tspan>' in that specification.
<use> - SVG: Scalable Vector Graphics
WebSVGElementuse
however, xlink:href can still be required in practice for cross-browser compatibility (see the compatibility table below).
...fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:href, xlink:title usage notes categoriesgraphics element, graphics referencing element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<use>' in that specification.
Basic Transformations - SVG: Scalable Vector Graphics
an example: <svg width="30" height="10"> <g fill="red"> <rect x="0" y="0" width="10" height="10" /> <rect x="20" y="0" width="10" height="10" /> </g> </svg> all following transformations are summed up in an element's transform attribute.
...that means, the units you specify for the element and its children might not follow the 1:1 pixel mapping, but are also distorted, skewed, translated and scaled according to the transformation.
... embedding svg in svg in contrast to html, svg allows you to embed other svg elements seamlessly.
Introduction - SVG: Scalable Vector Graphics
a downside is loading svg can be slow.
...it was dropped for the upcoming svg 2.0, which is under heavy development right now and follows a similar approach to css 3 in that it splits components into several loosely coupled specifications.
...the first, svg tiny, should yield graphics primitives for small devices with low capabilities.
SVG Filters Tutorial - SVG: Scalable Vector Graphics
filters svg allows us to use similar tools as the bitmap description language such as the use of shadow, blur effects or even merging the results of different filters.
...between the filter tags, we can define the primitives that allow us to implement the desired effect.
...<femerge> primitive contains the nodes <femergenode> taking as input the result offsetblur , this will allow it to appear below the sourcegraphic implementation of more primitives <defs> <filter id="drop-shadow"> <fegaussianblur in="sourcealpha" stddeviation="3" result="blur"/> <feoffset in="blur" dx="4" dy="4" result="offsetblur"/> </filter> <femerge> <femergenode in="offsetblur"/> <femergenode in="sourcegraphic"/> </femerge> </defs> ...
Secure contexts - Web security
some apis on the web are very powerful, giving an attacker the ability to do the following and more: invade a user's privacy.
... get low-level access to a user's computer.
... resources that are not local, to be considered secure, must meet the following criteria: must be served over https:// or wss:// urls the security properties of the network channel used to deliver the resource must not be considered deprecated feature detection pages 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.
Axes - XPath
WebXPathAxes
the following is an extremely brief description of the thirteen available axes and the degree of support available in gecko.
... following indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes.
... following-sibling indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
Web technology for developers
below you'll find links to our web technology documentation.
... svg scalable vector graphics let you describe images as sets of vectors and shapes in order to allow them to scale smoothly regardless of the size at which they're drawn.
... temporary the stuff below here is temporary to help keep track of things while organization work is ongoing.
Caching compiled WebAssembly modules - WebAssembly
caching via indexeddb indexeddb is a transactional database system that allows you to store and retrieve structured data on the client-side.
...any subsequent call to instantiatecachedurl() will then clear out the entire cache, allowing you to avoid using out-of-date modules.
... errmsg => { console.log(errmsg); return webassembly.instantiatestreaming(fetch(url)).then(results => { return results.instance }); }); } caching a wasm module with the above library function defined, getting a wasm module instance and using its exported features (while handling caching in the background) is as simple as calling it with the following parameters: a cache version, which — as we explained above — you need to update when any wasm module is updated or moved to a different url.
Index - WebAssembly
found 12 pages: # page tags and summary 1 webassembly landing, webassembly, wasm webassembly is a new type of code that can be run in modern web browsers — it is a low-level assembly-like language with a compact binary format that runs with near-native performance and provides languages such as c/c++ with a compilation target so that they can run on the web.
... it is also designed to run alongside javascript, allowing both to work together.
... 4 compiling an existing c module to webassembly c++, compiling, emscripten, webassembly, wasm a core use-case for webassembly is to take the existing ecosystem of c libraries and allow developers to use them on the web.
Communicating With Other Scripts - Archive of obsolete content
see the section below on using postmessage() before firefox 31.
...").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/listen.html", contentscriptfile: data.url("talk.js") }); the "talk.js" content script uses window.postmessage() to send the message to the page: // content-script (talk.js) window.postmessage("message from content script", "http://my-domain.org/"); the second argument may be '*' which will allow communication with any domain.
Contributor's Guide - Archive of obsolete content
data members are properties that allow each instance to have their own state, whereas member functions are properties that allow instances to have behavior.
... inheritance allows classes to inherit state and behavior from an existing classes, known as the base class.
SDK and XUL Comparison - Archive of obsolete content
low-level apis and third-party modules that's not the whole story.
... if you need more flexibility than the sdk's high-level apis provide, you can use its low-level apis to load xpcom objects directly or to manipulate the dom directly as in a traditional bootstrapped extension.
private-browsing - Archive of obsolete content
opting into private browsing add-ons built using the sdk must opt into private browsing by setting the following key in their package.json file: "permissions": {"private-browsing": true} if an add-on has not opted in, then the high-level sdk modules will not expose private windows, or objects (such as tabs) that are associated with private windows: the windows module will not list any private browser windows, generate any events for private browser windows, or let the add-on open any private brow...
... additionally, add-ons that use low-level modules such as window/utils may see private browser windows with certain functions, even if they have not explicitly opted into private browsing.
self - Archive of obsolete content
loadreason this property contains of the following strings describing the reason your add-on was loaded: install enable startup upgrade downgrade isprivatebrowsingsupported this property indicates whether or not the add-on supports private browsing.
...this data lives in the add-on's data/ directory, immediately below the package.json file.
simple-prefs - Archive of obsolete content
attribute description type the type of preference, as defined in the "preference types" section below.
... optional common attributes these are attributes that all preferences may have: attribute description description this appears below the preference title in the add-ons manager ui.
simple-storage - Archive of obsolete content
be careful to set properties on the storage object and not the module itself, as demonstrated below: // this is not good!
... 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".
windows - Archive of obsolete content
w we can use the chrome window api console.log(chromewindow.document.location.href); // -> "chrome://browser/content/browser.xul" // convert back to the high-level window var highlevelwindow = modelfor(chromewindow); // now we can use the sdk's high-level window api console.log(highlevelwindow.title); } browserwindows.on("open", converttochromeandback); note that directly accessing low-level chrome objects like this means you're no longer protected by the compatibility guarantees made by the sdk's high-level apis.
...serwindows.length); the currently active window is given by browserwindows.activewindow: var windows = require("sdk/windows").browserwindows; windows.on('activate', function(window) { console.log("a window was activated."); var activewindowtitle = windows.activewindow.title; console.log("active window title is: " + activewindowtitle); }); events the browserwindows property emits the following events which can be listened to using its on function.
content/mod - Archive of obsolete content
for example, the following code applies a style to a content window, adding a border to all divs in page: var attachto = require("sdk/content/mod").attachto; var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); parameters modification : object the modification we want to apply to the target.
... for example, the following code applies and removes a style to a content window, adding a border to all divs in page: var { attachto, detachfrom } = require("sdk/content/mod"); var style = require("sdk/stylesheet/style").style; var style = style({ source: "div { border: 4px solid gray }" }); // assuming window points to the content page we want to modify attachto(style, window); // ...
core/heritage - Archive of obsolete content
, blue: function blue() { return parseint(this.color.substr(4, 2), 16); } }); var cmyk = class({ black: function black() { var color = math.max(math.max(this.red(), this.green()), this.blue()); return (1 - color / 255).tofixed(4); }, magenta: function magenta() { var k = this.black(); return (((1 - this.green() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); }, yellow: function yellow() { var k = this.black(); return (((1 - this.blue() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); }, cyan: function cyan() { var k = this.black(); return (((1 - this.red() / 255).tofixed(4) - k) / (1 - k)).tofixed(4); } }); such composable pieces can be combined into a single class definition by passing special implements option to a class function: // com...
...posing `color` prototype out of reusable components: var color = class({ implements: [ hex, rgb, cmyk ], initialize: function initialize(color) { this.color = color; } }); var pink = color('ffc0cb'); // rgb pink.red() // => 255 pink.green() // => 192 pink.blue() // => 203 // cmyk pink.magenta() // => 0.2471 pink.yellow() // => 0.2039 pink.cyan() // => 0.0000 pink instanceof color // => true be aware though that it's not multiple inheritance and ancestors prototypes of the classes passed under implements option are ignored.
net/xhr - Archive of obsolete content
functions forceallowthirdpartycookie(xhr) force relevant cookies to be sent with this xmlhttprequest even if normally they would not be.
... parameters xhr: xmlhttprequest the xmlhttprequest to allow third-party cookies for.
stylesheet/utils - Archive of obsolete content
it accepts the following values: "agent", "user" and "author".
...it accepts the following values: "agent", "user" and "author".
system/xul-app - Archive of obsolete content
versioninrange(version, lowinclusive, highexclusive) compares a given version to a version range.
... lowinclusive : string the lower bound of the version range to compare.
test/assert - Archive of obsolete content
usage to use the assert module, write a set of unit tests following the instructions in the unit testing tutorial.
... equal(actual, expected, message) tests shallow, coercive equality with ==: assert.equal(1, 1, "test that one is one"); parameters actual : object the actual result.
ui/button/action - Archive of obsolete content
a special shortcut allows you to pass the string "window" or "tab" to select the currently active window or tab.
...bel); // access the window's label -> "window-specific label" console.log(button.state("window").label); // access the first tab's label -> "window-specific label" console.log(button.state(tabs[0]).label); // access the second tab's label -> "tab-specific label" console.log(button.state(tabs[1]).label); } the best way to think of this is as a tree: the global state is the root, followed by the state for each window, followed by the state for each tab in a window.
ui/button/toggle - Archive of obsolete content
a special shortcut allows you to pass the string "window" or "tab" to select the currently active window or tab.
...bel); // access the window's label -> "window-specific label" console.log(button.state("window").label); // access the first tab's label -> "window-specific label" console.log(button.state(tabs[0]).label); // access the second tab's label -> "tab-specific label" console.log(button.state(tabs[1]).label); } the best way to think of this is as a tree: the global state is the root, followed by the state for each window, followed by the state for each tab in a window.
Adding a Button to the Toolbar - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... create a directory called "data", mkdir data and save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png then open the file called "index.js" in the root of your addon directory and add the following code to it: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://www.mozilla.org/"); } now run the add-on wit...
Displaying annotations - Archive of obsolete content
the complete content script is here: self.on('message', function onmessage(annotations) { annotations.foreach( function(annotation) { if(annotation.url == document.location.tostring()) { createanchor(annotation); } }); $('.annotated').css('border', 'solid 3px yellow'); $('.annotated').bind('mouseenter', function(event) { self.port.emit('show', $(this).attr('annotation')); event.stoppropagation(); event.preventdefault(); }); $('.annotated').bind('mouseleave', function() { self.port.emit('hide'); }); }); function createanchor(annotation) { annotationanchorancestor = $('#' + annotation.ancestorid); annotationanchor = $(annotationa...
...you should see a yellow border around the item you annotated: when you move your mouse over the item, the annotation should appear: obviously this add-on isn't complete yet.
Creating Reusable Modules - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
...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.
List Open Tabs - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... the following add-on adds an action button that logs the urls of open tabs when the user clicks it: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); } note: to get this working, you will need to save an icon for the button to your add-on's "data" directory as "icon-16.png".
Listen for Page Load - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
...the following add-on listens to the tab's built-in ready event and just logs the url of each tab as the user loads it: require("sdk/tabs").on("ready", logurl); function logurl(tab) { console.log(tab.url); } you will find this console output in the browser console, not the web console.
Modifying the Page Hosted by a Tab - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
... in the following example, we are loading two scripts, first.js & second.js.
Bootstrapped extensions - Archive of obsolete content
creating a bootstrapped extension to mark an extension as bootstrappable, you need to add the following element to its install manifest: <em:bootstrap>true</em:bootstrap> then you need to add a bootstrap.js file that contains the required functions; this should be alongside the install.rdf file in the extension's package.
...the data is a simple javascript object with the following properties: property type description id string the id of the add-on being bootstrapped.
Forms related code snippets - Archive of obsolete content
th, span.zdp-decrease-year { float: left; margin-right: 2px; } span.zdp-increase-month, span.zdp-increase-year { float: right; margin-left: 2px; } td.zdp-active-cell { padding: 1px 3px; cursor: pointer; color: #000000; text-align: center; vertical-align: middle; } td.zdp-active-cell:hover { background-color: #999999; cursor: pointer; } td.zdp-empty-cell { cursor: not-allowed; } </style> </head> <body> <form name="myform"> <p> from: <input type="text" readonly class="date-picker" name="date-from" /> to: <input type="text" readonly class="date-picker" name="date-to" /> </p> </form> </body> </html> note: the current implementation of const (constant statement) is not part of ecmascript 5.
... this date-picker code snippet will automatically create an html code like the following: <table id="zdp-cal-1" class="zdp-calendar" style="z-index: 1026; position: absolute; left: 294px; top: 47px;"> <caption><span id="zdp-decr-year-1" class="zdp-decrease-year">&laquo;</span><span id="zdp-decr-month-1" class="zdp-decrease-month">&lt;</span><span id="zdp-incr-year-1" class="zdp-increase-year">&raquo;</span><span id="zdp-incr-month-1" class="zdp-increase-month">&gt;</span> ...
Examples and demos from articles - Archive of obsolete content
what follows is a brief list of examples and demos from our theoretical articles.
...[article] typewriter effect [html] the following example will delete and re-type simulating a typewriter all the text content of the nodelist which match a specified group of selectors.
Sidebar - Archive of obsolete content
for example the code below calls a function defined in the sidebar's context: var sidebarwindow = document.getelementbyid("sidebar").contentwindow; // verify that our sidebar is open at this moment: if (sidebarwindow.location.href == "chrome://yourextension/content/whatever.xul") { // call "yournotificationfunction" in the sidebar's context: sidebarwindow.yournotificationfunction(anyarguments); } testing which...
... resizing the sidebar programmatically in case you need to change the width of the sidebar, use the following code: function setsidebarwidth(newwidth) { var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); mainwindow.document.ge...
Toolbar - Archive of obsolete content
the following code will place your button on the toolbar by default.
... you must not insert your toolbar button between any of the following elements: the combined back/forward button, the location bar, the stop botton, or the reload button.
Tree - Archive of obsolete content
); } to collapse all tree nodes just change the condition: var treeview = tree.treeboxobject.view; for (var i = 0; i < treeview.rowcount; i++) { if (treeview.iscontainer(i) && treeview.iscontaineropen(i)) treeview.toggleopenstate(i); } getting the text from the selected row assuming the given <tree>: <tree id="my-tree" seltype="single" onselect="ontreeselected()"> use the following javascript: function ontreeselected(){ var tree = document.getelementbyid("my-tree"); var cellindex = 0; var celltext = tree.view.getcelltext(tree.currentindex, tree.columns.getcolumnat(cellindex)); alert(celltext); } getting the tree item from the focused row assuming <tree id="my-tree">, you can use the following to get the tree item: var view = document.getelementbyid("my...
...for example, assuming the given <tree>: <tree id="my-tree" onclick="ontreeclicked(event)"> use the following javascript: function ontreeclicked(event){ var tree = document.getelementbyid("my-tree"); var tbo = tree.treeboxobject; // get the row, col and child element at the point var row = { }, col = { }, child = { }; tbo.getcellat(event.clientx, event.clienty, row, col, child); var celltext = tree.view.getcelltext(row.value, col.value); alert(celltext); } getting the selected indic...
getAttributeNS - Archive of obsolete content
as some browsers do not support getattributens, the following might be used to work on them as well.
... to get an xmlns for the 'xml' prefix return thisitem.getattribute('xml:'+nsatt); // prefix must be 'xml' per the specs } var attrs2, result; var attrs = thisitem.attributes; var prefixatt = new regexp('^(.*):'+nsatt.replace(/\./g, '\\.')+'$'); // e.g., xlink:href // find any prefixes with the local-name being searched (escape period since only character (besides colon) allowed in an xml name which needs escaping) for (var j = 0; j < attrs.length; j++) { // thisitem's atts // e.g., abc:href, xlink:href while (((result = prefixatt.exec(attrs[j].nodename)) !== null) && thisitem.nodename !== '#document' && thisitem.nodename !== '#document-fragment') { var xmlnsprefix = new regexp('^xmlns:'+result[1]+'$'); // e.g., xmnls:xl, xm...
Code snippets - Archive of obsolete content
nevertheless, the increasing computational power of modern browsers together with the introduction of typed arrays in ecmascript allow us, in theory, to build full virtual machines in pure ecmascript.
... external links the content at mozillazine example code is slowly being moved here, but you can still find useful examples there for now.
Communication between HTML and your extension - Archive of obsolete content
communication between an html page and and extension after building a sample extension by reading carefully and following the complete instructions for building an extension i was able to get an extension that could display something on the status bar.
... // doc.location is a location object (see below for a link).
Custom about: URLs - Archive of obsolete content
this change is reflected in the code below.
... return components.id(`{${aboutpage_id}}`); } static get classdescription() { return aboutpage_description; } static get contractid() { return `@mozilla.org/network/protocol/about;1?what=${aboutpage_word}`; } static get queryinterface() { return xpcomutils.generateqi([ci.nsiaboutmodule]); } constructor() { object.freeze(this); } geturiflags(auri) { return ci.nsiaboutmodule.allow_script; } newchannel(auri, asecurity_or_aloadinfo) { let channel; if (services.vc.compare(services.appinfo.version, '47.*') > 0) { const uri = services.io.newuri(aboutpage_uri, null, null); // greater than or equal to firefox48 so asecurity_or_aloadinfo is aloadinfo channel = services.io.newchannelfromuriwithloadinfo(uri, asecurity_or_aloadinfo); } else { ...
Default Preferences - Archive of obsolete content
mozilla provides a simple way of shipping default settings by allowing default preferences.
...you may not set variables inside of it, nor may do any kind of program flow control (ifs, loops etc.) nor even calculated values (i.e.
Downloading JSON and JavaScript in extensions - Archive of obsolete content
so the extension will not be allowed to move out of the amo sandbox.
...json is about state and does not allow functions to be decoded.
Installing Extensions and Themes From Web Pages - Archive of obsolete content
extension and web authors are encouraged to use the method described below to install xpis, as it provides the best experience to users.
... hash: aevent.target.getattribute("hash"), tostring: function () { return this.url; } }; this specifies the display name (foo) for use in the confirmation dialog, the url to the extension (which is the link href, recall), the icon url to display in the confirmation dialog, a hash of the xpi file contents (to protect against corrupted downloads), and a tostring function which will allow this code to work with versions of firefox 0.8 and earlier.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
after getting an element with the nsisimpleenumerator.getnext() method, use the queryinterface method to get the interface, which allows you to handle each element as a window object.
... manipulating files using xpcom xpcom provides a number of interfaces allowing you to perform file manipulations without concern for whether you are running on windows, mac os x, or linux.
Adding menus and submenus - Archive of obsolete content
if you have nothing to show on a menu, you should follow the standard used in firefox: show a single disabled item with an "(empty)" label.
... menu types checkbox menu items you can make a menuitem "checkable" to allow the user to enable/disable options using the menu.
Performance best practices in extensions - Archive of obsolete content
the browser window is blocked while your add-on's load handler runs, so the more it does, the slower firefox will appear to the user.
... avoid writing slow css read the "writing efficient css" guide.
Supporting search suggestions in search plugins - Archive of obsolete content
this allows firefox to verify that the suggestions match the current search term.
... for example, if the search term is "fir", and you don't need to return descriptions or alternate query urls, you might return the following json: ["fir", ["firefox", "first choice", "mozilla firefox"]] note that in this example, only the query string and completion array are specified, leaving out the optional elements.
Updating addons broken by private browsing changes - Archive of obsolete content
if your code refers to any of the following interfaces: ff 15: nsidomstoragemanager ff 16: nsitransferable ff 18: imgicache moziasyncfavicons nsifaviconservice nsiwebbrowserpersist ff 19: nsicontentprefservice nsidownloadmanager nsidownload nsihttpauthmanager nsistricttransportsecurityservice ff 20: nsiprivatebrowsingservice nsirecentbadcertservice furthermore, if your code uses any of these common chrome apis: ff 19: saveurl saveinternal openlinkin ff 20: openbrowserwindow gprivatebrowsingui finally, if ...
... nsidownloadmanager/nsidownload: integer download ids (and specifically the id property of nsidownload) are deprecated, and don't allow access to private downloads.
Using Dependent Libraries In Extension Components - Archive of obsolete content
sample code is below, and can be built by placing the two files in extensions/stub and configuring with --enable-extensions=stub extension file structure using the stub slightly changes how components are packaged in the extension directory structure.
... the following are the necessary modifications you will need in order to write a stub loader for an os x extension.
Adding preferences to an extension - Archive of obsolete content
(output.length) { // remove any whitespace from the end of the string output = output.replace(/\w*$/, ""); // build the tooltip string var fieldarray = output.split(","); samplepanel.label = symbol + ": " + fieldarray[1]; samplepanel.tooltiptext = "chg: " + fieldarray[4] + " | " + "open: " + fieldarray[5] + " | " + "low: " + fieldarray[6] + " | " + "high: " + fieldarray[7] + " | " + "vol: " + fieldarray[8]; } } var httprequest = new xmlhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } } note that we use stockwatcher.tickersymbol here instead of this.tickersymbol to get the stock symb...
...all we need to do is add a popupset describing the menu to the statusbar, as follows: <popupset> <menupopup id="stockmenu"> <menuitem label="refresh now" default="true" oncommand="stockwatcher.refreshinformation()"/> <menuseparator/> <menuitem label="apple (aapl)" oncommand="stockwatcher.watchstock('aapl')"/> <menuitem label="google (goog)" oncommand="stockwatcher.watchstock('goog')"/> <menuitem label="microsoft (msft)" oncommand="sto...
Creating a status bar extension - Archive of obsolete content
the chrome manifest file, chrome.manifest, for the sample follows.
...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.
MozOrientation - Archive of obsolete content
note: this below describes how these values worked for the now obsolete mozorientation.
...evt.y * (180 / math.pi)); } // use evt.gamma, evt.beta, and evt.alpha // according to dev.w3.org/geo/api/spec-source-orientation } window.addeventlistener('deviceorientation', orientationhandler, false); window.addeventlistener('mozorientation', orientationhandler, false); example window.addeventlistener("mozorientation", dofunc, true); the example below simply displays the raw accelerometer data in the browser window as the events arrive.
Install.js - Archive of obsolete content
xpi file structure you can use the code below (taken from pike's extensions ).
... it assumes the following structure of your xpi file: sampleext.xpi chrome\ sampleext.jar content\ sampleext\ locale\ (optional) en-us\ sampleext\ ...
Environment variables affecting crash reporting - Archive of obsolete content
the following environment variables affect crash reporting: moz_crashreporter_url sets the url that the crash reporter will submit reports to.
... 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.
Installing plugins to Gecko embedding browsers on Windows - Archive of obsolete content
much of this registry data follows as a consequence of the discussions in bug 109402.
... to find the path to the browser executable (exe) applicable to netscape 6.1, 6.2.x, netscape 7.0 (and up), mozilla 1.0, and compuserve 7.0 finding the browser executable is useful if you wish to launch the browser following installation of the plugin dll.
No Proxy For configuration - Archive of obsolete content
because the public network was small in scope and connections were slow, a caching proxy could often improve the overall performance.
... limitations a domain, including sub-domains domain suffix "mozilla.org" does not block domains that end in the same string (amozilla.org) sub-domains domain suffix, starting with a dot ".mozilla.org" does not block the main domain (mozilla.org) a hostname (without domain) hostname-only (see problems below) "localhost" also blocks any possible domains that start with the entry ("www.otherdomain.localhost") a hostname (with domain) domain name "www.mozilla.org" does not block hostnames or domains that end in the same string (other-www.mozilla.org) an ip address ip address "1.2.3.4" does not block hostnames that resolve to the ip address ("127.0.0.1" does not...
Same-origin policy for file: URIs - Archive of obsolete content
starting in gecko 1.9, files are allowed to read only certain other files.
...for cross-window dom access, each file is treated as a separate origin, with one exception: if a file is loaded from another file that would otherwise be able to load it following this same-origin policy, they are considered to have the same origin.
Visualizing an audio spectrum - Archive of obsolete content
note: you can use the audionode called analysernode to perform real-time fft analysis on an audio stream, rather than the code shown below.
... fft.spectrum[i] * 4000; // draw rectangle bars for each frequency bin ctx.fillrect(i * 4, canvas.height, 3, -magnitude); } } var audio = document.getelementbyid('audio-element'); audio.addeventlistener('mozaudioavailable', audioavailable, false); audio.addeventlistener('loadedmetadata', loadedmetadata, false); // fft from dsp.js, see below var fft = function(buffersize, samplerate) { this.buffersize = buffersize; this.samplerate = samplerate; this.spectrum = new float32array(buffersize/2); this.real = new float32array(buffersize); this.imag = new float32array(buffersize); this.reversetable = new uint32array(buffersize); this.sintable = new flo...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
the sections below tell you how to fetch, build and use the pluginhostctrl.dll .
...the following <embed> attributes have <param> tag equivalents: <param name="type" ...> is equivalent to typespecifies the mime type of the plug-in.
Autodial for Windows NT - Archive of obsolete content
these conditions are as follows: the autodial service is running control panel | network connections | advanced | dialup preferences | enable autodial by location is set for some location a dialup connection has been configured there is no lan connected or the dialup connection has been used to access the internet address in question.
...mozilla 1.1 also includes a fix to bug 157733, which allows our interaction with the autodial service to work a little more reliably.
Enabling quicklaunch for all users - Archive of obsolete content
to enable it, just load the following registry script into the user's windows registry: quicklaunch.reg.
... this can be performed automatically by including the following command into the windows logon script: regedit /s \\server\netlogon\reg\quicklaunch.reg ...
How Mozilla finds its configuration files - Archive of obsolete content
the value contained in this key is a litteral value, no variables (such as %userprofile%/mozprofile) allowed.
...you may use the following items: a program to convert registry.dat file into a readable (and editable) xml file.
How Thunderbird and Firefox find their configuration files - Archive of obsolete content
the value contained in this key is a litteral value, no variables (such as %userprofile%/mozprofile) allowed.
...you'd obtain a file such as the following: [general] startwithlastprofile=1 [profile0] name=default isrelative=0 path=h:\thunderbird a discussion about this file can be found here ...
Compiling The npruntime Sample Plugin in Visual Studio - Archive of obsolete content
build create a new project in visual studio for a win32 gui library (dll) (in .net 2003: win32 template, then switch to dll in application settings in the following dialog, export symbols too?)(in visual studio 2008, it is visualc++|win32|win32 project, then check dll in the wizard).
... add the following preprocessor definitions to project properties|(all configurations)|c++|preprocessor|preprocessor definitions: win32;_windows;xp_win32;xp_win;_x86_;npsimple_exports disable precompiled headers using project properties|(all configurations)|c++|precompiled headers|create/use precompiled header.
Getting Started - Archive of obsolete content
<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.
... the description shows up below the preview image.
Download Manager improvements in Firefox 3 - Archive of obsolete content
firefox 3 offers improvements to the download manager that allow multiple progress listeners, use of the storage api for data management, download resuming, and more.
... download manager interfaces nsidownloadmanager gives applications and extensions access to the download manager, allowing them to add and remove files to the download list, retrieve information about past and present downloads, and request notifications as to the progress of downloads.
Drag and Drop Example - Archive of obsolete content
this allows us to place the new element at the position where the mouse button was released.
...the final code is shown below: <window title="widget dragger" id="test-window" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <script src="chrome://global/content/nsdraganddrop.js"/> <script src="chrome://global/content/nstransferable.js"/> <script src="dragboard.js"/> <stack id="board" style="width:300px; height: 300px; max-width: 300px; max-heigh...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
oords="371,71,635,185" href="#nsdocumentopeninfo"> <area alt="necko" coords="721,113,821,157" href="#necko"> <area alt="nsuriloader" coords="23,335,215,455" href="#nsuriloader"> <area coords="227,515,485,575" href="#nsiuricontentlistener"> <area alt="nsdocshell" coords="47,83,203,153" href="#nsdocshell"></map> this block diagram is out of date as of january 2012 with regard to some minor control flow shuffling in nsuriloader.
... the prose description below has been updated.
Help Viewer - Archive of obsolete content
help viewer: allows information to be shown to the user inside mozilla.
... help viewer project page articles & tutorials creating a help content pack task-oriented, as opposed to spec-type stuff like the link below will be other resources content pack specification a technical description of it, meant primarily to solidify the idea of exactly what constitutes a content pack ...
Settings - Archive of obsolete content
the jetpack.storage.settings namespace allows jetpacks to specify user-configurable settings.
...with the above manifest the following stored properties are available in the jetpack's code: * jetpack.storage.settings.twitter.username * jetpack.storage.settings.twitter.password * jetpack.storage.settings.facebook.username * jetpack.storage.settings.facebook.password * jetpack.storage.settings.music * jetpack.storage.settings.volume see also simple storage jep 24 ...
Settings - Archive of obsolete content
the jetpack.storage.settings namespace allows jetpacks to specify user-configurable settings.
...with the above manifest the following stored properties are available in the jetpack's code: jetpack.storage.settings.twitter.username jetpack.storage.settings.twitter.password jetpack.storage.settings.facebook.username jetpack.storage.settings.facebook.password jetpack.storage.settings.music jetpack.storage.settings.volume ...
Metro browser chrome tests - Archive of obsolete content
the metro browser chrome test suite is an automated testing framework designed to allow testing of the immersive version of firefox for windows 8 and above using javascript.
... it currently allows you to run javascript code in the same scope as the immersive browser and report results using the same functions as the mochitest test framework.
Microsummary XML grammar reference - Archive of obsolete content
the following example identifies a generator as being able to summarize all pages on the www.example.com web site except pages named about.html: <pages> <include> ^http://www\.example\.com/ </include> <exclude>/about\.html</exclude> </pages> note: regular expressions intended to match the beginnings of page urls should start with the caret (^) to ensure they do not inadvertently match urls whi...
...firefox determines which interval to apply to a microsummary generated by a generator according to the following rules: firefox processes each <condition> child element in document order.
Microsummary topics - Archive of obsolete content
for example, the following code snippet installs the microsummary generator from the creating a microsummary tutorial: var generatortext = ' \ <?xml version="1.0" encoding="utf-8"?> \ <generator xmlns="http://www.mozilla.org/microsummaries/0.1" \ name="firefox download count" \ uri="urn:{835daeb3-6760-47fa-8f4f-8e4fdea1fb16}"> \ <template> \ <transform xmlns="http://www.w3.org/199...
...for example, you might include the following header in your response to prevent firefox from making another microsummary-related request for one hour: cache-control: max-age=3600 note: because of a technical limitation (bug 346820), firefox uses the same cache for both microsummary-related requests and user-initiated requests, so the cache headers you return apply to both.
Plug-n-Hack Phase1 - Archive of obsolete content
plug-n-hack (pnh) phase 1 allows easier integration and defines how security tools can advertise their capabilities to browsers.
...for testing); plug-n-hack requires tool and service manifests to be served from the same origin as the api endpoints but, for testing purposes, ringleader (the firefox addon implementation of the browser component) allows you to set a preference to relax or disable origin checks.
Plug-n-Hack Phase2 - Archive of obsolete content
the next phase of plug-n-hack (pnh) is still being planned but is intended to allow browsers to advertise their capabilities to security tools.
... this will allow the tools to obtain information directly from the browser, and even use the browser as an extension of the tool.
Bundles - Archive of obsolete content
this can slow the overall launch time and the unpacking is redundant if the bundle has been launched previously.
... web application bundle: create file called webapp.ini that contains something like: [parameters] id=unique-app-id@unique-author-id.whatever name=webapp name uri=http://[the-url-what-you-want-to-connect-to]/ status=yes location=no sidebar=no navigation=no zip the file to [whatever].webapp double-click the webapp bundle or use prism -webapp [path-to-webapp] structure a bundle can contain the following files.
Extensions - Archive of obsolete content
the basics in order to install an extension in prism, you need to follow the guidelines for building a mozilla-based extension.
...installing prism supports a basic add-on user interface which allows a user to manage extensions.
Prism - Archive of obsolete content
prism supports a simple styling system that allows the user to add css files to the webapp bundle.
... scripting prism allows for some client-side web application customization.
Priority Content - Archive of obsolete content
devedge devedge mirror note: if you're digging around the mirror and see anything there that you think should be migrated to devmo that isn't on this list, feel free to add it below.
...dependant on: updating dhtml web pages for next generation browsers on devedge the tune-up wizard (see below, in the wishlist section) mostly completed: popup window controls devedge article migrators: mathieu deaudelin there are inline examples on this page that cannot be migrated.
Hacking wiki - Archive of obsolete content
the contents of the <tt>trunk</tt> directory you just checked out is a slightly modified mediawiki install, so you can follow the mediawiki install instructions.
...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.
New Skin Notes - Archive of obsolete content
--callek is it possible to remove the blank space on category pages, like category:dom?by the way, it looks like this skin has the same problem as previous - the edit box, category list on category pages, and others are always below the end of the sidebar.
...just so that (perhaps) this might revive the topic, a side bar shouldn't exceed 16% to allow proper viewing at 800 pixels width ideally in my opinion, i find strange that i'm the only person not too fond of large side bars (or side bars at all, for that matter :) considering that in most articles we scroll down to read the text, and that the side bar scrolls as well, the links aren't there anymore, but the width remains wasted anyway.
Remote XUL - Archive of obsolete content
this also means you can't load xul using file:// urls unless you set the preference dom.allow_xul_xbl_for_file to true.
...the remote xul manager extension lets you manage this whitelist, which is maintained using nsipermissionmanager, by creating entries of type "allowxulxbl", like this: components.classes["@mozilla.org/permissionmanager;1"] .getservice(components.interfaces.nsipermissionmanager) .add(uri, 'allowxulxbl', components.interfaces.nsipermissionmanager.allow_action); see using remote xul.
Remotely debugging Firefox for Metro - Archive of obsolete content
set up firefox for metro go to about:config in firefox for metro, and set the following required preference: devtools.debugger.remote-enabled = true you may also want to set these optional preferences: devtools.debugger.force-local = false (if you want to connect from a different machine over the network) devtools.debugger.remote-host (to change the tcp hostname where firefox will listen for connections) devtools.debugger.remote-port (to change the tcp port number where...
... firefox will listen for connections) devtools.debugger.prompt-connection = false (allow connections without displaying a confirmation prompt.
Remote debugging - Archive of obsolete content
a good place to start is a detailed stack (in gdb, use bt followed by bt full).
...it allows you to see the crash in a debugger even after the program has long exited.
Safely loading URIs - Archive of obsolete content
to solve this problem, gecko provides methods that allow the caller to check whether it's safe to load a particular uri.
... 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.
Table Cellmap - Border Collapse - Archive of obsolete content
as one can see from the following illustration this is enough to cover a whole table.
...the following owners are possible: etableowner = 0, ecolgroupowner = 1, eajacolgroupowner = 2, // col group to the left ecolowner = 3, eajacolowner = 4, // col to the left erowgroupowner = 5, eajarowgroupowner = 6, // row group above erowowner = 7, eajarowowner = 8, // row above ecellowner = 9, eajacellowner = 10 // cell to the top or to the left the ownership is determined by the rules for border conflict resolution as defined in css 2.1 corner for the corner we store the corne...
Abc Assembler Tests - Archive of obsolete content
when run, the assembler tests include the abcasm/abs_helper.as file which defines the following functions: start(summary:string):void - start a new test section described by summary end():void - test section finished compare_stricteq(name:string, expected:*, actual:*):void - compare the results of a testcase where name is the testcase name compare_typeerror(name:string, expected:*, actual:*):void - special function for comparing typeerrors (runtimeerrors) - will only compare the first 22 chars of expecte...
...if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl.
Tamarin Acceptance Test Template - Archive of obsolete content
if you wish to allow use of your version of this file only * under the terms of either the gpl or the lgpl, and not to allow others to * use your version of this file under the terms of the mpl, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the gpl or the lgpl.
...addtestcase is a function that is defined * in shell.as and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * for example, a test might look like this: * * var helloworld = "hello world"; * * addtestcase( * "var helloworld = 'hello world'", // description of the test * "hello world", // expected result * helloworld ); // actual result * */ // add your tests here var helloworld = "hello world"; addtestcase( "var helloworld = 'hello world'", "hello world", helloworld ); test(); // leave this alone.
Tamarin Acceptance Testing - Archive of obsolete content
in order to ensure that changes to the tamarin code base are high quality before submitting, all developers are required to complete the following steps.
... successfully build release and debug versions of the shell with the debugger enabled [info] successfully run the following test suites: acceptance test suite [info] self tests [info] submit a sandbox build request to test against platforms that you may not have locally [info] available tamarin acceptance test suites actionscript acceptance tests: actionscript acceptance tests running tamarin acceptance tests abc assembler tests cmdline tests performance tests actionscript performance tests running tamarin performance tests built-in self tests see instructions in doc/selftest.html in the tamarin repository.
Using cross commit - Archive of obsolete content
cross-commit is a script that allows a single patch to be easily checked in on multiple branches.
... 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 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.
XML in Mozilla - Archive of obsolete content
mozilla may also make an exception with xhtml documents, see below.
...the code for most the core xml can be found in the following directories on the mozilla mercurial repository: content/xml/, parser/expat/ and parser/htmlparser/.
Install Wizards (aka: Stub Installers) - Archive of obsolete content
this saves low-bandwidth users considerable time since they do not need to download software packages they may not be interested in.
...to learn more about the three platform-specific versions of the stub installer follow the links below: unix stub installer mac stub installer windows stub installer what do we mean by xpistub?
dirCreate - Archive of obsolete content
method of file object syntax int dircreate( filespecobject dirtocreate ); parameters the dircreate method has the following parameters: dirtocreate a filespecobject representing the pathname of the directory to create.
...the following simple example demonstrates the use of the dircreate method.
diskSpaceAvailable - Archive of obsolete content
method of file object syntax double diskspaceavailable ( string nativefolderpath ); parameters the diskspaceavailable method has the following parameters: nativefolderpath a string representing the pathname of the partition, a file, or a directory on the partition whose space is being queried.
...description use this function to make sure there is adequate space on the local disk for extracting and installing your files (see example below).
modDateChanged - Archive of obsolete content
method of file object syntax boolean moddatechanged (filespecobject asourcefolder, number anolddate); parameters the moddatechanged method has the following parameters: asourcefolder a filespecobject representing the file to be queried.
... 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.
confirm - Archive of obsolete content
the following examples show the result of calling confirm() with three buttons 0='a', 1='b' and 2='c'.
... firefox on linux mozilla application suite on win32 it is therefore recommended to only use two buttons wherever possible, and to keep in mind that button 1 has the same return value as "window closed" (see below).
getFolder - Archive of obsolete content
method of install object syntax filespecobject getfolder ( string foldername); filespecobject getfolder ( string foldername, string subdirectory); filespecobject getfolder ( object localdirspec, string subdirectory); parameters the getfolder method has the following parameters: foldername a string representing one of netscape's standard directories.
...the value of foldername must be one of the following (info is based on mozilla 1.7 stable branch, might also work in other versions): "chrome" "components" "current user" "defaults" "file:///" "os drive" "plugins" "preferences" "profile" "program" "temporary" "mac apple menu" "ma...
getLastError - Archive of obsolete content
this method allows you to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call.
...example the following example calls getlasterror after a series of addfile calls: addfile("npplug", ...); addfile("/ms/shared/ctl3d.dll", ...); addfile("/nethelp/royalplug/royalhelp.html",...); err = getlasterror(); ...
refreshPlugins - Archive of obsolete content
method of install object syntax int refreshplugins( [ areloadpages ] ); parameters the refreshplugins method has the following parameter: areloadpages areloadpages is an optional boolean value indicating whether you want to reload the open web pages after you have refreshed the plug-in list.
...when you use this method in an installation script, as the example below demonstrates, you can install new plug-ins and use them to display the requested media in a web page without interrupting the experience of the user.
registerChrome - Archive of obsolete content
method of install object syntax int registerchrome( switch, srcdir, xpipath); parameters the registerchrome method has the following parameters: switch switch is the chrome switch indicating what type of file is being registered.
... note that you can combine switches as in the example below.
enumKeys - Archive of obsolete content
method of winreg object syntax string enumkeys ( string key, int subkeyindex ); parameters the enumkeys method has the following parameters: key the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
...the following example shows how to use enumkeys to find the plugins subdirectory below the various mozilla-based browser installations.
enumValueNames - Archive of obsolete content
method of winreg object syntax string enumvaluenames ( string key, int subkeyindex ); parameters the enumvaluenames method has the following parameters: key the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
...the following brief example retrieves a key value using this method.
buttons - Archive of obsolete content
« xul reference home buttons type: comma-separated list of the values below a comma-separated list of buttons to appear in the dialog box.
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
collapse - Archive of obsolete content
« xul reference home collapse type: one of the values below determines which side of the splitter is collapsed when its grippy is clicked.
... both either the element immediately before the splitter, or the element immediately after the splitter can be collapsed, if the size of that element would fall below the minimum size due to the position of the splitter.
crop - Archive of obsolete content
ArchiveMozillaXULAttributecrop
« xul reference home crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } ...
dlgtype - Archive of obsolete content
« xul reference home dlgtype type: one of the values below the dialog type of the button, used only when the button is in a dialog box.
...the following values can be used as the dialog type: accept the ok button, which will accept the changes when pressed.
drawintitlebar - Archive of obsolete content
« xul reference home drawintitlebar type: boolean if this attribute is true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar.
... this allows the window to draw in the title bar.
onchange - Archive of obsolete content
a change event is fired in different ways for different xul input elements as listed below: onchange type: script code textbox when enter key is pressed radio/check box when the state is changed select list when the selected item is changed what is accessible the script context at this point can only access the following things: global values/functions i.e.
... the window object event object example <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="text/javascript"> function myfunction(e){ /* do something cool here or just say the below */ alert(e.target.nodename); } </script> <textbox id="find-text" onchange="return myfunction(event);"/> </window> ...
panel.fade - Archive of obsolete content
« xul reference homefadetype: one of the values belowthe fade attribute, which may only be used with arrow panels, lets you set up a panel that will automatically fade away after a short time.
... nonethe panels doesn't automatically fade away.slowthe panels slowly fades away after a short time.fastthe panels quickly fades away after a short time.
popupalign - Archive of obsolete content
« xul reference homepopupaligntype: one of the values belowpopupalign is an optional attribute for specifying which side of the popup content should be attached to the popupanchor.
...the example below shows how to create the traditional buttons with attached left mouse menus that exist in the 4.x communicator product.
seltype - Archive of obsolete content
« xul reference home seltype type: one of the values below used to indicate whether multiple selection is allowed.
...(default in tree.) for trees, you can also use the following values: cell individual cells can be selected text rows are selected; however, the selection highlight appears only over the text of the primary column.
sizemode - Archive of obsolete content
« xul reference home sizemode type: one of the values below the state of the window.
... it can have one of the following values: maximized the window is maximized, and occupies the full size of the screen.
validate - Archive of obsolete content
« xul reference home validate type: one of the values below this attribute indicates whether to load the image from the cache or not.
...the following values are accepted, or leave out the attribute entirely for default handling: always the image is always checked to see whether it should be reloaded.
width - Archive of obsolete content
<hbox> <hbox width="40" style="background-color: red;"> <label value="40"/> </hbox> </hbox> however, in the following example, despite that the preferred width of the box is 30 pixels, the displayed size of the box will be larger to accommodate the larger label.
... <vbox width="30" align="start" style="background-color: red;"> <label value="vbox xul width 10px red"/> </vbox> note: when used on treecol objects, the width attribute can be used to allow a tree to be scrolled horizontally if the column widths add up to be wider than the containing object.
Getting File Information - Archive of obsolete content
for instance, the following line will set the length of a file to 5000 bytes.
...the following four methods return true or false: nsifile.isreadable() - returns true if the file can be read from.
Uploading and Downloading Files - Archive of obsolete content
http file upload some web sites allow one to upload a file.
...this is simpler but it doesn't allow sending additional data and web servers usually need special configuration to support put operations.
International characters in XUL JavaScript - Archive of obsolete content
unicode escapes, as discussed below, have always worked.
...however, you can use unicode escapes – the earlier example rewritten using them would be: var text = "ein sch\u00f6nes beispiel eines mehrsprachigen textes: \u65e5\u672c\u8a9e"; an alternative might be to use property files via nsistringbundle or the xul <stringbundle> element; this would allow for localization of the xul.
List of commands - Archive of obsolete content
the following lists commands which might be usable by <command> or command dispatchers/controllers.
...evious 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.org/seamonkey/sou...toroverlay.xul http://lxr.mozilla.org/seamonkey/sou...onaltoolbar.js http://lxr.mozilla.org/seamonke...
addTab - Archive of obsolete content
ArchiveMozillaXULMethodaddTab
« xul reference home addtab( url, referreruri, charset, postdata, owner, allowthirdpartyfixup ) addtab( url, {referreruri: ..., charset: ..., postdata: ..., owner: ..., allowthirdpartyfixup: ..., relatedtocurrent: ...
... firefox 3.6 note the second form of this method was added in firefox 3.6; it allows you to specify the parameters by name, in any order.
appendNotification - Archive of obsolete content
priority levels (defined as properties of notificationbox) : priority_info_low priority_info_medium priority_info_high priority_warning_low priority_warning_medium priority_warning_high priority_critical_low priority_critical_medium priority_critical_high priority_critical_block buttons : the buttons argument is an array of button descriptions.
... each description is an object with the following properties: accesskey - the accesskey to appear on the button callback - function to be called when the button is activated.
Namespaces - Archive of obsolete content
it holds and allows disambiguation of items having the same name." if you are familiar with c++ namespaces, java packages, perl packages, or python module importing, you are already familiar with the namespace concept.
...here's a question: what namespace contains the element foo in the xml document below?
Floating Panels - Archive of obsolete content
a floating panel can be created using the panel element with at least two additional attributes as in the following example: <panel id="tools-panel" noautohide="true" titlebar="normal"> <label control="name" value="name:"/> <textbox id="name"/> </panel> the noautohide attribute is used to indicate that the panel is not temporary.
...a label for the titlebar may be set using the label attribute, as in the following example: <panel id="info-panel" noautohide="true" titlebar="normal" label="image properties"> closing a floating panel unlike other panels, a floating panel does not close when clicking outside of it.
MenuButtons - Archive of obsolete content
for instance, in the following example, pressing the 'view' button will open a menu which allows the user to select from a set of radio menuitems.
...in the example below a toolbarbutton with an image has a menu associated with it.
MenuModification - Archive of obsolete content
both the appenditem and insertitemat methods return the new menuitem, so you can further modify it, for instance to add an access key, as in the following example: var item = menu.appenditem("insert", "insert"); item.accesskey = "i"; appending submenus there is no built-in method to append submenus to a menu.
...the following shows how the addsubmenu function above might be rewritten to handle this case.
Tooltips - Archive of obsolete content
for example, in the following, a toolbar has a tooltip set for it.
...elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text inside it.
buttons - Archive of obsolete content
« xul reference buttons type: comma-separated list of the values below a comma-separated list of buttons to appear on the dialog box.
...the following values can be used in the list: accept: the ok button, which will accept the changes when pressed.
Bindings - Archive of obsolete content
the syntax is as follows: <template> <query> ...
...this allows a match to occur even if the description is not specified.
Filtering - Archive of obsolete content
a menulist is used to allow one to select either a specific country, or select all to show all of the photos.
...only the contents at the element with the uri attribute and below are copied for each result.
Rule Compilation - Archive of obsolete content
for instance, consider the example below: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a" hidden="true"> <template> ...
...for example, just calling the code like the following on the hidden vbox above will start off the template builder.
Template Builder Interface - Archive of obsolete content
this is also allowed.
...a common pattern is to use the following: var rdf = components.classes["@mozilla.org/rdf/rdf-service;1"].
XML Assignments - Archive of obsolete content
this element allows the use of additional xpath expressions to get more data from the xml data.
...it allows us to declare additional variables that may be used in the action body.
Things I've tried to do with XUL - Archive of obsolete content
(to add insult, xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox.
...:) silver: if you set height="0" and include "overflow: hidden" on each box that is sharing the space, current gecko will quite happily split the space out according to flex, ignoring the contents of each box, as desired.
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
see below for the list of common palette ids.
...the dimensions of the icons in various applications for both modes are summarized in the following table (feel free to add information about other applications): application (theme name) big icon size small icon size firefox 1.0 (winstripe) 24x24 16x16 thunderbird 1.0 (qute) 24x24 16x16 the stylesheet to set the image for your toolbar button, use the following css rules: /* skin/toolbar-button.css */ #myextension-button { list-style...
Complete - Archive of obsolete content
this page is for readers who have followed the custom toolbar button tutorial for firefox, thunderbird and sunbird, or the custom toolbar button:seamonkey tutorial for seamonkey, and who want to learn more about developing extensions.
...the following sections describe this extension's overall structure, and how it implements languages and themes.
Additional Install Features - Archive of obsolete content
the following code will make a copy of the file "/bin/grep" and put it in the directory "/main".
...for example, you might put the following as the last section of your script: if (getlasterror() == success) { performinstall(); } else { cancelinstall(); } error codes that could be returned by getlasterror() are listed in the mozilla source file nsinstall.h.
Box Model Details - Archive of obsolete content
the following is an outline of both types of boxes: horizontal boxes lay out their elements next to each other horizontally.
...just below the check box is a spacer.
Creating Dialogs - Archive of obsolete content
the following values may be used, seperated by commas: accept - an ok button cancel - a cancel button help - a help button disclosure - a disclosure button, which is used for showing more information you can set code to execute when the buttons are pressed using the ondialogaccept, ondialogcancel, ondialoghelp and ondialogdisclosure attributes.
...<script> function dosave(){ //dosomething() return true; } function docancel(){ return true; } </script> <dialogheader title="my dialog" description="example dialog"/> <groupbox flex="1"> <caption label="select favourite fruit"/> <radio id="orange" label="oranges because they are fruity"/> <radio id="violet" selected="true" label="strawberries because of their colour"/> <radio id="yellow" label="bananas because they are pre-packaged"/> </groupbox> </dialog> the buttons elements can be accessed with the following javascript // the accept button var acceptbutt = document.documentelement.getbutton("accept") more examples more examples in dialogs and prompts (code snippets).
Creating an Installer - Archive of obsolete content
these are described step by step below.
... our find files example for the find files dialog, we'll create a structure in the archive much like the following: install.js findfile content contents.rdf findfile.xul findfile.js skin contents.rdf findfile.css locale contents.rdf findfile.dtd a directory has been added for each part of the package, the content, the skin and the locale.
Features of a Window - Archive of obsolete content
other window features the flags below can be passed as part of the third argument to the window.open function.
... alwayslowered the window will always appear behind other windows.
Grids - Archive of obsolete content
ArchiveMozillaXULTutorialGrids
however, the grid allows either row or column based organization so you may put content in either rows or in columns.
...the following example demonstrates this: example 4 : source view <grid flex="1"> <columns> <column flex="5"/> <column/> <column/> </columns> <rows> <row flex="10"> <button label="cherry"/> <button label="lemon"/> <button label="grape"/> </row> <row flex="1"> <button label="strawberry"/> <button label="raspberry"/> <button label="peach"/> </row> </rows> </grid> t...
Introduction to XBL - Archive of obsolete content
the following example shows the basic skeleton of an xbl file: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl"> <binding id="binding1"> <!-- content, property, method and event descriptions go here --> </binding> <binding id="binding2"> <!-- content, property, method and event descriptions go here --> </binding> </bindings> the bindings element is the root element of an x...
...the following example demonstrates this.
Progress Meters - Archive of obsolete content
determinate progress meter: indeterminate progress meter: the progress meter has the following syntax: <html:progress id="identifier" mode="determined" value="50" max="100"/> the attributes are as follows: id the unique identifer of the progress meter mode the type of the progress meter.
...do this by adding the below line to your opening window tag in the findfile.xul.
Property Files - Archive of obsolete content
an example is shown below: notfoundalert=no files were found matching the criteria.
...var dir = "/usr/local/document"; var count = 10; var strbundle = document.getelementbyid("strings"); var result = strbundle.getformattedstring("resultmessage", [ dir, count ]); alert(result); this example will display following message in an alert box.
Scrolling Menus - Archive of obsolete content
mozilla will provide a scrolling mechanism that will allow you to scroll through the items.
...example - scrolling list of buttons the following example shows how to create a scrolling list of buttons (you will need to resize the window to see the arrow buttons): example 1 : source view <arrowscrollbox orient="vertical" flex="1"> <button label="red"/> <button label="blue"/> <button label="green"/> <button label="yellow"/> <button label="orange"/> <button label="silver"/> <button label="lavender"/> <button label="gold"/>...
XUL Coding Style Guidelines - Archive of obsolete content
xml, xul, html, and xhtml guidelines the following are considered good coding style for xml/xul documents.
...to prevent them from being localized, you may insert a line of comment following the xml declaration as follows.
assign - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
bbox - Archive of obsolete content
ArchiveMozillaXULbbox
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, to...
...p, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbyt...
binding - Archive of obsolete content
properties object, predicate, subject examples fixme: (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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlisten...
bindings - Archive of obsolete content
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, sortd...
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
box - Archive of obsolete content
ArchiveMozillaXULbox
examples <box orient="horizontal"> <label value="zero"/> <box orient="vertical"> <label value="one"/> <label value="two"/> </box> <box orient="horizontal"> <label value="three"/> <label value="four"/> </box> </box> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
broadcaster - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
broadcasterset - Archive of obsolete content
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, temp...
...late, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelement...
caption - Archive of obsolete content
crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute.
...for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } image type: uri the uri of the image to appear on the element.
column - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
columns - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
commandset - Archive of obsolete content
valid events are listed below, or you can use your own events.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
conditions - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
deck - Archive of obsolete content
ArchiveMozillaXULdeck
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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
dropmarker - Archive of obsolete content
examples properties accessibletype attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
grid - Archive of obsolete content
ArchiveMozillaXULgrid
<textbox id="user"/> </row> <row> <label value="group"/> <menulist> <menupopup> <menuitem label="accounts"/> <menuitem label="sales" selected="true"/> <menuitem label="support"/> </menupopup> </menulist> </row> </rows> </grid> </groupbox> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
grippy - Archive of obsolete content
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, styl...
...e, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, get...
groupbox - Archive of obsolete content
properties accessibletype examples <groupbox> <caption label="settings"/> <radiogroup> <radio label="black and white"/> <radio label="colour"/> </radiogroup> <checkbox label="enabled"/> </groupbox> 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
hbox - Archive of obsolete content
ArchiveMozillaXULhbox
example <!-- two button on the right --> <hbox> <spacer flex="1"/> <button label="connect"/> <button label="ping"/> </hbox> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
listcol - Archive of obsolete content
ox> <listhead> <listheader label="first"/> <listheader label="last"/> </listhead> <listcols> <listcol flex="1"/> <listcol/> </listcols> <listitem> <listcell label="buck"/> <listcell label="rogers"/> </listitem> <listitem> <listcell label="john"/> <listcell label="painter"/> </listitem> </listbox> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
listcols - Archive of obsolete content
example <!-- creates a two column listbox --> <listbox> <listcols> <listcol flex="1"/> <listcol flex="1"/> </listcols> <listitem> <listcell label="buck"/> <listcell label="rogers"/> </listitem> <listitem> <listcell label="john"/> <listcell label="painter"/> </listitem> </listbox> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
member - Archive of obsolete content
properties child, container 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
notification - Archive of obsolete content
type type: one of the values below indicates the type of notification, determined from the priority.
... value type: string the string attribute allows you to associate a data value with an element.
observes - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
page - Archive of obsolete content
ArchiveMozillaXULpage
examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width ...
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagna...
popupset - Archive of obsolete content
examples <popupset> <menupopup id="clipmenu"> <menuitem label="cut"/> <menuitem label="copy"/> <menuitem label="paste"/> </menupopup> </popupset> <label value="right click for popup" context="clipmenu"/> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
prefpane - Archive of obsolete content
using multiple prefpanes note that when using multiple prefpanes in the same prefwindow, you must not put the <script> elements above the prefpane elements, but instead below them.
...place the <script> tags as in the following example for preference dialogs to work correctly: <prefwindow> <prefpane id="panegeneral" label="general"> ...
query - Archive of obsolete content
ArchiveMozillaXULquery
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
queryset - Archive of obsolete content
attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties in...
...herited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), getfeature, get...
richlistitem - Archive of obsolete content
the disabled attribute is allowed only for form controls.
... value type: string the string attribute allows you to associate a data value with an element.
row - Archive of obsolete content
ArchiveMozillaXULrow
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
script - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
scrollbar - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] when a container's contents which are larger that the size of the container, scroll bars may be placed at the side of the container to allow the user to scroll around in the container.
... properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
scrollcorner - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width pro...
...perties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getelementsbytagnamens(), ...
spacer - Archive of obsolete content
examples <box> <button label="left"/> <spacer flex="1"/> <button label="right"/> </box> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
spinbuttons - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
stack - Archive of obsolete content
ArchiveMozillaXULstack
--> </hbox> </stack> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
statusbar - Archive of obsolete content
properties accessibletype examples <statusbar> <statusbarpanel label="left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus...
stringbundle - Archive of obsolete content
for example, the following defines two properties: message.displayerror=an error occured trying to display this message message.namealreadyused=the name %s is already being used by another account.
... 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, sortd...
tabpanel - Archive of obsolete content
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, st...
...atustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyat...
template - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
textnode - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbargrippy - Archive of obsolete content
properties accessible 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute...
toolbaritem - Archive of obsolete content
s" selected="true"/> <menuitem label="train"/> </menupopup> </menulist> </toolbaritem> <toolbaritem id="sample-toolbutton-unified"> <toolbarbutton id="myext-button1" class="toolbarbutton-1" label="label1" /> <toolbarbutton id="myext-button2" class="toolbarbutton-1" label="labe2l" /> </toolbaritem> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbarpalette - Archive of obsolete content
examples <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="toolbarpalette-button" class="toolbarbutton-class" label="&mylabel;" tooltiptext="&mytiptext;" oncommand="somefunction()"/> </toolbarpalette> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
toolbarseparator - Archive of obsolete content
properties accessibletype examples <toolbox> <toolbar> <toolbarbutton label="button 1"/> <toolbarseparator /> <toolbarbutton label="button 2"/> </toolbar> </toolbox> 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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus,...
toolbarset - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait...
...-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclassname(), getelementsbytagname(), getele...
toolbarspacer - Archive of obsolete content
properties accessibletype examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties ...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattr...
toolbarspring - Archive of obsolete content
properties accessibletype examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width p...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), gete...
treechildren - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
treecols - Archive of obsolete content
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, sortd...
... inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, f...
treerow - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
treeseparator - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
triple - Archive of obsolete content
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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
vbox - Archive of obsolete content
ArchiveMozillaXULvbox
example <!-- two labels at bottom --> <vbox> <spacer flex="1"/> <label value="one"/> <label value="two"/> </vbox> 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, sortd...
...irection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects()...
Building XULRunner - Archive of obsolete content
please read and follow the general build documentation for instructions on how to get sources and set up build prerequisites.
... 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.
Using SOAP in XULRunner 1.9 - Archive of obsolete content
after some experimentation, the following seems to be the best way to speak soap in xulrunner.
...(there is a diff below.) you'll need: sasoapclient.js saxmlutils.js making a soap call var url = 'http://example.com/soap/'; var ns = 'http://example.com/soap/namespace'; var method = 'foo'; var params = { 'foo': 'bar', 'baz': 'bang' }; var callback = function(obj) { components.utils.reporterror(obj.tosource()); }; soapclient.proxy = url; var body = new soapobject(method); body.ns = ns; for (var k in par...
What XULRunner Provides - Archive of obsolete content
the following features are either already implemented or planned: gecko features xpcom networking gecko rendering engine dom editing and transaction support (no ui) cryptography xbl (xbl2 planned) xul svg xslt xml extras (xmlhttprequest, domparser, etc.) web services (soap) auto-update support (not yet complete) type ahead find toolbar history implementation (the places implementation in the 1.9 cycle) accessibility support ipc services for communication between gecko-based apps (not yet complete) storage/sqlite interfaces user interface features the following user interface is supplied by xu...
... extension manager file picker (uses native os filepicker as appropriate) find toolbar helper app dialog/ui security ui (maintenance of ssl keychains, etc) embedding apis the following embedding apis are provided by xulrunner: cross-platform embedding (xre_initembedding) javaxpcom embedding gtkmozembed (linux only) activex control (windows only) (not yet complete) obsolete since gecko 7.0 nsview-based-widget (mac os x only) (not yet complete) the "maybe" list the following features have been discussed and may be included if developer time permits and code size is controlled...
calICalendarViewController - Archive of obsolete content
implementing a calicalendarviewcontroller allows for these actions to be performed in a manner consistent with the rest of the application in which the calicalendarview is included.
...otherwise, a dialog should be display allowing the user to modify the fields.
2006-10-27 - Archive of obsolete content
these were the following choices stated: search the filesystem for unneeded files delete or archive them, add a hard disk, move all or part of the concerned filesystem there move that tinderbox to a different machine with more empty disk space on october 23rd: nick responded to gavin and tony's posting.
...the following is his configuration script that he used to build firefox 2 on solaris.
2006-11-24 - Archive of obsolete content
he is using make 3.80, working with the source tarball for xulrunner 1.8.4,running "make -f client.mk distclean" followed by "make -f client.mk build_all".
...he is receiving the following error: error: uncaught exception: [exception...
2006-10-06 - Archive of obsolete content
preed followed up and said that the checker was run and "build is go for launch".
...dbaron then follows up that bug 354835 is solved so there is no need to close the tree waiting for it.
2006-11-10 - Archive of obsolete content
william vanderpol asks, regarding remote xul applications, if is it possible (or does it exist?) to have an extension that will allow chrome access to certain specified url's?
...benjamin smedberg has been "working on some xptcall refactoring which will allow us to expose xptcall via a frozen api (and c linkage)".
JS-Engine FAQ - Archive of obsolete content
to write wrappers in pure javascript to interface with any c library on the system there are mechanisms such as xpcshell, wxjs, jsdb, jsni coding spidermonkey in c check out this tutorial how to compile tamarin on linux/x86 there is a patch that allows you to compile it.
... rhino what is the performance between rhino js and native java rhino js is significantly slower in run-time than native java.
Monitoring plugins - Archive of obsolete content
below are a number of javascript snippets that would be useful to developers trying to use this feature: registration to register for runtime notifications with the observer service you must create a class with an observe method which receives 3 parameters (subject, topic and data) as well as a register method that contains the following code: var observerservice = components.classes["@mozilla.org...
... clean up to unregister your class with the observer service - when you no longer want to be listening to runtime notifications - your class must include an unregister method that contains the following code: var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.removeobserver(this, "experimental-notify-plugin-call"); skeleton observer class below is a skeleton class that you may use to listen to runtime notifications: function pluginobserver() { this.registered...
NPN_GetAuthenticationInfo - Archive of obsolete content
st, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); parameters this function has the following parameters: instance pointer to the current plug-in instance protocol protocol name (uri scheme) host host name port port number scheme http authentication scheme name realm http authentication realm username out parameter.
...this function allows the plugin to ask the browser for http authentication information for a domain.
NPN_GetURLNotify - Archive of obsolete content
syntax #include <npapi.h> nperror npn_geturlnotify(npp instance, const char* url, const char* target, void* notifydata); parameters the function has the following parameters: instance pointer to the current plug-in instance.
... notifydata plug-in-private value for associating the request with the subsequent npp_urlnotify() call, which passes this value (see description below).
NPN_GetValue - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary allows the plug-in to query the browser for information.
... syntax #include <npapi.h> nperror npn_getvalue(npp instance, npnvariable variable, void *value); parameters this function has the following parameters: instance pointer to the current plug-in instance.
NPN_GetValueForURL - Archive of obsolete content
syntax #include <npapi.h> typedef enum { npnurlvcookie = 501, npnurlvproxy } npnurlvariable; nperror npn_getvalueforurl(npp instance, npnurlvariable variable, const char *url, char **value, uint32_t *len); parameters this function has the following parameters: instance pointer to the current plug-in instance.
... description this entry point is designed to allow plugins which implement their own http stacks to form requests to the web server in the same way the browser does.
NPN_MemAlloc - Archive of obsolete content
syntax #include <npapi.h> void *npn_memalloc (uint32 size); parameters the function has the following parameters: size size of memory, in bytes, to allocate in the browser's memory space.
...since the browser and plug-ins share the same memory space, npn_memalloc allows plug-ins to take advantage of any customized memory allocation scheme the application may have, and allows the application to manage its memory more flexibly and efficiently.
NPN_PostURL - Archive of obsolete content
syntax #include <npapi.h> nperror npn_posturl(npp instance, const char *url, const char *target, uint32 len, const char *buf, npbool file); parameters the function has the following parameters: instance pointer to the current plug-in instance.
...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.
NPN_PostURLNotify - Archive of obsolete content
syntax #include <npapi.h> nperror npn_posturlnotify(npp instance, const char* url, const char* target, uint32 len, const char* buf, npbool file, void* notifydata); parameters the function has the following parameters: instance current plug-in instance, specified by the plug-in.
... notifydata plug-in-private value for associating the request with the subsequent npp_urlnotify call, which returns this value (see description below).
NPN_SetValue - Archive of obsolete content
syntax #include <npapi.h> nperror npn_setvalue(npp instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance setting the variable.
...the browser code reads this parameter as follows (nppvpluginwindowbool as an example): nperror np_export _setvalue(npp npp, nppvariable variable, void *value) { ...
NPP_GetValue - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary allows the browser to query the plug-in for information.
... syntax #include <npapi.h> nperror npp_getvalue(void *instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the plugin instance from which the value should come.
NPP_NewStream - Archive of obsolete content
syntax #include <npapi.h> nperror npp_newstream(npp instance, npmimetype type, npstream* stream, npbool seekable, uint16* stype); parameters the function has the following parameters: instance pointer to current plug-in instance.
...this mode allows the plug-in full random access to the data using platform-specific file operations.
NPStream - Archive of obsolete content
syntax typedef struct _npstream { void* pdata; /* plug-in private data */ void* ndata; /* netscape private data */ const char* url; uint32 end; uint32 lastmodified; void* notifydata; const char *headers; } npstream; fields the data structure has the following fields: plug-in-private value that the plug-in can use to store a pointer to private data associated with the instance; not modified by the browser.
...lines are terminated by newline characters ("\n"), and the headers are terminated by a newline followed by null ("\n\0").
NPWindow - Archive of obsolete content
32_t y; /* relative to a netscape page */ uint32_t width; /* maximum window size */ uint32_t height; nprect cliprect; /* clipping rectangle coordinates */ #ifdef xp_unix void * ws_info; /* platform-dependent additional data */ #endif /* xp_unix */ npwindowtype type; /* window or drawable target */ } npwindow; fields the data structure has the following fields: window platform-specific handle to a native window element in the netscape window hierarchy on windows (hwnd) and unix (x window id).
...the window field holds a platform-specific handle to a drawable or an off-screen pixmap, as follows: windows: hdc mac os: pointer to np_port structure unix/x11: not used.
NP_GetValue - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary allows the browser to query the plug-in for information.
... syntax #include <npapi.h> nperror np_getvalue(void *instance, nppvariable variable, void *value); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NP_Port - Archive of obsolete content
syntax typedef struct np_port { cgrafptr port; /* grafport */ int32 portx; /* position inside the topmost window */ int32 porty; } np_port; fields the data structure has the following fields: port standard mac os port into which the plug-in should draw.
...since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: draw only within the area designated by the npwindow.
Why Well-Formed Web RSS Module is Popular - Syndicating Your Comments - Archive of obsolete content
there aren't many blogs out there that don't allow commenting of blog posts.
... an example using the most popular element of the well-formed web rss module is shown below: <?xml version="1.0"> <rss version="2.0" xmlns:wfw="http://wellformedweb.org/commentapi/" > <channel> <title>example</title> <description>an rss example with wfw</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>i like root beer</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:article:54321...
Version - Archive of obsolete content
the list below is of all known rss versions.
... note: in the list below, although rss 1.0 seems to be out of place, it is actually in the correct place chronologically.
NSPR Release Engineering Guide - Archive of obsolete content
nspr generally follows the iplanet product lifecycle.
...ase candidate checkout a whole new tree using tag (including fixes) tag the treey with nsprpub_release_x_y_z build all targets, debug and optimized on all platforms using the command: gmake release mdist=<dir>/mdist build_number=vx.y.z [build_opt=1 | use_debug_rtl=1] copy the bits from mdist to /share/builds/components/nspr20/.vx.y.z in /share/builds/components/nspr20/ run the following scripts: explode.pl rename.sh symlink.sh rtm bits rename the .vx.y.z directory to vx.y.z (remove the hidden directory 'dot').
SSL and TLS - Archive of obsolete content
the handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows.
... supported cipher suites for rsa cipher suites with the rsa key exchange that are commonly supported include the following: aes and sha message authentication.
Vulnerabilities - Archive of obsolete content
these categories are described below.
...another example is a race condition error that allows the attacker to perform a specific action with elevated privileges.
Sunbird Theme Tutorial - Archive of obsolete content
note: if the <tt>extensions</tt> directory is empty, you are in the wrong place—start again and follow the instructions more carefully.
... fixing bug 320823 if you are using the sunbird 0.3a1 release, or a test build before 2005-12-21, then you must apply a fix for bug 320823 to allow sunbird to use themes.
Create Your Own Firefox Background Theme - Archive of obsolete content
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.
...duplicate names are not allowed, so you may need to try a few times to find a unique name.
Theme changes in Firefox 4 - Archive of obsolete content
default values of the iconsize attribute on browser toolbars if the theme doesn't override the value of the iconsize attribute, the following defaults are used: toolbar element id default iconsize value menu bar #toolbar-menubar small navigation bar #nav-bar small or large depending on user preference.
...finally, you need to create a chrome.manifest file with the contents: skin browser classic/1.0 chrome/browser/ skin communicator classic/1.0 chrome/communicator/ skin global classic/1.0 chrome/global/ skin mozapps classic/1.0 chrome/mozapps/ this results in the following structure : /my_theme/chrome/browser/* /my_theme/chrome/communicator/* /my_theme/chrome/global/* /my_theme/chrome/mozapps/* /my_theme/chrome.manifest /my_theme/icon.png /my_theme/install.rdf /my_theme/preview.png note: for more information (and how to package into a jar) consult creating a skin for firefox which still mostly applies.
Scratchpad - Archive of obsolete content
it is also possible to use scratchpad over pages opened from a local file system, if permission policies allow that.
...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.
-ms-hyphenate-limit-lines - Archive of obsolete content
in the flow above the consecutive hyphenated lines limit would be an infinitely large positive number.
...(hyphenation is effectively disabled.) negative values are not allowed.
-ms-scroll-chaining - Archive of obsolete content
formal syntax chained | none examples the following example illustrates the -ms-scroll-chaining property in use.
... .imagecontainer { -ms-scroll-chaining: chained; -ms-overflow-style: none; -ms-content-zooming: zoom; -ms-scroll-rails: none; -ms-content-zoom-limit-min: 100%; -ms-content-zoom-limit-max: 500%; -ms-scroll-snap-type: proximity; -ms-scroll-snap-points-x: snaplist(100%, 200%, 300%, 400%, 500%); -ms-overflow-style: none; width: 480px; height: 270px; overflow: auto; } specifications not part of any specification.
-ms-scroll-snap-x - Archive of obsolete content
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.
...the two selectors in the following example have the same effect.
-ms-scroll-snap-y - Archive of obsolete content
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.
...the two selectors in the following example have the same effect.
-ms-scrollbar-base-color - Archive of obsolete content
div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; } .aquascroll { scrollbar-base-color: aqua; scrollbar-arrow-color: blue; border-color: blue; } .bisquescroll { scrollbar-base-color: bisque; scrollbar-arrow-color: red; border-color: red; } <body> <div class="aquascroll"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh eu...
... </div> </body> the following image shows the result.
-ms-scrollbar-track-color - Archive of obsolete content
div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; } .bluescroll { -ms-scrollbar-highlight-color: aqua; -ms-scrollbar-face-color: blue; -ms-scrollbar-arrow-color: blue; border-color: blue; } .redscroll { -ms-scrollbar-highlight-color: bisque; -ms-scrollbar-face-color: red; -ms-scrollbar-arrow-color: red; border-color: red; } <body> <div class="bluescr...
... </div> </body> the following image shows the result.
-ms-wrap-through - Archive of obsolete content
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-browse - Archive of obsolete content
permitted properties only the following css properties can be used in a rule with ::-ms-browse in its selector.
...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-browse { color: red; background-color: yellow; } result output example specifications not part of any specification.
::-ms-check - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-check in its selector.
...*/ } result below is an example for you to try.
::-ms-clear - Archive of obsolete content
such inputs include: <input type="color"> <input type="date"> <input type="datetime"> <input type="datetime-local"> <input type="email"> <input type="month"> <input type="number"> <input type="search"> <input type="tel"> <input type="time"> <input type="url"> <input type="week"> allowable properties only the following css properties can be used in a rule with ::-ms-clear in its selector.
...*/ /* the cross can be hidden by setting the display attribute as "none" */ } result the following screenshot shows what the feature will look like: specifications not part of any specification.
::-ms-fill-upper - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-fill-upper in its selector.
... see also ::-ms-fill-lower ::-ms-track ::-ms-thumb ::-moz-range-progress css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
::-ms-thumb - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-thumb in its selector.
... see also ::-ms-track ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-thumb ::-moz-range-thumb css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
::-ms-track - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-track in its selector.
...tyle 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-thumb ::-ms-fill-upper ::-ms-fill-lower ::-webkit-slider-runnable-track ::-moz-range-track css-tricks: styling cross-browser compatible range inputs with css quirksmode: styling and scripting sliders ...
Displaying notifications (deprecated) - Archive of obsolete content
creating a notification the first thing you need to do is create the notification object by using the navigator.moznotification object's createnotification() method, as follows: var notification = navigator.moznotification.createnotification( "hey, check this out!", "this is a notification posted by " + "firefox 4.
...figured the way you want it to be, call its show() method to display the notification: notification.show(); on android, for example, the resulting notification panel looks like this: when the user taps on the "hey, check this out!" notification here, the resulting changes to the document look like this: if you're using firefox mobile, you can see this example live by tapping the button below.
Accessing XML children - Archive of obsolete content
operator allows you to change its value.
...for instance <pets> <dog color="brown">fido</dog> <cat color="grey">fluffy</cat> </pets> e4x allows you to access the attributes of a particular element with the .@ operator.
The global XML object - Archive of obsolete content
the xml object has several properties that allow you to customize parsing and serialization of e4x.
...the following example defines the foocount() method, which returns the amount of <foo> elements in the xml: xml.prototype.function::foocount = function foocount() { return this..foo.length(); }; <foobar><foo/><foo/><foo/></foobar>.foocount() // returns 3 ignorecomments true by default.
ECMAScript 2016 to ES.Next support in Mozilla - Archive of obsolete content
below is a list of features in es2016+ and what version of firefox they were implemented in.
...(may 2019) the following features are already implemented, but only available in the firefox nightly channel and not yet included in a draft edition of an ecmascript specification.
ActiveXObject - Archive of obsolete content
in the following example, you access properties and methods of the new object using the object variable excelsheet and other excel objects, including the application object and the activesheet.cells collection.
...excelsheet.application.quit(); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
Debug.debuggerEnabled - Archive of obsolete content
syntax var dbgenabled = debug.debuggerenabled; requirements supported in the following document modes: internet explorer 10 standards and internet explorer 11 standards.
... not supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards.
Debug.msTraceAsyncCallbackStarting - Archive of obsolete content
example the following code provides an example of tracing an asynchronous call for a windows 8.x store app.
... not supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards.
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
example the following code provides an example of tracing an asynchronous call for a windows 8.x store app.
... not supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards.
Debug - Archive of obsolete content
debug.writeln sends strings to the script debugger, followed by a newline character.
... var counter = 42; debug.write("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
Enumerator.atEnd - Archive of obsolete content
example in following code, the atend method is used to determine if the end of a list of drives has been reached: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; ...
...ady) { var freegb = drv.freespace / bytespergb; var totalgb = drv.totalsize / bytespergb; s += freegb.tofixed(3) + " gb free of "; s += totalgb.tofixed(3) + " gb"; } else { s += "not ready"; } s += "<br />"; e.movenext(); } return(s); } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Enumerator.moveFirst - Archive of obsolete content
example in following example, the movefirst method is used to evaluate members of the drivescollection from the beginning of the list: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += d...
...ady) { var freegb = drv.freespace / bytespergb; var totalgb = drv.totalsize / bytespergb; s += freegb.tofixed(3) + " gb free of "; s += totalgb.tofixed(3) + " gb"; } else { s += "not ready"; } s += "<br />"; e.movenext(); } return(s); } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Enumerator.moveNext - Archive of obsolete content
example in following example, the movenext method is used to move to the next drive in the drives collection: function showdrives() { var s = ""; var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); var e = new enumerator(fso.drives); e.movefirst(); while (e.atend() == false) { var drv = e.item(); s += drv.path + " - "; ...
...ady) { var freegb = drv.freespace / bytespergb; var totalgb = drv.totalsize / bytespergb; s += freegb.tofixed(3) + " gb free of "; s += totalgb.tofixed(3) + " gb"; } else { s += "not ready"; } s += "<br />"; e.movenext(); } return(s); } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Enumerator - Archive of obsolete content
example the following code shows the usage of the enumerator object: var bytespergb = 1024 * 1024 * 1024; var fso = new activexobject("scripting.filesystemobject"); document.write(fso.drives); var e = new enumerator(fso.drives); var drivestring = ""; e.movefirst(); while (e.atend() == false) { var drv = e.item(); drivestring += drv.path + " - "; if (drv.isready){ var freegb = drv.freespac...
... requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Error.description - Archive of obsolete content
example the following example illustrates the use of the description property.
... try { // cause an error: x = y } catch(e) { // prints "[object error]": document.write(e) document.write (" "); // prints 5009: document.write((e.number & 0xffff)) document.write (" "); // prints "'y' is undefined": document.write(e.description); document.write (" "); // prints "'y' is undefined": document.write(e.message) } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
ScriptEngineMinorVersion - Archive of obsolete content
example the following example illustrates the use of the scriptengineminorversion function.
... if (window.scriptengineminorversion) { console.log(window.scriptengineminorversion()); } //output: <current minor version> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
VBArray.dimensions - Archive of obsolete content
the following example consists of three parts.
...{ var i; var a = new vbarray(vba); var s = ""; for (i = 1; i <= a.dimensions(); i++) { s += "the upper bound of dimension "; s += i + " is "; s += a.ubound(i); s += ".<br />"; } return(s); } --> </script> </head> <body> <script type="text/javascript"> document.write(vbarraytest(createvbarray())); </script> </body> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
VBArray.getItem - Archive of obsolete content
example the following example consists of three parts.
...ript type="text/javascript"> <!-- function getitemtest(vbarray) { var i, j; var a = new vbarray(vbarray); for (i = 0; i <= 2; i++) { for (j =0; j <= 2; j++) { document.writeln(a.getitem(i, j)); } } } --> </script> </head> <body> <script type="text/javascript"> <!-- getitemtest(createvbarray()); --> </script> </body> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
VBArray.ubound - Archive of obsolete content
example the following example consists of three parts.
... var i; var a = new vbarray(vba); var s = ""; for (i = 1; i <= a.dimensions(); i++) { s += "the upper bound of dimension "; s += i + " is "; s += a.ubound(i); s += ".<br />"; } return (s); } --> </script> </head> <body> <script type="text/javascript"> document.write(vbarraytest(createvbarray())); </script> </body> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
@set - Archive of obsolete content
term zero or more unary operators followed by a constant, conditional compilation variable, or parenthesized expression.
... examples of variable declarations look like this: @set @myvar1 = 12 @set @myvar2 = (@myvar1 * 20) @set @myvar3 = @_jscript_version the following operators are supported in parenthesized expressions: !
New in JavaScript 1.7 - Archive of obsolete content
the following is a changelog for javascript 1.7.
... new features in javascript 1.7 the following features added with javascript 1.7 were not part of an ecma-262 standard at the time.
Object.prototype.watch() - Archive of obsolete content
examples using watch and unwatch const o = { p: 1 }; o.watch('p', (id, oldval, newval) => { console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval); return newval; }); o.p = 2; o.p = 3; delete o.p; o.p = 4; o.unwatch('p'); o.p = 5; this script displays the following: o.p changed from 1 to 2 o.p changed from 2 to 3 o.p changed from undefined to 4 using watch() to validate an object's properties you can use watch to test any assignment to an object's properties.
...ror('invalid name for ' + this); } if (id === 'age' && (newval < 0 || newval > 200)) { throw new rangeerror('invalid age for ' + this); } return newval; } } const will = new person('will', 29); console.log(will); // will, 29 try { will.name = ''; } catch (e) { console.log(e); } try { will.age = -4; } catch (e) { console.log(e); } this script displays the following: will, 29 rangeerror: invalid name for will, 29 rangeerror: invalid age for will, 29 specifications not part of any standard.
LiveConnect Reference - Archive of obsolete content
javascript-to-java these classes allow a java object to access javascript code.
...javascript objects are wrapped in an instance of the class jsobject and passed to java, allowing java to manipulate javascript objects.
LiveConnect - Archive of obsolete content
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.methodname()).
... note: liveconnect blocked under some conditions liveconnect calls from javascript to java api are blocked when the java control panel security slider is set to very high level, or when the slider is at the default high level and the jre has either expired or is below the security baseline.
JavaArray - Archive of obsolete content
in addition, the tostring method is inherited from the object object and returns the following value: [object javaarray] you must specify a class object, such as one returned by java.lang.object.forname, for the componenttype parameter of newinstance when you use this method to create an array.
... var javastring = new java.lang.string("hello world!"); var bytearray = javastring.getbytes(); example: instantiating a javaarray in javascript with the newinstance method in javascript 1.4, you can use a javaclass object as the argument for the newinstance method which creates the array, as shown in the following code: var dogs = java.lang.reflect.array.newinstance(java.lang.string, 5); in javascript 1.1, use a class object returned by java.lang.class.forname as the argument for the newinstance method, as shown in the following code: var datatype = java.lang.class.forname("java.lang.string"); var dogs = java.lang.reflect.array.newinstance(datatype, 5); ...
JavaClass - Archive of obsolete content
examples example: using javaclass in the following example, x is a javaclass object referring to java.awt.font.
... example in the following example, the javaclass object java.lang.string is passed as an argument to the newinstance method which creates an array: var cars = java.lang.reflect.array.newinstance(java.lang.string, 15); see also javaarray, javaobject, javapackage, packages ...
JavaObject - Archive of obsolete content
examples example: instantiating a java object in javascript the following code creates the javaobject thestring, which is an instance of the class java.lang.string: var thestring = new packages.java.lang.string("hello, world"); because the string class is in the java package, you can also use the java synonym and omit the packages keyword when you instantiate the class: var thestring = new java.lang.string("hello, world"); example: accessing methods of a java ...
...the following example uses the startswith method to check whether thestring begins with "hello".
Old Proxy API - Archive of obsolete content
the default object semantics are implemented in the javascript engine, often written in lower-level languages like c++.
...ame, desc) { object.defineproperty(obj, name, desc); }, delete: function(name) { return delete obj[name]; }, fix: function() { if (object.isfrozen(obj)) { return object.getownpropertynames(obj).map(function(name) { return object.getownpropertydescriptor(obj, name); }); } // as long as obj is not frozen, the proxy won't allow itself to be fixed return undefined; // will cause a typeerror to be thrown }, // derived traps has: function(name) { return name in obj; }, hasown: function(name) { return object.prototype.hasownproperty.call(obj, name); }, get: function(receiver, name) { return obj[name]; }, set: function(receiver, name, val) { obj[name] = val; ret...
Examples - Archive of obsolete content
ctype 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 2 - comments in xhtml</title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <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) { 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>.
... back to the article stylesheet /* * if you try to view the results of these examples, * you will need to put a file named style.css with * the following content in the same directory as * the examples.
Sharp variables in JavaScript - Archive of obsolete content
a sharp variable is a syntax in object initializers that allows serialization of objects that have cyclic references or multiple references to the same object.
... form sharp variables have the form of a sharp sign (#) immediately followed by one or more digits.
Standards-Compliant Authoring Tools - Archive of obsolete content
the following authoring tools adhere to the w3 standards.
... html-kit is a full-featured, low priced editor designed to help html, xhtml and xml authors to edit, format, lookup help, validate, preview and publish web pages.
background-size - Archive of obsolete content
konqueror is listed below the table, which seems inconsistent.
...] listing konqueror below the table is a compromise for consistency.
RFE to the Custom Controls Interfaces - Archive of obsolete content
in short, we have the following interfaces: nsixformsaccessors - serves to get/set the value of the instance data node that the xforms element is bound to as well as getting the various states of that node nsixformsdelegate - used to obtain the nsixformsaccessors interface nsixformsuiwidget - used by the xforms processor to update the value/state of an xforms element when its bound node's value/state is changed our current mechanism that allows authors to build custom controls assumes that the controls will be bound to instance nodes of simple content type.
... this means that the bound node is not allowed to contain element nodes.
XForms Repeat Element - Archive of obsolete content
since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed.
... to accommodate this, xforms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-number additionally, when using xforms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes.
XForms Trigger Element - Archive of obsolete content
introduction allows the user to initiate actions (see the spec).
... representations the xforms trigger element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul).
XForms Upload Element - Archive of obsolete content
visually, the upload control is shown as a file picker dialog that hides disallowed (filtered) file types.
... representations the xforms upload element is represented by visually combining three widgets: a text field that shows the uri of the selected file, a button to open the file picker dialog which allows the user to select a file, and a button to clear the text field and the reference to the file from the bound node (xhtml only).
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
this is most obvious in ordered lists, where the number that precedes each list item may be obviously different than the content that follows it.
...the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself.
Fixing Table Inheritance in Quirks Mode - Archive of obsolete content
to do this, the gecko rendering engine uses the following rule in the quirk.css user agent file: /* quirk: cut off all font inheritance in tables and captions except for family.
... /* rule to fix quirks-mode inheritance behavior */ table, caption { font-size: inherit; font-weight: inherit; font-style: inherit; font-variant: inherit; } this rule will override the rule in quirk.css and thus allow the author to have reliable inheritance of font styles into tables when in "quirks" mode.
Using the DOM File API in chrome code - Extensions
this protects users from the inherent security risks associated with allowing web content free access to the contents of their disks.
...ke this: var dsfile = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("profd", components.interfaces.nsifile); dsfile.append("myfilename.txt"); var file = file.createfromnsifile(dsfile); this uses the directory service to locate the profile directory (with the location key "profd", see below for more details), then appends the name of the file we want to work with by calling nsifile.append().
Bounding volume collision detection with THREE.js - Game development
instantiating boxes to create a box3 instance, we need to provide the lower and upper boundaries of the box.
...we also need to call setfromobject again in order to make the box3 follow the mesh.
Crisp pixel art look with image-rendering - Game development
original size 4x size 4x size (scaled with an image editor) none vendor's algorithm nearest-neighbor algorithm a css-based solution the good news is that you can use css to automatically do the up-scaling, which not only solves the blur problem, but also allows you to use the images in their original, smaller size, thus saving download time.
...} and some javascript to set up the canvas and load the image: // get canvas context var ctx = document.getelementbyid('game').getcontext('2d'); // load image var image = new image(); image.onload = function () { // draw the image into the canvas ctx.drawimage(image, 0, 0); } image.src = 'https://udn.realityripple.com/samples/11/a2954fe197.png'; this code used together produces the following result: note: you can check out the original code on github (and a live example.) ...
Square tilemaps implementation: Static maps - Game development
in this case, we need to map the column and row to an array index: var index = row * map.cols + column; wrapping up, an example of a tilemap object could look like the following.
...this snippets assumes the following definitions: context: a 2d canvas context.
asm.js - Game development
it is a very small, strict subset of javascript that only allows things like `while`, `if`, numbers, top-level named functions, and other simple constructs.
... it does not allow objects, strings, closures, and basically anything that requires heap allocation.
Bounce off the walls - Game development
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.
...remembering that the coordinate system starts from the top left, we can come up with something like this: if(y + dy < 0) { dy = -dy; } if the y value of the ball position is lower than zero, change the direction of the movement on the y axis by setting it equal to itself, reversed.
Bounce off the walls - Game development
add the following line below the previous one: ball.body.bounce.set(1); try reloading index.html again — now you should see the ball bouncing off all the walls and moving inside the canvas area.
... compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps this is starting to look more like a game now, but we can't control it in any way — it's high time we introduced the player paddle and controls.
Initialize the framework - Game development
using your favourite text editor, create a new html document, save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev phaser workshop - lesson 01: initialize the framework</title> <style>* { padding: 0; margin: 0; }</style> <script src="js/phaser.min.js"></script> </head> <body> <script> var game = new phaser.game(480, 320, phaser.canvas, null, { preload: preload, create: create, update: update });...
...the v2 library is still available on the phaser download page, below the links for the v3 download.
Win the game - Game development
add the following new code into your ballhitbrick() function: function ballhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); var count_alive = 0; for (i = 0; i < bricks.children.length; i++) { if (bricks.children[i].alive == true) { count_alive++; } } if (count_alive == 0) { alert('you won the game, congratulations!'); location.reload(); } } we lo...
... compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps both losing and winning are implemented, so the core gameplay of our game is finished.
Visual-js game engine - Game development
3) please read the following terms and conditions before using this application: disclaimer of warranty 'visual js' is provided "as-is" and without warranty of any kind, express, implied or otherwise, including without limitation, any warranty of merchantability or fitness for a particular purpose.
... intro build.js ) webgl2 based on : copyright (c) 2014 tappali ekanathan keestu (keestu@gmail.com) gnu general public license obj loader : https://github.com/frenchtoast747/webgl-obj-loader textures download from http://textures.com more texture downloads http://www.textures4photoshop.com/ female body v3.blend this file has been released by andrescuccaro under the following license: creative commons attribution 3.0 about gui for windows (canvas2d part only) : windows gui application version 1.0 (using visual-js 0.9 lib) important : you will need net 4.5.2 minimum also redistribution pack for c++ how to start project ?
Abstraction - MDN Web Docs Glossary: Definitions of Web-related terms
abstraction in computer programming is a way to reduce complexity and allow efficient design and implementation in complex software systems.
... advantages of data abstraction helps the user to avoid writing low level code.
CSS - MDN Web Docs Glossary: Definitions of Web-related terms
here is an example that makes every html paragraph yellow against a black background: /* the selector "p" indicates that all paragraphs in the document will be affected by that rule */ p { /* the "color" property defines the text color, in this case yellow.
... */ color: yellow; /* the "background-color" property defines the background color, in this case black.
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
cssom api the css object model is also a set of apis allowing the manipulation of css from javascript.
...it allows users to read and modify the css style dynamically.
Canvas - MDN Web Docs Glossary: Definitions of Web-related terms
the canvas element is part of html5 and allows for dynamic, scriptable rendering of 2d and 3d shapes and bitmap images.
... it is a low level, procedural model that updates a bitmap and does not have a built-in scene graph.
Distributed Denial of Service - MDN Web Docs Glossary: Definitions of Web-related terms
the overflow of data to the target causes saturation in the target machine so that it cannot respond or responds very slowly to legitimate traffic (hence the name "denial of service").
... the united states computer emergency readiness team (us-cert) defines symptoms of denial-of-service attacks to include: unusually slow network performance (opening files or accessing websites) unavailability of a particular website inability to access any website dramatic increase in the number of spam emails received—(this type of dos attack is considered an email bomb) disconnection of a wireless or wired internet connection longterm denial of access to the web or any internet services learn more general knowledge ...
Domain sharding - MDN Web Docs Glossary: Definitions of Web-related terms
as browsers limit the number of active connections per domain, serving all the required resources from a single domain could be slow as assets need to be downloaded sequentially.
...multiple domains, however, is an anti-pattern, as dns lookups slow initial load times.
Entity - MDN Web Docs Glossary: Definitions of Web-related terms
for example, if you use the less-than (<) sign, the browser interprets any text that follows as a tag.
... to display these characters as text, replace them with their corresponding character entities, as shown in the following table.
Fragmentainer - MDN Web Docs Glossary: Definitions of Web-related terms
a fragmentainer is defined in the css fragmentation specification as follows: a box—such as a page box, column box, or region—that contains a portion (or all) of a fragmented flow.
...when breakable content would overflow a fragmentainer in the block dimension, it breaks into the next container in its fragmentation context instead.
Function - MDN Web Docs Glossary: Definitions of Web-related terms
only function expressions can be anonymous, function declarations must have a name: // when used as a function expression (function () {}); // or using the ecmascript 2015 arrow notation () => {}; the following terms are not used in the ecmascript language specification, they're jargon used to refer to different types of functions.
...kipedia.org/wiki/immediately-invoked_function_expression) /* ​function foo() { console.log('hello foo'); }(); */ // function expressions, named or anonymous, can be called immediately (function foo() { console.log("hello foo"); }()); (function food() { console.log("hello food"); })(); (() => console.log('hello world'))(); if you'd like to know more about iifes, check out the following page on wikipedia : immediately invoked function expression learn more technical reference functions arrow functions ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
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.
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
the image below shows the first row track on a grid.
...the example below demonstrates a grid with three column tracks, one of 200 pixels, the second of 1fr, the third of 3fr.
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
headers are case-insensitive, begins at the start of a line and are immediately followed by a ':' and a value depending of the header itself.
... a basic request with one header: get /example.http http/1.1 host: example.com redirects have mandatory headers (location): 302 found location: /newpage.html a typical set of headers: 304 not modified access-control-allow-origin: * age: 2318192 cache-control: public, max-age=315360000 connection: keep-alive date: mon, 18 jul 2016 16:06:00 gmt server: apache vary: accept-encoding via: 1.1 3dc30c7222755f86e824b93feb8b5b8c.cloudfront.net (cloudfront) x-amz-cf-id: tol0fem6ui4fgldrkjx0vao5hpkkgzulyn2twd2gawltr7vlnjtvzw== x-backend-server: developer6.webapp.scl3.mozilla.com x-cache: hit from cloudfront x-cache-info: cac...
IMAP - MDN Web Docs Glossary: Definitions of Web-related terms
more recent than pop3, imap allows folders and rules on the server.
... unlike pop3, imap allows multiple simultaneous connections to one mailbox.
Intrinsic Size - MDN Web Docs Glossary: Definitions of Web-related terms
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.
... the max-content size is the opposite — in the case of text, this would have the text display as wide as possible, doing no soft-wrapping, even if an overflow was caused.
Latency - MDN Web Docs Glossary: Definitions of Web-related terms
low latency is good, meaning there is little or no delay.
... latency can be a factor in any kind of data flow, but is most commonly discussed in terms of network latency (the time it takes for a packet of data to travel from source to destination) and media codec latency (the time it takes for the source data to be encoded or decoded and reach the consumer of the resulting data).
Media (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
css offers several features that allow you to tweak your document's styles—or even offer different styles—according to the media type (such as screen or print, to name two) or media capabilities (such as width, resolution, or other values) of the viewer's device.
... learn more general knowledge using media queries technical reference media queries define a set of characteristics or parameters required to apply the css styles that are specified within the curly braces of the media query; for example: only applying certain css styles for devices below 768 pixels.
Normative - MDN Web Docs Glossary: Definitions of Web-related terms
normative is a word commonly used in software specifications to denote sections that are standardized and must be followed as a rule.
... specifications might also contain sections that are marked as non-normative or informative, which means those are provided there for the purpose of helping the reader understand the specifications better or to showcase an example or best practice, which need not be followed as a rule.
Preflight request - MDN Web Docs Glossary: Definitions of Web-related terms
for example, a client might be asking a server if it would allow a delete request, before sending a delete request, by using a preflight request: options /resource/foo access-control-request-method: delete access-control-request-headers: origin, x-requested-with origin: https://foo.bar.org if the server allows it, then it will respond to the preflight request with an access-control-allow-methods response header, which lists delete: http/1.1 204 no content c...
...onnection: keep-alive access-control-allow-origin: https://foo.bar.org access-control-allow-methods: post, get, options, delete access-control-max-age: 86400 the preflight response can be optionally cached for the requests created in the same url using access-control-max-age header like in the above example.
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
most of the time, a primitive value is represented directly at the lowest level of the language implementation.
... another example [ step-by-step ] the following example will help you go through how javascript deals with primitives.
Response header - MDN Web Docs Glossary: Definitions of Web-related terms
the following shows a few response headers after a get request.
... note that strictly speaking, the content-encoding and content-type headers are entity header: 200 ok access-control-allow-origin: * connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 date: mon, 18 jul 2016 16:06:00 gmt etag: "c561c68d0ba92bbeb8b0f612a9199f722e3a621a" keep-alive: timeout=5, max=997 last-modified: mon, 18 jul 2016 02:36:04 gmt server: apache set-cookie: mykey=myvalue; expires=mon, 17-jul-2017 16:06:00 gmt; max-age=31449600; path=/; secure transfer-encoding: chunked vary: cookie, accept-encoding x-backend-server: developer2.webapp.scl3.mozilla.com x-cache-info: not cacheable; meta data too large x-kuma-revision: 1085259 x-frame-options: deny ...
Scroll container - MDN Web Docs Glossary: Definitions of Web-related terms
a scroll container is created by applying overflow: scroll to a container, or overflow: auto when there is enough content to cause overflow.
... the scroll container allows the user to scroll through parts of the overflow region that would otherwise be clipped and hidden from view.
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
consider the following: <span style="font-size: 32px; margin: 21px 0;">is this a top level heading?</span> this will render it to look like a top level heading, but it has no semantic value, so it will not get any extra benefits as described above.
... some of the benefits from writing semantic markup are as follows: search engines will consider its contents as important keywords to influence the page's search rankings (see seo) screen readers can use it as a signpost to help visually impaired users navigate a page finding blocks of meaningful code is significantly easier than searching though endless divs with or without semantic or namespaced classes suggests to the developer the type of data that will be populated semantic naming mirrors proper custom element/component...
Vendor Prefix - MDN Web Docs Glossary: Definitions of Web-related terms
css prefixes the major browsers use the following prefixes: -webkit- (chrome, safari, newer versions of opera, almost all ios browsers including firefox for ios; basically, any webkit based browser) -moz- (firefox) -o- (old pre-webkit versions of opera) -ms- (internet explorer and microsoft edge) sample usage: -webkit-transition: all 4s ease; -moz-transition: all 4s ease; -ms-transition: all 4s ease; -o-transition: all 4s ease; trans...
... interface prefixes prefixes for interface names are upper-cased: webkit (chrome, safari, newer versions of opera, almost all ios browsers (including firefox for ios); basically, any webkit based browser) moz (firefox) o (older, pre-webkit, versions of opera) ms (internet explorer and microsoft edge) property and method prefixes the prefixes for properties and methods are lower-case: webkit (chrome, safari, newer versions of opera, almost all ios browsers (including firefox for ios); basically, any webkit based browser) moz (firefox) o (old, pre-webkit, versions of opera) ms (internet explorer and microsoft edge) sample usage: var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || ...
WebSockets - MDN Web Docs Glossary: Definitions of Web-related terms
websocket is a protocol that allows for a persistent tcp connection between server and client so they can exchange data at any time.
...through websocket, servers can pass data to a client without prior client request, allowing for dynamic content updates.
Baseline - MDN Web Docs Glossary: Definitions of Web-related terms
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.
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
not all http responses can be cached, these are the following constraints for an http response to be cached: the method used in the request is itself cacheable, that is either a get or a head method.
...the following status code are cacheable: 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501.
Character encoding - MDN Web Docs Glossary: Definitions of Web-related terms
a sequence of bytes allows for different textual interpretations.
... 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.
Loop - MDN Web Docs Glossary: Definitions of Web-related terms
example: for(var i = 0; i < 10; i++){ console.log(i) } //this loop will print numbers 0-9, will stop when condition is met (i = 10) for the above example, the syntax is as follows: statement 1 sets the variable for the loop (var i = 0).
... example: var i = 0; while(i < 5){ console.log(i) i++ } //this loop will print number 0-4, will stop when condition becomes false (i >=5) for the above example, the syntax is as follows: the code block will continue to run as long as the variable (i) is less than 5.
non-normative - MDN Web Docs Glossary: Definitions of Web-related terms
software specifications often contains information marked as non-normative or informative, which means that those are provided there for the purpose of helping the readers to understand the specification better or to show an example or a best practice, and not needed to be followed as a rule.
... sections that contain official part of the specification that must be followed are often marked as normative.
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
browsers can call safe methods without fearing to cause any harm to the server; this allows them to perform activities like pre-fetching without risk.
...in particular, an application should not allow get requests to alter its state.
Assessment: Accessibility troubleshooting - Learn web development
as it stands, it has a number of accessibility issues — your task is to explore the existing site and fix them to the best of your abilities, answering the questions given below.
...how can you allow them to still access the audio?
A cool-looking box - Learn web development
styling the box we'd like you to style the provided <p>, giving it the following: a reasonable width for a large button, say around 200 pixels.
... 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.
Test your skills: The Cascade - Learn web development
note: you can try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks.
... in the example below see if you can match the image above.
Fundamental CSS comprehension - Learn web development
the following sections describe what you need to do.
... example the following screenshot shows an example of what the finished design should look like: assessment or further help if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch.
CSS first steps - Learn web development
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.
... css (cascading style sheets) allows you to create great-looking web pages, but how does it work under the hood?
Learn to style HTML using CSS - Learn web development
modules this topic contains the following modules, in a suggested order for working through them.
...in the following video, miriam suzanne provides a useful explanation of why css works like it does, and why it has evolved like it has: ...
What text editors are available? - Learn web development
ideally, you'd try as many editors as you can and get a feel for what suits your workflow.
... if you like lots of features and your editor is slowing down because of all your plugins, try using an ide (integrated development environment).
How do you host your website on Google App Engine? - Learn web development
for this tutorial, the following values are used: project name: gae sample site project id: gaesamplesite click the create button to create your project.
... 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.
How do I start to design my website? - Learn web development
to do this, you need only pen and paper and some time to answer at least the following questions.
...in short, since these goals all revolve around the same topic, having everything in one place will help us meet our goals and help our followers connect with us.
What is a URL? - Learn web development
let's see the most important parts using the following url: http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#somewhereinthedocument http is the protocol.
... examples of relative urls to better understand the following examples, let's assume that the urls are called from within the document located at the following url: https://developer.mozilla.org/docs/learn sub-resources skills/infrastructure/understanding_urls because that url does not start with /, the browser will attempt to find the document in a sub-directory of the one containing the current resource.
What is a Domain Name? - Learn web development
tlds containing .gov are only allowed to be used by government departments.
... label (or component) the labels are what follow the tld.
What is accessibility? - Learn web development
this building has to be accessible, so it must follow these regulations for door width and toilet size and elevator placement.
... the basics of web accessibility a few necessities for basic web accessibility include: whenever your site needs an image to convey meaning, include text as an alternative for visually-challenged users or those with slow connections.
What software do I need to build a website? - Learn web development
you should make sure your hosting provider allows use of a secure connection, e.g.
...there are dozens of browser options for your personal use, but when you're developing a website you should test it at least with the following major browsers, to make sure your site works for most people: mozilla firefox google chrome microsoft internet explorer apple safari if you're targeting a specific group (e.g., technical platform or country), you may have to test the site with additional browsers, like opera, konqueror, or uc browser.
Sending forms through JavaScript - Learn web development
the different techniques you'll require are done below.
... in the following example, we use the filereader api to access binary data and then build the multi-part form data request by hand: <form id="theform"> <p> <label for="thetext">text data:</label> <input id="thetext" name="mytext" value="some text data" type="text"> </p> <p> <label for="thefile">file data:</label> <input id="thefile" name="myfile" type="file"> </p> <button>send me!</bu...
Getting started with the Web - Learn web development
by working through the articles listed below in order, you will go from nothing to getting your first webpage online.
...we outline a simple method you can follow to plan out your site's content and design.
Using data attributes - Learn web development
data-* attributes allow us to store extra information on standard, semantic html elements without other hacks such as non-standard attributes, extra properties on dom, or node.setuserdata().
...using the css selectors and javascript access here this allows you to build some nifty effects without having to write your own display routines.
Introduction to HTML - Learn web development
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.
... assessments the following assessments will test your understanding of the html basics covered in the guides above.
Asynchronous JavaScript - Learn web development
handling async operations gracefully with promises promises are a comparatively new feature of the javascript language that allow you to defer further actions until after the previous action has completed, or respond to its failure.
...the former allows standard functions to implicitly behave asynchronously with promises, whereas the latter can be used inside async functions to wait for promises before the function continues.
JavaScript building blocks - Learn web development
functions allow you to store a piece of code that does a single task inside a defined block, and then call that code whenever you need it using a single short command — rather than having to type out the same code multiple times.
... assessments the following assessment will test your understanding of the javascript basics covered in the guides above.
JavaScript First Steps - Learn web development
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).
... assessments the following assessment will test your understanding of the javascript basics covered in the guides above.
Solve common problems in your JavaScript code - Learn web development
the following links point to solutions to common problems you may encounter when writing javascript.
...for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remember that functions have their own scope — you can't access a variable value set inside a function from outside the function, unless you declared the variable globally (i.e.
Web performance resources - Learn web development
below is a quick review of best practices, tools, apis with links to provide more information about each topic.
...the following snippet includes an onload attribute, requiring javascript, so it is important to include a noscript tag with a traditional fallback.
Learning area release notes - Learn web development
check it out for an opinionated pathway to follow for learning front-end development!
... 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 moved out of the html topic area to recognise that it covers more than just html form elements — it also covers styling, validation, the basics of how to send data and p...
Git and GitHub - Learn web development
all developers will use some kind of version control system (vcs), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each other's work, and roll back to previous versions of the code base if a problem is discovered later on.
... guides note that the links below take you to resources on external sites.
Tools and testing - Learn web development
on top of that, we still need to keep cross-browser support in the forefront of our minds, and make sure that our code follows best practices that allow our projects to work across different browsers and devices that our users are using to browse the web, and be usable by people with disabilities.
... git and github all developers will use some kind of version control system (vcs), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each other's work, and roll back to previous versions of the code base if a problem is discovered later on.
Mozilla Plugin Accessibility
the new plugin api will allow plugins to bubble unused keypresses to the browser.
... this will allow keyboard users to still access menus, close the current page, scroll, move back and forward in history, etc.
Accessibility and Mozilla
mozilla strives to make its software accessible; the documents below cover the ways in which we do so.
...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.
Lightweight themes
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.
...duplicate names are not allowed, so you may need to try a few times to find a unique name.
Add-ons
add-ons allow developers to extend and modify the functionality of firefox.
... other types of add-ons in addition to extensions, there are a few other add-on types that allow users to customize firefox.
Cookies Preferences in Mozilla
0-65535, rfc 2109 and 2965 require this to be at least 300 network.cookie.maxperhost default value: 50 configures the maximum amount of cookies to be stored per host valid range is from 0-65535, rfc 2109 and 2965 require this to be at least 20 network.cookie.disablecookieformailnews default value: true true = do not accept any cookies from within mailnews or from mail-style uris false = allow cookies in these situations this preference is applicable to all versions of seamonkey.
...earlier versions of thunderbird only allowed cookies on rss feeds.
Creating MozSearch plugins
the following xml is the bundled firefox 2 search plugin for searching using yahoo!: <searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>yahoo</shortname> <description>yahoo search</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16">data:image/x-icon;base64,r0lgodlheaaqajecap8aaaaaap///waaach5baeaaaialaaaaaaqabaaaaipli+py+0nogquybdened2khkffwuamezmpzsf...
...firefox will use the above search engine description to construct the following search url: http://search.yahoo.com/search?p=mozilla&ei=utf-8&fr=moz2 if the user clicks the magnifying glass icon in the search bar, or chooses the web search option in the tools menu when the search bar isn't visible, the browser will take them to http://search.yahoo.com/, the value of the <searchform> element.
Creating Sandboxed HTTP Connections
below is an example: // global channel var gchannel; // init the channel // the io service var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); // create an nsiuri var uri = ioservice.newuri(myurlstring, null, null); // get a channel for that nsiuri gchannel = ioservice.newchannelfromuri(uri); // get an ...
... these methods provide all the required functionality needed to modify cookies before they are processed/sent, allowing for sandboxed cookie connections that don't affect the user's cookies.
Capturing a minidump
in the file chooser window that appears, find the firefox.exe executable process with the lowest pid.
... capturing a minidump: application hang on windows vista and windows 7, you can follow these instructions to capture a dump file and locate it after it's been saved.
Debugging
it is slow, but good for tracking down difficult memory safety bugs.
... debugging frame reflow and debugging table reflow notes on debugging issues in gecko's layout engine.
Building Firefox with Debug Symbols
use the following mozconfig settings to do a build with symbols: building firefox with symbols there is a single configure option to enable building with symbols on all platforms.
... breakpad symbol files after the build is complete, run the following command to generate an archive of breakpad symbol files: mach buildsymbols the tinderbox uses an additional uploadsymbols target to upload symbols to a socorro server.
Updating NSPR or NSS in mozilla-central
(because some developers might not be aware that nspr/nss are separately maintained and released, the mozilla hg server rejects accidental changes/forking, if the required keywords are missing in the commit comment.) if nspr or nss must be upgraded to a new static tag, follow this procedure: before starting, make sure your local repository is updated to mozilla-central tip and that there are no local changes: $ hg status -mard pull the new sources $ python client.py update_nspr nspr_tag_name or $ python client.py update_nss nss_tag_name if you update a branch older than mozilla 17 (without the change from bug 782784), you must manually add a dummy c...
...for example, in the following, "3.16.1" would be replaced with the new nss version.
Windows SDK versions
quick start follow the instructions for whichever version of visual c++ you're using.
...try the following things in order: run the windows sdk configuration tool (if available) and make sure the right sdk is selected.
ESLint
for example: in windows 10, if you have installed node.js on "c:\nodejs", then the command should look like: export path=$path:/c/nodejs enabling eslint for a new directory remove the directory from .eslintignore (in the base directory of the repository) fix errors that occur when running ./mach eslint path/to/dir, see also the no-undef rules below.
... you'll need to include the following just above it: /* import-globals-from relative/path/to/file.js */ do_check_eq, add_task not defined in a test directory.
Linux compatibility matrix
the following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox.
... yellow backgrounds denote compatibility with esr78 green backgrounds denote compatibility with the current release (as of writing, 78) greener backgrounds denote compatibility with the current mozilla-central (as of writing, 80).
Frame script environment
the frame script's global is a contentframemessagemanager, giving it the following environment: content the dom window of the content loaded in the browser may be null (see below) docshell the nsidocshell associated with the browser.
... events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload bubbles no fires when the frame script environment is shut down, i.e.
Firefox and the "about" protocol
ut:about provides an overview of all about: pages available for your current firefox version about:addons add-ons manager about:buildconfig displays the configuration and platform used to build firefox about:cache displays information about the memory, disk, and appcache about:checkerboard switches to the checkerboarding measurement page, which allows to detect checkerboarding issues about:config provides a way to inspect and change firefox preferences and settings about:compat lists overriding site compatability fixes, linked to specific bug issues.
... about:crashes lists all crashes, which happened during the runtime of firefox (in case the user enabled the crash reporter) about:credits lists all contributors to the firefox project about:debugging switches to the developer tools debugging page, which allows you to debug add-ons, tabs and service workers about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage, save it as report and run the gc and cc a...
mozbrowsercaretstatechanged
details the details property returns an anonymous javascript object with the following properties: rect an object that defines information about the bounding rectangle of the current selection.
... senddocommandmsg a method allowing you to issue a command via an anonymouse function, i.e.
mozbrowsermetachange
see below for the applicable types.
... details the details property returns an anonymous javascript object with the following properties: name a domstring representing the <meta> name attribute value.
Chrome-only API reference
MozillaGeckoChromeAPI
browser apithe html browser api is an extension of the html <iframe> element that allows web apps to implement browsers or browser-like applications.
...examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below.
Chrome-only CSS reference
MozillaGeckoChromeCSS
se cursor is presently hovering over a tree row.::-moz-tree-separatoractivated by the properties attribute.::-moz-tree-twistyactivated by the properties attribute.css -moz-bool-pref() @supports functionthe -moz-bool-pref() @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.
How to add a build-time test
note that the following variables are supplied by the rules.mk file: cppsrcs, simple_programs, run_test_program.
... for example, to add an xpcshell test to a module, do the following: copy tools/test-harness/xpcshell-simple/example to yourmoduledir/tests_type, wheretests_type is something that describes your tests.
IPDL Best Practices
consider the following protocol: async protocol pasyncquerier { child: pasyncquery(); } async protocol pasyncquery { child: kickoffquery(nsstring query); parent: returnresult(nsstring result); __delete__(); } in this situation, there is a guaranteed sequence of messages that will be sent.
... following actor construction, the parent will send a kickoffquery message and presumably ignore the actor until it receives returnresult, at which point it will be deleted.
Implementing QueryInterface
it addrefs the resulting interface, not this, thus following the com-correct way (particularly important in aggregation) it uses nscomtypeinfo<t>::getiid() instead of ktiid thus saving a global declaration and global space it uses c 's static_cast, via ns_static_cast, which detects errors when you can't really get to the desired interface.
...the differences are highlighted in the following code.
Integrated Authentication
<i>this document is incomplete ...</i> flow diagram the diagram below shows how various components interact.
... if you wish to use non-fully-qualified entries of the form mydomain.com in the above preferences for ntlm and spnego authentication, you will also need to set the preferences network.automatic-ntlm-auth.allow-non-fqdn and network.negotiate-auth.allow-non-fqdn (respectively) to true.
JavaScript-DOM Prototypes in Mozilla
because of this, the following holds true (assuming img1 and img2 are two different image objects in the same document): img1.__proto__ === img2.__proto__ if img1 would come from one document and img2 from another document, then the above would not be true.
... htmlelement.prototype | |.__proto__ | element.prototype | |.__proto__ | node.prototype | |.__proto__ | object.prototype | |.__proto__ | null if you have an instance of a htmldivelement in javascript, the following will hold true: div.__proto__ === htmldivelement.prototype which means that the following should also be true: div.__proto__ === div.constructor.prototype non standard no browser is required to provide modifiable __proto__, nor a global node, nor provide any way to get at host objects nor their associated prototypes.
JavaScript Tips
the properties are: align allowevents contextmenu datasources dir flex height id left maxheight maxwidth minheight minwidth observes orient pack persist ref statustext top tooltip tooltiptext width xul also maps the ordinal attribute but this defaults to "1" if it is not present.
...however in addition to locating elements by tag name xul also allows you to locate an element by attribute, starting at any element in the document.
DownloadSummary
this allows the summary to be used without requiring the initialization of the downloadlist first.
...the following methods may be defined: onsummarychanged: optional called after any property of the summary has changed.
Http.jsm
httprequest supports the following parameters: name meaning headers an array of headers postdata this can be: a string: send it as is an array of parameters: encode as form values null/undefined: no post data.
... submitting post data httprequest allows attaching data to the post requests.
JNI.jsm
if you would like to support versions before that, you can copy and paste the contents of the jsm file int jni stands for java native interface; this library allows calling java code running in java virtual machines (jvms), etc.
...t(2); // 0 ia.get(3); // 0 ia.get(4); // 0 ia.set(2, 10); // void ia.get(2); // 10 ia.setelements(3, [50, 75]); // void ia.get(0); // 0 ia.get(1); // 0 ia.get(2); // 10 ia.get(3); // 50 ia.get(4); // 75 } finally { if (my_jenv) { jni.unloadclasses(my_jenv); } } casting this example shows how to cast, the casting happens at jni.classes.android.view.windowmanager.__cast__(wm) below: function main() { var my_jenv; try { my_jenv = jni.getforthread(); var sig = { windowmanager: 'landroid/view/windowmanager;', windowmanager_layoutparams: 'landroid/view/windowmanager$layoutparams;', viewgroup_layoutparams: 'landroid/view/viewgroup$layoutparams;', view: 'landroid/view/view;', void: 'v', ...
OS.File.Info
using os.file.info example: determining if a file is a regular file the following snippet uses the main thread api to determine (asynchronously) whether some path is a regular file, or a directory, or a symbolic link: let promise = os.file.stat(somepath); promise.then( function onsuccess(info) { // |info| is an instance of |os.file.info| if (info.isdir) { // |somepath| represents a directory } else if (info.issymlink) { // |somepath| represents a symb...
...(as of firefox 38 this attribute is not found, see screen shots below, bugzilla :: bug 1156060) screenshot of info object in variable viewer macosx 10.10.1 ubuntu 14.04.1 windows 8.1 see also os.file.directoryiterator.entry ...
OSFile.jsm
this is critical because some platforms have extremely slow storage (e.g.
... consequently, one of the key design choices of os.file is to provide operations that are low-level enough that they do not hide any i/o from the developer (which could cause the developer to perform more i/o than they think) and, since not all platforms have the same features, offer system-specific information that the developer can use to optimize his algorithms for a platform.
Deferred
use the new promise() constructor instead (or use the above backwards/forwards compatible deferred function given below).
...if this value is a promise, then the associated promise will be resolved to the passed promise, and follow the state as the provided promise (including any future transitions).
Task.jsm
method overview function async(atask); promise spawn(atask); properties attribute type description result read only constructor constructs a special exception that, when thrown inside a legacy generator function, allows the associated task to be resolved with a specific value.
...this allows you to call the function with arguments.
XPCOMUtils.jsm
example for (var section in xpcomutils.iterstringenumerator(iniparser.getsections())) console.log(section); post-registration callback the post-registration callback called by generatemodule() should have the following signature: postregister( nsicomponentmanager compmgr, nsifile filespec, componentsarray ); parameters compmgr an nsicomponentmanager instance to use for managing the component.
... pre-unregistration callback the pre-unregistration callback passed to generatemodule() should have the following signature: preunregister( nsicomponentmanager compmgr, nsifile filespec, componentsarray ); parameters compmgr the nsicomponentmanager instance to use for managing the component.
L10n testing with xcode
follow the cloning and building instructions for firefox on ios.
...to view these strings, you'll need to start the accessibility inspector within the ios simulator by doing the following.
Localizing XLIFF files for iOS
go through the full xliff page adding <target></target> below each <source> tag set to help you to identify strings that need to be translated.
...keep in mind the following sets of characters that need to remain untranslated: $(some_text_here) is a variable format, %1$@ is another variable format.
Mozilla MathML Status
if only the main features of an element are implemented then its section is marked as supported but details of unsupported attributes are specified below.
... maxwidth, overflow not implemented.
MathML Demo: <mmultiscripts> - attach prescripts and tensor indices to a base
a mathml mmultiscripts object allows you to build tensor-like objects.
...displays a mathml mmultiscripts objects allows you to build tensor-like objects.
Mozilla Development Strategies
even if you're not comfortable with your writing skills, keep in mind that our helpful, happy documentation gnomes will follow along behind you and clean up for you.
... having parallel trees should allow you to work on other items while you are awaiting reviews.
Mozilla Style System Documentation
this double tree (style context tree and rule tree) allows for sharing of style data, which allows the data to take up less memory and allows the data computation to take less time.
... for example, suppose we had the css stylesheet: /* rule 1 */ doc { display: block; text-indent: 1em; } /* rule 2 */ title { display: block; font-size: 3em; } /* rule 3 */ para { display: block; } /* rule 4 */ [class="emph"] { font-style: italic; } and the following document: <doc> <title>a few quotes</title> <para class="emph">benjamin franklin said that <quote>"a penny saved is a penny earned."</quote></para> <para>franklin d.
Intel Power Gadget
understanding 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").
turbostat
invocation turbostat must be invoked as the super-user: sudo turbostat if you get an error saying "turbostat: no /dev/cpu/0/msr", you need to run the following command: sudo modprobe msr the output is as follows: core cpu avg_mhz %busy bzy_mhz tsc_mhz smi cpu%c1 cpu%c3 cpu%c6 cpu%c7 coretmp pkgtmp pkg%pc2 pkg%pc3 pkg%pc6 pkg%pc7 pkgwatt corwatt gfxwatt - - 799 21.63 3694 3398 0 12.02 3.16 1.71 61.48 49 49 0.00 0.00 0.00 0.00 22.68 15.13 1.13 0 0 ...
... if you run with the -s option you get a smaller range of measurements that fit on a single line, like the following: avg_mhz %busy bzy_mhz tsc_mhz smi cpu%c1 cpu%c3 cpu%c6 cpu%c7 coretmp pkgtmp pkg%pc2 pkg%pc3 pkg%pc6 pkg%pc7 pkgwatt corwatt gfxwatt 3614 97.83 3694 3399 0 2.17 0.00 0.00 0.00 77 77 0.00 0.00 0.00 0.00 67.50 57.77 0.46 ...
MailNews automated testing
it allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases.
...mailnews provides additional facilities as described on the mailnews automated testing page (see below).
Midas
user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); see: more about security preferences note: the shortcut key will automatically trigger this command (typically accel-v) with or without the signed js or any code on the page to handle it.
...otherwise, all selected characters will be drawn slightly lower than normal text.
Anonymous Shared Memory
see the examples below.
...the pseudo-code below shows the use of a file-mapped shared memory by a parent and child processes.
Dynamic Library Linking
(this is admittedly an omission that should be fixed.) however, it is possible to look up symbols defined in the main executable program as follows.
...for example, link your executable program a.out without the +s option, then execute the following: chatr +s enable a.out on rhapsody, the environment variable is dyld_library_path.
PRFileDesc
syntax #include <prio.h> struct prfiledesc { priomethods *methods; prfileprivate *secret; prfiledesc *lower, *higher; void (*dtor)(prfiledesc *fd); prdescidentity identity; }; typedef struct prfiledesc prfiledesc; parameters methods the i/o methods table.
... lower pointer to lower layer.
PRHostEnt
syntax #include <prnetdb.h> typedef struct prhostent { char *h_name; char **h_aliases; #if defined(_win32) print16 h_addrtype; print16 h_length; #else print32 h_addrtype; print32 h_length; #endif char **h_addr_list; } prhostent; fields the structure has the following fields: h_name pointer to the official name of host.
...the #ifdef in the structure allows direct assignment of the prhostent structure.
PRLinger
syntax #include <prio.h> typedef struct prlinger { prbool polarity; printervaltime linger; } prlinger; fields the structure has the following fields: polarity polarity of the option's setting: pr_false means the option is off, in which case the value of linger is ignored.
...the pr_sockopt_linger socket option, with a value represented by a structure of type prlinger, makes it possible to change this default as follows: if polarity is set to pr_false, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer.
PRNetAddr
syntax #include <prio.h> union prnetaddr { struct { pruint16 family; char data[14]; } raw; struct { pruint16 family; pruint16 port; pruint32 ip; char pad[8]; } inet; #if defined(_pr_inet6) struct { pruint16 family; pruint16 port; pruint32 flowinfo; pripv6addr ip; } ipv6; #endif /* defined(_pr_inet6) */ }; typedef union prnetaddr prnetaddr; fields the structure has the following fields: family address family: pr_af_inet|pr_af_inet6 for raw.family, pr_af_inet for inet.family, pr_af_inet6 for ipv6.family.
... flowinfo routing information.
PRSockOption
, pr_sockopt_keepalive, pr_sockopt_recvbuffersize, pr_sockopt_sendbuffersize, pr_sockopt_iptimetolive, pr_sockopt_iptypeofservice, pr_sockopt_addmember, pr_sockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o.
... pr_sockopt_reuseaddr allow local address reuse.
PRSocketOptionData
uintn tos; prbool non_blocking; prbool reuse_addr; prbool keep_alive; prbool mcast_loopback; prbool no_delay; prsize max_segment; prsize recv_buffer_size; prsize send_buffer_size; prlinger linger; prmcastrequest add_member; prmcastrequest drop_member; prnetaddr mcast_if; } value; } prsocketoptiondata; fields the structure has the following fields: ip_ttl ip time-to-live.
... reuse_addr allow local address reuse.
PR_Accept
syntax #include <prio.h> prfiledesc* pr_accept( prfiledesc *fd, prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the rendezvous socket on which the caller is willing to accept new connections.
... returns the function returns one of the following values: upon successful acceptance of a connection, a pointer to a new prfiledesc structure representing the newly accepted connection.
PR_AcceptRead
syntax #include <prio.h> print32 pr_acceptread( prfiledesc *listensock, prfiledesc **acceptedsock, prnetaddr **peeraddr, void *buf, print32 amount, printervaltime timeout); parameters the function has the following parameters: listensock a pointer to a prfiledesc object representing a socket descriptor that has been called with the pr_listen function, also known as the rendezvous socket.
...this buffer must be large enough to receive amount bytes of data and two prnetaddr structures (thus allowing the runtime to align the addresses as needed).
PR_Available
syntax #include <prio.h> print32 pr_available(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket.
... returns the function returns one of the following values: if the function completes successfully, it returns the number of bytes that are available for reading.
PR_Available64
syntax #include <prio.h> print64 pr_available64(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file or socket.
... returns the function returns one of the following values: if the function completes successfully, it returns the number of bytes that are available for reading.
PR_Bind
syntax #include <prio.h> prstatus pr_bind( prfiledesc *fd, const prnetaddr *addr); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: upon successful binding of an address to a socket, pr_success.
PR_CEnterMonitor
syntax #include <prcmon.h> prmonitor* pr_centermonitor(void *address); parameter the function has the following parameter: address a reference to the data that is to be protected by the monitor.
... returns the function returns one of the following values: if successful, the function returns a pointer to the prmonitor associated with the value specified in the address parameter.
PR_CExitMonitor
syntax #include <prcmon.h> prstatus pr_cexitmonitor(void *address); parameters the function has the following parameters: address the address of the protected object--the same address previously passed to pr_centermonitor.
... returns the function returns one of the following values: if successful, pr_success.
PR_CWait
syntax #include <prcmon.h> prstatus pr_cwait( void *address, printervaltime timeout); parameters the function has the following parameters: address the address of the protected object--the same address previously passed to pr_centermonitor.
... returns the function returns one of the following values: pr_success indicates either that the monitored object has been notified or that the interval specified in the timeout parameter has been exceeded.
PR_Close
syntax #include <prio.h> prstatus pr_close(prfiledesc *fd); parameters the function has the following parameters: fd a pointer to a prfiledesc object.
... returns one of the following values: if file descriptor is closed successfully, pr_success.
PR_CloseFileMap
syntax #include <prio.h> prstatus pr_closefilemap(prfilemap *fmap); parameter the function has the following parameter: fmap the file mapping to be closed.
... returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success.
PR_Connect
syntax #include <prio.h> prstatus pr_connect( prfiledesc *fd, const prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: upon successful completion of connection setup, pr_success.
PR_CreateThread
syntax #include <prthread.h> prthread* pr_createthread( prthreadtype type, void (*start)(void *arg), void *arg, prthreadpriority priority, prthreadscope scope, prthreadstate state, pruint32 stacksize); parameters pr_createthread has the following parameters: type specifies that the thread is either a user thread (pr_user_thread) or a system thread (pr_system_thread).
... returns the function returns one of the following values: if successful, a pointer to the new thread.
PR_Delete
syntax #include <prio.h> prstatus pr_delete(const char *name); parameters the function has the following parameter: name the pathname of the file to be deleted.
... returns one of the following values: if file is deleted successfully, pr_success.
PR_DestroyPollableEvent
syntax nspr_api(prstatus) pr_destroypollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent.
... returns the function returns one of the following values: if successful, pr_success.
PR_EnumerateHostEnt
syntax #include <prnetdb.h> printn pr_enumeratehostent( printn enumindex, const prhostent *hostent, pruint16 port, prnetaddr *address); parameters the function has the following parameters: enumindex the index of the enumeration.
... returns the function returns one of the following values: if successful, the function returns the value you should specify in the enumindex parameter for the next call of the enumerator.
PR_ExitMonitor
syntax #include <prmon.h> prstatus pr_exitmonitor(prmonitor *mon); parameter the function has the following parameter: mon a reference to an existing structure of type prmonitor.
... returns the function returns one of the following values: if successful, pr_success.
PR GetAddrInfoByName
syntax #include <prnetdb.h> praddrinfo *pr getaddrinfobyname( const char *hostname, pruint16 af, printn flags); parameters the function has the following parameters: hostname the character string defining the host name of interest.
...include pr_ai_nocanonname to suppress the determination of the canonical name corresponding to hostname returns the function returns one of the following values: if successful, a pointer to the opaque praddrinfo structure containing the results of the host lookup.
PR_GetDescType
syntax #include <prio.h> prdesctype pr_getdesctype(prfiledesc *file); parameter the function has the following parameter: file a pointer to a prfiledesc object whose descriptor type is to be returned.
... description the prdesctype enumeration is defined as follows: typedef enum prdesctype { pr_desc_file = 1, pr_desc_socket_tcp = 2, pr_desc_socket_udp = 3, pr_desc_layered = 4 } prdesctype; the enumeration has the following enumerators: pr_desc_file the prfiledesc object represents a normal file.
PR_GetFileInfo
syntax #include <prio.h> prstatus pr_getfileinfo( const char *fn, prfileinfo *info); parameters the function has the following parameters: fn the pathname of the file to get information about.
... returns one of the following values: if the file information is successfully obtained, pr_success.
PR_GetFileInfo64
syntax #include <prio.h> prstatus pr_getfileinfo64( const char *fn, prfileinfo64 *info); parameters the function has the following parameters: fn the pathname of the file to get information about.
... returns one of the following values: if the file information is successfully obtained, pr_success.
PR_GetHostByAddr
syntax #include <prnetdb.h> prstatus pr_gethostbyaddr( const prnetaddr *hostaddr, char *buf, printn bufsize, prhostent *hostentry); parameters the function has the following parameters: hostaddr a pointer to the ip address of host in question.
... returns the function returns one of the following values: if successful, pr_success.
PR_GetHostByName
syntax #include <prnetdb.h> prstatus pr_gethostbyname( const char *hostname, char *buf, printn bufsize, prhostent *hostentry); parameters the function has the following parameters: hostname the character string defining the host name of interest.
... returns the function returns one of the following values: if successful, pr_success.
PR_GetIdentitiesLayer
syntax #include <prio.h> prfiledesc* pr_getidentitieslayer( prfiledesc* stack, prdescidentity id); parameters the function has the following parameters: stack a pointer to a prfiledesc object that is a layer in a stack of layers.
... returns the function returns one of the following values: if successful, a pointer to a file descriptor of the layer with the specified identity in the given stack of layers.
PR_GetNameForIdentity
syntax #include <prio.h> const char* pr_getnameforidentity(prdescidentity ident); parameter the function has the following parameter: ident a layer's identity.
... returns the function returns one of the following values: if successful, the function returns a pointer to the string associated with the specified layer.
PR_GetOpenFileInfo
syntax #include <prio.h> prstatus pr_getopenfileinfo( prfiledesc *fd, prfileinfo *info); parameters the function has the following parameters: fd a pointer to a prfiledesc object for an open file.
... returns the function returns one of the following values: if file information is successfully obtained, pr_success.
PR_GetOpenFileInfo64
syntax #include <prio.h> prstatus pr_getopenfileinfo64( prfiledesc *fd, prfileinfo *info); parameters the function has the following parameters: fd a pointer to a prfiledesc object for an open file.
... returns the function returns one of the following values: if file information is successfully obtained, pr_success.
PR_GetProtoByName
syntax #include <prnetdb.h> prstatus pr_getprotobyname( const char* protocolname, char* buffer, print32 bufsize, prprotoent* result); parameters the function has the following parameters: protocolname a pointer to the character string of the protocol's name.
... returns the function returns one of the following values: if successful, pr_success.
PR_GetProtoByNumber
syntax #include <prnetdb.h> prstatus pr_getprotobynumber( print32 protocolnumber, char* buffer, print32 bufsize, prprotoent* result); parameters the function has the following parameters: protocolnumber the number assigned to the protocol.
... returns the function returns one of the following values: if successful, pr_success.
PR_GetSpecialFD
syntax #include <prio.h> prfiledesc* pr_getspecialfd(prspecialfd id); parameter the function has the following parameter: id a pointer to an enumerator of type prspecialfd, indicating the type of i/o stream desired: pr_standardinput, pr_standardoutput, or pr_standarderror.
... description type prspecialfd is defined as follows: typedef enum prspecialfd{ pr_standardinput, pr_standardoutput, pr_standarderror } prspecialfd; #define pr_stdin pr_getspecialfd(pr_standardinput) #define pr_stdout pr_getspecialfd(pr_standardoutput) #define pr_stderr pr_getspecialfd(pr_standarderror) file descriptors returned by pr_getspecialfd are owned by the runtime and should not be closed by the caller.
PR_GetUniqueIdentity
syntax #include <prio.h> prdescidentity pr_getuniqueidentity(const char *layer_name); parameter the function has the following parameter: layer_name the string associated with the creation of a layer's identity.
... returns the function returns one of the following values: if successful, the prdescidentity for the layer associated with the string specified in the layer named layer_name.
PR ImportTCPSocket
syntax #include "private/pprio.h" prfiledesc* pr_importtcpsocket(prosfd osfd); parameters the function has the following parameters: osfd the native file descriptor for the tcp socket to import.
... returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly imported native tcp socket.
PR_Init
syntax #include <prinit.h> void pr_init( prthreadtype type, prthreadpriority priority, pruintn maxptds); parameters pr_init has the following parameters: type this parameter is ignored.
... call pr_init as follows: pr_init(pr_user_thread, pr_priority_normal, 0); ...
PR_Initialize
syntax #include <prinit.h> printn pr_initialize( prprimordialfn prmain, printn argc, char **argv, pruintn maxptds); parameters pr_initialize has the following parameters: prmain the function that becomes the primordial thread's root function.
...this allows main to be treated like any other function, signaling its completion by returning and allowing the runtime to coordinate the completion of the other threads of the runtime.
PR_JoinThread
syntax #include <prthread.h> prstatus pr_jointhread(prthread *thread); parameter pr_jointhread has the following parameter: thread a valid identifier for the thread that is to be joined.
... returns the function returns one of the following values: if successful, pr_success if unsuccessful--for example, if no joinable thread can be found that corresponds to the specified target thread, or if the target thread is unjoinable--pr_failure.
PR_Listen
syntax #include <prio.h> prstatus pr_listen( prfiledesc *fd, printn backlog); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket that will be used to listen for new connections.
... returns the function returns one of the following values: upon successful completion of listen request, pr_success.
PR_MkDir
syntax #include <prio.h> prstatus pr_mkdir( const char *name, printn mode); parameters the function has the following parameters: name the name of the directory to be created.
... possible values include the following: 00400.
PR_NEXT_LINK
description pr_next_link returns a pointer to the element following the specified element.
...the following element is not removed from the list.
PR_NetAddrToString
syntax #include <prnetdb.h> prstatus pr_netaddrtostring( const prnetaddr *addr, char *string, pruint32 size); parameters the function has the following parameters: addr a pointer to the network address to be converted.
... returns the function returns one of the following values: if successful, pr_success.
PR_NewTCPSocket
syntax #include <prio.h> prfiledesc* pr_newtcpsocket(void); returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened ipv4 tcp socket.
...new code should use pr_opentcpsocket instead, which allows the address family (ipv4 or ipv6) of the new tcp socket to be specified.
PR_NewThreadPrivateIndex
syntax #include <prthread.h> prstatus pr_newthreadprivateindex( pruintn *newindex, prthreadprivatedtor destructor); parameters pr_newthreadprivateindex has the following parameters: newindex on output, an index that is valid for all threads in the process.
... returns the function returns one of the following values: if successful, pr_success.
PR_NewUDPSocket
syntax #include <prio.h> prfiledesc* pr_newudpsocket(void); returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened udp socket.
...new code should use pr_openudpsocket instead, which allows the address family (ipv4 or ipv6) of the new udp socket to be specified.
PR_Notify
syntax #include <prmon.h> prstatus pr_notify(prmonitor *mon); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor.
... returns the function returns one of the following values: if successful, pr_success.
PR_NotifyAll
syntax #include <prmon.h> prstatus pr_notifyall(prmonitor *mon); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor.
... returns the function returns one of the following values: if successful, pr_success.
PR_OpenTCPSocket
syntax #include <prio.h> prfiledesc* pr_opentcpsocket(printn af); parameters the function has the following parameters: af the address family of the new tcp socket.
... returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened tcp socket.
PR OpenUDPSocket
syntax #include <prio.h> prfiledesc* pr_openudpsocket(printn af); parameters the function has the following parameters: af the address family of the new udp socket.
... returns the function returns one of the following values: upon successful completion, a pointer to the prfiledesc object created for the newly opened udp socket.
PR_PopIOLayer
syntax #include <prio.h> prfiledesc *pr_popiolayer( prfiledesc *stack, prdescidentity id); parameters the function has the following parameters: stack a pointer to a prfiledesc object representing the stack from which the specified layer is to be removed.
... returns the function returns one of the following values: if the layer is successfully removed from the stack, a pointer to the removed layer.
PR_PushIOLayer
syntax #include <prio.h> prstatus pr_pushiolayer( prfiledesc *stack, prdescidentity id, prfiledesc *layer); parameters the function has the following parameters: stack a pointer to a prfiledesc object representing the stack.
... returns the function returns one of the following values: if the layer is successfully pushed onto the stack, pr_success.
PR_Read
syntax #include <prio.h> print32 pr_read(prfiledesc *fd, void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to a prfiledesc object for the file or socket.
... returns one of the following values: a positive number indicates the number of bytes actually read in.
PR_Recv
syntax #include <prio.h> print32 pr_recv( prfiledesc *fd, void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: a positive number indicates the number of bytes actually received.
PR_RecvFrom
syntax #include <prio.h> print32 pr_recvfrom( prfiledesc *fd, void *buf, print32 amount, printn flags, prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: a positive number indicates the number of bytes actually received.
PR_Rename
syntax #include <prio.h> prstatus pr_rename( const char *from, const char *to); parameters the function has the following parameters: from the old name of the file to be renamed.
... returns one of the following values: if file is successfully renamed, pr_success.
PR_Send
syntax #include <prio.h> print32 pr_send( prfiledesc *fd, const void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent.
PR_SendTo
syntax #include <prio.h> print32 pr_sendto( prfiledesc *fd, const void *buf, print32 amount, printn flags, const prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
... returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent.
PR_SetLibraryPath
returns the function returns one of the following values: if successful, pr_success.
...this allows an environment to express policy decisions globally and lazily, rather than hardcoding and distributing the decisions throughout the code.
PR_SetPollableEvent
syntax nspr_api(prstatus) pr_setpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent.
... returns the function returns one of the following values: if successful, pr_success.
PR_SetThreadPrivate
syntax #include <prthread.h> prstatus pr_setthreadprivate(pruintn index, void *priv); parameters pr_setthreadprivate has the following parameters: index an index into the per-thread private data table.
... returns the function returns one of the following values: if successful, pr_success.
PR_StringToNetAddr
syntax #include <prnetdb.h> prstatus pr_stringtonetaddr( const char *string, prnetaddr *addr); parameters the function has the following parameters: string the string to be converted.
... returns the function returns one of the following values: if successful, pr_success.
PR_Sync
syntax #include <prio.h> prstatus pr_sync(prfiledesc *fd); parameter the function has the following parameter: fd pointer to a prfiledesc object representing a file.
... returns the function returns one of the following values: on successful completion, pr_success.
PR_Unmap
syntax #include <prio.h> prstatus pr_memunmap( void *addr, pruint32 len); parameters the function has the following parameters: addr the starting address of the memory region to be unmapped.
... returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success.
PR_WaitCondVar
syntax #include <prcvar.h> prstatus pr_waitcondvar( prcondvar *cvar, printervaltime timeout); parameters pr_waitcondvar has the following parameters: cvar the condition variable on which to wait.
... returns the function returns one of the following values: if successful, pr_success.
PR_WaitForPollableEvent
syntax nspr_api(prstatus) pr_waitforpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent.
... returns the function returns one of the following values: if successful, pr_success.
PR_Write
syntax #include <prio.h> print32 pr_write( prfiledesc *fd, const void *buf, print32 amount); parameters the function has the following parameters: fd a pointer to the prfiledesc object for a file or socket.
... returns one of the following values: a positive number indicates the number of bytes successfully written.
PR_strtod
if the answer would overflow, a properly signed huge_val (infinity) is returned.
... if the answer would underflow, a properly signed 0 is returned.
Function_Name
the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance.
... see also copy of the mxr link, with the following text occurrences of function_name in the current nss source code (generated by mxr).
NSS CERTVerify Log
this allows multiple errors to be reported all at * once.
...*/ unsigned int depth; /* how far up the chain are we */ void *arg; /* error specific argument */ struct certverifylognodestr *next; /* next in the list */ struct certverifylognodestr *prev; /* next in the list */ }; the list is a doubly linked null terminated list sorted from low to high based on depth into the cert chain.
Deprecated SSL functions
the following ssl functions have been replaced with newer versions.
...applications that want to use the ssl shared libraries must convert to calling the new replacement functions listed below.
HTTP delegation
the api should allow nss to use the http client either asynchronously or synchronously.
...therefore the api should allow for keep-alive (persistent) http connections.
HTTP delegation
the api should allow nss to use the http client either asynchronously or synchronously.
...therefore the api should allow for keep-alive (persistent) http connections.
Build instructions for JSS 4.3.x
build instructions for jss 4.3.x newsgroup: mozilla.dev.tech.crypto before building jss, you need to set up your system as follows: build nspr/nss by following the nspr/nss build instructions, to check that nss built correctly, run all.sh (in mozilla/security/nss/tests) and examine the results (in mozilla/test_results/security/computername.#/results.html.
...follow these steps: switch to the appropriate directory and check out jss from the root of your source tree.
NSS 3.14.1 release notes
the bug fixes in nss 3.14.1 are described in the "bugs fixed" section below.
... bugs fixed in nss 3.14.1 the following bugzilla query returns all of the bugs fixed in nss 3.14.1: https://bugzilla.mozilla.org/buglist.cgi?list_id=5216669;resolution=fixed;query_format=advanced;bug_status=resolved;bug_status=verified;target_milestone=3.14.1;product=nss compatability nss 3.14.1 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.14.2 release notes
the bug fixes in nss 3.14.2 are described in the "bugs fixed" section below.
...support for other platforms, such as windows, will follow in a future nss release.
NSS 3.14.4 release notes
the bug fixes in nss 3.14.4 are described in the "bugs fixed" section below.
...nss 3.14.4 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_4_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.14.4.
NSS 3.14.5 release notes
the bug fixes in nss 3.14.5 are described in the "bugs fixed" section below.
...nss 3.14.5 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_14_5_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.14.5.
NSS 3.15.3.1 release notes
the bug fixes in nss 3.15.3.1 are described in the "bugs fixed" section below.
...nss 3.15.3.1 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_3_1_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.3.1.
NSS 3.15.3 release notes
the bug fixes in nss 3.15.3 are described in the "bugs fixed" section below.
...nss 3.15.3 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_3_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.3.
NSS 3.15.4 release notes
the bug fixes in nss 3.15.4 are described in the "bugs fixed" section below.
...nss 3.15.4 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_4_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.4.
NSS 3.16.2.1 release notes
the bug fixes in nss 3.16.2.1 are described in the "bugs fixed" section below.
... nss 3.16.2.1 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_2_1_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.16.2.1.
NSS 3.16.2 release notes
the bug fixes in nss 3.16.2 are described in the "bugs fixed" section below.
... 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.
NSS 3.16.5 release notes
the bug fixes in nss 3.16.5 are described in the "bugs fixed" section below.
... nss 3.16.5 source distributions are also available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_5_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.16.5.
NSS 3.17.1 release notes
the bug fixes in nss 3.17.1 are described in the "bugs fixed" section below.
... nss 3.17.1 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_1_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.17.1.
NSS 3.18 release notes
the following ca certificates had the websites and code signing trust bits turned off ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a cn = equifax secure global ebusiness ca-1 sha1 fingerprint: 7e:78:4a:10:1c:82:65:cc:2d:e1:f1:6d:47:b4:40:ca:d9:0a:19:45 cn = tc trustcenter class 3 ca i...
...i sha1 fingerprint: 80:25:ef:f4:6e:70:c8:d4:72:24:65:84:fe:40:3b:8a:8d:6a:db:f5 the following ca certificates were added cn = staat der nederlanden root ca - g3 sha1 fingerprint: d8:eb:6b:41:51:92:59:e0:f3:e7:85:00:c0:3d:b6:88:97:c9:ee:fc cn = staat der nederlanden ev root ca sha1 fingerprint: 76:e2:7e:c1:4f:db:82:c1:c0:a6:75:b5:05:be:3d:29:b4:ed:db:bb cn = identrust commercial root ca 1 sha1 fingerprint: df:71:7e:aa:4a:d9:4e:c9:55:84:99:60:2d:48:de:5f:bc:f0:3a:25 cn = identrust public sector root ca 1 sha1 fingerprint: ba:29:41:60:77:98:3f:f4:f3:ef:f2:31:05:3b:2e:ea:6d:4d:45:fd cn = s-trust universal root ca sha1 fingerprint: 1b:3d:11:14:ea:7a:0f:95:58:54:41:95:bf:...
NSS 3.19.2.3 release notes
the bug fixes in nss 3.19.2.3 are described in the "security fixes" section below.
... security fixes in nss 3.19.2.3 bug 1245528 / cve-2016-1950 - fixed a heap-based buffer overflow related to the parsing of certain asn.1 structures.
NSS 3.19.2.4 release notes
the bug fixed in nss 3.19.2.4 have been described in the "security fixes" section below.
... security fixes in nss 3.19.2.4 the following security fixes from nss 3.21 have been backported to nss 3.19.2.4: bug 1185033 / cve-2016-1979 - use-after-free during processing of der encoded keys in nss bug 1209546 / cve-2016-1978 - use-after-free in nss during ssl connections in low memory bug 1190248 / cve-2016-1938 - errors in mp_div and mp_exptmod cryptographic functions in nss compatibility nss 3.19.2.4 shared libraries are b...
NSS 3.21.1 release notes
the bug fixes in nss 3.21.1 are described in the "security fixes" section below.
... security fixes in nss 3.21.1 bug 1245528 / cve-2016-1950 - fixed a heap-based buffer overflow related to the parsing of certain asn.1 structures.
NSS 3.21 release notes
nfo_cipher_suite - used with sslpreliminarychannelinfo to indicate that a tls cipher suite has been selected ssl_preinfo_all - used with sslpreliminarychannelinfo to indicate that all preliminary information has been set notable changes in nss 3.21 nss now builds with elliptic curve ciphers enabled by default (bug 1205688) nss now builds with warnings as errors (bug 1182667) the following ca certificates were removed cn = verisign class 4 public primary certification authority - g3 sha1 fingerprint: c8:ec:8c:87:92:69:cb:4b:ab:39:e9:8d:7e:57:67:f3:14:95:73:9d cn = utn-userfirst-network applications sha1 fingerprint: 5d:98:9c:db:15:96:11:36:51:65:64:1b:56:0f:db:ea:2a:c2:3e:f1 cn = tc trustcenter universal ca iii sha1 fin...
...(c) kasım 2005 sha-1 fingerprint: b4:35:d4:e1:11:9d:1c:66:90:a7:49:eb:b3:94:bd:63:7b:a7:82:b7 the following ca certificate had the websites trust bit turned off ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the following ca certificates were added cn = certification authority of wosign g2 sha1 fingerprint: fb:ed:dc:90:65:b7:27:20:37:bc:55:0c:9c:56:de:bb:f2:78:94:e1 c...
NSS 3.22.2 release notes
the bug fixes in nss 3.22.2 are described in the "security fixes" section below.
... security fixes in nss 3.22.2 bug 1245528 / cve-2016-1950 - fixed a heap-based buffer overflow related to the parsing of certain asn.1 structures.
NSS 3.22 release notes
nss 3.22 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_22_rtm/src/ new in nss 3.22 new functionality rsa-pss signatures are now supported (bug 1215295) new functions pk11_signwithmechanism() and pk11_signwithmechanism() are provided to allow rsa keys to be used with pss.
... in ssl.h ssl_peersignedcerttimestamps - get signed_certificate_timestamp tls extension data ssl_setsignedcerttimestamps - set signed_certificate_timestamp tls extension data new types in secoidt.h the following are added to secoidtag: sec_oid_aes_128_gcm sec_oid_aes_192_gcm sec_oid_aes_256_gcm sec_oid_idea_cbc sec_oid_rc2_40_cbc sec_oid_des_40_cbc sec_oid_rc4_40 sec_oid_rc4_56 sec_oid_null_cipher sec_oid_hmac_md5 sec_oid_tls_rsa sec_oid_tls_dhe_rsa sec_oid_tls_dhe_dss sec_oid_tls_dh_rsa sec_oid_tls_dh_dss sec_oid_tls...
NSS 3.27.1 release notes
nss 3.27 set this value on by default, allowing tls 1.3 (draft) to be disabled using nss_disable_tls_1_3, although the maximum version used by default remained tls 1.2.
... bugs fixed in nss 3.27.1 the following bug has been fixed in nss 3.27.1: re-disable tls 1.3 by default compatibility nss 3.27.1 shared libraries are backwards compatible with all older nss 3.x shared libraries.
NSS 3.27 release notes
nss 3.27 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_27_rtm/src/ new in nss 3.27 new functionality allow custom named group priorities for tls key exchange handshake (ssl_namedgroupconfig).
... the following ca certificates were removed cn = igc/a, o = pm/sgdn, ou = dcssi sha256 fingerprint: b9:be:a7:86:0a:96:2e:a3:61:1d:ab:97:ab:6d:a3:e2:1c:10:68:b9:7d:55:57:5e:d0:e1:12:79:c1:1c:89:32 cn = juur-sk, o = as sertifitseerimiskeskus sha256 fingerprint: ec:c3:e9:c3:40:75:03:be:e0:91:aa:95:2f:41:34:8f:f8:8b:aa:86:3b:22:64:be:fa:c8:07:90:15:74:e9:39 cn = ...
NSS 3.28.3 release notes
the bug fixes in nss 3.28.3 are described in the "bugs fixed" section below.
...that size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ecpublickey, ecprivatekey, nsslowkeypublickey, nsslowkeyprivatekey, or potentially other data structures that reference ecparams.
NSS 3.28 release notes
ssl_signatureschemeprefset allows an application to set which signature schemes should be supported in tls and to specify the preference order of those schemes.
... ssl_signatureschemeprefget allows an application to learn the currently supported and enabled signature schemes for a socket.
NSS 3.29.1 release notes
the bug fixes in nss 3.29.1 are described in the "bugs fixed" section below.
...that size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ecpublickey, ecprivatekey, nsslowkeypublickey, nsslowkeyprivatekey, or potentially other data structures that reference ecparams.
NSS 3.32 release notes
the websites (tls/ssl) trust bit was turned off for the following root certificates.
... cn = addtrust class 1 ca root sha-256 fingerprint: 8c:72:09:27:9a:c0:4e:27:5e:16:d0:7f:d3:b7:75:e8:01:54:b5:96:80:46:e3:1f:52:dd:25:76:63:24:e9:a7 cn = swisscom root ca 2 sha-256 fingerprint: f0:9b:12:2c:71:14:f4:a0:9b:d4:ea:4f:4a:99:d5:58:b4:6e:4c:25:cd:81:14:0d:29:c0:56:13:91:4c:38:41 the following ca certificates were removed: cn = addtrust public ca root sha-256 fingerprint: 07:91:ca:07:49:b2:07:82:aa:d3:c7:d7:bd:0c:df:c9:48:58:35:84:3e:b2:d7:99:60:09:ce:43:ab:6c:69:27 cn = addtrust qualified ca root sha-256 fingerprint: 80:95:21:08:05:db:4b:bc:35:5e:44:28:d8:fd:6e:c2:cd:e3:ab:5f:b9:7a:99:42:98:8e:b8:f4:dc:d0:60:16 cn = china internet network information center ev certificates root ...
NSS 3.34 release notes
nss 3.34 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_34_rtm/src/ notable changes in nss 3.34 the following ca certificates were added: cn = gdca trustauth r5 root sha-256 fingerprint: bf:ff:8f:d0:44:33:48:7d:6a:8a:a6:0c:1a:29:76:7a:9f:c2:bb:b0:5e:42:0f:71:3a:13:b9:92:89:1d:38:93 trust flags: websites cn = ssl.com root certification authority rsa sha-256 fingerprint: 85:66:6a:56:2e:e0:be:5c:e9:25:c1:d8:89:0a:6f:76:a8:7e:c1:6d:4d:7d:5f:29:ea:74:19:cf:20:12:...
... trustcor rootcert ca-2 sha-256 fingerprint: 07:53:e9:40:37:8c:1b:d5:e3:83:6e:39:5d:ae:a5:cb:83:9e:50:46:f1:bd:0e:ae:19:51:cf:10:fe:c7:c9:65 trust flags: websites, email cn = trustcor eca-1 sha-256 fingerprint: 5a:88:5d:b1:9c:01:d9:12:c5:75:93:88:93:8c:af:bb:df:03:1a:b2:d4:8e:91:ee:15:58:9b:42:97:1d:03:9c trust flags: websites, email the following ca certificates were removed: cn = certum ca, o=unizeto sp.
NSS 3.37 release notes
nss allows servers now to register alpn handling callbacks to select a protocol.
... the following ca certificates were removed: cn = s-trust universal root ca sha-256 fingerprint: d8:0f:ef:91:0a:e3:f1:04:72:3b:04:5c:ec:2d:01:9f:44:1c:e6:21:3a:df:15:67:91:e7:0c:17:90:11:0a:31 cn = tc trustcenter class 3 ca ii sha-256 fingerprint: 8d:a0:84:fc:f9:9c:e0:77:22:f8:9b:32:05:93:98:06:fa:5c:b8:11:e1:c8:13:f6:a1:08:c7:d3:36:b3:40:8e cn = tÜrktrust e...
NSS 3.39 release notes
the following ca certificates were added: ou = globalsign root ca - r6 sha-256 fingerprint: 2cabeafe37d06ca22aba7391c0033d25982952c453647349763a3ab5ad6ccf69 cn = oiste wisekey global root gc ca sha-256 fingerprint: 8560f91c3624daba9570b5fea0dbe36ff11a8323be9486854fb3f34a5571198d the following ca certificate was removed: cn = comsign sha-25...
...6 fingerprint: ae4457b40d9eda96677b0d3c92d57b5177abd7ac1037958356d1e094518be5f2 the following ca certificates had the websites trust bit disabled: cn = certplus root ca g1 sha-256 fingerprint: 152a402bfcdf2cd548054d2275b39c7fca3ec0978078b0f0ea76e561a6c7433e cn = certplus root ca g2 sha-256 fingerprint: 6cc05041e6445e74696c4cfbc9f80f543b7eabbb44b4ce6f787c6a9971c42f17 cn = opentrust root ca g1 sha-256 fingerprint: 56c77128d98c18d91b4cfdffbc25ee9103d4758ea2abad826a90f3457d460eb4 cn = opentrust root ca g2 sha-256 fingerprint: 27995829fe6a7515c1bfe848f9c4761db16c225929257bf40d0894f29ea8baf2 cn = opentrust root ca g3 sha-256 fingerprint: b7c36231706e81078c367cb896198f1e3208dd926949...
NSS 3.41 release notes
bug 1493215 - enabled the following ciphersuites by default: tls_ecdhe_ecdsa_with_aes_256_gcm_sha384 tls_ecdhe_rsa_with_aes_256_gcm_sha384 tls_dhe_rsa_with_aes_256_gcm_sha384 tls_rsa_with_aes_256_gcm_sha384 new functions none notable changes in nss 3.41 the following ca certificates were added: cn = certigna root ca sha-256 fingerprint: d48d3d23eedb50a459e55197601c27774b9d7b18c94d5a059511a10250...
...babce5 cn = gts root r4 sha-256 fingerprint: 71cca5391f9e794b04802530b363e121da8a3043bb26662fea4dca7fc951a4bd cn = uca global g2 root sha-256 fingerprint: 9bea11c976fe014764c1be56a6f914b5a560317abd9988393382e5161aa0493c cn = uca extended validation root sha-256 fingerprint: d43af9b35473755c9684fc06d7d8cb70ee5c28e773fb294eb41ee71722924d24 the following ca certificates were removed: cn = ac raíz certicámara s.a.
NSS 3.44 release notes
nss test certificates, use @example.com (not @bogus.com) 1538479 - post-handshake messages after async server authentication break when using record layer separation 1521578 - x25519 support in pk11pars.c 1540205 - freebl build fails with -dnss_disable_chachapoly 1532312 - post-handshake auth doesn't interoperate with openssl 1542741 - certutil -f crashes with segmentation fault 1546925 - allow preceding text in try comment 1534468 - expose chacha20 primitive 1418944 - quote cc/cxx variables passed to nspr 1543545 - allow to build nss as a static library 1487597 - early data that arrives before the handshake completes can be read afterwards 1548398 - freebl_gtest not building on linux/mac 1548722 - fix some coverity warnings 1540652 - softoken/sdb.c: logically dead code 1549413 ...
...- android log lib is not included in build 1537927 - ipsec usage is too restrictive for existing deployments 1549608 - signature fails with dbm disabled 1549848 - allow building nss for ios using gyp 1549847 - nss's sqlite compilation warnings make the build fail on ios 1550041 - freebl not building on ios simulator 1542950 - macos cipher test timeouts this bugzilla query returns all the bugs fixed in nss 3.44: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.44 compatibility nss 3.44 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.45 release notes
this will likely prompt follow-on work, but please accept our apologies in the meantime.
... certificate authority changes the following ca certificates were removed: bug 1552374 - cn = certinomis - root ca sha-256 fingerprint: 2a99f5bc1174b73cbb1d620884e01c34e51ccb3978da125f0e33268883bf4158 bugs fixed in nss 3.45 bug 1540541 - don't unnecessarily strip leading 0's from key material during pkcs11 import (cve-2019-11719) bug 1515342 - more thorough input checking (cve-2019-11729) bug 1552208 - prohibit use of rsassa-pkcs1-v1_5 algorithms in tls 1.3 (cve-2019-11727) bug 1227090 - fix a potential divide-by-zero in makepfromqandseed from lib/freebl/pqg.c (static analysis) bug 1227096 - fix a potential divide-by-zero in pqg_verifyparams from lib/freebl/pqg.c (static analysis) bug 1509432 - de-duplicate code between mp_set_long and...
NSS 3.52 release notes
bug 1624864 - allow building of gcm-arm32-neon on non-armv7 architectures.
... bug 1622555 - fix argument parsing in lowhashtest.
NSS 3.54 release notes
certificate authority changes the following ca certificates were added: bug 1645186 - certsign root ca g2 sha-256 fingerprint: 657cfe2fa73faa38462571f332a2363a46fce7020951710702cdfbb6eeda3305 bug 1645174 - e-szigno root ca 2017 sha-256 fingerprint: beb00b30839b9bc32c32e4447905950641f26421b15ed089198b518ae2ea1b99 bug 1641716 - microsoft ecc root certificate authority 2017 sha-2...
...56 fingerprint: 358df39d764af9e1b766e9c972df352ee15cfac227af6ad1d70e8e4a6edcba02 bug 1641716 - microsoft rsa root certificate authority 2017 sha-256 fingerprint: c741f70f4b2a8d88bf2e71c14122ef53ef10eba0cfa5e64cfa20f418853073e0 the following ca certificates were removed: bug 1645199 - addtrust class 1 ca root sha-256 fingerprint: 8c7209279ac04e275e16d07fd3b775e80154b5968046e31f52dd25766324e9a7 bug 1645199 - addtrust external ca root sha-256 fingerprint: 687fa451382278fff0c8b11f8d43d576671c6eb2bceab413fb83d965d06d2ff2 bug 1641718 - luxtrust global root 2 sha-256 fingerprint: 54455f7129c20b1447c418f997168f24c58fc5023bf5da5be2eb6e1dd8902ed5 bug 1639987 - staat der nederlanden r...
Build instructions
you can install the new assembler as root as follows: yum install binutils220 you can then use the new assembler by adding /usr/libexec/binutils220 to the beginning of your build path.
... this can be done in sh or bash as follows: export path=/usr/libexec/binutils220:$path the following build instructions should work for all platforms (with some platform-specific changes as noted).
Migration to HG
however, below is a brief summary that shows how to checkout the source code and build both nspr and nss: mkdir workarea cd workarea hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss cd nss # set use_64=1 on 64 bit architectures # set build_opt=1 to get an optimized build make nss_build_all note that the jss project has been given a pr...
...ivate copy of the former mozilla/security/coreconf directory, allowing it to remain stable, and only update its build system as necessary.
FC_InitPIN
the module only allows the pkcs #11 so to log in if the normal user's pin has not yet been set or has been reset.
... return value fc_initpin() returns the following return codes.
FC_Initialize
the pinitargs argument must point to a ck_c_initialize_args structure whose members should have the following values: createmutex should be null.
...return value fc_initialize returns the following return codes.
FC_Login
the nss cryptographic module doesn't allow the so to log in if the normal user's pin is already initialized.
... return value fc_login() returns the following return codes.
NSC_InitToken
syntax ck_rv nsc_inittoken( ck_slot_id slotid, ck_char_ptr ppin, ck_ulong ulpinlen, ck_char_ptr plabel ); parameters nsc_inittoken() has the following parameters: slotid the id of the token's slot ppin the password of the security officer (so) ulpinlen the length in bytes of the so password plabel points to the label of the token, which must be padded with spaces to 32 bytes and not be null-terminated description nsc_inittoken() initializes a brand new token or re-initializes a token that was initialized before.
... return value nsc_inittoken() returns the following return codes.
NSC_Login
the nss cryptographic module doesn't allow the so to log in if the normal user's pin is already initialized.
... return value nsc_login() returns the following return codes.
NSS_Initialize
the flags parameter is a bitwise or of the following flags: nss_init_readonly - open the databases read only.
...the following limitation applies when this is set : secmod_waitforanytokenevent will not use c_waitforslotevent, in order to prevent the need for c_finalize.
NSS reference
the proposed chapters below are based on the chapters of the ssl reference and the categories of functions in nss public functions.
...dpasswordintegrity sec_pkcs12enablecipher sec_pkcs12encode sec_pkcs12destroyexportcontext sec_pkcs12decoderstart sec_pkcs12decoderimportbags sec_pkcs12decoderupdate sec_pkcs12decoderfinish sec_pkcs12decodervalidatebags sec_pkcs12decoderverify sec_pkcs12decodergetcerts sec_pkcs12decodersettargettokencas sec_pkcs12decoderiterateinit sec_pkcs12decoderiteratenext sec_pkcs12isencryptionallowed sec_pkcs12setpreferredcipher nspr functions a small number of nspr functions are required for using the certificate verification and ssl functions in nss.
SSL functions
in addition to the functions listed here, applications that support ssl use some of the certificate functions, crypto functions, and utility functions described below on this page.
... if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference.
NSS Tools
nss security tools newsgroup: mozilla.dev.tech.crypto overview the nss security tools allow developers to test, debug, and manage applications that use nss.
... the tools information table below describes both the tools that are currently working and those that are still under development.
NSS Tools certutil-tasks
allow for sorting by name and trust.
... allow listing and lookup of keys by index and nickname.
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.
...the options and arguments for the cmsutil command are defined as follows: options -ddecode a message.
NSS tools : signver
MozillaProjectsNSStoolssignver
nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues.
... by default, the tools (certutil, pk12util, modutil) assume that the given security databases follow the more common legacy type.
Pork Tools
if (!*aresult) return ns_error_failure; return ns_ok; } nsifoo* getter() { nsifoo *result = null; // aresult below is kept for complicated cases // typically it wont be needed and can be removed nsifoo **aresult = &result; // *aresult patterns are replaced with result result = ...
...then nuke the declaration // nsresult rv; // move outparam to lhs var = getter(); // detect ns_ensure_success immediately following // and change it to an equivalent ns_ensure_true ns_ensure_true(var, ns_error_failure); // case 2 var = getter(); // case 3, eliminate rv2 decl given that it's not used elsewhere var = getter(); ns_ensure_true(var, ns_error_failure) } outparamdel also support rewriting getters such that they return already_addrefed<nsifoo>.
Pork
this information allows c++ to be automatically rewritten in a precise way.
...please refer to the oink link below for a more up-to-date toolchain.
Rhino Examples
sample scripts the unique.js script allows printing unique lines from a file.
...sharing the global scope allows both information to be shared across threads, and amortizes the cost of context.initstandardobjects by only performing that expensive operation once.
Small Footprint
optimizer it is possible to run rhino with interpreter mode only, allowing you to remove code for classfile generation that include all the classes from <tt>org.mozilla.javascript.optimizer</tt> package.
...to build such minimalist jar without debug information, run the following command from the top directory of rhino distribution: ant clean ant -ddebug=off -dno-regexp=true -dno-e4x=true smalljar if you omit -dno-regexp=true, then the resulting smalljs.jar will include regular expression support.
Rhino shell
the following properties of the option object are processed: args - provides an array of additional command arguments env - explicit environment object.
... $ java org.mozilla.javascript.tools.shell.main -e "print('hi')" hi $ java org.mozilla.javascript.tools.shell.main js> print('hi') hi js> 6*7 42 js> function f() { return a; } js> var a = 34; js> f() 34 js> quit() $ cat echo.js for (i in arguments) { print(arguments[i]) } $ java org.mozilla.javascript.tools.shell.main echo.js foo bar foo bar $ spawn and sync the following example creates 2 threads via spawn and uses sync to create a synchronized version of the function test.
Creating JavaScript tests
writing a new test file have a look at the existing files and follow what they do.
...these tests will also show up as infrequent oranges on our heavily loaded test machines, lowering the value of our test suite for everyone.
Statistics API
the following adds an observer using the jetpack framework.
...in between slices, other browser code is allowed to run.
SpiderMonkey Internals: Thread Safety
*/ js_endrequest(cx); js_clearcontextthread(cx); it isn't a bottleneck; multiple threads are allowed to be in requests on the same jsruntime at once.
...this allows allocation to avoid locking most of the time (a significant speed win).
Self-hosted builtins in SpiderMonkey
most importantly, it's possible to invoke any function within the scope of any object using the syntax callfunction(fun, receiver, ...args) (or callcontentfunction, see below), which causes fun to be called within the scope of receiver with ...args as its arguments.
...a select set of c++-implemented builtins is installed via the intrinsic_functions array in selfhosting.cpp, as described below.
JIT Optimization Outcomes
disabled the optimization has been explicitly disallowed.
...for example, if the array has sparse indexes, or has indexes that overflow the array's length, the optimization strategy may fail.
INT_FITS_IN_JSVAL
description determines if a specified c integer value, i, lies within the range allowed for integer jsvals.
... example the following code snippet illustrates how a c variable, item, is conditionally tested in an if statement to see if it is a legal jsval integer value.
JS::PersistentRooted
initialization may take place on construction, or in two phases if the no-argument constructor is called followed by init().
...sistentrooted<jsid> persistentrootedid; typedef persistentrooted<jsobject*> persistentrootedobject; typedef persistentrooted<jsscript*> persistentrootedscript; typedef persistentrooted<jsstring*> persistentrootedstring; typedef persistentrooted<js::symbol*> persistentrootedsymbol; // added in spidermonkey 38 typedef persistentrooted<value> persistentrootedvalue; } example following example allocates persistentrootedvalue, and provides two functions for setting and getting it from javascript.
JS::Value
(note that both -0 and +0 are allowed, and the latter may sometimes be stored using the int32_t representation.) js::value further provides these methods combining various aspects of the above methods: js::objectornullvalue(jsobject*) returns an object value corresponding to the given non-null pointer, or a null value if the pointer is null.
...the now-deprecated jsval methods allowed jsval_to_object(val) when jsval_is_null(val), but this was a source of constant bugs.
JSFastNative
vp jsval * the arguments, including the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below.
... description the callback should use the following macros to access the fields of vp: macro name description js_callee(cx, vp) returns the function object that was called, as a jsval.
JSGetObjectOps
thus jsclass (which pre-dates jsobjectops in the api) provides a low-level interface to class-specific code and data, while jsobjectops allows for a higher level of operation, which does not use the object's class except to find the class's jsobjectops struct, by calling clasp->getobjectops, and to finalize the object.
... jsclass hooks jsclass offerd following hook: the jsclass.getobjectops hook is called each time an object is created.
JSNative
vp js::value * the arguments, the this argument, the return-value slot, and the callee function object are accessible through this pointer using macros described below.
...this has limited use cases; it's used to implement firefox's "slow script" dialog, for example.) when a jsnative is called, no jsstackframe is generated.
JSObjectOps.getProperty
each of these callbacks is responsible for everything involved with an individual property access operation, including: any locking necessary for thread safety; security checks; finding the property, including walking the prototype chain if needed; calling the lower-level jsclass hooks; calling getters or setters; and actually getting, setting, or deleting the property once it is found.
...see the description section below.
JSReserveSlotsOp
jsclass hooks jsclass offers the following hook: the jsclass.reserveslots callback is called each time a new object is created.
... the optional jsclass.reserveslots hook allows a class to make computed per-instance object slots reservations, in addition to or instead of using jsclass_has_reserved_slots(n) in the jsclass.flags initializer to reserve a constant-per-class number of slots.
JS_AddFinalizeCallback
status jsfinalizestatus one of the jsfinalizestatus constants, described below, indicating the stage of finalize.
...it was replaced with js_addfinalizecallback, to allow adding multiple callback functions.
JS_CheckAccess
it is one of the following values: value description jsacc_proto check for permission to read to obj's prototype.
... the access check proceeds as follows.
JS_FS
js_fninfo allows the simple adding of jsjitinfos.
...the _sym variants allow defining a function with a symbol key rather than a string key.
JS_GetProperty
the full algorithm is described below.
...if the lookup proceeds without error, exactly one of the following cases applies: if the property is not found, then *vp is set to undefined.
JS_NewRegExpObject
see below.
... flags name description regexp constructor flag jsreg_fold fold uppercase to lowercase.
JS_PushArguments
format const char * null-terminated string holding a list of format types to convert the following arguments to.
...format can contain one or more instances of the following characters, as appropriate: character argument type b jsbool c uint16 (16-bit, unsigned integer) i int32 (32-bit, ecma-compliant signed integer) u uint32 (32-bit, ecma-compliant, unsigned integer) j int32 (32-bit, signed integer) d jsdouble i jsdouble (converted to an integer value) s ch...
JS_SuspendRequest
suspends the calling thread's current request, if any, to allow the thread to block or perform time-consuming calculations.
...this allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked.
JS_YieldRequest
momentarily suspend the current jsapi request, allowing garbage collection to run if another thread has requested it.
...the effect is the same as a call to js_suspendrequest immediately followed by a call to js_resumerequest.
TPS Formdata Lists
a formdata asset list is an array of objects, each with the following properties: fieldname: required.
... for example: var formdata1 = [ { fieldname: "testing", value: "success", date: -1 }, { fieldname: "testing", value: "failure", date: -2 }, { fieldname: "username", value: "joe" } ]; formdata lists and phase actions you can use the following functions in phase actions for formdata lists: formdata.add formdata.delete formdata.verify formdata.verifynot for an example, see the tps formdata unittest: http://hg.mozilla.org/services/tps/f...st_formdata.js notes note 1, tps supports the delete action for formdata, but sync currently does not correctly sync deleted form data, see bug 564296.
TPS Password Lists
word_list = [ { hostname: "http://www.example.com", submiturl: "http://login.example.com", username: "joe", password: "secret123", usernamefield: "uname", passwordfield: "pword", changes: { password: "zippity-do-dah" } }, { hostname: "http://www.example.com", realm: "login", username: "joe", password: "secretlogin" } ]; each object has the following properties: hostname: the hostname for the password.
... password lists and phase actions following are the functions that can be used in phase actions related to passwords: passwords.add passwords.delete passwords.modify passwords.verify passwords.verifynot ...
TPS Tab Lists
a tabs asset list is an array of objects with the following keys: uri: the uri of the tab, required.
...i: "http://hg.mozilla.org/automation/crossweave/raw-file/2d9aca9585b6/pages/page1.html", title: "crossweave test page 1", profile: "profile1" }, { uri: "data:text/html,<html><head><title>hello</title></head><body>hello</body></html>", title: "hello", profile: "profile1" } ]; tab lists and phase actions tabs cannot be modified or deleted, only added or verified with the following functions: tabs.add - opens the specified tabs in the browser window.
Redis Tips
(this is, for instance, how tj holowaychuk's implemented kue: https://github.com/learnboost/kue.) memory usage in redis is important to think about.
... the speed benefits of redis are lost when you overflow into disk memory.
Security and the jar protocol
however, if a site allows file uploads, zip files are typically treated as relatively innocuous by web sites in that situation, since they're not executable.
... so starting with gecko 1.8.0.15 and 1.8.1.10, the jar: protocol is only allowed if the mime type of the file is application/java-archive.
Setting up an update server
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.
... if you'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.
Gecko states
« at apis support page introduction below you will find a list of supported states by gecko.
...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.
Using the Places annotation service
expiration: the expiration time for the annotation (see "lifetime of annotations" below).
...this allows you to link directly to data stored in the annotation service.
Preferences API
preferences api allows you to save and read strings, numbers, booleans, and references to files to the preferences store.
... you can also create a xul-based options window easily to allow user modify some preferences.
extIApplication
method overview boolean quit() boolean restart() void getextensions(extiextensionscallback acallback) attributes the following interfaces are available to all applications: attribute type description id readonly attribute astring the id of the application.
...supports: "load", "ready", "quit", "unload" the following interfaces are only available to firefox: attribute type description bookmarks readonly attribute fuelibookmarkroots the root bookmarks object for the application.
Generating GUIDs
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.
... 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:21:2}, 0x${uuid:24:2}, " echo -n "0x${uuid:26:2}, 0x${uuid:28:2}, 0x${uuid:30:2}, " echo "0x${uuid:32:2}, 0x${uuid:34:2} } }" } perl #!/usr/bin/perl $uuid = `uuidgen`; chomp $uuid; print $uuid, "\n"; @parts = ($uuid =~ /^(.{8})-(.{4})-(.{4})-(..)(..)-(..)(..)(..)(..)(..)(..)$/); print "{ 0x$parts[0], 0x$parts[1], 0x$parts[2], \\", "\n", " { "; for (3 ..
Generic factory
examples class nsicomponent : public nsisupports { public: ns_imethod dosomething() = 0; }; class mycomponent : public nsicomponent { public: mycomponent(); virtual ~mycomponent(); static ns_method create(nsisupports *aouter, refnsiid aiid, void **aresult); ns_impl_isupports ns_imethod dosomething(); }; to create a factory for this class, simply write the following: nsifactory* newcomponentfactory(nsirepository* repository) { nsigenericfactory* factory = null; nscid kgenericfactorycid = ns_genericfactory_cid; nsresult res = repository->createinstance(kgenericfactorycid, null, nsigenericfactory::iid(), &factory); if (res == ns_ok) { factory->setconstructor(&mycomponent::create); } return factory; } this example assumes t...
...it seems to me that we can cut down on code size (all those queryinterface, addref, release implementations) if we just use the following class for all of the simple factories: // idea: why not create a generic factory facility so we can avoid // duplication of so much nsifactory code?
Creating XPCOM components
accordingly, the book is arranged so that you can follow along and create your own components or learn about different xpcom topics individually, as in a reference work.
... preface who should read this book organization of the tutorial following along with the examples conventions acknowledgements an overview of xpcom the xpcom solution gecko components interfaces interfaces and encapsulation the nsisupports base interface xpcom identifiers cid contract id factories xpidl and type libraries xpcom services xpcom types method types reference counting status codes variable mappings co...
Components.Constructor
another important benefit is that it precomputes some of the computation it does, so using a function returned from components.constructor() to create xpcom objects is faster than creating the object from base principles, as demonstrated below.
...it is equivalent to the following javascript function: function components_constructor(contractid, interfacename, initializer) { var ccargs = arguments; function ctor() { var instance = components.classes[contractid] .createinstance(components.interfaces.nsisupports); if (ccargs.length > 1) { instance.queryinterface(components.interfaces[interfacename]); if (ccargs...
Components.classes
usage in order to retrieve the object for a given contractid, you can query the components.classes array as follows: var clazz0 = components.classes["@mozilla.org/messenger;1"]; clazz0 is the class object for the contractid @mozilla.org/messenger;1, which is not usually used by itself, but whose createinstance and getservice methods can be used to create a new instance of the component or to access the singleton instance, if the contract id represents a service.
... a new xpcom component instance can be created from the returned class object as follows: var obj = components.classes["@mozilla.org/supports-array;1"] .createinstance(components.interfaces.nsisupportsarray); which is a shortcut to var obj = components.classes["@mozilla.org/supports-array;1"] .createinstance(); obj.queryinterface(components.interfaces.nsisupportsarray); if you don't provide a specific interface to createinstance(), it will return an xpconnect wrapper for the component, which only exposes the methods of the nsisupports interface (and under certain circumstances the special wrappedjsobject property).
Components.isSuccessCode
components.issuccesscode() is functionally equivalent to the following javascript: function issuccesscode(returncode) { return (returncode & 0x80000000) === 0; } since failure error codes are turned into exceptions when encountered in javascript, this function usually is not necessary.
... examples checking whether copying a stream's data succeeded the following example demonstrates copying data from a buffered nsiinputstream to an nsioutputstream, checking for whether the copy succeeded using components.issuccesscode().
JavaXPCOM
javaxpcom allows for communication between java and xpcom, such that a java application can access xpcom objects, and xpcom can access any java class that implements an xpcom interface.
... embedding mozilla in a java application using javaxpcom xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects.
HOWTO
put the following at the end of your script: // do async processing // from <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> print("doing async work"); gscriptdone = false; var gthreadmanager = cc["@mozilla.org/thread-manager;1"] .getservice(ci.nsithreadmanager); var mainthread = gthreadmanager.currentthread; while (!gscriptdone) mainthread.processnextevent(true); while (mainthread.haspendingevents()) mainthread.processnextevent(true); 2.
...t: "0x80040111 (ns_error_not_available)" location: "js frame :: file.js :: <top_level> :: line 12" data: no] solution 1 var loader = components.classes["@mozilla.org/moz/jssubscript-loader;1"] .getservice(components.interfaces.mozijssubscriptloader); loader.loadsubscript("chrome://myall/content/file.jsm"); see: http://mxr.mozilla.org/comm-central/...figutils.js#54 solution 2 append the following at the top of your js file which you want to run in xpcshell { // <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> // <https://bugzilla.mozilla.org/show_bug.cgi?id=546628> let cc = components.classes; let ci = components.interfaces; // register resource://app/ uri let ios = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice); let reshandler = ios.
NS_InitXPCOM3
some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes.
...initializing xpcom with static modules allows the application to easily define modules that are linked into the application's executable.
NS_NewLocalFile
#include "nsxpcom.h" #include "nsilocalfile.h" nsresult ns_newlocalfile( const nsastring& apath, prbool afollowlinks, nsilocalfile** aresult ); parameters apath [in] a utf-16 string object that specifies an absolute filesystem path.
... afollowlinks [in] this attribute will determine if the nsilocalfile instance will automatically resolve symbolic links.
NS_NewNativeLocalFile
#include "nsxpcom.h" #include "nsilocalfile.h" nsresult ns_newnativelocalfile( const nsacstring& apath, prbool afollowlinks, nsilocalfile** aresult ); parameters apath [in] a string object that specifies an absolute filesystem path.
... afollowlinks [in] this attribute will determine if the nsilocalfile instance will automatically resolve symbolic links.
NS ConvertASCIItoUTF16 external
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstring_external data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
NS ConvertUTF8toUTF16 external
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstring_external data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
NS_OVERRIDE
ns_override is a macro which allows c++ code in mozilla to specify that a method is intended to override a base class method.
...a compiler with static-checking enabled will issue the following error: test.cpp:8: error: ns_override function b::getfoo(nsifoo**) does not override a base class method with the same name and signature.
PromiseFlatString (External)
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsAString (External)
reading charat operator[] first beginwriting endwriting setlength length isempty setisvoid isvoid assign assignliteral operator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger data members no public members.
... parameters nsastring& other prbool operator>(const prunichar*) const - source parameters prunichar* other operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsAutoString (External)
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsDependentString external
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstring_external data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsDependentSubstring external
stripwhitespace trim defaultcomparator compare(const prunichar*, print32 (*) compare(const nsastring&, print32 (*) equals(const prunichar*, print32 (*) equals(const nsastring&, print32 (*) operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find(const nsastring&, print32 (*) find(const nsastring&, pruint32, print32 (*) find rfind(const nsastring&, print32 (*) rfind(const nsastring&, print32, print32 (*) rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring other prbool operator!=(const prunichar*) const - source parameters prunichar other equalsliteral prbool equalsliteral(const char*) const - source parameters char aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsStringContainer (External)
erator= replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsastring data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
nsString external
literal replace append appendliteral operator+= insert cut truncate stripchars stripwhitespace trim defaultcomparator compare equals operator< operator<= operator== operator>= operator> operator!= equalsliteral lowercaseequalsliteral find rfind findchar rfindchar appendint tointeger base classes nsstringcontainer data members no public members.
... operator!= prbool operator!=(const nsastring&) const - source parameters nsastring& other prbool operator!=(const prunichar*) const - source parameters prunichar* other equalsliteral prbool equalsliteral(const char*) const - source parameters char* aasciistring lowercaseequalsliteral prbool lowercaseequalsliteral(const char*) const - source case-insensitive match this string to a lowercase ascii string.
XPCOM glue classes
ns convertasciitoutf16 externalclass declarationns convertutf16toutf8 externalclass declarationns convertutf8toutf16 externalclass declarationns lossyconvertutf16toascii externalclass declarationns_convertasciitoutf16class declarationns_convertutf16toutf8class declarationns_convertutf8toutf16class declarationns_lossyconvertutf16toasciiclass declarationns_overridens_override is a macro which allows c++ code in mozilla to specify that a method is intended to override a base class method.
...these routines allow easy access to xpcom's global nsimemory implementation without having to go through the service manager to get it.nspromiseflatcstringclass declarationnspromiseflatstringclass declarationnsrefptrrefptr (formerly known as nsrefptr, see bug 1207245) is a general class to implement reference counting pointers for objects.
IAccessible2
without the availability of windowhandle, the at would have to get the window handle by using windowfromaccessibleobject on each iaccessible, which is slow because it's implemented by oleacc.dll as a loop which crawls up the ancestor chain and looks for a role_window object, mapping that back to a window handle.
...remarks when you have a reference to an iaccessible and require a reference to an iaccessible2 use queryservice as follows: // pacc is a reference to the accessible object's iaccessible interface.
IAccessibleEditableText
the substrings used with this interface are specified as follows: if startoffset is less than endoffset, the substring starts with the character at startoffset and ends with the character just before endoffset.
... if endoffset is lower than startoffset, the result is the same as a call with the two arguments exchanged.
amIWebInstaller
toolkit/mozapps/extensions/amiwebinstaller.idlscriptable this interface is used to allow web pages to start installing add-ons.
... areferer the uri of the web page for which to see if installation is allowed.
imgIEncoder
apng: ----- the following options can be used with startimageencode(): transparency=[yes|no|none] -- default: "yes" overrides default from input format.
... the following options can be used for each frame, with addimageframe(): transparency=[yes|no|none] -- default: "yes" overrides default from input format.
mozIStorageAggregateFunction
it allows consumers to add aggregate functions that are available to sql queries and triggers.
... sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection.
mozIStorageConnection
methods asyncclose() asynchronously closes a database connection, allowing all pending asynchronous statements to complete first.
... void createtable( in string atablename, in string atableschema ); parameters atablename the name of the table to create; table names may consist of the letters a-z in either upper or lower case, the underscore, and the digits 0-9.
mozIStorageFunction
it allows consumers to add functions that are available to sql queries and triggers.
... sample code both of the following code samples assume that the variable dbconn is an opened mozistorageconnection.
mozIStorageProgressHandler
this allows you to monitor the progress and possibly display status information to the user.
... return value return true to abort the request or false to allow it to continue.
mozIThirdPartyUtil
this is done as follows: if achannel is an nsihttpchannel and has the 'forceallowthirdpartycookie' property set, then: if auri is null, return false.
...this is done as follows: obtain the uri of the principal associated with awindow.
nsIAboutModule
if it is, web pages and so forth will be allowed to link to this about: uri.
... allow_script (1 << 1) a flag that indicates whether script should be enabled for the given about: uri even if it's disabled in general.
nsIAccessibleRelation
relation_flows_to 0x07 content flows from this object to a target object, that is has content that flows logically to another object in a sequential way, for example text flow.
... relation_flows_from 0x08 content flows to this object from a target object, that is has content that flows logically from another object in a sequential way, for example text flow.
nsIAppStartup
obsolete since gecko 1.9.1 constants the following flags may be passed as the amode parameter to the quit() method.
... return value a javascript object with the following fields.
nsIBrowserSearchService
to access this service, use: var browsersearchservice = components.classes["@mozilla.org/browser/search-service;1"] .getservice(components.interfaces.nsibrowsersearchservice); attempting to use any method or attribute of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization.
... attempting to call any method of this interface before init() has completed will force the service to fall back to a slower, synchronous, initialization.
nsICachingChannel
a channel may optionally implement this interface to allow clients to affect its behavior with respect to how it uses the cache service.
...the listener will only see onstartrequest followed by onstoprequest.
nsIChannelPolicy
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) this interface exists to allow the content policy mechanism to function properly during channel redirects.
...attributes attribute type description contentsecuritypolicy nsisupports a nsicontentsecuritypolicy object to determine if the load should be allowed.
nsIChromeRegistry
this is useful because chrome urls are allowed to be specified in "shorthand", leaving the "file" portion off.
...this is useful because chrome urls are allowed to be specified in "shorthand", leaving the "file" portion off.
nsIConsoleService
note: see the code samples below for how to call getmessagearray.
... note: to guard against stack overflows from listeners which could log messages (this could be done inadvertently through listeners implemented in javascript), we do not call any listeners when another error is already being logged.
nsIContentPrefService2
dom/interfaces/base/nsicontentprefservice2.idlscriptable asynchronous api for content preferences 1.0 66 introduced gecko 20.0 inherits from: nsisupports last changed in gecko 20.0 (firefox 20.0 / thunderbird 20.0 / seamonkey 2.17) description content preferences allow the application to associate arbitrary data, or "preferences", with specific domains, or web "content".
...(see nsicontentpref below.) for example, if you want to remember the user's preference for a certain zoom level on www.mozilla.org pages, you might store a preference whose domain is "www.mozilla.org", whose name is "zoomlevel", and whose value is the numeric zoom level.
nsIContentSecurityPolicy
shouldload(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiuri arequestorigin, in nsisupports acontext, in acstring amimetypeguess, in nsisupports aextra); short shouldprocess(in unsigned long acontenttype, in nsiuri 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).
... allowsinlinescript boolean whether this policy allows in-page script.
nsICookiePermission
nsiuri auri, in nsichannel achannel); boolean cansetcookie(in nsiuri auri, in nsichannel achannel, in nsicookie2 acookie, inout boolean aissession, inout print64 aexpiry); nsiuri getoriginatinguri(in nsichannel achannel); void setaccess(in nsiuri auri, in nscookieaccess aaccess); constants constant value description access_default 0 nscookieaccess's access default value access_allow 1 nscookieaccess's access allow value access_deny 2 nscookieaccess's access deny value access_session 8 additional values for nscookieaccess, which are not directly used by any methods on this interface, but are nevertheless convenient to define here.
... return value one of the nscookieaccess values: access_default, access_allow, or access_deny.
nsICookieService
var cookiesvc = components.classes["@mozilla.org/cookieservice;1"] .getservice(components.interfaces.nsicookieservice); notifications this service broadcasts the following notifications when the cookie list is changed, or a cookie is rejected: topic subject data cookie-changed broadcast whenever the cookie list changes in some way.
... note: should be able to allow null aprompt, since nsiprompt can be queried from achannel.
nsICryptoHash
the following example shows how to compute the sha256 hash of a file: // hardcoded here for convenience var path = "c:\\windows\\notepad.exe"; var f = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); f.initwithpath(path); var istream = components.classes["@mozilla.org/network/file-input-stream;1"] .createinstance(...
... the example below shows how to convert a string to bytes in the utf-8 encoding, and then compute the sha256 hash of it.
nsIDNSService
if used with low, medium takes precedence.
... resolve_priority_low (1 << 3) the query is given lower priority.
nsIDOMParser
when you create a domparser from a privileged script, you can pass parameters to the constructor, more on that below.
...these values are automatically determined as defined below, but if you work with domparser from privileged code, you can override the defaults by providing arguments to the domparser constructor or calling parser.init().
nsIDOMXULElement
allowevents boolean true if the element's allowevents attribute is the string "true", otherwise false.
...gets or creates a box object for the element; browser, editor, iframe, listbox, menu, menupopup, scrollbox, tooltip and tree elements receive specialized box objects allowing access to additional properties not normally available from script.
nsIDirectoryServiceProvider2
xpcom/io/nsidirectoryservice.idlscriptable an extension of nsidirectoryserviceprovider which allows multiple files to be returned for the given key.
...use an xpcom return code of ns_success_aggregate_result if this result should be aggregated with other "lower" providers.
nsIEditor
void switchtextdirection(); output methods astring outputtostring(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('tex...
...// tag name are in lower case with <br>.
nsIEditorSpellCheck
subsequent calls iterate through all suggestions, allowing you to build a list.
...this function allows the caller to force the default immediately.
nsIEventListenerInfo
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview nsisupports getdebugobject(); astring tosource(); attributes attribute type description allowsuntrusted boolean indicates whether or not the event listener allows untrusted events.
...this is the method you should use if you want to get access to the actual listener, but the debugger service must be already active, which significantly slows down script execution.
nsIFileInputStream
netwerk/base/nsifilestreams.idlscriptable an input stream that allows you to read from a file.
...(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.
nsIHttpActivityObserver
see interpreting activity data below.
...see interpreting activity data below.
nsIJumpListBuilder
the default number of allowed items in a jump list is ten.
...applications do not have control over the number of items allowed in jump lists; excess items added are dropped by the system.
Using nsILoginManager
getting nsiloginmanager to get a component implementing nsiloginmanager, use the following: var passwordmanager = components.classes["@mozilla.org/login-manager;1"].getservice( components.interfaces.nsiloginmanager ); most login manager functions take an nsilogininfo object as a parameter.
... an nsilogininfo object contains the following attributes: hostname, form submit url, http realm, username, username field, password, and password field.
nsILoginManagerStorage
the user interface allows this to be done without getting each login first (which might require knowing the master password).
...this does not follow the same requirements as findlogins() for those fields; wildcard matches are not specified.
nsIMIMEInputStream
it also allows automatic creation of the content-length header.
...not allowed to be changed once the stream has been started to be read.
nsIMacDockSupport
this is created by using the dockmenu attribute of nsimacdocksupport here: http://mxr.mozilla.org/mozilla-release/source/browser/base/content/browser.js#1562 this is seen here: if you were to copy and follow that example you would replace the default native menu.
...the result of this code is shown below.
nsIMarkupDocumentViewer
inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview void scrolltonode(in nsidomnode node); void sizetocontent(); attributes attribute type description allowplugins boolean if true, plugins are allowed within the doc shell.
... hintcharacterset acstring hintcharactersetsource print32 minfontsize long the minimum font size to allow.
Building an Account Manager Extension
therefore we add the following code to the previous.
... prefpanel-devmo-account=devmo demo panel step4: the new panel and javascript the javascript for an account manager panel needs to implement at least the following functions.
nsIMsgCompFields
ay readonly attachvcard prbool bcc astring body astring bodyisasciionly prbool cc astring characterset char * defaultcharacterset char * readonly drafid char * dsn prbool fcc astring fcc2 astring followupto char * forcemsgencoding prbool forceplaintext prbool from astring hasrecipients prbool readonly new in thunderbird 23 indicates whether something is filled in in the to, cc, or bcc attribute.
... emailaddressonly ); void convertbodytoplaintext ( ); attachment handling methods void addattachment ( in nsimsgattachment attachment ); void removeattachment ( in nsimsgattachment attachment ); void removeattachments ( ); header methods void setheader(char* name, char* value); references this interface is the type of the following properties: nsimsgcompose.compfields, nsimsgcomposeparams.composefields this interface is passed as an argument to the following methods: nsimsgcomposesecure.begincryptoencapsulation, nsimsgcomposesecure.requirescryptoencapsulation, nsimsgsend.createandsendmessage, nsimsgsend.sendmessagefile, nsismimejshelper.getnocertaddresses, nsismimejshelper.getrecipientcertsinfo ...
nsIMsgDatabase
nsmsgkey astalehits); void updatehdrincache(in string asearchfolderuri, in nsimsgdbhdr ahdr, in boolean aadd); boolean hdrisincache(in string asearchfolderuri, 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.
...dbchangelistener instigator); deletemessage() void deletemessage(in nsmsgkey key, in nsidbchangelistener instigator, in boolean commit); deleteheader() void deleteheader(in nsimsgdbhdr msghdr, in nsidbchangelistener instigator, in boolean commit, in boolean notify); removeheadermdbrow() this is a lower level routine that doesn't remove the header from its thread or adjust message counts.
nsIMsgFilterCustomAction
ter type (manual, offlinemail, etc.) * * @return errormessage a localized message to display if invalid * set to null if the actionvalue is valid */ autf8string validateactionvalue(in autf8string actionvalue, in nsimsgfolder actionfolder, in nsmsgfiltertypetype filtertype); /* allow duplicate actions in the same filter list?
...*/ attribute boolean allowduplicates; /* * the custom action itself * * generally for the apply method, folder-based methods give correct * results and are preferred if available.
nsINavHistoryContainerResultNode
childrenreadonly boolean false if the node's list of children can be modified (by adding or removing children, or rearranging them), or true if the user interface should not allow the list of children to be altered.
... containeropen boolean set this to true to allow descent into this container.
nsINavHistoryQuery
this allows place queries to be returned (which might include bookmark folders -- use the bookmark service's getfolderuri) as well as anything else that may have been tagged with an annotation.
... minvisits long set lower limits for how many times an item has been visited.
nsINavHistoryResultObserver
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this interface replaced the older nsinavhistoryresultviewer interface, which only allowed one client at a time.
...the item previously at the specified index (if any) and everything below it is shifted down by one.
nsINavHistoryResultViewer
removed in gecko 2.0 and replaced with the nsinavhistoryresultobserver interface, which is similar but allows multiple clients to observe the result at once.
... remarks the item previously at the specified index (if any) as well as everything below it, is shifted down by one.
Component; nsIPrefBranch
on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this).
...unlocking a previously locked preference allows the preference service to once again return the user set value of the preference.
nsISHEntry
return value getanycontentviewer() return any content viewer present in or below this node in the nsshentry tree.
...if either contentviewer or windowstate are null, then all of the following members are cleared/reset: contentviewer, sticky, windowstate, viewerbounds, childshells, refreshurilist.
nsIStreamConverter
you could implement this interface to allow everyone else to use your conversion logic using a standard api.
...first of all the stream converter implementation must register itself with the component manager using a contractid in the format below.
nsIStyleSheetService
allows extensions or embeddors to add to the built-in list of user or agent style sheets.
...a user sheet loaded via this api will come before usercontent.css and userchrome.css in the cascade (so the rules in it will have lower precedence than rules in those sheets).
nsIUTF8ConverterService
autf8string convertstringtoutf8( in acstring astring, in string acharset, in boolean askipcheck, in boolean aallowsubstitution ); parameters astring a string to ensure its utf8ness.
... aallowsubstitution when true, allow the decoder to substitute invalid input sequences by replacement characters.
nsIUpdateTimerManager
an instead register an update-timer category with comma-separated values as a single string representing the timer, like this: _xpcom_categories: [{ category: "update-timer", value: "contractid," + "method," + "id," + "preference," + "interval" }], this allows you to schedule the timer without actually having to instantiate the component; instead, the component is instantiated when the timer is triggered.
... preference the preference for the timer interval; this allows a preference to override the default interval.
NS_CStringCopy
this is a low-level api.
... remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects.
NS_StringCopy
this is a low-level api.
... remarks this function is designed to allow the implementation to efficiently assign the same value to two string objects.
XPCOM ABI
abi naming each abi is named with a string [target_xpcom_abi] of the following format: {cpu_arch}-{target_compiler_abi} {cpu_arch} [platforms] represents the cpu architecture and may be either: x86 - i386 and higher series (including x86-64 cpus in 32-bit mode) ppc - powerpc series alpha - alpha series x86_64 - amd64/emt64 series in 64-bit mode (32-bit mode is still considered x86) sparc - sparc series ia64 - itanium series {target_compiler_abi}[platforms] r...
...to retrieve the abi of your firefox or thunderbird, open the error console (accessible through tools | error console) and evaluate the following javascript code: components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulruntime) .xpcomabi if either the cpu architecture or the c++ compiler are unknown, the application wouldn't have an xpcom abi string and attempts to get it will result in error ns_error_not_available.
XPCOM tasks
there is code above xpcom that should be below it.
... 5.1 3rd party code that doesn't use any services from our tree should be below xpcom; particularly, code xpcom could exploit, e.g., expat berkeley db changes to apis, functionality, and implementations the following items are listed (very) roughly in their order of importance, i.e., fixing observers is the first thing i want to do.
already_AddRefed
« xpcom api reference already_addrefed in association with nscomptr allows you to assign in a pointer without addrefing it.
...// the following assignment doesn't perform an additional addref, // as it would do if getfoo() returned a raw pointer.
The Valgrind Test Job
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.
Cached compose window FAQ
there is no "cached" window, so this will be as slow as step 4.
... there is no "cached" window, so this will be as slow as step 4.
Filelink Providers
the account setup dialog the account setup dialog allows the user to select what account type they would like to create from a menulist.
... for example, the hightail implementation provides the following function: function extraargs() { var usernamevalue = document.getelementbyid("username").value; return { "username": {type: "char", value: usernamevalue}, }; } in this example, the username value is read from the input, and then the specially-crafted object is returned.
MailNews Protocols
rss is implemented in js and doesn't follow the same pattern as the c++ protocols.
...those protocols all have the following, defined in the corresponding protocol subdirectory of mailnews (i.e., mailnews/imap, mailnews/local (for pop3), mailnews/news): an incoming server class, which implements nsimsgincomingserver and inherits from mailnews/base/util/nsmsgincomingserver, i.e.., nspop3incomingserver, nsimapincomingserver, nsnntpincomingserver.
Mail event system
the nsimsgmailsession interface actually only allows adding and removal of listeners - the notifications happen through the nsifolderlistener interface as well.
... sample control flow here is an example of a possible flow of control when a new message is added to a folder.
Mailnews and Mail code review requirements
all patches that affect user experience or interfaces on thunderbird should have ui-review on those patches in addition to the reviews required below.
... rubber-stamp 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.
Thunderbird Binaries
described below are three types of generally available thunderbird packages - releases, early preview releases, and nightly builds (including trunk development builds) - and their downloaded locations.
... additionally, ad-hoc packages called try builds are made available on an as-needed basis to allow for testing of certain patches, and are typically announced in related bug reports.
Building a Thunderbird extension 5: XUL
this shows how the thunderbird architecture allows extensions to modify the user experience without modifying the installation files.
... example xul overlay document create a new file called myhelloworld.xul within the content folder you created earlier with the following content: <?xml version="1.0"?> <overlay id="sample" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://myfirstext/content/overlay.js"/><!-- a reference to your javascript file --> <statusbar id="status-bar"> <statusbarpanel id="my-panel" label="date"/> </statusbar> </overlay> the <statusbar> widget named status-bar specifies the merge point within the application window that we want to attach to.
Building a Thunderbird extension 6: Adding JavaScript
depending on the installed theme the result will look something like this: modify xul elements with javascript save the following javascript code into the content/ folder next to your myhelloworld.xul file and name it overlay.js.
...this allows us to call the startup function repeatedly with an interval of 60000ms (every minute).
Activity Manager examples
showing a user-defined activity in the activity manager window the following sample will show a process and an event for junk processing in the activity manager window.
...nd", process.starttime, // start time date.now()); // completion time event.contexttype = process.contexttype; // optional event.contextobj = process.contextobj; // optional gactivitymanager.addactivity(event); showing a user-defined activity with cancel capability (javascript) this sample improves the previous one by providing an nsiactivitycancelhandler to allow the user to cancel the process.
Folders and message lists
we'll look at some of them below.
...otherwise, use one of the methods described below.
Using the Mozilla source server
the nightly debug builds are now also source indexed so that by following a couple of simple steps you can also have the source code served to you for debugging without a local build what you'll need windbg or visual studio (note: express editions will not work, but windbg is a free download) a nightly build that was created after april 15, 2008; go to the /pub/firefox/nightly/latest-mozilla-central/ folder and grab the installer for builds predating 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.
Add to iPhoto
in c, the declaration looks like this: typedef struct { cfindex location; cfindex length; } cfrange; to declare this for use with js-ctypes, we use the following code: this.cfrange = new ctypes.structtype("cfrange", [ {'location': ctypes.int32_t}, {'length': ctypes.int32_t}]); this defines corefoundation.cfrange to represent this data type, comprised of two 32-bit integer fields called location and length.
...we do that next by following these steps: create a cfstring referring to file:///applications/iphoto.app, which is iphoto's default path, using cfstringcreatewithcharacters().
Using C struct and pointers
using c strings with js-ctypes a pointer to char in javascript is declared as follows: var str = ctypes.pointertype(ctypes.char); now imagine you call a c function that returns a c string and you want to modify the contents of this string.
... once we have a ctypes char pointer that points to a buffer of known size, we modiify the contents of the memory block as follows: ptr.contents = string("hello world from javascript!!!"); string() adds the '\0' character.
Declaring types
{ fieldn: typen } ] example for example, to support the c tm structure using js-ctypes, you would use the following code: const struct_tm = new ctypes.structtype("tm", [ { "tm_sec": ctypes.int }, { "tm_min": ctypes.int }, { "tm_hour": ctypes.int }, { "tm_mday": ctypes.int }, { "tm_mon": ctypes.int }, { "tm_year": ctypes.int }, { ...
...this is permitted since c allows it, for the widest possible compatibility.
PKCS #11 Netscape Trust Objects - Network Security Services
conceptually a trust object contains the following: certificate reference purpose + level of trust (multiple) purpose + level of trust a trust object ultimately denotes a level of trust in a certificate.
... trust objects are of the class cko_netscape_trust and have the following attributes.
Browser Side Plug-in API - Plugins
npn_getvalue allows the plug-in to query the browser for information.
... npn_setvalueforurl allows a plug-in to change the stored information associated with a url, in particular its cookies.
Initialization and Destruction - Plugins
you can assign more than one mime type to a plug-in, which could potentially allow the plug-in to respond to data streams of different types with different interfaces and behavior.
...for example, the following embed element has the standard attributes src, height, and width and the private attribute loop: <embed src="movie.avi" height="100" width="100" loop="true"> with the embed element in the example, the browser passes the values in argv to the plug-in instance: argc = 4 argn = { "src", "height", "width", "loop" } argv = { "movie.avi", "100", "100", "true" } the saved parameter allows an ins...
Plug-in Side Plug-in API - Plugins
npp_getvalue allows the browser to query the plug-in for information.
... np_getvalue allows the browser to query the plug-in for information.
Gecko Plugin API Reference - Plugins
npn_getvalue allows the plug-in to query the browser for information.
... npn_setvalueforurl allows a plug-in to change the stored information associated with a url, in particular its cookies.
DOM Inspector - Firefox Developer Tools
the dom hierarchy can be navigated using a two-paned window that allows a variety of different views on the document and all nodes within.
...or, build thunderbird yourself with the following options: ac_add_options --enable-extensions="default inspector" ac_add_options --enable-inspector-apis mozilla suite and seamonkey select tools > web development > dom inspector.
Inspecting web app manifests - Firefox Developer Tools
when you open the application panel’s manifest view on a page that doesn't have an app manifest successfully deployed, you'll get the following output shown: deploying a manifest to get a manifest deployed successfully, you need to include a <link> element in the <head> of your document that points to your .webmanifest file: <link rel="manifest" href="/manifest.webmanifest"> the .webmanifest extension is recommended in the spec, and should be served with an application/manifest+json mime type, although browsers generally tend to support manifests with other appropriate extensions like .json (mime type: application/json).
... inspecting your manifest if your manifest is deployed successfully, you should end up with a display like the following on the manifest view: from here, you can inspect all the information in the manifest in an easy-to-digest way, making sure that it is all correct.
Break on DOM mutation - Firefox Developer Tools
click on the icon following the node name to go back to the page inspector with the node selected.
...in the following example, the selected node (the unordered list) is modified by adding a new child node.
Examine, modify, and watch variables - Firefox Developer Tools
in the screenshot below the variable upvar has been optimized away: modify variables when the code has stopped at a breakpoint, you can modify variables in the variables pane of the debugger.
...at that point, a box showing your active watch expressions and their current values will appear: you can step through your code, watching the value of the expression as it changes; each time it does, the box will flash briefly yellow.
Use watchpoints - Firefox Developer Tools
set watchpoint icons are blue, get watchpoint icons are reddish, and get or set watchpoint icons are dark yellow.
... in the following screenshot, the debugger pauses at line 7, where obj.a is set.
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
(this menu will not be present unless you have changed the preference as explained above.) selecting the 'browser' context in the scratchpad enter the following code in the scratchpad: // this simply defines the 'debugger' constructor in this // scratchpad; it doesn't actually start debugging anything.
...(if you get an error complaining that components.utils is not defined, be sure you've selected browser from the scratchpad's environment menu, as described in step 2.) save the following html text to a file, and visit the file in your browser.
Tutorial: Set a breakpoint - Firefox Developer Tools
save the following text to an html file: <div onclick="report('the best div');">click me!</div> <div onclick="report('another great div');">or me!</div> <script> function report(what) { console.log('clicked: ' + what); } </script> visit the html file in your browser, and open the browser content toolbox by opening the firefox menu, choosing “web developer”, and then “browser content toolbox”.
... click on the scratchpad panel and enter the following code: components.utils.import("resource://gre/modules/jsdebugger.jsm"); components.utils.import("resource://gre/modules/console.jsm"); // this simply defines 'debugger' in this scratchpad; // it doesn't actually start debugging anything.
Debugger-API - Firefox Developer Tools
here is a javascript program in the process of running a timer callback function: a running javascript program and its debugger shadows this diagram shows the various types of shadow objects that make up the debugger api (which all follow some general conventions): a debugger.object represents a debuggee object, offering a reflection-oriented api that protects the debugger from accidentally invoking getters, setters, proxy traps, and so on.
... all these types follow some general conventions, which you should look through before drilling down into any particular type’s specification.
Dominators - Firefox Developer Tools
this article provides an introduction to the concepts of reachability, shallow versus retained size, and dominators, as they apply in garbage-collected languages like javascript.
... shallow and retained size this gives rise to a distinction between two ways to look at the size of an object: shallow size: the size of the object itself retained size: the size of the object itself, plus the size of other objects that are kept alive by this object often, objects will have a small shallow size but a much larger retained size, through the references they contain to other objects.
Network monitor recording - Firefox Developer Tools
the pause button allows you to look at a certain snapshot.
... network monitor features the following articles cover different aspects of using the network monitor: toolbar network request list network request details performance analysis throttling ...
Use the Inspector API - Firefox Developer Tools
firefox add-ons may access the following objects from the chrome://browser/content/devtools/inspector/inspector.xul context: window.inspector defined in inspector-panel.js.
... layout-change "low-priority change event for things like paint and resize." ...
Work with animations - Firefox Developer Tools
the box below contains a grayscale icon, representing firefox developer edition.
...you'll get a message of "some animation properties are optimized." properties whose animation is not being optimized, but could be if you improved your code, are now given a dotted underline — see transform in the screenshot below.
UI Tour - Firefox Developer Tools
the following image shows the 2-pane layout: in 2-pane mode, the inspector includes the html pane, and the css pane, which can contain one of six tools: rules view layout view computed view changes view compatibility view (firefox developer edition 77 and later) fonts view animations view the following image shows the 3-pane mode (available from firefox 62 onwards) which moves the css rules vi...
...the following image shows 3-pane mode: as you can see, the css pane has moved into the center of the inspector.
Sorting algorithms comparison - Firefox Developer Tools
this program compares the performance of three different sorting algorithms: bubble sort selection sort quicksort it consists of the following functions: sortall() top-level function.
...you can also download the specific profile we discuss - just import it to the performance tool if you want to follow along.
Intensive JavaScript - Firefox Developer Tools
by default the browser uses a single thread to run all the javascript in your page as well as to perform layout, reflows, and garbage collection.
...the pink says that we are mostly performing css calculations and possibly reflow: this is the css animation that's running throughout the profile.
UI Tour - Firefox Developer Tools
for example, in the screenshot below a long-running paint operation (shown as a green bar in the waterfall overview) corresponds to a drop in the frame rate: zooming in you can use the overview to select a slice of the recording to examine in more detail.
...in the screenshot below we've selected that drop in the frame rate, and can see the long-running paint operation in more detail: details pane the details pane shows whichever tool is currently selected.
Storage Inspector - Firefox Developer Tools
currently it can be used to inspect the following storage types: cache storage — any dom caches created using the cache api.
... working with the storage inspector the following articles cover different aspects of using the network monitor: cookies local storage / session storage cache storage indexeddb extension storage ...
Style Editor - Firefox Developer Tools
source maps enable the tools to map back from the generated css to the original syntax, so they can display, and allow you to edit, files in the original syntax.
... this means that if you use, for example, sass, then the style editor will show you, and allow you to edit, sass files, rather than the css that is generated from them: for this to work, you must: use a css preprocessor that understands the source map revision 3 proposal.
Taking screenshots - Firefox Developer Tools
the command has the following optional parameters: command type description --clipboard boolean when present, this parameter will cause the screenshot to be copied to the clipboard.
...values above 1 yield "zoomed-in" images, whereas values below 1 create "zoomed-out" images.
Toolbox - Firefox Developer Tools
the array may include the following tools: web console javascript debugger page inspector style editor profiler network monitor note that not all the hosted tools are always listed here: only the tools actually available in this context are shown (for example, not all tools support remote debugging yet, so if the debugging target is not the firefox instance that launched the window, not all the hosted tools will be sho...
... the following tools are not included in the toolbar by default, but you can add them in the settings: highlight painted area 3d view (note that this is not available in firefox 40) scratchpad grab a color from the page take a screenshot of the entire page: take a screenshot of the complete web page and saves it in your downloads directory toggle rulers for the page measure a portion of the page: measure a part of the website by selecting areas within the page toolbox controls fina...
Validators - Firefox Developer Tools
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.
... accessibility services lynx viewer checks a web page using lynx visualization and allows validation of accessibility features original document information last updated date: august 16th, 2002 copyright © 2001-2003 netscape.
Rich output - Firefox Developer Tools
in particular, it: provides extra information for certain types enables detailed examination of the object's properties provides richer information for dom elements, and enables you to select them in the inspector type-specific rich output the web console provides rich output for many object types, including the following: object array date promise regexp window document element event examining object properties when an object is logged to the console it has a right-pointing triangle next to it, indicating that it can be expanded.
...for example, by expanding the array in the above list, i get the following: console.log(todolist) (4) […] ​ 0: object { status: "done", description: "morning pages", datecreated: 1552404478137 } ​ 1: object { status: "in progress", description: "refactor styles", datecreated: 1552404493169 } ​ 2: object { status: "to do", description: "create feedback form", datecreated: 1552404512630 } ​ 3: object { status: "to do", description: "normalize table", datecre...
Web Console UI Tour - Firefox Developer Tools
the web console's interface is split into three horizontal sections, detailed in the sections below.
... settings ("gear" menu): new in firefox 71, you can click the gear icon to access the new settings menu, where you can toggle the following features on and off: persist logs: when enabled, the console doesn't clear on page reload, or new page load.
about:debugging (before Firefox 68) - Firefox Developer Tools
each tab entry has a debug button next to it — when clicked, this will open up a toolbox specific to that tab, allowing you to debug that tab's contents.
... workers the workers page shows your workers, categorised as follows: all registered service workers all registered shared workers other workers, including chrome workers and dedicated workers you can connect the developer tools to each worker, and send push notifications to service workers.
AnalyserNode.minDecibels - Web APIs
when getting data from getfloatfrequencydata() or getbytefrequencydata(), any frequencies with an amplitude of mindecibels or lower will be returned as 0.0 or 0, respectively.
... 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.
Animation.finish() - Web APIs
WebAPIAnimationfinish
examples the following example shows how to use the finish() method and catch an invalidstate error.
... interfaceelement.addeventlistener("mousedown", function() { try { player.finish(); } catch(e if e instanceof invalidstate) { console.log("finish() called on paused or finished animation."); } catch(e); logmyerrors(e); //pass exception object to error handler } }); the following example finishes all the animations on a single element, regardless of their direction of playback.
Animation.updatePlaybackRate() - Web APIs
this may be a positive number (to speed up or slow down the animation), a negative number (to make it play backwards), or zero (to effectively pause the animation).
... examples a speed selector component would benefit from smooth updating of updateplaybackrate(), as demonstrated below: speedselector.addeventlistener('input', evt => { cartoon.updateplaybackrate(parsefloat(evt.target.value)); cartoon.ready.then(() => { console.log(`playback rate set to ${cartoon.playbackrate}`); }); }); specifications specification status comment web animationsthe definition of 'updateplaybackrate()' in that specification.
AnimationEffect.getComputedTiming() - Web APIs
although many of the attributes of the returned object are common to the effecttiming contained in the object returned by the animationeffect.gettiming() method, the values returned by this object differ in the following ways: duration returns the calculated value of the iteration duration.
... return value a computedeffecttiming dictionary object, which contains the following properties: endtime the end time of the animation in milliseconds from the animation's start (if the keyframeeffect is associated with an animation).
Attr.localName - Web APIs
WebAPIAttrlocalName
example the following example shows "id" in an alert dialog.
...in later versions, in compliance with html5, the property returns in the case of the internal dom storage, which is lower case for both html attributes in html doms and xhtml attributes in xml doms.
AudioBuffer() - Web APIs
options options are as follows: length: the size of the audio buffer in sample-frames.
...user agents are required to support sample rates from 8,000 hz to 96,000 hz (but are allowed to go farther outside this range).
AudioBuffer - Web APIs
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.
... example the following simple example shows how to create an audiobuffer and fill it with random white noise.
AudioBufferSourceNode.start() - Web APIs
the default value, 0, will begin playback at the beginning of the audio buffer, and offsets past the end of the audio which will be played (based on the audio buffer's duration and/or the loopend property) are silently clamped to the maximum value allowed.
... examples the most simple example just starts the audio buffer playing from the beginning — you don't need to specify any parameters in this case: source.start(); the following more complex example will, 1 second from now, start playing 10 seconds worth of sound starting 3 seconds into the audio buffer.
AudioBufferSourceNode - Web APIs
<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" tex...
... multiple calls to stop() are allowed.
AudioContext.createJavaScriptNode() - Web APIs
smaller sizes allow for lower latency and higher for better overall quality.
... example the following script illustrates the use of createjavascriptnode(): var sinewave = function(context) { var that = this; this.x = 0; // initial sample number this.context = context; this.node = context.createjavascriptnode(1024, 1, 1); this.node.onaudioprocess = function(e) { that.process(e) }; } sinewave.prototype.process = function(e) { var data = e.outputbuffer.getchanneldata(0); for (var i = 0; i < data.length; ++i) { data[i] = math.sin(this.x++); } } sinewave.prototype.play = function() { this.node.connect(this.context.destination); } sinewave.prototype.pause = function() { this.node.disconnect(); } see also ...
AudioContext.createMediaStreamTrackSource() - Web APIs
then a biquadfilternode is created using createbiquadfilter(), and it's configured as desired to perform a lowshelf filter on the audio coming from the source.
... navigator.mediadevices.getusermedia ({audio: true, video: false}) .then(function(stream) { audio.srcobject = stream; audio.onloadedmetadata = function(e) { audio.play(); audio.muted = true; }; let audioctx = new audiocontext(); let source = audioctx.createmediastreamsource(stream); let biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 3000; biquadfilter.gain.value = 20; source.connect(biquadfilter); biquadfilter.connect(audioctx.destination); }) .catch(function(err) { // handle getusermedia() error }); specifications specification status comment web audio apithe definition of 'createmediastreamtracksource()' in that specification.
AudioContextLatencyCategory - Web APIs
by using these strings rather than a numeric value when specifying a latency to a audiocontext, you can allow the user agent to select an appropriate latency for your use case that makes sense on the device on which your content is being used.
...the user agent should select the lowest possible latency that doesn't cause glitches in the audio.
AudioParam.setTargetAtTime() - Web APIs
the larger this value is, the slower the transition will be.
... for more details, check the following table on how the value changes from 0% to 100% as the time progresses.
AudioProcessingEvent - Web APIs
properties the list below includes the properties inherited from its parent, event.
... example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
AudioWorkletNode() - Web APIs
the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor.
... available properties are as follows: numberofinputs optional the value to initialize the numberofinputs property to.
AudioWorkletProcessor() - Web APIs
available properties are as follows: numberofinputs optional the value to initialize the numberofinputs property to.
... const audiocontext = new audiocontext() await audiocontext.audioworklet.addmodule('test-processor.js') const testnode = new audioworkletnode(audiocontext, 'test-processor', { processoroptions: { someusefulvariable: new map([[1, 'one'], [2, 'two']]) } }) the console output will be as follows: > 1 // audioworkletnode options.numberofinputs set to default > map(2) {1 => "one", 2 => "two"} // a cloned map under someusefulvariable specifications specification status comment web audio apithe definition of 'audioworkletprocessor()' in that specification.
BaseAudioContext.createBiquadFilter() - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
...ctx.createbiquadfilter(); var convolver = audioctx.createconvolver(); // connect the nodes together source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadfilter); biquadfilter.connect(convolver); convolver.connect(gainnode); gainnode.connect(audioctx.destination); // manipulate the biquad filter biquadfilter.type = "lowshelf"; biquadfilter.frequency.setvalueattime(1000, audioctx.currenttime); biquadfilter.gain.setvalueattime(25, audioctx.currenttime); specifications specification status comment web audio apithe definition of 'createbiquadfilter()' in that specification.
BaseAudioContext.createChannelMerger() - Web APIs
example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
... to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify both the index of the channel to connect from and the index of the channel to connect to.
BaseAudioContext.createChannelSplitter() - Web APIs
example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
... to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify the index of the channel to connect from and the index of the channel to connect to.
BaseAudioContext.createConvolver() - Web APIs
example the following example shows basic usage of an audiocontext to create a convolver node.
...the example below uses a short sample of a concert hall crowd, so the reverb effect applied is really deep and echoey.
BaseAudioContext.createDynamicsCompressor() - Web APIs
compression lowers the volume of the loudest parts of the signal and raises the volume of the softest parts.
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
BaseAudioContext.createGain() - Web APIs
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
... the below snippet wouldn't work as is — for a complete working example, check out our voice-change-o-matic demo (view source.) <div> <button class="mute">mute button</button> </div> var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var gainnode = audioctx.creategain(); var mute = document.queryselector('.mute'); var source; if (navigator.mediadevices.getusermedia) { navigator.mediadevices.getusermedia ( // constraints - only audio needed for this app { audio: true }, // success callback function(stream) { source = audioctx.createmediastreamsource(stream); }, // error callback function(err) { console.log('the following gum error occured: ' + err); } ); } else { console.log('getusermedia not supported on your bro...
BaseAudioContext.createWaveShaper() - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
...we found the below distortion curve code on stack overflow.
BaseAudioContext - Web APIs
<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...
... baseaudiocontext.createbiquadfilter() creates a biquadfilternode, which represents a second order filter configurable as several different common filter types: high-pass, low-pass, band-pass, etc baseaudiocontext.createbuffer() creates a new, empty audiobuffer object, which can then be populated by data and played via an audiobuffersourcenode.
BasicCardResponse.billingAddress - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardNumber - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardSecurityCode - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardholderName - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryMonth - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryYear - Web APIs
example let's look at a sample payment request: var request = new paymentrequest(supportedinstruments, details, options); // call show() to trigger the browser's payment flow.
...}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available inside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BiquadFilterNode.Q - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
...ctx.createbiquadfilter(); var convolver = audioctx.createconvolver(); // connect the nodes together source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadfilter); biquadfilter.connect(convolver); convolver.connect(gainnode); gainnode.connect(audioctx.destination); // manipulate the biquad filter biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = 25; biquadfilter.type = "peaking"; biquadfilter.frequency.value = 1000; biquadfilter.q.value = 100; biquadfilter.gain.value = 25; specifications specification status comment web audio apithe definition of 'q' in that specification.
BiquadFilterNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
...ctx.createbiquadfilter(); var convolver = audioctx.createconvolver(); // connect the nodes together source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadfilter); biquadfilter.connect(convolver); convolver.connect(gainnode); gainnode.connect(audioctx.destination); // manipulate the biquad filter biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = 25; biquadfilter.detune.value = 100; specifications specification status comment web audio apithe definition of 'detune' in that specification.
BiquadFilterNode.frequency - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
...ctx.createbiquadfilter(); var convolver = audioctx.createconvolver(); // connect the nodes together source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadfilter); biquadfilter.connect(convolver); convolver.connect(gainnode); gainnode.connect(audioctx.destination); // manipulate the biquad filter biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = 25; specifications specification status comment web audio apithe definition of 'frequency' in that specification.
BiquadFilterNode.gain - Web APIs
example the following example shows basic usage of an audiocontext to create a biquad filter node.
...ctx.createbiquadfilter(); var convolver = audioctx.createconvolver(); // connect the nodes together source = audioctx.createmediastreamsource(stream); source.connect(analyser); analyser.connect(distortion); distortion.connect(biquadfilter); biquadfilter.connect(convolver); convolver.connect(gainnode); gainnode.connect(audioctx.destination); // manipulate the biquad filter biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = 25; specifications specification status comment web audio apithe definition of 'gain' in that specification.
BiquadFilterNode.getFrequencyResponse() - Web APIs
example in the following example we are using a biquad filter on a media stream (for the full demo, see our stream-source-buffer demo live, or read the source.) as part of this demo, we get the frequency responses for this biquad filter, for five sample frequencies.
...sponse-output"> </ul> var freqresponseoutput = document.queryselector('.freq-response-output'); finally, after creating our biquad filter, we use getfrequencyresponse() to generate the response data and put it in our arrays, then loop through each data set and output them in a human-readable list at the bottom of the page: var biquadfilter = audioctx.createbiquadfilter(); biquadfilter.type = "lowshelf"; biquadfilter.frequency.value = 1000; biquadfilter.gain.value = range.value; ...
Bluetooth.getAvailability() - Web APIs
note: user might not allow use of web bluetooth api, even if getavailability() returned true (navigator.bluetooth.requestdevice() might not resolve with a bluetoothdevice).
... examples the following snippet prints out a message in the console specifying wheter or not bluetooth is supported: navigator.bluetooth.getavailability().then(available => { if (available) console.log("this device supports bluetooth!"); else console.log("doh!
Bluetooth.getDevices() - Web APIs
the getdevices() method of bluetooth interface of web bluetooth api exposes the bluetooth devices this origin is allowed to access.
... 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.
BluetoothDevice - Web APIs
<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="middle">eventtarget</text></a><polyline points="111,25 121,20 ...
... bluetoothdevice.uuids read only lists the uuid's of gatt services provided by the device, that the current origin is allowed to access.
Body - Web APIs
WebAPIBody
the body mixin of the fetch api represents the body of the response/request, allowing you to declare what its content type is and how it should be handled.
... examples the example below uses a simple fetch call to grab an image and display it in an <img> tag.
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.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"...
CSSNumericValue.equals() - Web APIs
this allows structural equality to be tested quickly.
...some of the following examples illustrate what happens when they are not.
CSSNumericValue.min() - Web APIs
the min() method of the cssnumericvalue interface returns the lowest value from among those values passed.
...some of the following examples illustrate what happens when they are not.
CSSNumericValue - Web APIs
interfaces based on cssnumericvalue below is a list of interfaces based on the cssnumericvalue interface.
... cssnumericvalue.tosum tbd cssnumericvalue.type tbd cssnumericvalue.parse allows a cssnumericvalue to be constructed directly from a string containing css.
CSSPrimitiveValue - Web APIs
conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anc...
CSSPseudoElement - Web APIs
methods csspseudoelement extends eventtarget, so it inherits the following methods: eventtarget.addeventlistener() registers an event handler of a specific event type on the pseudo-element.
...(a style rule may be needed to add quotation marks in older browsers.) the example below demonstrates the basic properties of the csspseudoelement object representing the opening quotation mark.
CSSStyleDeclaration.removeProperty() - Web APIs
exceptions domexception no_modification_allowed_err: if the property or declaration block is read only.
... example the following javascript code removes the background-color css property from a selector rule: var declaration = document.stylesheets[0].rules[0].style; var oldvalue = declaration.removeproperty('background-color'); specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.removeproperty()' in that specification.
CSSStyleDeclaration.setProperty() - Web APIs
priority optional is a domstring allowing the "important" css priority to be set.
...the following values are accepted: string value "important" keyword undefined string empty value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only.
CSSStyleSheet.insertRule() - Web APIs
* @param {array} rules accepts an array of json-encoded declarations * @example addstylesheetrules([ ['h2', // also accepts a second argument as an array of arrays instead ['color', 'red'], ['background-color', 'green', true] // 'true' for !important rules ], ['.myclass', ['background-color', 'yellow'] ] ]); */ function addstylesheetrules (rules) { var styleel = document.createelement('style'); // append <style> element to <head> document.head.appendchild(styleel); // grab style element's sheet var stylesheet = styleel.sheet; for (var i = 0; i < rules.length; i++) { var j = 1, rule = rules[i], selector = rule[0], propstr = ''; // if the second ...
...' !important' : '') + ';\n'; } // insert css rule stylesheet.insertrule(selector + '{' + propstr + '}', stylesheet.cssrules.length); } } polyfill the below polyfill will correct the input of the arguments of insertrule() to standardize them in internet explorer 5–8.
CSSValueList - Web APIs
some properties allow an empty list in their syntax.
... <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/cssvalue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" 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="...
CSS Object Model (CSSOM) - Web APIs
the css object model is a set of apis allowing the manipulation of css from javascript.
...it allows users to read and modify css style dynamically.
CSS Properties and Values API - Web APIs
the css properties and values api — part of the css houdini umbrella of apis — allows developers to explicitly define their css custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value.
... examples the following uses css.registerproperty in javascript to type a css custom properties, --my-color, as a color, give it a default value, and not allow it to inherit its value: window.css.registerproperty({ name: '--my-color', syntax: '<color>', inherits: false, initialvalue: '#c0ffee', }); the same registration can take place in css using the following @property: @property --my-color { syntax: '<color>'; inherits: false; initial-value: #c0ffee; } specifications specific...
Using the CSS Typed Object Model - Web APIs
the css typed object model api exposes css values as typed javascript objects to allow their performant manipulation.
... we grab our stylepropertymapreadonly with the following javascript: const allcomputedstyles = document.queryselector('button').computedstylemap(); the following examples reference allcomputedstyles: cssunparsedvalue the cssunparsedvalue represents custom properties: // cssunparsedvalue let unit = allcomputedstyles.get('--unit'); console.log( unit ) // cssunparsedvalue {0: " 1.2rem", length: 1} console.log (unit[0] ) // " 1.2rem" when we ...
Cache.matchAll() - Web APIs
WebAPICachematchAll
options optional an options object allowing you to set specific control options for the matching performed.
... ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
CanvasRenderingContext2D.addHitRegion() - Web APIs
when provided, it is an object which can contain the following properties: path a path2d object describing the area of the hit region.
...on(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.
CanvasRenderingContext2D.arcTo() - Web APIs
in this example, the arc's connecting line goes above, instead of below, the coordinate specified by moveto().
... this happens because the radius is too large for the arc to fit entirely below the starting point.
CanvasRenderingContext2D.clearRect() - Web APIs
const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.clearrect(0, 0, canvas.width, canvas.height); erasing part of a canvas this example draws a blue triangle on top of a yellowish background.
... 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 'canvasrenderingc...
CanvasRenderingContext2D.drawImage() - Web APIs
this allows scaling of the drawn image.
...this allows scaling of the drawn image.
CanvasRenderingContext2D.drawWindow() - Web APIs
this means hardware acceleration may be used, but it might actually be slower or lower quality than normal.
...by specifying "rgba(255,255,255,0)" as the color, the contents would be drawn with a transparent background (which would be slower).
CanvasRenderingContext2D.fillText() - Web APIs
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.
... <canvas id="canvas" width="400" height="150"></canvas> javascript the javascript code for this example follows.
CanvasRenderingContext2D.getImageData() - Web APIs
to avoid securityerror being thrown in this situation, configure cors to allow the source image to be used in this way.
... see allowing cross-origin use of images and canvas.
CanvasRenderingContext2D.imageSmoothingQuality - Web APIs
syntax ctx.imagesmoothingquality = "low" || "medium" || "high" options possible values: "low" low quality.
... html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let img = new image(); img.src = 'https://mdn.mozillademos.org/files/222/canvas_createpattern.png'; img.onload = function() { ctx.imagesmoothingquality = 'low'; ctx.drawimage(img, 0, 0, 300, 150); }; result specifications specification status comment html living standardthe definition of 'imagesmoothingquality' in that specification.
CanvasRenderingContext2D.strokeText() - Web APIs
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.
... <canvas id="canvas" width="400" height="150"></canvas> javascript the javascript code for this example follows.
Manipulating video using canvas - Web APIs
the document content the html document used to render this content is shown below.
... manipulating the video frame data the computeframe() method, shown below, is responsible for actually fetching a frame of data and performing the chroma-keying effect.
Compositing and clipping - Web APIs
in addition, the clip property allows us to hide unwanted parts of shapes.
... see compositing examples for the code of the following examples.
ChannelMergerNode - Web APIs
example the following example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
... to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify both the index of the channel to connect from and the index of the channel to connect to.
ChannelSplitterNode - Web APIs
example the following simple example shows how you could separate a stereo track (say, a piece of music), and process the left and right channel differently.
... to use them, you need to use the second and third parameters of the audionode.connect(audionode) method, which allow you to specify the index of the channel to connect from and the index of the channel to connect to.
CharacterData - Web APIs
<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...
... nondocumenttypechildnode.nextelementsibling read only returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.
ChildNode.replaceWith() - Web APIs
with(node) { replacewith("foo"); } // referenceerror: replacewith is not defined polyfill you can polyfill the replacewith() method in internet explorer 10+ and higher with the following code: function replacewithpolyfill() { 'use-strict'; // for safari, and ie > 10 var parent = this.parentnode, i = arguments.length, currentnode; if (!parent) return; if (!i) // if there are no arguments parent.removechild(this); while (i--) { // i-- decrements i and returns the value of i before the decrement currentnode = arguments[i]; if (typeof currentnode !== 'object...
...'){ currentnode = this.ownerdocument.createtextnode(currentnode); } else if (currentnode.parentnode){ currentnode.parentnode.removechild(currentnode); } // the value of "i" below is after the decrement if (!i) // if currentnode is the first argument (currentnode === arguments[0]) parent.replacechild(currentnode, this); else // if currentnode isn't the first parent.insertbefore(currentnode, this.nextsibling); } } if (!element.prototype.replacewith) element.prototype.replacewith = replacewithpolyfill; if (!characterdata.prototype.replacewith) characterdata.prototype.replacewith = replacewithpolyfill; if (!documenttype.prototype.replacewith) documenttype.prototype.replacewith = replacewithpolyfill; specification specification ...
Clients.claim() - Web APIs
WebAPIClientsclaim
the claim() method of the clients interface allows an active service worker to set itself as the controller for all clients within its scope.
... example the following example uses claim() inside service worker's "activate" event listener so that clients loaded in the same scope do not need to be reloaded before their fetches will go through this service worker.
Clipboard.read() - Web APIs
WebAPIClipboardread
example after using navigator.permissions.query() to find out if we have (or if the user will be prompted to allow) "clipboard-read" access, this example fetches the data currently on the clipboard.
... navigator.permissions.query({name: "clipboard-read"}).then(result => { // if permission to read the clipboard is granted or if the user will // be prompted to allow it, we proceed.
ClipboardItem - Web APIs
constructor clipboarditem.clipboarditem() creates a new clipboarditem object, with the mime type as the key and blob as the value properties this interface provides the following properties.
... methods this interface defines the following methods.
CloseEvent - Web APIs
the following values are permitted status codes.
... the following definitions are sourced from the iana website [ref].
ConstantSourceNode - Web APIs
properties inherits properties from its parent interface, audioscheduledsourcenode, and adds the following properties: offset an audioparam which specifies the value that this source continuously outputs.
... example in the article controlling multiple parameters with constantsourcenode, a constantsourcenode is created to allow one slider control to change the gain on two gainnodes.
ConstrainDOMString - Web APIs
it allows you to specify one or more exact string values from which one must be the parameter's value, or a set of ideal values which should be used if possible.
... properties the value of a constraindomstring can be any of the following: a single domstring an array of domstring objects an object with one or both of the following properties: exact either a single domstring which must be the value of the property, or an array of domstring objects one of which must be the property's value.
ContentIndex.add() - Web APIs
WebAPIContentIndexadd
syntax contentindex.add(contentdescription).then(...); parameters contentdescription the item registered is an object containing the following data: id: a unique string identifier.
... homepage article video audio icons: optional an array of image resources, defined as an object with the following data: src: a url string of the source image.
ContentIndex.delete() - Web APIs
examples below is an asynchronous function, that removes an item from the content index.
... we receive a reference to the current serviceworkerregistration, which allows us to access the index property and thus access the delete method.
ConvolverNode - Web APIs
convolvernode example the following example shows basic usage of an audiocontext to create a convolver node.
... note: you will need to find an impulse response to complete the example below.
Crypto.subtle - Web APIs
WebAPICryptosubtle
the crypto.subtle read-only property returns a subtlecrypto which can then be used to perform low-level cryptographic operations.
... syntax var crypto = crypto.subtle; value a subtlecrypto object you can use to interact with the web crypto api's low-level cryptography features.
CustomElementRegistry.define() - Web APIs
examples autonomous custom element the following code is taken from our popup-info-box-web-component example (see it live also).
... customized built-in element the following code is taken from our word-count-web-component example (see it live also).
DOMHighResTimeStamp - Web APIs
also note the section below on reduced time precision controlled by browser preferences to avoid timing attacks and fingerprinting.
...it's calculated like this: if the script's global object is a window, the time origin is determined as follows: if the current document is the first one loaded in the window, the time origin is the time at which the browser context was created.
DOMImplementation.createHTMLDocument() - Web APIs
here's the html for this example: <body> <p>click <a href="javascript:makedocument()">here</a> to create a new document and insert it below.</p> <iframe id="theframe" src="about:blank" /> </body> the javascript implementation of makedocument() follows: function makedocument() { let frame = document.getelementbyid("theframe"); let doc = document.implementation.createhtmldocument("new document"); let p = doc.createelement("p"); p.innerhtml = "this is a new paragraph."; try { doc.body.appendchild(p); } catch(e) { ...
... 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 specification.
DOMPoint - Web APIs
WebAPIDOMPoint
dompoint is based on dompointreadonly but allows its properties' values to be changed.
...in the following snippet, the pose of the xr device (such as a vr headset or phone with ar capabilities) can be retrieved by calling using xrframe.getviewerpose() during an xrsession animation frame, then accessing the resulting xrpose's transform property, which contains two dompointreadonly attributes: position as a vector and orientation as a quaternion.
Binary strings - Web APIs
WebAPIDOMStringBinary
a binary string is a concept similar to the ascii subset, but instead of limiting the range to 127, it allows code points until 255.
...however, this is slow and error-prone, due to the need for multiple conversions (especially if the binary data is not actually byte-format data, but, for example, 32-bit integers or floats).
DOMTokenList.entries() - Web APIs
the domtokenlist.entries() method returns an iterator allowing you to go through all key/value pairs contained in this object.
... examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.keys() - Web APIs
WebAPIDOMTokenListkeys
the keys() method of the domtokenlist interface returns an iterator allowing to go through all keys contained in this object.
... examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.values() - Web APIs
the values() method of the domtokenlist interface returns an iterator allowing developers to go through all values contained in the domtokenlist.
... examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DataTransfer.getData() - Web APIs
html content <div id="div1" ondrop="drop(event)" ondragover="allowdrop(event)"> <span id="drag" draggable="true" ondragstart="drag(event)">drag me to the other box</span> </div> <div id="div2" ondrop="drop(event)" ondragover="allowdrop(event)"></div> css content #div1, #div2 { width:100px; height:50px; padding:10px; border:1px solid #aaaaaa; } javascript content function allowdrop(allowdropevent) { allowdropevent.target.style.color ...
...= 'blue'; allowdropevent.preventdefault(); } function drag(dragevent) { dragevent.datatransfer.setdata("text", dragevent.target.id); dragevent.target.style.color = 'green'; } function drop(dropevent) { dropevent.preventdefault(); var data = dropevent.datatransfer.getdata("text"); dropevent.target.appendchild(document.getelementbyid(data)); document.getelementbyid("drag").style.color = 'black'; } result specifications specification status comment html living standardthe definition of 'getdata()' in that specification.
Detecting device orientation - Web APIs
these are described in greater detail in the orientation and motion data explained article which is summarized below.
... for acceleration and accelerationincludinggravity, those axes correspond to the following: x: represents the axis from west to east y: represents the axis from south to north z: represents the axis perpendicular to the ground for rotationrate, the situation is a bit different; the information corresponds to the following in each case: alpha: represents a rotation rate along the axis perpendicular to the screen (or keyboard for desktop).
Document.createElementNS() - Web APIs
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.
...p://www.w3.org/1999/xhtml", "div"); txtnode = document.createtextnode("this is text that was constructed dynamically with createelementns and createtextnode then inserted into the document using appendchild."); newdiv.appendchild(txtnode); container.appendchild(newdiv); } ]]></script> <vbox id="containerbox" flex="1"> <html:div> the script on this page will add dynamic content below: </html:div> </vbox> </page> the example given above uses inline script which is not recommended in xhtml documents.
Document.createTouch() - Web APIs
note: previous versions of this method included the following additional parameters but those parameters are not included in either of the standards listed below.
... in following code snippet, two touch objects are created for the target element.
Document: drag event - Web APIs
interface dragevent event handler property ondrag examples see this code in a jsfiddle demo or interact with it below.
...on the dragged elem dragged = event.target; // make it half transparent event.target.style.opacity = .5; }, false); document.addeventlistener("dragend", function(event) { // reset the transparency event.target.style.opacity = ""; }, false); /* events fired on the drop targets */ document.addeventlistener("dragover", function(event) { // prevent default to allow drop event.preventdefault(); }, false); document.addeventlistener("dragenter", function(event) { // highlight potential drop target when the draggable element enters it if (event.target.classname == "dropzone") { event.target.style.background = "purple"; } }, false); document.addeventlistener("dragleave", function(event) { // reset background of potential drop target when the dra...
Document.importNode() - Web APIs
starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone.
... best practice: although firefox doesn't currently enforce this rule, we encourage you to follow this rule for improved future compatibility.
Document.open() - Web APIs
WebAPIDocumentopen
examples the following simple code opens the document and replaces its content with a number of different html fragments, before closing it again.
... this call, for example opens github.com in a new window, with its opener set to null: document.open('https://www.github.com','', 'noopener=true') two-argument document.open() browsers used to support a two-argument document.open(), with the following signature: document.open(type, replace) where type specified the mime type of the data you are writing (e.g.
Document.querySelector() - Web APIs
escaping special characters to match against an id or selectors that do not follow standard css syntax (by using a colon or space inappropriately, for example), you must escape the character with a backslash ("\").
...'#foo:bar'); // does not match anything document.queryselector('#foo\\:bar'); // match the second div </script> examples finding the first element matching a class in this example, the first element in the document with the class "myclass" is returned: var el = document.queryselector(".myclass"); a more complex selector selectors can also be really powerful, as demonstrated in the following example.
Document: scroll event - Web APIs
instead, it is recommended to throttle the event using requestanimationframe(), settimeout(), or a customevent, as follows.
... note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary.
DocumentFragment.querySelector() - Web APIs
examples basic example in this basic example, the first element in the documentfragment with the class "myclass" is returned: var el = documentfragment.queryselector(".myclass"); css syntax and the method's argument the string argument pass to queryselector must follow the css syntax.
... to match id or selectors that do not follow the css syntax (by using semicolon or space inappropriately for example), it's mandatory to escape the wrong character with a double back slash: <div id="foo\bar"></div> <div id="foo:bar"></div> <script> document.queryselector('#foo\bar') // does not match anything document.queryselector('#foo\\\\bar') // match the first div document.queryselector('#foo:bar') // does not match anything document.queryselector('#foo\\:bar') // match the second div </script> specifications specification status comment selectors api level 2the definition of 'documentfragment.queryselector' in that specification.
Events and the DOM - Web APIs
there is an excellent diagram that clearly explains the three phases of event flow through the dom in the dom level 3 events draft.
...the following simple example shows how an event object is passed to the event handler function, and can be used from within one such function.
How to create a DOM tree - Web APIs
dynamically creating a dom tree consider the following xml document: <?xml version="1.0"?> <people> <person first-name="eric" middle-initial="h" last-name="jung"> <address street="321 south st" city="denver" state="co" country="usa"/> <address street="123 main st" city="arlington" state="ma" country="usa"/> </person> <person first-name="jed" last-name="brown"> <address street="321 north st" city="atlanta" state="ga" country="usa"/> <address street="123 west st" city="seattle" state="wa" country="usa"/> <address street="321 south avenue" cit...
... you can automate the creation of a dom tree using a jxon reverse algorithm in association with the following json representation: { "people": { "person": [{ "address": [{ "@street": "321 south st", "@city": "denver", "@state": "co", "@country": "usa" }, { "@street": "123 main st", "@city": "arlington", "@state": "ma", "@country": "usa" }], "@first-name": "eric", "@middle-initial": "h", "@last-na...
Document Object Model (DOM) - Web APIs
dom methods allow programmatic access to the tree.
...to achieve this, the following interfaces present in the different dom level 3 or earlier specifications have been removed.
DynamicsCompressorNode() - Web APIs
the dynamicscompressornode() constructor creates a new dynamicscompressornode object which provides a compression effect, which lowers the volume of the loudest parts of the signal, in order to help prevent clipping and distortion.
... options optional options are as follows: attack: the amount of time (in seconds) to reduce the gain by 10db.
DynamicsCompressorNode - Web APIs
the dynamicscompressornode interface provides a compression effect, which lowers the volume of the loudest parts of the signal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once.
... example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
EXT_texture_compression_rgtc - Web APIs
ext.compressed_red_green_rgtc2_ext each 4x4 block of texels consists of 64 bits of compressed unsigned red image data followed by 64 bits of compressed unsigned green image data.
... ext.compressed_signed_red_green_rgtc2_ext each 4x4 block of texels consists of 64 bits of compressed signed red image data followed by 64 bits of compressed signed green image data.
Element.attachShadow() - Web APIs
the following is a list of elements you can attach a shadow root to: any autonomous custom element with a valid name <article> <aside> <blockquote> <body> <div> <footer> <h1> <h2> <h3> <h4> <h5> <h6> <header> <main> <nav> <p> <section> <span> syntax var shadowroot = element.attachshadow(shadowrootinit); parameters shadowrootinit a shadowrootinit dictionary, which can contain the following fields: mode a string specifying th...
... examples the following example is taken from our word-count-web-component demo (see it live also).
Element.getAnimations() - Web APIs
syntax const animations = element.getanimations(options); parameters options optional an options object containing the following property: subtree a boolean value which, if true, causes animations that target descendants of element to be returned as well.
... examples the following code snippet will wait for all animations on elem and its descendants to finish before removing the element from the document.
Element.getAttribute() - Web APIs
examples const div1 = document.getelementbyid('div1'); const align = div1.getattribute('align'); alert(align); // shows the value of align for the element with id="div1" description lower casing when called on an html element in a dom flagged as an html document, getattribute() lower-cases its argument before proceeding.
...the implementation of getattribute() in xul (gecko) actually follows the dom 3 core specification and returns an empty string.
Element.getAttributeNS() - Web APIs
examples the following svg document reads the value of the foo attribute in a custom namespace.
... getattributens() differs from getattribute() in that it allows you to further specify the requested attribute as being part of a particular namespace, as in the example above, where the attribute is part of the fictional "specialspace" namespace on mozilla.
Element.getBoundingClientRect() - Web APIs
t : document.body).scrolltop examples this simple example retrieves the domrect object representing the bounding client rect of a simple <div> element, and prints out its properties below it.
... due to compatibility problems (see below), it is safest to rely on only properties left, top, right, and bottom.
Element.getElementsByTagName() - Web APIs
when called on an html element in an html document, getelementsbytagname lower-cases the argument before searching for it.
...for compatibility with xhtml, lower-case should be used.
Element.insertAdjacentText() - Web APIs
syntax element.insertadjacenttext(position, element); parameters position a domstring representing the position relative to the element; must be one of the following strings: 'beforebegin': before the element itself.
... polyfill you can polyfill the insertadjacenttext() method in internet explorer 5.5 (maybe earlier) and higher with the following code: if (!element.prototype.insertadjacenttext) element.prototype.insertadjacenttext = function(type, txt){ this.insertadjacenthtml( type, (txt+'') // convert to string .replace(/&/g, '&amp;') // embed ampersand symbols .replace(/</g, '&lt;') // embed less-than symbols ) } specification specification status comment domthe...
Element: mouseout event - Web APIs
bubbles yes cancelable yes interface mouseevent event handler property onmouseout examples the following examples show the use of the mouseout event.
... mouseout and mouseleave the following example illustrates the difference between mouseout and mouseleave events.
Element.scrollLeft - Web APIs
however: if the element can't be scrolled (e.g., it has no overflow), scrollleft is set to 0.
... example html <div id="container"> <div id="content">click the button to slide right!</div> </div> <button id="slide" type="button">slide right</button> css #container { width: 100px; height: 100px; border: 1px solid #ccc; overflow-x: scroll; } #content { width: 250px; background-color: #ccc; } javascript const button = document.getelementbyid('slide'); button.onclick = function () { document.getelementbyid('container').scrollleft += 20; }; result specifications specification status comment css object model (cssom) view modulethe definition of 'scrollleft' in that specification.
Element: scroll event - Web APIs
instead, it is recommended to throttle the event using requestanimationframe(), settimeout(), or a customevent, as follows.
... note, however, that input events and animation frames are fired at about the same rate, and therefore the optimization below is often unnecessary.
Element.toggleAttribute() - Web APIs
the attribute name is automatically converted to all lower-case when toggleattribute() is called on an html element in an html document.
... example in the following example, toggleattribute() is used to toggle the readonly attribute of a <input>.
Event.cancelable - Web APIs
WebAPIEventcancelable
example for example, browser vendors are proposing that the wheel event can only be canceled the first time the listener is called — any following wheel events cannot be canceled.
... console.warn(`the following event couldn't be canceled:`); console.dir(event); } } document.addeventlistener('wheel', preventscrollwheel); notes whether an event can be canceled or not is something that's determined when that event is initialized.
Event.composed - Web APIs
WebAPIEventcomposed
you can determine the path the event will follow through the shadow root to the dom root by calling composedpath().
... the <open-shadow> element's composed path is this: array [ p, shadowroot, open-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes inside the shadow boundary.
Event.msConvertURL() - Web APIs
the msconverturl method instructs the html paste operation on how to modify the src attribute that corresponds to each file in the clipboarddata.files collection, allowing otherwise inaccessible files to be converted to blob or data uris.
... targettype [in] type: domstring one of the following values indicating the desired conversion type: "specified", "base64", or "unchanged".
Event - Web APIs
WebAPIEvent
interfaces based on event below is a list of interfaces which are based on the main event interface, with links to their respective documentation in the mdn api reference.
... event.eventphase read only indicates which phase of the event flow is being processed.
FeaturePolicy.features() - Web APIs
feature whose name appears on the list might not be allowed by the feature policy of the current execution context and/or might not be accessible because of user's permissions.
... example the followin example logs all the supported directives in the console.
File.getAsBinary() - Web APIs
WebAPIFilegetAsBinary
summary the getasbinary method allows to access the file's data in raw binary format.
... example // fileinput is an htmlinputelement: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist) var files = fileinput.files; // object for allowed media types var accept = { binary : ["image/png", "image/jpeg"], text : ["text/plain", "text/css", "application/xml", "text/html"] }; var file; for (var i = 0; i < files.length; i++) { file = files[i]; // if file type could be detected if (file !== null) { if (accept.binary.indexof(file.type) > -1) { // file is a binary, which we accept var data = file.getasbinary...
FileSystemDirectoryEntry.removeRecursively() - Web APIs
the fileerror.code specifies what type of error occurred, as follows: fileerror.invalid_modification_err an attempt was made to remove the root directory; this is not permitted.
... fileerror.no_modification_allowed_err the file system's state doesn't permit modification.
FileSystemFileEntry - Web APIs
obsolete methods createwriter() creates a new filewriter object which allows writing to the file represented by the file system entry.
... example the following code creates an empty file called "log.txt" (if it doesn't exist) and fills it with the text "meow".
File and Directory Entries API - Web APIs
it includes the following interfaces: filesystem represents a file system.
...the interfaces below otherwise mirror the ones from the asynchronous api.
FontFace.display - Web APIs
WebAPIFontFacedisplay
(see below.) block period the browser invisibly prepares a fallback font.
... syntax var display = fontface.display fontface.display = display value a cssomstring with one of the following values.
Frame Timing API - Web APIs
performance frames the performanceframetiming interface extends the following performanceentry properties (for "frame" performance entry types) by qualifying and constrainting the properties as follows: performanceentry.entrytype set to "frame".
... frame observers the performance observer interfaces allow an application to register an observer for specific performance event types.
GainNode.gain - Web APIs
WebAPIGainNodegain
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
... the below snippet wouldn't work as is — for a complete working example, check out our voice-change-o-matic demo (view source.) <div> <button class="mute">mute button</button> </div> var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var gainnode = audioctx.creategain(); var mute = document.queryselector('.mute'); var source; if (navigator.mediadevices.getusermedia) { navigator.mediadevices.getusermedia ( // constraints - only audio needed for this app { audio: true }, // success callback function(stream) { source = audioctx.createmediastreamsource(stream); }, // error callback function(err) { console.log('the following gum error occured: ' + err); } ); } else { console.log('getusermedia not supported on your bro...
GainNode - Web APIs
WebAPIGainNode
example the following example shows basic usage of an audiocontext to create a gainnode, which is then used to mute and unmute the audio when a mute button is clicked by changing the gain property value.
... the below snippet wouldn't work as is — for a complete working example, check out our voice-change-o-matic demo (view source.) <div> <button class="mute">mute button</button> </div> var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var gainnode = audioctx.creategain(); var mute = document.queryselector('.mute'); var source; if (navigator.mediadevices.getusermedia) { navigator.mediadevices.getusermedia ( // constraints - only audio needed for this app { audio: true }, // success callback function(stream) { source = audioctx.createmediastreamsource(stream); }, // error callback function(err) { console.log('the following gum error occured: ' + err); } ); } else { console.log('getusermedia not supported on your bro...
Gamepad.buttons - Web APIs
WebAPIGamepadbuttons
syntax readonly attribute gamepadbutton[] buttons; example the following code is taken from my gamepad api button demo (you can view the demo live, and find the source code on github.) note the code fork — in chrome navigator.getgamepads needs a webkit prefix and the button values are stores as an array of double values, whereas in firefox navigator.getgamepads doesn't need a prefix, and the button values are stored as an array of gamepadbutton objects; it is the...
...in this simple example i've just allowed either.
Gamepad - Web APIs
WebAPIGamepad
the gamepad interface of the gamepad api defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id.
... experimental extensions to gamepad the following interfaces are defined in the gamepad extensions specification, and provide access to experimental features like haptic feedback and webvr controller pose information.
GeolocationPositionError.code - Web APIs
the following values are possible: value associated constant description 1 permission_denied the acquisition of the geolocation information failed because the page didn't have the permission to do it.
... 3 timeout the time allowed to acquire the geolocation, defined by positionoptions.timeout information that was reached before the information was obtained.
GeolocationPositionError - Web APIs
the following values are possible: value associated constant description 1 permission_denied the acquisition of the geolocation information failed because the page didn't have the permission to do it.
... 3 timeout the time allowed to acquire the geolocation, defined by positionoptions.timeout information was reached before the information was obtained.
GlobalEventHandlers - Web APIs
each of these interfaces can, of course, add more event handlers in addition to the ones listed below.
... properties this interface doesn't include any properties except for the event handlers listed below.
Audio() - Web APIs
determining when playback can begin there are three ways you can tell when enough of the audio file has loaded to allow playback to begin: check the value of the readystate property.
... the event-based approach is best: myaudioelement.addeventlistener("canplaythrough", event => { /* the audio is now playable; play it if permissions allow */ myaudioelement.play(); }); memory usage and management if all references to an audio element created using the audio() constructor are deleted, the element itself won't be removed from memory by the javascript runtime's garbage collection mechanism if playback is currently underway.
msAudioCategory - Web APIs
examples include the following local media playback scenarios: local playlist streaming radio streaming playlist music videos streaming audio/radio, youtube, netflix, etc.
... yes communications for streaming communication audio such as the following: voip real time chat or other type of phone calls should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as playback startup latency is affected.
HTMLBRElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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"/><li...
... htmlbrelement.clear is a domstring indicating the flow of text around floating objects.
HTMLCanvasElement.toDataURL() - Web APIs
examples given this <canvas> element: <canvas id="canvas" width="5" height="5"></canvas> you can get a data-url of the canvas with the following lines: var canvas = document.getelementbyid('canvas'); var dataurl = canvas.todataurl(); console.log(dataurl); // "data:image/png;base64,ivborw0kggoaaaansuheugaaaauaaaafcayaaacnby // blaaaadeleqvqimwngobmaaabpaafei8araaaaaelftksuqmcc" setting image quality with jpegs var fullquality = canvas.todataurl('image/jpeg', 1.0); // data:image/jpeg;base64,/9j/4aaqskzjrgabaq...9oadambaairaxeapwd/ad/...
...6ap/z" var mediumquality = canvas.todataurl('image/jpeg', 0.5); var lowquality = canvas.todataurl('image/jpeg', 0.1); example: dynamically change images you can use this technique in coordination with mouse events in order to dynamically change images (gray-scale vs.
HTMLDialogElement.show() - Web APIs
still allowing interaction with content outside of the dialog.
... examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the show() method.
HTMLFormElement.elements - Web APIs
the form controls in the returned collection are in the same order in which they appear in the form by following a preorder, depth-first traversal of the tree.
... the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms.
HTMLHRElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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>...
... recommendation following properties are now obsolete: align, noshade, size, and width.
HTMLHeadElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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</tex...
... recommendation the following property has been removed: profile.
HTMLImageElement.complete - Web APIs
the image is considered completely loaded if any of the following are true: neither the src nor the srcset attribute is specified.
...this is demonstrated in the code below.
HTMLImageElement.crossOrigin - Web APIs
javascript the code below demonstrates setting the crossorigin property on an <img> element to configure cors access for the fetch of a newly-created image.
...thanks for reading me.</p> </div> css body { font: 1.125rem/1.5, helvetica, sans-serif; } .container { display: flow-root; width: 37.5em; border: 1px solid #d2d2d2; } img { float: left; padding-right: 1.5em; } output { background: rgba(100, 100, 100, 0.1); font-family: courier, monospace; width: 95%; } result specifications specification status comment html living standardthe definition of 'htmlimageelement.crossorigin' in that specification.
HTMLLIElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
... recommendation the following property is now obsolete: type.
HTMLLabelElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 ...
... the following property has been added: control.
HTMLMarqueeElement - Web APIs
<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/htmlmarqueeelement" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmarqueeelement</text></a>...
... htmlmarqueeelement.truespeed by default, scrolldelay values lower than 60 are ignored.
HTMLMediaElement.srcObject - Web APIs
see below for an example.
... const mediasource = new mediasource(); const video = document.createelement('video'); video.srcobject = mediasource; supporting fallback to the src property the examples below support older browser versions that require you to create an object url and assign it to src if srcobject isn't supported.
HTMLMetaElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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,...
... recommendation the following property is now obsolete: scheme.
HTMLMeterElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... htmlmeterelement.low a double representing the value of the low boundary, reflecting the lowattribute.
HTMLOListElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="mid...
...it can have the following values: '1' meaning that decimal numbers are used: 1, 2, 3, 4, 5, … 'a' meaning that the lowercase latin alphabet is used: a, b, c, d, e, … 'a' meaning that the uppercase latin alphabet is used: a, b, c, d, e, … 'i' meaning that the lowercase latin numerals are used: i, ii, iii, iv, v, … 'i' meaning that the uppercase latin numerals are used: i, ii, iii, iv, v, … ht...
HTMLObjectElement.setCustomValidity - Web APIs
examples in this example, we pass the id of an input element, and set different error messages depending on whether the value is missing, too low or too high.
... function validate(inputid) { var input = document.getelementbyid(inputid); var validitystate_object = input.validity; if (validitystate_object.valuemissing) { input.setcustomvalidity('you gotta fill this out, yo!'); input.reportvalidity(); } else if (input.rangeunderflow) { input.setcustomvalidity('we need a higher number!'); input.reportvalidity(); } else if (input.rangeoverflow) { input.setcustomvalidity('thats too high!'); input.reportvalidity(); } else { input.setcustomvalidity(''); input.reportvalidity(); } } it's vital to set the message to an empty string if there are no errors.
HTMLOrForeignElement.tabIndex - Web APIs
tab order is as follows: elements with a positive tabindex.
...navigation proceeds from the lowest tabindex to the highest tabindex.
HTMLOrForeignElement - Web APIs
each of these interfaces can, of course, add more features in addition to the ones listed below.
... propertiesdataset read only the dataset read-only property of the htmlorforeignelement interface provides read/write access to all the custom data attributes (data-*) set on the element.nonce the nonce property of the htmlorforeignelement interface returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed.tabindexthe tabindex property of the htmlorforeignelement interface represents the tab order of the current element.methodsblur()the htmlelement.blur() method removes keyboard focus from the current element.focus()the htmlelement.focus() method sets focus on the specified element, if it can be focused.
HTMLParagraphElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 ...
... recommendation the following property is now obsolete: align.
HTMLParamElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
... recommendation the following properties are now obsolete: type, and valuetype.
HTMLPreElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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-base...
... recommendation the following property is now obsolete: width.
HTMLSelectElement.disabled - Web APIs
syntax edit aselectelement.disabled = abool; example html <label> allow drinks?
... <input id="allow-drinks" type="checkbox"/> </label> <label for="drink-select">drink selection:</label> <select id="drink-select" disabled> <option value="1">water</option> <option value="2">beer</option> <option value="3">pepsi</option> <option value="4">whisky</option> </select> javascript var allowdrinkscheckbox = document.getelementbyid("allow-drinks"); var drinkselect = document.getelementbyid("drink-select"); allowdrinkscheckbox.addeventlistener("change", function(event) { if (event.target.checked) { drinkselect.disabled = false; } else { drinkselect.disabled = true; } }, false); result specifications specification status comment html living standardthe definition of 'disabled' in that specification.
HTMLSelectElement.selectedOptions - Web APIs
bel><br> <select id="foods" name="foods" size="7" multiple> <option value="1">burrito</option> <option value="2">cheeseburger</option> <option value="3">double bacon burger supreme</option> <option value="4">pepperoni pizza</option> <option value="5">taco</option> </select> <br> <button name="order" id="order"> order now </button> <p id="output"> </p> the <select> element is set to allow multiple items to be selected, and it is 7 rows tall.
...self, looks like this: let orderbutton = document.getelementbyid("order"); let itemlist = document.getelementbyid("foods"); let outputbox = document.getelementbyid("output"); orderbutton.addeventlistener("click", function() { let collection = itemlist.selectedoptions; let output = ""; for (let i=0; i<collection.length; i++) { if (output === "") { output = "your order for the following items has been placed: "; } output += collection[i].label; if (i === (collection.length - 2) && (collection.length < 3)) { output += " and "; } else if (i < (collection.length - 2)) { output += ", "; } else if (i === (collection.length - 2)) { output += ", and "; } } if (output === "") { output = "you didn't order anything!"; } outputbo...
HTMLSelectElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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><pol...
... example get information about the selected option /* assuming we have the following html <select id='s'> <option>first</option> <option selected>second</option> <option>third</option> </select> */ var select = document.getelementbyid('s'); // return the index of the selected option console.log(select.selectedindex); // 1 // return the value of the selected option console.log(select.options[select.selectedindex].value) // second a better way to track changes t...
HTMLSourceElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 candidate image is a url followed by a 'w' with the width of the images, or an 'x' followed by the pixel density.
HTMLTableElement.frame - Web APIs
syntax htmltableelement.frame = framesides; var framesides = htmltableelement.frame; parameters framesides is a string whose value is one of the following values: void no sides.
... "above" top side "below" bottom side "hsides" top and bottom only "vsides" right and left sides only "lhs" left-hand side only "rhs" right-hand side only "box" all four sides "border" all four sides example // set the frame of tablea to 'border' var t = document.getelementbyid('tablea'); t.frame = "border"; t.border = "2px"; specification w3c dom 2 html specification ...
HTMLTableRowElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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-bas...
...it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline".
HTMLTableSectionElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
...it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline".
HTMLTimeElement.dateTime - Web APIs
the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid month string yyyy-mm 2011-11, 2013-05 valid date string yyyy-mm-dd 1887-12-01 valid yearless date string mm-dd 11-12 valid time string hh:mm hh:mm:ss hh:mm:ss.mmm 23:59 12:15:47 12:15:52.998 valid local date and time string yyyy-mm-dd hh:mm yyyy-mm-dd hh:mm:ss yyyy-mm-dd hh:mm:ss.mmm yyyy-mm-ddthh:mm yyyy-mm-ddthh:mm:ss yyyy-mm-ddthh:mm:ss.mmm 2013-12-25 11:12 1972-07-25 13:43:...
...07 1941-03-15 07:06:23.678 2013-12-25t11:12 1972-07-25t13:43:07 1941-03-15t07:06:23.678 valid time-zone offset string z +hhmm +hh:mm -hhmm -hh:mm z +0200 +04:30 -0300 -08:00 valid global date and time string any combination of a valid local date and time string followed by a valid time-zone offset string 2013-12-25 11:12+0200 1972-07-25 13:43:07+04:30 1941-03-15 07:06:23.678z 2013-12-25t11:12-08:00 valid week string yyyy-www 2013-w46 four or more ascii digits yyyy 2013, 0001 valid duration string pddthhmmss pddthhmms.xs pddthhmms.xxs pddthhmms.xxxs pthhmmss pthhmms.xs pthhmms.xxs pthhmms.xxxs ww dd hh mm ss p12dt7h12m13s p12...
HTMLTrackElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" alig...
... events the following events may be fired on a <track> element, in addition to any that may be fired at its parent, htmlelement.
History.replaceState() - Web APIs
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 - Web APIs
WebAPIHistory
the history interface allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in.
... scrollrestoration allows web applications to explicitly set default scroll restoration behavior on history navigation.
Ajax navigation example - Web APIs
to see how it works, please create the following files (or git clone https://github.com/giabao/mdn-ajax-nav-example.git ): note: for fully integrating the <form> elements within this mechanism, please take a look at the paragraph submitting forms and uploading files.
...ound", 303: "see other", 304: "not modified", 305: "use proxy", 306: "reserved", 307: "temporary redirect", 308: "permanent redirect", 400: "bad request", 401: "unauthorized", 402: "payment required", 403: "forbidden", 404: "not found", 405: "method not allowed", 406: "not acceptable", 407: "proxy authentication required", 408: "request timeout", 409: "conflict", 410: "gone", 411: "length required", 412: "precondition failed", 413: "request entity too large", 414: "request-uri too long", 415: "unsupported media type", 416...
History API - Web APIs
another use for the go() method is to refresh the current page by either passing 0, or by invoking it without an argument: // the following statements // both have the effect of // refreshing the page window.history.go(0) window.history.go() you can determine the number of pages in the history stack by looking at the value of the length property: let numberofentries = window.history.length interfaces history allows manipulation of the browser session history (that is, the pages visited in the tab or frame that the current...
... examples the following example assigns a listener to the onpopstate property.
IDBCursor.advance() - Web APIs
WebAPIIDBCursoradvance
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive.
...advance() works in a similar way to idbcursor.continue, except that it allows you to jump multiple records at a time, not just always go onto the next record.
IDBCursor.continue() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive.
... dataerror the key parameter may have any of the following conditions: the key is not a valid key.
IDBCursor.continuePrimaryKey() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive.
... dataerror the key parameter may have any of the following conditions: the key is not a valid key.
IDBCursor.update() - Web APIs
WebAPIIDBCursorupdate
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive.
...note also that you can't directly put cursor.value into an update call, hence the below example using an intermediary updatedata variable.
IDBCursor - Web APIs
WebAPIIDBCursor
it starts at the lower bound of the key range and moves upwards (monotonically increasing in the order of keys).
...it starts at the lower bound of the key range and moves upwards.
IDBDatabase.createObjectStore() - Web APIs
it includes the following properties: attribute description keypath the key path to be used by the new object store.
... exceptions this method may raise a domexception with a domerror of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback.
IDBFactory - Web APIs
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.
IDBIndex.count() - Web APIs
WebAPIIDBIndexcount
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.get() - Web APIs
WebAPIIDBIndexget
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.getAll() - Web APIs
WebAPIIDBIndexgetAll
if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown.
... exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
IDBIndex.getAllKeys() - Web APIs
if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown.
... exceptions this method may raise a domexception of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
IDBIndex.getKey() - Web APIs
WebAPIIDBIndexgetKey
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.openCursor() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.openKeyCursor() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbindex's transaction is inactive.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex - Web APIs
WebAPIIDBIndex
idbindex.unique read only if true, this index does not allow duplicate values for a key.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBObjectStore.getAll() - Web APIs
if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown.
... exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive.
IDBObjectStore.getAllKeys() - Web APIs
if it is lower than 0 or greater than 232-1 a typeerror exception will be thrown.
... exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive.
IDBObjectStore.index() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the source object store has been deleted, or the transaction for the object store has finished.
... example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBOpenDBRequest.onupgradeneeded - Web APIs
inside the event handler function you can include code to upgrade the database structure, as shown in the example below.
...}; example in the following example you can see the onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded.
IDBRequest.readyState - Web APIs
syntax var currentreadystate = request.readystate; value the idbrequestreadystate of the request, which takes one of the following two values: value meaning pending the request is pending.
... example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request.
IDBRequest.transaction - Web APIs
following the upgrade, the transaction ​property will again be null.
... example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request.
IDBRequest - Web APIs
<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...
... example in the following code snippet, we open a database asynchronously and make a request; onerror and onsuccess functions are included to handle the success and error cases.
IDBTransaction.error - Web APIs
example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
IDBTransaction.onabort - Web APIs
}; example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
IDBTransaction.oncomplete - Web APIs
}; example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
IDBTransaction.onerror - Web APIs
}; example in the following code snippet, we open a read/write transaction on our database and add some data to an object store.
... // this is used a lot below db = dbopenrequest.result; // run the adddata() function to add the data to the database adddata(); }; function adddata() { // create a new object ready for being inserted into the idb var newitem = [ { tasktitle: "walk dog", hours: 19, minutes: 30, day: 24, month: "december", year: 2013, notified: "no" } ]; // open a read/write db transaction, ready for adding the data var trans...
IDBVersionChangeEvent.newVersion - Web APIs
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.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of // implementations you want to test.
IDBVersionChangeEvent - Web APIs
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.) var note = document.queryselector("ul"); // in the following line, you should include the prefixes of implementations you want to test.
IIRFilterNode - Web APIs
it also has the following additional methods: getfrequencyresponse() uses the filter's current parameter settings to calculate the response for frequencies specified in the provided array of frequencies.
...it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects.
ImageCapture.getPhotoSettings() - Web APIs
syntax const settingspromise = imagecapture.getphotosettings() return value a promise that resolves with a photosettings object containing the following properties: filllightmode: the flash setting of the capture device, one of "auto", "off", or "on".
... example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotosettings() to modify the size of an input range.
startSoftwareUpdate - Web APIs
method of installtrigger object syntax boolean startsoftwareupdate ( string url); parameters the startsoftwareupdate method has the following parameter: url a uniform resource locator specifying the location of the xpi file containing the software.
...this method has been largely superseded by newer install method, which is more flexible and allows you to install more than one xpi.
Keyboard.lock() - Web APIs
WebAPIKeyboardlock
examples capturing all keys the following example captures all keypresses.
... navigator.keyboard.lock(); capturing specific keys the following example captures the "w", "a", "s", and "d" keys.
KeyboardEvent: code values - Web APIs
the following tables show what code values are used for each native scancode or virtual keycode on major platforms.
...so, following table is created from source code which maps from scancode to code value.
KeyboardEvent.getModifierState() - Web APIs
example // ignore if following modifier is active.
...if (event.getmodifierstate("control") + event.getmodifierstate("alt") + event.getmodifierstate("meta") > 1) { return; } // handle shortcut key with standard modifier if (event.getmodifierstate("accel")) { switch (event.key.tolowercase()) { case "c": if (event.getmodifierstate("shift")) { // handle accel + shift + c event.preventdefault(); // consume the key event } break; case "k": if (!event.getmodifierstate("shift")) { // handle accel + k event.preventdefault(); // consume the key event } break; } return; } // do somethig different for arr...
KeyframeEffect - Web APIs
constructor keyframeeffect() returns a new keyframeeffect object instance, and also allows you to clone an existing keyframe effect object instance.
... examples in the follow the white rabbit example, the keyframeeffect constructor is used to create a set of keyframes that dictate how the white rabbit should animate down the hole: var rabbitdownkeyframes = new keyframeeffect( whiterabbit, // element to animate [ { transform: 'translatey(0%)' }, // keyframe { transform: 'translatey(100%)' } // keyframe ], { duration: 3000, fill: 'forward...
MediaList.mediaText - Web APIs
the mediatext property of the medialist interface is a stringifier that returns a domstring representing the medialist as text, and also allows you to set a new medialist.
... examples the following would log to the console a textual representation of the medialist of the first stylesheet applied to the current document.
MediaMetadata.MediaMetadata() - Web APIs
syntax var mediametadata = new mediametadata([metadata]) parameters metadata optional the metadata parameters are as follows: title: the title of the media to be played.
... example the following example creates a new media session and assigns action handlers to it: if ('mediasession' in navigator){ navigator.mediasession.metadata = new mediametadata({ title: "podcast episode title", artist: "podcast host", album: "podcast name", artwork: [{src: "podcast.jpg"}] }); navigator.mediasession.setactionhandler('play', function() {}); navigator.mediasession.setactionhandler('pause', function() {}); navigator.mediasession.setactionhandler('seekbackward', function() {}); navigator.mediasession.setactionhandler(...
MediaQueryList - Web APIs
this is very useful for adaptive design, since this makes it possible to observe a document to detect when its media queries change, instead of polling the values periodically, and allows you to programmatically make changes to a document based on media query status.
... events the following events are delivered to mediaquerylist objects: change sent to the mediaquerylist when the result of running the media query against the document changes.
MediaRecorder - Web APIs
error fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsupported codec.
...ar audiourl = url.createobjecturl(blob); audio.src = audiourl; console.log("recorder stopped"); deletebutton.onclick = function(e) { evttgt = e.target; evttgt.parentnode.parentnode.removechild(evttgt.parentnode); } } mediarecorder.ondataavailable = function(e) { chunks.push(e.data); } }) .catch(function(err) { console.log('the following error occurred: ' + err); }) } this code sample is inspired by the web dictaphone demo.
MediaRecorderErrorEvent.error - Web APIs
invalidstateerror an operation was attempted in a context in which it isn't allowed, or a request has been made on an object that's deleted or removed.
... securityerror the mediastream is configured to disallow recording.
MediaSession.playbackState - Web APIs
the value may be one of the following: none the browsing context doesn't currently know the current playback state, or the playback state is not available at this time.
... example the following example sets up event handlers, for pausing and playing: var audio = document.queryselector("#player"); audio.src = "song.mp3"; navigator.mediasession.setactionhandler('play', play); navigator.mediasession.setactionhandler('pause', pause); function play() { audio.play(); navigator.mediasession.playbackstate = "playing"; } function pause() { audio.pause(); navigator.mediasession.playbackstate = "paused"; } specifications specification status comment media session standardthe definition of 'playbackstate' in that specification.
Media Session action types - Web APIs
implement support for each of these in order to allow that type of action to be performed.
... the following strings identify the currently available types of media session action: nexttrack advances playback to the next track.
MediaSource.duration - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
...their sourcebuffer.updating property is true.) example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) { mediasourc...
MediaSource - Web APIs
<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" a...
... examples the following simple example loads a video with xmlhttprequest, playing it as soon as it can.
MediaStreamTrack.applyConstraints() - Web APIs
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.
... examples the following shows how to specify a basic and advanced set of constraints.
MediaStreamTrack: mute event - Web APIs
bubbles no cancelable no interface event event handler property onmute examples in this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the mediastreamtrack referenced by musictrack.
...the following example shows this: musictrack.onmute = event => { document.getelementbyid("timeline-widget").style.backgroundcolor = "#aaa"; } musictrack.mute = event = > { document.getelementbyid("timeline-widget").style.backgroundcolor = "#fff"; } specifications specification status comment media capture and streamsthe definition of 'mute' in that specification.
MediaStreamTrack: unmute event - Web APIs
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.
...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.
Recording a media element - Web APIs
below the playback element is a button for downloading the recorded video.
... lines 17-18 the size and type of the recorded media are output to the log area below the two videos and the download button.
MediaTrackConstraints.logicalSurface - Web APIs
this is used to specify whether or not getdisplaymedia() should allow the user to choose display surfaces which are not necessarily fully visible on the screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents.
... for example, if your app needs to know if the selected display surface is a logical one: let islogicalsurface = displaystream.getvideotracks()[0].getsettings().logicalsurface; following this code, islogicalsurface is true if the display surface contained in the stream is a logical surface; that is, one which may not be entirely onscreen, or may even be entirely offscreen.
MediaTrackSettings - Web APIs
properties some or all of the following will be included in the object, either because it's not supported by the browser or because it's not available due to context.
... properties of shared screen tracks tracks containing video shared from a user's screen (regardless of whether the screen data comes from the entire screen or a portion of a screen, like a window or tab) are generally treated like video tracks, with the exception that they also support the following added settings: cursor a domstring which indicates whether or not the mouse cursor is being included in the generated stream and under what conditions.
MediaTrackSupportedConstraints - Web APIs
properties some combination—but not necessarily all—of the following properties will exist on the object.
... properties specific to shared screen tracks for tracks containing video sources from the user's screen contents, the following additional properties are may be included in addition to those available for video tracks.
Media Source API - Web APIs
mse allows us to replace the usual single track src value fed to media elements with a reference to a mediasource object, which is a container for information like the ready state of the media for being played, and references to multiple sourcebuffer objects that represent the different chunks of media that make up the entire stream.
... the two most common use cases for dash involve watching content “on demand” or “live.” on demand allows a developer to take their time transcoding the assets into multiple resolutions of various quality.
MessageChannel - Web APIs
the messagechannel interface of the channel messaging api allows us to create a new message channel and send data through it via its two messageport properties.
... example in the following example, you can see a new channel being created using the messagechannel.messagechannel constructor.
MessageEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 13.333333333333334%; vertical-align: middle; overflow: hidden;"><svg style="display: 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-anch...
... the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
MessagePort.close() - Web APIs
WebAPIMessagePortclose
this stops the flow of messages to that port.
... example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.addeventlistener.
MessagePort - Web APIs
the messageport interface of the channel messaging api represents one of the two ports of a messagechannel, allowing messages to be sent from one port and listening out for them arriving at the other.
... example in the following example, you can see a new channel being created using the messagechannel() constructor.
Microdata DOM API - Web APIs
inner = document.createelement('ul'); for (var name = 0; name < items[item].properties.names.length; name += 1) { var propli = document.createelement('li'); propli.appendchild(document.createtextnode(items[item].properties.names[name])); inner.appendchild(propli); } itemli.appendchild(inner); outer.appendchild(itemli); } document.body.appendchild(outer); if faced with the following from an earlier example: <section itemscope itemtype="http://example.org/animals#cat"> <h1 itemprop="name http://example.com/fn">hedral</h1> <p itemprop="desc">hedral is a male american domestic shorthair, with a fluffy <span itemprop="http://example.com/color">black</span> fur with <span itemprop="http://example.com/color">white</span> paws and belly.</p> <img itemprop="img" src="hedral.jpeg...
..." alt="" title="hedral, age 18 months"> </section> ...it would result in the following output: name http://example.com/fn desc http://example.com/color img (the duplicate occurrence of "http://example.com/color" is not included in the list.) htmlpropertiescollection the htmlpropertiescollection interface is used for collections of elements that add name-value pairs to a particular item in the microdata model.
MouseEvent.pageX - Web APIs
WebAPIMouseEventpageX
this property was originally specified in the touch events specification as a long integer, but was redefined in the cssom view module to be a double-precision floating-point number to allow for subpixel precision.
... css the css used for this example is shown below.
MouseEvent - Web APIs
<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/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-anch...
... mouseevent.mozinputsource read only the type of device that generated the event (one of the moz_source_* constants listed below).
MutationEvent - Web APIs
performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!).
... mutation events list the following is a list of all mutation events, as defined in dom level 3 events specification: domattrmodified domattributenamechanged domcharacterdatamodified domelementnamechanged domnodeinserted domnodeinsertedintodocument domnoderemoved domnoderemovedfromdocument domsubtreemodified usage you can register a listener for mutation events using eventtarget.addeventlistener() as follows: elem...
MutationObserver.observe() - Web APIs
exceptions typeerror thrown in any of the following circumstances: the options are configured such that nothing will actually be monitored.
... observation follows nodes when disconnected mutation observers are intended to let you be able to watch the desired set of nodes over time, even if the direct connections between those nodes are severed.
Navigation Timing API - Web APIs
while this interface is defined by the high resolution time api, the navigation timing api adds two properties: timing and navigation, of the types below.
... examples calculate the total page load time to compute the total amount of time it took to load the page, you can use the following code: const perfdata = window.performance.timing; const pageloadtime = perfdata.loadeventend - perfdata.navigationstart; this subtracts the time at which navigation began (navigationstart) from the time at which the load event handler returns (loadeventend).
Navigator.mozIsLocallyAvailable() - Web APIs
the navigator.mozislocallyavailable() method allows add-ons to determine whether or not a given resource is available.
... ifoffline allows you to specify whether or not the offline resources cache should be checked; specify true to consider the offline resources cache.
Online and offline events - Web APIs
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)...
... references 'online/offline events' section from the whatwg web applications 1.0 specification the bug tracking online/offline events implementation in firefox and a follow-up a simple test case an explanation of online/offline events ...
NavigatorPlugins.plugins - Web APIs
examples the following example function returns the version of the shockwave flash plugin.
...in chrome) return flash.description.replace(/shockwave flash /,""); } } the following example displays information about the installed plugin(s).
NetworkInformation.effectiveType - Web APIs
the effectivetype read-only property of the networkinformation interface returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'.
... syntax var effectivetype = networkinformation.effectivetype value a string containing one of 'slow-2g', '2g', '3g', or '4g'.
NetworkInformation - Web APIs
networkinformation.effectivetype read only returns the effective type of the connection meaning one of 'slow-2g', '2g', '3g', or '4g'.
...it will be one of the following values: bluetooth cellular ethernet none wifi wimax other unknown event handlers networkinformation.onchange the event that's fired when connection information changes and the change is fired on this object.
Network Information API - Web APIs
this can be used to select high definition content or low definition content based on the user's connection.
... let preloadvideo = true; var connection = navigator.connection || navigator.mozconnection || navigator.webkitconnection; if (connection) { if (connection.effectivetype === 'slow-2g') { preloadvideo = false; } } interfaces networkinformation provides information about the connection a device is using to communicate with the network and provides a means for scripts to be notified if the connection type changes.
Node.compareDocumentPosition() - Web APIs
the return value is a bitmask of the following values: name value document_position_disconnected 1 document_position_preceding 2 document_position_following 4 document_position_contains 8 document_position_contained_by 16 document_position_implementation_specific 32 syntax comparemask = node.comparedocumentposition(othernode) parameters othernode the other node with which to compare the first node’s document position.
... example const head = document.head; const body = document.body; if (head.comparedocumentposition(body) & node.document_position_following) { console.log('well-formed document'); } else { console.error('<head> is not before <body>'); } note: because the result returned by comparedocumentposition() is a bitmask, the bitwise and operator must be used for meaningful results.
Node.localName - Web APIs
WebAPINodelocalName
syntax name = element.localname name is the local name as a string (see notes below for details) example (must be served with xml content type, such as text/xml or application/xhtml+xml.) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <script type="application/javascript"><![cdata[ function test() { var text = document.getelementbyid('text'); var circle = document.getelementbyid('circle'); text.value = "<svg:circle> has:\n" + "localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.name...
...in later versions, in compliance with html5, the property returns in the case of the internal dom storage, which is lower case for both html elements in html doms and xhtml elements in xml doms.
Node.removeChild() - Web APIs
WebAPINoderemoveChild
this will also happen if child was in fact a child of element at the time of the call, but was removed by an event handler invoked in the course of trying to remove the element (e.g., blur.) errors thrown the method throws an exception in 2 different ways: if the child was in fact a child of element and so existing on the dom, but was removed the method throws the following exception: uncaught notfounderror: failed to execute 'removechild' on 'node': the node to be removed is not a child of this node.
... if the child doesn't exist on the dom of the page, the method throws the following exception: uncaught typeerror: failed to execute 'removechild' on 'node': parameter 1 is not of type 'node'.
Node.textContent - Web APIs
WebAPINodetextContent
moreover, since innertext takes css styles into account, reading the value of innertext triggers a reflow to ensure up-to-date computed styles.
... (reflows can be computationally expensive, and thus should be avoided when possible.) unlike textcontent, altering innertext in internet explorer (version 11 and below) removes child nodes from the element and permanently destroys all descendant text nodes.
NonDocumentTypeChildNode.nextElementSibling - Web APIs
the nondocumenttypechildnode.nextelementsibling read-only property returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.
...var nextnode = elementnodereference.nextelementsibling; example <div id="div-01">here is div-01</div> <div id="div-02">here is div-02</div> <script type="text/javascript"> var el = document.getelementbyid('div-01').nextelementsibling; console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </script> this example outputs the following into the console when it loads: siblings of div-01: div script polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/alhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototyp...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
is is a list item</li> <li>this is another list item</li> <div id="div-03">here is div-03</div> <script> let el = document.getelementbyid('div-03').previouselementsibling; document.write('<p>siblings of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodename + '</li>'); el = el.previouselementsibling; } document.write('</ol>'); </script> this example outputs the following into the page when it loads: siblings of div-03 1.
...div polyfills polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/alhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("previouselementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "previouselementsibling", { get: function(){ var e = this.previoussibling; while(e && 1 !== e.nodetype) e = e.previoussibling; return e; } }); } polyfill for internet explorer 9+ and safari // source: https://github.com/jserz/js_piece/blob/master/dom/nondocumenttypechildnode/previouselementsibling/previouselementsibling.md (function (arr) { arr.foreach(function (item) { if (...
Notification.close() - Web APIs
the user already read the notification on the webpage in the case of a messaging app or the following song is already playing in a music app).
... examples in the following snippet, we have a simple function that when called creates an options object and then a new notification.
OES_texture_float - Web APIs
limitation: linear filtering linear filtering on floating-point textures is not allowed with 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.
OES_texture_float_linear - Web APIs
the oes_texture_float_linear extension is part of the webgl api and allows linear filtering with floating-point pixel types for textures.
... linear filtering the oes_texture_float extension alone does not allow linear filtering with floating-point textures.
OES_texture_half_float - Web APIs
limitation: linear filtering linear filtering on half floating-point textures is not allowed with 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.
OES_texture_half_float_linear - Web APIs
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.
... linear filtering the oes_texture_half_float extension alone does not allow linear filtering with half floating-point textures.
OfflineAudioContext.suspend() - Web APIs
for this reason, it is not allowed to schedule multiple suspends at the same quantized frame.
... invalidstateerror if the quantized frame number is one of the following: a negative number is less than or equal to the current time is greater than or equal to the total render duration is scheduled by another suspend for the same time specifications specification status comment web audio apithe definition of 'suspend()' in that specification.
PannerNode.maxDistance - Web APIs
the default is 10000, and non-positive values are not allowed.
... 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.
PannerNode.rolloffFactor - Web APIs
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.
...z position, then schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime + note_length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime + note_length); }; // this tone should decay fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower than the previous one scheduletesttone(0.5, context.currenttime + note_length); // this tone should decay only slightly scheduletesttone(0.1, context.currenttime + note_length * 2); after running this code, the resulting waveforms should look something like this: specifications specification status comment web audio apithe definition of 'rollofffactor' in that speci...
ParentNode.append() - Web APIs
WebAPIParentNodeappend
differences from node.appendchild(): parentnode.append() allows you to also append domstring objects, whereas node.appendchild() only accepts node objects.
... let parent = document.createelement("div") with(parent) { append("foo") } // referenceerror: append is not defined polyfill you can polyfill the append() method in internet explorer 9 and higher with the following code: // source: https://github.com/jserz/js_piece/blob/master/dom/parentnode/append()/append().md (function (arr) { arr.foreach(function (item) { if (item.hasownproperty('append')) { return; } object.defineproperty(item, 'append', { configurable: true, enumerable: true, writable: true, value: function append() { var argarr = array.prototype...
ParentNode.replaceChildren() - Web APIs
for example, say we have a simple application allowing you to choose what food you want for your party.
...> <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 transfer any selected options in the "yes" list over to the "no" list when the "no" button is pressed.
PaymentCurrencyAmount.value - Web APIs
this must be a valid decimal number, with an optional leading minus sign ("-"), then one or more decimal digits 0 through 9, optionally with a decimal point (".") with at least one digit following it to represent fractional units.
... see the example verifying a properly formatted price below for a simple regular expression that can be used to validate the value string prior to submission.
PaymentCurrencyAmount - Web APIs
this string must only contain an optional leading "-" to indicate a negative value, then one or more digits from 0 to 9, and an optional decimal point (".", regardless of locale) followed by at least one more digit.
...this has been removed; instead of allowing sites to choose the standard to use, iso 4217 is always used for the currency identifier now.
PaymentResponse.retry() - Web APIs
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.
... 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.
PaymentResponse - Web APIs
methods paymentresponse.retry() secure context if something is wrong with the payment response's data (and there is a recoverable error), this method allows a merchant to request that the user retry the payment.
...allows the developer to revalidate any requested user data (e.g., the phone number or the email address) if it changes.
Payment processing concepts - Web APIs
validated merchants are allowed to interface with a payment handler.
...if the merchant doesn't successfully validate, it's not allowed to use the payment handler.
Pbkdf2Params - Web APIs
this determines how computationally expensive (that is, slow) the derivekey() operation will be.
... in this context, slow is good, since it makes it more expensive for an attacker to run a dictionary attack against the keys.
performance.measure() - Web APIs
the measure's performance entry will have the following property values: entrytype - set to "measure".
... return value void example the following example shows how measure() is used to create a new measure performance entry in the browser's performance entry buffer.
PerformanceEntry.entryType - Web APIs
syntax var type = entry.entrytype; return value the return value depends on the subtype of the performanceentry object and affects the value of the performanceentry.name property as shown by the table below.
... longtask performancelongtasktiming domstring reports instances of long tasks example the following example shows the use of the entrytype property.
PerformanceEntry.name - Web APIs
syntax var name = entry.name; return value the return value depends on the subtype of the performanceentry object and the value of performanceentry.entrytype, as shown by the table below.
... example the following example shows the use of the name property.
PerformanceEntry - Web APIs
performanceentry instances will always be one of the following subtypes: performancemark performancemeasure performanceframetiming performancenavigationtiming performanceresourcetiming performancepainttiming note: this feature is available in web workers.
... example the following example checks all performanceentry properties to see if the browser supports them and if so, write their values to the console.
PerformanceFrameTiming - Web APIs
<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/performanceframetiming" target="_top"><rect x="1" y="1" width="220" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill...
...="#4d4e53" text-anchor="middle" alignment-baseline="middle">performanceframetiming</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface has no properties but it extends the following performanceentry properties (for "frame" performance entry types) by qualifying and constraining the properties as follows: performanceentry.entrytype returns "frame".
PerformanceMark - Web APIs
<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/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"...
...width="150" 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">performancemark</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 by qualifying/constraining the properties as follows: performanceentry.entrytype returns "mark".
PerformanceMeasure - Web APIs
<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/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"...
...th="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="291" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">performancemeasure</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 by qualifying/constrainting the properties as follows: performanceentry.entrytype returns "measure".
PerformanceNavigationTiming.type - Web APIs
the value must be one of the following: navigate navigation started by clicking a link, entering the url in the browser's address bar, form submission, or initializing through a script operation other than reload and back_forward as listed below.
... example the following example illustrates this property's usage.
PerformanceResourceTiming.redirectEnd - Web APIs
when fetching a resource, if there are multiple http redirects, and any of the redirects have an origin that is different from the current document, and the timing allow check algorithm passes for each redirected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned.
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.redirectStart - Web APIs
if there are http redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the starting time of the fetch that initiates the redirect; otherwise, zero is returned.
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
Using the Performance API - Web APIs
the following code example shows the use of domhighrestimestamp and the performance.now() method.
...in the following example, json serialization for the performance, performance.timing and performance.navigation objects is printed in the object element.
Performance API - Web APIs
the navigation property returns a performancenavigation object representing the type of navigation that occurs in the given browsing context, such as the page was navigated to from history, the page was navigated to by following a link, etc.
...also adds the timing-allow-origin response header.
Permissions.query() - Web APIs
WebAPIPermissionsquery
uservisibleonly: (push only, not supported in firefox — see the browser support section below) indicates whether you want to show a notification for every message or be able to send silent push notifications.
... note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api.
Permissions.revoke() - Web APIs
uservisibleonly: (push only, not supported in firefox — see the browser compatibility section below) indicates whether you want to show a notification for every message or be able to send silent push notifications.
... note: the persistent-storage permission allows an origin to use a persistent box (i.e persistent storage) for its storage, as per the storage api.
Permissions API - Web APIs
concepts and usage historically different apis handle their own permissions inconsistently — for example the notifications api allows for explicit checking of permission status and requesting permission, whereas the geolocation api doesn't (which causes problems if the user denied the initial permission request).
... the permissions api provides the tools to allow developers to implement a better user experience as far as permissions are concerned.
PluginArray - Web APIs
examples the following example function returns the version of the shockwave flash plugin.
...'plugintable'); for(var i = 0; i < pluginslength; i++) { let newrow = table.insertrow(); newrow.insertcell().textcontent = navigator.plugins[i].name; newrow.insertcell().textcontent = navigator.plugins[i].filename; newrow.insertcell().textcontent = navigator.plugins[i].description; newrow.insertcell().textcontent = navigator.plugins[i].version?navigator.plugins[i].version:""; } the following example displays information about the installed plugin(s).
PositionOptions - Web APIs
note that this can result in slower response times or increased power consumption (with a gps chip on a mobile device for example).
... positionoptions.timeout secure context is a positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
ProgressEvent - Web APIs
<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/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="middl...
... examples the following example adds a progressevent to a new xmlhttprequest and uses it to display the status of the request.
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
syntax excludecredentials = publickeycredentialcreationoptions.excludecredentials value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created.
...the value of the strings may be: "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed).
PublicKeyCredentialRequestOptions - Web APIs
publickeycredentialrequestoptions.allowcredentials optional an array of credentials descriptor which restricts the acceptable existing credentials for retrieval.
... examples var options = { challenge: new uint8array([/* bytes sent from the server */]), rpid: "example.com", /* will only work if the current domain is something like foo.example.com */ userverification: "preferred", timeout: 60000, // wait for a minute allowcredentials: [ { transports: "usb", type: "public-key", id: new uint8array(26) // actually provided by the server }, { transports: "internal", type: "public-key", id: new uint8array(26) // actually provided by the server } ], extensions: { uvm: true, // rp wants to know how the user was verified loc: false, txauthsimple: "could y...
PushManager.subscribe() - Web APIs
it can have the following properties: uservisibleonly: a boolean indicating that the returned push subscription will only be used for messages whose effect is made visible to the user.
...nse to a user gesture, such as clicking a button, for example: btn.addeventlistener('click', function() { serviceworkerregistration.pushmanager.subscribe(options) .then(function(pushsubscription) { // handle subscription }); }) 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.
RTCConfiguration.bundlePolicy - Web APIs
this string, which must be a member of the rtcbundlepolicy enumeration, has the following possible values: balanced the ice agent begins by creating one rtcdtlstransport to handle each type of content added: one for audio, one for video, and one for the rtc data channel, if applicable.
... examples the following example creates a new rtcpeerconnection with a configuration setting the connection's bundlepolicy to max-compat to maximize compatibility while attempting to optimize network use.
RTCConfiguration.certificates - Web APIs
see using certificates below for more information on why you might want to—or not to—explicitly provide certificates.
... this attribute supports providing multiple certificates because even though a given dtls connection uses only one certificate, providing multiple certificates allows support for multiple encryption algorithms.
RTCDTMFSender - Web APIs
the primary purpose for webrtc's 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.
... <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="middle">eventtarget</text></a><polyline points="111,25 ...
RTCDTMFToneChangeEvent.RTCDTMFToneChangeEvent() - Web APIs
options a dictionary of type rtcdtmftonechangeeventinit, which may contain one or more of the following fields: tone a domstring containing a single dtmf tone character which has just begun to play, or an empty string ("") to indicate that the previous tone has stopped playing.
...lower-case "a"-"d" automatically gets converted to upper-case.
RTCDTMFToneChangeEvent - Web APIs
properties in addition to the properties of event, this interface offers the following: rtcdtmftonechangeevent.tone read only a domstring specifying the tone which has begun playing, or an empty string ("") if the previous tone has finished playing.
...it appends each tone to a display box as it's played, and, once all tones have been sent, re-enabled a previously-disabled "send" button, allowing the next dmtf string to be entered.
RTCDataChannel.bufferedAmount - Web APIs
whenever this value decreases to fall to or below the value specified in the bufferedamountlowthreshold property, the user agent fires the bufferedamountlow event.
... example the snippet below includes a function which changes the contents of a block with the id "buffersize" to a string indicating the number of bytes currently buffered on an rtcdatachannel.
RTCErrorEvent - Web APIs
it's based on the standard event interface, but adds rtc-specific information describing the error, as shown below.
... 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).
RTCIceCandidate.RTCIceCandidate() - Web APIs
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.
... the following fields are initialized to null if they are not included in the rtcicecandidate.candidate property: foundation, component, priority , ip, protocol, port, type, tcptype, relatedaddress, and relatedport.
RTCIceCandidate.usernameFragment - Web APIs
see randomization below for details.
...the function below, ssnewcandidate(), is called when a message, signalmsg, arrives from the signaling server that contains an ice candidate to be added to the rtcpeerconnection.
RTCIceCandidatePairStats - Web APIs
in addition, it adds the following new properties: availableincomingbitrate optional provides an informative value representing the available inbound capacity of the network by reporting the total number of bits per second available for all of the candidate pair's incoming rtp streams.
... obsolete properties the following properties have been removed from the specification and should no longer be used.
RTCIdentityErrorEvent.protocol - Web APIs
firefox implements the interface of this property under the following name: rtcpeerconnectionidentityerrorevent.
... syntax var protocol = event.protocol; event.protocol = "idp.html"; example pc.onidpassertionerror = function( ev ) { alert("the idp uses the following protocol '" + ev.protocol + "."); } ...
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
this interval is computed following the formula outlined in rfc 1889: a.7.
...since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once.
RTCInboundRtpStreamStats.qpSum - Web APIs
see calculating average quantization below for a function that does this.
... example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream.
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
this interval is computed following the formula outlined in rfc 1889: a.7.
...since this value is also used to determine the number of seconds after a stream starts to flow before the first rtcp packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be flooded with rtcp packets coming in all at once.
RTCOutboundRtpStreamStats.qpSum - Web APIs
see calculating average quantization below for a function that does this.
... example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcstats object that contains rtp stream statistics, returning 0 if the object doesn't describe an rtp stream.
RTCPeerConnection() - Web APIs
see using certificates below for additional information.
...you may find in some cases that connections can be established more quickly by allowing the ice agent to start fetching ice candidates before you start trying to connect, so that they're already available for inspection when rtcpeerconnection.setlocaldescription() is called.
RTCPeerConnection.getStats() - Web APIs
exceptions this method does not throw exceptions; instead, it rejects the returned promise with one of the following errors: invalidaccesserror there is no rtcrtpsender or rtcrtpreceiver whose track matches the specified selector, or selector matches more than one sender or receiver.
...a section is created for each report with a header and all of the statistics below, with the type, id, and timestamp handled specially to place them at the top of the list.
RTCPeerConnection: negotiationneeded event - Web APIs
see signaling transaction flow in signaling and video calling for a description of the signaling process that begins with a negotiationneeded event.
...the other peer should recognize this message and follow up by creating its own rtcpeerconnection, setting the remote description with setremotedescription(), and then creating an answer to send back to the offering peer.
RTCPeerConnection.restartIce() - Web APIs
the webrtc api's rtcpeerconnection interface offers the restartice() method to allow a web application to easily request that ice candidate gathering be redone on both ends of the connection.
... this simplifies the process by allowing the same method to be used by either the caller or the receiver to trigger an ice restart.
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
the findreportentry() function shown below examines an rtcstatsreport, returning the rtcstats-based statistics record which contains the specified key — and for which the key has the specified value.
... the output log, given the styles used by the example, looks like this: in the screenshot, we see a heading followed by the scrollable <div> we refer to as statsbox.
RTCRtpEncodingParameters - Web APIs
maxbitrate an unsigned long integer indicating the maximum number of bits per second to allow for this encoding.
... maxframerate a double-precision floating-point value specifying the maximum number of frames per second to allow for this encoding.
RTCRtpSendParameters.encodings - Web APIs
maxbitrate an unsigned long integer indicating the maximum number of bits per second to allow for this encoding.
... maxframerate a double-precision floating-point value specifying the maximum number of frames per second to allow for this encoding.
RTCRtpSendParameters - Web APIs
properties in addition to the properties below, rtcrtpsendparameters inherits the properties from the rtcrtpparameters interface.
...the default value is low.
RTCRtpStreamStats.qpSum - Web APIs
see calculating average quantization below for a function that does this.
... example calculating average quantization the calculateaverageqp() function shown below computes the average qp for the given rtcrtpstreamstats object, returning 0 if the object doesn't describe an rtp stream.
RTCRtpStreamStats - Web APIs
it's based on rtcstats and adds the following additional fields.
...in addition, some or all of the following properties are available.
RTCRtpTransceiver.direction - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
... exceptions when setting the value of direction, the following exceptions can occur: invalidstateerror either the receiver's rtcpeerconnection is closed or the rtcrtpreceiver is stopped.
RTCSessionDescription() - Web APIs
that dictionary has the following properties: type required.
... a string which is a member of the rtcsdptype enum; it must have one of the following values: this enum defines strings that describe the current state of the session description, as used in the type property.
ReadableStream.ReadableStream() - Web APIs
underlyingsource can contain the following: start(controller) this is a method, called immediately when the object is constructed.
... examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code).
ReadableStream.cancel() - Web APIs
searchterm.tolowercase() : searchterm; var buffersize = math.max(tomatch.length - 1, contextbefore); var bytesreceived = 0; var buffer = ''; var matchfoundat = -1; return reader.read().then(function process(result) { if (result.done) { console.log('failed to find match'); return; } bytesreceived += result.value.length; console.log(`received ${bytesreceived} bytes of data s...
...buffer.tolowercase() : buffer).indexof(tomatch); } if (matchfoundat === -1) { buffer = buffer.slice(-buffersize); } else if (buffer.slice(matchfoundat + tomatch.length).length >= contextafter) { console.log("here's the match:") console.log(buffer.slice( math.max(0, matchfoundat - contextbefore), matchfoundat + tomatch.length + contextafter )); console.log("cancelling fetch"); reader.cancel(); return; } else { console.log('found match, but need more context…'); } // keep reading return reader.read().
ReadableStream.tee() - Web APIs
this is useful for allowing two readers to read a stream simultaneously, perhaps at different speeds.
... examples in the following simple example, a previously-created stream is teed, then both resulting streams (contained in two members of a generated array) are passed to a function that reads the data out of the two streams and prints each stream's chunks sequentially to a different part of the ui.
ReadableStream - Web APIs
examples in the following example, an artificial response is created to stream html fragments fetched from another resource to the browser.
... fetch("https://www.example.org/").then((response) => { const reader = response.body.getreader(); const stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" reader.read().then(({ done, value }) => { // is there no more data to read?
ReadableStreamDefaultController - Web APIs
the readablestreamdefaultcontroller interface of the streams api represents a controller allowing control of a readablestream's state and internal queue.
... examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code).
ReportingObserver() - Web APIs
observer: a reference to the same reportingobserver object, allowing for recursive report collection, etc.
... options optional an reportingobserveroptions object allowing you to set the options for creating the object.
Request.cache - Web APIs
WebAPIRequestcache
cached redirects will be followed if the request's redirect property is "follow" and the redirects do not violate the "same-origin" mode.
...// abortcontroller and signal to allow better memory cleaning.
Request.destination - Web APIs
the destination is used by the user agent to, for example, help determine which set of rules to follow for cors purposes, or how to navigate any complicated code paths that affect how specific types of request get handled.
... example in the following snippet, we create a new request using the request() constructor (for an image file in the same directory as the script), then save the request's destination: var myrequest = new request('flowers.jpg'); var mydestination = myrequest.destination; // returns the empty string by default specifications specification status comment fetchthe definition of 'destination' in ...
Request.headers - Web APIs
WebAPIRequestheaders
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request headers in a variable: var myrequest = new request('flowers.jpg'); var myheaders = myrequest.headers; // headers {} to add a header to the headers object we use headers.append; we then create a new request along with a 2nd init parameter, passing headers in as an init option: var myheaders = new headers(); myheaders.append('content-type', 'image/jpeg'); var myinit = { method: 'get', headers: myheaders, mode: 'cors', cache: 'de...
...fault' }; var myrequest = new request('flowers.jpg', myinit); mycontenttype = myrequest.headers.get('content-type'); // returns 'image/jpeg' specifications specification status comment fetchthe definition of 'headers' in that specification.
Request.mode - Web APIs
WebAPIRequestmode
cors — allows cross-origin requests, for example to access various apis offered by 3rd party vendors.
... example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request mode in a variable: var myrequest = new request('flowers.jpg'); var mymode = myrequest.mode; // returns "cors" by default specifications specification status comment fetchthe definition of 'mode' in that specification...
Request.redirect - Web APIs
WebAPIRequestredirect
syntax var myredirect = request.redirect; value a requestredirect enum value, which can be one the following strings: follow error manual if not specified when the request is created, it takes the default value of follow.
... example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request redirect value in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.redirect; specifications specification status comment fetchthe definition of 'redirect' in that specification.
ResizeObserver.observe() - Web APIs
options optional an options object allowing you to set options for the observation.
... 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) + 're...
ResizeObserverEntry - Web APIs
the resizeobserverentry interface represents the object passed to the resizeobserver() constructor's callback function, which allows you to access the new dimensions of the element or svgelement being observed.
... examples the following snippet is taken from the resize-observer-text.html (see source) example.
Resource Timing API - Web APIs
the fetchstart timestamps follows and redirect processing (if applicable) and preceeds dns lookup.
...this requires the server providing the resource to send the timing-allow-origin http response header with a value specifying the origin or origins which are allowed to get the restricted timestamp values.
Response.clone() - Web APIs
WebAPIResponseclone
in fact, the main reason clone() exists is to allow multiple uses of body objects (when they are one-use only.) syntax var response2 = response1.clone(); parameters none.
... var image1 = document.queryselector('.img1'); var image2 = document.queryselector('.img2'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { var response2 = response.clone(); response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); image1.src = objecturl; }); response2.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); image2.src = objecturl; }); }); specifications specification status ...
Response.type - Web APIs
WebAPIResponsetype
it can be one of the following: basic: normal, same origin response, with all headers exposed except “set-cookie” and “set-cookie2″.
... var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.type); // returns basic by default response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'type' in that specification.
SVGAElement - Web APIs
svgaelement.ping is a domstring that reflects the ping attribute, containing a space-separated list of urls to which, when the hyperlink is followed, post requests with the body ping will be sent by the browser (in the background).
... example in the example below, the target attribute of the <a> element is set to _blank and when the link is clicked, it logs to notify whether the condition is met or not.
SVGAnimatedPathData - Web APIs
name type description animatednormalizedpathseglist svgpathseglist provides access to the current animated 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).
... 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).
SVGElement - Web APIs
<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="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,...
... abort fired when page loading is stopped before an svg element has been allowed to load completely.
SVGMarkerElement - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
SVGSVGElement - Web APIs
<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" tex...
... to suspend redraw actions as a collection of svg dom changes occur, precede the changes to the svg dom with a method call similar to: const suspendhandleid = suspendredraw(maxwaitmilliseconds) and follow the changes with a method call similar to: unsuspendredraw(suspendhandleid) note that multiple suspendredraw() calls can be used at once, and that each such method call is treated independently of the other suspendredraw() method calls.
SVGScriptElement - Web APIs
<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 x1="121" y1=...
...a domexception is raised with the code no_modification_allowed_err on an attempt to change the value of a read only attribut.
Screen.lockOrientation() - Web APIs
syntax lockallowed = window.screen.lockorientation(orientation); parameters orientation the orientation into which to lock the screen.
... the following strings represent the possible orientation requirements you may specify: portrait-primary it represents the orientation of the screen when it is in its primary portrait mode.
ScrollToOptions.behavior - Web APIs
syntax behavior: scrollbehavior value an enum, the value of which can be one of the following: smooth: the scrolling animates smoothly.
... examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e.
ScrollToOptions - Web APIs
a scrolltooptions dictionary can be provided as a parameter for the following methods: window.scroll() window.scrollby() window.scrollto() element.scroll() element.scrollby() element.scrollto() properties scrolltooptions.top specifies the number of pixels along the y axis to scroll the window or element.
... examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e.
Selection.modify() - Web APIs
WebAPISelectionmodify
note: starting in gecko 5.0, the "word" granularity no longer includes the following space, regardless of the default platform behavior.
...then click the button below to expand the selection.
ServiceWorkerContainer - Web APIs
serviceworkercontainer.startmessages() explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g.
... examples the example below first checks to see if the browser supports service workers.
ServiceWorkerMessageEvent - Web APIs
this extends the default message event to allow setting a serviceworker object as the source of a message.
... examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
SourceBuffer - Web APIs
<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="middle">eventtar...
... examples the following simple example loads a video chunk by chunk as fast as possible, playing it as soon as it can.
SourceBufferList - Web APIs
<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...
... sourcebufferlist: indexed property getter this getter allows the sourcebuffer objects in the list to be accessed with an array operator (i.e.
SpeechGrammarList.item() - Web APIs
the item getter of the speechgrammarlist interface is a standard getter — it allows individual speechgrammar objects to be retrieved from the speechgrammarlist using array syntax.
... = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var myfirstgrammar = speechrecognitionlist[0]; // var should contain the speechgrammar object created in line 4.
SpeechGrammarList - Web APIs
methods speechgrammarlist.item() standard getter — allows individual speechgrammar objects to be retrieved from the speechgrammarlist using array syntax.
... = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; specifications specification status comment web speech apithe definition of 'speechgrammarlist()' in that specification.
SpeechRecognitionEvent.resultIndex - Web APIs
the resultindex read-only property of the speechrecognitionevent interface returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed.
... the speechrecognitionresultlist object is not an array, but it has a getter that allows it to be accessed by array syntax.
StaticRange - Web APIs
<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/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" te...
... properties the properties below are inherited from its parent interface, abstractrange.
Storage.setItem() - Web APIs
WebAPIStoragesetItem
(safari sets the quota to 0 bytes in private mode, unlike other browsers, which allow storage in private mode using separate data containers.) hence developers should make sure to always catch possible exceptions from setitem().
... example the following function creates three data items inside local storage.
Using the Storage Access API - Web APIs
usage notes the storage access api is designed to allow embedded content to request access to storage that would otherwise be blocked when a user’s browser is set to block all third-party cookies.
... first of all, if the <iframe> is sandboxed, the embedding website needs to add the allow-storage-access-by-user-activation sandbox token to allow storage access requests to be successful, along with allow-scripts and allow-same-origin to allow it to call the api, and execute in an origin that can have cookies: <iframe sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin"> ...
SubtleCrypto.deriveBits() - Web APIs
essentially derivekey() is composed of derivebits() followed by importkey().
... exceptions the promise is rejected when one of the following exceptions are encountered: invalidaccesserror raised when the base key is not a key for the requested derivation algorithm or if the cryptokey.usages value of that key doesn't contain derivekey.
SubtleCrypto.exportKey() - Web APIs
it can be one of the following: raw: raw format.
... exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when trying to export a non-extractable key.
SubtleCrypto.importKey() - Web APIs
it can be one of the following: raw: raw format.
... exceptions the promise is rejected when one of the following exceptions is encountered: syntaxerror raised when keyusages is empty but the unwrapped key is of type secret or private.
SubtleCrypto.unwrapKey() - Web APIs
it can be one of the following: raw: raw format.
... exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the unwrapping key is not a key for the requested unwrap algorithm or if the cryptokey.usages value of that key doesn't contain unwrap.
SubtleCrypto.wrapKey() - Web APIs
it can be one of the following: raw: raw format.
... exceptions the promise is rejected when one of the following exceptions is encountered: invalidaccesserror raised when the wrapping key is not a key for the requested wrap algorithm.
SyncManager.register() - Web APIs
the available options are: allowonbattery: a boolean that determines whether synchronization is allowed when the user agent is on a battery-powered device.
... idlerequired: a boolean that determines whether synchronization is allowed when the user agent's device is idle.
Text.wholeText - Web APIs
WebAPITextwholeText
this allows to specify any text node and obtain all adjacent text as a single string.
... syntax str = textnode.wholetext; notes and example suppose you have the following simple paragraph within your webpage (with some whitespace added to aid formatting throughout the code samples here), whose dom node is stored in the variable para: <p>thru-hiking is great!
Text - Web APIs
WebAPIText
<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...
... properties included from slotable the text interface includes the following property, defined on the slotable mixin.
TextEncoder - Web APIs
polyfill the below polyfill is compliant with the standard and therefore only supports utf-8.
...finally, note that you should run the below code through a minifier (especially closure compiler) to turn sequences like 0x1e << 3 into 0xf0.
TextMetrics - Web APIs
html <canvas id="canvas" width="550" height="500"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); const baselinesabovealphabetic = ['fontboundingboxascent', 'actualboundingboxascent', 'emheightascent', 'hangingbaseline']; const baselinesbelowalphabetic = ['ideographicbaseline', 'emheightdescent', 'actualboundingboxdescent', 'fontboundingboxdescent']; const baselines = [...baselinesabovealphabetic, ...baselinesbelowalphabetic]; ctx.font = '25px serif'; ctx.strokestyle = 'red'; baselines.foreach(function (baseline, index) { let text = 'abcdefghijklmnop (' + baseline + ')'; let textmetrics = ctx.measuretext(text);...
... let y = 50 + index * 50; ctx.beginpath(); ctx.filltext(text, 0, y); let liney = y - math.abs(textmetrics[baseline]); if (baselinesbelowalphabetic.includes(baseline)) { liney = y + math.abs(textmetrics[baseline]); } ctx.moveto(0, liney); ctx.lineto(550, liney); ctx.stroke(); }); result measuring text width when measuring the x-direction of a piece of text, the sum of actualboundingboxleft and actualboundingboxright can be wider than the width of the inline box (width), due to slanted/italic fonts where characters overhang their advance width.
TextTrack.mode - Web APIs
WebAPITextTrackmode
the text track mode is one of the values listed below, under text track mode constants.
... text track mode constants the text track mode—sometimes identified using the idl enum texttrackmode—must be one of the following values: disabled the text track is currently disabled.
Touch() - Web APIs
WebAPITouchTouch
syntax touch = new touch(touchinit); arguments touchinit is a touchinit dictionary, having the following fields: "identifier", required, of type long, that is the identification number for the touch point.
...the user agent may use 0 as the value in this case, or it may use any other value in the allowed range.
TouchEvent.changedTouches - Web APIs
the changedtouches read-only property is a touchlist whose touch points (touch objects) varies depending on the event type, as follows: for the touchstart event, it is a list of the touch points that became active with the current event.
... in following code snippet, the touchmove event handler iterates through the changedtouches list and prints the identifier of each touch point that changed since the last event.
TouchEvent - Web APIs
<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/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-anch...
...values below 1.0 indicate an inward pinch (zoom out).
Supporting both TouchEvent and MouseEvent - Web APIs
below are some details about the interaction and the ramifications for application developers.
... // touchmove handler function process_touchmove(ev) { // call preventdefault() to prevent any further handling ev.preventdefault(); } event order although the specific ordering of touch and mouse events is implementation-defined, the standard indicates the following order is typical: for single input: touchstart zero or more touchmove events, depending on movement of the finger(s) touchend mousemove mousedown mouseup click if the touchstart, touchmove or touchend event is canceled during an interaction, no mouse or click events will be fired, and the resulting sequence of events would just be: touchstart zero or more touchmove events, depen...
UIEvent.cancelBubble - Web APIs
it is set to false by default, allowing the event to bubble up the dom, if it is a bubbleable event.
...not all events are allowed to bubble up the dom.
URL.origin - Web APIs
WebAPIURLorigin
the exact structure varies depending on the type of url: for http or https urls, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified).
... for blob: urls, the origin of the url following blob: will be used, e.g "blob:https://mozilla.org" will be returned as "https://mozilla.org".
ValidityState - Web APIs
rangeoverflow read only a boolean that is true if the value is greater than the maximum specified by the max attribute, or false if it is less than or equal to the maximum.
... rangeunderflow read only a boolean that is true if the value is less than the minimum specified by the min attribute, or false if it is greater than or equal to the minimum.
Visual Viewport API - Web APIs
these events allow you to position elements relative to the visual viewport that would normally be anchored to the layout viewport.
... example the code below is based on the sample the specification, though it adds a few things that make it function better.
WEBGL_compressed_texture_astc.getSupportedProfiles() - Web APIs
currently, this can be: "ldr": low dynamic range.
...low dynamic ranges are for example jpeg format images which won't exceed 255:1, or crt monitors which won't exceed 100:1.
WakeLock - Web APIs
WebAPIWakeLock
examples the following asynchronous function requests a wakelocksentinel object.
... const requestwakelock = async () => { try { const wakelock = await navigator.wakelock.request('screen'); } catch (err) { // the wake lock request fails - usually system related, such low as battery console.log(`${err.name}, ${err.message}`); } } requestwakelock(); specifications specification status comment screen wake lock apithe definition of 'wakelock' in that specification.
WakeLockSentinel - Web APIs
this can happen if the document becomes inactive or looses visibility, if the device is low on power or the user turns on a power save mode.
... properties this interface provides the following properties.
WaveShaperNode - Web APIs
example the following example shows basic usage of an audiocontext to create a wave shaper node.
...we found the below distortion curve code on stack overflow.
WebGL2RenderingContext.copyTexSubImage3D() - Web APIs
x a glint specifying the x coordinate of the lower left corner where to start copying.
... y a glint specifying the y coordinate of the lower left corner where to start copying.
WebGLQuery - Web APIs
another kind of queries are disjoint timer queries, which allow you to measure performance and profiling of your gpu.
... when working with webglquery objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createquery() webgl2renderingcontext.deletequery() webgl2renderingcontext.isquery() webgl2renderingcontext.beginquery() webgl2renderingcontext.endquery() webgl2renderingcontext.getquery() webgl2renderingcontext.getqueryparameter() examples creating a webglquery object in this example, gl must be a webgl2renderingcontext.
WebGLRenderingContext.blendEquationSeparate() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
... when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
WebGLRenderingContext.bufferSubData() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
... a gl.invalid_enum error is thrown if target is not one of the allowed enums.
WebGLRenderingContext.copyTexImage2D() - Web APIs
x a glint specifying the x coordinate of the lower left corner where to start copying.
... y a glint specifying the y coordinate of the lower left corner where to start copying.
WebGLRenderingContext.copyTexSubImage2D() - Web APIs
x a glint specifying the x coordinate of the lower left corner where to start copying.
... y a glint specifying the y coordinate of the lower left corner where to start copying.
WebGLRenderingContext.framebufferTexture2D() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
... when using a webgl 2 context, the following values are available additionally: gl.depth_stencil_attachment: depth and stencil buffer.
WebGLRenderingContext.generateMipmap() - Web APIs
a higher-resolution mipmap is used for objects that are closer, and a lower-resolution mipmap is used for objects that are farther away.
... when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.getBufferParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
... when using a webgl 2 context, the following values are available additionally: gl.static_read, gl.dynamic_read, gl.stream_read, gl.static_copy, gl.dynamic_copy, gl.stream_copy.
WebGLRenderingContext.getShaderPrecisionFormat() - Web APIs
either gl.low_float, gl.medium_float, gl.high_float, gl.low_int, gl.medium_int, or gl.high_int.
... examples the following code gets the precision format of a gl.vertex_shader with a gl.medium_float precision type.
WebGLRenderingContext.getUniformLocation() - Web APIs
additionally, for uniforms declared as arrays, the following names are also valid: the uniform name without the [0] suffix.
... errors the following errors may occur; to check for errors after getuniformlocation() returns, call geterror().
WebGLRenderingContext.hint() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.fragment_shader_derivative_hint: same as ext.fragment_shader_derivative_hint_oes mode sets the behavior.
... examples the following example hints that the quality of filtering when generating mipmap images should be most efficient instead of best quality.
WebGLRenderingContext.lineWidth() - Web APIs
the maximum minimum width is allowed to be 1.0.
... the minimum maximum width is also allowed to be 1.0.
WebGLRenderingContext.readPixels() - Web APIs
syntax // webgl1: void gl.readpixels(x, y, width, height, format, type, pixels); // webgl2: void gl.readpixels(x, y, width, height, format, type, glintptr offset); void gl.readpixels(x, y, width, height, format, type, arraybufferview pixels, gluint dstoffset); parameters x a glint specifying the first horizontal pixel that is read from the lower left corner of a rectangular block of pixels.
... y a glint specifying the first vertical pixel that is read from the lower left corner of a rectangular block of pixels.
WebGLRenderingContext.scissor() - Web APIs
syntax void gl.scissor(x, y, width, height); parameters x a glint specifying the horizontal coordinate for the lower left corner of the box.
... y a glint specifying the vertical coordinate for the lower left corner of the box.
WebGLRenderingContext.stencilOp() - Web APIs
syntax void gl.stencilop(fail, zfail, zpass); parameters all three parameters accept all constants listed below.
... gl.enable(gl.stencil_test); gl.stencilop(gl.incr, gl.decr, gl.invert); to get the current information about stencil and depth pass or fail, query the following constants with getparameter().
WebGLRenderingContext.stencilOpSeparate() - Web APIs
syntax void gl.stencilopseparate(face, fail, zfail, zpass); parameters the fail, zfail and zpass parameters accept all constants listed below.
... gl.enable(gl.stencil_test); gl.stencilopseparate(gl.front, gl.incr, gl.decr, gl.invert); to get the current information about stencil and depth pass or fail, query the following constants with getparameter().
WebGLRenderingContext.texImage2D() - Web APIs
when using the webgl_depth_texture extension: gl.depth_component gl.depth_stencil when using the ext_srgb extension: ext.srgb_ext ext.srgb_alpha_ext when using a webgl 2 context, the following values are available additionally: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rg16ui gl.rg32ui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb8_alpha8 gl.rgb5_a1 gl.rgb10_a2 gl.rgba4 gl.rgba16f gl.rgba32f gl.r...
... when using the webgl_depth_texture extension: gl.unsigned_short gl.unsigned_int ext.unsigned_int_24_8_webgl (constant provided by the extension) when using the oes_texture_float extension: gl.float when using the oes_texture_half_float extension: ext.half_float_oes (constant provided by the extension) when using a webgl 2 context, the following values are available additionally: gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_rev (pixels must be null) pixels one of the following objects can be used...
WebGLRenderingContext.viewport() - Web APIs
syntax void gl.viewport(x, y, width, height); parameters x a glint specifying the horizontal coordinate for the lower left corner of the viewport origin.
... y a glint specifying the vertical coordinate for the lower left corner of the viewport origin.
WebGLTransformFeedback - Web APIs
it allows to preserve the post-transform rendering state of an object and resubmit this data multiple times.
... when working with webgltransformfeedback objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createtransformfeedback() webgl2renderingcontext.deletetransformfeedback() webgl2renderingcontext.istransformfeedback() webgl2renderingcontext.bindtransformfeedback() webgl2renderingcontext.begintransformfeedback() webgl2renderingcontext.endtransformfeedback() webgl2renderingcontext.pausetransformfeedback() webgl2renderingcontext.resumetransformfeedback() webgl2renderingcontext.transformfeedbackvaryings() webgl2renderingcontext.gettransformfeedbackvarying() examples creating a webgltransformfeedback object in this example, gl must be a webgl2renderingcontext.
Boilerplate 1 - Web APIs
this would allow us to focus on the interesting pieces of code that are most relevant for learning webgl.
... in following examples, we will use a javascript helper function, getrenderingcontext(), to initialize the webgl rendering context.
Compressed texture formats - Web APIs
this allows for additional detail while limiting the added video memory necessary.
...which formats support texture_2d_array and texture_3d targets (in combination with compressedteximage3d) are noted in the following table.
WebGL constants - Web APIs
a list is provided below.
...bool 0x8b56 bool_vec2 0x8b57 bool_vec3 0x8b58 bool_vec4 0x8b59 float_mat2 0x8b5a float_mat3 0x8b5b float_mat4 0x8b5c sampler_2d 0x8b5e sampler_cube 0x8b60 shader precision-specified types constant name value description low_float 0x8df0 medium_float 0x8df1 high_float 0x8df2 low_int 0x8df3 medium_int 0x8df4 high_int 0x8df5 framebuffers and renderbuffers constant name value description framebuffer 0x8d40 renderbuffer 0x8d41 rgba4 0x8056 rgb5...
Matrix math for the web - Web APIs
below is the representation of a rotation about the x axis: let sin = math.sin; let cos = math.cos; // note: there is no perspective in these transformations, so a rotation // at this point will only appear to only shrink the div let a = math.pi * 0.3; //rotation amount in radians // rotate around z axis let rotatezmatrix = [ cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, ...
...for instance, to scale something down by 80%, move it down 200 pixels, and then rotate about the origin 90 degrees would look something like the following in pseudo-code.
WebGL: 2D and 3D graphics for the web - Web APIs
WebAPIWebGL API
guides and tutorials below, you'll find an assortment of guides to help you learn webgl concepts and tutorials that offer step-by-step lessons and examples.
...this is a great place to start if you've never done low-level graphics programming.
High-level guides - Web APIs
the high-level guides listed below introduce webrtc technology from a top-down perspective, describing the overall architecture, the life cycle of a webrtc connection, and basic security and technological issues you might run into as you explore and build web content or apps using the webrtc api.
... when you're ready to explore webrtc in more depth, be sure to take a look at our low-level guide to webrtc.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
however, despite that flexibility in transport and communication of signaling messages, there's still a recommended design pattern you should follow when possible, known as perfect negotiation.
...then, finally, the media source for the self-view <video> element indicated by the selfvideo constant is set to the camera and microphone stream, allowing the local user to see what the other peer sees.
WebXR application life cycle - Web APIs
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.
... if the session type you want to use is available, provide the appropriate interface to the user to allow them to activate it.
Web Audio API best practices - Web APIs
browser vendors decided that web audio contexts should not be allowed to automatically play audio; they should instead be started by a user.
... user control if your website or application contains sound, you should allow the user control over it, otherwise again, it will become annoying.
Web audio spatialization basics - Web APIs
as if its extensive variety of sound processing (and other) options wasn't enough, the web audio api also includes facilities to allow you to emulate the difference in sound as a listener moves around a sound source, for example panning as you move around a sound source inside a 3d game.
... let's set up a rotation rate, which we'll convert into a radian range value for use in math.sin and math.cos later, when we want to figure out the new coordinates when we're rotating our boombox: // set up rotation constants const rotationrate = 60; // bigger number equals slower sound rotation const q = math.pi/rotationrate; //rotation increment in radians we can also use this to work out degrees rotated, which will help with the css transforms we will have to create (note we need both an x and y-axis for the css transforms): // get degrees for css const degreesx = (q * 180)/math.pi; const degreesy = (q * 180)/math.pi; let's take a look at our left rotation as an...
Attestation and Assertion - Web APIs
the sections below describe attestation, which happens during registration, and assertion which happens during authentication.
... android safetynet -prior to android key attestation, the only option for android devices was to create android safetynet attestations fido u2f - security keys that implement the fido u2f standard use this format none - browsers may prompt users whether they want a site to be allowed to see their attestation data and/or may remove attestation data from the authenticator's response if the `attestation` parameter in `navigator.credentials.create()` is set to `none` the purpose of attestation is to cryptographically prove that a newly generated key pair came from a specific device.
Web Crypto API - Web APIs
the web crypto api is an interface allowing a script to use cryptographic primitives in order to build systems using cryptography.
... warning: the web crypto api provides a number of low-level cryptographic primitives.
Web NFC API - Web APIs
the web nfc api allows exchanging data over nfc via light-weight nfc data exchange format (ndef) messages.
...low-level operations are currently not supported by the api, however there is a public discussion about api that would add such functuionality.
Web Storage API - Web APIs
web storage concepts and usage the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores) stores data only for a session, meaning that the data is stored until the browser (or tab) is closed.
... web storage interfaces storage allows you to set, retrieve and remove data for a specific domain and storage type (session or local.) window the web storage api extends the window object with two new properties — window.sessionstorage and window.localstorage — which provide access to the current domain's session and local storage objects respectively, and a window.onstorage event handler that fires when a storage area changes ...
Window.mozAnimationStartTime - Web APIs
this value should be used instead of, for example, date.now(), because this value will be the same for all animations started in this window during this refresh interval, allowing them to remain in sync with one another.
... this also allows javascript-based animations to remain synchronized with css transitions and smil animations triggered during the same refresh interval.
Window.personalbar - Web APIs
syntax objref =window.personalbar example fixme: https://bugzilla.mozilla.org/show_bug.cgi?id=790023 the following complete html example shows the way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
... <!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.personalbar.visible = !window.personalbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window: popstate event - Web APIs
this will eventually send events such as domcontentloaded and load to the window containing the document, but the steps below will continue to execute in the meantime.
... examples a page at http://example.com/example.html running the following code will generate logs as indicated: window.addeventlistener('popstate', (event) => { console.log("location: " + document.location + ", state: " + json.stringify(event.state)); }); history.pushstate({page: 1}, "title 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // logs "location: http://example.co...
Window.releaseEvents() - Web APIs
syntax window.releaseevents(eventtype) eventtype is a combination of the following values: event.abort, event.blur, event.click, event.change, event.dblclick, event.dragddrop, event.error, event.focus, event.keydown, event.keypress, event.keyup, event.load, event.mousedown, event.mousemove, event.mouseout, event.mouseover, event.mouseup, event.move, event.reset, event.resize, event.select, event.submit, event.unload.
... example window.releaseevents(event.keypress) notes note that you can pass a list of events to this method using the following syntax: window.releaseevents(event.keypress | event.keydown | event.keyup).
Window.requestAnimationFrame() - Web APIs
check the example below for a way to do this.
... element.style.transform = 'translatex(' + math.min(0.1 * elapsed, 200) + 'px)'; if (elapsed < 2000) { // stop the animation after 2 seconds window.requestanimationframe(step); } } window.requestanimationframe(step); notes edge versions below 17 and internet explorer do not reliably fire requestanimationframe before the paint cycle.
Window: resize event - Web APIs
there is a proposal to allow all elements to be notified of resize changes.
... examples window size logger the following example reports the window size each time it is resized.
Window.self - Web APIs
WebAPIWindowself
example uses of window.self like the following could just as well be replaced by window.
... if (window.parent.frames[0] != window.self) { // this window is not the first frame in the list } furthermore, when executing in the active document of a browsing context, window is a reference to the current global object and thus all of the following are equivalent: var w1 = window; var w2 = self; var w3 = window.window; var w4 = window.self; // w1, w2, w3, w4 all strictly equal, but only w2 will function in workers specifications specification status comment html living standardthe definition of 'window.self' in that specification.
Window.sessionStorage - Web APIs
example the following snippet accesses the current origin's session storage object and adds data to it with storage.setitem().
... sessionstorage.setitem('mycat', 'tom'); the following example autosaves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost.
Window.statusbar - Web APIs
WebAPIWindowstatusbar
syntax objref = window.statusbar example the following complete html example shows a way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
..."en"> <head> <meta charset="utf-8" /> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.statusbar.visible=!window.statusbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window.toolbar - Web APIs
WebAPIWindowtoolbar
syntax objref = window.toolbar example the following complete html example shows way that the visible property of the various "bar" objects is used, and also the change to the privileges necessary to write to the visible property of any of the bars on an existing window.
... <!doctype html> <html> <head> <title>various dom tests</title> <script> // changing bar states on the existing window netscape.security.privilegemanager.enableprivilege("universalbrowserwrite"); window.toolbar.visible=!window.toolbar.visible; </script> </head> <body> <p>various dom tests</p> </body> </html> notes when you load the example page above, the browser displays the following dialog: to toggle the visibility of these bars, you must either sign your scripts or enable the appropriate privileges, as in the example above.
Window: unhandledrejection event - Web APIs
bubbles no cancelable yes interface promiserejectionevent event handler property onunhandledrejection usage notes allowing the unhandledrejection event to bubble will eventually result in an error message being output to the console.
... you can prevent this by calling preventdefault() on the promiserejectionevent; see preventing default handling below for an example.
Window: unload event - Web APIs
bubbles no cancelable no interface event event handler property onunload it is fired after: beforeunload (cancelable event) pagehide the document is in the following state: all the resources still exist (img, iframe etc.) nothing is visible anymore to the end user ui interactions are ineffective (window.open, alert, confirm, etc.) an error won't stop the unloading workflow please note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below).
...doctype html> <html> <head> <title>parent frame</title> <script> window.addeventlistener('beforeunload', function(event) { console.log('i am the 1st one.'); }); window.addeventlistener('unload', function(event) { console.log('i am the 3rd one.'); }); </script> </head> <body> <iframe src="child-frame.html"></iframe> </body> </html> below, the content of child-frame.html: <!doctype html> <html> <head> <title>child frame</title> <script> window.addeventlistener('beforeunload', function(event) { console.log('i am the 2nd one.'); }); window.addeventlistener('unload', function(event) { console.log('i am the 4th and last one…'); }); </script> </head> <body> ☻ </body...
Worker.prototype.postMessage() - Web APIs
example the following code snippet shows the creation of a worker object using the worker() constructor.
...ge 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 incoming mess...
WorkerGlobalScope.dump() - Web APIs
the dump() method of the workerglobalscope interface allows you to write a message to stdout — i.e.
... next, run a worker containing the following line: dump('test\n'); this should result in a "test" message being output to the terminal.
WorkerGlobalScope - Web APIs
for example: importscripts('foo.js', 'bar.js'); non-standard methods workerglobalscope.dump() allows you to write a message to stdout — i.e.
...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.
Worklet - Web APIs
WebAPIWorklet
the worklet interface is a lightweight version of web workers and gives developers access to low-level parts of the rendering pipeline.
...instead, you can use one of the following classes: name description location specification paintworklet for programmatically generating an image where a css property expects a file.
WritableStreamDefaultWriter - Web APIs
properties writablestreamdefaultwriter.closedread only allows you to write code that responds to an end to the streaming process.
... examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
Sending and Receiving Binary Data - Web APIs
}; oreq.send(); receiving binary data in older browsers the load_binary_resource() function shown below loads binary data from the specified url, returning it to the caller.
... the following example creates a text file on-the-fly and uses the post method to send the "file" to the server.
XMLHttpRequest.response - Web APIs
the response types are described below.
... ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer.
XMLHttpRequest.setRequestHeader() - Web APIs
note: for your custom fields, you may encounter a "not allowed by access-control-allow-headers in preflight response" exception when you send requests across domains.
... in this situation, you need to set up the access-control-allow-headers in your response header at server side.
XPathEvaluator.evaluate() - Web APIs
result optional allows to specify a result object which may be reused and returned by this method.
... example the following example shows the use of the evaluate() method.
XPathExpression.evaluate() - Web APIs
result optional allows to specify a result object which may be reused and returned by this method.
... example the following example shows the use of the evaluate() method.
XRBoundedReferenceSpace - Web APIs
these bounds are defined using an array of points, each of which defines a vertex in a polygon inside which the user is allowed to move.
... properties in addition to the properties of xrreferencespace, xrboundedreferencespace includes the following: boundsgeometry read only an array of dompointreadonly objects, each of which defines a vertex in the polygon defining the boundaries within which the user will be required to remain.
XREnvironmentBlendMode - Web APIs
values opaque the rendered image is drawn without allowing any pass-through imagery.
... additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eyes, the additive blending mode is designed to be used in a situation in which the device has no control over the background and its brightness, since that isn't being digitally controlled.
XRInputSourceEvent() - Web APIs
permitted values are listed under event types below.
... examples the code below sets up handlers for primary action events in order to determine when the user clicks on (shoots at/pokes at/whatever) objects in the scene.
XRPermissionDescriptor.requiredFeatures - Web APIs
the permitted values are: the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point.
XRPermissionDescriptor - Web APIs
properties in addition to inheriting the properties of the parent interface, permissiondescriptor, xrpermissiondescriptor provides the following properties.
... examples the example below demonstrates performing the permission request for an application that requires the local-floor reference space in an immersive-vr environment.
XRPermissionStatus.granted - Web APIs
the types of reference space are listed in the table below, with brief information about their use cases and which interface is used to implement them.
... xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point.
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
examples below are some examples showing how to use getoffsetreferencespace().
...in order to use mouse, keyboard, or other input devices to move or otherwise transform objects in the 3d space—or to allow the user to move through the space—you'll need to write some code to read the inputs and move perform the movements.
XRReferenceSpace: reset event - Web APIs
most common among them are the following: the user has manually reset the coordinate system, such as by requesting that the headset recalibrate itself to ensure that the facing direction and hand controllers are synchronized with the user's actual position and facing.
...instead of allowing this to happen, you can integrate the emulatedposition into the teleportation offset calculated prior to calling getoffsetreferencespace() to create a new reference space whose updated effective origin is adjusted by the distance the viewer's position jumped since the previous frame.
XRSession.environmentBlendMode - Web APIs
permitted values are: opaque the rendered image is drawn without allowing any pass-through imagery.
... additive primarily used by ar devices with transparent lenses which directly allow reality to pass through to the user's eyes, the additive blending mode is designed to be used in a situation in which the device has no control over the background and its brightness, since that isn't being digitally controlled.
XRSessionEvent - Web APIs
properties in addition to properties inherited from its parent interface, event, xrsessionevent provides the folllowing: session read only the xrsession to which the event refers.
... session event types the following events are represented using the xrsessionevent interface, and are permitted values for its type property.
XRSystem - Web APIs
WebAPIXRSystem
methods in addition to inheriting methods from its parent interface, eventtarget, the xrsystem interface includes the following methods: issessionsupported() returns a promise which resolves to true if the browser supports the given xrsessionmode.
... examples the following example shows how to use both issessionsupported() and requestsession().
XRView.eye - Web APIs
WebAPIXRVieweye
usage notes the primary purpose of this property is to allow the correct area of any pre-rendered stereo content to be presented to the correct eye.
... let viewport = gllayer.getviewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); renderscene(gl, view); } } for each of the views, the value of eye is checked and if it's either left or right, we check to see if the body.lefteye.injured or body.righteye.injured property is true; if so, we call a function updateinjury() on that eye to do things such as allow a bit of healing to occur, track the progress of a poison effect, or the like, as appropriate for the game's needs.
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
this method of dividing the frame buffer between views is shown in the following diagram.
...the result is a rendering context that looks like the diagram below: each time the xrviewerpose's views are iterated over for rendering, the rendering loop obtains an xrview for the left eye which has its top-left corner at (0, 0) with its width and height being 1280x1440 pixels.
Using the alertdialog role - Accessibility
possible effects on user agents and assistive technology when the alertdialog role is used, the user agent should do the following: expose the element as a dialog in the operating system's accessibility api.
... examples example 1: a basic alert dialog the code snippet below shows how to mark up an alert dialog that only provides a message and an ok button.
Using the aria-valuemax attribute - Accessibility
description the aria-valuemax attribute is used to define the maximum value allowed for a range widget such as a slider, spinbutton or progressbar.
... examples example 1: the snippet below shows a simple slider with a maximum value of 10.
Using the aria-valuemin attribute - Accessibility
the aria-valuemin attribute is used to define the minimum value allowed for a range widget such as a slider, spinbutton or progressbar.
... examples example 1: the snippet below shows a simple slider with a minimum value of 1.
Using the link role - Accessibility
possible effects on user agents and assistive technology when the link role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a link role in the operating system's accessibility api.
... opening a page using the open() method counts as being a popup, and certain browsers may issue a warning when you try to activate it, or make you explicitly agree to allowing popups form the domain it exists on.
Using the log role - Accessibility
possible effects on user agents and assistive technology when the log role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a log role in the operating system's accessibility api.
... examples example 1: adding the role in the html code the snippet below shows how the log role is added directly into the html source code.
Using the status role - Accessibility
possible effects on user agents and assistive technology when the status role is added to an element, or such an element becomes visible, the user agent should do the following: expose the element as having a status role in the operating system's accessibility api.
... examples example 1: adding the status role in html the snippet below shows how the status role is added directly into the html source code.
Using ARIA: Roles, states, and properties - Accessibility
roles widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem composite roles the techniques below describe each composite role as well as their required and optional child roles.
...red 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 aria-colindex aria-colspan aria-controls aria-describedby aria-details aria-errormessage aria-flowto aria-labelledby aria-owns aria-posinset aria-rowcount aria-rowindex aria-rowspan aria-setsize microsoftedge-specific properties x-ms-aria-flowfrom ...
ARIA: application role - Accessibility
in addition, a set of so-called quick navigation keys has been established over the years that allows blind users to skim through a page via a certain element type.
...if used, the application role should be added to the lowest common container possible, not on the <body> element, for example.
ARIA: Complementary role - Accessibility
this label will allow an assistive technology user to be able to quickly understand the purpose of each landmark.
... added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: contentinfo role - Accessibility
this label will allow assitive technology users to quickly understand the purpose of each landmark.
... added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: form role - Accessibility
this name will allow an assitive technology user to be able to quickly understand the purpose of the form landmark.
... added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: Mark role - Accessibility
examples in the following example we have a document section that has been commented.
... <p>the last half of the song is a slow-rising crescendo that peaks at the <span role="mark" aria-details="thread-1">end of the guitar solo</span>, before fading away sharply.</p> <div role="comment" id="thread-1" data-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> </div> the related comment is marked up using an html structure wrapped with a <div> containing role="comment".
ARIA: Navigation Role - Accessibility
this label will allow an assitive technology user to be able to quickly understand the purpose of each landmark.
... added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: search role - Accessibility
this label will allow an assitive technology user to be able to quickly understand the purpose of each landmark.
... added benefits certain technologies such as browser extensions can generate lists of all landmark roles present on a page, allowing non-screen reader users to also quickly identify and navigate to large sections of the document.
ARIA: table role - Accessibility
if a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead.
...if the interaction provides for the selection state of individual cells, if left to right and top to bottom navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead.
ARIA: button role - Accessibility
space activates the button following button activation, focus is set depending on the type of action the button performs.
... when the button role is used, screen readers announce the element as a button, generally saying "click" followed by the button's accessible name.
Web applications and ARIA FAQ - Accessibility
browsers aria is supported in the following browsers: browser minimum version notes firefox 3.0+ works with nvda, jaws 10+, and orca chrome latest screen reader support still experimental as of chrome 15 safari 4+ safari 5 support is much improved.
... javascript toolkits aria roles, states, and properties have been added to a number of popular javascript user interface toolkits, including: dojo/dijit jquery ui fluid infusion google closure google web toolkit bbc glow yahoo!
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
“delete history after” is to the left of the textbox, x is the number, for example 21, and the word “days” follows the textbox, forming a sentence that is easy to understand.
... if you’re using a screen reader, have you noticed that, when you go to this setting in firefox, it tells you “delete history after 21 days”?, followed by the announcement that you’re in a textbox, and that it contains the number 21.
Mobile accessibility checklist - Accessibility
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 following must be true (wcag 2.1: pointer cancellation): the down-event should not be used to trigger any action the action is triggered on the up event and an option to abort the action before its completion is available or an option to undo the action after its completion the up-event will undo any action that was triggered on a down event it is essential to trigger the action on the down event.
Understanding the Web Content Accessibility Guidelines - Accessibility
each of the links below will take you to pages that further expand on these areas, giving you practical advice on how to write your web content so it conforms to the success criteria outlined in each of the wcag 2.0 and 2.1 guidelines that further sub-divides each principle.
... wcag 2.1 includes: all of wcag 2.0 (verbatim, word-for-word) 17 new success criteria at the a / aa / aaa levels primarily addressing user needs in these areas: mobile accessibility low vision cognitive read more about wcag 2.1: deque: wcag 2.1: what is next for accessibility guidelines tpg: web content accessibility guidelines (wcag) 2.1 legal standing this guide is intended to provide practical information to help you build better, more accessible websites.
Custom properties (--*): CSS variables - CSS: Cascading Style Sheets
WebCSS--*
initial valuesee proseapplies toall elementsinheritedyescomputed valueas specified with variables substitutedanimation typediscrete syntax --somekeyword: left; --somecolor: #0000ff; --somecomplexvalue: 3px 6px rgb(20, 32, 54); <declaration-value> this value matches any sequence of one or more tokens, so long as the sequence does not contain an unallowed token.
... formal syntax <declaration-value> example html <p id="firstparagraph">this paragraph should have a blue background and yellow text.</p> <p id="secondparagraph">this paragraph should have a yellow background and blue text.</p> <div id="container"> <p id="thirdparagraph">this paragraph should have a green background and yellow text.</p> </div> css :root { --first-color: #488cff; --second-color: #ffff8c; } #firstparagraph { background-color: var(--first-color); color: var(--second-color); } #secondparagraph { background-color: var(--second-color); color: var(--first-colo...
-moz-orient - CSS: Cascading Style Sheets
syntax the -moz-orient property is specified as one of the keyword values chosen from the list below.
... 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.
-webkit-border-before - CSS: Cascading Style Sheets
syntax values one or more of the following, in any order: <'border-width'> see border-width <'border-style'> see border-style <'color'> see color formal definition initial valueas each of the properties of the shorthand:border-width: as each of the 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 sh...
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples applying a border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; -webkit-border-before: 5px dashed blue; } result specifications not part of any standard, but it relates to the standards-track border-block-start property.
-webkit-mask-repeat-x - CSS: Cascading Style Sheets
round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
... when the next image is added, all of the current ones compress to allow room.
-webkit-mask-repeat-y - CSS: Cascading Style Sheets
round as the allowed vertical space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
... when the next image is added, all of the current ones compress to allow room.
-webkit-print-color-adjust - CSS: Cascading Style Sheets
/* keyword values */ -webkit-print-color-adjust: economy; -webkit-print-color-adjust: exact; /* global values */ -webkit-print-color-adjust: inherit; -webkit-print-color-adjust: initial; -webkit-print-color-adjust: unset; syntax the -webkit-print-color-adjust property is specified as one of the keyword values listed below.
... background colors and images are only printed if the user explicitly allows it in their browser's print settings dialog.
:-moz-ui-invalid - CSS: Cascading Style Sheets
this pseudo-class is applied according to the following rules: if the control does not have focus, and the value is invalid, apply this pseudo-class.
... by default, gecko applies a style that creates a red "glow" (using the box-shadow property) around items, which have this pseudo-class applied.
::-moz-range-progress - CSS: Cascading Style Sheets
the ::-moz-range-progress css pseudo-element is a mozilla extension that represents the lower portion of the track (i.e., groove) in which the indicator slides in an <input> of type="range".
... this portion corresponds to values lower than the value currently selected by the thumb (i.e., virtual knob).
::-webkit-meter-even-less-good-value - CSS: Cascading Style Sheets
the ::-webkit-meter-even-less-good-value gives a red color to a <meter> element when the value and the optimum attributes fall outside the low-high range, but in opposite zones.
... to illustrate, it applies when value < low < high < optimum or value > high > low > optimum.
::-webkit-scrollbar - CSS: Cascading Style Sheets
css scrollbar selectors you can use the following pseudo elements to customize various parts of the scrollbar for webkit browsers: ::-webkit-scrollbar — the entire scrollbar.
... examples .visible-scrollbar, .invisible-scrollbar, .mostly-customized-scrollbar { display: block; width: 10em; overflow: auto; height: 2em; } .invisible-scrollbar::-webkit-scrollbar { display: none; } /* demonstrate a "mostly customized" scrollbar * (won't be visible otherwise if width/height is specified) */ .mostly-customized-scrollbar::-webkit-scrollbar { width: 5px; height: 8px; background-color: #aaa; /* or add it to the track */ } /* add a thumb */ .mostly-customized-scrollbar::-webkit-scrollba...
::backdrop - CSS: Cascading Style Sheets
the ::backdrop pseudo-element makes it possible to obscure, style, or completely hide everything located below the element when it's the topmost one in the top layer.
... video::backdrop { background-color: #448; } the resulting screen looks like this: note the dark grey-blue letterbox effect above and below where the backdrop is visible.
::before (:before) - CSS: Cascading Style Sheets
WebCSS::before
if you need to use a special character, and can not enter it literally into your css content string, use a unicode escape sequence, consisting of a backslash followed by the hexadecimal unicode value.
... css animations working draft allows animations on properties defined on pseudo-elements.
::cue-region - CSS: Cascading Style Sheets
::cue-region { color: yellow; font-weight: bold; } the properties are applied to the entire set of cues as if they were a single unit.
... syntax ::cue-region | ::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-decor...
::slotted() - CSS: Cascading Style Sheets
WebCSS::slotted
'='<attr-modifier> = i | s examples highlighting slotted elements the following snippets are taken from our slotted-pseudo-element demo (see it live also).
...this allows them to stand out better next to the slots that haven't been successfully filled.
:defined - CSS: Cascading Style Sheets
WebCSS:defined
/* selects any defined element */ :defined { font-style: italic; } /* selects any instance of a specific custom element */ simple-custom:defined { display: block; } syntax :defined examples hiding elements until they are defined the following snippets are taken from our defined-pseudo-class demo (see it live also).
....createelement('div'); divelem.textcontent = this.getattribute('text'); let shadowroot = this.attachshadow({mode: 'open'}) .appendchild(divelem); } }) then insert a copy of this element into the document, along with a standard <p>: <simple-custom text="custom element example text"></simple-custom> <p>standard paragraph example text</p> in the css we first include the following rules: // give the two elements distinctive backgrounds p { background: yellow; } simple-custom { background: cyan; } // both the custom and the built-in element are given italic text :defined { font-style: italic; } then provide the following two rules to hide any instances of our custom element that are not defined, and display instances that are defined as block level elements: s...
:host - CSS: Cascading Style Sheets
WebCSS:host
the :host css pseudo-class selects the shadow host of the shadow dom containing the css it is used inside — in other words, this allows you to select a custom element from inside its shadow dom.
... /* selects a shadow root host */ :host { font-weight: bold; } syntax :host examples styling the shadow host the following snippets are taken from our host-selectors example (see it live also).
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
WebCSS:is
/* selects any paragraph inside a header, main or footer element that is being hovered */ :is(header, main, footer) p:hover { color: red; cursor: pointer; } /* the above is equivalent to the following */ header p:hover, main p:hover, footer p:hover { color: red; cursor: pointer; } /* backwards-compatible version with :-*-any() and :matches() (it is not possible to group selectors into single rule, because presence of invalid selector would invalidate whole rule.) */ :-webkit-any(header, main, footer) p:hover { color: red; cursor: pointer; } :-moz-any(header, main, footer) p:h...
...for example, the following css: /* 3-deep (or more) unordered lists use a square */ ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, me...
:read-only - CSS: Cascading Style Sheets
input:read-only, textarea:read-only { background-color: #ccc; } p:read-only { background-color: #ccc; } syntax :read-only examples confirming form information in read-only/read-write controls one use of readonly form controls is to allow the user to check and verify information that they may have entered in an earlier form (for example, shipping details), while still being able to submit the information along with the rest of the form.
... we do just this in the example below.
:read-write - CSS: Cascading Style Sheets
input:read-write, textarea:read-write { background-color: #bbf; } p:read-write { background-color: #bbf; } syntax :read-write examples confirming form information in read-only/read-write controls one use of readonly form controls is to allow the user to check and verify information that they may have entered in an earlier form (for example, shipping details), while still being able to submit the information along with the rest of the form.
... we do just this in the example below.
@charset - CSS: Cascading Style Sheets
WebCSS@charset
as there are several ways to define the character encoding of a style sheet, the browser will try the following methods in the following order (and stop as soon as one yields a result) : the value of the unicode byte-order character placed at the beginning of the file.
...it must be the name of a web-safe character encoding defined in the iana-registry, and must be double-quoted, following exactly one space character (u+0020), and immediately terminated with a semicolon.
@counter-style - CSS: Cascading Style Sheets
the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs.
... the below @counter-style rule uses images instead of character symbols.
font-variation-settings - CSS: Cascading Style Sheets
the font-variation-settings css descriptor allows authors to specify low-level opentype or truetype font variations in the @font-face rule.
...each setting is always a <string> of 4 ascii characters, followed by a <number> indicating the axis value.
-ms-high-contrast - CSS: Cascading Style Sheets
syntax the -ms-high-contrast media feature is specified as one of the following values.
... examples the following declarations will match applications that are being displayed in high contrast mode with any color variation, a black-on-white color variation, and a white-on-black color variation, respectively.
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx.
...} examples html <p>this is a test of your device's pixel density.</p> css /* exact resolution */ @media (-webkit-device-pixel-ratio: 1) { p { color: red; } } /* minimum resolution */ @media (-webkit-min-device-pixel-ratio: 1.1) { p { font-size: 1.5em; } } /* maximum resolution */ @media (-webkit-max-device-pixel-ratio: 3) { p { background: yellow; } } result specifications specification status comment compatibility standardthe definition of '-webkit-device-pixel-ratio' in that specification.
any-hover - CSS: Cascading Style Sheets
WebCSS@mediaany-hover
syntax the any-hover feature is specified as a keyword value chosen from the list below.
... examples testing whether input methods can hover html <a href="#">try hovering over me!</a> css @media (any-hover: hover) { a:hover { background: yellow; } } result specifications specification status comment media queries level 4the definition of 'any-hover' in that specification.
forced-colors - CSS: Cascading Style Sheets
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.
... examples note: no browser currently implements this feature so the following example will not work.
hover - CSS: Cascading Style Sheets
WebCSS@mediahover
syntax the hover feature is specified as a keyword value chosen from the list below.
... examples html <a href="#">try hovering over me!</a> css @media (hover: hover) { a:hover { background: yellow; } } result specifications specification status comment media queries level 4the definition of 'hover' in that specification.
orientation - CSS: Cascading Style Sheets
syntax the orientation feature is specified as a keyword value chosen from the list below.
... examples html <div>box 1</div> <div>box 2</div> <div>box 3</div> css body { display: flex; } div { background: yellow; } @media (orientation: landscape) { body { flex-direction: row; } } @media (orientation: portrait) { body { flex-direction: column; } } result specifications specification status comment media queries level 4the definition of 'orientation' in that specification.
update - CSS: Cascading Style Sheets
syntax the update feature is specified as a single keyword value chosen from the list below.
... slow the layout may change dynamically according to the usual rules of css, but the output device is not able to render or display changes quickly enough for them to be perceived as a smooth animation.
@namespace - CSS: Cascading Style Sheets
any @namespace rules must follow all @charset and @import rules, and precede all other at-rules and style declarations in a style sheet.
...when a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only to elements in that namespace.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
.runbutton { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 12px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } @keyframes colorchange { 0% { background: yellow } 100% { background: blue } } .box { width: 100px; height: 100px; border: 1px solid black; } .changing { animation: colorchange 2s; } there are two classes here.
... the following demo shows how you'd achieve the aforementioned javascript technique: .slidein { animation-duration: 5s; animation-name: slidein; animation-iteration-count: infinite; } .stopped { animation-name: none; } @keyframes slidein { 0% { margin-left: 0%; } 50% { margin-left: 50%; } 100% { margin-left: 0%; } } <h1 id="watchme">click me to stop</h1> let watchme = d...
Using multiple backgrounds - CSS: Cascading Style Sheets
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.
..., rgba(30, 75, 115, 1), rgba(255, 255, 255, 0)); background-repeat: no-repeat, no-repeat, no-repeat; background-position: bottom right, left, right; } result (if image does not appear in codepen, click the 'tidy' button in the css section) as you can see here, the firefox logo (listed first within background-image) is on top, directly above the bubbles graphic, followed by the gradient (listed last) sitting underneath all previous 'images'.
Box alignment in grid layout - CSS: Cascading Style Sheets
the block axis crosses the inline axis in the direction that blocks are displayed down the page — for example paragraphs in english are displayed one below the other vertically.
...this allows them to be used for other layout methods where a gap between items makes sense.
Basic Concepts of Multicol - CSS: Cascading Style Sheets
in the below example we use the column-count property to create three columns on the .container element.
... in the below example we use the column-width property with a value of 200px.
Styling Columns - CSS: Cascading Style Sheets
in the example below, the column-gap is set to 40px.
... the allowed value for column-gap is a <length-percentage>, this means percentages are allowed.
CSS Display - CSS: Cascading Style Sheets
reference css properties display css data types <display-outside> <display-inside> <display-listitem> <display-box> <display-internal> <display-legacy> guides css flow layout (display: block, display: inline) block and inline layout in normal flow flow layout and overflow flow layout and writing modes formatting contexts explained in flow and out of flow display: flex basic concepts of flexbox aligning 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 lay...
... candidate recommendation added run-in, flow, flow-root, contents and multi-keyword values.
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
we can use grid-auto-flow: dense which will take items visually out of dom order.
... the concept of visual display following document source order is detailed in the wcag techniques for success criteria – technique c27.
CSS Grid Layout - CSS: Cascading Style Sheets
basic example the example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto.
...grid-row: 1; } .two { grid-column: 2 / 4; grid-row: 1 / 3; } .three { grid-column: 1; grid-row: 2 / 5; } .four { grid-column: 3; grid-row: 3; } .five { grid-column: 2; grid-row: 4; } .six { grid-column: 3; grid-row: 4; } reference css properties grid-template-columns grid-template-rows grid-template-areas grid-template grid-auto-columns grid-auto-rows grid-auto-flow grid grid-row-start grid-column-start grid-row-end grid-column-end grid-row grid-column grid-area row-gap column-gap gap css functions repeat() minmax() fit-content() css data types <flex> glossary entries grid grid lines grid tracks grid cell grid area gutters grid axis grid row grid column guides basic concepts of grid layout relationship of gri...
CSS Motion Path - CSS: Cascading Style Sheets
motion path is a css module that allows authors to animate any graphical object along a custom path.
...at your disposal, which wasn't ideal and only allowed for simple movements.
Understanding CSS z-index - CSS: Cascading Style Sheets
in this case, there is a single rendering flow, and all elements are aware of the space taken by others.
... (from css 2.1 section 9.9.1 - layered presentation) this means that css style rules allow you to position boxes on layers in addition to the normal rendering layer (layer 0).
CSS Properties Reference - CSS: Cascading Style Sheets
common css properties reference the following is a basic list of the most common css properties with the equivalent of the dom notation which is usually accessed from javascript: note: this list is incomplete.
...tterspacing 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 padding padding padding-bottom paddingbottom padding-left paddingleft padding-right paddingright padding-top paddingtop page-break-after pagebreakafter page-break-before pagebreakbefore position position stroke-dasharray strokedasharray stroke-dashoffset strokedashof...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
the main things to note are as follows: the scroll-snap-type-x and scroll-snap-type-y properties have been dropped the scroll-snap-type property has become a longhand, so the old shorthand syntax like scroll-snap-type:mandatory will stop working can i use the old implementation as a fallback?
... if you have already used the old implementation as a fallback, or feel you want to support users of old firefox (or -webkit prefixed safari), then you can continue to use the old specification as outlined in the example below.
CSS Shapes - CSS: Cascading Style Sheets
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%).
Using CSS transforms - CSS: Cascading Style Sheets
by modifying the coordinate space, css transforms change the shape and position of the affected content without disrupting the normal document flow.
... html the html below creates four copies of the same box, with the perspective set at different values.
Introducing the CSS Cascade - CSS: Cascading Style Sheets
WebCSSCascade
then it sorts these rules according to their importance, that is, whether or not they are followed by !important, and by their origin.
... specifications specification status comment css cascading and inheritance level 4 candidate recommendation added the revert keyword, which allows rolling a property back a cascade level.
Layout and the containing block - CSS: Cascading Style Sheets
if the position property is absolute or fixed, the containing block may also be formed by the edge of the padding box of the nearest ancestor element that has the following: a transform or perspective value other than none a will-change value of transform or perspective a filter value other than none or a will-change value of filter (only works on firefox).
... some examples the html code for all our examples is: <body> <section> <p>this is a paragraph!</p> </section> </body> only the css is altered in each instance below.
Grid wrapper - CSS: Cascading Style Sheets
the grid wrapper pattern is useful for aligning grid content within a central wrapper, while also allowing items to break out and align to the edge of the containing element or page when desired.
... accessibility concerns although grid enables us to position items anwhere (within reason), it is important when placing items using css grid that your underlying markup follows a logical order (see css grid layout and accessibility for more details).
Recipe: Media objects - CSS: Cascading Style Sheets
requirements media object pattern needs some or all of the following characteristics: stacked on mobile, two columns on desktop.
... the recipe download this example choices made i have chosen to use grid layout for the media object as it allows me to control the layout in two dimensions when i need to.
CSS Layout cookbook - CSS: Cascading Style Sheets
flexbox, margin breadcrumb navigation creating a list of links to allow the visitor to navigate back up through the page hierarchy.
... grid layout grid wrapper for aligning grid content within a central wrapper, while also allowing items to break out.
Microsoft CSS extensions - CSS: Cascading Style Sheets
-ms-accelerator -ms-block-progression -ms-content-zoom-chaining -ms-content-zooming -ms-content-zoom-limit -ms-content-zoom-limit-max -ms-content-zoom-limit-min -ms-content-zoom-snap -ms-content-zoom-snap-points -ms-content-zoom-snap-type -ms-filter -ms-flow-from -ms-flow-into -ms-high-contrast-adjust -ms-hyphenate-limit-chars -ms-hyphenate-limit-lines -ms-hyphenate-limit-zone -ms-ime-align -ms-overflow-style -ms-scrollbar-3dlight-color -ms-scrollbar-arrow-color -ms-scrollbar-base-color -ms-scrollbar-darkshadow-color -ms-scrollbar-face-color -ms-scrollbar-highlight-color -ms-scrollbar-shadow-color -ms-scrollbar-track-colo...
...r -ms-scroll-chaining -ms-scroll-limit -ms-scroll-limit-x-max -ms-scroll-limit-x-min -ms-scroll-limit-y-max -ms-scroll-limit-y-min -ms-scroll-rails -ms-scroll-snap-points-x -ms-scroll-snap-points-y -ms-scroll-snap-x -ms-scroll-snap-y -ms-scroll-translation -ms-text-autospace -ms-touch-select -ms-wrap-flow -ms-wrap-margin -ms-wrap-through zoom pseudo-elements ::-ms-browse ::-ms-check ::-ms-clear ::-ms-expand ::-ms-fill ::-ms-fill-lower ::-ms-fill-upper ::-ms-reveal ::-ms-thumb ::-ms-ticks-after ::-ms-ticks-before ::-ms-tooltip ::-ms-track ::-ms-value media features -ms-high-contrast css-related dom apis mscontentzoomfactor msgetpropertyenabled msgetregioncontent msrangecollection msregionoverflow ...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
in each of the examples below, the enclosing rectangles are 300 pixels wide and 200 pixels tall.
... note: the screenshots below show the expected rendering.
Viewport concepts - CSS: Cascading Style Sheets
sticky headers or footers, with the following styles, will stick to the top and bottom of the layout viewport respectively.
...to tell a mobile browser to use the viewport width instead of the default 980px as the width of the screen, developers can include a viewport meta tag, like the following: <meta name="viewport" content="width=device-width"> the width property controls the size of the viewport.
<angle-percentage> - CSS: Cascading Style Sheets
syntax refer to the documentation for <angle> and <percentage> for details of the individual syntaxes allowed by this type.
... use in calc() where an <angle-percentage> is specified as an allowable type, this means that the percentage resolves to an angle and therefore can be used in a calc() expression.
animation-fill-mode - CSS: Cascading Style Sheets
the first relevant keyframe depends on the value of animation-direction: animation-direction first relevant keyframe normal or alternate 0% or from reverse or alternate-reverse 100% or to both the animation will follow the rules for both forwards and backwards, thus extending the animation properties in both directions.
... formal definition initial valuenoneapplies toall elements, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <single-animation-fill-mode>#where <single-animation-fill-mode> = none | forwards | backwards | both examples you can see the effect of animation-fill-mode in the following example.
background-attachment - CSS: Cascading Style Sheets
syntax /* keyword values */ background-attachment: scroll; background-attachment: fixed; background-attachment: local; /* global values */ background-attachment: inherit; background-attachment: initial; background-attachment: unset; the background-attachment property is specified as one of the keyword values from the list below.
...however, on the second time round, she came upon a low curtain she had not noticed before, and behind it was a little door about fifteen inches high: she tried the little golden key in the lock, and to her great delight it fitted!
background-position-x - CSS: Cascading Style Sheets
(some browsers allow assigning the right edge for offset).
...]#where <length-percentage> = <length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately.
background-position-y - CSS: Cascading Style Sheets
(some browsers allow assigning the bottom edge for offset).
...]#where <length-percentage> = <length> | <percentage> examples basic example the following example shows a simple background image implementation, with background-position-x and background-position-y used to define the image's horizontal and vertical positions separately.
background-position - CSS: Cascading Style Sheets
] ]where <length-percentage> = <length> | <percentage> examples positioning background images each of these three examples uses the background property to create a yellow, rectangular element containing a star image.
... recommendation allows for keyword values and <length> and <percentage> values to be mixed.
background - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size syntax /* using a <background-color> */ background: green; /* using a <bg-image> and <repeat-style> */ background: url("test.jpg") repeat-y; /* using a <box> and <background-color> */ background: border-box red; /* a sin...
... the syntax of each layer is as follows: each layer may include zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%".
border-block-color - CSS: Cascading Style Sheets
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.
... formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typediscrete formal syntax <'border-top-color'>{1,2} examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 10px solid blue; border-block-color: red; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-color' in that specification.
border-block-end-color - CSS: Cascading Style Sheets
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.
... 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> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 10px solid blue; border-block-end-color: red; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-end-color' in that specification.
border-block - CSS: Cascading Style Sheets
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.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-block: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block' in that specification.
border-bottom-width - CSS: Cascading Style Sheets
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 denoted by each keyword, the precise result when 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.
border-collapse - CSS: Cascading Style Sheets
syntax /* keyword values */ border-collapse: collapse; border-collapse: separate; /* global values */ border-collapse: inherit; border-collapse: initial; border-collapse: unset; the border-collapse property is specified as a single keyword, which may be chosen from the list below.
... 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: red; } result specifications specification status comment css level 2 (revision 1)the definition of 'border-collapse' in that specification.
border-image-width - CSS: Cascading Style Sheets
al */ border-image-width: 2em 3em; /* top | horizontal | bottom */ border-image-width: 5% 15% 10%; /* top | right | bottom | left */ border-image-width: 5% 2em 10% auto; /* global values */ border-image-width: inherit; border-image-width: initial; border-image-width: unset; the border-image-width property may be specified using one, two, three, or four values chosen from the list of values below.
...etter.inheritednopercentagesrefer to the width or height of the border image areacomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typeby computed value type formal syntax [ <length-percentage> | <number> | auto ]{1,4}where <length-percentage> = <length> | <percentage> examples tiling a border image this example creates a border image using the following ".png" file, which is 90 by 90 pixels: thus, each circle in the source image is 30 by 30 pixels.
border-image - CSS: Cascading Style Sheets
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.
border-inline-color - CSS: Cascading Style Sheets
border-inline-color: yellow; border-inline-color: #f5f6f7; the border color in the other dimension can be set with border-block-color which sets border-block-start-color, and border-block-end-color.
... formal definition initial valuecurrentcolorapplies toall elementsinheritednocomputed valuecomputed coloranimation typediscrete formal syntax <'border-top-color'>{1,2} examples border color with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 10px solid blue; border-inline-color: red; } results specifications specification status comment css logical properties and values level 1the definition of 'border-inline-color' in that specification.
border-inline - CSS: Cascading Style Sheets
and:border-top-width: mediumborder-top-style: noneborder-top-color: currentcolorapplies toall elementsinheritednocomputed valueas each of the properties of the shorthand:border-top-width: the absolute length or 0 if border-top-style is none or hiddenborder-top-style: as specifiedborder-top-color: computed coloranimation typediscrete constituent properties this property is a shorthand for the following css properties: border-inline-color border-inline-style border-inline-width syntax values the border-inline is specified with one or more of the following, in any order: <'border-width'> the width of the border.
...)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; border-inline: 5px dashed blue; } results specifications specification status comment css logical properties and values level 1the definition of 'border-inline' in that specification.
border-left-width - CSS: Cascading Style Sheets
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 denoted by each keyword, the precise result when 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.
border-right-width - CSS: Cascading Style Sheets
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 denoted by each keyword, the precise result when 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.
border-top-width - CSS: Cascading Style Sheets
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 denoted by each keyword, the precise result when 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.
border - CSS: Cascading Style Sheets
WebCSSborder
constituent properties this property is a shorthand for the following css properties: border-color border-style border-width syntax /* style */ border: solid; /* width | style */ border: 2px dotted; /* style | color */ border: 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 bel...
...however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content.
box-decoration-break - CSS: Cascading Style Sheets
the specified value will impact the appearance of the following properties: background border border-image box-shadow clip-path margin padding syntax /* keyword values */ box-decoration-break: slice; box-decoration-break: clone; /* global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; the box-decoration-break property is specified as one of the keyword values listed below.
... 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; } ...
column-count - CSS: Cascading Style Sheets
<integer> is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed.
... if the column-width is also set to a non-auto value, it merely indicates the maximum allowed number of columns.
content - CSS: Cascading Style Sheets
WebCSScontent
/* keywords that cannot be combined with other values */ content: normal; content: none; /* <image> values */ content: url("http://www.example.com/test.png"); content: linear-gradient(#e66465, #9198e5); /* alt text for generated content, added in the level 3 specification */ content: url("http://www.example.com/test.png") / "this is the alt text"; /* values below can only be applied to generated content using ::before and ::after */ /* <string> value */ content: "prefix"; /* <counter> values */ content: counter(chapter_counter); content: counters(section_counter, "."); /* attr() value linked to the html attribute value */ content: attr(value string); /* language- and position-dependent keywords */ content: open-quote; content: close-quote; content: no...
... html <h2>paperback best sellers</h2> <ol> <li>political thriller</li> <li class="new-entry">halloween stories</li> <li>my biography</li> <li class="new-entry">vampire romance</li> </ol> css .new-entry::after { content: " new!"; /* the leading space creates separation between the added content and the rest of the content */ color: red; } result images and element attributes this example inserts an image before each link, and adds i...
counters() - CSS: Cascading Style Sheets
WebCSScounters
<li> <ol> <li></li> <li></li> <li></li> </ol> </li> </ol> </li> </ol> css ol { counter-reset: listcounter; } li { counter-increment: listcounter; } li::marker { content: counters(listcounter, '.', upper-roman) ') '; } li::before { content: counters(listcounter, ".") " == " counters(listcounter, ".", lower-roman) ; } result decimal-leading-zero compared to lower-alpha html <ol> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> <li></li> <li></li> <li> <ol> <li></li> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> </ol> </li> </ol> css ol {...
... counter-reset: count; } li { counter-increment: count; } li::marker { content: counters(count, '.', upper-alpha) ') '; } li::before { content: counters(count, ".", decimal-leading-zero) " == " counters(count, ".", lower-alpha); } result specifications specification status comment css lists module level 3the definition of 'css counters' in that specification.
<display-listitem> - CSS: Cascading Style Sheets
list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-inside> keywords.
... note: in browsers that support the two-value syntax, if no inner value is specified it will default to flow.
element() - CSS: Cascading Style Sheets
WebCSSelement
<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.
... <div style="width:400px; height:100px; background:-moz-element(#mybackground2);"> </div> <div style="overflow:hidden; height:0;"> <button id="mybackground2" type="button">evil button!</button> </div> specifications specification status comment css images module level 4the definition of 'using elements as images: the element() notation' in that specification.
flex-grow - CSS: Cascading Style Sheets
WebCSSflex-grow
formal definition initial value0applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item grow factor html <h4>this is a flex-grow</h4> <h5>a,b,c and f are flex-grow:1 .
... d and e are flex-grow:2 .</h5> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> <div class="box1" style="background-color:brown;">d</div> <div class="box1" style="background-color:lightgreen;">e</div> <div class="box" style="background-color:brown;">f</div> </div> css #content { display: flex; justify-content: space-around; flex-flow: row wrap; align-items: stretch; } .box { flex-grow: 1; border: 3px solid rgba(0,0,0,.2); } .box1 { flex-grow: 2; border: 3px solid rgba(0,0,0,.2); } result specifications specification status comment css flexible box layout modulethe definition of 'fle...
flex-shrink - CSS: Cascading Style Sheets
formal definition initial value1applies toflex items, including in-flow pseudo-elementsinheritednocomputed valueas specifiedanimation typea number formal syntax <number> examples setting flex item shrink factor html <p>the width of content is 500px; the flex-basis of the flex items is 120px.</p> <p>a, b, c have flex-shrink:1 set.
... d and e have flex-shrink:2 set</p> <p>the width of d and e is less than the others.</p> <div id="content"> <div class="box" style="background-color:red;">a</div> <div class="box" style="background-color:lightblue;">b</div> <div class="box" style="background-color:yellow;">c</div> <div class="box1" style="background-color:brown;">d</div> <div class="box1" style="background-color:lightgreen;">e</div> </div> css #content { display: flex; width: 500px; } #content div { flex-basis: 120px; border: 3px solid rgba(0,0,0,.2); } .box { flex-shrink: 1; } .box1 { flex-shrink: 2; } result specifications specification status comment css flexible box layout modulethe definition of 'flex-shrink' in that specification.
font-feature-settings - CSS: Cascading Style Sheets
these lead to more effective, predictable, understandable results than font-feature-settings, which is a low-level feature designed to handle special cases where no other way exists to enable or access an opentype font feature.
... examples enabling various font features /* use small-cap alternate glyphs */ .smallcaps { font-feature-settings: "smcp" on; } /* convert both upper and lowercase to small caps (affects punctuation also) */ .allsmallcaps { font-feature-settings: "c2sc", "smcp"; } /* use zeros with a slash through them to differentiate from "o" */ .nicezero { font-feature-settings: "zero"; } /* enable historical forms */ .hist { font-feature-settings: "hist"; } /* disable common ligatures, usually on by default */ .noligs { font-feature-settings: "liga" 0; } /* e...
font-smooth - CSS: Cascading Style Sheets
auto - allow the browser to select an optimization for font smoothing, typically grayscale.
... formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax auto | never | always | <absolute-size> | <length>where <absolute-size> = xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large examples basic usage example the following example shows the safari/chromium and firefox equivalents that turn on font-smoothing on macos.
font-variant-numeric - CSS: Cascading Style Sheets
; /* <numeric-fraction-values> */ font-variant-numeric: stacked-fractions; /* <numeric-fraction-values> */ font-variant-numeric: oldstyle-nums stacked-fractions; /* global values */ font-variant-numeric: inherit; font-variant-numeric: initial; font-variant-numeric: unset; this property can take one of two forms: either the keyword value normal or one or more of the other values listed below, space-separated, in any order.
... tabular-nums activating the set of figures where numbers are all of the same size, allowing them to be easily aligned like in tables.
font-variant - CSS: Cascading Style Sheets
the font-variant css shorthand property allows you to set all the font variants for a font.
... constituent properties this property is a shorthand for the following css properties: font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric syntax font-variant: small-caps; font-variant: common-ligatures small-caps; /* global values */ font-variant: inherit; font-variant: initial; font-variant: unset; values normal specifies a normal font face; each of the longhand properties has an in...
grid-area - CSS: Cascading Style Sheets
WebCSSgrid-area
constituent properties this property is a shorthand for the following css properties: grid-column-end grid-column-start grid-row-end grid-row-start syntax /* keyword values */ grid-area: auto; grid-area: auto / auto; grid-area: auto / auto / auto; grid-area: auto / auto / auto / auto; /* <custom-ident> values */ grid-area: some-grid-area; grid-area: some-grid-area / another-grid-area; /* <integer> && <custom-ident>?
...] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid areas html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 100px; grid-template: repeat(4, 1fr) / 50px 100px; } #item1 { background-color: lime; grid-area: 2 / 2 / auto / span 3; } #item2 { background-color: yellow; } #item3 { background-color: blue; } result specifications specification status comment css grid layoutthe definition of 'grid-area' in that specification.
grid-column - CSS: Cascading Style Sheets
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.
...] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid column size and location html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 100px; grid-template-columns: repeat(6, 1fr); grid-template-rows: 100px; } #item1 { background-color: lime; } #item2 { background-color: yellow; grid-column: 2 / 4; } #item3 { background-color: blue; grid-column: span 2 / 7; } result specifications specification status comment css grid layoutthe definition of 'grid-column' in that specification.
grid-row - CSS: Cascading Style Sheets
WebCSSgrid-row
constituent properties this property is a shorthand for the following css properties: grid-row-end grid-row-start syntax /* keyword values */ grid-row: auto; grid-row: auto / auto; /* <custom-ident> values */ grid-row: somegridarea; grid-row: somegridarea / someothergridarea; /* <integer> + <custom-ident> values */ grid-row: somegridarea 4; grid-row: 4 somegridarea / 6; /* span + <integer> + <custom-ident> values */ grid-row: span 3; grid-row: span som...
...] | [ span && [ <integer> | <custom-ident> ] ] examples setting grid row size and location html <div id="grid"> <div id="item1"></div> <div id="item2"></div> <div id="item3"></div> </div> css #grid { display: grid; height: 200px; grid-template-columns: 200px; grid-template-rows: repeat(6, 1fr); } #item1 { background-color: lime; } #item2 { background-color: yellow; grid-row: 2 / 4; } #item3 { background-color: blue; grid-row: span 2 / 7; } result specifications specification status comment css grid layoutthe definition of 'grid-row' in that specification.
grid-template-columns - CSS: Cascading Style Sheets
repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) represents a repeated fragment of the track list, allowing a large number of columns that exhibit a recurring pattern to be written in a more compact form.
... | min-content | max-content | auto<fixed-breadth> = <length-percentage>where <length-percentage> = <length> | <percentage> examples specifying grid column sizes html <div id="grid"> <div id="areaa">a</div> <div id="areab">b</div> </div> css #grid { display: grid; width: 100%; grid-template-columns: 50px 1fr; } #areaa { background-color: lime; } #areab { background-color: yellow; } result specifications specification status comment css grid layoutthe definition of 'grid-template-columns' in that specification.
grid-template-rows - CSS: Cascading Style Sheets
repeat( [ <positive-integer> | auto-fill | auto-fit ] , <track-list> ) represents a repeated fragment of the track list, allowing a large number of rows that exhibit a recurring pattern to be written in a more compact form.
...age> | min-content | max-content | auto<fixed-breadth> = <length-percentage>where <length-percentage> = <length> | <percentage> examples specifying grid row sizes html <div id="grid"> <div id="areaa">a</div> <div id="areab">b</div> </div> css #grid { display: grid; height: 100px; grid-template-rows: 30px 1fr; } #areaa { background-color: lime; } #areab { background-color: yellow; } result specifications specification status comment css grid layoutthe definition of 'grid-template-rows' in that specification.
image-set() - CSS: Cascading Style Sheets
WebCSSimage-set
resolution can be used as a proxy for filesize — a user agent on a slow mobile connection with a high-resolution screen may prefer to receive lower-resolution images rather than waiting for a higher resolution image to load.
... image-set() allows the author to provide options rather than determining what each individual user needs.
initial-letter - CSS: Cascading Style Sheets
lues */ 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>.
...negative values are not allowed.
inset-block - CSS: Cascading Style Sheets
ength> values */ inset-block: 3px 10px; inset-block: 2.4em 3em; inset-block: 10px; /* value applied to start and end */ /* <percentage>s of the width or height of the containing block */ inset-block: 10% 5%; /* keyword value */ inset-block: auto; /* global values */ inset-block: inherit; inset-block: initial; inset-block: unset; constituent properties this property is a shorthand for the following css properties: inset-block-end inset-block-start syntax values the inset-block property takes the same values as the left property.
...positioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'>{1,2} examples setting block start and end offsets html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-block: 20px 50px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-block' in that specification.
inset-inline - CSS: Cascading Style Sheets
alues */ inset-inline: 3px 10px; inset-inline: 2.4em 3em; inset-inline: 10px; /* value applied to start and end */ /* <percentage>s of the width or height of the containing block */ inset-inline: 10% 5%; /* keyword value */ inset-inline: auto; /* global values */ inset-inline: inherit; inset-inline: initial; inset-inline: unset; constituent properties this property is a shorthand for the following css properties: inset-inline-end inset-inline-start syntax values the inset-inline property takes the same values as the left property.
...positioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'>{1,2} examples setting inline start and end offsets html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-inline: 20px 50px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline' in that specification.
list-style - CSS: Cascading Style Sheets
the list-style css shorthand property allows you set all the list style properties at once.
... constituent properties this property is a shorthand for the following css properties: list-style-image list-style-position list-style-type syntax /* type */ list-style: square; /* image */ list-style: url('../img/shape.png'); /* position */ list-style: inside; /* type | position */ list-style: georgian inside; /* type | image | position */ list-style: lower-roman url('../img/shape.png') outside; /* keyword value */ list-style: none; /* global value...
margin-block - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: margin-block-end margin-block-start syntax values the margin-block property takes the same values as the margin-left property.
...as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2} examples setting block start and end margins html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-block: 20px 40px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block' in that specification.
margin-inline - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: margin-inline-end margin-inline-start syntax values the margin-inline property takes the same values as the margin-left property.
...s margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typediscrete formal syntax <'margin-left'>{1,2} examples setting inline start and end margins html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-inline: 20px 40px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline' in that specification.
mask-origin - CSS: Cascading Style Sheets
syntax one or more of the keyword values listed below, separated by commas.
...for single boxes 0 0 is the upper left corner of the padding edge, 100% 100% is the lower right corner.
mask-repeat - CSS: Cascading Style Sheets
round as the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room for another one to be added.
... when the next image is added, all of the current ones compress to allow room.
max-block-size - CSS: Cascading Style Sheets
how writing-mode affects directionality the values of writing-mode affect the mapping of max-block-size to max-width or max-height as follows: values of writing-mode max-block-size is equivalent to horizontal-tb, lr , lr-tb , rl , rb , rb-rl max-height vertical-rl, vertical-lr, sideways-rl , sideways-lr , tb , tb-rl max-width the writing-mode values sideways-lr and sideways-rl were removed from the css writing modes level 3 specification late in its design process.
... the writing modes lr, lr-tb, rl, rb, and rb-tl are no longer allowed in html contexts; they may only be used in svg 1.x contexts.
offset-anchor - CSS: Cascading Style Sheets
| [ [ 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.
... this allows you to see what effect the different offset-anchor values have — the first one, auto, causes the <div>'s center point to move along the path.
offset-rotate - CSS: Cascading Style Sheets
syntax /* follow the path direction, with optional additional angle */ offset-rotate: auto; offset-rotate: auto 45deg; /* follow the path direction but facing the opposite direction of `auto` */ offset-rotate: reverse; /* keep a constant rotation regardless the position on the path */ offset-rotate: 90deg; offset-rotate: .5turn; auto the element is rotated by the angle of the direction of the offset-path, relative to the positive x-axis.
... auto <angle> if auto is followed by an <angle>, the computed value of the angle is added to the computed value of auto.
outline-color - CSS: Cascading Style Sheets
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.
...if the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it.
outline-style - CSS: Cascading Style Sheets
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.
...a rounded edge outline with semi-translucent outer pixels that appears to glow.
outline - CSS: Cascading Style Sheets
WebCSSoutline
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.
...however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content.
padding-block - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: padding-block-end padding-block-start syntax values the padding-block property takes the same values as the padding-left property.
... formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typediscrete formal syntax <'padding-left'>{1,2} examples setting block padding for vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; padding-block: 20px 40px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block' in that specification.
padding-bottom - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-bottom: 0.5em; padding-bottom: 0; padding-bottom: 2cm; /* <percentage> value */ padding-bottom: 10%; /* global values */ padding-bottom: inherit; padding-bottom: initial; padding-bottom: unset; the padding-bottom property is specified as a single value chosen from the list below.
... unlike margins, negative values are not allowed for padding.
padding-inline - CSS: Cascading Style Sheets
bsolute length */ padding-inline: 1em 2em; /* relative to the text size */ padding-inline: 10px; /* sets both start and end values */ /* <percentage> values */ padding-inline: 5% 2%; /* relative to the nearest block container's width */ /* global values */ padding-inline: inherit; padding-inline: initial; padding-inline: unset; constituent properties this property is a shorthand for the following css properties: padding-inline-end padding-inline-start syntax values the padding-inline property takes the same values as the padding-left property.
... formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typediscrete formal syntax <'padding-left'>{1,2} examples setting inline padding for vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; padding-inline: 20px 40px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-inline' in that specification.
padding-left - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /* global values */ padding-left: inherit; padding-left: initial; padding-left: unset; the padding-left property is specified as a single value chosen from the list below.
... unlike margins, negative values are not allowed for padding.
padding-right - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-right: 0.5em; padding-right: 0; padding-right: 2cm; /* <percentage> value */ padding-right: 10%; /* global values */ padding-right: inherit; padding-right: initial; padding-right: unset; the padding-right property is specified as a single value chosen from the list below.
... unlike margins, negative values are not allowed for padding.
padding-top - CSS: Cascading Style Sheets
syntax /* <length> values */ padding-top: 0.5em; padding-top: 0; padding-top: 2cm; /* <percentage> value */ padding-top: 10%; /* global values */ padding-top: inherit; padding-top: initial; padding-top: unset; the padding-top property is specified as a single value chosen from the list below.
... unlike margins, negative values are not allowed for padding.
page-break-inside - CSS: Cascading Style Sheets
a subset of values should be aliased as follows: page-break-inside break-inside auto auto avoid avoid formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element.
... working draft allows this property on more elements.
paint-order - CSS: Cascading Style Sheets
when one value is specified, that one is painted first, followed by the other two in their default order relative to one another.
... when two values are specified, they will be painted in the order they are specified in, followed by the unspecified one.
place-content - CSS: Cascading Style Sheets
the place-content css shorthand property allows you to align content along both the block and inline directions at once (i.e.
... constituent properties this 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-items - CSS: Cascading Style Sheets
the css place-items shorthand property allows you to align items along both the block and inline directions at once (i.e.
... constituent properties this property is a shorthand for the following css properties: 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: rig...
pointer-events - CSS: Cascading Style Sheets
/* svg only */ pointer-events: painted; /* svg only */ pointer-events: fill; /* svg only */ pointer-events: stroke; /* svg only */ pointer-events: all; /* svg only */ /* global values */ pointer-events: inherit; pointer-events: initial; pointer-events: unset; the pointer-events property is specified as a single keyword chosen from the list of values below.
...if one of the element's children has pointer-events explicitly set to allow that child to be the target of pointer events, then any events targeting that child will pass through the parent as the event travels along the parent chain, and trigger event listeners on the parent as appropriate.
<position> - CSS: Cascading Style Sheets
this is not allowed in other properties that use <position>.
... recommendation allows combination of a keyword with a <length> or <percentage> value.
repeating-linear-gradient() - CSS: Cascading Style Sheets
<linear-color-stop> a color-stop's <color> value, followed by one or two optional stop positions, (each being either a <percentage> or a <length> along the gradient's axis).
... note: rendering of color stops in css gradients follows the same rules as color stops in svg gradients.
<resolution> - CSS: Cascading Style Sheets
syntax the <resolution> data type consists of a strictly positive <number> followed by one of the units listed below.
...} valid resolutions 96dpi 50.82dpcm 3dppx invalid resolutions 72 dpi spaces are not allowed between the number and the unit.
scroll-margin-inline-end - CSS: Cascading Style Sheets
the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > 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.
scroll-margin-inline-start - CSS: Cascading Style Sheets
the outer container is styled like this: .scroller { text-align: left; width: 250px; height: 250px; overflow-x: scroll; display: flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } the main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest...
... the child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } the most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points.
scroll-padding-block - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targeted element and the edges of the scrollport.
... constituent properties this property is a shorthand for the following css properties: scroll-padding-block-end scroll-padding-block-start syntax /* keyword values */ scroll-padding-block: auto; /* <length> values */ scroll-padding-block: 10px; scroll-padding-block: 1em .5em; scroll-padding-block: 10%; /* global values */ scroll-padding-block: inherit; scroll-padding-block: initial; scroll-padding-block: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.
scroll-padding-inline - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
... constituent properties this property is a shorthand for the following css properties: scroll-padding-inline-end scroll-padding-inline-start syntax /* keyword values */ scroll-padding-inline: auto; /* <length> values */ scroll-padding-inline: 10px; scroll-padding-inline: 1em .5em; scroll-padding-inline: 10%; /* global values */ scroll-padding-inline: inherit; scroll-padding-inline: initial; scroll-padding-inline: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.
scroll-padding - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars), or simply to put more breathing room between a targeted element and the edges of the scrollport.
... constituent properties this property is a shorthand for the following css properties: scroll-padding-bottom scroll-padding-left scroll-padding-right scroll-padding-top syntax /* keyword values */ scroll-padding: auto; /* <length> values */ scroll-padding: 10px; scroll-padding: 1em .5em 1em 1em; scroll-padding: 10%; /* global values */ scroll-padding: inherit; scroll-padding: initial; scroll-padding: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid <length> or a <percentage>.
scroll-snap-points-x - CSS: Cascading Style Sheets
only positive lengths are allowed.
... scroll containercomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syntax none | repeat( <length-percentage> )where <length-percentage> = <length> | <percentage> examples setting horizontal scroll snap points html <div id="container"> <div>1</div> <div>2</div> <div>3</div> </div> css #container { width: 200px; overflow: auto; white-space: nowrap; scroll-snap-points-x: repeat(100%); scroll-snap-type: mandatory; font-size: 0; } #container > div { width: 200px; height: 200px; display: inline-block; line-height: 200px; text-align: center; font-size: 100px; } #container > div:nth-child(even) { background-color: #87ea87; } #container > div:nth-child(odd) { background-color: #87ccea; } resu...
scroll-snap-points-y - CSS: Cascading Style Sheets
only positive lengths are allowed.
...ercomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typediscrete formal syntax none | repeat( <length-percentage> )where <length-percentage> = <length> | <percentage> examples setting vertical scroll snap points html <div id="container"> <div>1</div> <div>2</div> <div>3</div> </div> css #container { height: 200px; width: 220px; overflow-x: hidden; overflow-y: auto; scroll-snap-points-y: repeat(200px); scroll-snap-type: mandatory; font-size: 0; } #container > div { width: 200px; height: 200px; display: inline-block; line-height: 200px; text-align: center; font-size: 100px; } #container > div:nth-child(even) { background-color: #87ea87; } #container > div:nth-child(odd) { background-color: #87ccea; } re...
scroll-snap-stop - CSS: Cascading Style Sheets
the scroll-snap-stop css property defines whether the scroll container is allowed to "pass over" possible snap positions.
... css /* setup */ :root, body { height: 100%; display: flex; align-items: center; justify-content: space-between; flex-flow: column nowrap; font-family: monospace; } .container { display: flex; overflow: auto; outline: 1px dashed lightgray; flex: none; } .container.x { width: 100%; height: 128px; flex-flow: row nowrap; } .container.y { width: 256px; height: 256px; flex-flow: column nowrap; } /* definite scroll snap */ .mandatory-scroll-snapping > div { scroll-snap-stop: always; } .proximity-s...
<string> - CSS: Cascading Style Sheets
WebCSSstring
recommendation explicit definition; allows 6-digit unicode escaped characters.
... recommendation implicit definition; allows 4-digit unicode escaped characters.
text-decoration-line - CSS: Cascading Style Sheets
s */ text-decoration-line: underline overline; /* two decoration lines */ text-decoration-line: overline underline line-through; /* multiple decoration lines */ /* global values */ text-decoration-line: inherit; text-decoration-line: initial; text-decoration-line: unset; the text-decoration-line property is specified as none, or one or more space-separated values from the list below.
...it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax none | [ underline | overline | line-through | blink ] | spelling-error | grammar-error examples <p class="wavy">here's some text with wavy red underline!</p> <p class="both">this text has lines both above and below it.</p> .wavy { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: red; } .both { text-decoration-line: underline overline; } specifications specification status comment css text decoration module level 3the definition of 'text-decoration-line' in that specification.
text-decoration - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness syntax the text-decoration property is specified as one or more space-separated values representing the various longhand text-decoration properties.
...be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications specification status comment css text decoration module level 4 working draft adds text-decoration-thickness; note that this isn't yet officially part of th...
text-emphasis - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: text-emphasis-color text-emphasis-style syntax /* initial value */ text-emphasis: none; /* no emphasis marks */ /* <string> value */ text-emphasis: 'x'; text-emphasis: '点'; text-emphasis: '\25b2'; text-emphasis: '*' #555; text-emphasis: 'foo'; /* should not use.
... open the shape is hollow.
text-underline-offset - CSS: Cascading Style Sheets
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.
...it also applies to ::first-letter and ::first-line.inheritedyespercentagesrefer to the font size of the element itselfcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length> | <percentage> examples <p class="oneline">here's some text with an offset wavy red underline!</p> <br> <p class="twolines">this text has lines both above and below it.
top - CSS: Cascading Style Sheets
WebCSStop
when position is set to relative, the top property specifies the distance the element's top edge is moved below its normal position.
... for relatively positioned elements, the distance that the element is moved below its normal position.
unicode-bidi - CSS: Cascading Style Sheets
the unicode-bidi property overrides this algorithm and allows the developer to control the text embedding.
... this value allows the display of data that is already formatted using a tool following the unicode bidirectional algorithm.
url() - CSS: Cascading Style Sheets
WebCSSurl()
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.
... formal syntax url( <string> <url-modifier>* ) examples content property html <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> css li::after { content: ' - ' url(https://mdn.mozillademos.org/files/16761/star.gif); } result data-uri html <div class="background"></div> css .background { height: 100vh; } .background { background: yellow; background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='90' height='45'%3e%3cpath d='m10 10h60' stroke='%2300f' stroke-width='5'/%3e%3cpath d='m10 20h60' stroke='%230f0' stroke-width='5'/%3e%3cpath d='m10 30h60' stroke='red' stroke-width='5'/%3e%3c/svg%3e"); } specifications specification status comment css values and units module l...
user-select - CSS: Cascading Style Sheets
elect: inherit; user-select: initial; user-select: unset; /* mozilla-specific values */ -moz-user-select: none; -moz-user-select: text; -moz-user-select: all; /* webkit-specific values */ -webkit-user-select: none; -webkit-user-select: text; -webkit-user-select: all; /* doesn't work in safari; use only "none" or "text", or else it will allow typing in the <html> container */ /* microsoft-specific values */ -ms-user-select: none; -ms-user-select: text; -ms-user-select: element; note: user-select is not an inherited property, though the initial auto value makes it behave like it is inherited most of the time.
... auto the used value of auto is determined as follows: on the ::before and ::after pseudo elements, the used value is none if the element is an editable element, the used value is contain otherwise, if the used value of user-select on the parent of this element is all, the used value is all otherwise, if the used value of user-select on the parent of this element is none, the used value is none otherwise, the used value is text te...
visibility - CSS: Cascading Style Sheets
syntax /* keyword values */ visibility: visible; visibility: hidden; visibility: collapse; /* global values */ visibility: inherit; visibility: initial; visibility: unset; the visibility property is specified as one of the keyword values listed below.
...this value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table.
math:min() - EXSLT
WebEXSLTmathmin
note: syntax math:min(nodeset) parameters nodeset the node-set whose lowest value is to be returned.
... returns a result tree fragment representing the lowest valued node's numeric value as a string.
set:trailing() - EXSLT
WebEXSLTsettrailing
syntax set:trailing(nodeset1, nodeset2) parameters nodeset1 the node set to find nodes in that follow the first node in the second node set.
... returns a node-set containing the nodes from nodeset1 whose values follow the first node in nodeset2.
Event reference
overflow uievent mozilla specific an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible).
... touchenter touchevent touch events removed touchleave touchevent touch events removed underflow uievent mozilla specific an element is no longer overflowed by its content (only works for elements styled with overflow != visible).
Touch events (Mozilla experimental) - Developer guides
this api allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system.
... although touch events were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time.
Content categories - Developer guides
flow content elements belonging to the flow content category typically contain text or embedded content.
...elements whose model is flow content or phrasing content should have at least one node which is palpable.
XHTML - Developer guides
WebGuideHTMLXHTML
the following example shows an html document and corresponding "xhtml" document, and the accompanying http content-type headers they should be served with.
...the problems are described in more details in the following articles: beware of xhtml by david hammond sending xhtml as text/html considered harmful by ian hickson xhtml's dirty little secret by mark pilgrim xhtml - what's the point?
Mobile-friendliness - Developer guides
goal #3 (performance) “give your users a smooth experience, even on a slow connection.” though things have been getting better in recent years, browsing the internet over a wireless data connection can still be pretty painful.
...approaches to mobile web development the following approaches aim to achieve each of these goals by different means.
Parsing and serializing XML - Developer guides
creating an xml document using one of the following approaches to create an xml document (which is an instance of document.
... use the following approaches to serialize the contents of the xml document you created in the previous section.
The Unicode Bidirectional Text Algorithm - Developer guides
you must always follow each opening character with an appropriate closing character.
...se direction to rtl, isolating the embedded content from the surrounding text first strong isolate (fsi) u+2068 &#x2068; dir="auto" isolates the content and sets the base direction according to the first strongly-typed directional character in the embedded content left-to-right embedding (lre) u+202a &#x202a; dir="ltr" sets the base direction to ltr but allows the embedded text to interact with the surrounding content; this risks the effect spilling over to the outer content right-to-left embedding (rle) u+202b &#x202b; dir="rtl" sets the base direction to rtl, but lets the embedded text interact with the surrounding content, risking spillover effects left-to-right override (lro) u+202d &#x202d; <bdo dir="ltr"> ...
HTML attribute: crossorigin - HTML: Hypertext Markup Language
these attributes are enumerated, and have the following possible values: keyword description anonymous cors requests for this element will have the credentials flag set to 'same-origin'.
... example: crossorigin with the script element you can use the following <script> element to tell a browser to execute the https://example.com/example-framework.js script without sending user-credentials.
HTML attribute: multiple - HTML: Hypertext Markup Language
the user can choose multiple files from the file picker in any way that their chosen platform allows (e.g.
...when using the multiple attribute, inform the user that multiple values are allowed and provide directions on how to provide multiple values, such as "separate email addresses with a comma." setting size="1" on a multiple select can make it appear as a single select in some browsers, but then it doesn't expand on focus, harming usability.
DASH Adaptive Streaming for HTML 5 Video - HTML: Hypertext Markup Language
this means that it allows for a video stream to switch between bit rates on the basis of network performance, in order to keep a video playing.
... it will be replaced by an implementation of the media source extensions api which will allow support for dash via javascript libraries such as dash.js.
<article>: The Article Contents element - HTML: Hypertext Markup Language
WebHTMLElementarticle
content categories flow content, sectioning content, palpable content permitted content flow content.
... permitted parents any element that accepts flow content.
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
WebHTMLElementbdi
though the same visual effect can be achieved using the css rule unicode-bidi: isolate on a <span> or another text-formatting element, html authors should not use this approach because it is not semantic and browsers are allowed to ignore css styling.
... content categories flow content, phrasing content, palpable content.
<body>: The Document Body element - HTML: Hypertext Markup Language
WebHTMLElementbody
permitted content flow content.
...the end tag may be omitted if the <body> element has contents or has a start tag, and is not immediately followed by a comment.
<br>: The Line Break element - HTML: Hypertext Markup Language
WebHTMLElementbr
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.
... technical summary content categories flow content, phrasing content.
<cite>: The Citation element - HTML: Hypertext Markup Language
WebHTMLElementcite
content categories flow content, phrasing content, palpable content.
... usage notes in the context of the <cite> element, a creative work that might be cited could be, for example, one of the following: a book a research paper an essay a poem a musical score a song a play or film script a film a television show a game a sculpture a painting a theatrical production a play an opera a musical an exhibition a legal case report a computer program a web site a web page a blog post or comment a forum post or comment a tweet a facebook post a written or oral statement a...
<data> - HTML: Hypertext Markup Language
WebHTMLElementdata
content categories flow content, phrasing content, palpable content.
... examples the following example displays product names but also associates each name with a product number.
<dd>: The Description Details element - HTML: Hypertext Markup Language
WebHTMLElementdd
permitted content flow content.
...the end tag may be omitted if the <dd> element is immediately followed by another <dd> element or a <dt> element, or if there is no more content in the parent element.
<del>: The Deleted Text element - HTML: Hypertext Markup Language
WebHTMLElementdel
content categories phrasing content or flow content.
... del::before, del::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } del::before { content: " [deletion start] "; } del::after { content: " [deletion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity.
<dialog>: The Dialog element - HTML: Hypertext Markup Language
WebHTMLElementdialog
content categories flow content, sectioning root permitted content flow content tag omission none, both the starting and ending tag are mandatory.
... permitted parents any element that accepts flow content implicit aria role dialog permitted aria roles alertdialog dom interface htmldialogelement attributes this element includes the global attributes.
<em>: The Emphasis element - HTML: Hypertext Markup Language
WebHTMLElementem
content categories flow content, phrasing content, palpable content.
... <p> in html 5, what was previously called <em>block-level</em> content is now called <em>flow</em> content.
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
WebHTMLElementhr
content categories flow content.
... permitted parents any element that accepts flow content.
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
WebHTMLElementhtml
permitted content one <head> element, followed by one <body> element.
... the end tag may be omitted if the <html> element is not immediately followed by a comment.
<input type="submit"> - HTML: Hypertext Markup Language
WebHTMLElementinputsubmit
this label is likely to be something along the lines of "submit" or "submit query." here's an example of a submit button with a default label in your browser: <input type="submit"> additional attributes in addition to the attributes shared by all <input> elements, submit button inputs support the following attributes: attribute description formaction the url to which to submit the form's data; overrides the form's action attribute, if any formenctype a string specifying the encoding type to use for the form data formmethod the http method (get or post) to use when submitting the form.
... multipart/form-data uses the formdata api to manage the data, allowing for files to be submitted to the server.
<ins> - HTML: Hypertext Markup Language
WebHTMLElementins
content categories phrasing content or flow content.
... ins::before, ins::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } ins::before { content: " [insertion start] "; } ins::after { content: " [insertion end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity.
<label> - HTML: Hypertext Markup Language
WebHTMLElementlabel
technical summary content categories flow content, phrasing content, interactive content, form-associated element, palpable content.
...no labelable elements other than the labeled control are allowed.
<map> - HTML: Hypertext Markup Language
WebHTMLElementmap
content categories flow content, phrasing content, palpable content.
... examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html"> <area shape="circle" coords="275,75,75" href="right.html"> </map> <img usemap="#primary" src="https://udn.realityripple.com/samples/6a/7e559101b3.png" alt="350 x 150 pic"> result expected live example output the live example above should appear similar to the following images (when using your keyboard tab key): for the left.html link: for the right.html link specifications specification status comment html living standardthe definition of '<map>' in that specification.
<mark>: The Mark Text element - HTML: Hypertext Markup Language
WebHTMLElementmark
content categories flow content, phrasing content, palpable content.
... mark::before, mark::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } mark::before { content: " [highlight start] "; } mark::after { content: " [highlight end] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity.
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
WebHTMLElementnoframes
a <noframes> element can contain any html elements that are allowed within the body of an html document, with the exception of the <frameset> and <frame> elements, since using frames when they aren't supported doesn't make sense.
... <frameset cols="50%,50%"> <frame src="https://developer.mozilla.org/en/html/element/frameset" /> <frame src="https://developer.mozilla.org/en/html/element/frame" /> <noframes><p>it seems your browser does not support frames or is configured to not allow them.</p></noframes> </frameset> specifications specification status comment html5the definition of 'noframes' in that specification.
<noscript> - HTML: Hypertext Markup Language
WebHTMLElementnoscript
content categories metadata content, flow content, phrasing content.
... otherwise: flow content or phrasing content.
<object> - HTML: Hypertext Markup Language
WebHTMLElementobject
content categories flow content; phrasing content; embedded content, palpable content; if the element has a usemap attribute, interactive content; listed, submittable form-associated element.
... usemap a hash-name reference to a <map> element; that is a '#' followed by the value of a name of a map element.
<output>: The Output element - HTML: Hypertext Markup Language
WebHTMLElementoutput
content categories flow content, phrasing content, listed, labelable, resettable form-associated element, palpable content.
... examples in the following example, the form provides a slider whose value can range between 0 and 100, and an <input> element into which you can enter a second number.
<progress>: The Progress Indicator element - HTML: Hypertext Markup Language
WebHTMLElementprogress
content categories flow content, phrasing content, labelable content, palpable content.
... note: unlike the <meter> element, the minimum value is always 0, and the min attribute is not allowed for the <progress> element.
<s> - HTML: Hypertext Markup Language
WebHTMLElements
content categories phrasing content or flow content.
... s::before, s::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; } s::before { content: " [start of stricken text] "; } s::after { content: " [end of stricken text] "; } some people who use screen readers deliberately disable announcing content that creates extra verbosity.
<samp>: The Sample Output element - HTML: Hypertext Markup Language
WebHTMLElementsamp
content categories flow content, phrasing content, palpable content.
...for example, consider this text presenting a transcript of a linux (or macos) console session: html <pre> <samp><span class="prompt">mike@interwebz:~$</span> <kbd>md5 -s "hello world"</kbd> md5 ("hello world") = 3e25960a79dbc69b674cd4ec67a72c62 <span class="prompt">mike@interwebz:~$</span> <span class="cursor">█</span></samp></pre> note the use of <span> to allow customization of the appearance of specific portions of the sample text such as the shell prompts and the cursor.
<small>: the side comment element - HTML: Hypertext Markup Language
WebHTMLElementsmall
content categories flow content, phrasing content permitted content phrasing content tag omission none, must have both a start tag and an end tag.
... permitted parents any element that accepts phrasing content, or any element that accepts flow content.
<span> - HTML: Hypertext Markup Language
WebHTMLElementspan
content categories flow content, phrasing content.
... permitted parents any element that accepts phrasing content, or any element that accepts flow content.
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
WebHTMLElementstrong
content categories flow content, phrasing content, palpable content.
... permitted parents any element that accepts phrasing content, or any element that accepts flow content.
<thead>: The Table Head element - HTML: Hypertext Markup Language
WebHTMLElementthead
the end tag may be omitted if the <thead> element is immediately followed by a <tbody> or <tfoot> element.
...one of the sixteen predefined color strings may be used: black = "#000000" green = "#008000" silver = "#c0c0c0" lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" fuchsia = "#ff00ff" aqua = "#00ffff" usage note: do not use this attribute, as it is non-standard and only implemented in some versions of microsoft internet explorer:...
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
WebHTMLElementu
content categories flow content, phrasing content, palpable content.
... non-semantic underlines to underline text without implying any semantic meaning, use a <span> element with the text-decoration property set to "underline", as shown below.
<ul>: The Unordered List element - HTML: Hypertext Markup Language
WebHTMLElementul
content categories flow content, and if the <ul> element's children include at least one <li> element, palpable content.
... permitted parents any element that accepts flow content.
<var>: The Variable element - HTML: Hypertext Markup Language
WebHTMLElementvar
content categories flow content, phrasing content, palpable content.
...ther elements that are used in contexts in which <var> is commonly used include: <code>: the html code element <kbd>: the html keyboard input element <samp>: the html sample output element if you encounter code that is mistakenly using <var> for style purposes rather than semantic purposes, you should either use a <span> with appropriate css or, an appropriate semantic element among the following: <em> <i> <q> default style most browsers apply font-style to "italic" when rendering <var>.
contextmenu - HTML: Hypertext Markup Language
html5 now allows us to customize this menu.
...st element, you can change the size of the text by using the "increase/decrease font" actions from your context menu </li> <menu type="context" id="changefont"> <menuitem label="increase font" onclick="incfont()"></menuitem> <menuitem label="decrease font" onclick="decfont()"></menuitem> </menu> <li contextmenu="changeimage" id="changeimage"> on the image below, you can fire the "change image" action in your context menu.<br /> <img src="https://udn.realityripple.com/samples/a2/b601bdfc0c.png" contextmenu="changeimage" id="promobutton" /> <menu type="context" id="changeimage"> <menuitem label="change image" onclick="changeimage()"></menuitem> </menu> </li> </ol> </body> javascript function shareviatwitt...
data-* - HTML: Hypertext Markup Language
the data-* global attributes form a class of attributes called custom data attributes, that allow proprietary information to be exchanged between the html and its dom representation by scripts.
... the * may be replaced by any name following the production rule of xml names with the following restrictions: the name must not start with xml, whatever case is used for these letters; the name must not contain any semicolon (u+003a); the name must not contain capital letters.
dir - HTML: Hypertext Markup Language
it can have the following values: ltr, which means left to right and is to be used for languages that are written from the left to the right (like english); rtl, which means right to left and is to be used for languages that are written from the right to the left (like arabic); auto, which lets the user agent decide.
... browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content.
id - HTML: Hypertext Markup Language
in contrast to the class attribute, which allows space-separated values, elements can only have one single id value.
... note: using characters except ascii letters, digits, '_', '-' and '.' may cause compatibility problems, as they weren't allowed in html 4.
is - HTML: Hypertext Markup Language
the is global attribute allows you to specify that a standard html element should behave like a defined custom built-in element (see using custom elements for more details).
... examples the following code is taken from our word-count-web-component example (see it live also).
itemref - HTML: Hypertext Markup Language
it is merely a syntactic construct to aid authors in adding annotations to pages where the data to be annotated does not follow a convenient tree structure.
... for example, it allows authors to mark up data in a table so that each column defines a separate item while keeping the properties in the cells.
spellcheck - HTML: Hypertext Markup Language
it may have the following values: true, which indicates that the element should be, if possible, checked for spelling errors; false, which indicates that the element should not be checked for spelling errors.
...this means that the explicit usage of one of the values true or false is mandatory, and that a shorthand like <textarea spellcheck></textarea> is not allowed.
HTML reference - HTML: Hypertext Markup Language
link types in html, the following link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, or <link> element.
... date and time formats used in html certain html elements allow you to specify dates and/or times as the value or as the value of an attribute.
Data URLs - HTTP
data urls, urls prefixed with the data: scheme, allow content creators to embed small files inline in documents.
...to mitigate such issues, top-level navigation to data:// urls has been blocked in firefox 59+ (release version, nightly/beta from 58), and we hope to see other browsers follow suit soon.
Content-Disposition - HTTP
content-disposition: form-data content-disposition: form-data; name="fieldname" content-disposition: form-data; name="fieldname"; filename="filename.jpg" directives name is followed by a string containing the name of the html field in the form that the content of this subpart refers to.
... filename is followed by a string containing the original name of the file transmitted.
Content-Language - HTTP
the content-language entity header is used to describe the language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language.
...in most cases, a language tag consists of a primary language subtag that identifies a broad family of related languages (e.g., "en" = english), which is optionally followed by a series of subtags that refine or narrow that language's range (e.g., "en-ca" = the variety of english as communicated in canada).
CSP: block-all-mixed-content - HTTP
syntax content-security-policy: block-all-mixed-content; examples content-security-policy: block-all-mixed-content; <meta http-equiv="content-security-policy" content="block-all-mixed-content"> to disallow http assets on a more granular level, you can also set individual directives to https:.
... for example, to disallow nonsecure http images: content-security-policy: img-src https: specifications specification status comment mixed contentthe definition of 'block-all-mixed-content' in that specification.
Keep-Alive - HTTP
the keep-alive general header allows the sender to hint about how the connection may be used to set a timeout and a maximum amount of requests.
...the following identifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds).
Large-Allocation - HTTP
these windows must remain in the same process as their opener, as they can communicate, meaning that we cannot allow them to switch processes.
...this is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes.
Public-Key-Pins-Report-Only - HTTP
the http public-key-pins-report-only response header was used to send reports of pinning violation to the report-uri specified in the header but, unlike public-key-pins still allows browsers to connect to the server if the pinning is violated.
...some browsers might allow other hashing algorithms than sha-256 in the future.
Server-Timing - HTTP
header type response header forbidden header name no syntax the syntax of the server-timing header allows you to communicate metrics in different ways: server metric name only, metric with value, metric with value and description, and metric with description.
...this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics.
Transfer-Encoding - HTTP
the content-length header is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another '\r\n'.
...it is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields.
X-DNS-Prefetch-Control - HTTP
the x-dns-prefetch-control http response header controls dns prefetching, a feature by which browsers proactively perform domain name resolution on both links that the user may choose to follow as well as urls for items referenced by the document, including images, css, javascript, and so forth.
... the implementation of this prefetching in some browsers allows domain name resolution to occur in parallel with (instead of in serial with) the fetching of actual page content.
POST - HTTP
WebHTTPMethodsPOST
as described in the http 1.1 specification, post is designed to allow a uniform method to cover the following functions: annotation of existing resources posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; adding a new user through a signup modal; providing a block of data, such as the result of submitting a form, to a data-handling process; extending a database through an append operation.
... request has body yes successful response has body yes safe no idempotent no cacheable only if freshness information is included allowed in html forms yes syntax post /test example a simple form using the default application/x-www-form-urlencoded content type: post /test http/1.1 host: foo.example content-type: application/x-www-form-urlencoded content-length: 27 field1=value1&field2=value2 a form using the multipart/form-data content type: post /test http/1.1 host: foo.example content-type: multipart/form-data;boundary="boundary" --boundary content-disposition: form-data; name="field1" value1 --boundary content-disposition: form-data; name="field2"; filename="example.txt" value2 --boundary-- specifi...
TRACE - HTTP
WebHTTPMethodsTRACE
the final recipient of the request should reflect the message received, excluding some fields described below, back to the client as the message body of a 200 (ok) response with a content-type of message/http.
... request has body no successful response has body no safe no idempotent yes cacheable no allowed in html forms no syntax trace /index.html specifications specification title rfc 7231, section 4.3.8: trace hypertext transfer protocol (http/1.1): semantics and content ...
451 Unavailable For Legal Reasons - HTTP
WebHTTPStatus451
status 451 unavailable for legal reasons example this example response is taken from the ietf rfc (see below) and contains a reference to monty python's life of brian.
...tp/1.1 451 unavailable for legal reasons link: <https://spqr.example.org/legislatione>; rel="blocked-by" content-type: text/html <html> <head><title>unavailable for legal reasons</title></head> <body> <h1>unavailable for legal reasons</h1> <p>this request may not be serviced in the roman province of judea due to the lex julia majestatis, which disallows access to resources hosted on servers deemed to be operated by the people's front of judea.</p> </body> </html> specifications specification title rfc 7725: 451 unavailable for legal reasons an http status code to report legal obstacles ...
Groups and ranges - JavaScript
types the following section is also duplicated on this cheatsheet.
...if you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below).
About the JavaScript reference - JavaScript
where to find javascript information javascript documentation of core language features (pure ecmascript, for the most part) includes the following: the javascript guide the javascript reference if you are new to javascript, start with the guide.
... 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.
Private class fields - JavaScript
there is however an experimental proposal to allow defining private class fields using a hash # prefix is added.
...in the following example this refers to the derived class (not the base class) when we try to call derived.publicstaticmethod2(), and thus exhibits the same "provenance restriction" as mentioned above: class base { static #privatestaticmethod() { return 42; } static publicstaticmethod1() { return base.#privatestaticmethod(); } static publicstaticmethod2() { return t...
Public class fields - JavaScript
see the compat information below.
...in subclasses, super lets you access the superclass prototype, allowing you to call methods from the superclass.
Classes - JavaScript
you first need to declare your class and then access it, otherwise code like the following will throw a referenceerror: const p = new rectangle(); // referenceerror class rectangle {} class expressions a class expression is another way to define a class.
... private field declarations using private fields, the definition can be refined as below.
SyntaxError: invalid regular expression flag "x" - JavaScript
s allow .
... let obj = { url: '/docs/web' }; valid regular expression flags see the table above for the six valid regular expression flags that are allowed in javascript.
TypeError: can't assign to property "x" on "y": not an object - JavaScript
the problem might be that an unexpected value is flowing at an unexpected place, or that an object variant of a string or a number is expected.
... examples invalid cases 'use strict'; var foo = "my string"; // the following line does nothing if not in strict mode.
TypeError: cyclic object value - JavaScript
examples circular references in a circular structure like the following var circularreference = {otherdata: 123}; circularreference.myself = circularreference; json.stringify() will fail json.stringify(circularreference); // typeerror: cyclic object value to serialize circular references you can use a library that supports them (e.g.
... the snippet below illustrates how to find and filter (thus causing data loss) a cyclic reference by using the replacer parameter of json.stringify(): const getcircularreplacer = () => { const seen = new weakset(); return (key, value) => { if (typeof value === "object" && value !== null) { if (seen.has(value)) { return; } seen.add(value); } return value; }; }; json.stringify(circularreference, getcircularreplacer()); // {"otherdata":123} ...
TypeError: can't access dead object - JavaScript
the javascript exception "can't access dead object" occurs when firefox disallows add-ons to keep strong references to dom objects after their parent document has been destroyed to improve in memory usage and to prevent memory leaks.
... to improve in memory usage and to prevent memory leaks, firefox disallows add-ons to keep strong references to dom objects after their parent document has been destroyed.
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated - JavaScript
message syntaxerror: calling delete on expression not allowed in strict mode (edge) syntaxerror: applying the 'delete' operator to an unqualified name is deprecated (firefox) syntaxerror: delete of an unqualified identifier in strict mode.
...in strict mode, an attempt to delete a variable will throw an error and is not allowed.
TypeError: setting getter-only property "x" - JavaScript
message typeerror: assignment to read-only properties is not allowed in strict mode (edge) typeerror: setting getter-only property "x" (firefox) typeerror: cannot set property "prop" of #<object> which has only a getter (chrome) error type typeerror in strict mode only.
... examples property with no setter the example below shows how to set a getter for a property.
SyntaxError: for-in loop head declarations may not have initializers - JavaScript
this is not allowed in for-of loops in strict mode.
...the for loop allows you to set an initializer then as well: var arr = [ "a", "b", "c" ] for (var i = 2; i < arr.length; i++) { console.log(arr[i]); } // "c" ...
SyntaxError: JSON.parse: bad parsing - JavaScript
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 proper...
... 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.
TypeError: "x" is not a constructor - JavaScript
the following javascript standard built-in objects are not a constructor: math, json, symbol, reflect, intl, atomics.
...to do this, you would write the following function: function car(make, model, year) { this.make = make; this.model = model; this.year = year; } now you can create an object called mycar as follows: var mycar = new car('eagle', 'talon tsi', 1993); in promises when returning an immediately-resolved or immediately-rejected promise, you do not need to create a new promise(...) and act on it.
RangeError: precision is out of range - JavaScript
there was an out of range precision argument in one of these methods: number.prototype.toexponential() number.prototype.tofixed() number.prototype.toprecision() the allowed range for these methods is usually between 0 and 20 (or 21).
... however, the ecmascript specification allows to extend this range.
RangeError: repeat count must be less than infinity - JavaScript
message rangeerror: argument out of range (edge) rangeerror: repeat count must be less than infinity and not overflow maximum string size (firefox) rangeerror: invalid count value (chrome) error type rangeerror what went wrong?
...the range of allowed values can be described like this: [0, +∞).
Warning: unreachable code after return statement - JavaScript
in the case of semicolon-less return statements, it can be unclear whether the developer intended to return the statement on the following line, or to stop execution and return.
... warnings will not be shown for semicolon-less returns if these statements follow it: throw break var function examples invalid cases function f() { var x = 3; x += 4; return x; // return exits the function immediately x -= 3; // so this line will never run; it is unreachable } function f() { return // this is treated like `return;` 3 + 4; // so the function returns, and this line is 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 } ...
The arguments object - JavaScript
for example, if a function is passed 3 arguments, you can access them as follows: arguments[0] // first argument arguments[1] // second argument arguments[2] // third argument each argument can also be set or reassigned: arguments[1] = 'new value'; the arguments object is not an array.
...the function is defined as follows: function list(type) { var html = '<' + type + 'l><li>'; var args = array.prototype.slice.call(arguments, 1); html += args.join('</li><li>'); html += '</li></' + type + 'l>'; // end list return html; } you can pass any number of arguments to this function, and it adds each argument as a list item to a list of the type indicated.
setter - JavaScript
note the following when working with the set syntax: it can have an identifier which is either a number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property.
... ( { set x(v) { }, set x(v) { } } and { x: ..., set x(v) { } } are forbidden ) examples defining a setter on new objects in object initializers the following example define a pseudo-property current of object language.
Array.prototype.findIndex() - JavaScript
examples find the index of a prime number in an array the following example returns the index of the first element in the array that is a prime number, or -1 if there is no prime number.
... function isprime(num) { for (let i = 2; num > i; i++) { if (num % i == 0) { return false; } } return num > 1; } console.log([4, 6, 8, 9, 12].findindex(isprime)); // -1, not found console.log([4, 6, 7, 9, 12].findindex(isprime)); // 2 (array[2] is 7) find index using arrow function the following example finds the index of a fruit using an arrow function: const fruits = ["apple", "banana", "cantaloupe", "blueberries", "grapefruit"]; const index = fruits.findindex(fruit => fruit === "blueberries"); console.log(index); // 3 console.log(fruits[index]); // blueberries specifications specification ecmascript (ecma-262)the definition of 'array.prototype.findindex' in that specification.
Array.isArray() - JavaScript
polyfill running the following code before any other code will create array.isarray() if it's not natively available.
... if (!array.isarray) { array.isarray = function(arg) { return object.prototype.tostring.call(arg) === '[object array]'; }; } examples using array.isarray // all following calls return true array.isarray([]); array.isarray([1]); array.isarray(new array()); array.isarray(new array('a', 'b', 'c', 'd')); array.isarray(new array(3)); // little known fact: array.prototype itself is an array: array.isarray(array.prototype); // all following calls return false array.isarray(); array.isarray({}); array.isarray(null); array.isarray(undefined); array.isarray(17); array.isarray('array'); array.isarray(true); array.isarray(false); array.isarray(new uint8array(32)); array.isarray({ __proto__: array.prototype }); instanceof vs isarray when checking for array instance, array.isarray is prefe...
Array.prototype.join() - JavaScript
examples joining an array four different ways the following example creates an array, a, with three elements, then joins the array four times: using the default separator, then a comma and a space, then a plus and an empty string.
... var a = ['wind', 'water', 'fire']; a.join(); // 'wind,water,fire' a.join(', '); // 'wind, water, fire' a.join(' + '); // 'wind + water + fire' a.join(''); // 'windwaterfire' joining an array-like object the following example joins array-like object (arguments), by calling function.prototype.call on array.prototype.join.
Array.prototype.length - JavaScript
examples iterating over an array in the following example, the array numbers is iterated through by looking at the length property.
... var numbers = [1, 2, 3, 4, 5]; var length = numbers.length; for (var i = 0; i < length; i++) { numbers[i] *= 2; } // numbers is now [2, 4, 6, 8, 10] shortening an array the following example shortens the array numbers to a length of 3 if the current length is greater than 3.
Array.prototype.push() - JavaScript
examples adding elements to an array the following code creates the sports array containing two elements, then appends two elements to it.
...instead, we store the collection on the object itself and use call on array.prototype.push to trick the method into thinking we are dealing with an array—and it just works, thanks to the way javascript allows us to establish the execution context in any way we want.
Array.prototype.reverse() - JavaScript
examples reversing the elements in an array the following example creates an array a, containing three elements, then reverses the array.
... const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.reverse(); console.log(a); // [3, 2, 1] reversing the elements in an array-like object the following example creates an array-like object a, containing three elements and a length property, then reverses the array-like object.
Atomics - JavaScript
if waiting is not allowed in the calling agent then it throws an error exception.
... (most browsers will not allow wait() on the browser's main thread.) atomics.xor() computes a bitwise xor on the value at the specified index of the array with the provided value.
Boolean - JavaScript
for example, the condition in the following if statement evaluates to true: var x = new boolean(false); if (x) { // this code is executed } this behavior does not apply to boolean primitives.
... for example, the condition in the following if statement evaluates to false: var x = false; if (x) { // this code is not executed } do not use a boolean object to convert a non-boolean value to a boolean value.
DataView - JavaScript
the dataview view provides a low-level interface for reading and writing multiple number types in a binary arraybuffer, without having to care about the platform's endianness.
...further, although native bigints are much faster than user-land library equivalents, bigints will always be much slower than 32-bit integers in javascript due to the nature of their variable size.
Date.prototype.toDateString() - JavaScript
the todatestring() method returns the date portion of a date object in english in the following format separated by spaces: first three letters of the week day name first three letters of the month name two digit day of the month, padded on the left a zero if necessary four digit year (at least), padded on the left with zeros if necessary e.g.
...in spidermonkey, this consists of the date portion (day, month, and year) followed by the time portion (hours, minutes, seconds, and time zone).
Date.prototype.toGMTString() - JavaScript
syntax dateobj.togmtstring() return value a string representing the given date following the internet greenwich mean time (gmt) convention.
... examples simple example in this example, the togmtstring() method converts the date to gmt (utc) using the operating system's time-zone offset and returns a string value that is similar to the following form.
Date.prototype.toLocaleDateString() - JavaScript
the new locales and options arguments let applications specify the language whose formatting conventions should be used and allow to customize the behavior of the function.
...in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // formats below assume the local time zone of the locale; // america/los_angeles for the us // us english uses month-day-year order console.log(date.tolocaledatestring('en-us')); // → "12/19/2012" // british english uses day-month-year order console.log(date.tolocaledatestring('en-gb')); // → "20/12/2012" // korean uses year-month-day order console.log(date.tolocaledatestring('ko-kr')); // → "2012.
Intl.DateTimeFormat.prototype.formatToParts() - JavaScript
the intl.datetimeformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by datetimeformat formatters.
...the structure the formattoparts() method returns, looks like this: [ { type: 'day', value: '17' }, { type: 'weekday', value: 'monday' } ] possible types are the following: day the string used for the day, for example "17".
Intl.DisplayNames() constructor - JavaScript
the following unicode extension key is allowed: nu the numbering system to be used.
... options optional an object with some or all of the following properties: localematcher the locale matching algorithm to use.
Intl.ListFormat - JavaScript
examples using format the following example shows how to create a list formatter using the english language.
... console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).format(list)); // > motorcycle, bus and car console.log(new intl.listformat('en-gb', { style: 'short', type: 'disjunction' }).format(list)); // > motorcycle, bus or car console.log(new intl.listformat('en-gb', { style: 'narrow', type: 'unit' }).format(list)); // > motorcycle bus car using formattoparts the following example shows how to create a list formatter returning formatted parts const list = ['motorcycle', 'bus', 'car']; console.log(new intl.listformat('en-gb', { style: 'long', type: 'conjunction' }).formattoparts(list)); // [ { "type": "element", "value": "motorcycle" }, // { "type": "literal", "value": ", " }, // { "type": "element", "value": "bus" }, // { "type": "literal", "value": ", a...
Intl.NumberFormat.prototype.formatToParts() - JavaScript
the intl.numberformat.prototype.formattoparts() method allows locale-aware formatting of strings produced by numberformat formatters.
...the structure the formattoparts() method returns, looks like this: [ { type: "integer", value: "3" }, { type: "group", value: "." }, { type: "integer", value: "500" } ] possible types are the following: currency the currency string, such as the symbols "$" and "€" or the name "dollar", "euro" depending on how currencydisplay is specified.
Intl.NumberFormat.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used.
... only one of the following two groups of properties is included: minimumintegerdigits minimumfractiondigits maximumfractiondigits the values provided for these properties in the options argument or filled in as defaults.
Intl.PluralRules() constructor - JavaScript
an object with some or all of the following properties: localematcher the locale matching algorithm to use.
... the following properties fall into two groups: minimumintegerdigits, minimumfractiondigits, and maximumfractiondigits in one group, minimumsignificantdigits and maximumsignificantdigits in the other.
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used.
... only one of the following two groups of properties is included: minimumintegerdigits minimumfractiondigits maximumfractiondigits the values provided for these properties in the options argument or filled in as defaults.
Intl.RelativeTimeFormat.prototype.format() - JavaScript
examples basic format usage the following example shows how to create a relative time formatter using the english language.
...this allows to not always have to use numeric values in the output.
Intl.RelativeTimeFormat.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used.
...the "auto" value allows to not always have to use numeric values in the output.
Intl.RelativeTimeFormat - JavaScript
examples basic format usage the following example shows how to use a relative time formatter for the english language.
...rtf.format(1, "day"); // > "in 1 day" using formattoparts the following example shows how to create a relative time formatter returning formatted parts const rtf = new intl.relativetimeformat("en", { numeric: "auto" }); // format relative time using the day unit.
JSON.parse() - JavaScript
third, we delete all // open brackets that follow a colon or comma or that begin the text.
...}); // 1 // 2 // 4 // 6 // 5 // 3 // "" json.parse() does not allow trailing commas // both will throw a syntaxerror json.parse('[1, 2, 3, 4, ]'); json.parse('{"foo" : 1, }'); json.parse() does not allow single quotes // will throw a syntaxerror json.parse("{'foo': 1}"); specifications specification ecmascript (ecma-262)the definition of 'json.parse' in that specification.
Map.prototype.forEach() - JavaScript
it takes the following arguments: value optional value of each iteration.
... examples printing the contents of a map object the following code logs a line for each element in an map object: function logmapelements(value, key, map) { console.log(`map.get('${key}') = ${value}`) } new map([['foo', 3], ['bar', {}], ['baz', undefined]]).foreach(logmapelements) // logs: // "map.get('foo') = 3" // "map.get('bar') = [object object]" // "map.get('baz') = undefined" specifications specification ecmascript (ec...
Map - JavaScript
even though every nan is not equal to itself (nan !== nan is true), the following example works because nans are indistinguishable from each other: let mymap = new map() mymap.set(nan, 'not a number') mymap.get(nan) // "not a number" let othernan = number('foo') mymap.get(othernan) // "not a number" iterating map with for..of maps can be iterated using a for..of loop: let mymap = new map() mymap.set(0, 'zero') mymap.set(1, 'one') for (let [key, value] of mymap) { ...
... syntax console.log([...mymap]) // or use the keys() or values() iterators, and convert them to an array console.log(array.from(mymap.keys())) // ["key1", "key2"] cloning and merging maps just like arrays, maps can be cloned: let original = new map([ [1, 'one'] ]) let clone = new map(original) console.log(clone.get(1)) // one console.log(original === clone) // false (useful for shallow comparison) important: keep in mind that the data itself is not cloned.
Math.fround() - JavaScript
internally, javascript continues to treat the number as a 64-bit float, it just performs a "round to even" on the 23rd bit of the mantissa, and sets all following mantissa bits to 0.
... polyfill this can be emulated with the following function, if float32array are supported: math.fround = math.fround || (function (array) { return function(x) { return array[0] = x, array[0]; }; })(new float32array(1)); supporting older browsers is slower, but also possible: if (!math.fround) math.fround = function(arg) { arg = number(arg); // return early for ±0 and nan.
Math.log() - JavaScript
if you need a logarithm to other bases, use math.log(x) / math.log(otherbase) as in the example below; you might want to precalculate 1 / math.log(otherbase) .
... examples using math.log() math.log(-1); // nan, out of range math.log(0); // -infinity math.log(1); // 0 math.log(10); // 2.302585092994046 using math.log() with a different base the following function returns the logarithm of y with base x (ie.
Math.min() - JavaScript
the static function math.min() returns the lowest-valued number passed into it, or nan if any parameter isn't a number and can't be converted into one.
... zero or more numbers among which the lowest value will be selected and returned.
Number.MIN_VALUE - JavaScript
values smaller than min_value ("underflow values") are converted to 0.
... examples using min_value the following code divides two numeric values.
Object.create() - JavaScript
note that while the setting of null as [[prototype]] is supported in the real es5 object.create, this polyfill cannot support it due to a limitation inherent in versions of ecmascript lower than 5.
...d doesn't support 'null' as the first argument."); } if (typeof propertiesobject != 'undefined') { throw new error("this browser's implementation of object.create is a shim and doesn't support a second argument."); } function f() {} f.prototype = proto; return new f(); }; } examples classical inheritance with object.create() below is an example of how to use object.create() to achieve classical inheritance.
Object.getOwnPropertyDescriptors() - JavaScript
a property descriptor is a record with some of the following attributes: value the value associated with the property (data descriptors only).
... examples creating a shallow clone whereas the object.assign() method will only copy enumerable and own properties from a source object to a target object, you are able to use this method and object.create() for a shallow copy between two unknown objects: object.create( object.getprototypeof(obj), object.getownpropertydescriptors(obj) ); creating a subclass a typical way of creating a subclass is to define the subcl...
Object.prototype.hasOwnProperty() - JavaScript
o = new object(); o.propone = null; o.hasownproperty('propone'); // returns true o.proptwo = undefined; o.hasownproperty('proptwo'); // returns true examples using hasownproperty to test for a property's existence the following example determines whether the o object contains a property named prop: o = new object(); o.hasownproperty('prop'); // returns false o.prop = 'exists'; o.hasownproperty('prop'); // returns true direct vs.
... inherited properties the following example differentiates between direct properties and properties inherited through the prototype chain: o = new object(); o.prop = 'exists'; o.hasownproperty('prop'); // returns true o.hasownproperty('tostring'); // returns false o.hasownproperty('hasownproperty'); // returns false iterating over the properties of an object the following example shows how to iterate over the properties of an object without executing on inherited properties.
Object.prototype.propertyIsEnumerable() - JavaScript
examples a basic use of propertyisenumerable the following example shows the use of propertyisenumerable on objects and arrays: var o = {}; var a = []; o.prop = 'is enumerable'; a[0] = 'is enumerable'; o.propertyisenumerable('prop'); // returns true a.propertyisenumerable(0); // returns true user-defined vs.
... built-in objects the following example demonstrates the enumerability of user-defined vs.
Object.prototype.toSource() - JavaScript
description the tosource() method returns the following values: for the built-in object object, tosource() returns the following string indicating that the source code is not available: function object() { [native code] } for instances of object, tosource() returns a string representing the source code.
... examples using tosource() the following code defines the dog object type and creates thedog, an object of type dog: function dog(name, breed, color, sex) { this.name = name; this.breed = breed; this.color = color; this.sex = sex; } thedog = new dog('gabby', 'lab', 'chocolate', 'female'); calling the tosource() method of thedog displays the javascript source that defines the object: thedog.tosource(); // returns ({name:"...
Object.prototype.valueOf() - JavaScript
the following code assigns a user-defined function to the object's valueof method: mynumbertype.prototype.valueof = function() { return customprimitivevalue; }; with the preceding code in place, any time an object of type mynumbertype is used in a context where it is to be represented as a primitive value, javascript automatically calls the function defined in the preceding code.
... an object's valueof method is usually invoked by javascript, but you can invoke it yourself as follows: mynumbertype.valueof() note: objects in string contexts convert via the tostring() method, which is different from string objects converting to string primitives using valueof.
Promise.all() - JavaScript
see the example about "asynchronicity or synchronicity of promise.all" below.
...se.reject(555)]); // using settimeout we can execute code after the stack is empty settimeout(function() { console.log(p); console.log(p2); console.log(p3); }); // logs // promise { <state>: "fulfilled", <value>: array[3] } // promise { <state>: "fulfilled", <value>: array[4] } // promise { <state>: "rejected", <reason>: 555 } asynchronicity or synchronicity of promise.all this following example demonstrates the asynchronicity (or synchronicity, if the iterable passed is empty) of promise.all: // we are passing as argument an array of promises that are already resolved, // to trigger promise.all as soon as possible var resolvedpromisesarray = [promise.resolve(33), promise.resolve(44)]; var p = promise.all(resolvedpromisesarray); // immediately logging the value of p console.
Promise.prototype.catch() - JavaScript
note the examples below are throwing instances of error.
...he catch method var p1 = new promise(function(resolve, reject) { resolve('success'); }); p1.then(function(value) { console.log(value); // "success!" throw new error('oh, no!'); }).catch(function(e) { console.error(e.message); // "oh, no!" }).then(function(){ console.log('after a catch the chain is restored'); }, function () { console.log('not fired due to the catch'); }); // the following behaves the same as above p1.then(function(value) { console.log(value); // "success!" return promise.reject('oh, no!'); }).catch(function(e) { console.error(e); // "oh, no!" }).then(function(){ console.log('after a catch the chain is restored'); }, function () { console.log('not fired due to the catch'); }); gotchas when throwing errors // throwing an error will call the catch met...
handler.getPrototypeOf() - JavaScript
} }); parameters the following parameter is passed to the getprototypeof() method.
... description interceptions this trap can intercept these operations: object.getprototypeof() reflect.getprototypeof() __proto__ object.prototype.isprototypeof() instanceof invariants if the following invariants are violated, the proxy will throw a typeerror: getprototypeof() method must return an object or null.
Reflect.construct() - JavaScript
description reflect.construct() allows you to invoke a constructor with a variable number of arguments.
...s the same result as this: let obj2 = object.create(otherclass.prototype) oneclass.apply(obj2, args) console.log(obj1.name) // 'one' console.log(obj2.name) // 'one' console.log(obj1 instanceof oneclass) // false console.log(obj2 instanceof oneclass) // false console.log(obj1 instanceof otherclass) // true console.log(obj2 instanceof otherclass) // true //another example to demonstrate below: function func1(a, b, c, d) { console.log(arguments[3]); } function func2(d, e, f, g) { consol.log(arguments[3]); } let obj1 = reflect.construct(func1, ['i', 'love', 'my', 'india']) obj1 however, while the end result is the same, there is one important difference in the process.
Reflect.deleteProperty() - JavaScript
the static reflect.deleteproperty() method allows to delete properties.
... description the reflect.deleteproperty method allows you to delete a property on an object.
RegExp.prototype.compile() - JavaScript
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).
... examples using compile() the following example shows how to recompile a regular expression with a new pattern and a new flag.
Set - JavaScript
(5) // set [ 1, 5 ] myset.add('some text') // set [ 1, 5, 'some text' ] let o = {a: 1, b: 2} myset.add(o) myset.add({a: 1, b: 2}) // o is referencing a different object, so this is okay myset.has(1) // true myset.has(3) // false, since 3 has not been added to the set myset.has(5) // true myset.has(math.sqrt(25)) // true myset.has('some text'.tolowercase()) // true myset.has(o) // true myset.size // 5 myset.delete(5) // removes 5 from the set myset.has(5) // false, 5 has been removed myset.size // 4, since we just removed one value console.log(myset) // logs set(4) [ 1, "some text", {…}, {…} ] in firefox // logs set(4) { 1, "some text", {…}, {…} } in chrome iterating sets // iterate over items i...
...: 1, "b": 2} for (let item of myset.values()) console.log(item) // logs the items in the order: 1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2} // (key and value are the same here) for (let [key, value] of myset.entries()) console.log(key) // convert set object to an array object, with array.from let myarr = array.from(myset) // [1, "some text", {"a": 1, "b": 2}, {"a": 1, "b": 2}] // the following will also work if run in an html document myset.add(document.body) myset.has(document.queryselector('body')) // true // converting between set and array myset2 = new set([1, 2, 3, 4]) myset2.size // 4 [...myset2] // [1, 2, 3, 4] // intersect can be simulated via let intersection = new set([...set1].filter(x => set2.has(x))) // difference can be simulate...
String.prototype.codePointAt() - JavaScript
polyfill the following extends strings to include the codepointat() function as specified in ecmascript 2015 for browsers without native support.
...fined; } // get the first code unit var first = string.charcodeat(index); var second; if ( // check if it’s the start of a surrogate pair first >= 0xd800 && first <= 0xdbff && // high surrogate size > index + 1 // there is a next code unit ) { second = string.charcodeat(index + 1); if (second >= 0xdc00 && second <= 0xdfff) { // low surrogate // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000; } } return first; }; if (defineproperty) { defineproperty(string.prototype, 'codepointat', { 'value': codepointat, 'configurable': true, 'writable': true }); } else { ...
String.fromCodePoint() - JavaScript
use the code below for a polyfill: if (!string.fromcodepoint) (function(stringfromcharcode) { var fromcodepoint = function(_) { var codeunits = [], codelen = 0, result = ""; for (var index=0, len = arguments.length; index !== len; ++index) { var codepoint = +arguments[index]; // correctly handles all cases including `nan`, `-infinity`, `+infinity` // the surrounding `!(...)`...
...int <= 0xffff) { // bmp code point codelen = codeunits.push(codepoint); } else { // astral code point; split in surrogate halves // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae codepoint -= 0x10000; codelen = codeunits.push( (codepoint >> 10) + 0xd800, // highsurrogate (codepoint % 0x400) + 0xdc00 // lowsurrogate ); } if (codelen >= 0x3fff) { result += stringfromcharcode.apply(null, codeunits); codeunits.length = 0; } } return result + stringfromcharcode.apply(null, codeunits); }; try { // ie 8 only supports `object.defineproperty` on dom elements object.defineproperty(string, "fromcodepoint", { "value": fromc...
String.prototype.search() - JavaScript
(if you only want to know if it exists, use the similar test() method on the regexp prototype, which returns a boolean.) for more information (but slower execution) use match() (similar to the regular expression exec() method).
... examples using search() the following example searches a string with two different regex objects to show a successful search (positive value) vs.
String.prototype.slice() - JavaScript
examples using slice() to create a new string the following example uses slice() to create a new string.
...console.log(str5) // output: "" using slice() with negative indexes the following example uses slice() with negative indexes.
String.prototype.toLocaleUpperCase() - JavaScript
in most cases, this will produce the same result as touppercase(), but for some locales, such as turkish, whose case mappings do not follow the default case mappings in unicode, there may be a different result.
...the following can return false: x.tolocalelowercase() === x.tolocaleuppercase().tolocalelowercase() examples using tolocaleuppercase() 'alphabet'.tolocaleuppercase(); // 'alphabet' 'gesäß'.tolocaleuppercase(); // 'gesÄss' 'i\u0307'.tolocaleuppercase('lt-lt'); // 'i' let locales = ['lt', 'lt', 'lt-lt', 'lt-u-co-phonebk', 'lt-x-lietuva']; 'i\u0307'.tolocaleuppercase(locales); // 'i' specifications specification ecmascript (ecma-262)the definition of 'string.proto...
String.prototype.trim() - JavaScript
polyfill running the following code before any other code will create trim() if it's not natively available.
... if (!string.prototype.trim) { string.prototype.trim = function () { return this.replace(/^[\s\ufeff\xa0]+|[\s\ufeff\xa0]+$/g, ''); }; } examples using trim() the following example displays the lowercase string 'foo': var orig = ' foo '; console.log(orig.trim()); // 'foo' // another example of .trim() removing whitespace from just one side.
TypedArray.prototype.map() - JavaScript
examples mapping a typed array to a typed array of square roots the following code takes a typed array and creates a new typed array containing the square roots of the numbers in the first typed array.
... const numbers = new uint8array([1, 4, 9]); const roots = numbers.map(math.sqrt); // roots is now: uint8array [1, 2, 3], // numbers is still uint8array [1, 4, 9] mapping a typed array of numbers using a function containing an argument the following code shows how map works when a function requiring one argument is used with it.
TypedArray.prototype.slice() - JavaScript
the slice() method returns a shallow copy of a portion of a typed array into a new typed array object.
...it returns a shallow copy of elements from the original typed array.
WebAssembly.Global() constructor - JavaScript
this allows dynamic linking of multiple modules.
... examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor.
WebAssembly.Global - JavaScript
this allows dynamic linking of multiple modules.
... examples creating a new global instance the following example shows a new global instance being created using the webassembly.global() constructor.
WebAssembly.Instance - JavaScript
instance objects contain all the exported webassembly functions that allow calling into webassembly code from javascript.
... instance properties instance.prototype.exports returns an object containing as its members all the functions exported from the webassembly module instance, to allow them to be accessed and used by javascript.
WebAssembly.Memory - JavaScript
the following example creates a new webassembly memory instance with an initial size of 10 pages (640kib), and a maximum size of 100 pages (6.4mib).
... 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.
WebAssembly.Module.customSections() - JavaScript
(read high level structure for information on section structures, and how normal sections ("known sections") and custom sections are distinguished.) this provides developers with a way to include custom data inside wasm modules for other purposes, for example the name custom section, which allows developers to provide names for all the functions and locals in the module (like "symbols" in a native build).
...the wast2wasm command available as part of the wabt tool has a --debug-names option — specify this during conversion to get a .wasm with a names custom section, for example: wast2wasm simple-name-section.was -o simple-name-section.wasm --debug-names examples using customsections the following example (see the custom-section.html source and live example) compiles the loaded simple-name-section.wasm byte code.
WebAssembly.Table.prototype.grow() - JavaScript
examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10.
... var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification.
WebAssembly.Table.prototype.length - JavaScript
syntax table.length; examples using length the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10.
... var table = new webassembly.table({ element: "anyfunc", initial: 2, maximum: 10 }); you can then grow the table by 1 with the following: console.log(table.length); // "2" console.log(table.grow(1)); // "2" console.log(table.length); // "3" specifications specification webassembly javascript interfacethe definition of 'length' in that specification.
WebAssembly.instantiate() - JavaScript
the webassembly.instantiate() function allows you to compile and instantiate webassembly code.
... second overload example the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends it to a worker using postmessage().
WebAssembly - JavaScript
this allows dynamic linking of multiple modules.
... examples stream a .wasm module then compile and instantiate it the following example (see our instantiate-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a resultobject.
parseFloat() - JavaScript
if parsefloat encounters a character other than a plus sign (+), minus sign (- u+002d hyphen-minus), numeral (0–9), decimal point (.), or exponent (e or e), it returns the value up to that character, ignoring the invalid character and characters following it.
... examples parsefloat returning a number the following examples all return 3.14: parsefloat(3.14); parsefloat('3.14'); parsefloat(' 3.14 '); parsefloat('314e-2'); parsefloat('0.0314e+2'); parsefloat('3.14some non-digit characters'); parsefloat({ tostring: function() { return "3.14" } }); parsefloat returning nan the following example returns nan: parsefloat('ff2'); parsefloat and bigint the following examples both return 9007199254740993...
Conditional (ternary) operator - JavaScript
the conditional (ternary) operator is the only javascript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy.
...person.name : `stranger` return `howdy, ${name}` } console.log(greeting({name: `alice`})); // "howdy, alice" console.log(greeting(null)); // "howdy, stranger" conditional chains the ternary operator is right-associative, which means it can be "chained" in the following way, similar to an if … else if … else if … else chain: function example(…) { return condition1 ?
Equality (==) - JavaScript
this can be roughly summarised as follows: if the operands are both objects, return true only if both operands reference the same object.
... if the operands have the same type, they are compared as follows: string: return true only if both operands have the same characters in the same order.
Logical AND assignment (&&=) - JavaScript
syntax expr1 &&= expr2 description short-circuit evaluation the logical and operator is evaluated left to right, it is tested for possible short-circuit evaluation using the following rule: (some falsy expression) && expr is short-circuit evaluated to the falsy expression; short circuit means that the expr part above is not evaluated, hence any side effects of doing so do not take effect (e.g., if expr is a function call, the calling never takes place).
... logical and assignment short-circuits as well meaning that x &&= y is equivalent to: x && (x = y); and not equivalent to the following which would always perform an assignment: x = x && y; examples using logical and assignment let x = 0; let y = 1; x &&= 0; // 0 x &&= 1; // 0 y &&= 1; // 1 y &&= 0; // 0 specifications specification logical assignment operatorsthe definition of 'assignment operators' in that specification.
Logical NOT (!) - JavaScript
examples using not the following code shows examples of the !
...n4 = !!false // !!falsy returns false n5 = !!"" // !!falsy returns false n6 = !!boolean(false) // !!falsy returns false converting between nots the following operation involving booleans: !!bcondition is always equal to: bcondition specifications specification ecmascript (ecma-262)the definition of 'logical not expression' in that specification.
Logical nullish assignment (??=) - JavaScript
syntax expr1 ??= expr2 description short-circuit evaluation the nullish coalescing operator is evaluated left to right, it is tested for possible short-circuit evaluation using the following rule: (some expression that is neither null nor undefined) ??
...(x = y); and not equivalent to the following which would always perform an assignment: x = x ??
await - JavaScript
if the value of the expression following the await operator is not a promise, it's converted to a resolved promise.
... an await can split execution flow, allowing the caller of the await's function to resume execution before the deferred continuation of the await's function.
class expression - JavaScript
class expressions allow you to redefine (re-declare) classes without throwing a syntaxerror.
... 'use strict'; let foo = class {}; // constructor property is optional foo = class {}; // re-declaration is allowed typeof foo; // returns "function" typeof class {}; // returns "function" foo instanceof object; // true foo instanceof function; // true class foo {} // throws syntaxerror (class declarations do not allow re-declaration) examples a simple class expression this is just a simple anonymous class expression which you can refer to using the variable foo.
Function expression - JavaScript
syntax the expression is not allowed at the start of a statement.
... var foo = function() {} foo.name // "foo" var foo2 = foo foo2.name // "foo" var bar = function baz() {} bar.name // "baz" console.log(foo === foo2); // true console.log(typeof baz); // undefined console.log(bar === baz); // false (errors because baz == undefined) examples creating an unnamed function the following example defines an unnamed function and assigns it to x.
instanceof - JavaScript
examples demonstrating that string and date are of type object and exceptional cases the following code uses instanceof to demonstrate that string and date objects are also of type object (they are derived from object).
...}) instanceof object // returns true, same case as above mynonobj instanceof object // returns false, prototype is end of prototype chain (null) mystring instanceof date // returns false mydate instanceof date // returns true mydate instanceof object // returns true mydate instanceof string // returns false demonstrating that mycar is of type car and type object the following code creates an object type car and an instance of that object type, mycar.
class - JavaScript
but unlike a class expression, a class declaration doesn't allow an existing class to be declared again and will throw a syntaxerror if attempted.
... examples a simple class declaration in the following example, we first define a class named polygon, then extend it to create a class named square.
const - JavaScript
examples basic const usage constants can be declared with uppercase or lowercase, but a common convention is to use all-uppercase letters.
...my_object = {'other_key': 'value'}; // however, object keys are not protected, // so the following statement is executed without problem my_object.key = 'othervalue'; // use object.freeze() to make object immutable // the same applies to arrays const my_array = []; // it's possible to push items into the array my_array.push('a'); // ["a"] // however, assigning a new array to the variable throws an error // uncaught typeerror: assignment to constant variable.
do...while - JavaScript
when condition evaluates to false, control passes to the statement following the do...while.
... examples using do...while in the following example, the do...while loop iterates at least once and reiterates until i is no longer less than 5.
for...in - JavaScript
examples using for...in the for...in loop below iterates over all of the object's enumerable, non-symbol properties and logs a string of the property names and their values.
... var obj = {a: 1, b: 2, c: 3}; for (const prop in obj) { console.log(`obj.${prop} = ${obj[prop]}`); } // output: // "obj.a = 1" // "obj.b = 2" // "obj.c = 3" iterating own properties the following function illustrates the use of hasownproperty(): the inherited properties are not displayed.
import.meta - JavaScript
note that this will include query parameters and/or hash (i.e., following the ?
... 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: // index.mjs import './index2.mjs?someurlinfo=5'; // index2.mjs new url(import.meta.url).searchparams.get('someurlinfo'); // 5 note that while node.js will pass on query parameters (or the hash) as in the latter example, as of node 14.1.0, a url with query parameters will err when loading in the form node --experimental-modules index.mjs?someurlinfo=5 (it is treated as a file rather than a url in this context).
while - JavaScript
examples using while the following while loop iterates as long as n is less than three.
...therefore, x and n take on the following values: after the first pass: n = 1 and x = 1 after the second pass: n = 2 and x = 3 after the third pass: n = 3 and x = 6 after completing the third pass, the condition n < 3 is no longer true, so the loop terminates.
Strict mode - JavaScript
both extensions are problematic for "secure" javascript because they allow "secured" code to access "privileged" functions and their (potentially unsecured) arguments.
...internet explorer below version 10!).
JavaScript typed arrays - JavaScript
8×10308 8 64-bit ieee floating point number (16 significant digits e.g., 1.123...15) unrestricted double double bigint64array -263 to 263-1 8 64-bit two's complement signed integer bigint int64_t (signed long long) biguint64array 0 to 264-1 8 64-bit unsigned integer bigint uint64_t (unsigned long long) dataview the dataview is a low-level interface that provides a getter/setter api to read and write arbitrary data to the buffer.
...this can be done using array.from(), or using the following code where array.from() is unsupported.
categories - Web app manifests
note: categories values are lower-cased by the stores and catalogs before processing, so "news" and "news" are treated as the same value.
... developers are encouraged to use lower case in the first place.
Web app manifests
it is a json-formatted file, with one exception: it is allowed to contain "//"-style comments.
... members web manifests can contain the following keys.
<mn> - MathML
WebMathMLElementmn
however, it is also allowed to have arbitrary text in it which is actually a numeric quantity, for example "eleven".
...the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; example fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-serif-bold-italic ; example monospace ; example initial ; ...
<msub> - MathML
WebMathMLElementmsub
it uses the following syntax: <msub> base subscript </msub>.
... subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a length value.
<msubsup> - MathML
it uses the following syntax: <msubsup> base subscript superscript </msubsup>.
... subscriptshift the minimum space by which to shift the subscript below the baseline of the expression, as a length value.
Mapping the width and height attributes of media container elements to their aspect-ratio - Web media technologies
to keep images from breaking out of their containers when the container becomes narrower than the image, developers started using css like the following: img { max-width: 100%; height: auto; } this is really useful for responsive layouts, but unfortunately it causes the jank problem to return — the above css overrides the width and height attribute information, meaning that if the image has not loaded for some reason, its height will be set to 0.
...this appears in the browser's internal ua stylesheet, similar to the following: img, input[type="image"], video, embed, iframe, marquee, object, table { aspect-ratio: attr(width) / attr(height); } this actually affects any element that acts as a container for complex or mixed visual media — <embed>, <iframe>, <marquee>, <object>, <table>, and <video>, in addition to actual images (<img> and <input type="image">).
Installing and uninstalling web apps - Progressive web apps (PWAs)
web application installation is a feature available in modern browsers that allows users to choose to easily and conveniently “install” a web application on their device so they can access it in the same way they would any other installed app.
... 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.
SVG Conditional Processing Attributes - SVG: Scalable Vector Graphics
value: false|true; animatable: no requiredextensions list all the browser specific capabilities that must be supported by the borwser to be allowed to render the associated element.
... value: a list of space-separated uri; animatable: no requiredfeatures deprecated since svg 2 list all the features, as defined is the svg 1.1 specification, that must be supported by the borwser to be allowed to render the associated element..
SVG Event Attributes - SVG: Scalable Vector Graphics
WebSVGAttributeEvents
event attributes always have their name starting with "on" followed by the name of the event for which they are intended.
... for every event type that the browser supports, svg supports that as an event attribute, following the same requirements as for html event attributes.
additive - SVG: Scalable Vector Graphics
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value replace | sum default value replace animatable no sum specifies that the animation will add to the underlying value of the attribute and other lower priority animations.
... replace specifies that the animation will override the underlying value of the attribute and other lower priority animations.
alignment-baseline - SVG: Scalable Vector Graphics
for example, this allows alphabetic baselines in roman text to stay aligned across font size changes.
... 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.
clip - SVG: Scalable Vector Graphics
WebSVGAttributeclip
as a presentation attribute, it can be applied to any element but it has effect only on the following six elements: <svg>, <symbol>, <image>, <foreignobject>, <pattern>, <marker> html,body,svg { height:100% } <svg viewbox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- auto clipping --> <svg x="0" width="10" height="10" clip="auto"> <circle cx="5" cy="5" r="4" stroke="green" /> </svg> <!-- rect(top, right, bottom, left) clipping --> <svg x="10" width="10" height...
... value auto | rect() default value auto animatable yes the value auto defines a clipping path along the bounds of the viewport created by the given element.the value rect() defines a clipping rectangle following the following syntax: rect(<top>, <right>, <bottom>, <left>).
dominant-baseline - SVG: Scalable Vector Graphics
that font baseline-table is chosen using the following priority order of baseline-table names: ideographic, alphabetic, hanging, mathematical.
...that font baseline-table is chosen using the following priority order of baseline-table names: alphabetic, ideographic, hanging, mathematical.
enable-background - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <a>, <defs>, <glyph>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <switch>, and <symbol> context notes value accumulate | new [ <x> <y> <width> <height> ]?
... the optional <x>, <y>, <width>, and <height> parameters are <number> values that indicate the subregion of the container elementʼs user space where access to the background image is allowed to happen.
fill-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altglyph>, <circle>, <ellipse>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 400 100" xmlns="http://www.w3.org/2000/svg"> <!-- default fill opacity: 1 --> <circle cx="50" cy="50" r="40" /> <!-- fill opacity as a number --> <circle cx="150" cy="50" r="40" fill-opacity="0.7" /> <!-- fill opacity as a percentage --> <circle cx="250" cy="50" r="...
... fill-opacity="50%" /> <!-- fill opacity as a css property --> <circle cx="350" cy="50" r="40" style="fill-opacity: .25;" /> </svg> usage notes value [0-1] | <percentage> default value 1 animatable yes note: svg2 introduces percentage values for fill-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1].
lang - SVG: Scalable Vector Graphics
WebSVGAttributelang
the glyph was meant to be used if the xml:lang attribute exactly matched one of the languages given in the value of this parameter, or if the xml:lang attribute exactly equaled a prefix of one of the languages given in the value of this parameter such that the first tag character following the prefix was "-".
... the most common syntax is a value formed by a lowercase two-character part for the language and an uppercase two-character part for the region or country, separated by a minus sign, e.g.
mask - SVG: Scalable Vector Graphics
WebSVGAttributemask
l,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <mask id="mymask" maskcontentunits="objectboundingbox"> <rect fill="white" x="0" y="0" width="100%" height="100%" /> <polygon fill="black" points="0.5,0.2 0.68,0.74 0.21,0.41 0.79,0.41 0.32,0.74" /> </mask> <!-- punch a hole in a shape of a star inside the red circle, revealing the yellow circle underneath --> <circle cx="50" cy="50" r="20" fill="yellow" /> <circle cx="50" cy="50" r="45" fill="red" mask="url(#mymask)"/> </svg> since svg2, the mask attribute is defined as a css property and is a shorthand for many other properties: mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-size, and mask-composite.
... as a 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.
paint-order - SVG: Scalable Vector Graphics
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.
...ient> <rect width="400" height="200" fill="url(#g)"/> <g fill="crimson" stroke="white" stroke-width="6" stroke-linejoin="round" text-anchor="middle" font-family="sans-serif" font-size="50px" font-weight="bold"> <text x="200" y="75">stroke over</text> <text x="200" y="150" paint-order="stroke" id="stroke-under">stroke under</text> </g> </svg> the example would be rendered as follows: the stroke under effect could be achieved via the following css property: #stroke-under { paint-order: stroke; } specifications specification status comment scalable vector graphics (svg) 2the definition of 'paint-order' in that specification.
r - SVG: Scalable Vector Graphics
WebSVGAttributer
with a value lower or equal to zero the circle won't be drawn at all.
...a value of lower or equal to zero will cause the area to be painted as a single color using the color and opacity of the last gradient <stop>.
stop-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage notes value <opacity-value> default value 1 animatable yes <opacity-value> this value is either a <number> between 0 and 1 or a <percentage> value specifying the opacity of the color gradient stop.
... candidate recommendation refers to the definition in css colors 3, but allows percentage values.
stroke-dashoffset - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following twelve elements: <altglyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-3 0 33 10" xmlns="http://www.w3.org/2000/svg"> <!-- no dash array --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- no dash offset --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="3 1" /> <!-- the start of the dash array computation is pulle...
...> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="-3" /> <!-- the start of the dash array computation is pulled by 1 user units which ends up in the same rendering as the previous example --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="1" /> <!-- the following red lines highlight the offset of the dash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage notes value <percentage> | <length> default value 0 animatable yes the offset is usually expressed in user units resolved against the pathlength but if a <percentage> is used, the value is resolve...
stroke-miterlimit - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element 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 38 30" xmlns="http://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 ...
... 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 ,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" /> <!-- the following pink lines highlight the position of the path for each stroke --> <path stroke="pink" fill="none" stroke-width="0.05" 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 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 m1,29 l7,-3 l7,3 m2,0 l3.5,-3 l3.5,3 m2,0 l2,-3 l2,3 ...
stroke-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following twelve elements: <altglyph>, <circle>, <ellipse>, <path>, <line>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="0 0 40 10" xmlns="http://www.w3.org/2000/svg"> <!-- default stroke opacity: 1 --> <circle cx="5" cy="5" r="4" stroke="green" /> <!-- stroke opacity as a number --> <circle cx="15" cy="5" r="4" stroke="green" stroke-opacity="0.7" /> <!-- stroke op...
...city="50%" /> <!-- stroke opacity as a css property --> <circle cx="35" cy="5" r="4" stroke="green" style="stroke-opacity: .3;" /> </svg> usage notes value [0-1] | <percentage> default value 1 animatable yes note: svg2 introduces percentage values for stroke-opacity, however, it is not widely supported yet (see browser compatibility below) as a consequence, it is best practices to set opacity with a value in the range [0-1].
systemLanguage - SVG: Scalable Vector Graphics
the attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by a "-") of one of the language tags given in the value of this parameter.
... the prefix rule simply allows the use of prefix tags if this is the case.
type - SVG: Scalable Vector Graphics
WebSVGAttributetype
the other keywords represent convenience shortcuts to allow commonly used color operations to be performed without specifying a complete matrix.
...ories none value fractalnoise | turbulence animatable yes normative document svg 1.1 (2nd edition) for the <style> and <script> elements categories none value <content-type> animatable no normative document svg 1.1 (2nd edition) : script svg 1.1 (2nd edition) : style example elements the following elements can use the values attribute <animatetransform> <fecolormatrix> <fefunca> <fefuncb> <fefuncg> <fefuncr> <feturbulence> <script> <style> ...
visibility - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following nineteen elements: <a>, <altglyph>, <audio>, <canvas>, <circle>, <ellipse>, <foreignobject>, <iframe>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, <tspan>, <video> html, body, svg { height: 100%; } <svg viewbox="0 0 220 120" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="200" height="100" stroke="black" stroke-width="5" fil...
... example the following example toggles the css visibility of the svg image path.
widths - SVG: Scalable Vector Graphics
WebSVGAttributewidths
the widths attribute indicates a list of range values, each followed by one or more glyph widths.
... only one element is using this attribute: <font-face> usage notes value <number> default value none animatable no <number> this value is a comma-separated list of ucs range values as defined in iso 10646, each followed by one or more glyph widths.
x-height - SVG: Scalable Vector Graphics
the x-height attribute indicates the height of lowercase glyphs in the font within 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 height of lowercase glyphs.
xml:lang - SVG: Scalable Vector Graphics
it is a universal attribute allowed in all xml dialects to mark up the natural human language that an element contains.
... the most common syntax is a value formed by a lowercase two-character part for the language and an uppercase two-character part for the region or country, separated by a minus sign, e.g.
<animateTransform> - SVG: Scalable Vector Graphics
the animatetransform element animates a transformation attribute on its target element, thereby allowing animations to control translation, scaling, rotation, and/or skewing.
... usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements example <svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <polygon points="60,30 90,90 30,90"> <animatetransform attributename="transform" attributetype="xml" type="rotate" from="0 60 70" to="360 60 70" dur="10s" repeatcount="indefinite"/> </polygon> </svg> live sample attributes global attributes conditional processing attributes » core attributes » animation event attributes » xlink attributes » animation attribute target attribut...
<color-profile> - SVG: Scalable Vector Graphics
the <color-profile> element allows describing the color profile used for the image.
... usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » specific attributes local name rendering-intent xlink:href dom interface this element implements the svgcolorprofileelement interface.
<discard> - SVG: Scalable Vector Graphics
WebSVGElementdiscard
the <discard> svg element allows authors to specify the time at which particular elements are to be discarded, thereby reducing the resources required by an svg user agent.
... usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<script> attributes global attributes conditional processing attributes core attributes aria attributes specific attributes begin href (but note that <discard> has never supported xlink:href) specifications specification status comment svg animations level 2the definition of '<discard>' in that specification.
<ellipse> - SVG: Scalable Vector Graphics
WebSVGElementellipse
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<ellipse>' in that specification.
<feColorMatrix> - SVG: Scalable Vector Graphics
| r' | | r1 r2 r3 r4 r5 | | r | | g' | | g1 g2 g3 g4 g5 | | g | | b' | = | b1 b2 b3 b4 b5 | * | b | | a' | | a1 a2 a3 a4 a5 | | a | | 1 | | 0 0 0 0 1 | | 1 | in simplified terms, below is how each color channel in the new pixel is calculated.
... usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in type values dom interface this element implements the svgfecolormatrixelement interface.
<feComponentTransfer> - SVG: Scalable Vector Graphics
it allows operations like brightness adjustment, contrast adjustment, color balance or thresholding.
... usage context categoriesfilter primitive elementpermitted contentany number of the 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.
<feConvolveMatrix> - SVG: Scalable Vector Graphics
to illustrate, suppose you have a input image which is 5 pixels by 5 pixels, whose color values for one of the color channels are as follows: 0 20 40 235 235 100 120 140 235 235 200 220 240 235 235 225 225 255 255 255 225 225 255 255 255 and you define a 3-by-3 convolution kernel as follows: 1 2 3 4 5 6 7 8 9 let's focus on the color value at the second row and second column of the image (source pixel value is 120).
...case (where the input image's pixel grid aligns perfectly with the kernel's pixel grid) and assuming default values for attributes ‘divisor’, ‘targetx’ and ‘targety’, then resulting color value will be: (9* 0 + 8* 20 + 7* 40 + 6*100 + 5*120 + 4*140 + 3*200 + 2*220 + 1*240) / (9+8+7+6+5+4+3+2+1) usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in order kernelmatrix divisor bias targetx targety edgemode kernelunitlength preservealpha dom interface this element implements the svgfeconvolvematrixelement interface.
<feMerge> - SVG: Scalable Vector Graphics
WebSVGElementfeMerge
the <femerge> svg element allows filter effects to be applied concurrently instead of sequentially.
... usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<femergenode> example svg <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <filter id="feoffset" x="-40" y="-20" width="100" height="200"> <feoffset in="sourcegraphic" dx="60" dy="60" /> <fegaussianblur stddeviation="5" result="blur2" /> <femerge> <femergenode in="blur2" /> <femergenode in="sourcegraphic" /> </femerge> </filter> <rect x="40" y="40" width="100" height="100" style="stroke: #000000; fill: green; filter: url(#feoffset);" /> </svg> result attributes global attributes ...
<feOffset> - SVG: Scalable Vector Graphics
WebSVGElementfeOffset
the <feoffset> svg filter primitive allows to offset the input image.
... usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dx dy dom interface this element implements the svgfeoffsetelement interface.
<fePointLight> - SVG: Scalable Vector Graphics
the <fepointlight> filter primitive defines a light source which allows to create a point light effect.
... usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes specific attributes x y z dom interface this element implements the svgfepointlightelement interface.
<feSpotLight> - SVG: Scalable Vector Graphics
the <fespotlight> svg filter primitive defines a light source which allows to create a spotlight effect.
... usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes specific attributes x y z pointsatx pointsaty pointsatz specularexponent limitingconeangle dom interface this element implements the svgfespotlightelement interface.
<feTile> - SVG: Scalable Vector Graphics
WebSVGElementfeTile
the <fetile> svg filter primitive allows to fill a target rectangle with a repeated, tiled pattern of an input image.
... usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in dom interface this element implements the svgfetileelement interface.
<feTurbulence> - SVG: Scalable Vector Graphics
it allows the synthesis of artificial textures like clouds or marble.
... usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes basefrequency numoctaves seed stitchtiles type dom interface this element implements the svgfeturbulenceelement interface.
<foreignObject> - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <style> div { color: white; font: 18px serif; height: 100%; overflow: auto; } </style> <polygon points="5,5 195,10 185,185 10,195" /> <!-- common use case: embed html text into svg --> <foreignobject x="20" y="20" width="160" height="160"> <!-- in the context of svg embedded in an html document, the xhtml namespace could be omitted, but it is mandatory in the context of an svg document --> <div xmlns="http://www.w3.org/1999/xhtml"> lorem ipsum dolor sit amet, consectetur adipiscin...
...fset, 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-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, ari...
<g> - SVG: Scalable Vector Graphics
WebSVGElementg
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role 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>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<g>' in that specification.
<image> - SVG: Scalable Vector Graphics
WebSVGElementimage
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 specific attributes x: positions the image horizontally from the origin.
... candidate recommendation allows omitting height and width scalable vector graphics (svg) 1.1 (second edition)the definition of '<image>' in that specification.
<line> - SVG: Scalable Vector Graphics
WebSVGElementline
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<line>' in that specification.
<marker> - SVG: Scalable Vector Graphics
WebSVGElementmarker
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role 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>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment svg markersthe definition of '<marker>' in that specification.
<mpath> - SVG: Scalable Vector Graphics
WebSVGElementmpath
usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes core attributes » xlink attributes » externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgmpathelement interface.
...--> <path d="m-25,-12.5 l25,-12.5 l 0,-87.5 z" fill="yellow" stroke="red" stroke-width="7.06" > <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="auto" > <mpath xlink:href="#path1"/> </animatemotion> </path> </svg> result specifications specification status comment svg animations level 2the definition of '<mpath>' in that specification.
<path> - SVG: Scalable Vector Graphics
WebSVGElementpath
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment svg pathsthe definition of '<path>' in that specification.
<polygon> - SVG: Scalable Vector Graphics
WebSVGElementpolygon
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polygon>' in that specification.
<polyline> - SVG: Scalable Vector Graphics
WebSVGElementpolyline
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<polyline>' in that specification.
<rect> - SVG: Scalable Vector Graphics
WebSVGElementrect
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements specifications specification status comment scalable vector graphics (svg) 2the definition of '<rect>' in that specification.
<script> - SVG: Scalable Vector Graphics
WebSVGElementscript
the svg script element allows to add scripts to an svg document.
... while svg's script element is equivalent to the html <script> element, it has some discrepancies, like it uses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility below for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.round(math.random() * 255).tostring(16).padstart(2,'0') const g = math.round(math.random() * 255).tostring(16).padstart(2,'0') const b = math.round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventlistener('click', (e) => { e.target.styl...
<set> - SVG: Scalable Vector Graphics
WebSVGElementset
the additive and accumulate attributes are not allowed, and will be ignored if specified.
...eatcount, repeatdur, fill other animation attributes most notably: attributename 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 categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements specifications specification status comment svg animations level 2the definition of '<set>' in that specification.
<svg> - SVG: Scalable Vector Graphics
WebSVGElementsvg
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role 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>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphics (svg) 2the definition of '<svg>' in that specification.
<text> - SVG: Scalable Vector Graphics
WebSVGElementtext
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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role usage notes categoriesgraphics element, text content elementpermitted contentcharacter data and any number of the following elements, in any order:animation elementsdescriptive elementstext content elements<a> specifications specification status comment scalable vector graphics (svg) 2the definition of '<text>' in that specification.
<textPath> - SVG: Scalable Vector Graphics
WebSVGElementtextPath
fset, 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-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, ari...
...a-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role xlink attributes xlink:title usage notes categoriestext content element, text content child elementpermitted contentcharacter data and any number of the following elements, in any order:descriptive elements<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan> specifications specification status comment scalable vector graphics (svg) 2the definition of '<textpath>' in that specification.
Specification Deviations - SVG: Scalable Vector Graphics
nevertheless, to allow mozilla to more cleanly share internal 'class' and 'style' related code, we will implement these attributes on all svg elements as of firefox 3.
...extending the 'class' attribute to apply to all svg elements will allow svg authors to use the selectors api to select any svg element based on class.
Fills and Strokes - SVG: Scalable Vector Graphics
note: in firefox 3+, rgba values are also allowed, and will give the same effect.
...can all be set this way, in addition to the gradient and pattern versions of those shown below.
Gradients in SVG - SVG: Scalable Vector Graphics
<stop offset="100%" stop-color="yellow" stop-opacity="0.5"/> to use a gradient, we have to reference it from an object's fill or stroke attributes.
...setting these three attributes will allow you to move the gradient around and change its size, as shown in the second rect above.
Patterns - SVG: Scalable Vector Graphics
WebSVGTutorialPatterns
the reason they've been used here is described below.
...all three of the preceding examples are shown below on a rectangle that has been slightly elongated to a height of 300px, but i should note that it's not an exhaustive picture, and there are other options available depending on your application.
Referer header: privacy and security concerns - Web security
the referrer problem the referer (sic) header contains the address of the previous web page from which a link to the currently requested page was followed, which has lots of fairly innocent uses including analytics, logging, or optimized caching.
...if the link was followed, depending on how information was shared the social media site may receive the reset password url and may still be able to use the shared information, potentially compromising a user's security.
Securing your site - Web security
note: this article is a work in progress, and is neither complete nor does following its suggestions guarantee your site will be fully secure.
... the x-frame-options response header the x-frame-options: http response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame>.
Types of attacks - Web security
(click-jacking is sometimes called "user interface redressing", though this is a misuse of the term "redress".) cross-site request forgery (csrf) cross-site scripting (xss) cross-site scripting (xss) is a security exploit which allows an attacker to inject into a website malicious client-side code.
...this could allow an attacker to bypass csrf protection or hijack a session after the user logs in.
Tutorials
these resources are created by forward-thinking companies and web developers who have embraced open standards and best practices for web development and that provide or allow translations, through an open content license such as creative commons.
... quick guide to implement web fonts (with @font-face) the @font-face feature from css3 allows you to use custom typefaces on the web in an accessible, manipulatable, and scalable way.
current - XPath
the following two are symantically equivalent.
...thus within all of the following three expressions the current function (not the entire expressions) returns the same node.
Index - XPath
WebXPathIndex
9 following axe, xpath the following axis indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes.
... 10 following-sibling axe, xpath the following-sibling axis indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
the following is an alphabetized and annotated list of the elements, axes, and functions from the w3c's 1.0 recommendation for xslt, as well as from the appropriate sections of the xpath recommendation.
...ing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) format-number() (supported) function-availa...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
xslt allows a stylesheet author to transform a primary xml document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format (and in the case of firefox, the focus is on converting it on the fly into html which can then be displayed by the browser).
...processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) format-number() (supported) function-available() (suppo...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
some things work if you use lower case node-names in patterns and expressions, and treat the nodes as if they are in the null namespace, however this is not very well tested so it might not work in all situations.
... resources the following reflect the interface of the xsltprocessor object: nsixsltprocessor.idl xsltprocessor.webidl using xsltprocessor from xpcom components instantiating an xsltprocessor from an xpcom component requires a different syntax as the constructor is not defined inside components.
XSLT: Extensible Stylesheet Language Transformations
WebXSLT
transforming xml with xslt xslt allows a stylesheet author to transform a primary xml document in two significant ways: manipulating and sorting the content, including a wholesale reordering of it if so desired, and transforming the content into a different format.
... specifying parameters using processing instructions firefox allows stylesheet parameters to be specified when using the <?xml-stylesheet?> processing instruction.
Compiling an Existing C Module to WebAssembly - WebAssembly
a core use-case for webassembly is to take the existing ecosystem of c libraries and allow developers to use them on the web.
...you just need to add -s allow_memory_growth=1 to your compilation command.
Builder - Archive of obsolete content
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.
Testing the Add-on SDK - Archive of obsolete content
with gulp installed, and after installing the addon-sdk's npm dependencies, we can run the latter three test suites mentioned for cfx with jpm using the following commands: gulp test:examples --filter <addon_example_folder_name> gulp test:addons --filter <addon_folder_name> gulp test:modules --filter <file_name>:<test_name> or run all of the tests with gulp test.
Two Types of Scripts - Archive of obsolete content
api access for add-on code and content scripts the table below summarizes the apis that are available to each type of script.
clipboard - Archive of obsolete content
the following types are supported: text (plain text) html (a string of html) image (a base-64 encoded png) if no data type is provided, then the module will detect it for you.
hotkeys - Archive of obsolete content
the following commonly used hotkey combinations will not pass amo review: accel-z, accel-c, accel-x, accel-v or accel-q if you choose to use a key combination that's already defined, choose one which makes sense for the operation it will perform.
indexed-db - Archive of obsolete content
me(); var request = store.put({ "name": name, "time": time }); request.onerror = database.onerror; }; function getitems(callback) { var cb = callback; var db = database.db; var trans = db.transaction(["items"], "readwrite"); var store = trans.objectstore("items"); var items = new array(); trans.oncomplete = function() { cb(items); } var keyrange = idbkeyrange.lowerbound(0); var cursorrequest = store.opencursor(keyrange); cursorrequest.onsuccess = function(e) { var result = e.target.result; if(!!result == false) return; items.push(result.value.name); result.continue(); }; cursorrequest.onerror = database.onerror; }; function listitems(itemlist) { console.log(itemlist); } open("1"); var add = require("sdk/ui/button/acti...
l10n - Archive of obsolete content
and the following code: var _ = require("sdk/l10n").get; console.log(_("hello_string")); the following output will be logged: info: hello!
request - Archive of obsolete content
the example below shows how to use request to get the most recent tweet from the @mozhacks account: var request = require("sdk/request").request; var latesttweetrequest = request({ url: "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=mozhacks&count=1", oncomplete: function (response) { var tweet = response.json[0]; console.log("user: " + tweet.user.screen_name); console.log("t...
system - Archive of obsolete content
this will be one of the values listed as os_target, converted to lower case.
ui - Archive of obsolete content
this module exports constructors for the following: actionbutton togglebutton frame toolbar sidebar each object has its own reference page, linked above: for all the details please refer to the reference page.
chrome - Archive of obsolete content
the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis.
console/traceback - Archive of obsolete content
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.
dev/panel - Archive of obsolete content
the messages follow the remote debugging protocol.
event/core - Archive of obsolete content
the event/core module allows the creation of apis to broadcast and subscribe to events.
frame/hidden-frame - Archive of obsolete content
the following code creates a hidden frame, loads a web page into it, and then logs its title: var hiddenframes = require("sdk/frame/hidden-frame"); let hiddenframe = hiddenframes.add(hiddenframes.hiddenframe({ onready: function() { this.element.contentwindow.location = "http://www.mozilla.org/"; let self = this; this.element.addeventlistener("domcontentloaded", function() { console.log(...
io/file - Archive of obsolete content
apart from these options, this api always passes the following options: create_file, truncate (see //github.com/realityripple/uxp/blob/master/nsprpub/pr/include/prio.h#550).
lang/type - Archive of obsolete content
let { source } = require('sdk/lang/type'); var obj = { name: undefined, twitter: '@horse_js', tweets: [ { id: 100, text: 'what happens to you if you break the monad laws?' }, { id: 101, text: 'javascript dubstep generator' } ] }; console.log(source(obj)); // prints the below /* { // [object object] // writable configurable enumerable name: undefined, // writable configurable enumerable twitter: "@horse_js", // writable configurable enumerable tweets: [ { // [object object] // writable configurable enumerable id: 100, // writable configurable enumerable text: "what happens to you if you br...
places/history - Archive of obsolete content
// we'd compose the query with the following options let lastweek = date.now - (1000*60*60*24*7); search( // first query looks for all entries before last week with 'ruby' [{ query: "ruby", to: lastweek }, // second query searches all entries after last week with 'javascript' { query: "javascript", from: lastweek }], // we want to order chronologically by visit date { sort: "date" } ).on("end", function (results) { // resu...
remote/parent - Archive of obsolete content
multiprocess firefox restricts the things that code running in child processes is allowed to do.
stylesheet/style - Archive of obsolete content
it accepts the following values: "agent", "user" and "author".
system/child_process - Archive of obsolete content
child.stdin has no write() method (see example below for writing to child process stdin) examples adaption of node's documentation for spawn(): var child_process = require("sdk/system/child_process"); var ls = child_process.spawn('/bin/ls', ['-lh', '/usr']); ls.stdout.on('data', function (data) { console.log('stdout: ' + data); }); ls.stderr.on('data', function (data) { console.log('stderr: ' + data); }); ls.on('close', function (code) ...
system/events - Archive of obsolete content
usage the system/events module provides core (low level) api for working with the application observer service, also known as nsiobserverservice.
system/unload - Archive of obsolete content
it is called with a single argument, one of the following strings describing the reason for unload: "uninstall", "disable", "shutdown", "upgrade", or "downgrade".
util/collection - Archive of obsolete content
for example, the following code...
util/list - Archive of obsolete content
removelistitem(list, item) function removes an item from a list list an ordered collection (also known as a sequence) disallowing duplicate elements.
util/object - Archive of obsolete content
extend(arguments) returns an object that inherits from the first argument and contains all of the properties from all following arguments, with precedence from right to left.
cfx to jpm - Archive of obsolete content
requiring local modules suppose your add-on is structured into separate modules: my-addon lib main.js utils.js when you want to use the "utils" module in "main.js", you should use a path relative to "main.js", and prefix the path with "./" to indicate that it's a relative path: var utils = require("./utils"); however, with cfx you are also allowed to omit the "./": var utils = require("utils"); // this will not work with jpm!
console - Archive of obsolete content
the complete set of logging levels is given in the table below, along with the set of functions that will result in output at each level: level will log calls to: all any console method debug debug(), error(), exception(), info(), log(), time(), timeend(), trace(), warn() info error(), exception(), info(), log(), time(), timeend(), trace(), warn() warn error(), exception(), warn() error ...
jpmignore - Archive of obsolete content
using .jpmignore to allow files everything in your add-on directory will be included in the xpi file you make with jpm xpi.
Add a Context Menu Item - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
Implementing the widget - Archive of obsolete content
main.js now in the lib directory open main.js and add the following code: var widgets = require('sdk/widget'); var data = require('sdk/self').data; var annotatorison = false; function toggleactivation() { annotatorison = !annotatorison; return annotatorison; } exports.main = function() { var widget = widgets.widget({ id: 'toggle-switch', label: 'annotator', contenturl: data.url('widget/pencil-off.png'), contentscriptwhen: 'ready', ...
Storing annotations - Archive of obsolete content
add the following to your add-on's main function: simplestorage.on("overquota", function () { notifications.notify({ title: 'storage space exceeded', text: 'removing recent annotations'}); while (simplestorage.quotausage > 1) simplestorage.storage.annotations.pop(); }); because we use a notification to alert the user, we need to import the notifications module: var notifications = require("sd...
Display a Popup - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
Open a Web Page - Archive of obsolete content
to follow this tutorial you'll need to have learned the basics of jpm.
Using third-party modules (jpm) - Archive of obsolete content
to follow this tutorial you'll need to have installed jpm and learned the basic jpm commands.
Add-on SDK - Archive of obsolete content
low-level apis reference documentation for the low-level sdk apis.
Alerts and Notifications - Archive of obsolete content
basic modal alert alert('hello'); pop-ups the following code presents a non-modal pop-up, which automatically disappears after an appropriate delay.
Cookies - Archive of obsolete content
setting a cookie the following code demonstrates how to set a cookie in firefox.
Customizing the download progress bar - Archive of obsolete content
in your jar.mn file, add the following (replacing "myextension" with the name of your extension's chrome package): % overlay chrome://mozapps/content/downloads/downloads.xul chrome://myextension/content/downloads-overlay.xul in downloads-overlay.xul, reference the new stylesheet: <?xml version="1.0"?> <?xml-stylesheet href="chrome://myextension/skin/myextension.css" type="text/css"?> <overlay id="mydownloadoverlay" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> </overlay> in jar.mn, make sure that there is an asterisk in front of the entry for myextension.css so tha...
Downloading Files - Archive of obsolete content
the following methods of downloading files may not work as expected after firefox 26, and should no longer be used.
Drag & Drop - Archive of obsolete content
if the file types are present in the drag data, the function returns that dropping the data is allowed.
IsDefaultNamespace - Archive of obsolete content
the following is a snippet to get isdefaultnamespace() supported across other browsers.
Label and description - Archive of obsolete content
note: if running in a xulrunner application add the following preferences to your default preferences file: pref("network.protocol-handler.expose.http", false); pref("network.protocol-handler.warn-external.http", false); change or add additional protocols (https or ftp) as needed.
LookupPrefix - Archive of obsolete content
function lookupprefix (node, namespaceuri) { var htmlmode = document.contenttype; // mozilla only // depends on private function _lookupnamespaceprefix() below and on https://developer.mozilla.org/en/code_snippets/lookupnamespaceuri // http://www.w3.org/tr/dom-level-3-core/core.html#node3-lookupnamespaceprefix // http://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#lookupnamespaceprefixalgo // (the above had a few apparent 'bugs' in the pseudo-code which were corrected here) if (node.lookupprefix && htmlmode !== 'text/html') { // shouldn't use...
Page Loading - Archive of obsolete content
page loading on page load how to execute code each time a new page is loaded in browser/mail progress listeners progress listeners allow extensions to be notified of events associated with documents loading in the browser and with tab switching events.
Post data to window - Archive of obsolete content
posting data to the current tab there is a convenience method in global scope (in firefox, chrome://browser/content/browser.js): loaduri(auri, areferrer, apostdata, aallowthirdpartyfixup); posting data to a new window window.opendialog('chrome://browser/content', '_blank', 'all,dialog=no', auri, aflags, areferrer, apostdata); ...
QuerySelector - Archive of obsolete content
// 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.prototype, accessing this.document.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { ...
JavaScript timers - Archive of obsolete content
but there are some javascript native functions (timers) which allow us to delay the execution of arbitrary instructions: settimeout() setinterval() setimmediate() requestanimationframe() the settimeout() function is commonly used if you wish to have your function called once after the specified delay.
xml:base support in old browsers - Archive of obsolete content
these two functions aim to allow some support for xml:base.
XPath - Archive of obsolete content
notes and sample code for xpath and ajax (the following was moved from document.evaluate) obj.evaluate(xpathexpression,contextnode,namespaceresolver,resulttype,result); //obj and contextnode should be the same object, if context is a ajax xml object (example: returnedxml) this should be used as : returnedxml.evaluate(xpathexpression,returnedxml,namespaceresolver,returntype,result); //contextnode should be used in the one in which it was created //add by mooring 2008-11-15 16:00 china var xhr = new ajax('post','demo.xml',parsexml,'xml'); //ajax is a class written by javascript which return responsexml object to parsexml function function parsexml(obj)//obj is the returnxml object now { if(!obj.documentelement) { alert("your browser does't support this script!"); return...
Deploying a Plugin as an Extension - Archive of obsolete content
this allows the plugin to be treated like other firefox extensions; it can be upgraded, disabled, or uninstalled using the firefox user interface.
Extension Packaging - Archive of obsolete content
in the apache http server, this can be done by adding the following directive to the configuration file or .htaccess: addtype application/x-xpinstall .xpi install extension files directly if you know the location of the application (if you are installing an extension as part of the application installer, for example), you can install the extension files directly to <appdir>/extensions/<extensionid>.
Extension Theming Guidelines - Archive of obsolete content
custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content.
Offering a context menu for form controls - Archive of obsolete content
overlay the content the first thing to do is to establish an overlay over the chrome for the window in which you want to allow context menus on form controls.
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
i will assume that you have experience developing with dynamic html, as well as the topics below.
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
so, if we were to use fuel, we can do the following in the init function: init : function() { let firstrunpref = "extensions.xulschoolhello.firstrundone"; if (!application.prefs.getvalue(firstrunpref, false)) { application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here.
Introduction - Archive of obsolete content
it is this very powerful platform that has allowed such a fast growth of the development community surrounding mozilla and firefox.
Observer Notifications - Archive of obsolete content
let's see the following example code on how to send out a notification from non-chrome code.
XUL School Tutorial - Archive of obsolete content
the project is now published here following its sharing licenses.
Signing an XPI - Archive of obsolete content
odesigning\signed> zip -r -d fsb.xpi * -x meta-inf/zigbert.rsa adding: meta-inf/manifest.mf (deflated 37%) adding: meta-inf/zigbert.sf (deflated 40%) adding: chrome/fsb.jar (deflated 74%) adding: chrome.manifest (deflated 69%) adding: install.rdf (deflated 62%) test your certificate to test your certificate, install it into your browser, and attempt to load the signed extension by following these steps: 1.
Add-ons - Archive of obsolete content
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.
DOMSubtreeModified - Archive of obsolete content
example the following code will display the time of last dom change on the title bar of the page.
List of Former Mozilla-Based Applications - Archive of obsolete content
the following is a list of all known applications that at one point used mozilla technologies or that are no longer being actively maintained.
List of Mozilla-Based Applications - Archive of obsolete content
the following is a list of all known active applications that are built using mozilla technologies.
Bypassing Security Restrictions and Signing Code - Archive of obsolete content
early versions of firefox allowed web sites to segregate principals using signed scripts, and request extra permissions for scopes within signed scripts using a function called enableprivelege.
cert_override.txt - Archive of obsolete content
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 certs (whether it's self signed cert or a missing or invalid issuer cert) t : allow errors in the validity time, for example, for expired or not yet valid certs certificate's serial number and the issuer name as a base64 encoded string ...
Monitoring WiFi access points - Archive of obsolete content
this capability was introduced primarily to allow wifi-based location services to be used by geolocation services.
Using XML Data Islands in Mozilla - Archive of obsolete content
internet explorer had an "xml data islands" feature that allows web authors include xml data inline in html documents using the <xml> tag.
Kill the XUL.mfl file for good - Archive of obsolete content
loading these files from the server, and storing them back slows down the network, thus it may actually be faster without than with xul.mfl occasionnally gets corrupted, needing a manual intervention to wipe it out, before mozilla again works correctly.
Locked config settings - Archive of obsolete content
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 ...
Protecting Mozilla's registry.dat file - Archive of obsolete content
in summary, you can use the following series of commands in your logon script (usually stored in /home/samba/netlogon/startup.bat on the server): rem ================================================== rem mozilla rem ================================================== attrib -r -s "%userprofile%\application data\mozilla" >nul 2>nul attrib -r -s "%userprofile%\application data\mozilla\registry.dat" >nul 2>nul mkdir "%userprofile%\a...
Automatically Handle Failed Asserts in Debug Builds - Archive of obsolete content
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,...
BlackConnect - Archive of obsolete content
blackconnect was a blackwood subproject, trying to build a java-to-xpcom bridge to allow interoperability between java and xpcom components.
Chromeless - Archive of obsolete content
the aim is to enable developers to create full blown desktop applications using only web technologies.
Creating a Firefox sidebar extension - Archive of obsolete content
here the package for the sidebar is created, the files included are listed below.
Enabling the behavior - updating the status periodically - Archive of obsolete content
this allows users to get relatively frequent updates about tinderbox without overloading the tinderbox server or slowing down mozilla with requests.
Finding the file to modify - Archive of obsolete content
the dom inspector is a tool bundled with mozilla that allows you to examine the dom of web pages and xul windows.
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
copy the following files into the content sub-subdirectory: tinderstatusoverlay.xul tinderstatus.js tinderstatus.css tb-busted.png tb-nostatus.png tb-success.png tb-testfailed.png these are the files we're going to put into the xpi.
Making it into a static overlay - Archive of obsolete content
thus it allows us to define the exact position of our element relative to the other statusbarpanel elements within statusbar.
Prerequisites - Archive of obsolete content
in order to complete this tutorial you need to have and know how to use the following programs on your computer: an installation of mozilla; zip and unzip utilities; a text editor.
Specifying the appearance - Archive of obsolete content
make your own icons for the four states or use the following icons: no status , success , test failed and busted .
chrome.manifest - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "chrome.manifest": 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 messenger-newsblog my_theme jar:chrome/my_theme.jar!/messenger-newsblog/ skin communicator my_theme jar:chrome/my_theme.jar!/communicator/ skin help my_theme jar:chrome/my_theme.jar!/help/ skin navigator my_theme jar:chrome/my_theme.jar!/navigator/ skin editor my_theme jar:chrome/my_theme.jar!/editor/ ...
install.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "install.rdf": <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>author@oftheme.com</em:id> <em:version>2.0b1</em:version> <!-- seamonkey --> <em:targetapplication> <description> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>2.0b1pre</em:minversion> <em:maxversion>2.0b2pre</em:maxversion> </description> </em:targetapplication> <!-- front end metadata --> <em:name>my_theme</em:name> <em:description>my first theme</em:description> <!-- front end integration hooks (used by ...
contents.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "contents.rdf": <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <!-- list all the skins being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> </rdf:seq> <rdf:description about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:description="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="preview.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:myskin/1.0:packages"> <rdf:li resource=...
toolbarBindings.xml - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "toolbarbindings.xml": <bindings id="toolbarbindings"> <binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar-primary"> <content> <xul:hbox class="toolbar-holder toolbar-primary-holder" flex="1" xbl:inherits="orient=tborient,buttonstyle"> <xul:hbox class="toolbar-button-box" flex="1"> <children/> </xul:hbox> <xul:image class="toolbar-primary-icon" xbl:inherits="buttonstyle"/> </xul:hbox> </content> </binding> </bindings> ...
DTrace - Archive of obsolete content
dtrace is sun microsystem's dynamic tracing framework that allows developers to instrument a program with probes that have little to no effect on performance when not in use and very little when active.
Dehydra Frequently Asked Questions - Archive of obsolete content
initially dehydra was written as an easy way to look for patterns in control flow graphs (cfgs).
Dehydra - Archive of obsolete content
it was also useful to find bugs in source code as it allows for much more error checking than c++ is capable of by itself.
Developing New Mozilla Features - Archive of obsolete content
if so, and if your feature is not of general interest, prepare to be a low priority for a while.
Download Manager preferences - Archive of obsolete content
the following table however, includes preferences which must be included in any product for the download manager to function.
Drag and drop events - Archive of obsolete content
firefox 3 adds two new events that allow you to determine when drag operations begin and end.
Exception logging in JavaScript - Archive of obsolete content
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.
External CVS snapshots in mozilla-central - Archive of obsolete content
the following list of directories (incomplete) contain them.
Fast Graphics Performance With HTML - Archive of obsolete content
use <div style="overflow:scroll><div style="background:white"><p>this is some text</p><p>and some more</p></div></div> instead of <div style="overflow:scroll><p>this is some text</p><p>and some more</p></div> animating 'transform' and 'opacity' properties can be done with the compositor which makes them efficient to animate ...
Downloading Nightly or Trunk Builds - Archive of obsolete content
these are the "tinderbox builds", also known as "hourly builds" though it usually takes more than one hour to make one; they are followed by automatic tests and their main purpose is to check that nothing is horridly wrong with the latest change to the source: what they are doing is to constantly check that the current source can be built into an executable and that that executable passes a certain more-or-less fixed set of tests.
JSS build instructions for OSX 10.6 - Archive of obsolete content
the following build instructions were provided by pavrw.
Syncing custom preferences - Archive of obsolete content
the whitelist is determined as follows: for each services.sync.prefs.sync.<pref> preference that is set to true, firefox sync will sync the <pref> preference.
GRE Registration - Archive of obsolete content
linux on linux, registration information is kept in ini-style files of the following form: [1.7.10] gre_path=/usr/lib/mozilla-1.7.10 feature=value feature2=value2 these ini files can be in any of the following locations: /etc/gre.conf /etc/gre.d/*.conf ~/.gre.conf ~/.gre.d/*.conf mozilla has never officially shipped a linux gre based on the mozilla suite.
Helper Apps (and a bit of Save As) - Archive of obsolete content
bird's eye view flow of control uriloader tries to find a content listener for the mime type in question.
Isp Data - Archive of obsolete content
introduction these files allow for adding to the new account wizard a new option, and help with, among other things, deployment of custom thunderbird.
JavaScript OS.Shared - Archive of obsolete content
tiveone_or_fd (unix only) negativeone_or_nothing (unix only) string (unix only) null_or_string (unix only) handle (windows only) maybe_handle (windows only) dword (windows only) negative_or_dword (windows only) zero_or_dword (windows only) zero_or_nothing (windows only) declareffi() intn_t() uintn_t()instances of os.shared.type convert_from_c() releasewith() attributes global object os.shared.hollowstructure in_ptr out_ptr inout_ptr ...
Content - Archive of obsolete content
execute callbacks when certain pages are opened siteboost allows a jetpack to empower a domain with extended abilities beyond those native to web pages ...
Extenders - Archive of obsolete content
manifest chief mechanism for allowing advanced api use within your jetpack superpowers similar to libraries, superpowers are for adding deeper platform coupling for your jetpack sandboxes safely abstracts library interoperability issues so you don't have to worry about them future api interface method for including not yet finalized functionality in your jetpack ...
Twitter - Archive of obsolete content
the examples below all use this first, simpler style.
Libraries - Archive of obsolete content
the following libraries are available: twitter ...
Enabling Experimental Jetpack Features - Archive of obsolete content
to get a list of mount paths that are available, see the method below.
Enabling - Archive of obsolete content
to get a list of mount paths that are available, see the method below.
Me - Archive of obsolete content
ArchiveMozillaJetpackMetaMe
the namespace currently lives in the future and must be imported before it is used: jetpack.future.import("me"); methods onfirstrun(funcfunction)jetpack.me.onfirstrun() allows jetpacks to be notified after they are successfully installed.
File access - Archive of obsolete content
click on the paper-clip icon below for a demonstration of the file upload dialog.
slideBar - Archive of obsolete content
they allow quick access to a wide range of both temporary and permanent information at the side of your browser window.
slideBar - Archive of obsolete content
they allow quick access to a wide range of both temporary and permanent information at the side of your browser window.
UI - Archive of obsolete content
idebar ui mechanism for displaying jetpack content in a slide-out animated vertical column toolbar including entries and access elements into the toolbar panel a movable, expandable, and custom styled content element to display jetpack content tabs adding events and interacting with browser tabs and their contained documents statusbar low-level functions and basic calls notifications a system for alerting users via provided ui mechanisms selection interacting with user-selected content window mitigates and eases interactions between different browser windows ...
Enabling Experimental Jetpack Features - Archive of obsolete content
ArchiveMozillaJetpackdocsMetaFuture
to get a list of mount paths that are available, see the method below.
Jetpack - Archive of obsolete content
get started visit the getting started tutorial download the add-on sdk (formerly called the jetpack sdk) documentation check out the documentation, including tutorials, examples, guides, and api reference join the jetpack community follow jetpack on the mozilla add-ons blog report a bug check out the open bugs discuss jetpack grab the source code join us in #jetpack on irc.mozilla.org ...
Mac OS X Build Prerequisites/fink - Archive of obsolete content
if you perform a major operating system upgrade on your computer, such as an upgrade from tiger to leopard, you should remove the /sw directory and re-install fink and the packages below.
Makefile.mozextension.2 - Archive of obsolete content
which is why the code shown below is corrupt - so you may wanna click on edit and view source instead !!
Message Summary Database - Archive of obsolete content
this allows us to store watch/ignore information on a thread object, and avoids having to generate threading information whenever a folder is open.
Monitoring downloads - Archive of obsolete content
firefox 3 introduces new api that allows any number of listeners to observe downloads.
Overview of how downloads work - Archive of obsolete content
this document describes both codepaths (see below for the second one).
HostWindow - Archive of obsolete content
the window does have some ui components (as shown in the screenshot below).
PyDOM - Archive of obsolete content
this allows you to use python code (almost) anywhere you can use javascript.
Reading textual data - Archive of obsolete content
for the limited use case of reading lines from a local file, the following code using nsiscriptableunicodeconverter works.
Running Windows Debug Builds Downloaded From Tinderbox - Archive of obsolete content
to run tests of the tests package you can, for example, run the reftests as follows: python reftest/runreftest.py --appname=firefox/firefox.exe --utility-path=bin --extra-profile-file=bin/plugins reftest/tests/layout/reftests/reftest.list ...
open - Archive of obsolete content
examples example: using open in the following example, myfile is a file object: myfile.open("read", "text"); see also ...
File object - Archive of obsolete content
file.writeln() write bytes to the file, followed by a line separator, flushing the buffer if file.hasautoflush.
String Quick Reference - Archive of obsolete content
function declarations what: use abstract classes instead of concrete classes when passing strings across function boundaries why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments.
Supporting per-window private browsing - Archive of obsolete content
the example below creates a channel to load a url, and forces it to be in private mode.
Cmdline tests - Archive of obsolete content
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.
Treehydra Build Instructions - Archive of obsolete content
follow dehydra build instructions.
Treehydra - Archive of obsolete content
treehydra is a gcc plugin that provides a low level javascript binding to gcc's gimple ast representation.
Using addresses of stack variables with NSPR threads on win16 - Archive of obsolete content
the simplest demonstration of the problem is as follows: typedef struct shareddata { prlock *ml; prcondvar *cv; print32 counter; } shareddata; static void forkedthread(void *arg) { shareddata *shared = (shareddata*)arg; while (--shared->counter > 0) pr_waitcondvar(shared->cv, pr_interval_no_timeout); return; } /* forkedthread */ printn main(printn argc, char **argv) { prthread *thread; shareddata shared; ...
Venkman Internals - Archive of obsolete content
jsdiscript is a lower level access to the function than the scriptwrapper.
When To Use ifdefs - Archive of obsolete content
this code is all going to be moved elsewhere (most of it to toolkit/ or suite/), but for the time being most application-specific ifdefs are allowed because we can't help it.
DOM Interfaces - Archive of obsolete content
no return value example the following snippet checks to see if any anonymous child of "element" is itself an element.
XBL 1.0 Reference - Archive of obsolete content
tachment attachment using css attachment using element.style property <constructor> call <destructor> call binding documents dom interfaces the nsidomdocumentxbl interface anonymous content introduction scoping and access using the dom content generation rules for generation attribute forwarding insertion points <children> handling dom changes event flow and targeting flow and targeting across scopes focus and blur events mouseover and mouseout events anonymous content and css selectors and scopes binding stylesheets binding implementations introduction methods properties inheritance of implementations event handlers example - sticky notes updated and adjusted for the current firefox implementation.
XBL - Archive of obsolete content
xbl 2.0 (w3c candidate recommendation) was developed to address problems found in xbl 1.0 and to allow for implementations in a broader range of web browsers.
Mac stub installer - Archive of obsolete content
to do this, in addition to the above steps to set up the mac installer to debug you will need to do the following: create a file named xpcom.xpi with the shared libraries in the structure described under the [xpcom] section in: <http://lxr.mozilla.org/seamonkey/sou...ackages-mac#33> note that if you are using the debug target of the installer binary all shared libraries are expected to have the name format <libname>debug.shlb now set a break point at xpi_init() in the mac installer code and step into ...
InstallTrigger.installChrome - Archive of obsolete content
when a user clicks the link "install the new blue theme" in the example below, xpinstall downloads, registers, and installs the theme contained in newblue.xpi to the user's profile directory.
Examples - Archive of obsolete content
the following samples demonstrate some of the principal installation functions in the xpinstall api: file.macalias file.windowsshortcut [install.]adddirectory [install.]addfile installtrigger.installchrome installtrigger.startsoftwareupdate windows install example ...
copy - Archive of obsolete content
method of file object syntax int copy( filespecobject source, filespecobject dest ) parameters the copy method has the following parameters: source a filespecobject object reprsenting the file to be copied.
dirGetParent - Archive of obsolete content
method of file object syntax filespecobject dirgetparent( filespecobject fileordir ); parameters the dirgetparent method has the following parameters: fileordir a filespecobject representing the pathname of the file or directory whose parent is being requested.
dirRemove - Archive of obsolete content
method of file object syntax int dirremove( filespecobject dirtoremove [, boolean recursive] ); parameters the dirremove method has the following parameters: dirtoremove a filespecobject representing the directory to be removed.
dirRename - Archive of obsolete content
method of file object syntax int dirrename( filespecobject directory, string newname ); parameters the dirrename method has the following parameters: directory a filespecobject representing the directory to be renamed.
execute - Archive of obsolete content
method of file object syntax int execute ( filespecobject executablefile, [string aparameters] ); parameters the execute method has the following parameters: executablefile a filespecobject representing the local file already on disk to be executed.
exists - Archive of obsolete content
method of file object syntax boolean exists( filespecobject target ) parameters the exists method has the following parameters: target a filespecobject representing the file or directory being tested for existence.
isDirectory - Archive of obsolete content
method of file object syntax boolean isdirectory ( filespecobject nativefolderpath ); parameters the isdirectory method has the following parameters: nativefolderpath a filespecobject representing the queried directory.
isFile - Archive of obsolete content
method of file object syntax boolean isfile (filespecobject nativefolderpath); parameters the isfile method has the following parameter: nativefolderpath a filespecobject representing the queried file object.
macAlias - Archive of obsolete content
method of file object syntax int macalias( filespecobject destdir, string filename, filespecobject aliasdir, string aliasname ); parameters the macalias method has the following parameters: destdir a filespecobject that represents the directory into which the program file will be installed.
modDate - Archive of obsolete content
method of file object syntax double moddate ( filespecobject nativefolderpath ); parameters the moddate method has the following parameters: nativefolderpath a filespecobject representing the queried file.
move - Archive of obsolete content
method of file object syntax int move( filespecobject source, filespecobject dest ); parameters the move method has the following parameters: source a filespecobject representing the source file.
remove - Archive of obsolete content
method of file object syntax int remove( filespecobject file ) parameters the remove method has the following parameters: file a filespecobject representing the file to be removed.
rename - Archive of obsolete content
method of file object syntax int rename( filespecobject file, string newname ) parameters the rename method has the following parameters: file a filespecobject representing the file to be renamed.
size - Archive of obsolete content
method of file object syntax int size (string nativefolderpath); parameters the size method has the following parameters: nativefolderpath the full pathname to the file.
windowsGetShortName - Archive of obsolete content
method of file object syntax string windowsgetshortname( object localdirspec ) parameters the windowsregisterserver method has the following parameter: localdirspec a filespecobject representing a directory obtained by getcomponentfolder or getfolder.
windowsRegisterServer - Archive of obsolete content
method of file object syntax int windowsregisterserver( object localdirspec ) parameters the windowsregisterserver method has the following parameters: localdirspec a filespecobject representing a directory obtained by getcomponentfolder or getfolder.
windowsShortcut - Archive of obsolete content
method of file object syntax int windowsshortcut( folderobject atarget, folderobject ashortcutpath, string adescription, folderobject aworkingpath, string aparams, folderobject aicon, number aiconid); parameters the windowsshortcut method has the following parameters: atarget a filespecobject representing the absolute path (including filename) to file that the shortcut will be created for.
init - Archive of obsolete content
method of installversion object syntax init ( int maj, int min, int rev, int bld ); init ( string version ); parameters the init method has the following parameters: maj the major version number.
toString - Archive of obsolete content
method of installversion object syntax string version = installversion.tostring ( initobj ); parameters the tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called.
addDirectory - Archive of obsolete content
public int adddirectory ( string registryname, string version, string xpisourcepath, object localdirspec, string relativelocalpath, boolean forceupdate); public int adddirectory ( string registryname, installversion version, string xpisourcepath, object localdirspec, string relativelocalpath, boolean forceupdate); parameters the adddirectory method has the following parameters: registryname the pathname in the client version registry for the root directory of the files that are to be installed.this parameter can be an absolute pathname (beginning with a /) or a relative pathname, (not beginning with a slash).
addFile - Archive of obsolete content
ativelocalpath, boolean forceupdate); public int addfile ( string xpisourcepath); public int addfile ( string registryname, string xpisourcepath, object localdirspec, string relativelocalpath); public int addfile ( string registryname, string version, string xpisourcepath, object localdirspec, string relativelocalpath); parameters the addfile method has the following parameters: registryname the pathname in the client version registry about the file.
cancelInstall - Archive of obsolete content
example use the following code to abort or to finalize an installation, based on a variable you set earlier in your code: initinstall("royal airways tripplanner","/royalairways/ tripplanner","1.0.0.0"); ...
deleteRegisteredFile - Archive of obsolete content
method of install object syntax int deleteregisteredfile (string registryname); parameters the deleteregisteredfile method has the following parameter: registryname the pathname in the client version registry for the file that is to be deleted.
gestalt - Archive of obsolete content
method of install object syntax int gestalt ( string selector ); parameters the gestalt method takes the following parameters: selector the selector code for the information you want.
getWinProfile - Archive of obsolete content
method of install object syntax winprofile getwinprofile ( object folder, string file); parameters the getwinprofile method has the following parameters: folder an object representing a directory.
initInstall - Archive of obsolete content
ll ( string displayname, string package, installversion version, int flags); int initinstall ( string displayname, string package, string version, int flags); int initinstall ( string displayname, string package, string version); int initinstall ( string displayname, string package, installversion version); parameters the initinstall method has the following parameters: displayname a string that contains the name of the software being installed.
patch - Archive of obsolete content
string xpisourcepath, object localdirspec, string relativelocalpath); int patch ( string registryname, installversion version, string xpisourcepath, object localdirspec, string relativelocalpath); int patch ( string registryname, string version, string xpisourcepath, object localdirspec, string relativelocalpath); parameters the patch method has the following parameters: registryname the pathname in the client version registry for the component that is to be patched.this parameter can be an absolute pathname, such as /royalairways/royalsw/executable or a relative pathname, such as executable.
performInstall - Archive of obsolete content
example use the following code to abort or to finalize an installation, based on a variable you set earlier in your code: initinstall("royal airways tripplanner", "/royalairways/tripplanner", "1.0.0.0"); ...
setPackageFolder - Archive of obsolete content
method of install object syntax void setpackagefolder ( object folder); parameters the setpackagefolder method has the following parameter: folder an object representing a directory.
Methods - Archive of obsolete content
also allows custom button labels and a checkbox.
Install Object - Archive of obsolete content
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.
Return Codes - Archive of obsolete content
return codes the methods described in this chapter can return any of the following return codes.
getString - Archive of obsolete content
method of winprofile object syntax string getstring ( string section, string key); parameters the method has the following parameters: section section in the file, such as "boot" or "drivers".
writeString - Archive of obsolete content
method of winprofile object syntax boolean writestring ( string section, string key, string value); parameters the method has the following parameters: section section in the file, such as "boot" or "drivers".
WinProfile Object - Archive of obsolete content
the two methods of the winprofile object, getstring and writestring, allow you to read and write the data in the key/value pairs of a windows .ini file.
createKey - Archive of obsolete content
method of winreg object syntax int createkey ( string subkey, string classname); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
deleteKey - Archive of obsolete content
method of winreg object syntax int deletekey ( string subkey); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
deleteValue - Archive of obsolete content
method of winreg object syntax int deletevalue ( string subkey, string valname); parameters the deletevalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
getValue - Archive of obsolete content
method of winreg object syntax winregvalue getvalue ( string subkey, string valname); parameters the getvalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
getValueNumber - Archive of obsolete content
method of winreg object syntax number getvaluenumber ( string subkey, string valname); parameters the getvaluestring method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
getValueString - Archive of obsolete content
method of winreg object syntax string getvaluestring ( string subkey, string valname); parameters the getvaluestring method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
isKeyWritable - Archive of obsolete content
method of winreg object syntax boolean iskeywritable( string key); parameters the method has the following parameter: key a string representing the path to the key returns a boolean value: true if the key is writable; false if not.
keyExists - Archive of obsolete content
method of winreg object syntax boolean keyexists ( string key); parameters the method has the following parameter: key a string representing the path to the key returns boolean value description if the user does not have read access to the given key, this will also return false.
setRootKey - Archive of obsolete content
method of winreg object syntax void setrootkey ( int key ); parameters the method has the following parameter: key an integer representing a root key in the registry.
setValue - Archive of obsolete content
method of winreg object syntax string setvalue ( string subkey, string valname, winregvalue value); parameters the setvalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
setValueNumber - Archive of obsolete content
method of winreg object syntax int setvaluenumber ( string subkey, string valname, number value ); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
setValueString - Archive of obsolete content
method of winreg object syntax int setvaluestring ( string subkey, string valname, string value); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail".
valueExists - Archive of obsolete content
method of winreg object syntax boolean valueexists ( string key, string value ); parameters the method has the following parameters: key a string representing the path to the key.
WinRegValue - Archive of obsolete content
syntax winregvalue ( int datatype, byte[] regdata); parameters the winregvalue constructor takes the following parameter: datatype an integer indicating the type of the data encapsulated by this object.
XPJS Components Proposal - Archive of obsolete content
the xpconnectcomponents object allows access to the whole repository of native and js xpcom components, so this is not as isolated an environment as it might at first sound.
XTech 2006 Presentations - Archive of obsolete content
layout algorithm improvements for web user interfaces (slides, slides as one page) - david baron a discussion of problems with existing standards and potential improvements in two areas: layout systems for user interfaces (rather than documents) and mechanisms for reordering content to allow the author to use good markup and appropriate layout.
Flexgroup - Archive of obsolete content
elements with a lower flexgroup are flexed first.
accelerated - Archive of obsolete content
« xul reference homeaccelerated type: booleanset this attribute to true to allow hardware layer managers to accelerate the window.
accesskey - Archive of obsolete content
this allows a label of 'open…' with an accesskey of 'a', to have a generated label of 'open (a)…'.
align - Archive of obsolete content
« xul reference home align type: one of the values below the align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children.
button.type - Archive of obsolete content
« xul reference home type type: one of the values below the type of button.
closemenu - Archive of obsolete content
« xul reference home closemenu type: one of the values below indicates if the menu closes when the menuitem is activated.
coalesceduplicatearcs - Archive of obsolete content
this attribute, if true, which is the default, allows a datasource to negate an earlier assertion.
currentset - Archive of obsolete content
the value of this attribute should be a comma-separated list of item ids from the toolbarpalette or, additionally, any of the following strings: "separator", "spring", "spacer".
datepicker.type - Archive of obsolete content
« xul reference home type type: one of the values below you can set the type attribute to one of the values below to specify the type of datepicker to use normal a datepicker with three fields for entering the year, month and date.
dir - Archive of obsolete content
ArchiveMozillaXULAttributedir
« xul reference home dir type: one of the values below the direction in which the child elements of the element are placed.
disabled - Archive of obsolete content
the disabled attribute is allowed only for form controls.
droppedLinkHandler - Archive of obsolete content
« xul reference home droppedlinkhandler type: function this function is called when links are dropped to the browser element, with the following arguments.
editortype - Archive of obsolete content
« xul reference home editortype type: one of the values below the type of editor to use.
equalsize - Archive of obsolete content
« xul reference home equalsize type: one of the values below this attribute can be used to make the children of the element equal in size.
eventnode - Archive of obsolete content
« xul reference home eventnode type: one of the values below indicates where keyboard navigation events are listened to.
events - Archive of obsolete content
valid events are listed below, or you can use your own events.
flags - Archive of obsolete content
« xul reference home flags type: space-separated list of the values below a set of flags used for miscellaneous purposes.
flex - Archive of obsolete content
ArchiveMozillaXULAttributeflex
elements with larger flex values will be made larger than elements with lower flex values, at the ratio determined by the two elements.
fullscreenbutton - Archive of obsolete content
« xul reference home fullscreenbutton type: boolean set this attribute to true to display a button in the window chrome to allow the user to switch the window into full screen mode.
hidespinbuttons - Archive of obsolete content
« xul reference home hidespinbuttons type: boolean if true, the number box does not have arrow buttons next to it to allow the user to adjust the value.
homepage - Archive of obsolete content
« xul reference home homepage type: url this attribute allows you to set a homepage for the browser element.
id - Archive of obsolete content
ArchiveMozillaXULAttributeid
ton was pressed'); } </script> a more abstract version of the above would be a <button id="foo" label="click me" oncommand="setwidgetlabel(this, 'i was pressed')"/> <script> function setwidgetlabel(idname, newcaption){ document.getelementbyid( idname.id ).setattribute('label',newcaption) } </script> not specifying the id attribute for a window or a prefwindow fills the console with the following warning message: warning: empty string passed to getelementbyid() see also name ...
iframe.transparent - Archive of obsolete content
« xul reference hometransparenttype: one of the values belowset the background of an iframe as transparent.transparentthis results in the iframe's background being transparent.
maxlength - Archive of obsolete content
« xul reference home maxlength type: integer the maximum number of characters that the textbox allows to be entered.
menuitem.type - Archive of obsolete content
« xul reference home type type: one of the values below can be used to create checkable menuitems or for radio button menuitems.
modifiers - Archive of obsolete content
« xul reference home modifiers type: space-separated list of the values below a list of modifier keys that should be pressed to invoke the keyboard shortcut.
multiline - Archive of obsolete content
if false, the textbox only allows entry of one line.
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.
notification.type - Archive of obsolete content
« xul reference home type type: one of the values below indicates the type of notification, determined from the priority.
orient - Archive of obsolete content
« xul reference home orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically.
pack - Archive of obsolete content
ArchiveMozillaXULAttributepack
« xul reference home pack type: one of the values below the pack attribute specifies where child elements of the box are placed when the box is larger that the size of the children.
panel.level - Archive of obsolete content
« xul reference home level type: one of the values below specifies whether the panel appears on top of all windows, or just on top of the window the panel is in.
panel.type - Archive of obsolete content
should be one of the following: autocomplete specify this for a panel that provides a tree for an autocomplete element.
popup.position - Archive of obsolete content
this allows you to place the popup on one side of a button.
popupanchor - Archive of obsolete content
« xul reference homepopupanchortype: one of the values belowpopupanchor is an optional attribute for specifying where popup content should be anchored on the element.noneno anchortopleftanchor to the top left cornertoprightanchor to the top right cornerbottomleftanchor to the bottom left cornerbottomrightanchor to the bottom right cornersyntax<element popupanchor="none | topleft | topright | bottomleft | bottomright" /> example<element id="edit-context" popup="editor-popup" popupanchor="topleft" popupalign="bottomright" /> notesthe popupanchor attribute can be used to specify that the popup content should come up anchored to one of the four corners of the content object (e.g., the button popping up the content).
preference.type - Archive of obsolete content
« xul reference home type type: one of the values below the preference type which should be one of the following values.
primary - Archive of obsolete content
the attribute also controls whether the column picker allows the user to deselect this column.
progressmeter.mode - Archive of obsolete content
« xul reference home mode type: one of the values below a determinedprogressmeter is used in cases where you know how long an operation will take.
query.type - Archive of obsolete content
« xul reference home type type: one of the values below the type of the parameter's value integer 32 bit integer int64 64 bit integer double double-precision floating-point number string string literal, the default value ...
rel - Archive of obsolete content
ArchiveMozillaXULAttributerel
« xul reference home rel type: one of the values below the type of comparison to perform.
resizebefore - Archive of obsolete content
« xul reference home resizebefore type: one of the values below this attribute indicates which element to the left or above the splitter should be resized when the splitter is repositioned.
resizer.dir - Archive of obsolete content
« xul reference home dir type: one of the values below the direction that the window is resized.
searchSessions - Archive of obsolete content
the following values are possible, although custom components may be installed which add others.
separator.orient - Archive of obsolete content
« xul reference home orient type: one of the values below used to specify whether the separator is a horizontal or vertical separator.
sizetopopup - Archive of obsolete content
« xul reference home sizetopopup type: one of the values below indicates how the menu width and the menupopup width are determined.
sortDirection - Archive of obsolete content
« xul reference home sortdirection type: one of the values below set this attribute to set the direction that template-generated content is sorted.
state - Archive of obsolete content
« xul reference home state type: one of the values below indicates whether the splitter has collapsed content or not.
substate - Archive of obsolete content
« xul reference home substate type: one of the values below on splitters which have state="collapsed" and collapse="both", determines which direction the splitter is actually collapsed in.
textbox.autoFill - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.disableAutocomplete - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.forceComplete - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.ignoreBlurWhileSearching - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.minResultsForPopup - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.showCommentColumn - Archive of obsolete content
as of gecko 1.9.1, this attribute is now always specified in lower case.
textbox.tabScrolling - Archive of obsolete content
if false, the default, the tab key moves the focus to the next element.as of gecko 1.9.1, this attribute is now always specified in lower case.
toolbar.mode - Archive of obsolete content
« xul reference home mode not in seamonkey 1.x type: one of the values below how the toolbarbuttons on the toolbar are displayed.
treecell.editable - Archive of obsolete content
« xul reference home editable type: boolean allows the contents of individual cells in the column to be changed, especially useful when <treecol type="checkbox">.
treecell.mode - Archive of obsolete content
« xul reference home mode type: one of the values below for columns that are progress meters, this determines the type of progress meter to use.
treecol.editable - Archive of obsolete content
« xul reference home editable type: boolean allows the contents of cells in the column to be changed, especially useful when type="checkbox".
treecol.type - Archive of obsolete content
« xul reference home type type: one of the values below the type of tree column.
treecol.width - Archive of obsolete content
specifying widths for your columns causes gecko to allow the tree to be scrolled horizontally if it is wider than the available space.
userAction - Archive of obsolete content
« xul reference home useraction type: one of the values below this attribute will be set to the action the user is currently performing.
value - Archive of obsolete content
« xul reference home value type: string the string attribute allows you to associate a data value with an element.
Attribute (XUL) - Archive of obsolete content
« xul reference home acceltext accessible accesskey activetitlebarcolor afterselected align allowevents allownegativeassertions alternatingbackground alwaysopenpopup attribute autocheck autocompleteenabled autocompletepopup autocompletesearch autocompletesearchparam autofill autofillaftermatch autoscroll beforeselected buttonaccesskeyaccept buttonaccesskeycancel buttonaccesskeydisclosure buttonaccesskeyextra1 buttonaccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabelhelp buttonorient buttonpack buttons checked checkstate clicktoscroll class closebutton closemenu coalesceduplicatearcs collapse collapsed c...
close - Archive of obsolete content
if an event handler is placed on the window element, it can be prevented to close (see example below).
findbar - Archive of obsolete content
properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width browser type: browser element lets you s...
Menus - Archive of obsolete content
for more information about how to use an overlay to modify a menu, see using menus and popups in extensions the following tables list the ids of menus in firefox that are commonly overlaid upon.
How to implement a custom XUL query processor component - Archive of obsolete content
custom query processors are xpcom components, must implement the nsixultemplatequeryprocessor interface and follow some conventions for when registering the component.
advance - Archive of obsolete content
ArchiveMozillaXULMethodadvance
the pageid argument allows you to specify the index of the page to which to jump.
loadTabs - Archive of obsolete content
the properties of params are following: boolean inbackground boolean replace boolean allowthirdpartyfixup tab targettab number newindex object postdatas number usercontextid ...
loadURIWithFlags - Archive of obsolete content
in addition to the flags allowed for the reloadwithflags method, the following flags are also valid: load_flags_is_refresh: this flag is used when the url is loaded because of a meta tag refresh or redirect.
openSubDialog - Archive of obsolete content
usually this method would be used to allow the user to configure advanced options.
reloadWithFlags - Archive of obsolete content
the flags listed below may be used, which are all constants of the webnavigation property (or the nsiwebnavigation interface).
showPopup - Archive of obsolete content
this is what you might do to show a popup below a button, for example.
ContextMenus - Archive of obsolete content
for example, the following will attach a context menu with the id 'contentareacontextmenu' to a browser element: <browser context="contentareacontextmenu"> indicating the default item on some platforms, one of the items in a context menu is marked as being a default operation.
Special per-platform menu considerations - Archive of obsolete content
for instance, the edit menu always starts with the undo command if such a feature is available in the application, followed by redo, cut, copy, paste, and so forth.
builderView - Archive of obsolete content
the builder provides access to the rdf resources for each row in the tree, and allows sorting the data by column.
canAdvance - Archive of obsolete content
set to false to disallow moving to the next page.
canRewind - Archive of obsolete content
set to false to disallow moving to the previous page.
currentSet - Archive of obsolete content
for spacers, separators, and flexible spacers the following strings are used instead of ids: "spacer", "separator", "spring".
editortype - Archive of obsolete content
« xul reference editortype type: one of the values below the type of editor to use.
is24HourClock - Archive of obsolete content
with a 12-hour clock, an extra field allows the user to pick between am and pm.
maxLength - Archive of obsolete content
« xul reference maxlength type: integer the maximum number of characters that the textbox allows to be entered.
view - Archive of obsolete content
ArchiveMozillaXULPropertyview
functions available in the view allow one to retrieve the data within the cells, and determine which rows are nested within others.
Property - Archive of obsolete content
« xul reference accessible accessibletype accesskey align allnotifications allowevents alwaysopenpopup amindicator applocale autocheck autofill autofillaftermatch boxobject browsers builder builderview buttons canadvance cangoback cangoforward canrewind checked checkstate child children classname clickselectsall clientheight clientwidth collapsed color columns command commandmanager completedefaultindex container contentdocument contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi custo...
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.
Sorting and filtering a custom tree view - Archive of obsolete content
for strings, lowercases them function prepareforcomparison(o) { if (typeof o == "string") { return o.tolowercase(); } return o; } function gettopvisiblerow() { return tree.treeboxobject.getfirstvisiblerow(); } function settopvisiblerow(topvisiblerow) { return tree.treeboxobject.scrolltorow(topvisiblerow); } function inputfilter(event) { //do this now rather than doing it at every comparison var value...
statusbarpanel-menu-iconic - Archive of obsolete content
« xul reference home statusbarpanel-menu-iconic use this class to have an image appear on the statusbarpanel, and also allow a popup menu.
Additional Template Attributes - Archive of obsolete content
this allows you to share the same template among two different parts of the user interface.
Building Hierarchical Trees - Archive of obsolete content
as shown in the snippet of the data below, the street is a seq, so it will become a container.
Introduction - Archive of obsolete content
the template syntax allows for different rules to generate different content based on particular criteria as well as set attribute values from returned results.
Namespaces - Archive of obsolete content
for example using the following xml document containing a list of people: <people xmlns="www.example.com/people"> <person name="napoleon bonaparte" gender="male"/> <person name="cleopatra" gender="female"/> <person name="julius caesar" gender="male"/> <person name="ferdinand magellan" gender="male"/> <person name="laura secord" gender="female"/> </people> <listbox datasources="people.xml" ref="*" querytype="xml"> <template xmlns:ns="www.example.com/people"> <query expr="ns:person"/> <action> <listitem uri="?" label="?ns:name"/> </action> </template> </listbox> once added to the template element the namespaces can then be referenced inside temple...
SQLite Templates - Archive of obsolete content
this allows information from the database to be used to generate xul content.
Static Content - Archive of obsolete content
remember that only the content at the uri attribute or below inside the action are copied for each result.
Using Multiple Queries to Generate More Results - Archive of obsolete content
if we add the following data about people to the neighbourhood datasource: <rdf:description rdf:about="http://www.xulplanet.com/rdf/myneighbourhood"> <r:people> <rdf:seq> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/person/1"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/person/2"/> </rdf:seq> </r:people> </rdf:description> <rdf:description rdf:about="http://ww...
Using Recursive Templates - Archive of obsolete content
the result is output like the following: <groupbox> ...
Template Guide - Archive of obsolete content
it allows to use javascript objects as a data source for xul templates.
Toolbars - Archive of obsolete content
the following articles provide details about implementing and working with toolbars.
Accesskey display rules - Archive of obsolete content
for this issue, we recommend the following format if you use .properties: <command-name>.label=cancel <command-name>.accesskey=c note that apis of nsipromptservice are using the bad way.
More Wizards - Archive of obsolete content
in the following example, the user must enter a secret code into a textbox on the first page of the wizard.
Open and Save Dialogs - Archive of obsolete content
file pickers a file picker is a dialog that allows the user to select a file.
Scroll Bars - Archive of obsolete content
the syntax of a scroll bar is as follows: <scrollbar id="identifier" orient="horizontal" curpos="20" maxpos="100" increment="1" pageincrement="10"/> the attributes are as follows: id the unique identifer of the scroll bar orient this specifies the direction of the scroll bar.
Simple Menu Bars - Archive of obsolete content
the menu features of xul consist of a number of different elements which allow you to create menu bars or popup menus.
Toolbars - Archive of obsolete content
presumably, they would allow the user to save search results and re-open them later.
XBL Inheritance - Archive of obsolete content
for example, the following binding creates a textbox which adds the text 'http://www' to the beginning of its value when the f4 key is pressed.
Using nsIXULAppInfo - Archive of obsolete content
the following sections provide a few examples of using nsixulappinfo from javascript.
Using the standard theme - Archive of obsolete content
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.
XULBrowserWindow - Archive of obsolete content
in order to do so it implements the following interfaces: nsisupports nsixulbrowserwindow nsiwebprogresslistener nsiwebprogresslistener2 nsisupportsweakreference note: this page is not complete at this time.
Accessibility/XUL Accessibility Reference - Archive of obsolete content
using context="popupid" allows access via shift+f10 on windows and linux.
XUL and RDF - Archive of obsolete content
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.
content - Archive of obsolete content
propiedades tag, uri ejemplos (no son necesarios) atributos 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, sortd...
menubar - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
param - Archive of obsolete content
ArchiveMozillaXULparam
type type: one of the values below the type of the parameter's value integer 32 bit integer int64 64 bit integer double double-precision floating-point number string string literal, the default value properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , ...
rule - Archive of obsolete content
ArchiveMozillaXULrule
properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
stringbundleset - Archive of obsolete content
examples (example needed) attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties inherited properties align, , allowev...
tabbox - Archive of obsolete content
ther tab"/> <tab label="last tab"/> </tabs> <tabpanels> <tabpanel><!-- tabpanel first elements go here --></tabpanel> <tabpanel><!-- tabpanel second elements go here --></tabpanel> <tabpanel><button label="click me"/></tabpanel> <tabpanel><!-- tabpanel fourth elements go here --></tabpanel> </tabpanels> </tabbox> attributes eventnode type: one of the values below indicates where keyboard navigation events are listened to.
tabpanels - Archive of obsolete content
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, sortd...
tabs - Archive of obsolete content
ArchiveMozillaXULtabs
the disabled attribute is allowed only for form controls.
toolbox - Archive of obsolete content
<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, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortd...
treeitem - Archive of obsolete content
properties inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited methods addeventlist...
wizardpage - Archive of obsolete content
inherited properties align, , allowevents, , boxobject, builder, , , , classname, , , , , collapsed, contextmenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxheight, maxwidth, menu, minheight, minwidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statustext, style, ,, tooltip, tooltiptext, top, width methods inherited ...
Custom app bundles for Mac OS X - Archive of obsolete content
a xul application for mac os x should follow something similar to this basic directory structure: example.app/ contents/ info.plist (application bundle properties are specified in this xml file.) pkginfo (this is a simple text file and is created along with the info.plist file) macos/ (the macos folder will contain your xulrunner executable) xulrunner (this is the xulrunner stub) ...
Dialogs in XULRunner - Archive of obsolete content
newer releases will allow using preferences to switch to a xul emulation filepicker, if you want to.
XULRunner FAQ - Archive of obsolete content
it is not meant to be a full-featured runtime; this allows xulrunner to maintain a smaller footprint and simpler deployment strategy than generic full-featured runtimes.
XULRunner Hall of Fame - Archive of obsolete content
slimerjs slimerjs is a xulrunner application that can be launched with firefox, allowing to execute an external javascript script which can manipulate web content.
How to enable locale switching in a XULRunner application - Archive of obsolete content
code to update the locale user preference and restart the application mozilla xulrunner doesn't allow runtime switching of the locale, therefore the application must be restarted to activate the new choice.
MacFAQ - Archive of obsolete content
taking advantage of the core code "openurl" from "nscommandlineservicemac.cpp", you'll see that it looks for "browser.chromeurl" before defaulting to navigator.xul, and this is called when an xulrunner app is already running, so: create a default preference of "browser.chromeurl" that points to your new "hiddenwindow" as such: "chrome://myxul/content/hiddenwindow.xul" next take the code below and drop it in, to create the hiddenwindow.xul (note: the debug function and nsicommandline try/catch can be removed, all you need is the window.arguments[0]) <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="myxul_hidden" windowtype="myxul:hiddenwindow" title="" width="0" height="0" persist="screenx screeny width hei...
Make your xulrunner app match the system locale - Archive of obsolete content
the following is python code to set this preference.
Opening a Link in the Default Browser - Archive of obsolete content
to suppress this warning for particular protocols that are safe to open in the default application, you must set default prefs (thunderbird sets the following prefs): // suppress external-load warning for standard browser schemes pref("network.protocol-handler.warn-external.http", false); pref("network.protocol-handler.warn-external.https", false); pref("network.protocol-handler.warn-external.ftp", false); you can also check whether an external handler for a scheme exists.
Specifying Startup Chrome Window - Archive of obsolete content
it's directory structure is as follows: xulmine ├───chrome ├───components └───defaults └───preferences in defaults/preferences, there is a file named xulmine.js.
Using Crash Reporting in a XULRunner Application - Archive of obsolete content
to enable crash reporting on the client, set the following items in application.ini: [crash reporter] enabled=true serverurl=https://your.server.url/submit note: because crash reports can contain private data including passwords, in production environments they should only be sent via https.
XUL Application Packaging - Archive of obsolete content
application.ini the application.ini manifest is located at the root of the extension and provides metadata that allows xulrunner to launch the application properly.
toolkit.defaultChromeFeatures - Archive of obsolete content
type: string specified by: default prefs of xulrunner applications default: "chrome,dialog=no,all" example: pref("toolkit.defaultchromefeatures", "chrome,resizable=no,dialog=no"); the toolkit.defaultchromefeatures preference allows simple xulrunner-based applications to specify what features are passed to window.open() when the main application window is opened.
toolkit.defaultChromeURI - Archive of obsolete content
type: string specified by: default prefs of xulrunner applications default: none example: pref("toolkit.defaultchromeuri", "chrome://myapp/content/"); the toolkit.defaultchromeuri preference allows simple xulrunner-based applications to open a new window when the application is launched.
XULRunner - Archive of obsolete content
xulrunner also provides libxul, a solution which allows the embedding of mozilla technologies in other projects and products.
xbDesignMode.js - Archive of obsolete content
erg <doron@netscape.com> (original author) * * * * ***** end license block ***** */ /* xbdesignmode a javascript wrapper for browsers that support designmode */ function xbdesignmode(aiframe){ this.meditordocument = null; this.miframeelement = null; // argument is a string, therefore an id if ( (typeof(aiframe) == "string") && (document.getelementbyid(aiframe).tagname.tolowercase()=="iframe") ){ this.miframeelement = document.getelementbyid(aiframe); } else if( (typeof(aiframe)=="object") && (aiframe.tagname.tolowercase() == "iframe") ){ this.miframeelement = aiframe; } else { throw "argument isn't an id of an iframe or an iframe reference"; } if (this.miframeelement.contentdocument){ // gecko this.meditordocument = this.miframeelement.c...
Mozilla.dev.apps.firefox-2006-10-06 - Archive of obsolete content
discussions firefox trunk and rc1 slowdown using tabs discussion regarding certain theme components (specifically alpha-transparency) creating a high cpu load on os/2.
2006-10-06 - Archive of obsolete content
discussions firefox trunk and rc1 slowdown using tabs discussion regarding certain theme components (specifically alpha-transparency) creating a high cpu load on os/2.
2006-10-26 - Archive of obsolete content
(what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
2006-10-27 - Archive of obsolete content
(what it is, how to use it) cross-post-and followup fx2 announcment to support-firefox request for when the announcement about firefox 2's release to be posted on the mozilla.dev.apps.firefox newsgroup.
2006-11-10 - Archive of obsolete content
followed by a discussion whether this is an improvement.
2006-11-24 - Archive of obsolete content
discussions microsummary w/ script a user created patch that will allow script to run in a sandbox during the update of a microsummary.
2006-12-01 - Archive of obsolete content
how do allow an internal web site to have universalbrowserwrite?
2006-11-03 - Archive of obsolete content
bug found in nslocalmailfolder.cpp david bienvenu is following up on this bug.
2006-11-17 - Archive of obsolete content
summary: mozilla.dev.platform - november 11th - november 17th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
2006-18-24 - Archive of obsolete content
summary: mozilla.dev.platform - november 18th - november 24th, 2006 announcements no announcements this week traffic xulrunner: <browser> not allowing javascript popup windows b notes that when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box and asks what needs to be implement.
2006-10-20 - Archive of obsolete content
joes noticed that mp3 files are no longer allowed to be opened directly from email attachments in trunk builds of thunderbird and seamonkey.
2006-10-27 - Archive of obsolete content
multiple presshells discussion on why current interfaces allow for multiple presshells and how the relationships work for the following objects: docshell, presshell, prescontext, document, domwindow, widget, docshell and contentviewer.
2006-11-10 - Archive of obsolete content
the idea of using a single sheet and the per-site selectors that dbaron implemented would allow for a quick proof of concept.
2006-12-24 - Archive of obsolete content
discussions [reset issue for overflow='hidden' in ie and opera there is a very modest horizontal shift of the document due to reflow associated with the removal of the vertical scroll bar (because the document content is using a horizontal centering style).
2006-12- 02 - Archive of obsolete content
discussions [reset issue for overflow='hidden' in ie and opera there is a very modest horizontal shift of the document due to reflow associated with the removal of the vertical scroll bar (because the document content is using a horizontal centering style).
2006-12- 08 - Archive of obsolete content
david baron is planning to make an additional change to the computesize api onthe reflow branch to resolve a number of float-related bugs (359135,360093), and some others.
Multi-process plugin architecture - Archive of obsolete content
in addition to crash protection, the multi-process plugin architecture allows firefox to see plugins which respond very slowly or have completely stopped responding.
Browser-side plug-in API - Archive of obsolete content
this chapter describes methods in the plug-in api that are provided by the browser; these allow call back to the browser to request information, tell the browser to repaint part of the window, and so forth.
NPAnyCallbackStruct - Archive of obsolete content
syntax typedef struct { int32 type; } npanycallbackstruct; fields the data structure has the following field: type always contains np_print.
NPByteRange - Archive of obsolete content
syntax typedef struct _npbyterange { int32 offset; /* negative offset = from the end */ uint32 length; struct _npbyterange* next; } npbyterange; fields the data structure has the following fields: offset offset in bytes to the start of the requested range.
NPClass - Archive of obsolete content
this call is always followed by a call to the deallocate function, or free().
NPEmbedPrint - Archive of obsolete content
syntax typedef struct _npembedprint { npwindow window; void* platformprint; /* platform-specific */ } npembedprint; fields the data structure has the following fields: window the npwindow the plug-in should use for printing.
NPFullPrint - Archive of obsolete content
syntax typedef struct _npfullprint { npbool pluginprinted; /* true: print fullscreen */ npbool printone; /* true: print one copy */ /* to default printer */ void* platformprint; /* platform-specific */ } npfullprint; fields the data structure has the following fields: pluginprinted determines whether the plug-in prints in full-page mode.
NPN_CreateObject - Archive of obsolete content
syntax #include <npruntime.h> npobject *npn_createobject(npp npp, npclass *aclass); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin wants to instantiate the object.
NPN_DestroyStream - Archive of obsolete content
syntax #include <npapi.h> nperror npn_destroystream(npp instance, npstream* stream, nperror reason); parameters the function has the following parameters: instance pointer to current plug-in instance.
NPN_Enumerate - Archive of obsolete content
syntax #include <npruntime.h> bool npn_enumerate(npp npp, npobject *npobj, npidentifier **identifiers, uint32_t *identifiercount); parameters the function has the following parameters: npp the npp indicating which plugin instance is making the request.
NPN_Evaluate - Archive of obsolete content
syntax #include <npruntime.h> bool npn_evaluate(npp npp, npobject *npobj, npstring *script, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin instance's window to evaluate the script in.
NPN_ForceRedraw - Archive of obsolete content
syntax #include <npapi.h> void npn_forceredraw(npp instance); parameters the function has the following parameters: instance plug-in instance for which the function forces redrawing.
NPN_GetIntIdentifier - Archive of obsolete content
syntax #include <npruntime.h> npidentifier npn_getintidentifier(int32_t intid); parameters the function has the following parameter: <tt>intid</tt> the integer for which an opaque identifier should be returned.
NPN_GetProperty - Archive of obsolete content
syntax #include <npruntime.h> bool npn_getproperty(npp npp, npobject *npobj, npidentifier propertyname, npvariant *result); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request.
NPN_GetStringIdentifier - Archive of obsolete content
syntax #include <npruntime.h> npidentifier npn_getstringidentifier(const nputf8 *name); parameters the function has the following parameters: <tt>name</tt> the string for which an opaque identifier should be returned.
NPN_GetStringIdentifiers - Archive of obsolete content
syntax #include <npruntime.h> void npn_getstringidentifiers(const nputf8 **names, int32_t namecount, npidentifier *identifiers); parameters the function has the following parameters: names an array of strings for which opaque identifiers should be returned.
NPN_HasMethod - Archive of obsolete content
syntax #include <npruntime.h> bool npn_hasmethod(npp npp, npobject *npobj, npidentifier methodname); parameters the function has the following parameters: npp the npp indicating which plugin instance is making the request.
NPN_HasProperty - Archive of obsolete content
syntax #include <npruntime.h> bool npn_hasproperty(npp npp, npobject *npobj, npidentifier propertyname); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance is making the request.
NPN_IdentifierIsString - Archive of obsolete content
syntax #include <npruntime.h> bool npn_identifierisstring(npidentifier identifier); parameters the function has the following parameter: <tt>identifier</tt> the identifier whose type is to be examined.
NPN_IntFromIdentifier - Archive of obsolete content
syntax #include <npruntime.h> int32_t npn_intfromidentifier(npidentifier identifier); parameters the function has the following parameter: <tt>identifier</tt> the integer identifier whose corresponding integer value should be returned.
NPN_InvalidateRect - Archive of obsolete content
syntax #include <npapi.h> void npn_invalidaterect(npp instance, nprect *invalidrect); parameters the function has the following parameters: instance pointer to the plug-in instance to invalidate a portion of.
NPN_InvalidateRegion - Archive of obsolete content
syntax #include <npapi.h> void npn_invalidateregion(npp instance, npregion invalidregion); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPN_Invoke - Archive of obsolete content
syntax #include <npruntime.h> bool npn_invoke(npp npp, npobject *npobj, npidentifier methodname, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the method on the object.
NPN_InvokeDefault - Archive of obsolete content
syntax #include <npruntime.h> bool npn_invokedefault(npp npp, npobject *npobj, const npvariant *args, uint32_t argcount, npvariant *result); parameters the function has the following parameters: npp the npp indicating which plugin wants to call the default method on the object.
NPN_MemFlush - Archive of obsolete content
syntax #include <npapi.h> uint32 npn_memflush(uint32 size); parameters the function has the following parameters: size size of memory, in bytes, to free in the browser's memory space.
NPN_MemFree - Archive of obsolete content
syntax #include <npapi.h> void npn_memfree (void* ptr); parameters the function has the following parameters: ptr block of memory previously allocated using npn_memalloc.
NPN NewStream - Archive of obsolete content
syntax #include <npapi.h> nperror npn_newstream(npp instance, npmimetype type, const char* target, npstream** stream); parameters the function has the following parameters: instance pointer to current plug-in instance.
NPN_PluginThreadAsyncCall - Archive of obsolete content
syntax #include <npapi.h> void npn_pluginthreadasynccall(npp plugin, void (*func)(void *), void *userdata); parameters the function has the following parameters: plugin pointer to the current plug-in instance.
NPN_ReleaseObject - Archive of obsolete content
syntax #include <npruntime.h> void npn_releaseobject(npobject *npobj); parameters the function has the following parameter: <tt>npobj</tt> the npobject whose reference count should be decremented.
NPN_ReleaseVariantValue - Archive of obsolete content
syntax #include <npruntime.h> void npn_releasevariantvalue(npvariant *variant); parameters the function has the following parameters: <tt>variant</tt> the variant whose value is to be released.
NPN_ReloadPlugins - Archive of obsolete content
syntax #include <npapi.h> void npn_reloadplugins(npbool reloadpages);code parameters the function has the following parameter: reloadpages whether to reload pages.
NPN_RemoveProperty - Archive of obsolete content
syntax #include <npruntime.h> bool npn_removeproperty(npp npp, npobject *npobj, npidentifier propertyname); parameters the function has the following parameters: npp the npp indicating which plugin instance is making the request.
NPN_RequestRead - Archive of obsolete content
syntax #include <npapi.h> nperror npn_requestread(npstream* stream, npbyterange* rangelist); parameters the function has the following parameters: stream stream of type np_seek from which to read bytes.
NPN_RetainObject - Archive of obsolete content
syntax #include <npruntime.h> npobject *npn_retainobject(npobject *npobj); parameters the function has the following parameter: npobj the npobject to retain.
NPN_SetException - Archive of obsolete content
syntax #include <npruntime.h> void npn_setexception(npobject *npobj, const nputf8 *message); parameters the function has the following parameters: <tt>npobj</tt> the object on which the exception occurred.
NPN_SetProperty - Archive of obsolete content
syntax #include <npruntime.h> bool npn_setproperty(npp npp, npobject *npobj, npidentifier propertyname, const npvariant *value); parameters the function has the following parameters: <tt>npp</tt> the npp indicating which plugin instance's is making the request.
NPN_Status - Archive of obsolete content
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.
NPN_UTF8FromIdentifier - Archive of obsolete content
syntax #include <npruntime.h> nputf8 *npn_utf8fromidentifier(npidentifier identifier); parameters the function has the following parameter: <tt>identifier</tt> the string identifier whose corresponding string should be returned.
NPN_UserAgent - Archive of obsolete content
syntax #include <npapi.h> const char* npn_useragent(npp instance); parameters the function has the following parameter: instance pointer to the current plug-in instance.
NPN_Version - Archive of obsolete content
syntax #include <npapi.h> void npn_version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); parameters the function has the following parameters: plugin_major pointer to a plug-in's major version number; changes with major code release number.
NPN_Write - Archive of obsolete content
syntax #include <npapi.h> int32 npn_write(npp instance, npstream* stream, int32 len, void* buf); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPObject - Archive of obsolete content
warning: do not manipulate the _class and referencecount fields directly; use the functions below to manipulate the object.
NPP - Archive of obsolete content
syntax typedef struct _npp { void* pdata; /* plug-in private data */ void* ndata; /* mozilla private data */ } npp_t; typedef npp_t* npp; fields the data structure has the following fields: pdata a value, whose definition is up to the plug-in, that the plug-in can use to store a pointer to an internal data structure associated with the instance; this field isn't modified by the browser.
NPP_Destroy - Archive of obsolete content
syntax #include <npapi.h> nperror npp_destroy(npp instance, npsaveddata **save); parameters the function has the following parameters: instance pointer to the plug-in instance to delete.
NPP_DestroyStream - Archive of obsolete content
syntax #include <npapi.h> nperror npp_destroystream(npp instance, npstream* stream, npreason reason); parameters the function has the following parameters: instance pointer to current plug-in instance.
NPP_HandleEvent - Archive of obsolete content
syntax #include <npapi.h> int16 npp_handleevent(npp instance, void* event); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPP_New - Archive of obsolete content
syntax #include <npapi.h> nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char *argn[], char *argv[], npsaveddata *saved); parameters the function has the following parameters: plugintype pointer to the mime type for new plug-in instance.
NPP_Print - Archive of obsolete content
syntax #include <npapi.h> void npp_print(npp instance, npprint* printinfo); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPP_SetValue - Archive of obsolete content
syntax #include <npapi.h> nperror npp_setvalue(void *instance, npnvariable variable, void *value); parameters the function has the following parameters: instance pointer to plugin instance on which to set the variable.
NPP_StreamAsFile - Archive of obsolete content
syntax #include <npapi.h> void npp_streamasfile(npp instance, npstream* stream, const char* fname); parameters the function has the following parameters: instance pointer to current plug-in instance.
NPP_URLNotify - Archive of obsolete content
syntax #include <npapi.h> void npp_urlnotify(npp instance, const char* url, npreason reason, void* notifydata); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPP_Write - Archive of obsolete content
(remark: hence the name "npp_write" is misleading - just think of:"data_arrived") syntax #include <npapi.h> int32 npp_write(npp instance, npstream* stream, int32 offset, int32 len, void* buf); parameters the function has the following parameters: instance pointer to the current plug-in instance.
NPPrint - Archive of obsolete content
syntax typedef struct _npprint { uint16 mode; /* np_full or np_embed */ union { npfullprint fullprint; /* if mode is np_full */ npembedprint embedprint; /* if mode is np_embed */ } print; } npprint; fields the data structure has the following fields: mode determines whether plug-in prints in full-page or embedded mode.
NPPrintCallbackStruct - Archive of obsolete content
syntax typedef struct { int32 type; file* fp; } npprintcallbackstruct; fields the data structure has the following fields: type always contains np_print.
NPRect - Archive of obsolete content
syntax typedef struct _nprect { uint16 top; uint16 left; uint16 bottom; uint16 right; } nprect; fields the data structure has the following fields: top, left, bottom, right the top, left, bottom, and right sides of the rectangle.
NPSavedData - Archive of obsolete content
syntax typedef struct _npsaveddata { int32 len; void* buf; } npsaveddata; fields the data structure has the following fields: len length in bytes of the buffer pointed to by buf; set by the plug-in.
NPSetWindowCallbackStruct - Archive of obsolete content
syntax typedef struct { int32 type; display* display; visual* visual; colormap colormap; unsigned int depth; } npsetwindowcallbackstruct; fields the data structure has the following fields: type always contains np_setwindow.
NPString - Archive of obsolete content
syntax typedef struct _npstring { const nputf8 *utf8characters; uint32_t utf8length; } npstring; fields the data structure has the following fields: utf8characters an array of the utf-8 characters comprising the string.
NPAPI plug-in side API - Archive of obsolete content
this chapter describes methods in the plug-in api that are available from the plug-in object; these allow plug-ins to interact with the browser.
Plugins - Archive of obsolete content
shipping a plugin as a toolkit bundle plugins can be shipped as a toolkit bundle, allowing a user to easily install, uninstall and manage their personal plugins.
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
an example using the most popular element of the rss slash module is shown below: <?xml version="1.0"> <rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" > <channel> <title>example</title> <description>an rss example with slash</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>review ...
Syndicating content with RSS - Archive of obsolete content
the icon looks like the following: you can get more icons like this from feed icons.
Getting Started - Archive of obsolete content
this tutorial follows the mantra thatthe best way to learn is to do .
Element - Archive of obsolete content
ArchiveRSSModuleSlashElement
rss slash module elements note: in the list of elements below the slash xml namespace prefix is used (since it is a popular choice).
Element - Archive of obsolete content
rss well-formed web module elements note: in the list of elements below the wfw xml namespace prefix is used (since it is a popular choice).
Module - Archive of obsolete content
below is a list of the popular rss modules.
0.90 - Archive of obsolete content
ArchiveRSSVersion0.90
specification the original rss 0.90 specification has disappeared from its original location: http://my.netscape.com/publish/help/quickstart.html copies of it have been saved, and can be viewed at the following locations: http://www.purplepages.ie/rss/netscape/rss0.90.html http://web.archive.org/web/*/http://...uickstart.html ...
title - Archive of obsolete content
why can't i get any tang?</description> </item> </channel> </rss> attributes none sub-elements none parent elements the table below shows a list of rss elements that this element can be a child of.
.htaccess ( hypertext access ) - Archive of obsolete content
cache control : .htaccess allows a server to control caching by web browsers, helps load pages faster, and reduces the data transfer.
Security Controls - Archive of obsolete content
there are three types of security controls, as follows: management controls: the security controls that focus on the management of risk and the management of information system security.
Digital Signatures - Archive of obsolete content
a one-way hash is a number of fixed length with the following characteristics: the value of the hash is unique for the hashed data.
Encryption and Decryption - Archive of obsolete content
the sections that follow introduce the use of keys for encryption and decryption.
Threats - Archive of obsolete content
threats against network traffic include the following: eavesdropping.
The Basics of Web Services - Archive of obsolete content
this short guide will allow you to learn more about web services.
contents.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "contents.rdf": <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <!-- list all the skins being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:my_theme"/> </rdf:seq> <rdf:description about="urn:mozilla:skin:my_theme" chrome:displayname="my theme" chrome:accesskey="n" chrome:author="" chrome:authorurl="" chrome:description="" chrome:name="my_theme" chrome:image="preview.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:my_theme:packages"> <rdf:li resource="urn:mozilla:skin:my_...
install.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then save that file as "install.rdf": <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>{themes_uuid}</em:id> <em:version>themes_version</em:version> <!-- target application this extension can install into, with minimum and maximum supported versions.
Making sure your theme works with RTL locales - Archive of obsolete content
instead, you should use the following start/end rules instead to ensure rtl compatibility: -moz-padding-start -moz-padding-end -moz-margin-start -moz-margin-end -moz-border-start -moz-border-start-color -moz-border-start-style -moz-border-start-width -moz-border-end -moz-border-end-color -moz-border-end-style -moz-border-end-width #urlbar-search-splitter { min-width: 8px; -moz-margin-start: -4px; border: none...
Developing cross-browser and cross-platform pages - Archive of obsolete content
opera 6+ allows users to set the browser identification string via a menu internet explorer uses the windows registry safari, konqueror and icab browsers can mask their browser identity under internet explorer or netscape labels a user or browser distributor can put what they want in the navigator.useragent string and this may trick your code into executing a "wrong" block of code.
Using workers in extensions - Archive of obsolete content
this is because only the main thread is allowed to access the user interface.
-moz-window-shadow - Archive of obsolete content
<window>, <panel>inheritednocomputed valueas specifiedanimation typediscrete syntax the -moz-window-shadow property is specified as one of the keyword values listed below.
-ms-content-zoom-limit-max - Archive of obsolete content
initial value400%applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednopercentagesthe largest allowed zoom factor.
-ms-content-zoom-limit-min - Archive of obsolete content
initial value100%applies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednopercentagesthe smallest allowed zoom factor.
-ms-content-zoom-snap - Archive of obsolete content
e-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.
-ms-content-zooming - Archive of obsolete content
remarks this property has no effect unless overflow is permitted on both the x- and y-axes.
-ms-scroll-limit - Archive of obsolete content
: 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.
-ms-scroll-rails - Archive of obsolete content
this value allows for free-form panning.
-ms-scrollbar-3dlight-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-3dlight-color property for a <textarea> element.
-ms-scrollbar-darkshadow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-darkshadow-color property for a <textarea> element.
-ms-scrollbar-face-color - Archive of obsolete content
div { width: 150px; height: 150px; overflow-y: scroll; border-style: solid; border-width: thin; font-family: sans-serif; float: left; margin-right: 10px; } .bluescrollbox { scrollbar-face-color: blue; scrollbar-arrow-color: blue; } .greenscrollbox { scrollbar-face-color: green; scrollbar-arrow-color: green; } <body> <div class="bluescrollbox"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonu...
-ms-scrollbar-highlight-color - Archive of obsolete content
div { width: 150px; height: 150px; border-style: solid; border-width: thin; overflow-y: scroll; font-family: sans-serif; float: left; margin-right: 10px; } .bluescroll { -ms-scrollbar-highlight-color: aqua; -ms-scrollbar-face-color: blue; -ms-scrollbar-arrow-color: blue; border-color: blue; } .redscroll { -ms-scrollbar-highlight-color: bisque; -ms-scrollbar-face-color: red; -ms-scrollbar-arrow-color: red; border-color: red; } <body> <div class="bluescro...
-ms-scrollbar-shadow-color - Archive of obsolete content
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples the following example shows how to create a style rule that sets the -ms-scrollbar-shadow-color property for a <textarea> element.
:-moz-system-metric(windows-default-theme) - Archive of obsolete content
the :-moz-system-metric(windows-default-theme) css pseudo-class matches an element if the user is currently using one of the following themes in windows: luna, royale, zune, or aero (i.e., vista basic, vista standard, or aero glass).
:-moz-system-metric() - Archive of obsolete content
e area of the document.:-moz-system-metric(touch-enabled)the :-moz-system-metric(touch-enabled) css pseudo-class will match an element if the device on which the content is being rendered offers a supported touch-screen interface.:-moz-system-metric(windows-default-theme)the :-moz-system-metric(windows-default-theme) css pseudo-class matches an element if the user is currently using one of the following themes in windows: luna, royale, zune, or aero (i.e., vista basic, vista standard, or aero glass).
::-ms-expand - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-expand in its selector.
::-ms-reveal - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-reveal in its selector.
::-ms-ticks-after - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-ticks-after in its selector.
::-ms-ticks-before - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-ticks-before in its selector.
::-ms-tooltip - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-tooltip in its selector.
::-ms-value - Archive of obsolete content
allowable properties only the following css properties can be used in a rule with ::-ms-value in its selector.
azimuth - Archive of obsolete content
ArchiveWebCSSazimuth
stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage.
display-inside - Archive of obsolete content
syntax one of the keyword values listed below.
display-outside - Archive of obsolete content
syntax one of the keyword values listed below.
Using JavaScript Generators in Firefox - Archive of obsolete content
you can opt in in html as follows: <script type="text/javascript;version=1.7" src="myscript.js"></script> then your myscript.js file might look like this: // need to stash the generator in a global variable.
Array.observe() - Archive of obsolete content
callback the function called each time changes are made, with the following argument: changes an array of objects each representing a change.
Expression closures - Archive of obsolete content
javascript 1.7 and older: function(x) { return x * x; } javascript 1.8: function(x) x * x this syntax allows you to leave off the braces and 'return' statement - making them implicit.
Date.getVarDate() - Archive of obsolete content
requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Debug.msUpdateAsyncCallbackRelation - Archive of obsolete content
not supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards.
Debug.write - Archive of obsolete content
var counter = 42; debug.write("the value of counter is " + counter); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
Enumerator.item - Archive of obsolete content
ady) { var freegb = drv.freespace / bytespergb; var totalgb = drv.totalsize / bytespergb; s += freegb.tofixed(3) + " gb free of "; s += totalgb.tofixed(3) + " gb"; } else { s += "not ready"; } s += "<br />"; e.movenext(); } return(s); } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, and internet explorer 10 standards.
Error.stackTraceLimit - Archive of obsolete content
example the following example shows how to set and then get the stack trace limit.
ScriptEngine() - Archive of obsolete content
example the following example illustrates the use of the scriptengine function: if (window.scriptengine) { console.log(window.scriptengine()); } // output: jscript requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
ScriptEngineBuildVersion - Archive of obsolete content
example the following example illustrates the use of the scriptenginebuildversion function: if(window.scriptenginebuildversion) { console.log(window.scriptenginebuildversion()); } // output: <current build version> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, interne...
ScriptEngineMajorVersion - Archive of obsolete content
example the following example illustrates the use of the scriptenginemajorversion function: if (window.scriptenginemajorversion) { console.log(window.scriptengine()); } output: <current major version> requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10...
@cc_on - Archive of obsolete content
example the following example illustrates the use of the @cc_on statement.
@if - Archive of obsolete content
example the following example illustrates the use of the @if...@elif...@else...@end statement.
New in JavaScript 1.1 - Archive of obsolete content
the following is a changelog for javascript from netscape navigator 2.0 to 3.0.
New in JavaScript 1.2 - Archive of obsolete content
the following is a changelog for javascript from netscape navigator 3.0 to 4.0.
New in JavaScript 1.4 - Archive of obsolete content
the following is a changelog for javascript 1.4, which was only used for netscape's server side javascript released in 1999.
New in JavaScript 1.6 - Archive of obsolete content
the following is a changelog for javascript 1.6.
New in JavaScript 1.8.1 - Archive of obsolete content
the following is a changelog for javascript 1.8.1.
Object.getNotifier() - Archive of obsolete content
the object.getnotifer() method was used to create an object that allows to synthetically trigger a change, but has been deprecated and removed in browsers.
Object.observe() - Archive of obsolete content
callback the function called each time changes are made, with the following argument: changes an array of objects each representing a change.
Object.prototype.unwatch() - Archive of obsolete content
note: the reason for unwatch() to take the property name prop as its only parameter is due to the "single handler allowing" behavior of the watch() method.
String.prototype.quote() - Archive of obsolete content
examples using quote in the table below the quote() method replaces any special characters and wraps the strings in double-quotes.
arguments.caller - Archive of obsolete content
function whocalled() { if (whocalled.caller == null) console.log('i was called from the global scope.'); else console.log(whocalled.caller + ' called me!'); } examples the following code was used to check the value of arguments.caller in a function, but doesn't work anymore.
for each...in - Archive of obsolete content
the following snippet iterates over an object's properties, calculating their sum: var sum = 0; var obj = {prop1: 5, prop2: 13, prop3: 8}; for each (var item in obj) { sum += item; } console.log(sum); // logs "26", which is 5+13+8 specifications not part of any standard.
JavaPackage - Archive of obsolete content
the following code creates the javapackage red: var red = packages.redwood; see also javaarray, javaclass, javaobject, packages ...
MSX Emulator (jsMSX) - Archive of obsolete content
since javascript currently is mostly an interpreted language in web browsers, it is at least an order of magnitude slower than other languages such as c and java.
XForms API Reference - Archive of obsolete content
note the word beginning :-) naming convention the xforms interfaces has the following naming convention: nsixforms...element interfaces implemented by the c++ part of a control nsixformsns...element interfaces extending xforms specification interfaces nsixforms...uielement interfaces implemented by the js part of a control nsixforms...accessors interface exposing states about the bound instance node for a given control frozen interfaces nsixformsmodelelement the model interface experimental interfaces nsixformsdelegate the delegate interface for xforms:custom_controls nsixformsaccessors the accessors interface for xforms:c...
Implementation Status - Archive of obsolete content
5.2.1 additional xforms datatypes to allow empty content unsupported 5.2.2 xforms:listitem supported 5.2.3 xforms:listitems supported 5.2.4 xforms:daytimeduration supported 5.2.5 xforms:yearmonthduration supported 5.2.6 xf...
RFE to the Custom Controls - Archive of obsolete content
this page could be of particular interest to people using custom controls in xul documents for the following reason.
RFE to the XForms API - Archive of obsolete content
ArchiveWebXFormsRFEXForms API
as an example, the nsixformsaccessors interface which allows a user to get/set the value of an instance node and get the state of an instance node, is exposed by the nsixformsdelegate interface using the accessors property.
XForms Styling - Archive of obsolete content
triggers use appearance="minimal" to be able to style buttons portability the mozilla xforms extension is one of the few xforms processors which allow for styling of the xforms elements directly, using mostly standard css.
XForms Message Element - Archive of obsolete content
representations it may be represented in the following ways: modal window - if level attribute value is modal modeless window - if level attribute value is modeless tooltip window - if level attribute value is ephemeral note: message element doesn't define a default presentation.
XForms Submit Element - Archive of obsolete content
representations the xforms submit element can be represented by the following widgets for the specified appearance attribute values: button - default representation (xhtml/xul) link/clickable text - used when appearance = 'minimal' (xhtml only) button displaying a button is the default presentation (xhtml/xul).
XForms Switch Module - Archive of obsolete content
introduction xforms switch module define a switch construct that allows the creation of user interfaces where the user interface can be varied based on user actions and events.
Displaying a graphic with audio samples - Archive of obsolete content
the following example shows how to take samples from an audio stream and display them behind an image (in this case, the mozilla logo), giving the impression that the image is built from the samples.
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
consider the effects of the following rule: a:hover {color: red;} in a document with an unclosed named anchor, any text that follows the anchor's open tag will be colored red (unless another css rule intervenes).
RDF in Fifty Words or Less - Archive of obsolete content
this syntax allows the graph-like model to be communicated between "agents".
Styling Abbreviations and Acronyms - Archive of obsolete content
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 removing it.
Web Standards - Archive of obsolete content
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.
XQuery - Archive of obsolete content
xquseme is a working proof-of-concept (so far tested on windows and linux with java installed; mac does not work) extension which allows one to perform xqueries on external urls, the currently loaded webpage (even if originally from poorly formed html), and/or xml (including well-formed xhtml) documents stored locally.
XUL Parser in Python - Archive of obsolete content
in the explanation section below, i try to say a little something about how this script works.
bootstrap.js - Extensions
the example below contains the required methods in vsdoc format.
Introduction to game development for the Web - Game development
want your players to be able to talk to each other while blowing up monsters?
Publishing games - Game development
game distribution so you've followed a tutorial or two and created an html5 game — that's great!
2D collision detection - Game development
implementing sat is out of scope for this page so see the recommended tutorials below: separating axis theorem (sat) explanation collision detection and response collision detection using the separating axis theorem sat (separating axis theorem) separating axis theorem collision performance while some of these algorithms for collision detection are simple enough to calculate, it can be a waste of cycles to test *every* entity with every other entity.
WebVR — Virtual Reality for the Web - Game development
for example, the below code outputs position information on the screen: function setview() { var posstate = gpositionsensor.getstate(); if(posstate.hasposition) { pospara.textcontent = 'position: x' + roundtotwo(posstate.position.x) + " y" + roundtotwo(posstate.position.y) + " z" + roundtotwo(posstate.position.z); xpos = -posstate.position.x ...
Async scripts for asm.js - Game development
in gecko, async compilation allows the javascript engine to compile the asm.js off the main thread when the game is loading and cache the generated machine code so that the game doesn't need to be compiled on subsequent loads (starting in firefox 28).
Desktop mouse and keyboard controls - Game development
we'll look at this below.
Mobile touch controls - Game development
the events are as follows: touchstart is fired when the user puts a finger on the screen.
Techniques for game development - Game development
efficient animation for web games this article covers techniques and advice for creating efficient animation for web games, with a slant towards supporting lower end devices such as mobile phones.
2D breakout game using Phaser - Game development
frameworks speed up development time and help take care of the boring parts, allowing you to concentrate on the fun stuff.
Tutorials - Game development
this page contains multiple tutorial series that highlight different workflows for effectively creating different types of web games.
Character sets supported by Gecko - Gecko Redirect 1
for other encodings, including gbk, this is the lower-case name from the encoding standard.
Ajax - MDN Web Docs Glossary: Definitions of Web-related terms
ajax allows you to update parts of the dom of an html page instead without the need for a full page refresh.
Accessibility tree (AOM) - MDN Web Docs Glossary: Definitions of Web-related terms
additionally, the accessibility tree often contains information on what can be done with an element: a link can be followed, a text input can be typed into, etc.
Alpha (alpha channel) - MDN Web Docs Glossary: Definitions of Web-related terms
below you see a small box of that color in the top-left corner and a box of the same color but with an alpha channel set at 0.5 (50% opacity).
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
software design asynchronous software design expands upon the concept by building code that allows a program to ask that a task be performed alongside the original task (or tasks), without stopping to wait for the task to complete.
Attribute - MDN Web Docs Glossary: Definitions of Web-related terms
an attribute always has the form name="value" (the attribute's identifier followed by its associated value).
Block (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element).
Block - MDN Web Docs Glossary: Definitions of Web-related terms
underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element).
Boolean - MDN Web Docs Glossary: Definitions of Web-related terms
below is some javascript pseudocode (it's not truly executable code) demonstrating this concept.
Breadcrumb - MDN Web Docs Glossary: Definitions of Web-related terms
a breadcrumb, or breadcrumb trail, is a navigational aid that is typically placed between a site's header and the main content, displaying either a hierarchy of the current page in relation to the the site's structure, from top level to current page, or a list of the links the user followed to get to the current page, in the order visited.
CDN - MDN Web Docs Glossary: Definitions of Web-related terms
using cdn for those library files is preferable for a number of reasons: serving libraries' static assets over cdn lowers the request burden on an organization's own servers.
CMS - MDN Web Docs Glossary: Definitions of Web-related terms
a cms (content management system) is software that allows users to publish, organize, change, or remove various kinds of content, not only text but also embedded images, video, audio, and interactive code.
CORS-safelisted response header - MDN Web Docs Glossary: Definitions of Web-related terms
by default, the safelist includes the following response headers: cache-control content-language content-type expires last-modified pragma examples extending the safelist you can extend the list of cors-safelisted response headers by using the access-control-expose-headers header: access-control-expose-headers: x-custom-header, content-length ...
CRLF - MDN Web Docs Glossary: Definitions of Web-related terms
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.
Selector (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
consider this css: p { color: green; } div.warning { width: 100%; border: 2px solid yellow; color: white; background-color: darkred; padding: 0.8em 0.8em 0.6em; } #customized { font: 16px lucida grande, arial, helvetica, sans-serif; } the selectors here are "p" (which applies the color green to the text inside any <p> element), "div.warning" (which makes any <div> element with the class "warning" look like a warning box), and "#customized", which sets the base font of the element with the id "customized" to 16-pixel tall lucida grande or one of a few fallback fonts.
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
if the stack takes up more space than it had assigned to it, it results in a "stack overflow" error.
Canonical order - MDN Web Docs Glossary: Definitions of Web-related terms
on stack overflow provides useful further discussion.
Cipher - MDN Web Docs Glossary: Definitions of Web-related terms
ciphers operate two ways, either as block ciphers on successive blocks, or buffers, of data, or as stream ciphers on a continuous data flow (often of sound or video).
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
client hints are a set of http request header fields for proactive content negotiation allowing clients to indicate a list of device and agent specific preferences.
Compile - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge compiler on wikipedia the gnu compiler collection (gcc) learning resources base cs introduction on compilers a big list of learning material on stackoverflow ...
Computer Programming - MDN Web Docs Glossary: Definitions of Web-related terms
for example, a program that helps scientists with complex calculations, a database that stores huge amounts of data, a web site that allows people to download music, or animation software that allows people to create animated movies.
Conditional - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge condition on wikipedia control flow on mdn learn about it making decisions in your code — conditionals control flow and error handling in javascript on mdn ...
Continuous Media - MDN Web Docs Glossary: Definitions of Web-related terms
continuous media, therefore, identifies a context where the content is not broken up, it flows continuously.
Cross-site scripting - MDN Web Docs Glossary: Definitions of Web-related terms
cross-site scripting (xss) is a security exploit which allows an attacker to inject into a website malicious client-side code.
DOM (Document Object Model) - MDN Web Docs Glossary: Definitions of Web-related terms
the dom is one of the most-used apis on the web because it allows code running in a browser to access and interact with every node in the document.
DTLS (Datagram Transport Layer Security) - MDN Web Docs Glossary: Definitions of Web-related terms
however, dtls gains the benefits of datagram protocols, too; in particular, the lower overhead and reduced latency.
Deserialization - MDN Web Docs Glossary: Definitions of Web-related terms
the process whereby a lower-level format (e.g.
Doctype - MDN Web Docs Glossary: Definitions of Web-related terms
its sole purpose is to prevent a browser from switching into so-called “quirks mode” when rendering a document; that is, the "<!doctype html>" doctype ensures that the browser makes a best-effort attempt at following the relevant specifications, rather than using a different rendering mode that is incompatible with some specifications.
Domain - MDN Web Docs Glossary: Definitions of Web-related terms
if you like to own a domain you have to register it with one of the many registrars who are allowed to do so with a top-level domain registry.
Empty element - MDN Web Docs Glossary: Definitions of Web-related terms
the empty elements in html are as follows: <area> <base> <br> <col> <embed> <hr> <img> <input> <keygen>(html 5.2 draft removed) <link> <meta> <param> <source> <track> <wbr> ...
Endianness - MDN Web Docs Glossary: Definitions of Web-related terms
little-endian means storing bytes in order of least-to-most-significant (where the least significant byte takes the first or lowest address), comparable to a common european way of writing dates (e.g., 31 december 2050).
Entity header - MDN Web Docs Glossary: Definitions of Web-related terms
a few request headers after a get request: in the following example, content-length is an entity header, while host and user-agent are requests headers: post /myform.html http/1.1 host: developer.mozilla.org user-agent: mozilla/5.0 (macintosh; intel mac os x 10.9; rv:50.0) gecko/20100101 firefox/50.0 content-length: 128 learn more technical knowledge list of all http headers ...
FTP - MDN Web Docs Glossary: Definitions of Web-related terms
increasingly, though, teams and hosting accounts don't allow ftp and instead rely on a version control system like git.
Fallback alignment - MDN Web Docs Glossary: Definitions of Web-related terms
this is specified per alignment method, as detailed below.
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
there are 8 falsy values: false the keyword false 0 the number zero -0 the number negative zero 0n bigint, when used as a boolean, follows the same rule as a number.
Fetch directive - MDN Web Docs Glossary: Definitions of Web-related terms
for instance, script-src allows developers to allow trusted sources of script to execute on a page, while font-src controls the sources of web fonts.
Fetch metadata request header - MDN Web Docs Glossary: Definitions of Web-related terms
the following are fetch metadata request headers: sec-fetch-site sec-fetch-mode sec-fetch-user sec-fetch-dest ...
First input delay - MDN Web Docs Glossary: Definitions of Web-related terms
the time between when content is painted to the page and when all the functionality becomes responsive to human interaction often varies based on the the size and complexity of the javascript needing to be downloaded, parsed, and executed on the main thread, and on the device speed or lack thereof (think low end mobile devices).
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-content align-items align-self flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content order further reading css flexible box layout module level 1 specification css flexbox guide: basic concepts of flexbox css flexbox guide: relationship of flexbox to other layout methods css flexbox guide: aligning items in a flex container css flexbox guide: ordering flex items css flexbox guide: controlling ratios of flex items alo...
Flex Container - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-content align-items flex flex-direction flex-flow flex-wrap justify-content 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 items ...
Flexbox - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-content align-items align-self flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content order further reading css flexible box layout module level 1 specification css flexbox guide: basic concepts of flexbox css flexbox guide: relationship of flexbox to other layout methods css flexbox guide: aligning items in a flex container css flexbox guide: ordering flex items css flexbox guide: controlling ratios of flex items alo...
Forbidden header name - MDN Web Docs Glossary: Definitions of Web-related terms
forbidden header names start with proxy- or sec-, or are one of the following names: accept-charset accept-encoding access-control-request-headers access-control-request-method connection content-length cookie cookie2 date dnt expect feature-policy host keep-alive origin proxy- sec- referer te trailer transfer-encoding upgrade via note: the user-agent header is no longer forbidden, as per spec — see forbidden header name list (this was impl...
Fork - MDN Web Docs Glossary: Definitions of Web-related terms
basically, if the license of the original software allows, you can copy the code to develop your own version of it, with your own additions, which will be a "fork".
Gzip compression - MDN Web Docs Glossary: Definitions of Web-related terms
it is based on the deflate algorithm that allows files to be made smaller in size which allows for faster network transfers.
Gonk - MDN Web Docs Glossary: Definitions of Web-related terms
gonk is the lower-level operating system of firefox os and consists of a linux kernel (based on the android open source project (aosp)) and userspace hardware abstraction layer (hal).
Graceful degradation - MDN Web Docs Glossary: Definitions of Web-related terms
it is a useful technique that allows web developers to focus on developing the best possible websites, given that those websites are accessed by multiple unknown user-agents.
Grid - MDN Web Docs Glossary: Definitions of Web-related terms
in the example below i have created an explicit grid of three columns and two rows.
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
in the example below i have a grid container with two grid items.
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
in the example below we have a three-column and two-row track grid, with 20-pixel gaps between column tracks and 20px-gaps between row tracks.
HTML - MDN Web Docs Glossary: Definitions of Web-related terms
brief history in 1990, as part of his vision of the web, tim berners-lee defined the concept of hypertext, which berners-lee formalized the following year through a markup mainly based on sgml.
High-level programming language - MDN Web Docs Glossary: Definitions of Web-related terms
unlike low-level programming languages, it may use natural language elements, or may automate (or even entirely hide) significant areas of computing systems, making the process of developing simpler and more understandable relative to a lower-level language.
Houdini - MDN Web Docs Glossary: Definitions of Web-related terms
houdini is a set of low level apis that give developers the power to extend css, providing the ability to hook into the styling and layout process of a browser’s rendering engine.
Hypertext - MDN Web Docs Glossary: Definitions of Web-related terms
hypertext is text that contains links to other texts, as opposed to a single linear flow like in a novel.
ICE - MDN Web Docs Glossary: Definitions of Web-related terms
the framework algorithm looks for the lowest-latency path for connecting the two peers, trying these options in order: direct udp connection (in this case—and only this case—a stun server is used to find the network-facing address of a peer) direct tcp connection, via the http port direct tcp connection, via the https port indirect connection via a relay/turn server (if a direct connection fails, e.g., if one peer is behind a f...
IDL - MDN Web Docs Glossary: Definitions of Web-related terms
most of the time, it will follow the rules laid out in the specification, but sometimes it doesn't.
IPv6 - MDN Web Docs Glossary: Definitions of Web-related terms
slowly ipv6 is replacing ipv4, among other reasons because ipv6 allows for many different ip addresses.
Java - MDN Web Docs Glossary: Definitions of Web-related terms
the jvm is available across many platforms, which allows java programs to run almost everywhere without the need to be compiled or packaged again.
JavaScript - MDN Web Docs Glossary: Definitions of Web-related terms
node.js - built using chrome's v8 javascript engine - allows developers to use javascript as a scripting language to automate things on a computer and build fully functional http and web sockets servers.
Localization - MDN Web Docs Glossary: Definitions of Web-related terms
the following are common factors to consider: language unit of measure (e.g., kilometers in europe, miles in u.s.) text direction (e.g., european languages are left-to-right, arabic right-to-left) capitalization in latin script (e.g., english uses capitals for weekdays, spanish uses lowercase) adaptation of idioms (e.g., "raining cats and dogs" makes no sense when translated literally) use of register (e.g., in japanese respectful speech differs exceptionally from casual speech) number format (e.g., 10 000,00 in germany vs.
Long task - MDN Web Docs Glossary: Definitions of Web-related terms
common examples include long running event handlers, expensive reflows and other re-renders, and work the browser does between different turns of the event loop that exceeds 50 ms.
Lossless compression - MDN Web Docs Glossary: Definitions of Web-related terms
lossless compression is a class of data compression algorithms that allows the original data to be perfectly reconstructed from the compressed data.
Main thread - MDN Web Docs Glossary: Definitions of Web-related terms
by default, the browser uses a single thread to run all the javascript in your page, as well as to perform layout, reflows, and garbage collection.
Mutable - MDN Web Docs Glossary: Definitions of Web-related terms
on appending the "immutablestring" with a string value, following events occur: existing value of "immutablestring" is retrieved "world" is appended to the existing value of "immutablestring" the resultant value is then allocated to a new block of memory "immutablestring" object now points to the newly created memory space previously created memory space is now available for garbage collection.
Node.js - MDN Web Docs Glossary: Definitions of Web-related terms
node.js is a cross-platform javascript runtime environment that allows developers to build server-side and network applications with javascript.
OOP - MDN Web Docs Glossary: Definitions of Web-related terms
it follows a prototype-based model (as opposed to class-based).
POP3 - MDN Web Docs Glossary: Definitions of Web-related terms
clients usually retrieve all messages and then delete them from the server, but pop3 does allow retaining a copy on the server.
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
the high priority queue is emptied more quickly than lower priority queues when the network is congested.
Port - MDN Web Docs Glossary: Definitions of Web-related terms
ports are designated by numbers, and below 1024 each port is associated by default with a specific protocol.
Prefetch - MDN Web Docs Glossary: Definitions of Web-related terms
dns prefetching domain lookups can be slow, especially with network latency on mobile phones.
Progressive Enhancement - MDN Web Docs Glossary: Definitions of Web-related terms
progressive enhancement is a useful technique that allows web developers to focus on developing the best possible websites while making those websites work on multiple unknown user agents.
Prototype-based programming - MDN Web Docs Glossary: Definitions of Web-related terms
in simple words: this type of style allows the creation of an object without first defining its class.
Pseudo-class - MDN Web Docs Glossary: Definitions of Web-related terms
for example, the selector a:visited applies styles only to links that the user has already followed.
Public-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
however, they are typically much slower than symmetric algorithms and the size of message they can encrypt is proportional to the size of the key, so they do not scale well for long messages.
Recursion - MDN Web Docs Glossary: Definitions of Web-related terms
examples recursive function calls itself until condition met the following python code defines a function that takes a number, prints it, and then calls itself again with the number's value -1.
Request header - MDN Web Docs Glossary: Definitions of Web-related terms
request headers, like accept, accept-*, or if-* allow to perform conditional requests; others like cookie, user-agent, or referer precise the context so that the server can tailor the answer.
SIMD - MDN Web Docs Glossary: Definitions of Web-related terms
simd allows one same operation to be performed on multiple data points resulting in data level parallelism and thus performance gains — for example, for 3d graphics and video processing, physics simulations or cryptography, and other domains.
SISD - MDN Web Docs Glossary: Definitions of Web-related terms
see also simd for a parallel architecture that allows one same operation to be performed on multiple data points.
SPA (Single-page application) - MDN Web Docs Glossary: Definitions of Web-related terms
this therefore allows users to use websites without loading whole new pages from the server, which can result in performance gains and a more dynamic experience, with some tradeoff disadvantages such as seo, more effort required to maintain state, implement navigation, and do meaningful performance monitoring.
SRI - MDN Web Docs Glossary: Definitions of Web-related terms
it works by allowing you to provide a cryptographic hash that a fetched file must match.
SVG - MDN Web Docs Glossary: Definitions of Web-related terms
html5 now allows direct embedding of svg tags in an html document.
SVN - MDN Web Docs Glossary: Definitions of Web-related terms
it allows developers to keep a history of text and code modifications.
Scope - MDN Web Docs Glossary: Definitions of Web-related terms
for instance, the following is invalid: function examplefunction() { var x = "declared inside function"; // x can only be used in examplefunction console.log("inside function"); console.log(x); } console.log(x); // causes error however, the following code is valid due to the variable being declared outside the function, making it global: var x = "declared outside function"; examplefunction(); function...
Scrollport - MDN Web Docs Glossary: Definitions of Web-related terms
a scroll container is created by applying overflow: scroll to a container, or overflow: auto when there is enough content to cause overflow.
Search engine - MDN Web Docs Glossary: Definitions of Web-related terms
a search engine conducts the following processes: web crawling: searching web sites by navigating hyperlinks on web pages, both within a site, and from one site to another.
Server Timing - MDN Web Docs Glossary: Definitions of Web-related terms
the server timing specification enables the server to communicate performance metrics from the request-response cycle to the user agent, and utilizes a javascript interface to allow applications to collect, process, and act on these metrics to optimize application delivery.
Session Hijacking - MDN Web Docs Glossary: Definitions of Web-related terms
monitor packets flowing between server and user.
Site map - MDN Web Docs Glossary: Definitions of Web-related terms
structured listings of a site's page help with search engine optimization, providing a link for web crawlers such as search engines to follow.
Slug - MDN Web Docs Glossary: Definitions of Web-related terms
in the context of mdn, it is the portion of the url following "<locale>/docs/".
Snap positions - MDN Web Docs Glossary: Definitions of Web-related terms
this allows a scrolling experience that gives the effect of paging through content rather than needing to drag content into view.
Speed index - MDN Web Docs Glossary: Definitions of Web-related terms
expressed in milliseconds, and dependent on the size of the viewport, the lower the score, the better.
State machine - MDN Web Docs Glossary: Definitions of Web-related terms
there are two types of basic state machines: deterministic finite state machine this kind allows only one possible transition for any allowed input.
Static typing - MDN Web Docs Glossary: Definitions of Web-related terms
in most of these languages, types must be expressly indicated by the programmer; in other cases (such as ocaml), type inference allows the programmer to not indicate their variable types.
Stylesheet - MDN Web Docs Glossary: Definitions of Web-related terms
external stylesheets are generally preferred because they allow you to control the styling of multiple pages from a single place, rather than having to repeat the css across each page.
Symbol - MDN Web Docs Glossary: Definitions of Web-related terms
the method symbol.for(tokenstring) returns a symbol value from the registry, and symbol.keyfor(symbolvalue) returns a token string from the registry; each is the other's inverse, so the following is true: symbol.keyfor(symbol.for("tokenstring")) === "tokenstring" // true learn more general knowledge symbol (programming) on wikipedia javascript data types and data structures symbols in ecmascript 6 symbol in the mdn js reference object.getownpropertysymbols() ...
TLD - MDN Web Docs Glossary: Definitions of Web-related terms
iana today distinguishes the following groups of top-level domains: country-code top-level domains (cctld) two-character domains established for countries or territories.
TURN - MDN Web Docs Glossary: Definitions of Web-related terms
turn is used by webrtc to allow any two devices on the internet to enter a peer-to-peer connection.
Tag - MDN Web Docs Glossary: Definitions of Web-related terms
note that the end tag's name is preceded by a slash character, </p>, and that in empty elements, the end tag is neither required nor allowed.
Time to interactive - MDN Web Docs Glossary: Definitions of Web-related terms
time to interactive (tti) is a non-standardized web performance 'progress' metric defined as the point in time when the last long task finished and was followed by 5 seconds of network and main thread inactivity.
VoIP - MDN Web Docs Glossary: Definitions of Web-related terms
voip allows you to make a call directly from a computer, a special voip phone, or a traditional phone connected to a special adapter.
WebDAV - MDN Web Docs Glossary: Definitions of Web-related terms
webdav allows clients to add, delete, and retrieve webpage metadata (e.g.
Web performance - MDN Web Docs Glossary: Definitions of Web-related terms
subjectively, it is the user's perception of whether the time it takes between the time the user requests the content and the time until the user feels the content requested is available and usable feels slow or fast.
Array - MDN Web Docs Glossary: Definitions of Web-related terms
each item in an array has a number attached to it, called a numeric index, that allows you to access it.
Brotli - MDN Web Docs Glossary: Definitions of Web-related terms
brotli provides better compression ratios than gzip and deflate speeds are comparable, but brotli compressing is a slower process than gzip compression, so gzip may be a better option for the compression of non-cachable content.
caret - MDN Web Docs Glossary: Definitions of Web-related terms
on the web, a caret is used to represent the insertion point in <input> and <textarea> elements, as well as any elements whose contenteditable attribute is set, thereby allowing the contents of the element to be edited by the user.
HTTPS - MDN Web Docs Glossary: Definitions of Web-related terms
this secure connection allows clients to safely exchange sensitive data with a server, such as when performing banking activities or online shopping.
jQuery - MDN Web Docs Glossary: Definitions of Web-related terms
$(document).ready(function(){ alert("hello world!"); $("#blackbox").hide(); }); the above code carries out the same function as the following code: window.onload = function() { alert("hello world!"); document.getelementbyid("blackbox").style.display = "none"; }; or: window.addeventlistener("load", () => { alert("hello world!"); document.getelementbyid("blackbox").style.display = "none"; }); learn more general knowledge jquery on wikipedia jquery official website technical information offical api reference docum...
JPEG - MDN Web Docs Glossary: Definitions of Web-related terms
chroma subsampling involves implementing less resolution for chroma information than for luma information, taking advantage of the human visual system's lower acuity for color differences than for luminance.
Percent-encoding - MDN Web Docs Glossary: Definitions of Web-related terms
the encoding consists of substitution: a '%' followed by the hexadecimal representation of the ascii value of the replace character.
Routers - MDN Web Docs Glossary: Definitions of Web-related terms
they are distributed by retailers allowing user interaction to the internet.
Speculative parsing - MDN Web Docs Glossary: Definitions of Web-related terms
this document helps you avoid the kind of things that make speculation fail and slow down the loading of your page.
Test your skills: Media Queries and Responsive Design - Learn web development
you can see the layout you are aiming for in the screenshot below.
What do common web layouts contain? - Learn web development
simple layouts are easier to implement, but allow yourself room to express your creativity in this area.
How does the Internet work? - Learn web development
as we saw, the internet is a technical infrastructure which allows billions of computers to be connected all together.
What is the difference between webpage, website, web server, and search engine? - Learn web development
each web page of a given website provides explicit links—most of the time in the form of clickable portion of text—that allow the user to move from one page of the website to another.
Common questions - Learn web development
html, css and javascript questions for common solutions to html/css/javascript problems, try the following articles: use html to solve common problems use css to solve common problems use javascript to solve common problems ...
Example - Learn web development
a payment form html content <form method="post"> <h1>payment form</h1> <p>required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p> <section> <h2>contact information</h2> <fieldset> <legend>title</legend> <ul> <li> <label for="title_1"> <input type="radio" id="title_1" name="title" value="a"> ace </label> </li> <li> <label for="title_2"> <input type="radio" id="title_2" name="title" value="k" > king </label> </li> <li> <label for="title_3"> <input type="radio" id="title_3" name="title" value="q...
Test your skills: Form structure - Learn web development
note: you can try out the solution in the interactive editor 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.
Test your skills: Styling basics - Learn web development
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.
Example - Learn web development
; 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 { /* this extra magin represent the same space as the space between the labels and their text fields */ margin-left: .5em; ...
Installing basic software - Learn web development
choose your operating system below and click the relevant links to download installers for your favorite browsers: linux: firefox, chrome, opera, brave.
What will your website look like? - Learn web development
click on the tools button, then on the resulting usage rights option that appears below.
HTML Cheatsheet - Learn web development
d a word or phrase within the text mark text as important <strong>i'm important</strong> i'm important highlight some text <mark>notice me</mark> notice me draw a line through irrelevant text <s>i'm irrelevant</s> i'm irrelevant underline a non-textual annotation this is <u>mispelled</u> this is mispelled text displayed lower than normal text h<sub>2</sub>o h2o small text used to represent the <small>small print </small>of a document used to represent the small print of a document used for an address <address>main street 67</address> main street 67 used for a textual cite <cite>lorem ipsum</cite> lorem ipsum text displayed higher than normal text x<sup>2<...
Use HTML to solve common problems - Learn web development
LearnHTMLHowto
the following links point to solutions to common everyday problems you'll need to solve with html.
HTML Tables - Learn web development
LearnHTMLTables
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.
Structuring the web with HTML - Learn web development
borders and drop shadows, layout your page with multiple columns, add animations and other visual effects.) javascript, and how to use it to add dynamic functionality to web pages (for example find your location and plot it on a map, make ui elements appear/disappear when you toggle a button, save users' data locally on their computers, and much much more.) modules this topic contains the following modules, in a suggested order for working through them.
Server-side website programming first steps - Learn web development
we recommend that you first read the following topics: what is a web server?
React resources - Learn web development
the react devtools utility allows you to inspect the internals of your react application directly in the browser.
ChromeWorkers and the Chrome worker loader
that will regenerate the table of contents below for all readers.
Information for users
firefox accessibility skins and themes at the excellent access firefox website, you will find many valuable resources, including a list of firefox themes that have been specially designed for those with low vision: themes with high color constrast themes with big icons themes with extra large and bright icons themes with extra large and extra bold text 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.
ZoomText
issues for ai squared, from high to low priority docreader and appreader don't respect the structure of the document -- no support for columns.
Frequently Asked Questions for Lightweight themes
what's the maximum file size allowable for my lightweight theme?
Themes
themes allow you to change the look and feel of the user interface and personalize it to your tastes.
A bird's-eye view of the Mozilla framework
it examines what happens when the user performs a simple user interface (ui) action such as clicking a link in the contents panel of the help viewer window shown below.
Choosing the right memory allocator
allocating memory in xpcom these are general purpose memory-management routines that you should use unless your code falls into one of the other categories below.
Creating JavaScript callbacks in components
so we could convert the example above to accept javascript functions in place of the stringparserobserver by making the following changes: [scriptable, function, uuid(...)] interface stringparserobserver : nsisupports { void onword(string word); }; [scriptable, uuid(...)] interface stringparser { void parse(string data); void addobserver(stringparserobserver observer); }; note the only change was adding function to the interface attributes of the callback interface.
Creating a Login Manager storage module
sample javascript implementation the following code snippet is a javascript component that implements a dummy nsiloginmanagerstorage interface.
Debugging OpenGL
if you start up firefox with this variable defined, the following behavior changes occur: each time you issue an opengl call, a check is performed to ensure that the gl context is current, using a thread-local static variable to keep track of this.
Debugging Safari
to enable the very useful debug menu in safari use the following: defaults write com.apple.safari includeinternaldebugmenu 1 it is often useful to switch into single process mode by turning off "use multi-process windows" ...
Debugging update problems
useful preferences enabling the following preferences in about:config can help troubleshoot problems with updates: app.update.log - for application updates; extensions.logging.enabled - for add-on updates.
Debugging a hang on OS X (Archived)
below are steps you can use to attach so-called "samples" to bug reports.
Adding APIs to the navigator object
each method below of adding new objects to the navigator object requires that the new object is a registered xpcom component.
OS TARGET
the following list is not complete as any platform could have its own os_target.
pymake
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.
Working with Mozilla source code
the articles below will help you get your hands on the mozilla source code, learn to navigate the code, and how to get the changes you propose checked into the tree.
Index
141 index firefox, index, mozilla found 168 pages: 142 linux compatibility matrix the following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox.
Limitations of chrome scripts
add-on code is still allowed to use cpows "unsafely".
Message manager overview
the diagram below shows the setup that would result from having two child processes: with the gppmm, you can broadcast messages to the cipmm and all cpmms.
Message manager
they are particularly useful for allowing chrome code, including the browser's code and extension's code, to access web content while the browser is running web content in a separate process.
Errors
you can find further information about them by clicking on the links below: a request to access cookies or storage was blocked because of a custom cookie permission blocked because it came from a tracker and content blocking is enabled blocked because we are blocking all storage access requests blocked because we are blocking all third-party storage access requests and content blocking is enabled granted partitioned access because it came from a third-party and dynamic first-party isolation is enabled ...
Firefox
linux compatibility matrixthe following table lists the available library versions for the mozilla.org-distributed firefox builds dependencies, and/or to build firefox.multiple firefox profilesa profile in firefox is the collection of settings, customizations, add-ons, and other personalizations that a user has made or installed into their copy of firefox.
Firefox Operational Information Database: SQLite
the sqlite manager add-on allows convenient browsing of this information.
HTMLIFrameElement.clearMatch()
examples the following function is taken from our browser api demo, and (amongst other things) clears the search results when the search bar is hidden, if an existing search is active.
HTMLIFrameElement.download()
options optional an options object allowing optional settings to be specified for the download.
HTMLIFrameElement.executeScript()
the executescript() method of the htmliframeelement interface allows a specified script to be executed against a page loaded in the browser <iframe>.
HTMLIFrameElement.findAll()
casesensitivity a string to declare whether you want the search to be case sensitive (case-sensitive) or insensitive (case-insensitive.) example the following function is taken from our browser api demo, and executes a search when a search form is submitted.
HTMLIFrameElement.findNext()
examples the following functions are taken from our browser api demo, and cycle through the available search results.
mozbrowseractivitydone
details the details property returns an anonymous javascript object with the following properties: success a boolean that indicates whether the activity has completed successfully (true) or not (false).
mozbrowserasyncscroll
details the details property returns an anonymous javascript object with the following properties: top the scroll top position in css pixels of the document within the browser <iframe>.
mozbrowsererror
detail the detail property returns an anonymous javascript object with the following properties: type a domstring representing the type of error that occurred.
mozbrowserfindchange
details the details property returns an anonymous javascript object with the following properties: active a boolean indicating whether a search is currently active (true), or not (false.) searchstring a domstring representing the string that is currently being searched for.
mozbrowsericonchange
details the details property returns an anonymous javascript object with the following properties: href a domstring representing the path to the new icon.
mozbrowserloadend
detail the detail property returns an anonymous javascript object with the following properties: backgroundcolor a domstring representing the main background color of the browser <iframe> content, expressed as an rgb value.
mozbrowserlocationchange
detail the detail property returns an anonymous javascript object with the following properties: url a domstring representing the url of the new location.
mozbrowsermanifestchange
details the details property returns an anonymous javascript object with the following properties: href the url of the new app manifest.
mozbrowseropensearch
details the details property returns an anonymous javascript object with the following properties: title a domstring representing the title of the search engine.
mozbrowseropentab
details the details property returns an anonymous javascript object with the following properties: url a domstring representing the url of the new document loaded.
mozbrowseropenwindow
details the details property returns an anonymous javascript object with the following properties: url a domstring representing the url of the document loaded within the frameelement property.
mozbrowserresize
details the details property returns an anonymous javascript object with the following properties: width a number representing the new width of the <iframe> viewport, in device pixels.
mozbrowserscroll
details the details property returns an anonymous javascript object with the following properties: top a number representing the new vertical scroll position of the <iframe> viewport — in css pixels — from the top of the viewport.
mozbrowserscrollareachanged
details the details property returns an anonymous javascript object with the following properties: width a number representing the new scroll area width of the <iframe> viewport, in css pixels.
mozbrowserscrollviewchange
details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of scrolling in the viewport — available values are started and stopped.
mozbrowsersecuritychange
details the details property returns an anonymous javascript object with the following properties: state a domstring representing the current state of ssl security.
mozbrowserselectionstatechanged
details the details property returns an anonymous javascript object with the following properties: rect an object that represents the bounding rectangle of the selection.
mozbrowsershowmodalprompt
details the details property is an anonymous javascript object with the following properties: prompttype a domstring defining the type of the prompt.
mozbrowserusernameandpasswordrequired
details the details property returns an anonymous javascript object with the following members: host a domstring representing the host requesting the http authentification.
mozbrowservisibilitychange
details the details property returns an anonymous javascript object with the following properties: visible a boolean that indicates whether the browser iframe is visible (true) or not (false).
HTMLIFrameElement.sendMouseEvent()
the sendmouseevent() method of the htmliframeelement interface allows you to fake a mouse event and send it to the browser <iframe>'s content.
HTMLIFrameElement.sendTouchEvent()
the sendtouchevent() method of the htmliframeelement allows you to fake a touch event and send it to the browser <iframe>'s content.
HTMLIFrameElement.setVisible()
on the contrary, if its visible state is set to false, it has low priority over the resources it needs.
ChromeWorker
examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below.
-moz-window-dragging
<window>, <panel> inherited no media visual computed value as specified animation type discrete canonical order the unique non-ambiguous order defined by the formal grammar syntax the -moz-window-dragging property is specified as one of the keyword values listed below.
CSS <display-xul> component
firefox supports the following -moz- prefixed xul display values: syntax -moz-box obsolete since gecko 64 xul box, mostly equivalent to flex -moz-inline-box obsolete since gecko 64 xul inline box, mostly equivalent to inline-flex -moz-grid obsolete since gecko 62 xul grid -moz-inline-grid obsolete since gecko 62 xul inline grid -moz-grid-group obsolete since gecko 62 xul grid group -moz-grid-line obsolete since gecko 62 xul grid line -moz-stack obsolete since gecko 62 xul stack -moz-inline-stack obsolete since gecko 62 xul inline stack -moz-deck obsolete since gecko 62 xul deck -moz-popup obsolete since gecko 62 xul popup all xul display values, with the exception of -moz-box and -moz-inline-box, have been removed in bug 1288572.
MozBeforePaint
this allows multiple animations to remain in sync with one another within the context of a given window.
MozScrolledAreaChanged
note: while you can poll the values of document.scrollwidth and document.scrollheight to watch for changes to the document size, reading these properties can trigger document reflow, which can make them computationally expensive.
Embedding Mozilla
gecko allows third-party developers to use the same technology as found in mozilla.
HTML parser threading
these objects are memory managed as follows: attribute holders (nshtml5htmlattributes objects) are allocated using new by the tokenizer.
Gecko versions and application versions
the following table shows the various versions of gecko and what versions of common applications are based on them.
Gecko's "Almost Standards" Mode
for example, consider the following doctype: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> the parts are as follows: public identifier: "-//w3c//dtd html 4.01 transitional//en" system identifier: "http://www.w3.org/tr/html4/loose.dtd" thus any html 4.01 transitional or frameset doctype with a uri (system identifier) will trigger "almost standards" mode, as will ...
How to get a process dump with Windows Task Manager
once the browser hangs, continue with the steps below.
How to get a stacktrace for a bug report
in these cases you will need to use one of the alternative methods listed below.
IPDL Type Serialization
each type specializes ipc::paramtraits as follows: namespace ipc { template <> struct paramtraits<mytype> { typedef mytype paramtype; static void write(message* amsg, const paramtype& aparam) { // implement serialization here } static bool read(const message* amsg, void** aiter, paramtype* aresult) { // implement deserialization here.
IPC Protocol Definition Language (IPDL)
ipdl, short for "ipc (inter-process communication) protocol definition language", is a mozilla-specific language allowing c++ code to pass messages between processes or threads in an organized and secure way.
Addon
operations my be restricted based on system policies (e.g., the system administrator may not allow certain add-ons to be uninstalled), add-on type (e.g., themes may not be disabled), or add-on state (e.g., an incompatible add-on cannot be enabled).
AddonListener
only applies to the following properties: applybackgroundupdates void onpropertychanged( in addon addon, in string properties[] ) parameters addon the addon that has had its properties changed properties an array of the names of properties that changed.
AddonManager
the existing add-on types are defined in xpiprovider.jsm and are, at this time, the following: extension, theme, locale, multipackage, dictionary and experiment.
AddonScreenshot
a screenshot object for an add-on can have following attributes.
AddonType
the lower the number the higher in the list the type will appear.
Code Samples
getting the directory where your add-on is located if you need to determine the directory in which your add-on is installed, code like the following will do the trick.
UpdateListener
for each individual update check, the following methods will be called on the listener: either oncompatibilityupdateavailable() or onnocompatibilityupdateavailable(), depending on whether compatibility information for the requested application version was seen.
Assert.jsm
undefined ok( actual, message ); parameters actual test subject to be evaluated as truthy message short explanation of the expected result equal() the equality assertion tests shallow, coercive equality with ==.
AsyncShutdown.jsm
please make sure that the name respects the following model: "some service: some action in progress" - for instance "os.file: flushing all pending i/o".
API-provided widgets
overflows whether widget can overflow when in an overflowable toolbar (optional, default: true) defaultarea default area to add the widget to (optional, default: none; required if non-removable) shortcutid id of an element that has a shortcut for this widget (optional, default: null).
Widget Wrappers
this will point to the overflow chevron on overflowable toolbars if and only if your widget node is overflowed, to the anchor for the panel menu if your widget is inside the panel menu, and to the node itself in all other cases overflowed boolean indicating whether the node is currently in the overflow panel of the toolbar isgroup false, will be true for the group widget label for api-provide...
Dict.jsm
methods copy() returns a shallow copy of the dictionary; that is, a copy of the dictionary including the items immediately included within the dictionary; however, any objects referenced by those top-level objects are not copied.
DownloadList
the following methods may be defined: ondownloadadded: optional this function is called with a single download argument, after the download is added to the end of the list.
JavaScript OS
the javascript os module contains tools that allow chrome content (i.e.
OS.File.Error
} catch (ex) { if (ex instanceof os.file.error && ex.becausenosuchfile) { // the file does not exist } } global object os.file.error methods overview the following functions are utility functions that may be used to construct instances of os.file.error, setting the platform-specific error number.
Deferred
if this value is a promise, then the associated promise will be resolved to the passed promise, and follow the state as the provided promise (including any future transitions).
WebChannel.jsm
webchannel(string webchannelid, string originorpermission); 2nd argument is a permission for which the permission manager will be checked to determine if the request is allowed.
Localization notes
it's important to follow the format as closely as possible.
Localizing with Mozilla Translator
see the following example.
Web Localizability
the following list contains links to pages that highlight steps that can be taken to make web content localizable.
Writing localizable code
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.
Mozilla Framework Based on Templates (MFBT)
they behave like integers, but safely check for integer overflow and divide-by-zero.
MathML3Testsuite
the pages below contain our current results of the mathml 3 full testsuite for presentation mathml.
MathML Torture Test
addeventlistener("change", updatemathfont, false) } window.addeventlistener("load", load, false); the following test contains sample tex formulas from knuth's tex book and equivalent mathml representations.
MathML In Action
as for the roots of the equation a x 2 + b x + c = 0 , click anywhere in the yellow area to zoom-in/zoom-out: zoomable math html content <p> <math display="block"> <mstyle id="zoomablemath" mathbackground="yellow"> <mrow> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <mrow> <mo>-</mo> <mi>b</mi> </mrow> <mo>&#xb1;</mo> ...
Updates
please follow our monthly irc meeting for the latest updates.
Various MathML Tests
click the expression below to see several definitions of pi: π = 3.14159265358...
Mozilla projects on GitHub
this is a great place to start looking for any projects not listed below.
Namespace
below, find links to articles about c++ classes mozilla uses within various namespaces, primarily the mozilla namespace.
Are We Slim Yet
this allowed us to run measurements on all branches and platforms.
GC and CC logs
about:ccdump is prettier but a bit slower.
Investigating CSS Performance
two counts are collected which allow for an estimation of the amount of work being done during restyle: resolvestyleforcount this is incremented everytime that we do style resolution on an element contentenumfunccount this is incremented roughly for every rule that we test against time during restyle can be spent in a bunch of places.
Profiling with the Gecko Profiler and Local Symbols on Windows
follow the steps below: note: you only need to do this if you're on windows and you've built firefox yourself.
dtrace
a good starting command for profiling wakeups is the following.
Phishing: a short definition
the following is a non-exhaustive list of the most common approaches.
Preferences system
reference information about them is available below: preferences system documentation: introduction: getting started | examples | troubleshooting reference: prefwindow | prefpane | preferences | preference | xul attributes use code for a typical preferences window may look like this: <prefwindow id="apppreferences" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="pane1" label="&pane1.title;"> <preferences> <preference id="pref1" name="pref.na...
Productization guide
the following (and last) page will cover the technical steps to creating and submitting productization patches.
Crash reporting
there is also a custom query tool which allows users to limit searches on more precise information.
L20n
it allows to adapt your web application not only to languages and cultures, but also contextual data, user gender and screen dimensions.
MailNews
it allows reviewers to quickly pick up regressions in patches and helps developers to think about different cases.
McCoy
mccoy is an application that allows add-on authors to provide secure updates to their users.
Creating a Cookie Log
please follow the instructions below to run firefox with cookie logging enabled.
NSPR build instructions
on mac os x, they can be executed with the following: /bin/sh: $ cd pr/tests $ dyld_library_path=../../dist/lib ./accept pass $ $ # to run all the nspr tests...
NSPR release procedure
after you have run repackage.sh, follow the instructions in to upload the files to ftp.mozilla.org's staging server, so that they eventually show up on ftp.mozilla.org.
Nonblocking IO In NSPR
one can make the new socket nonblocking by using <tt>pr_setsockopt()</tt> as in the example below (error checking is omitted for clarity): <tt>prfiledesc *sock;</tt> <tt>printn optval = 1;</tt> <tt>sock = pr_newtcpsocket();</tt> /* * make the socket nonblocking */ pr_setsockopt(sock, pr_sockopt_nonblocking, &optval, sizeof(optval)); programming constraints there are some constraints due to the use of nt asynchronous i/o in the nspr.
Optimizing Applications For NSPR
watch out for printn overflow on win16.
Programs Using NSPR
the following programs are known to use nspr, or portions of it: gecko using programs (mozilla application suite, firefox, thunderbird, camino, etc.) many fedora/red hat and sun server applications.
I/O Types
prfiledesc priomethods prfileprivate prdescidentity note that the nspr documentation follows the unix convention of using the termfiles to refer to many kinds of i/o objects.
Interval Timing
this chapter describes printervaltime and the functions that allow you to use it for timing purposes: interval time type and constants interval functions interval time type and constants all timed functions in nspr require a parameter that depicts the amount of time allowed to elapse before the operation is declared failed.
Logging
logging at execution time: nspr_log_modules nspr_log_file logging functions and macros the functions and macros for logging are: pr_newlogmodule pr_setlogfile pr_setlogbuffering pr_logprint pr_logflush pr_log_test pr_log pr_assert pr_assert pr_static_assert (new in nspr 4.6.6xxx this hasn't been released yet; the number is a logical guess) pr_not_reached use example the following sample code fragment demonstrates use of the logging and debugging aids.
NSPR Types
here are some simple examples of the use of these types: in dowhim.h: pr_extern( void ) dowhatimean( void ); static void pr_callback rootfunction(void *arg); in dowhim.c: pr_implement( void ) dowhatimean( void ) { return; }; prthread *thread = pr_createthread(..., rootfunction, ...); algebraic types nspr provides the following type definitions with unambiguous bit widths for algebraic operations: 8-, 16-, and 32-bit integer types 64-bit integer types floating-point number type for convenience, nspr also provides type definitions with platform-dependent bit widths: native os integer types 8-, 16-, and 32-bit integer types signed integers print8 print16 print32 unsigned integers pruint8 pruint1...
PLHashEntry
an entry has a key and a value, represented by the following fields in the plhashentry structure.
PL_HashString
syntax #include <plhash.h> plhashnumber pl_hashstring(const void *key); parameter the function has the following parameter: key a pointer to a character string.
PL_HashTableAdd
syntax #include <plhash.h> plhashentry *pl_hashtableadd( plhashtable *ht, const void *key, void *value); parameters the function has the following parameters: ht a pointer to the the hash table to which to add the entry.
PL_HashTableDestroy
syntax #include <plhash.h> void pl_hashtabledestroy(plhashtable *ht); parameter the function has the following parameter: ht a pointer to the hash table to be destroyed.
PL_HashTableEnumerateEntries
syntax #include <plhash.h> printn pl_hashtableenumerateentries( plhashtable *ht, plhashenumerator f, void *arg); parameters the function has the following parameters: ht a pointer to the hash table whose entries are to be enumerated.
PL_HashTableLookup
syntax #include <plhash.h> void *pl_hashtablelookup( plhashtable *ht, const void *key); parameters the function has the following parameters: ht a pointer to the hash table in which to look up the entry specified by key.
PL_HashTableRemove
syntax #include <plhash.h> prbool pl_hashtableremove( plhashtable *ht, const void *key); parameters the function has the following parameters: ht a pointer to the hash table from which to remove the entry.
PL_NewHashTable
syntax #include <plhash.h> plhashtable *pl_newhashtable( pruint32 numbuckets, plhashfunction keyhash, plhashcomparator keycompare, plhashcomparator valuecompare, const plhashallocops *allocops, void *allocpriv ); parameters the function has the following parameters: numbuckets the number of buckets in the hash table.
PRFileInfo
syntax #include <prio.h> struct prfileinfo { prfiletype type; pruint32 size; prtime creationtime; prtime modifytime; }; typedef struct prfileinfo prfileinfo; fields the structure has the following fields: type type of file.
PRFileInfo64
syntax #include <prio.h> struct prfileinfo64 { prfiletype type; pruint64 size; prtime creationtime; prtime modifytime; }; typedef struct prfileinfo64 prfileinfo64; fields the structure has the following fields: type type of file.
PRFileType
syntax #include <prio.h> typedef enum prfiletype{ pr_file_file = 1, pr_file_directory = 2, pr_file_other = 3 } prfiletype; enumerators the enumeration has the following enumerators: pr_file_file the information in the structure describes a file.
PRIOMethods
if a layer provides no functionality, it should call the next lower (higher) function of the same name (for example, the "close" method would return fd->lower->method->close(fd->lower)).
PRMcastRequest
syntax #include <prio.h> struct prmcastrequest { prnetaddr mcaddr; prnetaddr ifaddr; }; typedef struct prmcastrequest prmcastrequest; fields the structure has the following fields: mcaddr ip multicast address of group.
PR_Initialize
the type for the root function used by pr_initialize is specified as follows: syntax typedef printn (pr_callback *prprimordialfn)(printn argc, char **argv); see also pr_initialize ...
PRProtoEnt
syntax #include <prnetdb.h> typedef struct prprotoent { char *p_name; char **p_aliases; #if defined(_win32) print16 p_num; #else print32 p_num; #endif } prprotoent; fields the structure has the following fields: p_name pointer to official protocol name.
PRSeekWhence
syntax #include <prio.h> typedef prseekwhence { pr_seek_set = 0, pr_seek_cur = 1, pr_seek_end = 2 } prseekwhence; enumerators the enumeration has the following enumerators: pr_seek_set sets the file pointer to the value of the offset parameter.
PRThreadType
nspr allows the client to synchronize the termination of all user threads and ignores those created as system threads.
PR_AtomicAdd
syntax #include <pratom.h> print32 pr_atomicadd( print32 *ptr, print32 val); parameter the function has the following parameters: ptr a pointer to the value to increment.
PR_AtomicDecrement
syntax #include <pratom.h> print32 pr_atomicdecrement(print32 *val); parameter the function has the following parameter: val a pointer to the value to decrement.
PR_AtomicIncrement
syntax #include <pratom.h> print32 pr_atomicincrement(print32 *val); parameter the function has the following parameter: val a pointer to the value to increment.
PR_AtomicSet
syntax #include <pratom.h> print32 pr_atomicset( print32 *val, print32 newval); parameters the function has the following parameter: val a pointer to the value to be set.
PR_AttachThread
syntax #include <pprthread.h> prthread* pr_attachthread( prthreadtype type, prthreadpriority priority, prthreadstack *stack); parameters pr_attachthread has the following parameters: type specifies that the thread is either a user thread (pr_user_thread) or a system thread (pr_system_thread).
PR_CNotify
syntax #include <prcmon.h> prstatus pr_cnotify(void *address); parameter the function has the following parameter: address the address of the monitored object.
PR_CNotifyAll
syntax #include <prcmon.h> prstatus pr_cnotifyall(void *address); parameter the function has the following parameter: address the address of the monitored object.
PR_CallOnce
from that time on, the client should consider the object read-only (or even opaque) and allow the runtime to manipulate its content appropriately.
PR_CancelJob
syntax #include <prtpool.h> nspr_api(prstatus) pr_canceljob(prjob *job); parameter the function has the following parameter: job a pointer to a prjob structure returned by a pr_queuejob function representing the job to be cancelled.
PR_Cleanup
syntax #include <prinit.h> prstatus pr_cleanup(void); returns the function returns one of the following values: if nspr has been shut down successfully, pr_success.
PR_CloseDir
syntax #include <prio.h> prstatus pr_closedir(prdir *dir); parameter the function has the following parameter: dir a pointer to a prdir structure representing the directory to be closed.
PR_CloseSemaphore
syntax #include <pripcsem.h> nspr_api(prstatus) pr_closesemaphore(prsem *sem); parameter the function has the following parameter: sem a pointer to a prsem structure returned from a call to pr_opensemaphore.
PR_ConnectContinue
syntax #include <prio.h> prstatus pr_connectcontinue( prfiledesc *fd, print16 out_flags); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
PR ConvertIPv4AddrToIPv6
syntax #include <prnetdb.h> void pr_convertipv4addrtoipv6( pruint32 v4addr, pripv6addr *v6addr ); parameters the function has the following parameters: v4addr the ipv4 address to convert into an ipv4-mapped ipv6 address.
PR_CreateIOLayerStub
syntax #include <prio.h> prfiledesc* pr_createiolayerstub( prdescidentity ident priomethods const *methods); parameters the function has the following parameters: ident the identity to be associated with the new layer.
PR_CreatePipe
syntax #include <prio.h> prstatus pr_createpipe( prfiledesc **readpipe, prfiledesc **writepipe); parameters the function has the following parameters: readpipe a pointer to a prfiledesc pointer.
PR_CreateThreadPool
syntax #include <prtpool.h> nspr_api(prthreadpool *) pr_createthreadpool( print32 initial_threads, print32 max_threads, pruint32 stacksize ); parameters the function has the following parameters: initial_threads the number of threads to be created within this thread pool.
PR_DeleteSemaphore
syntax #include <pripcsem.h> nspr_api(prstatus) pr_deletesemaphore(const char *name); parameter the function has the following parameter: name the name of a semaphore that was previously created via a call to pr_opensemaphore.
PR_DestroyMonitor
syntax #include <prmon.h> void pr_destroymonitor(prmonitor *mon); parameter the function has the following parameter: mon a reference to an existing structure of type prmonitor.
PR_EXTERN
warning: some platforms do not allow the use of the underscore character (_) as the first character of an exported symbol.
PR_EnterMonitor
syntax #include <prmon.h> void pr_entermonitor(prmonitor *mon); parameter the function has the following parameter: mon a reference to an existing structure of type prmonitor.
PR EnumerateAddrInfo
syntax #include <prnetdb.h> void *pr_enumerateaddrinfo( void *enumptr, const praddrinfo *addrinfo, pruint16 port, prnetaddr *result); parameters the function has the following parameters: enumptr the index pointer of the enumeration.
PR_ExportFileMapAsString
syntax #include <prshma.h> nspr_api( prstatus ) pr_exportfilemapasstring( prfilemap *fm, prsize bufsize, char *buf ); define pr_filemap_string_bufsize 128 parameters the function has the following parameters: fm a pointer to the prfilemap to be represented as a string.
PR FreeAddrInfo
syntax #include <prnetdb.h> void pr_enumerateaddrinfo(praddrinfo *addrinfo); parameters the function has the following parameters: addrinfo a pointer to a praddrinfo structure returned by a successful call to pr_getaddrinfobyname.
PR GetCanonNameFromAddrInfo
syntax #include <prnetdb.h> const char *pr_getcanonnamefromaddrinfo(const praddrinfo *addrinfo); parameters the function has the following parameters: addrinfo a pointer to a praddrinfo structure returned by a successful call to pr_getaddrinfobyname.
PR_GetConnectStatus
syntax prstatus pr_getconnectstatus(const prpolldesc *pd); parameter the function has the following parameter: pd a pointer to a prpolldesc satructure whose fd field is the socket and whose in_flags field must contain pr_poll_write and pr_poll_except.
PR_GetInheritedFileMap
syntax #include <prshma.h> nspr_api( prfilemap *) pr_getinheritedfilemap( const char *shmname ); parameter the function has the following parameter: shmname the name provided to pr_processattrsetinheritablefilemap.
PR_GetLayersIdentity
syntax #include <prio.h> prdescidentity pr_getlayersidentity(prfiledesc* fd); parameter the function has the following parameter: fd a pointer to a file descriptor.
PR_GetPeerName
syntax #include <prio.h> prstatus pr_getpeername( prfiledesc *fd, prnetaddr *addr); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket.
PR_GetSockName
syntax #include <prio.h> prstatus pr_getsockname( prfiledesc *fd, prnetaddr *addr); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket.
PR_GetSocketOption
syntax #include <prio.h> prstatus pr_getsocketoption( prfiledesc *fd, prsocketoptiondata *data); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket whose options are to be retrieved.
PR_GetThreadPriority
syntax #include <prthread.h> prthreadpriority pr_getthreadpriority(prthread *thread); parameter pr_getthreadpriority has the following parameter: thread a valid identifier for the thread whose priority you want to know.
PR_GetThreadPrivate
syntax #include <prthread.h> void* pr_getthreadprivate(pruintn index); parameter pr_getthreadprivate has the following parameters: index the index into the per-thread private data table.
PR_IMPLEMENT
warning: some platforms do not allow the use of the underscore character (_) as the first character of an exported symbol.
PR_ImportFileMapFromString
syntax #include <prshma.h> nspr_api( prfilemap * ) pr_importfilemapfromstring( const char *fmstring ); parameter the function has the following parameter: fmstring a pointer to string created by pr_exportfilemapasstring.
PR_Initialized
syntax #include <prinit.h> prbool pr_initialized(void); returns the function returns one of the following values: if pr_init has already been called, pr_true.
PR_IntervalToMicroseconds
description conversion may cause overflow, which is not reported.
PR_IntervalToMilliseconds
description conversion may cause overflow, which is not reported.
PR_IntervalToSeconds
description conversion may cause overflow, which is not reported.
PR_JoinJob
syntax #include <prtpool.h> nspr_api(prstatus) pr_joinjob(prjob *job); parameter the function has the following parameter: job a pointer to a prjob structure returned by a pr_queuejob function representing the job to be cancelled.
PR_JoinThreadPool
syntax #include <prtpool.h> nspr_api(prstatus) pr_jointhreadpool( prthreadpool *tpool ); parameter the function has the following parameter: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_MemMap
syntax #include <prio.h> void* pr_memmap( prfilemap *fmap, print64 offset, pruint32 len); parameters the function has the following parameters: fmap a pointer to the file-mapping object representing the file to be memory-mapped.
PR_MicrosecondsToInterval
syntax #include <prinrval.h> printervaltime pr_microsecondstointerval(pruint32 milli); parameter the function has the following parameter: micro the number of microseconds to convert to interval form.
PR_MillisecondsToInterval
syntax #include <prinrval.h> printervaltime pr_millisecondstointerval(pruint32 milli); parameter the function has the following parameter: milli the number of milliseconds to convert to interval form.
PR_NewCondVar
returns the function returns one of the following values: if successful, a pointer to the new condition variable object.
PR_NewLock
syntax #include <prlock.h> prlock* pr_newlock(void); returns the function returns one of the following values: if successful, a pointer to the new lock object.
PR_NewMonitor
syntax #include <prmon.h> prmonitor* pr_newmonitor(void); returns the function returns one of the following values: if successful, a pointer to a prmonitor object.
PR_NotifyAllCondVar
syntax #include <prcvar.h> prstatus pr_notifyallcondvar(prcondvar *cvar); returns the function returns one of the following values: if successful, pr_success.
PR_NotifyCondVar
returns the function returns one of the following values: if successful, pr_success.
PR_OpenAnonFileMap
creates or opens a named semaphore with the specified name syntax #include <prshma.h> nspr_api( prfilemap *) pr_openanonfilemap( const char *dirname, prsize size, prfilemapprotect prot ); parameters the function has the following parameters: dirname a pointer to a directory name that will contain the anonymous file.
PR_OpenDir
syntax #include <prio.h> prdir* pr_opendir(const char *name); parameter the function has the following parameter: name the pathname of the directory to be opened.
PR_OpenSemaphore
syntax #include <pripcsem.h> #define pr_sem_create 0x1 /* create if not exist */ #define pr_sem_excl 0x2 /* fail if already exists */ nspr_api(prsem *) pr_opensemaphore( const char *name, printn flags, printn mode, pruintn value ); parameters the function has the following parameters: name the name to be given the semaphore.
PR_OpenSharedMemory
clude <prshm.h> nspr_api( prsharedmemory * ) pr_opensharedmemory( const char *name, prsize size, printn flags, printn mode ); /* define values for pr_opensharememory(...,create) */ #define pr_shm_create 0x1 /* create if not exist */ #define pr_shm_excl 0x2 /* fail if already exists */ parameters the function has the following parameters: name the name of the shared memory segment.
PR_PostSemaphore
syntax #include <pripcsem.h> nspr_api(prstatus) pr_postsemaphore(prsem *sem); parameter the function has the following parameter: sem a pointer to a prsem structure returned from a call to pr_opensemaphore.
PR_ProcessAttrSetInheritableFileMap
syntax #include <prshma.h> nspr_api(prstatus) pr_processattrsetinheritablefilemap( prprocessattr *attr, prfilemap *fm, const char *shmname ); parameters the function has the following parameters: attr pointer to a prprocessattr structure used to pass data to pr_createprocess.
PR_QueueJob
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob( prthreadpool *tpool, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_QueueJob_Accept
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_accept( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_QueueJob_Connect
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_connect( prthreadpool *tpool, prjobiodesc *iod, const prnetaddr *addr, prjobfn fn, void * arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_QueueJob_Read
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_read( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_QueueJob_Timer
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_timer( prthreadpool *tpool, printervaltime timeout, prjobfn fn, void * arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_QueueJob_Write
syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_write( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_RmDir
syntax #include <prio.h> prstatus pr_rmdir(const char *name); parameter the function has the following parameter: name the name of the directory to be removed.
PR_SecondsToInterval
syntax #include <prinrval.h> printervaltime pr_secondstointerval(pruint32 seconds); parameter the function has the following parameter: seconds the number of seconds to convert to interval form.
PR_SetSocketOption
syntax #include <prio.h> prstatus pr_setsocketoption( prfiledesc *fd, prsocketoptiondata *data); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing the socket whose options are to be set.
PR_SetThreadPriority
syntax #include <prthread.h> void pr_setthreadpriority( prthread *thread, prthreadpriority priority); parameters pr_setthreadpriority has the following parameters: thread a valid identifier for the thread whose priority you want to set.
PR_ShutdownThreadPool
syntax #include <prtpool.h> nspr_api(prstatus) pr_shutdownthreadpool( prthreadpool *tpool ); parameter the function has the following parameter: tpool a pointer to a prthreadpool structure previously created by a call to pr_createthreadpool.
PR_Sleep
syntax #include <prthread.h> prstatus pr_sleep(printervaltime ticks); parameter pr_sleep has the following parameter: ticks the number of ticks you want the thread to sleep for (see printervaltime).
PR_TicksPerSecond
pr_pr_tickspersecond() allows you to discover exactly what that relationship is.
PR_UnloadLibrary
returns the function returns one of the following values: if successful, pr_success.
PR_Unlock
returns the function returns one of the following values: if successful, pr_success.
PR_VersionCheck
returns the function returns one of the following values: if the version of the shared library is compatible with that expected by the caller, pr_true.
PR_WaitSemaphore
syntax #include <pripcsem.h> nspr_api(prstatus) pr_waitsemaphore(prsem *sem); parameter the function has the following parameter: sem a pointer to a prsem structure returned from a call to pr_opensemaphore.
PR_htonl
syntax #include <prnetdb.h> pruint32 pr_htonl(pruint32 conversion); parameter the function has the following parameter: conversion the 32-bit unsigned integer, in host byte order, to be converted.
PR_htons
syntax #include <prnetdb.h> pruint16 pr_htons(pruint16 conversion); parameter the function has the following parameter: conversion the 16-bit unsigned integer, in host byte order, to be converted.
PR_ntohl
syntax #include <prnetdb.h> pruint32 pr_ntohl(pruint32 conversion); parameter the function has the following parameter: conversion the 32-bit unsigned integer, in network byte order, to be converted.
PR_ntohs
syntax #include <prnetdb.h> pruint16 pr_ntohs(pruint16 conversion); parameter the function has the following parameter: conversion the 16-bit unsigned integer, in network byte order, to be converted.
NSPR
opensuse linux: install one or more of the following via yast or zypper : mozilla-nspr : binary libraries for your platform mozilla-nspr-32bit : binary libraries needed to run 32-bit programs on a 64-bit os mozilla-nspr-devel : files needed (in addition to the above libraries) to compile programs using nspr mozilla-nspr-debuginfo : debug information (including build symbols) for package mozilla-nspr mozilla-nspr-debuginfo-32bit...
CERT_FindCertByDERCert
the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance.
CERT_FindCertByIssuerAndSN
the certificate is a shallow copy, use cert_destroycertificate to decrement the reference count on the certificate instance.
Certificate functions
if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference.
NSS Code Coverage
yellow: 40-70% of blocks tested.
Cryptography functions
if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference.
JSS FAQ
MozillaProjectsNSSJSSJSS FAQ
setcipherpolicy does not need to be called by a jss app unless that app wants to limit itself to export-allowed cipher suites.
Using JSS
MozillaProjectsNSSJSSUsing JSS
the following table gives the core names of the libraries, omitting the platform-specific prefix and suffix.
NSS Memory allocation
this makes nss slower, but produces accurate leak allocation stacks.
NSS 3.15.5 release notes
the bug fixes in nss 3.15.5 are described in the "bugs fixed" section below.
NSS 3.16.1 release notes
the bug fixes in nss 3.16.1 are described in the "bugs fixed" section below.
NSS 3.16.2.2 release notes
the bug fixes in nss 3.16.2.2 are described in the "bugs fixed" section below.
NSS 3.16.2.3 release notes
the bug fixes in nss 3.16.2.3 are described in the "bugs fixed" section below.
NSS 3.16.6 release notes
the bug fixes in nss 3.16.6 are described in the "bugs fixed" section below.
NSS 3.17.2 release notes
the bug fixes in nss 3.17.2 are described in the "bugs fixed" section below.
NSS 3.17.4 release notes
the bug fixes in nss 3.17.4 are described in the "bugs fixed" section below.
NSS 3.19.1 release notes
the bug fixes in nss 3.19.1 are described in the "bugs fixed" section below.
NSS 3.19.2.2 release notes
the bug fixes in nss 3.19.2.2 are described in the "security fixes" section below.
NSS 3.19 release notes
a new api (cert_getimposednameconstraints) has been added that allows one to lookup imposed constraints.
NSS 3.20.2 release notes
the bug fixes in nss 3.20.2 are described in the "security fixes" section below.
NSS 3.21.2 release notes
the bug fixes in nss 3.21.2 are described in the "security fixes" section below.
NSS 3.21.3 release notes
the bug fixes in nss 3.21.3 are described in the "security fixes" section below.
NSS 3.21.4 release notes
the bug fixes in nss 3.21.4 are described in the "bugs fixed" section below.
NSS 3.22.1 release notes
the bug fixes in nss 3.22.1 are described in the "notable changes" section below.
NSS 3.22.3 release notes
the bug fixes in nss 3.22.3 are described in the "bugs fixed" section below.
NSS 3.25.1 release notes
bugs fixed in nss 3.25.1 the following bug has been fixed in nss 3.25.1: ignore md5 signature algorithms in certificate requests compatibility nss 3.25.1 shared libraries are backwards compatible with all older nss 3.x shared libraries.
NSS 3.26.2 release notes
bugs fixed in nss 3.26.2 the following bug has been fixed in nss 3.26.2: ignore md5 signature algorithms in certificate requests compatibility nss 3.26.2 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.26 release notes
urce tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_26_rtm/src/ new in nss 3.26 new functionality the selfserv test utility has been enhanced to support alpn (http/1.1) and 0-rtt added support for the system-wide crypto policy available on fedora linux, see http://fedoraproject.org/wiki/changes/cryptopolicy introduced build flag nss_disable_libpkix which allows compilation of nss without the libpkix library notable changes in nss 3.26 the following ca certificate was added cn = isrg root x1 sha-256 fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6 npn is disabled, and alpn is enabled by default the nss test suite now completes with the experimental tls 1.3 ...
NSS 3.27.2 Release Notes
bugs fixed in nss 3.27.2 the following bug has been fixed in nss 3.27.2: bug 1318561 - ssl_settrustanchors leaks compatibility nss 3.27.2 shared libraries are backward compatible with all older nss 3.x shared libraries.
NSS 3.28.4 release notes
the bug fixes in nss 3.28.4 are described in the "bugs fixed" section below.
NSS 3.29.2 release notes
the bug fixes in nss 3.29.2 are described in the "bugs fixed" section below.
NSS 3.29.3 release notes
the bug fixes in nss 3.29.3 are described in the "bugs fixed" section below.
NSS 3.29.5 release notes
the bug fixes in nss 3.29.5 are described in the "bugs fixed" section below.
NSS 3.30.1 release notes
the bug fixes in nss 3.30.1 are described in the "bugs fixed" section below.
NSS 3.30 release notes
in pk11pub.h pk11_hasattributeset - allows to check if a pkcs#11 object in a given slot has a specific boolean attribute set.
NSS 3.34.1 release notes
nss 3.34.1 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_34_1_rtm/src/ notable changes in nss 3.34.1 the following ca certificate was re-added.
NSS 3.36.5 release notes
the bug fixes in nss 3.36.5 are described in the "bugs fixed" section below.
NSS 3.36.6 release notes
the bug fixes in nss 3.36.6 are described in the "bugs fixed" section below.
NSS 3.36.7 release notes
the bug fixes in nss 3.36.7 are described in the "bugs fixed" section below.
NSS 3.36.8 release notes
the bug fixes in nss 3.36.8 are described in the "bugs fixed" section below.
NSS 3.40 release notes
the following ca certificates were removed: cn = visa ecommerce root sha-256 fingerprint: 69fac9bd55fb0ac78d53bbee5cf1d597989fd0aaab20a25151bdf1733ee7d122 bugs fixed in nss 3.40 bug 1478698 - ffdhe key exchange sometimes fails with decryption failure this bugzilla query returns all the bugs fixed in nss 3.40: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&c...
NSS 3.41.1 release notes
the bug fixes in nss 3.41.1 are described in the "bugs fixed" section below.
NSS 3.42 release notes
new in nss 3.42 new functionality bug 818686 - support xdg basedir specification new functions none notable changes in nss 3.42 the following ca certificates were added: none the following ca certificates were removed: none added support for some of the testcases from the wycheproof project: bug 1508666 - added aes-gcm test cases bug 1508673 - added chacha20-poly1305 test cases bug 1514999 - added the curve25519 test cases thanks to jon...
NSS 3.44.1 release notes
the bug fixes in nss 3.44.1 are described in the "bugs fixed" section below.
NSS 3.44.2 release notes
the bug fixes in nss 3.44.2 are described in the "bugs fixed" section below.
NSS 3.44.3 release notes
the bug fixes in nss 3.44.3 are described in the "bugs fixed" section below.
NSS 3.46.1 release notes
the bug fixes in nss 3.46.1 are described in the "bugs fixed" section below.
NSS 3.46 release notes
notable changes in nss 3.46 certificate authority changes the following ca certificates were removed: bug 1574670 - remove expired class 2 primary root certificate sha-256 fingerprint: 0f993c8aef97baaf5687140ed59ad1821bb4afacf0aa9a58b5d57a338a3afbcb bug 1574670 - remove expired utn-userfirst-client root certificate sha-256 fingerprint: 43f257412d440d627476974f877da8f1fc2444565a367ae60eddc27a412531ae bug 1574670 -...
NSS 3.47.1 release notes
the bug fixes in nss 3.47.1 are described in the "bugs fixed" section below.
NSS 3.48.1 release notes
the bug fixes in nss 3.48.1 are described in the "bugs fixed" section below.
NSS 3.49.1 release notes
the bug fixes in nss 3.49.1 are described in the "bugs fixed" section below.
NSS 3.49.2 release notes
the bug fixes in nss 3.49.2 are described in the "bugs fixed" section below.
NSS 3.49 release notes
bugs fixed in nss 3.49 bug 1513586 - set downgrade sentinel for client tls versions lower than 1.2.
NSS 3.51.1 release notes
this is a minor release focusing on functional bug fixes and low-risk patches only.
NSS Sample Code Sample1
this program shows the following: rsa key pair generation naming rsa key pairs looking up a previously generated key pair by name creating aes and mac keys (or encryption and mac keys in general) wrapping symmetric keys using your own rsa key pair so that they can be stored on disk or in a database.
NSS Sample Code Utilities_1
this code shows the following: extract seed from noise file read der encoding from a file extract the password from a text file get the module password print as ascii or hexadecimal sample code #include <prlog.h> #include <termios.h> #include <base64.h> #include <unistd.h> #include <sys/stat.h> #include <prprf.h> #include "util.h" /* * these utility functions are adapted from those found in * the sectool library used by the nss security tools and * other nss test applications.
Hashing - sample 1
the nss same code below computes the hash of a file and saves it to another file, this illustrates the use of nss message apis.
Initialize NSS database - sample 2
the nss sample code below demonstrates how to initialize the nss database.
Utilities for nss samples
it shows the following: read der from a file.
NSS release notes template
the bug fixes in nss 3.xx.y are described in the "bugs fixed" section below.
PKCS 12 functions
ater sec_pkcs12decodervalidatebags mxr 3.2 and later sec_pkcs12decoderverify mxr 3.2 and later sec_pkcs12destroyexportcontext mxr 3.2 and later sec_pkcs12enablecipher mxr 3.2 and later sec_pkcs12encode mxr 3.2 and later sec_pkcs12isencryptionallowed mxr 3.2 and later sec_pkcs12setpreferredcipher mxr 3.2 and later ...
PKCS 7 functions
later sec_pkcs7includecertchain mxr 3.2 and later sec_pkcs7iscontentempty mxr 3.2 and later sec_pkcs7setcontent mxr 3.4 and later sec_pkcs7verifydetachedsignature mxr 3.4 and later sec_pkcs7verifysignature mxr 3.2 and later secmime_decryptionallowed mxr 3.4 and later ...
Installation guide
the libraries you need to install are listed below.
Sample manual installation
after building nss with "gmake nss_build_all", the resulting build can be found in the nss source tree as follows: nss header files: mozilla/dist/public/nss nspr header files: mozilla/dist/<obj-dir>/include nspr/nss shared libs: mozilla/dist/<obj-dir>/lib nss binary executables: mozilla/dist/<obj-dir>/bin.
FC_GetInfo
on return, the ck_info structure that pinfo points to has the following information: cryptokiversion: pkcs #11 interface version number implemented by the pkcs #11 library.
FC_GetSessionInfo
otherwise, it fills in the ck_session_info structure with the following information: state: the state of the session, i.e., no role is assumed, the user role is assumed, or the crypto officer role is assumed flags: bit flags that define the type of session ckf_rw_session (0x00000002): true if the session is read/write; false if the session is read-only.
FC_GetTokenInfo
on return, the ck_token_info structure that pinfo points to has the following information: label: the label of the token, assigned during token initialization, padded with spaces to 32 bytes and not null-terminated.
FC_OpenSession
syntax ck_rv fc_opensession( ck_slot_id slotid, ck_flags flags, ck_void_ptr papplication, ck_notify notify, ck_session_handle_ptr phsession ); parameters fc_opensession has the following parameters: slotid [in] the id of the token's slot.
NSPR functions
the following nspr functions allow you to create your own nspr i/o layer and manipulate it.
NSS cryptographic module
the following sections document the data types and functions.
troubleshoot.html
some systems may not be configured to allow this many simultaneous connections by default; if the stress tests fail, try increasing the number of simultaneous sockets supported.
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.
Utility functions
if documentation is available for a function listed below, the function name is linked to either its mdc wiki page or its entry in the old ssl reference.
NSS Tools dbck-tasks
there should be command-line options and, perhaps, an interactive mode to allow determine which certificates to keep.
Rhino downloads archive
if you are looking for js.jar for xslt or for ibm's bean scripting framework (bsf), please read the following note and then download one of the zip files above and unzip it.
Rhino history
for a time, a couple of major companies (including sun) licensed rhino for use in their products and paid netscape to do so, allowing work on rhino to continue.
Rhino optimization
simple data and type flow analysis is performed to determine which javascript variables can be allocated to java vm registers, and which variables are used only as numbers.
Rhino requirements and limitations
to use the javaadapter feature or an optimization level of 0 or greater, rhino must be running under a security manager that allows the definition of class loaders.
The JavaScript Runtime
these types are implemented with the following java types and values: javascript fundamental type java type undefined a singleton object defined by context.getundefinedtype() null null boolean java.lang.boolean number java.lang.number, that is, any of java.lang.byte, java.lang.short, java.lang.integer, java.lang.float, or java.lang.double.
Rhino serialization
if you are using rhino serialization in an environment where you always define, say, a constructor foo, you should add the following code before calling writeobject: out.addexcludedname("foo"); out.addexcludedname("foo.prototype"); this code will prevent foo and foo.prototype from being serialized and will cause references to foo or foo.prototype to be resolved to the objects in the new scope upon deserialization.
FOSS
includes a js shell that allows you to use cpan modules from javascript.
Future directions
we would also like to allow webassembly to interact with gc-managed data.
JSAPI Cookbook
getpropfunc, null, jsprop_shared | jsprop_native_accessors | jsprop_enumerate)) { return false; } working with the prototype chain defining a native read-only property on the string.prototype // javascript object.defineproperty(string.prototype, "md5sum", {get: getmd5func, enumerable: true}); the following trick couldn't work if someone has replaced the global string object with something.
JS::GetFirstArgumentAsTypeHint
see below.
JS::MutableHandle
it is used in the same way as js::handle&lt;t&gt; and includes a |set(const t &v)| method to allow updating the value of the referenced js::rooted&lt;t&gt;.
JS::SetLargeAllocationFailureCallback
added in spidermonkey 38 description if a large allocation fails when calling pod_{calloc,realloc}cangc, the js engine may call the large-allocation- failure callback, if set, to allow the embedding to flush caches, possibly perform shrinking gcs, etc.
JS::SetOutOfMemoryCallback
added in spidermonkey 38 description unlike the error reporter, which is only called if the exception for an oom bubbles up and is not caught, the js::outofmemorycallback is called immediately at the oom site to allow the embedding to capture the current state of heap allocation before anything is freed.
JSCheckAccessOp
jsclass hooks jsclass offers the following hook: the jsclass.checkaccess callback is called when a script attempts to access an object property.
JSConstDoubleSpec
obsolete since jsapi 35 currently these can be 0 or more of the following values or'd: jsprop_enumerate: property is visible in for loops.
JSConvertOp
jsclass hooks jsclass offers the following hook: the jsclass.convert callback implements the [[defaultvalue]] behavior for objects having that class.
JSEnumerateOp
jsclass hooks jsclass offers following hook: the jsclass.enumerate hook is for classes that implement lazy properties using jsclass.resolve.
JSExnType
(lower bound) jsexn_err error jsexn_internalerr internalerror jsexn_evalerr evalerror jsexn_rangeerr rangeerror jsexn_referenceerr referenceerror jsexn_syntaxerr syntaxerror jsexn_typeerr typeerror jsexn_urierr urierror jsexn_limit (upper bound) description these types are part of a jserrorformatstring structure.
JSExtendedClass.wrappedObject
wrapper objects typically have no prototype, do not allow setting __proto__, and inherit properties from the wrapped object rather than the prototype chain (see jsnewresolveop).
JSFinalizeOp
jsclass hooks jsclass offers the following hook: the jsclass.finalize callback is a hook for destructor code.
JSHasInstanceOp
jsclass hooks jsclass offers the following hook: the jsclass.hasinstance callback implements js_hasinstance and the javascript instanceof keyword.
JSMarkOp
jsclass hooks jsclass offers the following hook: the javascript engine calls the jsclass.mark callback during the mark phase of garbage collection.
JSNewResolveOp
flags the flags argument is the logical or of zero or more of the following flags.
JSObject
objects are made up of the following parts: most objects have a prototype.
JSObjectOps.dropProperty
description the following contract governs jsobjectops callers and implementations: whenever jsobjectops.lookupproperty returns a jsproperty pointer, the property is locked.
JSObjectOps.getAttributes
see the description section below.
JSObjectOps.getRequiredSlot
see note below.
JSResolveOp
jsclass hooks jsclass offers the following hook: jsclass.resolve callback is called when a property is not found on an object.
JSRuntime
earlier versions allowed using js_clearcontextthread and other functions to move a jscontext from one thread to another.
JSTraceOp
jsclass hooks jsclass offers the following hook: the jsclass.trace callback is called to enumerate all traceable things reachable.
JSVAL_IS_DOUBLE
example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js double data type.
JSVAL_IS_INT
example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer data type.
JSVAL_IS_NULL
(note: jsval_is_object(jsval_null) is also true.) example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it contains a null value.
JSVAL_IS_NUMBER
example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a js integer or double value.
JSVAL_IS_STRING
example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is a string.
JSVAL_IS_VOID
example the following code snippet illustrates how a javascript variable, myitem, is conditionally tested in an if statement to see if it is void.
JSVersion
description the jsversion enumerated type includes the following values.
JSXDRObjectOp
jsclass hooks jsclass offers the following hook: jsxdr calls the jsclass.xdrobject callback to serialize and deserialize objects.
JS_AddArgumentFormatter
this function is described in more detail below.
JS_AddExternalStringFinalizer
syntax int js_addexternalstringfinalizer(jsstringfinalizeop finalizer); name type description finalizer jsstringfinalizeop pointer to a callback function, described below.
JS_Add*Root
js_addgcthingroot allows the caller to have a single root that may hold either strings or objects.
JS_CallFunction
see below.
JS_ClearNewbornRoots
using js_enterlocalrootscope disables updating of the context's per-gc-thing-type newborn roots, until control flow unwinds and leaves the outermost nesting local root scope.
JS_ClearPendingException
(there is a pending exception if the most recently thrown exception in cx has not yet been caught or cleared.) when any jsapi call fails with an exception, the caller must either use js_clearpendingexception to catch the exception; or return false to allow the exception to propagate to the caller.
JS_ContextIterator
example the following code snippet illustrates how to cycle through the contexts for a given runtime: jscontext *acx; jscontext *iterp = null; int i = 0; while ((acx = js_contextiterator(rt, &iterp)) != null) { printf("%d ", ++i); } see also mxr id search for js_contextiterator ...
JS_ConvertArguments
format can contain one or more instances of the following characters, as appropriate: character c type description b bool boolean c uint16_t ecma uint16_t, unicode character i int32_t ecma int32_t j int32_t ecma int32_t (used to be different, behaves like i now) obsolete since jsapi 28 u uint32_t ecma uint32_t d double ieee double i d...
JS_DefineFunctions
behavior propertydefinitionbehavior see below.
JS_DefineProperty
it differs from js_setproperty in that: it does not behave like ordinary property assignment in the javascript language; it allows the application to specify additional details (getter, setter, and attrs) governing the new property's behavior; it never calls a setter; it can call the jsclass.addproperty callback when js_setproperty would not, because it can replace an existing property.
JS_DeleteProperty
then one of the following cases applies: if obj has no property with the given name or id, or if obj inherits the specified property from its prototype, then obj's jsclass.delproperty hook is called.
JS_DeleteProperty2
then one of the following cases applies: if obj has no property with the given name or id, or if obj inherits the specified property from its prototype, then *succeeded is set to true and obj's jsclass.delproperty hook is called (which may change *succeeded).
JS_DumpHeap
jstrace_outofline = 0x07, // the following kinds do not have an exposed c++ idiom.
JS_EnterLocalRootScope
description scoped local root management allows native functions, getter/setters, etc.
JS_ExecuteScript
instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc.
JS_ExecuteScriptVersion
instead: the scope chain is initialized to contain obj, followed by its parent, then its parent's parent, etc.
JS_GetFunctionFlags
function flags are a value of type unsigned int, the bitwise or of zero or more of the jsfun flags described below.
JS_GetFunctionObject
see below.
JS_GetGlobalObject
furthermore, some jsapi functions, such as js_executescript, allow the caller to specify a global object in which the script executes.
JS_GetInstancePrivate
obsolete since jsapi 32 this must be one of the following: an argv pointer created by the javascript engine and passed to a jsnative callback; js_argv(cx, vp) where vp is a pointer created by the engine and passed to a jsfastnative callback; or null.
JS_GetParent
some of these functions allow the application to specify a parent object.
JS_GetReservedSlot
reserved slots may also contain private values to store pointer values (whose lowest bit is 0) or uint32_t, when non-javascript values must be stored; the garbage collector ignores such values when it sees them.
JS_GetTypeName
the following table lists jstypes and the string literals reported by js_gettypename: type literal jstype_void "undefined" jstype_object "object" jstype_function "function" jstype_string "string" jstype_number "number" jstype_boolean "boolean" any other value null see also js_convertvalue js_typeofvalue js...
JS_InstanceOf
when args is non-null, js_instanceof behaves as follows.
JS_IsConstructing_PossiblyWithGivenThisObject
in such cases, the following example would provide the additional information of whether a special this was supplied.
JS_IterateCompartments
compartmentcallback jsiteratecompartmentcallback callback function (see below).
JS_LockGCThing
js_unlockgcthing removes a lock from a specified item, thing, allowing it to be garbage collected when the javascript engine determines it is unreachable.
JS_NewExternalString
(ultimately, the string will be garbage collected, and the javascript engine will call the string finalizer callback, allowing the application to free the array.) the array does not need to be zero-terminated.
JS_NewObject
the jsclass may be used to override low-level object behavior, including such details as the physical memory layout of the object and how property lookups are done.
JS_NewUCString
this allows the javascript engine to avoid needless data copying.
JS_PreventExtensions
the failure-mode information below is new as of spidermonkey 36.
JS_SameValue
the samevalue algorithm is equivalent to the following javascript: function samevalue(v1, v2) { if (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1 && v2 !== v2) return true; return v1 === v2; } syntax // added in spidermonkey 45 bool js_samevalue(jscontext *cx, js::handle<js::value> v1, js::handle<js::value> v2, bool *same); // obsolete since jsapi 39 bool js_samevalue(jscontext *cx, jsval v1, jsval v2, bool *same); name type ...
JS_SetCallReturnValue2
causes a native to return a reference value (as allowed by ecma 262-3 §11.2.3).
JS_SetCompartmentNameCallback
callback jscompartmentnamecallback callback function which will be called to name each compartment (see below).
JS_SetContextCallback
cxcallback jscontextcallback pointer to the callback function, described below.
JS_SetDestroyCompartmentCallback
callback jsdestroycompartmentcallback callback function which will be called for each compartment being destroyed (see below).
JS_SetErrorReporter
er jserrorreporter the user-defined error reporting function to use in your application, described below.
JS_SetExtraGCRoots
this is described below.
JS_SetGCZeal
the drawback is that gc zeal can cause javascript code to run extremely slowly.
JS_SetInterruptCallback
description these functions allow setting an interrupt callback that will be called from the js thread some time after any thread triggered the callback using js_requestinterruptcallback.
JS_SetObjectPrincipalsFinder
description js_setobjectprincipalsfinder allows the application to set a callback that the javascript engine uses to obtain an object's principals.
JS_SetOperationCallback
description these functions allow setting an operation callback that will be called from the js thread some time after any thread triggered the callback using js_triggeroperationcallback.
JS_SetPropertyAttributes
it is the bitwise or of zero or more of the following values: flag purpose jsprop_enumerate property is visible in for and in loops.
JS_SetThreadStackLimit
enable or disable checks to avoid overflowing the c stack.
JS_StringToVersion
js_stringtoversion may return any of the following values: string enumeration "1.0" jsversion_1_0 obsolete since jsapi 24 "1.1" jsversion_1_1 obsolete since jsapi 24 "1.2" jsversion_1_2 obsolete since jsapi 24 "1.3" jsversion_1_3 obsolete since jsapi 24 "1.4" jsversion_1_4 obsolete since jsapi 24 "ecmav3" jsversion_ecma_3 "1.5" jsversion_1_5 obsolete since jsapi 24 "1.6" jsve...
JS_TracerInit
callback jstracecallback a callback, described below, which the tracing apis will call each time a pointer is found from one gc thing to another.
JS_ValueToNumber
js_valuetonumber carries out the following steps to convert it to a number.
JS_ValueToString
js_valuetostring uses the steps below to convert it to a string.
JS_VersionToString
js_versiontostring may return any of the following values: enumeration string jsversion_1_0 "1.0" obsolete since jsapi 24 jsversion_1_1 "1.1" obsolete since jsapi 24 jsversion_1_2 "1.2" obsolete since jsapi 24 jsversion_1_3 "1.3" obsolete since jsapi 24 jsversion_1_4 "1.4" obsolete since jsapi 24 jsversion_ecma_3 "ecmav3" jsversion_1_5 "1.5" obsolete since jsapi 24 jsversi...
Stored value
js_defineproperty allows the application to specify a property's initial stored value.
jsint
uintn; // following types are still provides in js/public/legacyinttypes.h, // but should not use them.
JSDBGAPI
js_connectshark js_disconnectshark js_startchudremote js_stopchudremote the following jsnative functions can be used to expose the above four apis to scripts.
Profiling SpiderMonkey
if you'd like to profile something at a higher level of detail than the js shark functions allow, there are corresponding c functions available at the bottom of jsdbgapi.h.
SpiderMonkey 45
it also contains new language and api features described in detail below.
SpiderMonkey 52
it also contains new language and api features described in detail below.
SavedFrame
including and excluding chrome frames consider the following savedframe stack.
SpiderMonkey: The Mozilla JavaScript runtime
pidermonkey internals: gc separate internals article on the gc spidermonkey internals: hacking tips collection of helpful tips & tools for hacking on the engine related topics javascript foss projects using or based on spidermonkey releases spidermonkey release notes current and past versions: 52, 45, 38, 31, 24, 17 community mailing list spidermonkey questions on stack overflow report a bug ...
Zest runtimes
the following runtimes are available: java https://github.com/mozilla/zest - this is the reference implementation the following runtimes are planned or an an early stage of implementation: https://github.com/mozilla/zest/tree/master/js javascript https://github.com/darkowlzz/zest-runner https://github.com/darkowlzz/zest-cli - this is the zest-cli of js based runner.
Zest tools
the following tools currently support zest: owasp zed attack proxy the zap add-on allows the user to create, edit and run zest scripts.
Zest usecase: Reporting Security Vulnerabilities to Developers
while it will still be necessary to describe vulnerabilities, zest allows security teams to create reproducible test cases which they can then share with the developers.
compare-locales
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
downloading the software and running python setup.py develop will allow you to do import mozinfo from python.
The Rust programming language
to learn more about rust, you can: watch the videos below for a closer look at the power and benefits rust provides.
Exploitable crashes
next steps once you've determined that a crash is potentially exploitable, take the following steps.
Pinning violation reports
it allows site operators to specify who can issue valid certificates for them, rather than accepting any one of the hundreds of built-in root certificates that ship with your browser.
Browser security
secure development guidelinesthe following content will likely see significant revision, though can be used as a reference for security best practices to follow when developing code for mozilla.security and the jar protocolthis article discusses security concerns with the jar: protocol, which only firefox has ever implemented for web content.
Gecko object attributes
note some widgets which appear to be checkboxes might in fact be cyclers (see "cycles" below).
ROLE_TABLE
also refer to the following roles: role_columnheader, role_rowheader, role_column, role_row, role_cell.
Implementation Details
please refer to pages below for interesting at api: msaa ia2 at-spi differences with other applications this section provides information about implementation differences between gecko based applications and other applications.
AT APIs Support
this is done to ensure a common look and feel across all supported platforms, and to allow for different skins (appearances).
The Places database
periodically at runtime, the following happens to expire pages: expire visits that are older than the history expiration threshold.
Frecency algorithm
ts) example this is an example of a frecency calculation for a uri that is bookmarked and has been visited twice recently (once yesterday, and once last week by clicking a link), and two other times more than 90 days ago: 0 default score +140 100 * (140/100.0) - first bucket weight and bookmarked bonus +84 70 * (120/100.0) - second bucket weight and followed-link bonus +14 10 * (140/100.0) - fifth bucket weight and bookmarked bonus +14 10 * (140/100.0) - fifth bucket weight and bookmarked bonus -- 252 (4 * 252 / 4) - final frecency score notes the number of sampled visits is min(10 most recent visits pref, total visit counts).
Retrieving part of the bookmarks tree
otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser.
Using the Places favicon service
this allows efficient caching, since the default favicon will probably be cached in its decoded form by the image library.
places.sqlite Database Troubleshooting
in some cases, this procedure may allow you to recover the corrupt file along with all of its contents (history).
extISessionStorage
this content covers features introduced in thunderbird 3 extisessionstorage allows an extension to store data for the life time of the application (e.g.
Toolkit API
nsion packaging: specific information about how to package extensions theme packaging: specific information about how to package themes multiple-item extension packaging: specific information about multiple-item extension xpis xul application packaging: specific information about how to package xulrunner applications chrome registration printing in xul apps see also the following developer pages contain examples and discussions of particular topics: xul xul overlays developing extensions xulrunner developing themes dom rdf storage ...
Aggregating the In-Memory Datasource
the basic idea is to overload queryinterface(), allowing it to return adelegate object that supports the interface.
Bundling multiple binary components
background binary xpcom components are sometimes required to implement low-level features for extensions.
Creating a Python XPCOM component
for example: % cd c:\mozilla\bin\python\xpcom % python xpt.py nsisample class nsisample: _com_interfaces_ = xpcom.components.interfaces.nsisample # if this object needs to be registered, the following 2 are also needed.
Fun With XBL and XPConnect
the basic model of interaction is as follows: binding to the xpcom object the widget holds onto an xpcom object that is the auto complete engine that will perform our auto complete lookups.
XPCOM glue
MozillaTechXPCOMGlue
it allows developers to link only against the frozen xpcom method symbols and maintain compatibility with multiple versions of xpcom.
XPCOM hashtable guide
there are a number of builtin hash keys available in nshashkeys.h, the more useful of which are listed below.
How to build a binary XPCOM component using Visual Studio
then make the following tweaks: add "..\gecko-sdk\include" to additional include directories add "..\gecko-sdk\lib" to additional library directories add "nspr4.lib xpcom.lib xpcomglue_s.lib" to additional dependencies add "xp_win;xp_win32″ to preprocessor definitions turn off precompiled headers (just to keep it simple) use a custom build step for the xpcom idl file (spawns xpidl-build.bat to process the id...
How To Pass an XPCOM Object to a New Window
to access the xpcom object from the window's code, you can access the window.arguments[] array, as shown in the example below: components.utils.reporterror(string(window.arguments[0])); this will produce output similar to "[xpconnect wrapped nsimyxpcomobject]".
Interfacing with the XPCOM cycle collector
the approach you should take is as follows.
Components.classesByID
usage in order to retrieve the object for a given cid, you can use that cid as an index with components.classesbyid as follows: var clazz = components.classesbyid["{ed132c20-eed1-11d2-baa4-00805f8a5dd7}"]; ...
Components.interfaces
for example, assume we have the following interface declaration: interface nsifoo : nsisupports { const pruint32 myflag = 5; }; the constant myflag can then be accessed using var myflag = components.interfaces.nsifoo.myflag; ...
Components.lastResult
example in the following example, the local variable i contains the actual result returned by bar() (assuming that bar() is called via xpconnect), and components.lastresult contains the success code returned by bar().
Components.utils.unload
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.
Components object
the components object has the following members: classes array of classes by contractid classesbyid array of classes by cid constructor constructor for constructor of components exception constructor for xpconnect exceptions id constructor for xpcom nsids interfaces array of interfaces by interface name interfacesbyid array of interfaces by iid issuccesscode function t...
PyXPCOM
pyxpcom allows for communication between python and xpcom, such that a python application can access xpcom objects, and xpcom can access any python class that implements an xpcom interface.
RbXPCOM
you can find additional information using the resource links below.
Using components
any of the below can be accessed by components.blah (ie: components.issuccesscode) utils=[object nsxpccomponents_utils] interfaces=[object nsxpccomponents_interfaces] classes=[object nsxpccomponents_classes] results=[object nsxpccomponents_results] issuccesscode=function issuccesscode() { [native code] } constructor=[object nsxpccomponents_constructor] queryinterface=function queryinterface() { [native code] } in...
Profiling XPCShell
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).
Standard XPCOM components
there are a number of components provided in the standard implementation of xpcom; these are as follows.
NS_InitXPCOM2
some of the possible errors are documented below: ns_error_not_initialized indicates that static globals were not yet initialized, which may happen if this method is called before xpcom's static initialization code executes.
nsresult
because nsresult is strongly typed, code like the following will result in an error at compile time: bool foo() { ...
nsMemory
these routines allow easy access to xpcom's global nsimemory implementation without having to go through the service manager to get it.
RefPtr
xxx it's not clear that the details in the following paragraph are correct.
IAccessibleHypertext
if iaccessibletext is used to represent the text containing the link, then the character index is only valid if it is greater than or equal to zero and lower than the number of characters in the text.
amIInstallTrigger
the value of the property should either be a string url, or an object with the following properties: url for the add-on's url iconurl for an icon for the add-on hash for a hash of the add-on.
amIWebInstallInfo
toolkit/mozapps/extensions/amiwebinstalllistener.idlscriptable this interface is used by the default implementation of amiwebinstalllistener to communicate with the running application and allow it to warn the user about blocked installs and start the installs running.
amIWebInstallListener
methods onwebinstallblocked() called when the website is not allowed to directly prompt the user to install add-ons.
imgICache
use the following snippet to obtain a relevant image cache for a given document or channel (where relevantdocument is a document object that contains images you care about, or relevantchannel is an nsichannel that is used for fetching images): var tools = components.classes["@mozilla.org/image/tools;1"].getservice(components.interfaces.imgitools); var cache = tools.getimgcachefordocument(relevantdocument); // alternatively, tools.getimgcacheforchannel(relevan...
jsdIStackFrame
|true| if this context should be allowed to run scripts, |false| otherwise.
mozIAsyncHistory
toolkit/components/places/moziasynchistory.idlscriptable this interface allows you to add multiple visits to a single url in a batch.
mozIColorAnalyzer
remarks below are some images with the result of findrepresentativecolor: image representative color 0xb28d3a 0x502e1e 0x53ba3f 0x00a400 see also mozirepresentativecolorcallback bug 634139 ...
mozIStorageAsyncStatement
(mozistoragestatement can be used for both synchronous and asynchronous purposes.) this specialization for asynchronous operation allows us to avoid needing to acquire synchronization primitives also used by the asynchronous execution thread.
mozIStoragePendingStatement
the mozistoragependingstatement interface represents a pending asynchronous database statement, and offers the cancel() method which allows you to cancel the pending statement.
mozITXTToHTMLConv
unsigned long citeleveltxt(in wstring line, out unsigned long loglinestart) void findurlinplaintext(in wstring text, in long alength, in long apos, out long astartpos, out long aendpos) wstring scanhtml(in wstring text, in unsigned long whattodo) wstring scantxt(in wstring text, in unsigned long whattodo) constants conversion control attributes these bits allow you to control the conversion of text into html.
GetAccessibleAbove
see also nsiaccessible.getaccessibletoright() nsiaccessible.getaccessibletoleft() nsiaccessible.getaccessiblebelow() ...
GetAccessibleToLeft
see also nsiaccessible.getaccessibletoright() nsiaccessible.getaccessibleabove() nsiaccessible.getaccessiblebelow() ...
GetAccessibleToRight
see also nsiaccessible.getaccessibletoleft() nsiaccessible.getaccessibleabove() nsiaccessible.getaccessiblebelow() ...
nsIAccessibleImage
accessible/public/nsiaccessibleimage.idlscriptable this interface allows in-process accessibility clients to retrieve information about an image.
nsIAccessibleText
nsiaccessible getattributerange( in long offset, out long rangestartoffset, out long rangeendoffset ); parameters offset rangestartoffset rangeendoffset return value getcharacteratoffset() it would be better to return an unsigned long here, to allow unicode chars > 16 bits.
nsIAppShell
runinstablestate() allows running of a "synchronous section", in the form of an nsirunnable once the event loop has reached a "stable state".
nsIAppShellService
follow this bug - bugzilla - bug 1280028 nsiwebnav createwindowlessbrowser( in bool aischrome ); var webnav = services.appshell.createwindowlessbrowser(true); var docshell = webnav.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.nsidocshell); var systemprincipal = cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); docshell.createaboutblankcontentviewer(systemprincipal...
nsIAsyncVerifyRedirectCallback
if this is ns_succeeded the redirect has been allowed by all consumers.
nsIAuthInformation
this string will always be in lowercase.
nsIAuthModule
req_delegate (1 << 1) the server is allowed to impersonate the client.
nsIAuthPrompt
netwerk/base/public/nsiauthprompt.idlscriptable this interface allows the networking layer to pose a user/password prompt to obtain the values needed for authentication.
nsIAuthPrompt2
netwerk/base/public/nsiauthprompt2.idlscriptable an interface allowing to prompt for a username and password.
nsIAuthPromptProvider
exceptions thrown ns_error_not_available if no prompt is allowed or available for the given reason.
nsIBlocklistPrompt
these are javascript objects with properties: name - the plugin or extension name version - the version of the extension or plugin icon - the plugin or extension icon disable - can be used by the nsiblocklistprompt to allows users to decide whether a soft-blocked add-on should be disabled blocked - true if the item is hard-blocked, false otherwise item - the nsiplugintag or addon object acount optional the number of addons.
nsICache
allows the cache entry to be stored in any device.
nsICommandLine
this flag allows the default action to be prevented.
nsIComponentManager
a "bootstrapped" chrome manifest supports some of the instructions allowed in a regular chrome manifest, see the chrome registration documentation for details.
nsIConsoleListener
xpcom/base/nsiconsolelistener.idlscriptable this interface allows you to listen for messages sent to the console.
nsIContentPrefObserver
dom/interfaces/base/nsicontentprefservice.idlscriptable this interface allows code to easily watch for changes to the values of content preferences.
nsIControllers
windows and text inputs have default controllers that allow commands such as cmd_copy to act on the focused element or window.
nsIConverterInputStream
this allows reading unicode strings from a stream, automatically converting the bytes from a selected character encoding.
nsIConverterOutputStream
xpcom/io/nsiconverteroutputstream.idlscriptable this interface allows writing strings to a stream, doing automatic character encoding conversion.
nsICrashReporter
only https and http urls are allowed, as the submission is handled by os-native networking libraries.
nsIDNSRecord
since a dns query may return more than one resolved ip address, the record acts like an enumerator, allowing the caller to easily step through the list of ip addresses.
nsIDOMChromeWindow
methods beginwindowmove() on some operating systems, we must allow the window manager to handle window dragging.
nsIDOMFile
this allows the file reference to be saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the internet connection is restored.
nsIDOMGeoPositionAddress
historical note, which is likely of no interest to most readers: the types of the attributes below all changed from string to domstring in gecko 1.9.2 beta 5.
nsIDOMHTMLSourceElement
last changed in gecko 1.9.1.2 inherits from: nsidomhtmlelement the source element allows authors to specify multiple media resources for media elements.
nsIDOMOfflineResourceList
the nsidomofflineresourcelist interface provides access to the application cache that allows web content's resources to be cached locally for use while offline.
nsIDOMOrientationEvent
the nsidomorientationevent interface describes the event that can be delivered to dom windows, providing information from the device's accelerometer, allowing code to determine the orientation of the device.
nsIDOMSimpleGestureEvent
the following events are generated: mozswipegesture - generated when the user completes a swipe across across the input device.
nsIDOMStorageEventObsolete
canbubblearg true if the event is allowed to bubble, otherwise false.
nsIDOMWindow2
inherits from: nsidomwindow last 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.
nsIDebug
this allows the debugger to be attached before the software break.
nsIDownloadProgressListener
rather, the developer must create an object with the methods provided below to implement it.
nsIDragSession
this allows chrome to handle a drag that was refused by content.
nsIDynamicContainer
containers should follow these when possible, for example, whether to expand queries, etc.
nsIEnvironment
note: * for unix/linux platforms we follow the unix definition: an environment variable exists when getenv() returns a non-null value.
nsIErrorService
xpcom/base/nsierrorservice.idlscriptable this is a service that allows nsresult codes to be mapped to string bundles that can be used to look up error messages.
ExtensionManager (Toolkit)
the extensionmanager follows the nsiextensionmanager api.
nsIFTPEventSink
last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void onftpcontrollog(in boolean server, in string msg) methods onftpcontrollog allows a consumer to receive a log of the ftp control connection conversation.
nsIFactory
xpcom/components/nsifactory.idlscriptable this interface is a class factory that allows for the creation of nsisupports derived classes without specifying a concrete class type.
nsIFaviconService
this allows you to avoid trying to load "foo.com/favicon.ico" for every page on a site that doesn't have a favicon.
nsIFeed
textinput nsiwritablepropertybag2 information about a text box that can be displayed along with the feed by aggregators that support it, to allow the reader to send a response back to the source of the feed.
nsIFeedEntry
toolkit/components/feeds/public/nsifeedentry.idlscriptable this interface describes a single entry in an rss or atom news feed, providing attributes allowing access to the entry's data.
nsIFeedProgressListener
programs using the feed content access api do not have to implement any of these callbacks; they are optional, but allow you to provide feedback during the parsing process.
nsIFeedResult
this value will be one of the following: atom, rss2, rss09, rss091, rss091userland, rss092, rss1, atom03, atomentry, rssitem methods registerextensionprefix() registers a prefix for a namespace used to access an extension in the feed or entry.
nsIFileOutputStream
the deferred open will be performed when one of the following is called: seek() tell() write() flush() 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.
nsIFilePicker
filterallowurls 0x80 allow urls.
nsIFileStreams
the nsifilestreams interface is an input stream that allows you to read from a file.
nsIFileURL
the setter clones the nsifile object (allowing the caller to safely modify the nsifile object after setting it on this interface).
nsIFrameLoader
this can be used to decide what operations may or may not be allowed on the loader's docshell.
nsIFrameLoaderOwner
exceptions thrown ns_error_dom_security_err if the swap is not allowed on security grounds.
nsIFrameMessageListener
called to deliver a message to the frame handling process; called with one parameter, which has the following properties: name the name of the message.
nsIHTMLEditor
void setbackgroundcolor( in astring acolor ); parameters acolor the html color string, such as "#ffccff" or "yellow" setbodyattribute() set an attribute on the document's <body> element such as text, link, background colors.
nsIHTTPHeaderListener
modules/plugin/base/public/nsihttpheaderlistener.idlscriptable this interface allows plugin authors to access http response headers after issuing an nsipluginhost.geturl or nsipluginhost.posturl call.
nsIINIParser
ini sections are * defined by square brakets and look like this: [settings] * all entries below such a section definition belong to that * section (until the next section).
nsIINIParserFactory
example obtaining a parser object to obtain a parser for an ini file, you can use code that looks like this: to get an nsiiniparser instance for an ini file, you may use the following code: // create an nsilocalfile var cl = "@mozilla.org/file/local;1"; var interf = components.interfaces.nsilocalfile; var file = components.classes[cl].createinstance(interf); // init the file with the path to your ini file var path = "c:\\temp\\example.ini"; file.initwithpath(path); // create the nsiiniparserfactory var cl = "@mozilla.org/xpcom/ini-parser-factory;1"; var interf = component...
nsIInterfaceRequestor
nsiinterfacerequestor, however, allows you to obtain an interface c from a that may (or most likely) will not have the ability to get back to a.
nsIJSID
inherits from: nsisupports last changed in gecko 1.9 (firefox 3) the following methods return objects that implement this interface: components.interfaces.name components.classes[contract] components.interfacesbyid[uuid] components.classesbyid[cid] the first two cases create a named jsid while the last two cases create an unnamed jsid.
nsIJetpack
the first argument passed to it is the name of the message, and all arguments following it are either json-serializable types or handles.
nsILivemarkService
being able to manually control this allows activity such as bookmarks import to occur without kicking off http traffic.
nsILoginManager
this does not follow the same requirements as findlogins() for those fields; wildcard matches are not specified.
nsIMessageListener
the received message is an object with the following properties: target the target of the message.
nsIMimeConverter
the nsimimeconverter service allows you to convert headers into and out of mime format.
nsIMsgCustomColumnHandler
the nsimsgcustomcolumnhandler interface allows you to create custom handlers for columns.
nsIMsgDBViewCommandUpdater
updatenextmessageafterdelete() allows the backend to tell the front end to re-determine which message we should select after a delete or move void updatenextmessageafterdelete(); parameters none.
nsIMsgHeaderParser
removealiasestome allows the address parser to use the preference which contains regular expressions which also mean 'me' for the purpose of stripping the user's email address(es) out of addrs string removeduplicateaddresses( in string addrs, in string other_addrs, in prbool removealiasestome ); parameters addrs the addresses to remove duplicates from.
nsIMsgIncomingServer
by default this value is set to true via global pref 'allows_specialfolders_usage' (mailnews.js).
nsIMsgProtocolInfo
specialfoldersdeletionallowed boolean true if the user can delete folders like inbox, trash, etc.
nsIMsgSearchCustomTerm
* recommended form: extensionname@example.com#termname * commas and quotes are not allowed, the id must not * parse to an integer, and names of standard search * attributes in searchattribentrytable in nsmsgsearchterm.cpp * are not allowed.
nsIMsgSearchSession
the nsimsgsearchsession interface allows you to create and manipulate search sessions within thunderbird.
nsIObserver
example the following code is an implementation of nsiobserver that is registered to receive notifications for the "mytopicid" topic.
nsIPluginHost
the result will be in the following format.
nsIPrefBranch2
on preference changes, the following arguments will be passed to nsiobserver.observe(): asubject - the nsiprefbranch object (this).
nsIPrefService
the preference service is directly responsible for the management of the preferences files and also facilitates access to the preference branch object which allows the direct manipulation of the preferences themselves.
nsIPushSubscription
the following key names are supported: p256dh the ecdh public key, used as the input keying material in the hkdf invocation during encryption.
nsIResumableChannel
in both of these cases, no ondataavailable will be called, and onstoprequest will immediately follow with the same status code.
nsISHistory
to access individual history entries of the enumerator, perform the following steps: call getshistoryenumerator() to obtain handle the nsisimpleenumerator object.
nsIScreen
each call to this method must eventually be followed by a corresponding call to unlockminimumbrightness() with the same value for the brightness parameter.
nsIScriptableInputStream
note: the init method may be called more than once, allowing a nsiscriptableinputstream instance to be reused.
nsIScriptableUnicodeConverter
this legacy api represents binary data using the lower haft of each 16-bit code unit in a javascript string.
nsISearchEngine
this allows the search service to provide a different nsisearchsubmission depending on e.g.
nsISelectionController
note: if issynchronous is true, calling this method may flush the pending reflow.
nsISocketProvider
methods native code only!addtosocket this function is called to allow the socket provider to layer a prfiledesc (a file descriptor) on top of another prfiledesc.
nsITXTToHTMLConv
netwerk/streamconv/public/nsitxttohtmlconv.idlscriptable this interface allows you to modify the conversion from plain text to html.
nsITaskbarPreview
the controller is not allowed to be null.
nsITaskbarPreviewButton
these buttons are displayed below the window preview.
nsITaskbarPreviewController
this doesn't need to match the preview's aspect ratio, and is allowed to be changed at any time.
nsITaskbarTabPreview
an application may have as many tab previews as memory allows.
nsITextInputProcessorNotification
see type values below.
nsIThread
warning: calling nsithread.processnextevent allows network and ui events to run which can modify data structures that your code isn't expecting to be modified during a synchronous method call.
nsIThreadObserver
maywait true if the method is allowed to block the calling thread.
nsIThreadPool
threadlimit unsigned long the maximum number of threads allowed at once in the pool; you may change this value by altering this attribute.
nsIToolkitProfileService
to access the service, you can use the following code: var toolkitprofileservice = components.classes["@mozilla.org/toolkit/profile-service;1"] .createinstance(components.interfaces.nsitoolkitprofileservice); prior to gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service.
nsITransactionManager
this mode allows an application to execute and group together several independent transactions so they can be undone with a single call to undotransaction().
nsITreeBoxObject
this must be followed by calling endupdatebatch(), otherwise the tree will get out of sync.
nsIURIFixup
fixup_flag_allow_keyword_lookup 1 allow the fixup to use a keyword lookup service to complete the uri.
nsIURIFixupInfo
the input is an invalid uri and fixup_flag_allow_keyword_lookup is not passed).
nsIURLFormatter
mozilla applications linking to mozilla websites are strongly encouraged to use urls of the following format: http[s]://%service%.mozilla.[com|org]/%locale%/ method overview astring formaturl(in astring aformat); astring formaturlpref(in astring apref); methods formaturl() formats a string url.
nsIURLParser
netwerk/base/public/nsiurlparser.idlscriptable specifies the interface to an url parser that attempts to follow the definitions of rfc 2396.
nsIUTF8StringEnumerator
xpcom/ds/nsistringenumerator.idlscriptable an object can implement this interface to allow a client to iterate over a set of strings provided by the object.
nsIUpdate
this allows the user to never receive a notification for that specific update version again.
nsIUserCertPicker
inherits from: nsisupports last changed in gecko 1.7 method overview nsix509cert pickbyusage(in nsiinterfacerequestor ctx, in wstring selectednickname, in long certusage, in boolean allowinvalid, in boolean allowduplicatenicknames, out boolean canceled); methods pickbyusage() nsix509cert pickbyusage( in nsiinterfacerequestor ctx, in wstring selectednickname, in long certusage, in boolean allowinvalid, in boolean allowduplicatenicknames, out boolean canceled ); parameters ctx selectednickname certusage allowinvalid allowduplicatenicknames canceled return value ...
nsIVersionComparator
the service can be accessed directly via services.vc after loading services.jsm or with the following code: var versioncomparator = components.classes["@mozilla.org/xpcom/version-comparator;1"] .getservice(components.interfaces.nsiversioncomparator); method overview long compare(in acstring a, in acstring b); methods compare() compare two version strings.
nsIWeakReference
it allows a consumer to hold an indirect, non-owning reference to an xpcom object.
nsIWebBrowserChrome
chrome_window_lowered 67108864 represent special cases.
nsIWebBrowserFindInFrames
searchparentframes boolean whether to allow the search to propagate out of the currentsearchframe into its parent frame(s).
nsIWebPageDescriptor
docshell/base/nsiwebpagedescriptor.idlscriptable this interface allows content being displayed in one window to be loaded into another window without refetching it from the network.
nsIWebProgress
constants the following flags may be combined to form the anotifymask parameter for the addprogresslistener() method.
nsIWebSocketChannel
status codes the following values are permitted status codes.
nsIWinAppHelper
returns true only if all the following conditions are all true at once: the operating system is at least windows vista user account control is enabled the user is an administrator the application is not already running with elevated permissions otherwise it returns false.
nsIWindowsRegKey
it is still possible to enumerate values that have other types (that is, getvaluetype() may return a type not defined below).
nsIWorker
methods postmessage() used to allow the worker to send a message back to the web application that created it.
nsIWorkerGlobalScope
this interface allows a worker to look up information about itself, as well as to control itself.
nsIWorkerMessagePort
dom/interfaces/threads/nsidomworkers.idlscriptable this interface represents a worker thread's message port, which is used to allow the worker to post messages back to its creator.
nsIWorkerScope
methods close() allows the worker to terminate itself.
nsIXMLHttpRequest
when using the xpcom interface, as seen below in example 2, we can get access to this.
nsIXMLHttpRequestEventTarget
onloadend nsidomeventlistener a javascript function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event.
nsIXULAppInfo
only the following characters are allowed: a-z a-z 0-9 - .
nsIXULRuntime
xpcom/system/nsixulruntime.idlscriptable provides information about the xul runtime to allow extensions and xul applications to determine information about the xul runtime.
nsIXULSortService
asorthints one or more hints as to how to sort: ascending: sort the contents in ascending order descending: sort the contents in descending order comparecase: perform case sensitive comparisons integer: treat values as integers, non-integers are compared as strings twostate: do not allow the natural (unordered state) see also nsixultemplatequeryprocessor ...
nsIXmlRpcClient
return value will be converted as follows: i4 or int: nsisupportsprint32 boolean: nsisupportsprbool string: nsisupportscstring double: nsisupportsdouble datetime.iso8601: nsisupportsprtime base64: nsisupportscstring array: nsisupportsarray struct: nsidictionary faults (server side errors) are indicated by returning ns_error_failure.
nsIZipWriter
recursively add all contents of a directory to zip file this example below can be copied and pasted into your scratchpad, set the environment to "browser" and can run.
nsMsgPriorityValue
defined in comm-central/ mailnews/ base/ public/ mailnewstypes2.idl typedef long nsmsgpriorityvalue; [scriptable, uuid(94c0d8d8-2045-11d3-8a8f-0060b0fc04d2)] interface nsmsgpriority { const nsmsgpriorityvalue notset = 0; const nsmsgpriorityvalue none = 1; const nsmsgpriorityvalue lowest = 2; const nsmsgpriorityvalue low = 3; const nsmsgpriorityvalue normal = 4; const nsmsgpriorityvalue high = 5; const nsmsgpriorityvalue highest = 6; // the default for a priority picker const nsmsgpriorityvalue default = 4; }; ...
nsMsgSearchOp
is also applies */ const nsmsgsearchopvalue islowerthan = 8; const nsmsgsearchopvalue beginswith = 9; const nsmsgsearchopvalue endswith = 10; const nsmsgsearchopvalue soundslike = 11; /* for ldap phoenetic matching */ const nsmsgsearchopvalue ldapdwim = 12; /* do what i mean for simple search */ const nsmsgsearchopvalue isgreaterthan = 13; const nsmsgsearchopvalue islessthan = 14; const nsmsgsearch...
NS_IF_RELEASE
ns_if_release is exactly equivalent to the following function: inline void ns_if_release(nsisupports* foo) { if (foo) foo->release(); foo = 0; } syntax ns_if_release(foo); see also ns_addref, ns_release ...
XPCOM primitive
all xpcom primitives are scriptable, and they all implement an xpcom interface from the table below.
NS_CStringAppendData
this is a low-level api.
NS_CStringCutData
this is a low-level api.
NS_CStringGetMutableData
example // convert any uppercase ascii letters to lowercase void tolowercase(nscstring &str) { char *iter; pruint32 len = ns_cstringgetmutabledata(str, pr_uint32_max, &iter); char *end = iter + len; while (iter != end) { char c = *iter; if (c >= 'a' && c <= 'z') *iter = c + ('a' - 'a'); ++iter; } } history this function was finalized for mozilla 1.8.
NS_CStringInsertData
this is a low-level api.
NS_CStringSetData
this is a low-level api.
NS_CStringSetDataRange
this is a low-level api.
NS_StringAppendData
this is a low-level api.
NS_StringContainerFinish
this is a low-level api.
NS_StringContainerInit
this is a low-level api.
NS_StringCutData
this is a low-level api.
NS_StringGetData
this is a low-level api.
NS_StringInsertData
this is a low-level api.
NS_StringSetData
this is a low-level api.
NS_StringSetDataRange
this is a low-level api.
nsMsgSearchOpValue
is also applies */ 160 const nsmsgsearchopvalue islowerthan = 8; 161 162 const nsmsgsearchopvalue beginswith = 9; 163 const nsmsgsearchopvalue endswith = 10; 164 165 const nsmsgsearchopvalue soundslike = 11; /* for ldap phoenetic matching */ 166 const nsmsgsearchopvalue ldapdwim = 12; /* do what i mean for simple search */ 167 168 const nsmsgsearchopvalue isgreaterthan = 13; 169 const nsmsgsearchopvalue islessthan = 14; ...
The Thread Manager
nsithreadeventfilter this interface is used by the nsithreadinternal.pusheventqueue() method in nsithreadinternal to allow event filtering.
XPCOM Thread Synchronization
} am.wait(); pr_notifycondvar(mcvar); } new usage using namespace mozilla; concurrentmethod() { mutexautolock al(mlock); monitorautoenter am(mmonitor); if (needexpensivecomputation()) { mutexautounlock au(mlock); } am.wait(); mcvar->notify(); } mozilla synchronization api reference the mozilla:: namespace exports the following synchronization primitives.
Frequently Asked Questions
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".
XPCOM category image-sniffing-services
in firefox 3, a new xpcom category was added in bug 391667 to allow "third-party" xpcom components to identify images based on their content.
nsCOMPtr versus RefPtr
it differs from do_queryinterface as follows: do_queryobject inherits from nscomptr_helper, so it can be assigned into both nscomptr and refptr.
xpidl
MozillaTechXPIDLxpidl
the xpidl compiler is now part of the build process, allowing us to generate headers used by the xpcom components.
XTF
MozillaTechXTF
the extensible tag framework (xtf) allows adding support for new namespaces using xpcom components to mozilla (written in javascript or c++).
Xray vision
these rules are demonstrated in the script below, which evaluates a script in a sandbox, then examines the object attached to the sandbox.
nsIMsgCloudFileProvider
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.
Mail client architecture overview
the base module consists of the following basic building blocks account management - the account manager is the root object of the server/folder/message hierarchy.
Mailbox
this may seem like a lot of infrastructure just to read messages from a flat file, but it allows us to do it asynchronously, and to have reading local messages fit into the same kind of mechanisms that reading nntp and imap messages do - running urls, getting onstart/stoprunningurl notifications when the url starts/stops, etc.
Thunderbird Configuration Files
if you don't already have one, consider running the following code in a terminal.
Building a Thunderbird extension 1: introduction
the tutorial has the following pages: introduction (this page) the extension filesystem (setting up your local system) install manifest (the install.rdf file that contains meta-information about the extension) chrome manifest (list of packages and overlays) xul (the xml user interface language that is used to modify the thunderbird user interface) adding javascript (explains how to add some simple javascript to your...
Building a Thunderbird extension 2: extension file layout
when this tutorial is finished, our extension will look like this: myfirstext.xpi: //created in step 8 /install.rdf //created in step 3 /chrome.manifest //created in step 4 /chrome/ /content/ /content/myhelloworld.xul //created in step 5 /content/overlay.js //created in step 6 /chrome/locale/* //building an extension# localization /chrome/skin/ /defaults/preferences/ //building an extension# defaults files the following tutorial pages will explain how to write each of these files (except locale/ and ...
Demo Addon
all three demos are explained in the following sections.
Finding the code for a feature
as an example, i received the following inquiry, and i decided to follow my usual path and document what i do: hello i would like to add colours and tags to specific emails...by using nsimsgtagservice, can this be done?
Access StringBundle from Overlay
the most efficient way to append these strings is by attaching them to an existing stringbundleset as such: <stringbundleset id="stringbundleset"> <stringbundle src="chrome://your_extension/locale/overlay.properties" id="your-extension-strings" /> </stringbundleset> now that your stringbundle is attached you can access it from javascript as follows: var str = document.getelementbyid("your-extension-strings"); //get the stringbundle object itself str.getstring("propertyname"); //get a string (and do something with it) alternative way let stringbundleservice = cc["@mozilla.org/intl/stringbundle;1"].getservice(ci.nsistringbundleservice); let bundle = stringbundleservice.createbundle("chrome://your_extensi...
Filter Incoming Mail
by example, setting it to lower case subject = subject.tolocalelowercase(); // then we rebuild a subject objet by rencoding the string // and assign it to the message headers and we're done amsghdr.subject = mimeconvert.encodemimepartiistr_utf8(subject, false, "utf-8", 0, 72); } } }; function init() { var notificationservice = components.classes["@mozilla.org/messenger/msgnotificationserv...
Get Thunderbird version
on thunderbird version 3.0b3pre and later, you can use the following snippet to get the thunderbird version.
Tips and Tricks from the newsgroups
the following discussions on mozilla.dev.apps.thunderbird and mozilla.dev.extensions include useful tips for thunderbird add-on developers.
Thunderbird extensions
the following documentation provides help for creating extensions for the thunderbird email client.
Using MAPI with Thunderbird's Windows 7 developer builds
mapi (messaging application programming interface) is a windows feature that allows applications to send files via a system's default mail application.
Using popup notifications
implementing a timeout function for the popup notification you can use a timeout to make your notification automatically disappear after some amount of time, by calling notification.remove() as shown below.
Examples
lightweight bridge for calling cocoa frameworks from javascript, js-macosx transparently handles definition of cocoa api, both c and objective-c, and provides automatic declarations for framework functions, structures, constants and enumerations, as well as allows creating and subclassing cocoa classes.
Memory Management
keeping objects alive the following js-ctypes objects will hold references to objects, keeping them alive.
ctypes.open
see: http://stackoverflow.com/questions/19382201/how-to-load-dll-from-sdk-addon-data-folder it is important to note that custom native files cannot be loaded through chrome:// or resource:// uris.
ABI
a calling convention is an implementation-level (low-level) scheme regarding how subroutines receive parameters from their caller and how they revert.
CData
in theory, in other words, the following javascript expression should return a copy of the original cdata object: eval(dataobject.tosource()); tostring() returns a string identifying the data.
Library
declare() declares an api from the native library, allowing it to be used from javascript.
js-ctypes reference
first, they provide a concrete representation of different data types, allowing the programmer to describe the arguments and return type of a native function (see library.declare()).
Blocking By Domain - Plugins
in order to improve site performance and reduce the number of plugin prompts that users see, popular sites that show unnecessary plugin prompts or slow the browser down with unnecessary plugins will be added to the plugin block list.
Memory - Plugins
the npn_memalloc method has the following syntax: void *npn_memalloc (uint32 size); the size parameter is an unsigned long integer that represents the amount of memory, in bytes, to allocate in the browser's memory space.
Scripting plugins - Plugins
the new npnvariable enumerations are defined in npapi.h as: npnvwindownpobject = 15, npnvpluginelementnpobject = 16 how to call plugin native methods the following html code will do the job: <embed type="application/plugin-mimetype"> <script> var embed = document.embeds[0]; embed.nativemethod(); alert(embed.nativeproperty); embed.nativeproperty.anothernativemethod(); </script> the api extensions the api extensions are based on four new structs: npstring npvariant npn_releasevariantvalue npn_getstringidentifier npn_getstringide...
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.
Plugins
tutorials and references the articles below are developer information about the developing for click-to-play, and plugin blocking.
Preferences System
reference information about them is available below: preferences system documentation: introduction: getting started | examples | troubleshooting reference: prefwindow | prefpane | preferences | preference | xul attributes use code for a typical preferences window may look like this: <prefwindow id="apppreferences" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="pane1" label="&pane1.title;"> <preferences> <preference id="pref1" name="pref.na...
Browser Toolbox - Firefox Developer Tools
altogether you will have access to the following developer tools: debugger (note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger.) console style editor performance network monitor page inspector accessibility inspector you can debug chrome: and about: pages using the normal debugger, just as if they were ordinary content pages.
Debug worker threads - Firefox Developer Tools
inspecting worker code for example, see the selected item worker.js below — it is listed in a separate thread in the sources list, but appears in the source pane in the same way as main thread code when selected.
Access debugging in add-ons - Firefox Developer Tools
the following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): window.addeventlistener("debugger:editorloaded") - called when the read-only script panel loaded.
Debug eval sources - Firefox Developer Tools
in the video below, we load a page containing a source like this: var script = `function foo() { console.log('called foo'); } //# sourceurl=my-foo.js`; eval(script); var button = document.getelementbyid("foo"); button.addeventlistener("click", foo, false); the evaluated string is given the name "my-foo.js" using the //# sourceurl directive.
Search - Firefox Developer Tools
for example, if i enter "load" when viewing the above list, i get the following: only the functions with load in their name are shown.
Set watch expressions - Firefox Developer Tools
each time it does, the box will flash briefly yellow.
Set event listener breakpoints - Firefox Developer Tools
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.
Source map errors - Firefox Developer Tools
there are a few common ways that source maps can go wrong; they are detailed in the following sections.
The Firefox JavaScript Debugger - Firefox Developer Tools
how to to find out what you can do with the debugger, refer to the following how-to guides.
Measure a portion of the page - Firefox Developer Tools
when you stop holding the mouse down, the rectangle that was displayed on screen when you released the button will stay there until you click again, allowing you time to take screenshots, note the information down, etc.
Performance Analysis - Firefox Developer Tools
network monitor features the following articles cover different aspects of using the network monitor: toolbar network request list network request details network traffic recording throttling ...
Network Monitor - Firefox Developer Tools
ui overview the ui is divided into four main pieces: the main screen contains the toolbar, the network request list, and the network request details pane: the performance analysis view is a separate screen: working with the network monitor the following articles cover different aspects of using the network monitor: toolbar network request list network request details network traffic recording performance analysis throttling ...
Edit CSS filters - Firefox Developer Tools
you can save the current filter to the preset list: click to edit the filter, display the preset list by clicking the icon as shown below.
Animation inspector example: CSS transitions - Firefox Developer Tools
</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%); 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")) ...
Animation inspector example: Web Animations API - Firefox Developer Tools
id="icon"/> <span id="note">firefox developer 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'}, { op...
Page Inspector - Firefox Developer Tools
how to to find out what you can do with the inspector, see the following how to guides: open the inspector examine and edit html examine and edit the box model inspect and select colors reposition elements in the page edit fonts visualize transforms use the inspector api select an element examine and edit css examine event listeners work with animations edit css filters edit css shapes view background images use the inspector from the web console...
Allocations - Firefox Developer Tools
it includes the following columns: self count: the number of allocation-samples that were taken in this function (also shown as a percentage of the total) self bytes: the total number of bytes allocated in the allocation-samples in this function (also shown as a percentage of the total) rows are sorted by the "self bytes" column.
Shader Editor - Firefox Developer Tools
the screenshots below are from the unreal engine demo.
Extension Storage - Firefox Developer Tools
this table contains the following columns: key — the name of the stored item.
Tips - Firefox Developer Tools
storage inspector right-click the column headers to open a menu allowing to toggle the display of the columns.
Firefox Developer Tools
accessibility inspector provides a means to access the page's accessibility tree, allowing you to check what's missing or otherwise needs attention.
ANGLE_instanced_arrays - Web APIs
the angle_instanced_arrays extension is part of the webgl api and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type.
AbortSignal: abort event - Web APIs
bubbles no cancelable no interface event event handler onabort examples in the following snippets, we create a new abortcontroller object, and get its abortsignal (available in the signal property).
AbortSignal.aborted - Web APIs
syntax var isaborted = abortsignal.aborted; value a boolean examples in the following snippet, we create a new abortcontroller object, and get its abortsignal (available in the signal property).
AbortSignal.onabort - Web APIs
}; examples in the following snippet, we create a new abortcontroller object, and get its abortsignal (available in the signal property).
AbsoluteOrientationSensor - Web APIs
syntax var absoluteorientationsensor = new absoluteorientationsensor([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.
AbsoluteOrientationSensor - Web APIs
examples basic example the following example, which is loosely based on intel's orientation phone demo, instantiates an absoluteorientationsensor with a frequency of 60 times a second.
AbstractWorker.onerror - Web APIs
}; example the following code snippet shows creation of a worker object using the worker() constructor and setting up of an onerror handler on the resulting object: var myworker = new worker('worker.js'); myworker.onerror = function() { console.log('there is an error with your worker!'); } specifications specification status comment html living standardthe definition of 'abstractworker.onerror' in that specification.
Accelerometer.Accelerometer() - Web APIs
syntax var accelerometer = new accelerometer([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.onerror will be called.
Accelerometer.x - Web APIs
WebAPIAccelerometerx
in the example below this occurs sixty times a second.
Accelerometer.y - Web APIs
WebAPIAccelerometery
in the example below this occurs sixty times a second.
Accelerometer.z - Web APIs
WebAPIAccelerometerz
in the example below this occurs sixty times a second.
Accelerometer - Web APIs
in the example below this occurs sixty times a second.
AesCtrParams - Web APIs
the counter must be big enough that it doesn't wrap: if the message is n blocks and the counter is m bits long, then the following must be true: n <= 2m.
AesGcmParams - Web APIs
according to the web crypto specification this must have one of the following values: 32, 64, 96, 104, 112, 120, or 128.
Ambient Light Events - Web APIs
it allows them to react to such a change, for example by changing the color contrast of the user interface (ui) or by changing the exposure necessary to take a picture.
AnalyserNode.fftSize - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.frequencyBinCount - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.getByteFrequencyData() - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.getByteTimeDomainData() - Web APIs
return value void | none example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.getFloatFrequencyData() - Web APIs
example const audioctx = new audiocontext(); const analyser = audioctx.createanalyser(); // float32array should be the same length as the frequencybincount const mydataarray = new float32array(analyser.frequencybincount); // fill the float32array with data returned from getfloatfrequencydata() analyser.getfloatfrequencydata(mydataarray); drawing a spectrum the following example shows basic usage of an audiocontext to connect a mediaelementaudiosourcenode to an analysernode.
AnalyserNode.getFloatTimeDomainData() - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
AnalyserNode.maxDecibels - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
AnalyserNode.smoothingTimeConstant - Web APIs
example the following example shows basic usage of an audiocontext to create an analysernode, then requestanimationframe and <canvas> to collect frequency data repeatedly and draw a "winamp bargraph style" output of the current audio input.
Animation() - Web APIs
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.
Animation.finished - Web APIs
examples the following code waits until all animations running on the element elem have finished, then deletes the element from the dom tree: promise.all( elem.getanimations().map( function(animation) { return animation.finished } ) ).then( function() { return elem.remove(); } ); specifications specification status comment web animationsthe definition of 'animatio...
Animation.id - Web APIs
WebAPIAnimationid
examples in the follow the white rabbit example, you can assign the rabbitdownanimation an id like so: rabbitdownanimation.effect.id = "rabbitgo"; specifications specification status comment web animationsthe definition of 'animation.id' in that specification.
Animation.onremove - Web APIs
examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replac...
Animation.pause() - Web APIs
WebAPIAnimationpause
example animation.pause() is used many times in the alice in web animations api land growing/shrinking alice game, largely because animations created with the element.animate() method immediately start playing and must be paused manually if you want to avoid that: // animation of the cupcake slowly getting eaten up var nommingcake = document.getelementbyid('eat-me_sprite').animate( [ { transform: 'translatey(0)' }, { transform: 'translatey(-80%)' } ], { fill: 'forwards', easing: 'steps(4, end)', duration: alicechange.effect.timing.duration / 2 }); // doesn't actually need to be eaten until a click event, so pause it initially: nommingcake.pause(); additionally, when resett...
Animation.persist() - Web APIs
WebAPIAnimationpersist
examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replacestate); }); here we have a <...
Animation.playbackRate - Web APIs
cake.addeventlistener("mousedown", growalice, false); cake.addeventlistener("touchstart", growalice, false); in another example, the red queen's race game, alice and the red queen are constantly slowing down: setinterval( function() { // make sure the playback rate never falls below .4 if (redqueen_alice.playbackrate > .4) { redqueen_alice.playbackrate *= .9; } }, 3000); but clicking or tapping on them causes them to speed up by multiplying their playbackrate: var gofaster = function() { redqueen_alice.playbackrate *= 1.1; } document.addeventlistener("click", gofaster)...
Animation.ready - Web APIs
WebAPIAnimationready
you'll typically use a construct similar to this when using the ready promise: animation.ready.then(function() { // do whatever needs to be done when // the animation is ready to run }); example in the following example, the state of the animation will be running when the current ready promise is resolved because the animation does not leave the pending play state in between the calls to pause and play and hence the current ready promise does not change.
Animation.replaceState - Web APIs
examples in our simple replace indefinite animations demo, you can see the following code: const divelem = document.queryselector('div'); document.body.addeventlistener('mousemove', evt => { let anim = divelem.animate( { transform: `translate(${ evt.clientx}px, ${evt.clienty}px)` }, { duration: 500, fill: 'forwards' } ); anim.commitstyles(); //anim.persist() anim.onremove = function() { console.log('animation removed'); } console.log(anim.replac...
Animation - Web APIs
WebAPIAnimation
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).
AnimationEvent.initAnimationEvent() - Web APIs
the following values are allowed: value meaning animationstart the animation has started.
AnimationEvent - Web APIs
<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/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"/><lin...
AnimationPlaybackEvent.AnimationPlaybackEvent() - Web APIs
eventinitdict optional an optional eventinit dictionary object containing the following fields: bubbles optional defaults to false, of type boolean, indicating if the event bubbles or not.
ArrayBufferView - Web APIs
arraybufferview is a helper type representing any of the following javascript typedarray types: int8array, uint8array, uint8clampedarray, int16array, uint16array, int32array, uint32array, float32array, float64array or dataview.
Attr.prefix - Web APIs
WebAPIAttrprefix
syntax string = attribute.prefix examples the following logs "x" to the console.
AudioBuffer.getChannelData() - Web APIs
example in the following example we create a two second buffer, fill it with white noise, and then play it via an audiobuffersourcenode.
AudioBufferSourceNode.AudioBufferSourceNode() - Web APIs
options optional options are as follows: buffer: an instance of audiobuffer to be played.
AudioBufferSourceNode.playbackRate - Web APIs
a value of 1.0 indicates it should play at the same speed as its sampling rate, values less than 1.0 cause the sound to play more slowly, while values greater than 1.0 result in audio playing faster than normal.
AudioContext() - Web APIs
available properties are as follows: latencyhint optional the type of playback that the context will be used for, as a value from the audiocontextlatencycategory enum or a double-precision floating-point value indicating the preferred maximum latency of the context in seconds.
AudioContext.close() - Web APIs
example the following snippet is taken from our audiocontext states demo (see it running live.) when the stop button is clicked, close() is called.
AudioContext.createMediaStreamDestination() - Web APIs
examples in the following simple example, we create a mediastreamaudiodestinationnode, an oscillatornode and a mediarecorder (the example will therefore only work in firefox and chrome at this time.) the mediarecorder is set up to record information from the mediastreamdestinationnode.
AudioContext.resume() - Web APIs
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 running, suspend() is called; if it is suspended, resume() is called.
AudioContext.suspend() - Web APIs
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 running, suspend() is called; if it is suspended, resume() is called.
AudioContext - Web APIs
<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...
AudioContextOptions.latencyHint - Web APIs
in fact, the default value of latencyhint is "interactive" (meaning the browser should try to use the lowest possible and reliable latency it can).
AudioContextOptions - Web APIs
the user agent should select the lowest possible latency that doesn't cause glitches in the audio.
AudioDestinationNode.maxChannelCount - Web APIs
example the following would set up a simple audio graph, featuring an audiodestinationnode with maxchannelcount of 2: var audioctx = new audiocontext(); var source = audioctx.createmediaelementsource(mymediaelement); source.connect(gainnode); audioctx.destination.maxchannelcount = 2; gainnode.connect(audioctx.destination); to see a more complete implementation, check out one of our mdn web audio examples, such as...
AudioListener.dopplerFactor - Web APIs
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.
AudioListener.forwardX - Web APIs
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.
AudioListener.forwardY - Web APIs
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.
AudioListener.forwardZ - Web APIs
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.
AudioListener.positionX - Web APIs
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.
AudioListener.positionY - Web APIs
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.
AudioListener.positionZ - Web APIs
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.
AudioListener.setOrientation() - Web APIs
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.
AudioListener.setPosition() - Web APIs
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.
AudioListener.speedOfSound - Web APIs
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.
AudioListener.upX - Web APIs
WebAPIAudioListenerupX
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.
AudioListener.upY - Web APIs
WebAPIAudioListenerupY
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.
AudioListener.upZ - Web APIs
WebAPIAudioListenerupZ
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.
AudioListener - Web APIs
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.
AudioNode.channelCountMode - Web APIs
the possible values of channelcountmode and their meanings are: value description the following audionode children default to this value max the number of channels is equal to the maximum number of channels of all connections.
AudioParam.exponentialRampToValueAtTime() - Web APIs
the change starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endtime parameter.
AudioParam.linearRampToValueAtTime() - Web APIs
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.value - Web APIs
WebAPIAudioParamvalue
during each render quantum, the browser does the following things related to managing the value of a parameter: if the value setter has been used, the parameter's value is changed to the value given.
AudioParamMap - Web APIs
in addition, there are the following properties available: size ?
AudioScheduledSourceNode - Web APIs
methods inherits methods from its parent interface, audionode, and adds the following methods: start() schedules the node to begin playing the constant sound at the specified time.
AudioTrack.kind - Web APIs
WebAPIAudioTrackkind
the string is one of those found in audio track kind strings below.
AudioTrack.label - Web APIs
WebAPIAudioTracklabel
the list is filtered to only allow certain track kinds through.
AudioTrack - Web APIs
the list is filtered to only allow certain track kinds through.
AudioTrackList.getTrackById() - Web APIs
this function allows the game to disable a specific character's audio in order to adjust the movie's performance based on occurrences within the game; if the character's dialog isn't relevant, it gets left out.
AudioWorklet - Web APIs
the audioworklet interface of the web audio api is used to supply custom audio processing scripts that execute in a separate thread to provide very low latency audio processing.
AudioWorkletGlobalScope.registerProcessor - Web APIs
registering the same name twice is not allowed.
AudioWorkletGlobalScope - Web APIs
as the global execution context is shared across the current baseaudiocontext, it's possible to define any other variables and perform any actions allowed in worklets — apart from defining audioworkletprocessor-derived classes.
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
the properties of these objects are as follows: name the domstring which represents the name of the audioparam.
AudioWorkletProcessor - Web APIs
examples in the example below we create a custom audioworkletnode that outputs white noise.
AuthenticatorAttestationResponse.attestationObject - Web APIs
syntax attestobj = authenticatorattestationresponse.attestationobject properties after decoding the cbor encoded arraybuffer, the resulting javascript object will contain the following properties: authdata the same as authenticatorassertionresponse.authenticatordata.
AuthenticatorAttestationResponse.getTransports() - Web APIs
their values may be : "usb": the authenticator can be contacted via a removable usb link "nfc": the authenticator may be used over nfc (near field communication) "ble": the authenticator may be used over ble (bluetooth low energy) "internal": the authenticator is specifically bound to the client device (cannot be removed).
AuthenticatorResponse.clientDataJSON - Web APIs
properties after the clientdatajson object is converted from an arraybuffer to a javascript object, it will have the following properties: type a string which is either "webauthn.get" when an existing credential is retrieved or "webauthn.create" when a new credential is created.
AuthenticatorResponse - Web APIs
interfaces based on authenticatorresponse below is a list of interfaces based on the authenticatorresponse interface.
BaseAudioContext.createAnalyser() - Web APIs
example the following example shows basic usage of an audiocontext to create an analyser node, then use requestanimationframe() to collect time domain data repeatedly and draw an "oscilloscope style" output of the current audio input.
BaseAudioContext.createDelay() - Web APIs
example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code).
BaseAudioContext.createOscillator() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
BaseAudioContext.createPanner() - Web APIs
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.
BaseAudioContext.createPeriodicWave() - Web APIs
example the following example illustrates simple usage of createperiodicwave(), to create a periodicwave object containing a simple sine wave.
BaseAudioContext.createStereoPanner() - Web APIs
it positions an incoming audio stream in a stereo image using a low-cost equal-power panning algorithm.
BaseAudioContext.onstatechange - Web APIs
}; example the following snippet is taken from our audiocontext states demo (see it running live.) the onstatechange hander is used to log the current state to the console every time it changes.
BaseAudioContext.state - Web APIs
closed: the audio context has been closed (with the audiocontext.close() method.) example the following snippet is taken from our audiocontext states demo (see it running live.) the audiocontext.onstatechange hander is used to log the current state to the console every time it changes.
BasicCardRequest.supportedNetworks - Web APIs
legal values are defined in the w3c's document card network identifiers approved for use with payment request api, and are currently: amex cartebancaire diners discover jcb mastercard mir unionpay visa example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties.
BasicCardRequest.supportedTypes - Web APIs
legal values are defined in basiccardtype enum, and are currently: credit debit prepaid example the following example shows a sample definition of the first parameter of the paymentrequest() constructor, the data property of which contains supportednetworks and supportedtypes properties.
Battery Status API - Web APIs
this can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to save changes before the battery runs out in order to prevent data loss.
Beacon API - Web APIs
the synchronous xmlhttprequest forces the browser to delay unloading the document, and makes the next navigation appear to be slower.
BeforeInstallPromptEvent.prompt() - Web APIs
the prompt() method of the beforeinstallpromptevent interface allows a developer to show the install prompt at a time of their own choosing.
Blob() - Web APIs
WebAPIBlobBlob
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.
Bluetooth - Web APIs
WebAPIBluetooth
for example, an eddystone beacon might advertise a url, which the user agent allows the user to open.
BluetoothCharacteristicProperties - Web APIs
examples the following example shows how tell if a gatt characteristic supports value change notifications.
BluetoothDevice.uuids - Web APIs
the bluetoothdevice.uuids read-only property lists the uuids of gatt services provided by the device, that the current origin is allowed to access.
Body.blob() - Web APIs
WebAPIBodyblob
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest) .then(response => response.blob()) .then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); specifications specification status comment fetchthe definition of 'blob()' in that specification.
BroadcastChannel.close() - Web APIs
the broadcastchannel.close() terminates the connection to the underlying channel, allowing the object to be garbage collected.
CSS.paintWorklet (Static property) - Web APIs
WebAPICSSpaintWorklet
examples the following example demonstrates loading a paintworklet from its js file and does so by feature detection.
CSS.supports() - Web APIs
WebAPICSSsupports
the first one allows to test the support of a pair property-value: propertyname a domstring containing the name of the css property to check.
CSS - Web APIs
WebAPICSS
css.registerproperty() registers custom properties, allowing for property type checking, default values, and properties that do or do not inherit their value.
CSSCounterStyleRule - Web APIs
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/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...
CSSKeywordValue.CSSKeywordValue() - Web APIs
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.
CSSKeywordValue.value - Web APIs
examples the following example resets the css display property to its defaults.
CSSKeywordValue - Web APIs
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.
CSSMathValue - Web APIs
interfaces based on cssmathvalue below is a list of interfaces based on the cssmathvalue interface.
CSSMediaRule - Web APIs
it has the following specific property: cssmediarule.media read only specifies a medialist representing the intended destination medium for style information.
CSSNumericValue.max() - Web APIs
some of the following examples illustrate what happens when they are not.
CSSNumericValue.parse() - Web APIs
exceptions syntaxerror tbd examples the following returns a cssunitvalue object with a unit property equal to "px" and a value property equal to 42.
CSSPageRule - Web APIs
it has the following specific properties: csspagerule.selectortext represents the text of the page selector associated with the at-rule.
CSSPositionValue.CSSPositionValue() - Web APIs
examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page.
CSSPositionValue.x - Web APIs
example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page.
CSSPositionValue.y - Web APIs
example the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page.
CSSPositionValue - Web APIs
examples the following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page.
CSSPrimitiveValue.setFloatValue() - Web APIs
an no_modification_allowed_err is raised if this property is read-only.
CSSPrimitiveValue.setStringValue() - Web APIs
an no_modification_allowed_err is raised if this property is read-only.
CSSPseudoElement.element - Web APIs
examples the example below demonstrates the relationship between csspseudoelement.element and element.pseudo(): const myelement = document.queryselector('q'); const csspseudoelement = myelement.pseudo('::after'); const originatingelement = csspseudoelement.element; console.log(myelement === originatingelement); // outputs true console.log(myelement.parentelement === originatingelement); // outputs false console.log(myelement.lastelementchild === csspseudoelement); ...
CSSPseudoElement.type - Web APIs
syntax var typeofpseudoelement = csspseudoelement.type; value a cssomstring containing one of the following values: "::before" "::after" "::marker" examples the example below demonstrates the relationship between csspseudoelement.type and element.pseudo(): const myelement = document.queryselector('q'); const myselector = '::after'; const csspseudoelement = myelement.pseudo(myselector); const typeofpseudoelement = csspseudoelement.type; console.log(myselector === typeofpseudoelement); // outputs true specifications specification status comment css pseudo-elements level 4the definition of 'type' ...
CSSRule - Web APIs
WebAPICSSRule
there are several types of rules, listed in the type constants section below.
CSSStyleDeclaration.getPropertyCSSValue() - Web APIs
example the following javascript code gets an object containing the computed rgb values of the color css property: var style = window.getcomputedstyle(elem, null); var rgbobj = style.getpropertycssvalue('color').getrgbcolorvalue(); specifications specification status comment document object model (dom) level 2 style specificationthe definition of 'cssstyledeclaration' in that specifi...
CSSStyleDeclaration.getPropertyPriority() - Web APIs
example the following javascript code checks whether margin is marked as important in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var isimportant = declaration.getpropertypriority('margin') === 'important'; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertypriority()' in that spe...
CSSStyleDeclaration.getPropertyValue() - Web APIs
example the following javascript code queries the value of the margin property in a css selector rule: var declaration = document.stylesheets[0].cssrules[0].style; var value = declaration.getpropertyvalue('margin'); // "1px 2px" specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.getpropertyvalue()' in that specification.
CSSStyleDeclaration.length - Web APIs
example the following gets the number of explicitly set styles on the following html element: <div id="div1" style="margin: 0 10px; background-color: #ca1; font-family: monospace"></div> javascript code: var mydiv = document.getelementbyid('div1'); var divstyle = mydiv.style; var len = divstyle.length; // 6 specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.length' in that specification.
CSSStyleDeclaration.parentRule - Web APIs
example the following javascript code gets the parent css style rule from a cssstyledeclaration: var declaration = document.stylesheets[0].rules[0].style; var rule = declaration.parentrule; specifications specification status comment css object model (cssom)the definition of 'cssstyledeclaration.parentrule' in that specification.
CSSStyleDeclaration - Web APIs
see the item() method below.
CSSStyleSheet.addRule() - Web APIs
therefore, given existing code such as the following: cssstylesheet.addrule(selector, styles, 0); you can rewrite this to use the more standard insertrule() like this: cssstylesheet.insertrule(`${selector} {${styles}}`, 0); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.addrule()' in that specification.
CSSStyleSheet - Web APIs
a (possibly incomplete) list of ways a stylesheet can be associated with a document follows: reason for the style sheet to be associated with the document appears in document.
CSSStyleValue.parse() - Web APIs
example the code below parses a set of declarations for the transform property.
CSSStyleValue - Web APIs
interfaces based on cssstylevalue below is a list of interfaces based on the cssstylevalue interface.
CSSUnitValue.CSSUnitValue() - Web APIs
examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors.
CSSUnitValue.unit - Web APIs
WebAPICSSUnitValueunit
examples the following creates a csspositionvalue from individual cssunitvalue constructors, then queries the cssunitvalue.unit.
CSSUnitValue.value - Web APIs
examples the following creates a csspositionvalue from individual cssunitvalue constructors, then queries the cssunitvalue.value.
CSSUnitValue - Web APIs
examples the following shows a method of creating a csspositionvalue from individual cssunitvalue constructors.
CSSVariableReferenceValue - Web APIs
the cssvariablereferencevalue interface of the css typed object model api allows you to create a custom name for a built-in css value.
CSS Counter Styles - Web APIs
the css counter styles module allows to define custom counter styles, which can be used for css list-marker and generated-content counters.
Managing screen orientation - Web APIs
let's have an example with the following html code <ul id="toolbar"> <li>a</li> <li>b</li> <li>c</li> </ul> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.
Cache.add() - Web APIs
WebAPICacheadd
the add() method is functionally equivalent to the following: fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); }) for more complex operations, you'll need to use cache.put() directly.
Cache.delete() - Web APIs
WebAPICachedelete
ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
Cache.keys() - Web APIs
WebAPICachekeys
ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
Cache.match() - Web APIs
WebAPICachematch
ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
Cache.put() - Web APIs
WebAPICacheput
the put() method of the cache interface allows key/value pairs to be added to the current cache object.
Cache - Web APIs
WebAPICache
note: in chrome, visit chrome://inspect/#service-workers and click on the "inspect" link below the registered service worker to view logging statements for the various actions the service-worker.js script is performing.
CacheStorage.has() - Web APIs
WebAPICacheStoragehas
examples the following example first checks whether a cache called 'v1' exists.
CacheStorage.match() - Web APIs
ignoremethod: a boolean that, when set to true, prevents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false.
CanvasCaptureMediaStreamTrack - Web APIs
the canvascapturemediastreamtrack interface represents the video track contained in a mediastream being generated from a <canvas> following a call to htmlcanvaselement.capturestream().
CanvasImageSource - Web APIs
the interfaces that it allows to be used as image sources are the following: htmlimageelement svgimageelement htmlvideoelement htmlcanvaselement imagebitmap offscreencanvas specifications specification status comment html living standardthe definition of 'canvasimagesource' in that specification.
CanvasPattern.setTransform() - Web APIs
222/canvas_createpattern.png'; img.onload = function() { var pattern = ctx.createpattern(img, 'repeat'); pattern.settransform(matrix.rotate(-45).scale(1.5)); ctx.fillstyle = pattern; ctx.fillrect(0, 0, 400, 400); }; note that newer browser versions started to support dommatrix as an input to settransform(), so for example you could replace the svgmatrix in the above example with the following: const matrix = new dommatrix([1, .2, .8, 1, 0, 0]); edit the code below and see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <svg id="svg1" style="display:none"></svg> <div class="playable-buttons"> <input id="edit" type="button" value="edit" /> <input id="reset" type="button" value="reset" /> </d...
CanvasRenderingContext2D.clip() - Web APIs
in the image below, the red outline represents a clipping region shaped like a star.
CanvasRenderingContext2D.createPattern() - Web APIs
it can be any of the following: htmlimageelement (<img>) svgimageelement (<image>) htmlvideoelement (<video>, by using the capture of the video) htmlcanvaselement (<canvas>) imagebitmap offscreencanvas repetition a domstring indicating how to repeat the pattern's image.
CanvasRenderingContext2D.getTransform() - Web APIs
examples in the following example, we have two <canvas> elements.
CanvasRenderingContext2D.lineJoin - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.linewidth = 20; ctx.linejoin = 'round'; ctx.beginpath(); ctx.moveto(20, 20); ctx.lineto(190, 100); ctx.lineto(280, 20); ctx.lineto(280, 150); ctx.stroke(); result comparison of line joins the example below draws three different paths, demonstrating each of the three linejoin options.
CanvasRenderingContext2D.measureText() - Web APIs
you can get a textmetrics object using the following code: const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let text = ctx.measuretext('hello world'); console.log(text.width); // 56; specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.measuretext' in that specification.
CanvasRenderingContext2D.rotate() - Web APIs
to do this, the following steps are applied to the matrix: first, translate() moves the matrix's origin to the shape's center.
CanvasRenderingContext2D.save() - Web APIs
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.
CanvasRenderingContext2D.scrollPathIntoView() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.fillrect(10, 10, 30, 30); ctx.scrollpathintoview(); edit the code below to see your changes update live in the canvas: playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"> <input id="button" type="range" min="1" max="12"> </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"> ctx.beginpath(); ctx.rec...
CanvasRenderingContext2D.setLineDash() - Web APIs
html <canvas id="canvas"></canvas> javascript the drawdashedline() function created below makes the drawing of multiple dashed lines simple.
CanvasRenderingContext2D.setTransform() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.settransform(1, .2, .8, 1, 0, 0); ctx.fillrect(0, 0, 100, 100); result retrieving and passing a dommatrix object in the following example, we have two <canvas> elements.
A basic ray-caster - Web APIs
=) the ray-caster the nice people here have manually copied my files up so you can take a look, and for your hacking enjoyment i've posted the individual file contents as code listings (see below).
Compositing example - Web APIs
pure black or white does not result in pure black or white.', 'subtracts the bottom layer from the top layer or the other way round to always get a positive value.', 'like difference, but with lower contrast.', 'preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.', 'preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.', 'preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.', 'preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.' ...
Optimizing canvas - Web APIs
performance tips the following is a collection of tips to improve canvas performance.
Canvas API - Web APIs
the libraries listed below can make the creation of canvas-based projects faster and easier.
ChildNode.after() - Web APIs
WebAPIChildNodeafter
with(node) { after("foo"); } // referenceerror: after is not defined polyfill you can polyfill the after() method in internet explorer 9 and higher with the following code: // from: https://github.com/jserz/js_piece/blob/master/dom/childnode/after()/after().md (function (arr) { arr.foreach(function (item) { if (item.hasownproperty('after')) { return; } object.defineproperty(item, 'after', { configurable: true, enumerable: true, writable: true, value: function after() { var argarr = array.prototype.slice.c...
ChildNode.before() - Web APIs
WebAPIChildNodebefore
with(node) { before("foo"); } // referenceerror: before is not defined polyfill you can polyfill the before() method in internet explorer 9 and higher with the following code: // from: https://github.com/jserz/js_piece/blob/master/dom/childnode/before()/before().md (function (arr) { arr.foreach(function (item) { if (item.hasownproperty('before')) { return; } object.defineproperty(item, 'before', { configurable: true, enumerable: true, writable: true, value: function before() { var argarr = array.prototype.sl...
ChildNode.remove() - Web APIs
WebAPIChildNoderemove
with(node) { remove(); } // referenceerror: remove is not defined polyfill you can polyfill the remove() method in internet explorer 9 and higher with the following code: // from:https://github.com/jserz/js_piece/blob/master/dom/childnode/remove()/remove().md (function (arr) { arr.foreach(function (item) { if (item.hasownproperty('remove')) { return; } object.defineproperty(item, 'remove', { configurable: true, enumerable: true, writable: true, value: function remove() { this.parentnode.removechild(this...
Client.postMessage() - Web APIs
the postmessage() method of the client interface allows a service worker to send a message to a client (a window, worker, or sharedworker).
Clients.matchAll() - Web APIs
WebAPIClientsmatchAll
syntax self.clients.matchall(options).then(function(clients) { // do something with your clients list }); parameters options optional an options object allowing you to set options for the matching operation.
Clients.openWindow() - Web APIs
in firefox, the method is allowed to show popups only when called as the result of a notification click event.
ClipboardEvent() - Web APIs
options optional options are as follows: clipboarddata: a datatransfer containing the data concerned by the clipboard event.
ClipboardItem() - Web APIs
examples the below example requests a png image using the fetch api, and in turn, the responses' blob() method, to create a new clipboarditem and write it to the clipboard, using the clipboard api.
ClipboardItem.getType() - Web APIs
examples in the following example, we're returning all items on the clipboard via the clipboard.read() method.
ClipboardItem.types - Web APIs
examples in the below example, we're returning all items on the clipboard via the clipboard.read() method.
CloseEvent() - Web APIs
closeeventinit optional is a closeeventinit dictionary, having the following fields: "wasclean", optional and defaulting to false, of type long, indicates if the connection has been closed cleanly or not.
Comment - Web APIs
WebAPIComment
<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...
CompositionEvent.CompositionEvent() - Web APIs
compositioneventinit optional a compositioneventinit dictionary object, which can contain the following members: data initializes the data attribute of the compositionevent object to the characters generated by the ime composition.
CompositionEvent - Web APIs
<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/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="...
console.assert() - Web APIs
WebAPIConsoleassert
examples the following code example demonstrates the use of a javascript object following the assertion: const errormsg = 'the # is not even'; for (let number = 2; number <= 5; number += 1) { console.log('the # is ' + number); console.assert(number % 2 === 0, {number: number, errormsg: errormsg}); // or, using es2015 object property shorthand: // console.assert(number % 2 === 0, {number, errormsg});...
console.clear() - Web APIs
WebAPIConsoleclear
the console.clear() method clears the console if the environment allows it.
Console.group() - Web APIs
WebAPIConsolegroup
this indents following console messages by an additional level, until console.groupend() is called.
Console.timeEnd() - Web APIs
WebAPIConsoletimeEnd
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
Console.timeLog() - Web APIs
WebAPIConsoletimeLog
examples console.time("answer time"); alert("click to continue"); console.timelog("answer time"); alert("do a bunch of other stuff..."); console.timeend("answer time"); the output from the example above shows the time taken by the user to dismiss the first alert box, followed by the time it took for the user to dismiss the second alert: notice that the timer's name is displayed when the timer value is logged using timelog() and again when it's stopped.
console.trace() - Web APIs
WebAPIConsoletrace
example function foo() { function bar() { console.trace(); } bar(); } foo(); in the console, the following trace will be displayed: bar foo <anonymous> specifications specification status comment console apithe definition of 'console.trace()' in that specification.
Console API - Web APIs
the console api provides functionality to allow developers to perform debugging tasks, such as logging messages or the values of variables at set points in your code, or timing how long an operation takes to complete.
ConstrainDouble - Web APIs
properties if the value of a constraindouble is an object rather than a number, it may have the properties below in addition the properties it inherits from doublerange.
ConstrainULong - Web APIs
properties if the value of a constrainulong is an object rather than a number, it may have the properties below in addition to the properties it inherits from ulongrange.
ContentIndexEvent - Web APIs
properties in addition to the properties listed below, this interface inherits the properties of its parent interface, extendableevent.
ConvolverNode() - Web APIs
options optional options are as follows: audiobuffer: a mono, stereo, or 4-channel audiobuffer containing the (possibly multichannel) impulse response used by the convolvernode to create the reverb effect.
CredentialsContainer.preventSilentAccess() - Web APIs
the preventsilentaccess() method of the credentialscontainer interface sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty promise.
CredentialsContainer - Web APIs
credentialscontainer.preventsilentaccess()secure context sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty promise.
Crypto - Web APIs
WebAPICrypto
it allows access to a cryptographically strong random number generator and to cryptographic primitives.
CryptoKey - Web APIs
WebAPICryptoKey
properties cryptokey.type string which may take one of the following values: "secret": this key is a secret key for use with a symmetric algorithm.
CustomElementRegistry - Web APIs
examples the following code is taken from our word-count-web-component example (see it live also).
CustomEvent() - Web APIs
customeventinit optional a customeventinit dictionary, having the following fields: "detail", optional and defaulting to null, of type any, that is an event-dependent value associated with the event.
CustomEvent - Web APIs
event.eventphase read only indicates which phase of the event flow is being processed.
DOMMatrixReadOnly.scale() - Web APIs
dommatrix.scale(scale[, originx][, originy]) we'll show an example of how you can deal with the cross-browser support implications of this in the examples section, below.
DOMMatrixReadOnly.translate() - Web APIs
examples this svg contains two squares, one red and one blue, each positioned at the document origin: <svg width="250" height="250" viewbox="0 0 50 50"> <rect width="25" height="25" fill="red" /> <rect id="transformed" width="25" height="25" fill="blue" /> </svg> the following javascript first creates an identity matrix, then uses the translate() method to create a new, translated matrix — which is then applied to the blue square as a transform.
DOMPoint.fromPoint() - Web APIs
the z and w properties are allowed to keep their default values (0 and 1 respectively).
DOMPoint.w - Web APIs
WebAPIDOMPointw
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPoint.x - Web APIs
WebAPIDOMPointx
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPoint.y - Web APIs
WebAPIDOMPointy
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPoint.z - Web APIs
WebAPIDOMPointz
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointInit.w - Web APIs
WebAPIDOMPointInitw
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointInit.x - Web APIs
WebAPIDOMPointInitx
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointInit.y - Web APIs
WebAPIDOMPointInity
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointInit.z - Web APIs
WebAPIDOMPointInitz
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointReadOnly() - Web APIs
examples the following code demonstrates creating both 2d and 3d points.
DOMPointReadOnly.fromPoint() - Web APIs
the z and w properties are allowed to keep their default values (0 and 1 respectively).
DOMPointReadOnly.w - Web APIs
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointReadOnly.x - Web APIs
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointReadOnly.y - Web APIs
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMPointReadOnly.z - Web APIs
this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity).
DOMRect - Web APIs
WebAPIDOMRect
<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/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" ...
DOMTokenList.add() - Web APIs
WebAPIDOMTokenListadd
return value undefined examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.contains() - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.forEach() - Web APIs
example in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.item() - Web APIs
WebAPIDOMTokenListitem
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.length - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist, then write the length of the list to the <span>'s node.textcontent.
DOMTokenList.remove() - Web APIs
return value undefined examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.supports() - Web APIs
example let iframe = document.getelementbyid('display'); if (iframe.sandbox.supports('an-upcoming-feature')) { // support code for mystery future feature } else { // fallback code } if (iframe.sandbox.supports('allow-scripts')) { // instruct frame to run javascript // // (note: this feature is well-supported; this is just an example!) // } specifications specification status comment credential management level 1 working draft initial definition.
DOMTokenList.toggle() - Web APIs
examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist.
DOMTokenList.value - Web APIs
syntax tokenlist.value; value a domstring examples in the following example we retrieve the list of classes set on a <span> element as a domtokenlist using element.classlist, then write the value of the list to the <span>'s node.textcontent.
DataTransfer.items - Web APIs
<style> div { margin: 0em; padding: 2em; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart: target.id = " + ev.target.id); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text/plain", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: target.id = " + ev.target.id); ev.preventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print each format type if (ev.datatransfer.types != null) { for (var i=0; i < ev.datatransfer.types.
DataTransfer.setDragImage() - Web APIs
when a drag occurs, a translucent image is generated from the drag target (the element the dragstart event is fired at), and follows the mouse pointer during the drag.
DataTransfer.types - Web APIs
<style> div { margin: 0em; padding: 2em; } #target { border: 1px solid black; } </style> <script> function dragstart_handler(ev) { console.log("dragstart: target.id = " + ev.target.id); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text/plain", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: target.id = " + ev.target.id); ev.preventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); // print each format type if (ev.datatransfer.types != null) { for (var i=0; i < ev.datatransfer.types.
DataTransfer - Web APIs
datatransfer.effectallowed provides all of the types of operations that are possible.
DataTransferItem.getAsString() - Web APIs
see callback below for details.
DataTransferItem.kind - Web APIs
it must be one of the following values: 'file' if the drag data item is a file.
DedicatedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
DedicatedWorkerGlobalScope.onmessage - Web APIs
}; example the following code snippet shows creation of a worker object using the worker() constructor.
DedicatedWorkerGlobalScope.postMessage() - Web APIs
example the following code snippet shows worker.js, in which an onmessage handler is used to handle messages from the main script.
DelayNode() - Web APIs
can contain the following members: delaytime: the initial delay time for the node, in seconds.
DelayNode.delayTime - Web APIs
example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code).
DelayNode - Web APIs
WebAPIDelayNode
example we have created a simple example that allows you to play three different samples on a constant loop — see create-delay (you can also view the source code).
Using light sensors - Web APIs
the devicelightevent provides a value attribute with light intensity in lux which is generally treated as shown below.
DeviceMotionEvent.DeviceMotionEvent() - Web APIs
optionsoptional options are as follows: acceleration: an object giving the acceleration of the device on the three axis x, y and z.
DeviceOrientationEvent.DeviceOrientationEvent() - Web APIs
options optional options are as follows: alpha: a number representing the motion of the device around the z axis, express in degrees with values ranging from 0 to 360.
DisplayMediaStreamConstraints.audio - Web APIs
syntax displaymediastreamconstraints.audio = allowaudioflag; displaymediastreamconstraints.audio = mediatrackconstraints; displaymediastreamconstraints = { audio: allowaudioflag|mediatrackconstraints; } value the value may be either a boolean or a mediatrackconstraints object.
Document: DOMContentLoaded event - Web APIs
if loaded as usual, stylesheets slow down dom parsing as they're loaded in parallel, "stealing" traffic from the main html document.
Document.adoptNode() - Web APIs
best practice: although firefox doesn't currently enforce this rule, we encourage you to follow this rule for improved future compatibility.
Document.all - Web APIs
WebAPIDocumentall
more information about this can be found in this answer from stackoverflow.
Document.anchors - Web APIs
WebAPIDocumentanchors
example if (document.anchors.length >= 5) { dump("found too many anchors"); } the following is an example that auto populates a table of contents with every anchor on the page: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>test</title> <script> function init() { var toc = document.getelementbyid("toc"); var i, li, newanchor; for (i = 0; i < document.anchors.length; i++) { li = document.createelement("li"); newanchor = document.createelement('a'); newanchor.href = "#" + document.anchors[i].name; newanchor.innerhtml = document.anchors[i].text; li.appendchild(n...
Document.caretRangeFromPoint() - Web APIs
returns one of the following: a range.
Document.createAttribute() - Web APIs
the string given in parameter is converted to lowercase.
Document.createDocumentFragment() - Web APIs
since the document fragment is in memory and not part of the main dom tree, appending children to it does not cause page reflow (computation of element's position and geometry).
Document.createEvent() - Web APIs
gecko supports some non-standard event object aliases, which are listed below.
Document.createNodeIterator() - Web APIs
example const nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode(node) { return node.nodename.tolowercase() === 'p' ?
Document.createProcessingInstruction() - Web APIs
exceptions dom_invalid_character throws if either of the following are true: the processing instruction target is invalid — it should be a valid xml name that doesn't contain "xml", "xml", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>.
Document.createTouchList() - Web APIs
in following code snippet, some touch objects are created for the target element and those touch points are then used to create some touchlist objects.
Document.createTreeWalker() - Web APIs
example the following example goes through all nodes in the body, reduces the set of nodes to elements, simply passes through as acceptable each node (it could reduce the set in the acceptnode() method instead), and then makes use of tree walker iterator that is created to advance through the nodes (now all elements) and push them into an array.
Document.designMode - Web APIs
firefox follows this standard.
Document.domain - Web APIs
WebAPIDocumentdomain
exceptions securityerror an attempt has been made to set domain under one of the following conditions: the document is inside a sandboxed <iframe> the document has no browsing context the document's effective domain is null the given value is not equal to the document's effective domain (or it is not a registerable domain suffix of it) the document-domain feature-policy is enabled examples getting the domain for the uri http://developer.mozilla.org/docs/web, this...
Document.evaluate() - Web APIs
WebAPIDocumentevaluate
using // is generally slow as it visits every node from the root and all subnodes looking for possible matches.
Document.execCommand() - Web APIs
enableabsolutepositioneditor enables or disables the grabber that allows absolutely-positioned elements to be moved around.
Document.fullscreenEnabled - Web APIs
full-screen mode is available only for a page that has no windowed plug-ins in any of its documents, and if all <iframe> elements which contain the document have their allowfullscreen attribute set.
Document.getAnimations() - Web APIs
examples the following code snippet will slow down all animations on a page by halving their animation.playbackrate.
Document.getElementsByName() - Web APIs
the getelementsbyname method works differently in ie10 and below.
Document.images - Web APIs
WebAPIDocumentimages
the following are equivalent: firstimage = imagecollection.item(0); firstimage = imagecollection[0]; example this example looks through the list of images and finds one whose name is "banner.gif".
Document: keydown event - Web APIs
for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress.
Document: keyup event - Web APIs
for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress.
Document: pointercancel event - Web APIs
after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave.
Document.readyState - Web APIs
syntax var string = document.readystate; values the readystate of a document can be one of following: loading the document is still loading.
Document.registerElement() - Web APIs
the mytag variable holds a constructor that you can use to create a my-tag element in the document as follows: document.body.appendchild(new mytag()); this inserts an empty my-tag element that will be visible if you use the browser's developer tools.
Document.title - Web APIs
WebAPIDocumenttitle
otherwise, it contains the title specified in the markup (see the notes below).
Document.writeln() - Web APIs
WebAPIDocumentwriteln
writes a string of text followed by a newline character to a document.
Document.xmlVersion - Web APIs
to detect this, you can create an element with its name in lower case, then check to see if it gets converted into all upper case (in which case the document is in the non-xml html mode): if (document.createelement("foo").tagname == "foo") { /* document is not xml */ } specifications http://www.w3.org/tr/dom-level-3-cor...ument3-version this has been removed from dom core level 4wd ...
DocumentOrShadowRoot.activeElement - Web APIs
example html <p>select some text from one of the text areas below:</p> <form> <textarea name="ta-example-one" id="ta-example-one" rows="7" cols="40">this is text area one.
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
the code for it is below the demo.
DocumentOrShadowRoot.elementFromPoint() - Web APIs
elements with pointer-events set to none will be ignored, and the element below it will be returned.
DocumentOrShadowRoot.styleSheets - Web APIs
examples function getstylesheet(unique_title) { for (var i=0; i<document.stylesheets.length; i++) { var sheet = document.stylesheets[i]; if (sheet.title == unique_title) { return sheet; } } } notes the returned list is ordered as follows: stylesheets retrieved from <link> headers are placed first, sorted in header order.
DocumentOrShadowRoot - Web APIs
the following features are included in both document and shadowroot.
DocumentTimeline.DocumentTimeline() - Web APIs
examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline.
DocumentTimeline - Web APIs
examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline.
DocumentType - Web APIs
<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="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1="25" x...
Locating DOM elements using selectors - Web APIs
for example, to select all paragraph (p) elements in a document whose css class is either warning or note, you can do the following: var special = document.queryselectorall( "p.warning, p.note" ); you can also query by id.
DragEvent() - Web APIs
drageventinitoptional is a drageventinit dictionary, having the following fields: "datatransfer", optional and defaults to "null".
DragEvent - Web APIs
WebAPIDragEvent
dragover this event is fired continuously when an element or text selection is being dragged and the mouse pointer is over a valid drop target (every 50 ms when mouse is not moving else much faster between 5 ms (slow movement) and 1ms (fast movement) approximately.
DynamicsCompressorNode.attack - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
DynamicsCompressorNode.knee - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
DynamicsCompressorNode.ratio - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
DynamicsCompressorNode.release - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
DynamicsCompressorNode.threshold - Web APIs
example the below code demonstrates a simple usage of createdynamicscompressor() to add compression to an audio track.
EXT_color_buffer_float - Web APIs
extended methods the following sized formats become color-renderable: gl.r16f, gl.rg16f, gl.rgba16f, gl.r32f, gl.rg32f, gl.rgba32f, gl.r11f_g11f_b10f.
EXT_float_blend - Web APIs
the webgl api's ext_float_blend extension allows blending and draw buffers with 32-bit floating-point components.
EXT_sRGB - Web APIs
WebAPIEXT sRGB
constants this extension exposes the following constants, which can be used in the teximage2d(), texsubimage2d(), renderbufferstorage() and getframebufferattachmentparameter() methods.
EXT_shader_texture_lod - Web APIs
glsl built-in functions the following new functions can be used in glsl shader code, if this extension is enabled: vec4 texture2dlodext(sampler2d sampler, vec2 coord, float lod) vec4 texture2dprojlodext(sampler2d sampler, vec3 coord, float lod) vec4 texture2dprojlodext(sampler2d sampler, vec4 coord, float lod) vec4 texturecubelodext(samplercube sampler, vec3 coord, float lod) vec4 texture2dgradext(sampler2d sampler, vec2 p, vec2 ...
EcKeyGenParams - Web APIs
this may be any of the following names for nist-approved curves: p-256 p-384 p-521 examples see the examples for subtlecrypto.generatekey().
EcKeyImportParams - Web APIs
this may be any of the following names for nist-approved curves: p-256 p-384 p-521 examples see the examples for subtlecrypto.importkey().
EcdsaParams - Web APIs
this should be one of the following: sha-256: selects the sha-256 algorithm.
EffectTiming.direction - Web APIs
it can take one of the following values, with the default being "normal": "normal" the animation runs forwards, from beginning to end, in the way we experience the flow of time.
EffectTiming.iterationStart - Web APIs
usually you'll use a value between 0.0 and 1.0 to indicate an offset into the first run of the animation at which to begin the animation performance, but any positive, non-infinite value is allowed.
Element: MSInertiaStart event - Web APIs
this event may not be fired if the scroll is sufficiently slow.
Element.animate() - Web APIs
WebAPIElementanimate
examples in the demo down the rabbit hole (with the web animation api), we use the convenient animate() method to immediately create and play an animation on the #tunnel element to make it flow upwards, infinitely.
Element.attributes - Web APIs
the following example runs through the attribute nodes for the element in the document with id "paragraph", and prints each attribute's value.
Element: auxclick event - Web APIs
html <button><h1>click me!</h1></button> css html { height: 100%; overflow: hidden; } body { height: inherit; display: flex; justify-content: center; align-items: center; margin: 0; } button { border: 0; background-color: white; font-size: 8vw; display: block; width: 100%; height: 100%; } h1 { letter-spacing: 0.5rem; } result note: if you are using a three-button mouse, you'll notice that the onauxclick handler is run when any of the non...
Element: click event - Web APIs
safari mobile considers the following elements to be typically interactive (and thus they aren't affected by this bug): <a> (but it must have an href) <area> (but it must have an href) <button> <img> <input> <label> (but it must be associated with a form control) <textarea> this list is incomplete; you can help mdn by doing further testing/research and expanding it.
Element.clientLeft - Web APIs
it includes the width of the vertical scrollbar if the text direction of the element is right–to–left and if there is an overflow causing a left vertical scrollbar to be rendered.
Element.closest() - Web APIs
WebAPIElementclosest
or || element.prototype.webkitmatchesselector; } if (!element.prototype.closest) { element.prototype.closest = function(s) { var el = this; do { if (element.prototype.matches.call(el, s)) return el; el = el.parentelement || el.parentnode; } while (el !== null && el.nodetype === 1); return null; }; } however, if you really do require ie 8 support, then the following polyfill will do the job very slowly, but eventually.
Element: compositionend event - Web APIs
ncelable yes interface compositionevent event handler property none examples const inputelement = document.queryselector('input[type="text"]'); inputelement.addeventlistener('compositionend', (event) => { console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control lo...
Element: compositionstart event - Web APIs
elable yes interface compositionevent event handler property none examples const inputelement = document.queryselector('input[type="text"]'); inputelement.addeventlistener('compositionstart', (event) => { console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control lo...
Element: compositionupdate event - Web APIs
lable yes interface compositionevent event handler property none examples const inputelement = document.queryselector('input[type="text"]'); inputelement.addeventlistener('compositionupdate', (event) => { console.log(`generated characters were: ${event.data}`); }); live example html <div class="control"> <label for="name">on macos, click in the textbox below,<br> then type <kbd>option</kbd> + <kbd>`</kbd>, then <kbd>a</kbd>:</label> <input type="text" id="example" name="example"> </div> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents" rows="8" cols="25"></textarea> <button class="clear-log">clear</button> </div> css body { padding: .2rem; display: grid; grid-template-areas: "control lo...
Element.currentStyle - Web APIs
polyfill this polyfill returns the values in pixels and is likely to be rather slow, as it has to call window.getcomputedstyle() every time its value is read.
Element.getAttributeNode() - Web APIs
example // html: <div id="top" /> let t = document.getelementbyid("top"); let idattr = t.getattributenode("id"); alert(idattr.value == "top") notes when called on an html element in a dom flagged as an html document, getattributenode lower-cases its argument before proceeding.
Element.getAttributeNodeNS() - Web APIs
== example == tbd the example needs to be fixed pre> // html: <div id="top" /> t = document.getelementbyid("top"); specialnode = t.getattributenodens( "http://www.mozilla.org/ns/specialspace", "id"); // inode.value = "full-top" </pre notes getattributenodens is more specific than getattributenode in that it allows you to specify attributes that are part of a particular namespace.
Element.getClientRects() - Web APIs
the returned rectangles do not include the bounds of any child elements that might happen to overflow.
Element.getElementsByClassName() - Web APIs
however the following code will not work as one might expect because "matches" will change as soon as any "colorbox" class is removed.
Element.insertAdjacentElement() - Web APIs
syntax targetelement.insertadjacentelement(position, element); parameters position a domstring representing the position relative to the targetelement; must match (case-insensitively) one of the following strings: 'beforebegin': before the targetelement itself.
Element.insertAdjacentHTML() - Web APIs
syntax element.insertadjacenthtml(position, text); parameters position a domstring representing the position relative to the element; must be one of the following strings: 'beforebegin': before the element itself.
Element: keydown event - Web APIs
for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress.
Element: keyup event - Web APIs
for example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress.
Element.localName - Web APIs
WebAPIElementlocalName
in later versions, in compliance with html5, the property returns in the case of the internal dom storage, which is lower case for both html elements in html doms and xhtml elements in xml doms.
Element.matches() - Web APIs
WebAPIElementmatches
esselector || element.prototype.omatchesselector || element.prototype.webkitmatchesselector || function(s) { var matches = (this.document || this.ownerdocument).queryselectorall(s), i = matches.length; while (--i >= 0 && matches.item(i) !== this) {} return i > -1; }; } however, given the practicality of supporting older browsers, the following should suffice for most (if not all) practical cases (i.e.
Element: mousedown event - Web APIs
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.
Element: mouseenter event - Web APIs
mouseenter the following trivial example uses the mouseenter event to change the border on the div when the mouse enters the space alloted to it.
Element: mouseleave event - Web APIs
mouseleave the following trivial example uses the mouseenter event to change the border on the <div> when the mouse enters the space alloted to it.
Element: mousemove event - Web APIs
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.
Element: mouseover event - Web APIs
bubbles yes cancelable yes interface mouseevent event handler property onmouseover examples the following example illustrates the difference between mouseover and mouseenter events.
Element: mouseup event - Web APIs
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.
Element: mousewheel event - Web APIs
see following explanation for the detail.
Element.name - Web APIs
WebAPIElementname
it only applies to the following elements: <a>, <applet>, <button>, <form>, <frame>, <iframe>, <img>, <input>, <map>, <meta>, <object>, <param>, <select>, and <textarea>.
Element.outerHTML - Web APIs
WebAPIElementouterHTML
nomodificationallowederror an attempt was made to set outerhtml on an element which is a direct child of a document, such as document.documentelement.
Element.part - Web APIs
WebAPIElementpart
syntax let elementpartlist = element.part examples the following excerpt is from our shadow-part example.
Element.prefix - Web APIs
WebAPIElementprefix
syntax string = element.prefix examples the following logs "x" to the console.
Element.scrollIntoView() - Web APIs
scrollintoviewoptions optional is an object with the following properties: behavior optional defines the transition animation.
Element.scrollTop - Web APIs
WebAPIElementscrollTop
it has no overflow or if the element has a property of "non-scrollable"), scrolltop is 0.
Element.setAttributeNS() - Web APIs
name is a string identifying the attribute by its qualified name; that is, a namespace prefix followed by a colon followed by a local name.
Element.setPointerCapture() - Web APIs
overview of pointer capture pointer capture allows events for a particular pointer event (pointerevent) to be re-targeted to a particular element instead of the normal (or hit test) target at a pointer's location.
Element.shadowRoot - Web APIs
examples the following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes.
Element.tagName - Web APIs
WebAPIElementtagName
example html <span id="born">when i was born...</span> javascript var span = document.getelementbyid("born"); console.log(span.tagname); in xhtml (or any other xml format), the original case will be maintained, so "span" would be output in case the original tag name was created lowercase.
ElementCSSInlineStyle.style - Web APIs
the following code snippet demonstrates the difference between the values obtained using the element's style property and that obtained using the getcomputedstyle() method: <!doctype html> <html> <body style="font-weight:bold;"> <div style="color:red" id="myelement">..</div> </body> </html> var element = document.getelementbyid("myelement"); var out = ""; var elementstyle = element.style; var com...
ElementCSSInlineStyle - Web APIs
each of these interfaces can, of course, add more features in addition to the ones listed below.
ElementTraversal - Web APIs
the elementtraversal interface used to define methods that allowed access from one node to another in the document tree.
Encoding API - Web APIs
interfaces textdecoder textencoder textdecoderstream textencoderstream tutorials & tools a shim allowing to use this interface in browsers that don't support it.
ErrorEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#d4dde4" fill="none"/><line x1="86" ...
Comparison of Event Targets - Web APIs
see anonymous content#event_flow_and_targeting for details.
Event() - Web APIs
WebAPIEventEvent
eventinit optional this is an eventinit dictionary, having the following optional fields: bubbles optional a boolean indicating whether the event bubbles.
Event.bubbles - Web APIs
WebAPIEventbubbles
you can use this property to check if an event is allowed to bubble or not.
Event.composedPath() - Web APIs
the <open-shadow> element's composed path is this: array [ p, shadowroot, open-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes inside the shadow boundary.
Event.originalTarget - Web APIs
see anonymous content#event_flow_and_targeting for more details.
Event.returnValue - Web APIs
WebAPIEventreturnValue
it is set to true by default, allowing the default action to occur.
EventListener - Web APIs
this is shown in the example below.
EventTarget.removeEventListener() - Web APIs
const body = document.queryselector('body') const clicktarget = document.getelementbyid('click-target') const mouseovertarget = document.getelementbyid('mouse-over-target') let toggle = false; function makebackgroundyellow() { if (toggle) { body.style.backgroundcolor = 'white'; } else { body.style.backgroundcolor = 'yellow'; } toggle = !toggle; } clicktarget.addeventlistener('click', makebackgroundyellow, false ); mouseovertarget.addeventlistener('mouseover', function () { clicktarget.removeeventlistener('click', makebackgroundyellow, false ); }); ...
EventTarget - Web APIs
<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="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" t...
ExtendableEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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-anch...
ExtendableMessageEvent() - Web APIs
init optional an initialisation object, which should contain the following parameters: data: the event's data — this can be any data type.
ExtendableMessageEvent.data - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.lastEventId - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.origin - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.ports - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.source - Web APIs
examples when the following code is used inside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent - Web APIs
examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then calls its postmessage() function.
FetchEvent() - Web APIs
options are as follows: clientid read only the client that the current service worker is controlling.
FetchEvent.navigationPreload - Web APIs
example the following example shows the implementation of a fetch event that uses a preloaded response.
FetchEvent.respondWith() - Web APIs
the respondwith() method of fetchevent prevents the browser's default fetch handling, and allows you to provide a promise for a response yourself.
FetchEvent - Web APIs
it provides the event.respondwith() method, which allows us to provide a response to this fetch.
Fetch basic concepts - Web APIs
when a request or response object is created, it has an associated headers object whose guard is set as summarized below: new object's type creating constructor guard setting of associated headers object request request() request request() with mode of no-cors request-no-cors response response() response error() or redirect() methods immutable a header's guard affects the set(), delete(), and append() methods which change the header's ...
File.File() - Web APIs
WebAPIFileFile
available options are as follows: type: a domstring representing the mime type of the content that will be put into the file.
File.getAsText() - Web APIs
WebAPIFilegetAsText
example // fileinput is a htmlinputelement: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist) var files = fileinput.files; // object for allowed media types var accept = { binary : ["image/png", "image/jpeg"], text : ["text/plain", "text/css", "application/xml", "text/html"] }; var file; for (var i = 0; i < files.length; i++) { file = files[i]; // if file type could be detected if (file !== null) { if (accept.text.indexof(file.mediatype) > -1) { // file is of type text, which we accept // make sure it's en...
File.lastModified - Web APIs
WebAPIFilelastModified
multiple id="fileinput"> const fileinput = document.queryselector('#fileinput'); fileinput.addeventlistener('change', (event) => { // files is a filelist object (similar to nodelist) const files = event.target.files; for (let file of files) { const date = new date(file.lastmodified); console.log(`${file.name} has a last modified date of ${date}`); } }); try the results out below: dynamically created files if a file is created dynamically, the last modified time can be supplied in the new file() constructor function.
File.name - Web APIs
WebAPIFilename
example <input type="file" multiple onchange="processselectedfiles(this)"> function processselectedfiles(fileinput) { var files = fileinput.files; for (var i = 0; i < files.length; i++) { alert("filename " + files[i].name); } } try the results out below: specifications specification status comment file apithe definition of 'name' in that specification.
FileReader() - Web APIs
example the following code snippet shows creation of a filereader object using the filereader() constructor and subsequent usage of the object: function printfile(file) { var reader = new filereader(); reader.onload = function(evt) { console.log(evt.target.result); }; reader.readastext(file); } specifications specification status comment file api working draft initial definition ...
FileReader.readyState - Web APIs
a filereader exists in one of the following states: value state description 0 empty reader has been created.
FileReader.result - Web APIs
WebAPIFileReaderresult
the result types are described below.
FileReader - Web APIs
this is one of the following: empty 0 no data has been loaded yet.
FileReaderSync - Web APIs
the filereadersync interface allows to read file or blob objects synchronously.
FileSystemDirectoryEntry - Web APIs
example in the following code snippet, we create a directory called "documents." // taking care of the browser-specific prefixes.
FileSystemEntry.remove() - Web APIs
fileerror.no_modification_allowed_err the file system's state doesn't permit removing the file or directory.
FileSystemFlags.create - Web APIs
syntax filesystemflags.create = booleanvalue values the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
FileSystemFlags.exclusive - Web APIs
syntax filesystemflags.exclusive = booleanvalue values the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
FileSystemFlags - Web APIs
values and results the table below describes the result of each possible combination of these flags depending on whether or not the target file or directory path already exists.
FileSystemSync - Web APIs
about this document this document was last updated on march 2, 2012 and follows the w3c specifications (working draft) drafted on april 19, 2011.
FocusEvent() - Web APIs
focuseventinit optional is a focuseventinit dictionary, having the following fields: "relatedtarget", optional and defaulting to null, is an eventtarget representing the secondary target of a focusevent.
FocusEvent - Web APIs
<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/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"/><l...
FontFace.FontFace() - Web APIs
WebAPIFontFaceFontFace
it can have the following keys: family: family style: style weight: weight stretch: stretch unicoderange: unicode range variant: variant featuresettings: feature settings example async function loadfonts() { const font = new fontface('myfont', 'url(myfont.woff)'); // wait for font to be loaded await font.load(); // add font to document document.fonts.add(font); // enable f...
FontFace.family - Web APIs
WebAPIFontFacefamily
the fontface.family property allows the author to get or set the font family of a fontface object.
FontFace - Web APIs
WebAPIFontFace
it allows control of the source of the font face, being a url to an external resource, or a buffer; it also allows control of when the font face is loaded and its current status.
FontFaceSetLoadEvent.FontFaceSetLoadEvent() - Web APIs
options optional options are as follows: fontfaces: an array of fontface instances.
Force Touch events - Web APIs
event properties the following property is known to be available on the webkitmouseforcewillbegin, mousedown, webkitmouseforcechanged, webkitmouseforcedown, webkitmouseforceup, mousemove, and mouseup event objects: mouseevent.webkitforce read only the amount of pressure currently being applied to the trackpad/touchscreen constants these constants are useful for determining the relative intensity of the pressure in...
FormData() - Web APIs
WebAPIFormDataFormData
example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you could add a key/value pair to this using formdata.append: formdata.append('username', 'chris'); or you can specify the optional form argument when creating the formdata object, to prepopulate it with values from the specified form: <form id="myform" name="myform"> <div> <label for="username...
FormData.append() - Web APIs
WebAPIFormDataappend
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.
FormData.delete() - Web APIs
WebAPIFormDatadelete
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.
FormData.entries() - Web APIs
WebAPIFormDataentries
the formdata.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
FormData.get() - Web APIs
WebAPIFormDataget
example the following line creates an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following get() function will only return the first username value appended: formdata.get('username'); // returns "chris" specifications specification status comment ...
FormData.getAll() - Web APIs
WebAPIFormDatagetAll
example the following line creates an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following getall() function will return both username values in an array: formdata.getall('username'); // returns ["chris", "bob"] specifications specification status commen...
FormData.has() - Web APIs
WebAPIFormDatahas
example the following line creates an empty formdata object: var formdata = new formdata(); the following snippet shows the results of testing for the existence of username in the formdata object, before and after appending a username value to it with formdata.append: formdata.has('username'); // returns false formdata.append('username', 'chris'); formdata.has('username'); // returns true specifications specification status comment xmlhttprequestthe definit...
FormData.keys() - Web APIs
WebAPIFormDatakeys
the formdata.keys() method returns an iterator allowing to go through all keys contained in this object.
FormData.set() - Web APIs
WebAPIFormDataset
example the following line creates an empty formdata object: var formdata = new formdata(); // currently empty you can set key/value pairs on this using formdata.set: formdata.set('username', 'chris'); formdata.set('userpic', myfileinput.files[0], 'chris.jpg'); if the sent value is different than string or blob it will be automatically converted to string: formdata.set('name', 72); formdata.get('name'); // "72...
FormData.values() - Web APIs
WebAPIFormDatavalues
the formdata.values() method returns an iterator allowing to go through all values contained in this object.
FormDataEntryValue - Web APIs
note that the formdata.append() and formdata.set() methods allow passing a blob value, which is converted to a file in the process.
FormDataEvent() - Web APIs
formeventinit optional a formeventinit dictionary, which can take the following optional fields: bubbles: a boolean indicating whether the event bubbles.
FormDataEvent - Web APIs
this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself when you wish to submit form data via a method like xmlhttprequest (see using formdata objects).
FullscreenOptions.navigationUI - Web APIs
syntax let fullscreenoptions = { navigationui: value }; value the value of the navigationui property must be one of the following strings.
GainNode() - Web APIs
WebAPIGainNodeGainNode
options optional options are as follows: gain: the amount of gain to apply.
Gamepad.axes - Web APIs
WebAPIGamepadaxes
analog thumb sticks).- each entry in the array is a floating point value in the range -1.0 – 1.0, representing the axis position from the lowest value (-1.0) to the highest value (1.0).
Gamepad.id - Web APIs
WebAPIGamepadid
this information is intended to allow you to find a mapping for the controls on the device as well as display useful feedback to the user.
Gamepad.timestamp - Web APIs
WebAPIGamepadtimestamp
the idea behind this is to allow developers to determine if the axes and button data have been updated from the hardware.
GamepadEvent() - Web APIs
options optional options are as follows: gamepad: an instance of gamepad describing the gamepad associated with the event.
Gamepad API - Web APIs
see also the extensions to the gamepad interface, for features that allow you to access the above information.
Geolocation - Web APIs
this allows a web site or app to offer customized results based on the user's location.
GeolocationCoordinates.longitude - Web APIs
javascript the javascript code below creates an event listener so that when the user clicks on a button, the location information is retrieved and displayed.
GestureEvent - Web APIs
values below 1.0 indicate an inward pinch (zoom out).
GlobalEventHandlers.onanimationiteration - Web APIs
example let's create an animation which automatically pauses at the end of each iteration, allowing the user to choose whether or not to start the next iteration.
GlobalEventHandlers.onclick - Web APIs
note: when using the click event to trigger an action, also consider adding this same action to the keydown event, to allow the use of that same action by people who don't use a mouse or a touch screen.
GlobalEventHandlers.ondrag - Web APIs
m; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> --> <p id="source" ondr...
GlobalEventHandlers.ondragend - Web APIs
.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's background color to visually indicate // the drag ended.
GlobalEventHandlers.ondragenter - Web APIs
.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's background color to visually indicate // the drag ended.
GlobalEventHandlers.ondragexit - Web APIs
.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's border back to white ev.currenttarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's background color to visually indicate // the drag ended.
GlobalEventHandlers.ondragleave - Web APIs
.style.background = "lightblue"; ev.preventdefault(); } function drop_handler(ev) { console.log("drop"); ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragleave"); // change the source element's background color back to white ev.currenttarget.style.background = "white"; } function dragend_handler(ev) { console.log("dragend"); // change the target element's background color to visually indicate // the drag ended.
GlobalEventHandlers.ondragover - Web APIs
m; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondr...
GlobalEventHandlers.ondragstart - Web APIs
m; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondr...
GlobalEventHandlers.ondrop - Web APIs
m; } #source { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.preventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.preventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div class="source"> <p id="source" ondrag="drag_handle...
GlobalEventHandlers.onerror - Web APIs
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 ...
GlobalEventHandlers.onkeypress - Web APIs
rs only: <input> </label> javascript function numbersonly(event) { return event.charcode === 0 || /\d/.test(string.fromcharcode(event.charcode)); } const input = document.queryselector('input'); input.onkeypress = numbersonly; // prevent pasting (since pasted content might include non-number characters) input.onpaste = event => false; result capture the typing of a hidden word the following javascript function will do something after the user types the word "exit" in any point of a page.
GlobalEventHandlers.onpointerdown - Web APIs
#target { width: 400px; height: 30px; text-align: center; font: 16px "open sans", "helvetica", sans-serif; color: white; background-color: blue; border: 2px solid darkblue; cursor: pointer; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } result the resulting output is shown below.
Gyroscope.Gyroscope() - Web APIs
syntax var gyroscope = new gyroscope([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.
Gyroscope.x - Web APIs
WebAPIGyroscopex
in the example below this occurs sixty times a second.
Gyroscope.y - Web APIs
WebAPIGyroscopey
in the example below this occurs sixty times a second.
Gyroscope.z - Web APIs
WebAPIGyroscopez
in the example below this occurs sixty times a second.
Gyroscope - Web APIs
WebAPIGyroscope
in the example below this occurs sixty times a second.
HTMLBaseElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="11...
HTMLCanvasElement.height - Web APIs
syntax var pxl = canvas.height; canvas.height = pxl; examples given this <canvas> element: <canvas id="canvas" width="300" height="300"></canvas> you can get the height of the canvas with the following code: var canvas = document.getelementbyid('canvas'); console.log(canvas.height); // 300 specifications specification status comment html living standardthe definition of 'htmlcanvaselement.height' in that specification.
HTMLCanvasElement.mozFetchAsStream() - Web APIs
also uses netutil.jsm 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(); var netutilcallback = function() { return function(result) { if (!components.issuccesscode(result)) { alert('failed to create icon'); } else { alert('succesfully made'); } }; } var mfascallback = function(iconname) { return function(instream) { var file = fileutils.getfile('desk', [iconname + '.ico']); var outstre...
HTMLCanvasElement.mozGetAsFile() - Web APIs
html <canvas id="canvas" width="100" height="100"></canvas> <p><a href="#" id="link">click here to try out mozgetasfile()</a>.</p> javascript the following code uses mozgetasfile() to create a file object from the canvas and appends it as an image to the page by loading it as a data url using the readasdataurl() method.
HTMLCanvasElement.width - Web APIs
syntax var pxl = canvas.width; canvas.width = pxl; examples given this <canvas> element: <canvas id="canvas" width="300" height="300"></canvas> you can get the width of the canvas with the following code: var canvas = document.getelementbyid('canvas'); console.log(canvas.width); // 300 specifications specification status comment html living standardthe definition of 'htmlcanvaselement.width' in that specification.
HTMLCanvasElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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=...
HTMLCollection.item - Web APIs
see the example below.
HTMLDListElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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">even...
HTMLDataElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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><polylin...
HTMLDataListElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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">eventtar...
HTMLDetailsElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/htmldetailselement" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmldetailsele...
HTMLDialogElement.close() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLDialogElement.open - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLDialogElement.returnValue - Web APIs
examples the following example displays a button to open a <dialog> containing a form via the showmodal() method.
HTMLDialogElement.showModal() - Web APIs
examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method.
HTMLDivElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 ...
HTMLDocument - Web APIs
<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-baselin...
HTMLElement: change event - Web APIs
try entering something into the field below, and then click somewhere else to trigger the event.
HTMLElement.contentEditable - Web APIs
this enumerated attribute can have the following values: 'true' indicates that the element is contenteditable.
HTMLElement.dir - Web APIs
WebAPIHTMLElementdir
browsers might allow users to change the directionality of <input> and <textarea>s in order to assist with authoring content.
inert - Web APIs
WebAPIHTMLElementinert
check out the following polyfills: inert ...
HTMLElement.innerText - Web APIs
html <h3>source element:</h3> <p id="source"> <style>#source { color: red; } #text { text-transform: uppercase; }</style> <span id=text>take a look at<br>how this text<br>is interpreted below.</span> <span style="display:none">hidden text</span> </p> <h3>result of textcontent:</h3> <textarea id="textcontentoutput" rows="6" cols="30" readonly>...</textarea> <h3>result of innertext:</h3> <textarea id="innertextoutput" rows="6" cols="30" readonly>...</textarea> javascript const source = document.getelementbyid("source"); const textcontentoutput = document.getelementbyid("textcontento...
HTMLElement.offsetHeight - Web APIs
floated elements extending below other linear content are ignored.
HTMLElement.offsetParent - Web APIs
note: offsetparent returns null in the following situations: the element or its parent element has the display property set to none.
HTMLElement.oncut - Web APIs
WebAPIHTMLElementoncut
example this example allows text to be copied from the <textarea>, but doesn't allow text to be cut.
HTMLElement.outerText - Web APIs
example see this stackoverflow answer.
HTMLElement: pointercancel event - Web APIs
after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave.
HTMLElement: transitioncancel event - Web APIs
ansition = document.queryselector('.transition'); transition.addeventlistener('transitioncancel', () => { console.log('transition canceled'); }); the same, but using the ontransitioncancel property instead of addeventlistener(): const transition = document.queryselector('.transition'); transition.ontransitioncancel = () => { console.log('transition canceled'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition"></div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform background; transition-duration: 2s; transition-delay: 2s; } .transition:hover { transform: rotate(90deg); background: rgba(25...
HTMLElement: transitionend event - Web APIs
d adds a listener to the transitionend event: const transition = document.queryselector('.transition'); transition.addeventlistener('transitionend', () => { console.log('transition ended'); }); the same, but using the ontransitionend: const transition = document.queryselector('.transition'); transition.ontransitionend = () => { console.log('transition ended'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backgr...
HTMLElement: transitionrun event - Web APIs
event: el.addeventlistener('transitionrun', () => { console.log('transition is running but hasn\'t necessarily started transitioning yet'); }); the same, but using the ontransitionrun property instead of addeventlistener(): el.ontransitionrun = () => { console.log('transition started running, and will start transitioning when the transition delay has expired'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backg...
HTMLElement: transitionstart event - Web APIs
event handler property ontransitionstart examples this code adds a listener to the transitionstart event: element.addeventlistener('transitionstart', () => { console.log('started transitioning'); }); the same, but using the ontransitionstart property instead of addeventlistener(): element.ontransitionrun = () => { console.log('started transitioning'); }; live example in the following example, we have a simple <div> element, styled with a transition that includes a delay: <div class="transition">hover over me</div> <div class="message"></div> .transition { width: 100px; height: 100px; background: rgba(255,0,0,1); transition-property: transform, background; transition-duration: 2s; transition-delay: 1s; } .transition:hover { transform: rotate(90deg); backg...
HTMLEmbedElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
HTMLFontElement.color - Web APIs
the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid name color string nameofcolor (case insensitive) green green green valid hex color string in rgb format: #rrggbb #008000 rgb using decimal values rgb(x,x,x) (x in 0-255 range) rgb(0,128,0) syntax colorstring = fontobj.color; fontobj.color = colorstring; examples // assumes there is <font id="f"> element in the html var f = document.getelementbyid("f"); f.color = "green"; specifications the <font...
HTMLFontElement.face - Web APIs
the format of the string must follow one of the following html microsyntax: microsyntax description examples list of one or more valid font family names a list of font names, that have to be present on the local system courier,verdana syntax facestring = fontobj.face; fontobj.face = facestring; examples // assumes there is <font id="f"> element in the html var f = document.getelementbyi...
HTMLFontElement.size - Web APIs
the format of the string must follow one of the following html microsyntaxes: microsyntax description examples valid size number string integer number in the range of 1-7 6 relative size string +x or -x, where x is the number relative to the value of the size attribute of the <basefont> element (the result should be in the same range of 1-7) +2 -1 syntax sizestring = fontobj.size; fontobj.size = sizestring; examples // assumes there is <font id="f"> element in the h...
HTMLFormControlsCollection - Web APIs
<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/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" t...
HTMLFormElement.enctype - Web APIs
multipart/form-data: the type that allows file <input> element(s) to upload file data.
HTMLFormElement.length - Web APIs
the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms.
HTMLFormElement.name - Web APIs
internet explorer (ie) does not allow the name attribute of an element created using createelement() to be set or modified using the name property.
HTMLFormElement.requestSubmit() - Web APIs
examples in the example below, the form is submitted by attempting to send the request using requestsubmit() if it's available.
HTMLHeadingElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 poi...
HTMLHtmlElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
HTMLHyperlinkElementUtils.hash - Web APIs
the htmlhyperlinkelementutils.hash property returns a usvstring containing a '#' followed by the fragment identifier of the url.
HTMLHyperlinkElementUtils.href - Web APIs
the htmlhyperlinkelementutils.href property is a stringifier that returns a usvstring containing the whole url, and allows the href to be updated.
HTMLHyperlinkElementUtils.origin - Web APIs
the htmlhyperlinkelementutils.origin read-only property is a usvstring containing the unicode serialization of the origin of the represented url; that is: for url using the http or https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified); for url using file: scheme, the value is browser dependant; for url using the blob: scheme, the origin of the url following blob:.
HTMLHyperlinkElementUtils.pathname - Web APIs
the htmlhyperlinkelementutils.pathname property is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path).
HTMLHyperlinkElementUtils.search - Web APIs
the htmlhyperlinkelementutils.search property is a search string, also called a query string, that is usvstring containing a '?' followed by the parameters of the url.
HTMLIFrameElement.setNfcFocus() - Web APIs
default is false; set to true to allow it to receive nfc events.
Image() - Web APIs
examples var myimage = new image(100, 200); myimage.src = 'picture.jpg'; document.body.appendchild(myimage); this would be the equivalent of defining the following html tag inside the <body>: <img width="100" height="200" src="picture.jpg"> specifications specification status comment html living standardthe definition of 'image()' in that specification.
HTMLImageElement.border - Web APIs
for example, if you have the following html: <img src="image.png" border="2"> the following will provide the same appearance using css instead of this obsolete property: <img src="image.png" style="border: 2px;"> you can further provide additional information to change the color and other features of the border: <img src="image.png" style="border: dashed 2px #333388;"> specifications specification status comme...
HTMLImageElement.decoding - Web APIs
usage notes the decoding property allows you to control whether or not the browser is allowed to try to parallelize loading your image.
HTMLImageElement.src - Web APIs
as an equivalent for specifying an image in srcset with the size multiplier 1x; that is, the image specified by src is used on low-density screens (such as typical 72 dpi or 96 dpi displays).
HTMLImageElement.useMap - Web APIs
consider a <map> that looks like this: <map name="mainmenu-map"> <area shape="circle" coords="25, 25, 75, 75" href="/index.html" alt="return to home page"> <area shape="rect" coords="25, 25, 100, 150" href="/index.html" alt="shop"> </map> given the image map named mainmenu-map, the image which uses it should look something like the following: <img src="menubox.png" usemap="#mainmenu-map"> for additional examples (including interactive ones), see the articles about the <map> and <area> elements, as well as the guide to using image maps.
HTMLInputElement.stepUp() - Web APIs
the stepup will not allow the input to out of range, in this case stopping when it reaches 400, and rounding down any floats that are passed as a parameter.
HTMLInputElement.webkitEntries - Web APIs
more specifically, files are represented by filesystemfileentry objects, and, if they're allowed, directories are represented by filesystemdirectoryentry objects.
HTMLInputElement.webkitdirectory - Web APIs
syntax htmlinputelement.webkitdirectory = boolvalue value a boolean; true if the <input> element should allow picking only directories or false if only files should be selectable.
HTMLMapElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="...
HTMLMediaElement.autoplay - Web APIs
syntax htmlmediaelement.autoplay = true | false; var autoplay = htmlmediaelement.autoplay; value a boolean whose value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption.
HTMLMediaElement.canPlayType() - Web APIs
the string will be one of the following values: probably media of the type indicated by the mediatype parameter is probably playable on this device.
HTMLMediaElement.captureStream() - Web APIs
the stream can then be used for other purposes—like a source for streaming over webrtc, to allow sharing prerecorded videos with another person during a video call.
HTMLMediaElement.defaultPlaybackRate - Web APIs
1.0 is "normal speed," values lower than 1.0 make the media play slower than normal, higher values make it play faster.
HTMLMediaElement.disableRemotePlayback - Web APIs
the htmlmediaelement.disableremoteplayback property determines whether the media element is allowed to have a remote playback ui.
HTMLMediaElement: loadstart event - Web APIs
tlistener('canplay', handleevent); video.addeventlistener('canplaythrough', handleevent); loadvideo.addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('source'); source.setattribute('src', 'https://interactive-examples.mdn.mozilla.net/media/examples/flower.webm'); source.setattribute('type', 'video/webm'); video.appendchild(source); } }); result specifications specification status html living standardthe definition of 'loadstart media event' in that specification.
HTMLMediaElement.onencrypted - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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-base...
HTMLMediaElement.onwaitingforkey - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
HTMLMediaElement: progress event - Web APIs
tlistener('canplay', handleevent); video.addeventlistener('canplaythrough', handleevent); loadvideo.addeventlistener('click', () => { if (source) { document.location.reload(); } else { loadvideo.textcontent = "reset example"; source = document.createelement('source'); source.setattribute('src', 'https://interactive-examples.mdn.mozilla.net/media/examples/flower.webm'); source.setattribute('type', 'video/webm'); video.appendchild(source); } }); result specifications specification status html living standardthe definition of 'progress media event' in that specification.
HTMLMediaElement.seekToNextFrame() - Web APIs
if the seek fails because the media is already at the last frame, a seeked event occurs, followed immediately by an ended event.
HTMLMenuElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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">eventtarge...
HTMLMenuItemElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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">ev...
HTMLModElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
HTMLOptGroupElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="mid...
Option() - Web APIs
examples just add new options /* assuming we have the following html <select id='s'> </select> */ var s = document.getelementbyid('s'); var options = [four, five, six]; options.foreach(function(element,key) { s[key] = new option(element,key); }); append options with different parameters /* assuming we have the following html <select id="s"> <option>first</option> <option>second</option> <option>third</option> </select> */ var s = doc...
HTMLOptionElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="...
HTMLElement.focus() - Web APIs
this object may contain the following property: preventscroll optional a boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view.
HTMLOrForeignElement.nonce - Web APIs
the nonce property of the htmlorforeignelement interface returns the cryptographic number used once that is used by content security policy to determine whether a given fetch will be allowed to proceed.
HTMLOutputElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 poi...
HTMLPictureElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" str...
HTMLProgressElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" alignme...
HTMLQuoteElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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-ancho...
HTMLScriptElement.referrerPolicy - Web APIs
syntax refstr = scriptelem.referrerpolicy; scriptelem.referrerpolicy = refstr; value a domstring; one of the following: no-referrer the referer header will be omitted entirely.
HTMLSelectElement.form - Web APIs
the below code gives all select elements in a particular form a css class of "selectclass": <script type="text/javascript"> var form_element = document.getelementbyid('subscribe_form'); var vist = form_element.style; if (vist.display=='' || vist.display=='none') { vist.display = 'block'; } else { vist.display = 'none'; } </script> specifications specification status comment ...
HTMLSelectElement.remove() - Web APIs
example var sel = document.getelementbyid("existinglist"); sel.remove(1); /* takes the existing following select object: <select id="existinglist" name="existinglist"> <option value="1">option: value 1</option> <option value="2">option: value 2</option> <option value="3">option: value 3</option> </select> and changes it to: <select id="existinglist" name="existinglist"> <option value="1">option: value 1</option> <option value="3">option: value 3</option> </select> ...
HTMLShadowElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
HTMLSlotElement.assignedNodes() - Web APIs
examples the following snippet is taken from our slotchange example (see it live also).
HTMLSlotElement.name - Web APIs
examples the following snippet is taken from our slotchange example (see it live also).
HTMLSlotElement: slotchange event - Web APIs
examples element.setattribute('slot', slotname); // element.assignedslot = $slot element.removeattribute('slot'); // element.assignedslot = null the following snippet is taken from our slotchange example (see it live also).
HTMLSlotElement - Web APIs
examples the following snippet is taken from our slotchange example (see it live also).
HTMLSpanElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
HTMLTableCaptionElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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</...
HTMLTableColElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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</...
HTMLTableElement.align - Web APIs
syntax htmltableelement.align = alignment; var alignment = htmltableelement.align; parameters alignment domstring with one of the following values: left center right example // set the alignmnet of a table var t = document.getelementbyid('tablea'); t.align = 'center'; specification w3c dom 2 html specification htmltableelement .align.
HTMLTableElement.rows - Web APIs
although the property itself is read-only, the returned object is live and allows the modification of its content.
HTMLTableElement.rules - Web APIs
syntax htmltableelement.rules = rules; var rules = htmltableelement.rules; parameters rules is a string with one of the following values: none no rules groups lines between groups only rows lines between rows cols lines between cols all lines between all cells example // turn on all the internal borders of a table var t = document.getelementbyid("tableid"); t.rules = "all"; specification w3c dom 2 html specification ...
HTMLTableElement.tBodies - Web APIs
although the property is read-only, the returned object is live and allows the modification of its content.
HTMLTemplateElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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="...
HTMLTimeElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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><polylin...
HTMLTitleElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 ...
HTMLUListElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
HTMLUnknownElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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 p...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
for msislayoutoptimalforplayback to be true, avoid the following: video elements with cascading style sheets (css) outlines set.
msStereo3DPackingMode - Web APIs
syntax htmlvideoelement.msstereo3dpackingmode(topbottom, sidebyside, none); value the following values return, or set, the stereo 3-d content packing as "topbottom", "sidebyside", or "none" for regular 2-d video.
msStereo3DRenderMode - Web APIs
syntax htmlvideoelement.msstereo3drendermode(mono, stereo); value the following values set the stereo display to mono or stereo.
HTMLVideoElement - Web APIs
<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" tex...
Headers() - Web APIs
WebAPIHeadersHeaders
in the following snippet we create a new headers object, adding some headers by passing the constructor an init object as an argument: var httpheaders = { 'content-type' : 'image/jpeg', 'accept-charset' : 'utf-8', 'x-my-custom-header' : 'zeke are cool' }; var myheaders = new headers(httpheaders); you can now create another headers object, passing it the first headers object as its init object: var secondhea...
Headers.delete() - Web APIs
WebAPIHeadersdelete
this method throws a typeerror for the following reasons: the value of the name parameter is not the name of an http header.
Headers.entries() - Web APIs
WebAPIHeadersentries
the headers.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
Headers.keys() - Web APIs
WebAPIHeaderskeys
the headers.keys() method returns an iterator allowing to go through all keys contained in this object.
Headers.values() - Web APIs
WebAPIHeadersvalues
the headers.values() method returns an iterator allowing to go through all values contained in this object.
History.back() - Web APIs
WebAPIHistoryback
syntax history.back() examples the following short example causes a button on the page to navigate back one entry in the session history.
History.forward() - Web APIs
WebAPIHistoryforward
syntax history.forward() examples the following examples create a button that moves forward one step in the session history.
History.go() - Web APIs
WebAPIHistorygo
examples to move back one page (the equivalent of calling back()): history.go(-1) to move forward a page, just like calling forward(): history.go(1) to move forward two pages: history.go(2); to move backwards by two pages: history.go(-2); and, finally either of the following statements will reload the current page: history.go(); history.go(0); specifications specification status comment html living standardthe definition of 'history.go()' in that specification.
History.scrollRestoration - Web APIs
the scrollrestoration property of history interface allows web applications to explicitly set default scroll restoration behavior on history navigation.
History.state - Web APIs
WebAPIHistorystate
examples the code below logs the value of history.state before using the pushstate() method to push a value to the history.
IDBCursor.delete() - Web APIs
WebAPIIDBCursordelete
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive.
IDBCursor.direction - Web APIs
see the values section below for possible values.
IDBCursorWithValue - Web APIs
<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/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-an...
IDBDatabase.deleteObjectStore() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback.
IDBDatabase.name - Web APIs
WebAPIIDBDatabasename
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.
IDBDatabase.objectStoreNames - Web APIs
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.
IDBDatabase.version - Web APIs
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.
IDBEnvironment - Web APIs
example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open("todolist"); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; }; } browser compatibility the compatibility table on this page is generated from struc...
IDBFactory.cmp() - Web APIs
WebAPIIDBFactorycmp
return value an integer that indicates the result of the comparison; the table below lists the possible values and their meanings: returned value description -1 1st key is less than the 2nd key 0 1st key is equal to the 2nd key 1 1st key is greater than the 2nd key exceptions this method may raise a domexception of the following types: attribute description dataerror one of the supplied keys was not...
databases - Web APIs
exceptions this method may raise a domexception of the following types: attribute description securityerror the method is called from an opaque origin.
IDBFactory.deleteDatabase() - Web APIs
syntax for the current standard: var request = indexeddb.deletedatabase(name); for the experimental version with options (see below): var request = indexeddb.deletedatabase(name, options); parameters name the name of the database you want to delete.
IDBFactorySync - Web APIs
exceptions this method can raise an idbdatabaseexception with the following codes: non_transient_err if the name parameter is not valid.
IDBIndex.isAutoLocale - Web APIs
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.keyPath - Web APIs
WebAPIIDBIndexkeyPath
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.locale - Web APIs
WebAPIIDBIndexlocale
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.multiEntry - Web APIs
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.name - Web APIs
WebAPIIDBIndexname
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBIndex.objectStore - Web APIs
example in the following example we open a transaction and an object store, then get the index lname from a simple contacts database.
IDBLocaleAwareKeyRange - Web APIs
this is because when you use bound(), it checks if lower bound < upper bound, and throws an exception if that’s not the case.
FileHandle.getFile() - Web APIs
summary the getfile method allows to retrieve a read-only snapshot of the handled file in the form of a file object.
FileHandle.open() - Web APIs
summary the open method returns a lockedfile object that allows to safely write in the file.
IDBObjectStore.count() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore has been deleted.
IDBObjectStore.getKey() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbobjectstore's transaction is inactive.
IDBObjectStore.openCursor() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted.
IDBObjectStore.openKeyCursor() - Web APIs
exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted.
IDBObjectStore - Web APIs
duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("todolist"); // make a request to add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { note.innerhtml += '<li>request successful .</li>'; } specifications specification status comment ...
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.
IDBRequest.onerror - Web APIs
}; example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store.
IDBRequest.onsuccess - Web APIs
}; example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store.
IDBRequest.result - Web APIs
WebAPIIDBRequestresult
syntax var myresult = request.result; value any example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store.
IDBRequest.source - Web APIs
WebAPIIDBRequestsource
example the following example requests a given record title, onsuccess gets the associated record from the idbobjectstore (made available as objectstoretitlerequest.result), updates one property of the record, and then puts the updated record back into the object store in another request.
IDBTransaction: abort event - Web APIs
bubbles yes cancelable no interface event event handler property onabort this can happen for any of the following reasons: bad requests, (for example, trying to add the same key twice, or put the same index key when the key has a uniqueness constraint), an explicit abort() call an uncaught exception in the request's success/error handler, an i/o error (an actual failure to write to disk, for example disk detached, or other os/hardware failure) quota exceeded.
IDBTransaction.commit() - Web APIs
duplicate items not allowed.</li>'; }; // create an object store on the transaction var objectstore = transaction.objectstore("myobjstore"); // add our newitem object to the object store var objectstorerequest = objectstore.add(newitem[0]); objectstorerequest.onsuccess = function(event) { // report the success of the request (this does not mean the item // has been stored successfully in the db - for that you need ...
IIRFilterNode() - Web APIs
options options are as follows: feedforward: a sequence of feedforward coefficients.
IIRFilterNode.getFrequencyResponse() - Web APIs
examples in the following example we are using an iir filter on a media stream (for a complete full demo, see our stream-source-buffer demo live, or read its source.) as part of this demo, we get the frequency responses for this iir filter, for five sample frequencies.
ImageCapture() constructor - Web APIs
example the following example shows how to use a call to mediadevices.getusermedia() to retrieve the mediastreamtrack needed by the imagecapture() constructor.
ImageCapture.getPhotoCapabilities() - Web APIs
example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotocapabilities() to modify the size of an input range.
InputDeviceCapabilities - Web APIs
it contains the following property.
InputDeviceCapabilities - Web APIs
this allows, for example, touchscreen keyboards and physical keyboards to be represented the same way when they produce the same input.
InputEvent() - Web APIs
inputeventinitoptional is a inputeventinit dictionary, having the following fields: inputtype: (optional) a string specifying the type of change for editible content such as, for example, inserting, deleting, or formatting text.
InputEvent.data - Web APIs
WebAPIInputEventdata
examples in the following simple example we've set up an event listener on the input event so that when any change is made to the contents of the <input> element (either by typing or pasting), the text that was added is retrieved via the inputevent.data property and reported in the paragraph below the input.
InputEvent.dataTransfer - Web APIs
examples in the following simple example we've set up an event listener on the input event so that when any content is pasted into the contenteditable <p> element, its html source is retrieved via the inputevent.datatransfer.getdata() method and reported in the paragraph below the input.
InputEvent - Web APIs
<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/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"...
InstallEvent.InstallEvent() - Web APIs
available options are as follows: activeworker: the serviceworker that is currently actively controlling the page.
InstallEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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-anch...
enabled - Web APIs
example the following code uses the startsoftwareupdate method to unconditionally trigger a download from http://royalairways/royalpkg.xpi as long as software installation is enabled on the browser: if (installtrigger.enabled() ) { installtrigger.startsoftwareupdate ("http://royalair.com/rasoft.xpi"); } ...
installChrome - Web APIs
method of installtrigger object syntax int installchrome( type, url, name ) parameters the installchrome method has the following parameters: type type can be installtrigger.skin or installtrigger.locale.
InstallTrigger - Web APIs
the following is a basic example of an install trigger on a web page: xpi={'xpinstall dialog display name':'simple.xpi'}; installtrigger.install(xpi); you can also use the installtrigger object to install netscape 6/mozilla skins and language packs, and perform multiple-package installations with install.
IntersectionObserver.IntersectionObserver() - Web APIs
you can provide any combination of the following options: root an element or document object which is an ancestor of the intended target, whose bounding rectangle will be considered the viewport.
IntersectionObserver.observe() - Web APIs
note that this design allows multiple elements' intersection changes to be processed by a single call to the callback.
InterventionReportBody - Web APIs
so for example, a script was been stopped because it was significantly slowing down the browser, or the browser's autoplay policy blocked audio from playing without a user gesture to trigger it.
Keyboard.getLayoutMap() - Web APIs
example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard.
Keyboard - Web APIs
WebAPIKeyboard
example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard.
KeyboardEvent() - Web APIs
keyboardeventinitoptional is a keyboardeventinit dictionary, having the following fields: "key", optional and defaulting to "", of type domstring, that sets the value of keyboardevent.key.
KeyboardEvent.charCode - Web APIs
example html <p>type anything into the input box below to log a <code>charcode</code>.</p> <input type="text" /> <p id="log"></p> javascript let input = document.queryselector('input'); let log = document.queryselector('#log'); input.addeventlistener('keypress', function(e) { log.innertext = `key pressed: ${string.fromcharcode(e.charcode)}\ncharcode: ${e.charcode}`; }); result notes in a keypress event, the unicode value of the key presse...
KeyboardEvent.initKeyEvent() - Web APIs
the initkeyevent is the current gecko equivalent of the dom level 3 events (initially drafted and also deprecated in favor of keyboardevent() keyboard.initkeyboardevent() method with the following arguments : typearg of type domstring canbubblearg of type boolean cancelablearg of type boolean viewarg of type views::abstractview keyidentifierarg of type domstring keylocationarg of type unsigned long modifierslist of type domstring); ...
KeyboardLayoutMap.get() - Web APIs
example the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard.
KeyboardLayoutMap - Web APIs
examples the following example demonstrates how to get the location- or layout-specific string associated with the key that corresponds to the 'w' key on an english qwerty keyboard.
KeyframeEffect.getKeyframes() - Web APIs
return value returns a sequence of objects with the following format: property value pairs as many property value pairs as are contained in each keyframe of the animation.
KeyframeEffect.target - Web APIs
examples in the follow the white rabbit example, whiterabbit sets the target element to be animated: var whiterabbit = document.getelementbyid("rabbit"); var rabbitdownkeyframes = new keyframeeffect( whiterabbit, [ { transform: 'translatey(0%)' }, { transform: 'translatey(100%)' } ], { duration: 3000, fill: 'forwards' } ); // returns <div id=​"rabbit">​click the rabbit's ears!​</div>​ rabbitd...
LayoutShift - Web APIs
examples the following example shows how to capture layout shifts and log them to the console.
LinearAccelerationSensor.LinearAccelerationSensor() - Web APIs
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.
LinearAccelerationSensor.x - Web APIs
in the example below this occurs sixty times a second.
LinearAccelerationSensor.y - Web APIs
in the example below this occurs sixty times a second.
LinearAccelerationSensor.z - Web APIs
in the example below this occurs sixty times a second.
LinearAccelerationSensor - Web APIs
in the example below this occurs sixty times a second.
Location: hash - Web APIs
WebAPILocationhash
the hash property of the location interface returns a usvstring containing a '#' followed by the fragment identifier of the url.
Location: href - Web APIs
WebAPILocationhref
the href property of the location interface is a stringifier that returns a usvstring containing the whole url, and allows the href to be updated.
Location: origin - Web APIs
WebAPILocationorigin
the origin read-only property of the location interface is a usvstring containing the unicode serialization of the origin of the represented url; that is: for url using the http or https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified); for url using file: scheme, the value is browser dependant; for url using the blob: scheme, the origin of the url following blob:.
Location: pathname - Web APIs
WebAPILocationpathname
the pathname property of the location interface is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path).
Location: search - Web APIs
WebAPILocationsearch
the search property of the location interface is a search string, also called a query string; that is, a usvstring containing a '?' followed by the parameters of the url.
Locks.mode - Web APIs
WebAPILockmode
example the following examples show how the mode property is passed in the call to lockmanager.request().
Locks.name - Web APIs
WebAPILockname
example the following examples show how the name property passed in the call to lockmanager.request().
Lock - Web APIs
WebAPILock
examples the following examples show how the mode and name properties are passed in the call to lockmanager.request().
LockManager.query() - Web APIs
WebAPILockManagerquery
return value a promise that resolves with a lockmanagersnapshot containing the following properties.
LockedFile.active - Web APIs
WebAPILockedFileactive
the active property allows to know if the lockedfile object is still usable (true) or not (false).
LockedFile.flush() - Web APIs
WebAPILockedFileflush
this allows fast writing and reading operations.
Long Tasks API - Web APIs
expensive reflows and other re-renders.
MSCandidateWindowUpdate - Web APIs
tan ime candidate window may be identified as needing to change size for any of the following reasons: as a result of displaying new / changed alternatives or predictions web applications need only register for this event once per element (the handler will remain valid for the lifetime of the element).
MSGraphicsTrust - Web APIs
syntax var trustobject = media.msgraphicstruststatus; parameters constrictionactive a read-only property which returns true when protected media is forced to play in a lower resolution.
Magnetometer.Magnetometer() - Web APIs
syntax var magnetometer = new magnetometer([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.
Magnetometer.x - Web APIs
WebAPIMagnetometerx
in the example below this occurs sixty times a second.
Magnetometer.y - Web APIs
WebAPIMagnetometery
in the example below this occurs sixty times a second.
Magnetometer.z - Web APIs
WebAPIMagnetometerz
in the example below this occurs sixty times a second.
Magnetometer - Web APIs
in the example below this occurs sixty times a second.
MediaConfiguration - Web APIs
all of these must be present, as in the examples below, or a typeerror will occur.
MediaDevices.getSupportedConstraints() - Web APIs
html <p>the following media constraints are supported by your browser:</p> <ul id="constraintlist"> </ul> css body { font: 15px arial, sans-serif; } javascript let constraintlist = document.getelementbyid("constraintlist"); let supportedconstraints = navigator.mediadevices.getsupportedconstraints(); for (let constraint in supportedconstraints) { if (supportedconstraints.hasownproperty(constraint)) { ...
MediaDevices - Web APIs
; }) .catch(function(error) { if (error.name === 'constraintnotsatisfiederror') { errormsg('the resolution ' + constraints.video.width.exact + 'x' + constraints.video.height.exact + ' px is not supported by your device.'); } else if (error.name === 'permissiondeniederror') { errormsg('permissions have not been granted to use your camera and ' + 'microphone, you need to allow the page access to your devices in ' + 'order for the demo to work.'); } errormsg('getusermedia error: ' + error.name, error); }); function errormsg(msg, error) { errorelement.innerhtml += '<p>' + msg + '</p>'; if (typeof error !== 'undefined') { console.error(error); } } specifications specification status comment media capture and streamsthe de...
MediaError.code - Web APIs
WebAPIMediaErrorcode
the possible values are described below, in media error code constants.
MediaError.message - Web APIs
result you can try out this example below, and can see the example in action outside this page here.
MediaError - Web APIs
mediaerror.code a number which represents the general type of error that occurred, as follows: name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request.
MediaKeyMessageEvent() - Web APIs
options options are as follows: messagetype: a developer-defined message type that allows applications to differentiate messages without parsing them.
MediaKeyMessageEvent - Web APIs
<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/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</...
MediaKeySession.onkeystatuseschange - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
MediaKeySession.onmessage - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
MediaMetadata - Web APIs
the mediametadata interface of the the media session api provides allows a web page to provide rich media metadata for display in a platform ui.
MediaPositionState.playbackRate - Web APIs
lower values indicate the media is being played more slowly.
MediaRecorder() - Web APIs
options optional a dictionary object that can contain the following properties: mimetype: a mime type specifying the format for the resulting media; you may simply specify the container format (the browser will select its preferred codecs for audio and/or video), or you may use the codecs parameter and/or the profiles parameter to provide detailed information about which codecs to use and how to configure them.
MediaRecorder: error event - Web APIs
the mediarecorder interface's error event is fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsupported codec.
MediaRecorder.mimeType - Web APIs
}) .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.
MediaRecorder.onpause - Web APIs
the mediarecorder.onpause event handler (part of the mediarecorder api) handles the pause event, allowing you to run code in response to the media recording being paused.
MediaRecorder.onresume - Web APIs
the mediarecorder.onresume event handler (part of the mediarecorder api) handles the resume event, allowing you to run code in response to the media recording being resumed after pausing.
MediaRecorder.onstart - Web APIs
the mediarecorder.onstartevent handler (part of the mediarecorder api) handles the start event, allowing you to run code in response to media recording being started by a mediarecorder.
MediaRecorder.onstop - Web APIs
the mediarecorder.onstop event handler (part of the mediarecorder api) handles the stop event, allowing you to run code in response to media recording via a mediarecorder being stopped.
MediaRecorder.onwarning - Web APIs
the mediarecorder.onwarning event handler (part of the mediarecorder api) handles the recordingwarning event, allowing you to run code in response to non-fatal errors being thrown during media recording via a mediarecorder, which don't halt recording.
MediaRecorder.pause() - Web APIs
when a mediarecorder object’s pause()method is called, the browser queues a task that runs the below steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaRecorder.requestData() - Web APIs
when the requestdata() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is not "recording", raise a dom invalidstate error and terminate these steps.
MediaRecorder.resume() - Web APIs
when the resume() method is invoked, the browser queues a task that runs the following steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaRecorder.state - Web APIs
syntax var state = mediarecorder.state values a animationplaystate object containing one of the following values: enumeration description inactive recording is not occuring — it has either not been started yet, or it has been started and then stopped.
MediaRecorder.stop() - Web APIs
when the stop() method is invoked, the ua queues a task that runs the following steps: if mediarecorder.state is "inactive", raise a dom invalidstate error and terminate these steps.
MediaSession.metadata - Web APIs
example the following example creates a new media session and assigns action handlers to it: if ('mediasession' in navigator){ navigator.mediasession.metadata = new mediametadata({ title: "podcast episode title", artist: "podcast host", album: "podcast name", artwork: [{src: "podcast.jpg"}] }); navigator.mediasession.setactionhandler('play', function() {}); navigator.mediasession.setactionh...
MediaSettingsRange - Web APIs
example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotocapabilities().imagewidth to modify the size of an input range.
MediaSource.MediaSource() - Web APIs
example the following snippet is taken from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.crea...
MediaSource.activeSourceBuffers - Web APIs
example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) {...
MediaSource.addSourceBuffer() - Web APIs
example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec))...
MediaSource.endOfStream() - Web APIs
their sourcebuffer.updating property is true.) example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec))...
MediaSource.isTypeSupported() - Web APIs
example the following snippet is from an example written by nick desaulniers (view the full demo live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { v...
MediaSource.readyState - Web APIs
example the following snippet is from a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sou...
MediaSource.sourceBuffers - Web APIs
example the following snippet is based on a simple example written by nick desaulniers (view the full demo live, or download the source for further investigation.) function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) { mediasource.endofstream(); console.log(mediasource.sourcebuffers); // will contain the source b...
MediaStream.getVideoTracks() - Web APIs
example the following example, extracted from chrome's image capture / photo resolution sample, uses getvideotracks() to retrieve a track for passing to the imagecapture() constructor.
MediaStreamAudioSourceNode() - Web APIs
evices.getusermedia ( // constraints: audio and video for this app { audio: true, video: false }).then(function(stream) { var options = { mediastream : stream } var source = new mediastreamaudiosourcenode(audioctx, options); source.connect(audioctx.destination); }).catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('new getusermedia not supported on your browser!'); } specifications specification status comment web audio apithe definition of 'mediastreamaudiosourcenode()' in that specification.
MediaStreamConstraints - Web APIs
properties some combination—but not necessarily all—of the following properties will exist on the object.
MediaStreamEvent() - Web APIs
mediastreameventinit is a mediastreameventinit dictionary, having the following fields: "stream" of type mediastream representing the stream being concerned by the event.
MediaStreamTrack.enabled - Web APIs
the enabled property on the mediastreamtrack interface is a boolean value which is true if the track is allowed to render the source stream or false if it is not.
MediaStreamTrack.getConstraints() - Web APIs
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.
MediaStreamTrack.kind - Web APIs
syntax const type = track.kind value the possible values are a domstring with on of the following values: "audio": the track is an audio track.
MediaStreamTrack.readyState - Web APIs
syntax const state = track.readystate value it takes one of the following values: "live" which indicates that an input is connected and does its best-effort in providing real-time data.
MediaStreamTrack.remote - Web APIs
the mediastreamtrack.remote read-only property allows javascript to know whether a webrtc mediastreamtrack is from a remote source or a local one.
MediaStreamTrackAudioSourceNode() - Web APIs
iadevices.getusermedia) { navigator.mediadevices.getusermedia ( { audio: true, video: false }).then(function(stream) { let options = { mediastreamtrack: stream.getaudiotracks()[0]; } let source = new mediastreamtrackaudiosourcenode(audioctx, options); source.connect(audioctx.destination); }).catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('new getusermedia not supported on your browser!'); } specifications specification status comment web audio apithe definition of 'mediastreamtrackaudiosourcenode()' in that specification.
MediaStreamTrackAudioSourceOptions.mediaStreamTrack - Web APIs
iadevices.getusermedia) { navigator.mediadevices.getusermedia ( { audio: true, video: false }).then(function(stream) { let options = { mediastreamtrack: stream.getaudiotracks()[0]; } let source = new mediastreamtrackaudiosourcenode(audioctx, options); source.connect(audioctx.destination); }).catch(function(err) { console.log('the following gum error occured: ' + err); }); } else { console.log('new getusermedia not supported on your browser!'); } specifications specification status comment web audio apithe definition of 'mediastreamtrackaudiosourceoptions.mediastream' in that specification.
MediaStreamTrackEvent - Web APIs
<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/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-anch...
MediaTrackConstraints.cursor - Web APIs
for example, if your app needs to alter the stream by inserting a representation of the cursor position if the stream doesn't include the rendered cursor, you can determine the need to do so by using code like this: let insertfakecursorflag = false; if (displaystream.getvideotracks()[0].getsettings().cursor === "never") { insertfakecursorflag = true; } following this code, insertfakecursorflag is true if there's no cursor rendered into the stream already.
MediaTrackConstraints.displaySurface - Web APIs
your app needs to know that the surface being shared is a monitor or application—meaning that there's possibly a non-content backdrop—it can use code similar to this: let mayhavebackdropflag = false; let displaysurface = displaystream.getvideotracks()[0].getsettings().displaysurface; if (displaysurface === "monitor" || displaysurface ==="application") { mayhavebackdropflag = true; } following this code, mayhavebackdrop is true if the display surface contained in the stream is of type monitor or application; either of these may have non-content backdrop areas.
MediaTrackConstraints.facingMode - Web APIs
the following strings are permitted values for the facing mode.
MediaTrackConstraints.latency - Web APIs
in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable.
MediaTrackSettings.cursor - Web APIs
syntax cursorsetting = mediatracksettings.cursor; value the value of cursor comes from the cursorcaptureconstraint enumerated string type, and may have one of the following values: always the mouse should always be visible in the video content of the {domxref("mediastream"), unless the mouse has moved outside the area of the content.
MediaTrackSettings.displaySurface - Web APIs
syntax displaysurface = mediatracksettings.displaysurface; value the value of displaysurface is a string that comes from the displaycapturesurfacetype enumerated type, and is one of the following: application the stream's video track contains all of the windows belonging to the application chosen by the user.
MediaTrackSettings.facingMode - Web APIs
videofacingmodeenum the following strings are permitted values for the facing mode.
MediaTrackSettings.logicalSurface - Web APIs
for example, a user agent may choose to allow the user to choose whether to share the entire document (a browser with logicalsurface value of true), or just the currently visible portion of the document (where the logicalsurface of the browser surface is false).
MediaTrackSettings.sampleRate - Web APIs
however, lower values are often used to reduce bandwidth requirements; 8,000 samples per second is adequate for comprehensible albeit imperfect human speech, and both 11,025 fps and 22,050 fps are often used for low-bandwidth, reduced quality sound and music.
MediaTrackSupportedConstraints.displaySurface - Web APIs
it adds the displaysurface constraint (requesting that only full-screen sharing be allowed) only if it is known to be supported by the browser.
Media Capture and Streams API (Media Stream) - Web APIs
events addtrack ended muted overconstrained removetrack started unmuted guides and tutorials the articles below provide additional guidance and how-to information that will help you learn to use the api, and how to perform specific tasks that you may wish to handle.
MerchantValidationEvent() - Web APIs
options optional an optional dictionary which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used.
MerchantValidationEvent - Web APIs
the merchantvalidationevent interface of the the payment request api enables a merchant to verify themselves as allowed to use a particular payment handler.
MessageChannel() - Web APIs
example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor.
MessageChannel.port1 - Web APIs
example in the following code block, you can see a new channel being created using the messagechannel() constructor.
MessageChannel.port2 - Web APIs
example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor.
MessageEvent.MessageEvent() - Web APIs
this can be one of xxx init optional a dictionary object that can contain the following properties: data: the data you want contained in the messageevent.
MessagePort.onmessage - Web APIs
}; example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor.
MessagePort.postMessage() - Web APIs
example in the following code block, you can see a new channel being created using the messagechannel.messagechannel constructor.
MessagePort.start() - Web APIs
WebAPIMessagePortstart
example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using onmessage: channel.port1.onmessage = handlemessage; function handlemessage(e) { para.innerhtml = e.data; } another option would be to do this using eventtarget.addeventlistener, however, when this method is used, you need to explicitly call start() to begin the flow of messages to this document: channel.port1.addeventlistener('m...
Microsoft API extensions - Web APIs
playtodisabled msplaytopreferredsourceuri msplaytoprimary msplaytosource msrealtime mssetmediaprotectionmanager mssetvideorectangle msstereo3dpackingmode msstereo3drendermode onmsvideoformatchanged onmsvideoframestepcompleted onmsvideooptimallayoutchanged msfirstpaint pinned sites apis mssitemodeevent mssitemodejumplistitemremoved msthumbnailclick other apis x-ms-aria-flowfrom x-ms-acceleratorkey x-ms-format-detection mscaching mscachingenabled mscapslockwarningoff event.msconverturl() mselementresize document.mselementsfromrect() msisstatichtml navigator.mslaunchuri() mslaunchuricallback element.msmatchesselector() msprotocols msputpropertyenabled mswriteprofilermark ...
MimeTypeArray - Web APIs
example the following example tests whether a plugin is available for the application/pdf mime type and if so, which plugin that is.
MouseEvent() - Web APIs
mouseeventinit optional is a mouseeventinit dictionary, having the following fields: "screenx", optional and defaulting to 0, of type long, that is the horizontal position of the mouse event on the user's screen; setting this value doesn't move the mouse pointer.
MouseEvent.buttons - Web APIs
each button that can be pressed is represented by a given number (see below).
MouseEvent.initMouseEvent() - Web APIs
example html <div style="background:red; width:180px; padding:10px;"> <div id="out"></div> <input type="text"> </div> javascript document.body.onclick = function(){ e = arguments[0]; var dt = e.target,stag = dt.tagname.tolowercase(); document.getelementbyid("out").innerhtml = stag; }; var simulateclick = function(){ var evt = document.createevent("mouseevents"); evt.initmouseevent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null); document.body.dispatchevent(evt); } simulateclick(); result specifications specification status comment document obj...
MouseEvent.mozInputSource - Web APIs
syntax var source = instanceofmouseevent.mozinputsource; return value the following values are possible.
MouseEvent.relatedTarget - Web APIs
html <body id="body"> <div id="outer"> <div id="red"></div> <div id="blue"></div> </div> <p id="log"></p> </body> css #outer { width: 250px; height: 125px; display: flex; } #red { flex-grow: 1; background: red; } #blue { flex-grow: 1; background: blue; } #log { max-height: 120px; overflow-y: scroll; } javascript const mouseoutlog = document.getelementbyid('log'), red = document.getelementbyid('red'), blue = document.getelementbyid('blue'); red.addeventlistener('mouseover', overlistener); red.addeventlistener('mouseout', outlistener); blue.addeventlistener('mouseover', overlistener); blue.addeventlistener('mouseout', outlistener); function outlistener(event) { let...
MouseEvent.screenX - Web APIs
lector('#screen-log'); document.addeventlistener('mousemove', logkey); function logkey(e) { screenlog.innertext = ` screen x/y: ${e.screenx}, ${e.screeny} client x/y: ${e.clientx}, ${e.clienty}`; } result routing an event when you trap events on the window, document, or other roomy elements, you can get the coordinates of that event (e.g., a click) and route it properly, as the following example demonstrates: function checkclickmap(e) { if (e.screenx < 50) doredbutton(); if (50 <= e.screenx && e.screenx < 100) doyellowbutton(); if (e.screenx >= 100) doredbutton(); } specifications specification status comment css object model (cssom) view modulethe definition of 'screenx' in that specification.
msFirstPaint - Web APIs
example the following example shows how to calculate the time that is required to request the document before the document begins to display for the user.
msPlayToPreferredSourceUri - Web APIs
this uri can point to a cloud based media server allowing streaming directly from the cloud, which can be drm protected, instead of streaming content from the windows machine which must be unprotected content.
MutationObserver.MutationObserver() - Web APIs
see the example below for more details.
MutationObserver - Web APIs
mutation observer & customize resize event listener & demo https://codepen.io/webgeeker/full/yjrzgg/ example the following example was adapted from this blog post.
NDEFReader - Web APIs
properties in addition to the properties listed below, ndefreader inherits properties from its parent interface, eventtarget.
NDEFRecord.encoding - Web APIs
syntax ndefrecord.encoding value a usvstring which can be one of the following: "utf-8", "utf-16", "utf-16le" or "utf-16be".
NDEFRecord.recordType - Web APIs
syntax ndefrecord.recordtype value a usvstring which can be one of the following: "empty" represents a empty ndef record.
NavigationPreloadManager - Web APIs
await self.registration.navigationpreload.enable(); } }()); }); using a preloaded response the following example shows the implementation of a fetch event that uses a preloaded response.
Navigator.clipboard - Web APIs
examples the following code uses navigator.clipboard to access the system clipboard in order to read the contents of the clipboard.
Navigator.connection - Web APIs
this could be used to select high definition content or low definition content based on the user's connection.
Navigator.cookieEnabled - Web APIs
for example, chrome 80+ does not allow creating cookies with samesite=none attribute, unless they are created over https and with secure attribute.
Navigator.deviceMemory - Web APIs
it is then clamped within lower and upper bounds to protect the privacy of owners of very low- or high-memory devices.
Navigator.geolocation - Web APIs
this allows a web site or app to offer customized results based on the user's location.
msSaveBlob - Web APIs
notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header, where x-download-options removes the file open button from the browser file download dialog: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> x-download-options: noopen specifications not part of any specifications.
msSaveOrOpenBlob - Web APIs
notes when a site calls this method, the behavior is the same as when windows internet explorer downloads a file with the following in the header: content-length: <blob.size> content-type: <blob.type> content-disposition: attachment;filename=<defaultname> specifications not part of any specifications.
Navigator.registerContentHandler() - Web APIs
allows web sites to register themselves as possible handlers for content of a particular mime type.
Navigator.share() - Web APIs
WebAPINavigatorshare
at least one of the following fields must be specified.
Navigator.wakeLock - Web APIs
the wakelock read-only property returns a wakelock interface which allows a document to acquire a screen wake lock.
navigator.hardwareConcurrency - Web APIs
the browser may, however, choose to report a lower number of logical cores in order to represent more accurately the number of workers that can run at once, so don't treat this as an absolute measurement of the number of cores in the user's system.
NavigatorConcurrentHardware - Web APIs
the navigatorconcurrenthardware mixin adds to the navigator interface features which allow web content to determine how many logical processors the user has available, in order to let content and web apps optimize their operations to best take advantage of the user's cpu.
NavigatorID.platform - Web APIs
the specification allows browsers to always return the empty string, so don't rely on this property to get a reliable answer.
NavigatorLanguage.language - Web APIs
note that in safari on ios prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc.
NetworkInformation.downlinkMax - Web APIs
examples the following example monitors the connection using the change event and logs changes as they occur.
NetworkInformation.type - Web APIs
syntax var type = netinfo.type return value an enumerated value that is one of the following values: "bluetooth" "cellular" "ethernet" "none" "wifi" "wimax" "other" "unknown" specifications specification status comment network information apithe definition of 'type' in that specification.
Node.baseURI - Web APIs
WebAPINodebaseURI
although this property is read-only, its value may change in certain situations (see below).
Node.cloneNode() - Web APIs
WebAPINodecloneNode
starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of a deep clone.
Node.isConnected - Web APIs
WebAPINodeisConnected
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 code for ie10 and edgehtml: /* * node.isconnected polyfill for ie and edgehtml * 2020-02-04 * * by eli grey, https://eligrey.com * public domain.
Node.nodeName - Web APIs
WebAPINodenodeName
tfragment "#document-fragment" documenttype the value of documenttype.name element the value of element.tagname entity the entity name entityreference the name of entity reference notation the notation name processinginstruction the value of processinginstruction.target text "#text" example given the following markup: <div id="d1">hello world</div> <input type="text" id="t"> and the following script: var div1 = document.getelementbyid("d1"); var text_field = document.getelementbyid("t"); text_field.value = div1.nodename; in xhtml (or any other xml format), text_field's value would read "div".
Node.nodeType - Web APIs
WebAPINodenodeType
deprecated node type constants the following constants have been deprecated and should not be used anymore.
Node.nodeValue - Web APIs
WebAPINodenodeValue
the following table shows the return values for different elements: node value of nodevalue cdatasection content of the cdata section comment content of the comment document null documentfragment null documenttype null element null namednodemap null entityreference null notation n...
Node.prefix - Web APIs
WebAPINodeprefix
syntax string = node.prefix examples the following logs "x" to the console.
Node.rootNode - Web APIs
WebAPINoderootNode
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.
Node.setUserData() - Web APIs
WebAPINodesetUserData
the node.setuserdata() method allows a user to attach (or remove) data to an element, without needing to modify the dom.
NodeIterator - Web APIs
syntax a nodeiterator can be created using the document.createnodeiterator() method, as follows: const nodeiterator = document.createnodeiterator(root, whattoshow, filter); properties this interface doesn't inherit any property.
NodeList.entries() - Web APIs
WebAPINodeListentries
the nodelist.entries() method returns an iterator allowing to go through all key/value pairs contained in this object.
NodeList.prototype.forEach() - Web APIs
WebAPINodeListforEach
ent.createelement("p"); let kid2 = document.createtextnode("hey"); let kid3 = document.createelement("span"); node.appendchild(kid1); node.appendchild(kid2); node.appendchild(kid3); let list = node.childnodes; list.foreach( function(currentvalue, currentindex, listobj) { console.log(currentvalue + ', ' + currentindex + ', ' + this); }, 'mythisarg' ); the above code results in the following: [object htmlparagraphelement], 0, mythisarg [object text], 1, mythisarg [object htmlspanelement], 2, mythisarg polyfill this polyfill adds compatibility to all browsers supporting es5: if (window.nodelist && !nodelist.prototype.foreach) { nodelist.prototype.foreach = function (callback, thisarg) { thisarg = thisarg || window; for (var i = 0; i < this.length; i++) { ...
NodeList.keys() - Web APIs
WebAPINodeListkeys
the nodelist.keys() method returns an iterator allowing to go through all keys contained in this object.
NodeList.values() - Web APIs
WebAPINodeListvalues
the nodelist.values() method returns an iterator allowing to go through all values contained in this object.
NonDocumentTypeChildNode - Web APIs
nondocumenttypechildnode.nextelementsibling read only returns the element immediately following this node in its parent's children list, or null if there is no element in the list following this node.
Notification.Notification() - Web APIs
body: a domstring representing the body text of the notification, which is displayed below the title.
Notification.data - Web APIs
WebAPINotificationdata
examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor.
Notification.dir - Web APIs
WebAPINotificationdir
examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor.
Notification.lang - Web APIs
WebAPINotificationlang
examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor.
Notification.maxActions - Web APIs
examples the following snippet logs the maximum number of supported actions.
Notification.onclick - Web APIs
examples in the following example, we use an onclick handler to open a webpage in a new tab (specified by the inclusion of the '_blank' parameter) once a notification is clicked: notification.onclick = function(event) { event.preventdefault(); // prevent the browser from focusing the notification's tab window.open('http://www.mozilla.org', '_blank'); } specifications specification status comment ...
Notification.permission - Web APIs
examples the following snippet could be used if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to send notifications, then request permission if required, before then sending a notification.
Notification.renotify - Web APIs
examples the following snippet is intended to fire a notification that renotifies the user after it has been replaced; a simple options object is created, and then the notification is fired using the notification() constructor.
Notification.silent - Web APIs
examples the following snippet is intended to fire a silent notification; a simple options object is created, and then the notification is fired using the notification() constructor.
Notification.timestamp - Web APIs
examples the following snippet fires a notification; a simple options object is created, then the notification is fired using the notification() constructor.
Notification.vibrate - Web APIs
examples the following snippet is intended to create a notification that also triggers a device vibration; a simple options object is created, and then the notification is fired using the notification() constructor.
NotificationAction - Web APIs
here a service worker shows a notification with a single "archive" action, allowing users to perform this common task from the notification without having to open the website.
NotificationEvent.notification - Web APIs
the notification provides read-only access to many properties that were set at the instantiation time of the notification such as tag and data attributes that allow you to store information for defered use in the notificationclick event.
OES_standard_derivatives - Web APIs
glsl built-in functions the following new functions can be used in glsl shader code, if this extension is enabled: gentype dfdx(gentype) gentype dfdy(gentype) gentype fwidth(gentype) examples enabling the extensions: gl.getextension('oes_standard_derivatives'); gl.getextension('ext_shader_texture_lod'); shader code that avoids artifacts when wrapping texture coordinates: <script type="x-shader/x-fragment"> #extension gl_ext...
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
init optional options are as follows: renderedbuffer: the rendered audiobuffer containing the audio data.
OfflineAudioContext.resume() - Web APIs
exceptions the promise is rejected when the following exception is encountered.
OfflineAudioContext - Web APIs
<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...
OffscreenCanvas.getContext() - Web APIs
failifmajorperformancecaveat: boolean that indicates if a context will be created if the system performance is low.
OffscreenCanvas - Web APIs
given these two <canvas> elements <canvas id="one"></canvas> <canvas id="two"></canvas> the following code will provide the rendering using an offscreencanvas as described above.
OrientationSensor.populateMatrix() - Web APIs
the rotation matrix is shown below.
OscillatorNode.detune - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.frequency - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.onended - Web APIs
}; example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.setPeriodicWave() - Web APIs
returns undefined example the following example illustrates simple usage of createperiodicwave(), recreating a sine wave from a periodic wave.
OscillatorNode.start() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.stop() - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
OscillatorNode.type - Web APIs
example the following example shows basic usage of an audiocontext to create an oscillator node.
PageTransitionEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text></a><polyline points="76,25 86,20 8...
PaintWorklet.registerPaint - Web APIs
examples the following shows registering an example worklet module.
PannerNode.distanceModel - Web APIs
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.
PannerNode.panningModel - Web APIs
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.
PannerNode.positionX - Web APIs
example the following example starts an oscillator, and pans it to the left after 1 second, to the right after 2 seconds, and back to the center after 3 seconds.
PannerNode.positionY - Web APIs
example the following example starts an oscillator and pans it above the listener after 1 second, below the listener after 2 seconds, and back to the center after 3 seconds.
PannerNode.positionZ - Web APIs
example the following example starts an oscillator and moves it in front of the listener after 1 second, behind the listener after 2 seconds, and back to the listener's position after 3 seconds.
PannerNode.refDistance - Web APIs
schedule the ramp panner.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime + note_length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime + note_length); }; // this tone should decay immediately and fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower and later than the previous one scheduletesttone(4, context.currenttime + note_length); // this tone should decay only slightly, and only start decaying fairly late scheduletesttone(7, context.currenttime + note_length * 2); after running this code, the resulting waveforms should look something like this: specifications specification status comment web audio apithe ...
PannerNode.setOrientation() - Web APIs
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.
PannerNode.setPosition() - Web APIs
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.
PannerNode.setVelocity() - Web APIs
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.
PannerNode - Web APIs
examples in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control audio spatialisation.
ParentNode.lastElementChild - Web APIs
syntax const element = node.lastelementchild example <ul id="foo"> <li>first (1)</li> <li>second (2)</li> <li>third (3)</li> </ul> <script> const foo = document.getelementbyid('foo'); console.log(foo.lastelementchild.textcontent); // logs: third (3) </script> polyfill the code below adds support of lastelementchild() to document and documentfragment in internet explorer and safari.
PasswordCredential - Web APIs
syntax var mycredential = new passwordcredential(passwordcredentialdata) var mycredential = new passwordcredential(htmlformelement) parameters either of the following: passwordcredentialdata a passwordcredentialdata dictionary containing the following fields: iconurl: (optional) the url of a user's avatar image.
PasswordCredential.additionalData - Web APIs
example the following example creates a formdata object with an appended csrf token.
PaymentAddress.addressLine - Web APIs
for example, the addressline array for the mozilla space in london would have the following entries: example showing addressline entries for an address in london index addressline[] value 0 metal box factory 1 suite 441, 4th floor 2 30 great guildford street these, combined with additional values for other properties of the paymentaddress, would represent the full address, which is: mozilla metal box factory suite 441, 4...
PaymentAddress.languageCode - Web APIs
this is used while localizing the displayy of the address, allowing the determination of the field separators and the order of fields when formatting the address.
PaymentDetailsBase - Web APIs
derived dictionaries the following dictionaries include paymentdetailsbase.
PaymentDetailsUpdate.error - Web APIs
this happens if both of the following are true: the paymentrequest specifies using its requestshipping property that shipping information is required.
PaymentDetailsUpdate - Web APIs
properties the paymentdetailsupdate dictionary is based on the paymentdetailsbase dictionary, and inherits its properties, which are included in the list below.
PaymentMethodChangeEvent - Web APIs
options optional an optional paymentmethodchangeeventinit dictionary which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used.
PaymentMethodChangeEvent - Web APIs
properties in addition to the properties below, this interface includes properties inherited from paymentrequestupdateevent.
PaymentRequest.abort() - Web APIs
parameters none examples the following example sets up a timeout to clear the payment request that might have been abandoned or neglected.
PaymentRequest.canMakePayment() - Web APIs
parameters none examples in the following example, is excerpted from a demo that asynchronously builds a paymentrequest object for both apple pay and credit cards.
PaymentRequest.onmerchantvalidation - Web APIs
syntax paymentrequest.onmerchantvalidation = eventhandlerfunction; value an event handler function which is to be called whenever the merchantvalidation event is fired at the paymentrequest, indicating that the payment handler requires the merchant to validate themselves as allowed to use this payment handler.
PaymentRequest.onpaymentmethodchange - Web APIs
examples an example payment method change handler is shown below; this example handles changes made to the payment method when using apple pay, specifically: request.onpaymentmethodchange = ev => { const { type: cardtype } = ev.methoddetails; const newstuff = {}; if (ev.methodname === "https://apple.com/apple-pay") { switch (cardtype) { case "store": // do apple pay specific handling for store card...
PaymentRequest.shippingAddress - Web APIs
in the example below, the cost of shipping varies by geography.
PaymentRequest.shippingOption - Web APIs
syntax // returns the id of the selected paymentshippingoption var shippingoption = request.shippingoption; example in the example below, the paymentrequest.onshippingoptionchange and the paymentrequest.onshippingaoptionchange events are dispatched.
PaymentRequestEvent() - Web APIs
options optional options are as follows: instrumentkey: a paymentinstrument object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument.
PaymentRequestEvent.respondWith() - Web APIs
the respondwith property of the paymentrequestevent interface prevents the default event handling and allows you to provide a promise for a paymentresponse object yourself.
PaymentRequestEvent - Web APIs
respondwith() prevents the default event handling and allows you to provide a promise for a paymentresponse object yourself.
PaymentRequestUpdateEvent - Web APIs
methods in addition to methods inherited from the parent interface, event, paymentrequestupdateevent offers the following methods: paymentrequestupdateevent.updatewith() secure context if the event handler determines that information included in the payment request needs to be changed, or that new information needs to be added, it calls updatewith() with the information that needs to be replaced or added.
PaymentResponse.details - Web APIs
syntax var detailsobject = paymentresponse.details; example the following example extracts the details from the paymentresponse object to the promise returned from paymentrequest.show().
PaymentResponse.methodName - Web APIs
example the following example extracts the method name from the paymentresponse object to the promise returned from paymentrequest.show().
PaymentResponse.onpayerdetailchange - Web APIs
examples in the example below, onpayerdetailchange is used to set up a listener for the payerdetailchange event in order to validate the information entered by the user, requesting that any mistakes be corrected // options for paymentrequest(), indicating that shipping address, // payer email address, name, and phone number all be collected.
PaymentResponse: payerdetailchange event - Web APIs
bubbles no cancelable no interface paymentrequestupdateevent event handler property onpayerdetailchange examples in the example below, onpayerdetailchange is used to set up a listener for the payerdetailchange event in order to validate the information entered by the user, requesting that any mistakes be corrected // options for paymentrequest(), indicating that shipping address, // payer email address, name, and phone number all be collected.
PaymentResponse.shippingAddress - Web APIs
in the example below, the cost of shipping varies by geography.
PaymentResponse.shippingOption - Web APIs
syntax var shippingoption = paymentrequest.shippingoption; example in the example below, the paymentrequest.onshippingaoptionchange event is called.
performance.clearMarks() - Web APIs
return value void example the following example shows both uses of the clearmarks() method.
performance.clearMeasures() - Web APIs
return value void example the following example shows both uses of the clearmeasures() method.
performance.mark() - Web APIs
WebAPIPerformancemark
return value void example the following example shows how to use mark() to create and retrieve performancemark entries.
performance.now() - Web APIs
WebAPIPerformancenow
bear in mind the following points: in dedicated workers created from a window context, the value in the worker will be lower than performance.now() in the window who spawned that worker.
Performance.onresourcetimingbufferfull - Web APIs
examples the following example sets a callback function on the onresourcetimingbufferfull property.
Performance: resourcetimingbufferfull event - Web APIs
bubbles yes cancelable yes interface event event handler property onresourcetimingbufferfull examples the following example sets a callback function on the onresourcetimingbufferfull property.
Performance - Web APIs
note: this interface and its members are available in web workers, except where indicated below.
PerformanceEntry.duration - Web APIs
example the following example shows the use of the duration property.
PerformanceEntry.startTime - Web APIs
example the following example shows the use of the starttime property.
PerformanceEntry.toJSON() - Web APIs
example the following example shows the use of the tojson() method.
PerformanceLongTaskTiming - Web APIs
<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/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="#d...
PerformanceNavigation.type - Web APIs
possible values are: value constant name meaning 0 type_navigate the page was accessed by following a link, a bookmark, a form submission, a script, or typing the url in the address bar.
PerformanceNavigation - Web APIs
possible values are: type_navigate (0) the page was accessed by following a link, a bookmark, a form submission, or a script, or by typing the url in the address bar.
PerformanceNavigationTiming.domComplete - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.domContentLoadedEventEnd - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.domContentLoadedEventStart - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.domInteractive - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.loadEventEnd - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.loadEventStart - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.redirectCount - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.unloadEventEnd - Web APIs
example the following example illustrates this property's usage.
PerformanceNavigationTiming.unloadEventStart - Web APIs
example the following example illustrates this property's usage.
PerformanceObserver.observe() - Web APIs
syntax observer.observe(options); parameters options a performanceobserverinit dictionary with the following possible members: entrytypes: an array of domstring objects, each specifying one performance entry type to observe.
PerformanceObserverEntryList.getEntries() - Web APIs
syntax general syntax: entries = list.getentries(); entries = list.getentries(performanceentryfilteroptions); specific usage: entries = list.getentries({name: "entry_name", entrytype: "mark"}); parameters performanceentryfilteroptionsoptional is a performanceentryfilteroptions dictionary, having the following fields: "name", the name of a performance entry.
PerformanceResourceTiming.connectEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.connectStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.decodedBodySize - Web APIs
example the following example, the value of the size properties of all "resource" type events are logged.
PerformanceResourceTiming.domainLookupEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.domainLookupStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.encodedBodySize - Web APIs
example the following example, the value of the size properties of all "resource" type events are logged.
PerformanceResourceTiming.fetchStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.initiatorType - Web APIs
the value of this string is as follows: if the initiator is a element, the property returns the element's localname.
PerformanceResourceTiming.nextHopProtocol - Web APIs
example the following example uses the nexthopprotocol property.
PerformanceResourceTiming.requestStart - Web APIs
syntax resource.requeststart; return value a domhighrestimestamp representing the time immediately before the browser starts requesting the resource from the server example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.responseEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.responseStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.secureConnectionStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceResourceTiming.transferSize - Web APIs
example the following example, the value of size properties of all "resource" type events are logged.
PerformanceResourceTiming.workerStart - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged.
PerformanceServerTiming - Web APIs
this interface is restricted to the same origin, but you can use the timing-allow-origin header to specify the domains that are allowed to access the server metrics.
PeriodicWave - Web APIs
example the following example illustrates simple usage of createperiodicwave(), to create a periodicwave object containing a simple sine wave.
PhotoCapabilities.fillLightMode - Web APIs
auto the device's fill light will be used automatically in low light conditions.
PhotoCapabilities - Web APIs
example the following example, extracted from chrome's image capture / photo resolution sample, uses the results from getphotocapabilities() to modify the size of an input range.
PointerEvent.PointerEvent() - Web APIs
pointereventinitoptional is a pointereventinit dictionary, having the following fields: pointerid — optional and defaulting to 0, of type long, that sets the value of the instance's pointerevent.pointerid.
PointerEvent.pointerId - Web APIs
example the following code snippet compares a previously saved pointerid with the one of the pointerdown event that was just fired.
PointerEvent.pointerType - Web APIs
the supported values are the following strings: "mouse" the event was generated by a mouse device.
PointerEvent - Web APIs
pointerevent.getpredictedevents() returns a sequence of pointerevent instances that the browser predicts will follow the dispatched pointermove event's coalesced events.
PopStateEvent - Web APIs
the popstate event as an example, a page at http://example.com/example.html running the following code will generate alerts as indicated: window.onpopstate = function(event) { alert("location: " + document.location + ", state: " + json.stringify(event.state)); }; history.pushstate({page: 1}, "title 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // alerts "location: http://example.com/example.htm...
PositionOptions.enableHighAccuracy - Web APIs
note that this can result in slower response times or increased power consumption (with a gps chip on a mobile device for example).
PositionOptions.timeout - Web APIs
the positionoptions.timeout property is a positive long value representing the maximum length of time (in milliseconds) the device is allowed to take in order to return a position.
ProcessingInstruction - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 10%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
ProgressEvent.initProgressEvent() - Web APIs
the following values are allowed: value meaning loadstart the operation has started.
PromiseRejectionEvent - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anc...
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() - Web APIs
examples publickeycredential.isuserverifyingplatformauthenticatoravailable() .then(function(available){ if(available){ // we can proceed with the creation of a publickeycredential // with this authenticator } else { // use another kind of authenticator or a classical login/password // workflow } }).catch(function(err){ // something went wrong console.error(err); }); specifications specification status comment web authentication: an api for accessing public key credentials level 1the definition of 'isuserverifyingplatformauthenticatoravailable' in that specification.
PublicKeyCredentialCreationOptions.authenticatorSelection - Web APIs
syntax authenticatorselection = publickeycredentialcreationoptions.authenticatorselection value an object with the following properties: authenticatorattachmentoptional a string which is either "platform" or "cross-platform".
PublicKeyCredentialCreationOptions.extensions - Web APIs
the client must not use any authenticator with false acceptance rate (far) and false rejection rate (frr) below the inputs.
PublicKeyCredentialCreationOptions.pubKeyCredParams - Web APIs
syntax pubkeycredparams = publickeycredentialcreationoptions.pubkeycredparams value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created.
PublicKeyCredentialCreationOptions.user - Web APIs
this is not intended to store the login of the user (see name below).
PushEvent.data - Web APIs
WebAPIPushEventdata
examples the following example takes data from a pushevent and displays it on all of the service workers' clients.
PushEvent - Web APIs
WebAPIPushEvent
examples the following example takes data from a pushevent and displays it on all of the service worker's clients.
PushManager.getSubscription() - Web APIs
var pushbutton = document.queryselector('.js-push-button'); pushbutton.disabled = false; if (!subscription) { // we aren’t subscribed to push, so set ui // to allow the user to enable push return; } // keep your server in sync with the latest subscriptionid sendsubscriptiontoserver(subscription); showcurlcommand(subscription); // set your ui to show they have subscribed for // push messages pushbutton.textcontent = 'disable push messages'; ispushenabled = true; }) .catch...
PushManager.permissionState() - Web APIs
it can have the following properties: uservisibleonly: a boolean indicating that the returned push subscription will only be used for messages whose effect is made visible to the user.
PushManager.registrations() - Web APIs
pushregistration those objects are anonymous javascript objects with the following properties: pushendpoint a string representing the url of the endpoint.
PushManager.unregister() - Web APIs
pushregistration those objects are anonymous javascript objects with the following properties: pushendpoint a string representing the url of the unregistered endpoint.
PushMessageData - Web APIs
unlike the similar methods in the fetch api, which only allow the method to be invoked once, these methods can be called multiple times.
PushSubscription.getKey() - Web APIs
subbtn.disabled = false; if (!subscription) { console.log('not yet subscribed to push') // we aren't subscribed to push, so set ui // to allow the user to enable push return; } // set your ui to show they have subscribed for // push messages subbtn.textcontent = 'unsubscribe from push messaging'; ispushenabled = true; // initialize status, which includes setting ui elements for subscribed status // and updating subscribers list via push var endpoint = subscription.endpoint; var key = subscription.getkey('p256dh')...
PushSubscription.options - Web APIs
syntax var options = pushsubscription.options value an read-only options object containing the following values: uservisibleonly: a boolean, indicating that the returned push subscription will only be used for messages whose effect is made visible to the user.
PushSubscription - Web APIs
the pushsubscription interface of the push api provides a subcription's url endpoint and allows unsubscription from a push service.
Web Push API Notifications best practices - Web APIs
allowing your site to push notifications in realtime requires trust.
RTCConfiguration.iceServers - Web APIs
examples the configuration below opens a new peer connection, specifying two servers for the ice agent to use for negotiation.
RTCDTMFSender.insertDTMF() - Web APIs
the browser will enforce a minimum value of 30 ms (that is, if you specify a lower value, 30 ms will be used instead); the default is 70 ms.
RTCDTMFSender.toneBuffer - Web APIs
lower-case "a"-"d" automatically gets converted to upper-case.
RTCDataChannel.binaryType - Web APIs
values allowed by the websocket.binarytype property are also permitted here: "blob" if blob objects are being used or "arraybuffer" if arraybuffer objects are being used.
RTCDataChannel.close() - Web APIs
a background task is established to handle the remainder of the steps below, and close() returns to the caller.
RTCDataChannel: close event - Web APIs
bubbles no cancelable no interface event event handler property rtcdatachannel.onclose examples this example sets up a handler for the close event for the rtcdatachannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started.
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rtcdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.
RTCDataChannel.negotiated - Web APIs
example the code snippet below checks the value of negotiated; if it's true, a function called shutdownremotechannel() is called with the channel's id; presumably this would be implemented to transmit a shutdown signal to the remote peer prior to terminating the connection.
RTCDataChannel.onerror - Web APIs
example in the example below, a data channel is established, and an onerror handler is added to it.
RTCDataChannel.onopen - Web APIs
the rtcdatachannel.onopen property is an eventhandler which specifies a function to be called when the open event is fired; this is a simple event which is sent when the data channel's underlying data transport—the link over which the rtcdatachannel's messages flow—is established or re-established.
RTCDataChannelEvent() - Web APIs
rtcdatachanneleventinit a rtcdatachanneleventinit dictionary, which has following fields: "channel" of type rtcdatachannel, representing the data channel being concerned by the event.
RTCDataChannelEvent.channel - Web APIs
example the first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic.
RTCDtlsTransport.state - Web APIs
its value is one of the following: new the initial state when dtls has not started negotiating yet.
RTCDtlsTransport - Web APIs
<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/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="#4d4e...
RTCError - Web APIs
WebAPIRTCError
properties in addition to the properties defined by the parent interface, domexception, rtcerror includes the following properties: errordetail read only a domstring specifying the webrtc-specific error code identifying the type of error that occurred.
RTCIceCandidate.relatedAddress - Web APIs
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".
RTCIceCandidate.relatedPort - Web APIs
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.
RTCIceCandidate. toJSON() - Web APIs
see the example below.
RTCIceCandidatePairStats.availableOutgoingBitrate - Web APIs
the returned value is undefined in each of the following situations: the underlying implementation doesn't support computing a sender-side estimate of the outgoing bit rate.
RTCIceCandidatePairStats.circuitBreakerTriggerCount - Web APIs
a 5-tuple defining a tcp connection is made up of the following data: the source ip address.
RTCIceCandidatePairStats.consentExpiredTimestamp - Web APIs
syntax consentexpiration = rtcicecandidatepairstats.consentexpiredtimestamp; value a domhighrestimestamp object that indicates the time at which the stun binding that allows the two peers described by this rtcicecandidatepair to communicate will expire (or the time at which the binding did expire, if the time has passed).
RTCIceCandidatePairStats.nominated - Web APIs
once a candidate pair has been nominated and the two peers have each reconfigured themselves to use the specified configuration, the ice negotiation process can potentially end (or it can continue, to allow the connection to adapt to changing conditions).
RTCIceCandidateStats.priority - Web APIs
the priority of a candidate is calculated using the following variables as inputs: the preferability of the candidate type (local, server reflexive, peer reflexive, or relayed) the preferability of the candidate's specific ip address (for multihomed agents) the candidate's component id (1 for rtp, 2 for rtcp) the candidate's priority is computed using the formula (ptype is the priority of the candidate's type and plocal is the priority of the ip a...
RTCIceCandidateStats - Web APIs
properties rtcicecandidatestats is based upon the rtcstats dictionary, so it includes those properties in addition to the ones below.
RTCIceCredentialType - Web APIs
obsolete values the following values are no longer part of the webrtc specification, but were in the past.
RTCIceServer.url - Web APIs
WebAPIRTCIceServerurl
you should instead use the newer urls property, which allows you to optionally specify multiple urls for the server.
RTCIceTransport.state - Web APIs
its value will be one of the following: "new" the rtcicetransport is currently gathering local candidates, or is waiting for the remote device to begin to transmit the remote candidates, or both.
RTCIceTransport: statechange event - Web APIs
bubbles no cancelable no interface event event handler property rtcicetransport.onstatechange examples given an rtcpeerconnection, pc, the following code creates an event handler that calls a function named handlefailure() if the ice transport enters a failure state.
RTCIceTransport - Web APIs
it also offers the following properties: component read only the ice component being used by the transport.
RTCIdentityErrorEvent.idp - Web APIs
firefox implements the interface of this property under the following name: rtcpeerconnectionidentityerrorevent.
RTCIdentityErrorEvent.loginUrl - Web APIs
firefox implements the interface of this property under the following name: rtcpeerconnectionidentityerrorevent.
RTCIdentityErrorEvent - Web APIs
firefox implements this interface under the following name: rtcpeerconnectionidentityerrorevent.
RTCIdentityEvent.assertion - Web APIs
firefox implements the interface this property belongs to under the following name: rtcpeerconnectionidentityevent.
RTCIdentityEvent - Web APIs
firefox implements this interface under the following name: rtcpeerconnectionidentityevent.
RTCNetworkType - Web APIs
this type is used as the value or the following properties: rtcicecandidate's networktype rtcstunserverconnectionstats's networktype values bluetooth a bluetooth connection is used by the described connection.
RTCOutboundRtpStreamStats - Web APIs
properties the rtcoutboundrtpstreamstats dictionary includes the following properties in addition to those it inherits from rtcsentrtpstreamstats, rtcrtpstreamstats, and rtcstats.
RTCPeerConnection.addStream() - Web APIs
navigator.mediadevices.getusermedia({video:true, audio:true}, function(stream) { var pc = new rtcpeerconnection(); pc.addstream(stream); }); migrating to addtrack() compatibility allowing, you should update your code to instead use the addtrack() method: navigator.getusermedia({video:true, audio:true}, function(stream) { var pc = new rtcpeerconnection(); stream.gettracks().foreach(function(track) { pc.addtrack(track, stream); }); }); the newer addtrack() api avoids confusion over whether later changes to the track-makeup of a stream affects a peer connection (they d...
RTCPeerConnection.addTrack() - Web APIs
you could also just create a new stream for each track received: pc.ontrack = ev => { if (ev.streams && ev.streams[0]) { videoelem.srcobject = ev.streams[0]; } else { let inboundstream = new mediastream(ev.track); videoelem.srcobject = inboundstream; } } associating tracks with specific streams by specifying a stream and allowing rtcpeerconnection to create streams for you, the streams' track associations are automatically managed for you by the webrtc infrastructure.
RTCPeerConnection.addTransceiver() - Web APIs
sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender.
RTCPeerConnection.canTrickleIceCandidates - Web APIs
example var pc = new rtcpeerconnection(); // the following code might be used to handle an offer from a peer when // it isn't known whether it supports trickle ice.
RTCPeerConnection.connectionState - Web APIs
constant description "new" at least one of the connection's ice transports (rtcicetransports or rtcdtlstransports) are in the "new" state, and none of them are in one of the following states: "connecting", "checking", "failed", or "disconnected", or all of the connection's transports are in the "closed" state.
RTCPeerConnection.createAnswer() - Web APIs
the parameters for this form of createanswer() are described below, to aid in updating existing code.
RTCPeerConnection.createDataChannel() - Web APIs
options optional an rtcdatachannelinit dictionary providing configuration options for the data channel rtcdatachannelinit dictionary the rtcdatachannelinit dictionary provides the following fields, any of which may be included in the object passed as the options parameter in order to configure the data channel to suit your needs: ordered optional indicates whether or not messages sent on the rtcdatachannel are required to arrive at their destination in the same order in which they were sent (true), or if they're allowed to arrive out-of-order (false).
RTCPeerConnection.getIdentityAssertion() - Web APIs
it is not expected for the application dealing with the rtcpeerconnection: this is automatically done; an explicit call only allows to anticipate the need.
RTCPeerConnection.getStreamById() - Web APIs
example var stream = pc.getstreambyid(mytrackid); if (stream) { console.log("found stream: " + stream.id); } polyfill running the following code before any other code will create rtcpeerconnection.prototype.getstreambyid() if it's not natively available.
RTCPeerConnection.getTransceivers() - Web APIs
example the following snippet of code stops all transceivers associated with an rtcpeerconnection.
RTCPeerConnection.iceConnectionState - Web APIs
"checking" the ice agent has been given one or more remote candidates and is checking pairs of local and remote candidates against one another to try to find a compatible match, but has not yet found a pair which will allow the peer connection to be made.
RTCPeerConnection: icecandidateerror event - Web APIs
example the following example establishes a handler for icecandidateerrors that occur on the rtcpeerconnection pc.
RTCPeerConnection.onicecandidate - Web APIs
example the example below, which is based on the code from the article signaling and video calling, sets up a handler for icecandidate events to send the candidates to the remote peer.
RTCPeerConnection.oniceconnectionstatechange - Web APIs
example the example below watches the state of the ice agent for a failure or unexpected closure and takes appropriate action, such as presenting an error message or attempting to restart the ice agent.
RTCPeerConnection.signalingState - Web APIs
syntax var state = rtcpeerconnection.signalingstate; value the allowed values are those included in the enum rtcsignalingstate.
RTCPeerConnectionIceErrorEvent - Web APIs
properties the rtcpeerconnectioniceerrorevent interface includes the properties found on the event interface, as well as the following properties: address read only a domstring providing the local ip address used to communicate with the stun or turn server being used to negotiate the connection, or null if the local ip address has not yet been exposed as part of a local ice candidate.
RTCPeerConnectionIceEvent() - Web APIs
options a dictionary of type rtcpeerconnectioninit, which may contain one or more of the following fields: "candidate" (optional, default is null): a rtcicecandidate representing the ice candidate being concerned by the event.
RTCRemoteOutboundRtpStreamStats - Web APIs
properties in addition to the properties defined by rtcsentrtpstreamstats and its underlying rtcrtpstreamstats and rtcstats dictionaries, rtcremoteoutboundrtpstreamstats defines the following properties.
RTCRtpCapabilities - Web APIs
there are some special entries in this array, described below in the section the codecs array.
RTCRtpReceiver.getCapabilities() static function - Web APIs
example the function below returns a boolean indicating whether or not the device supports receiving h.264 video on a webrtc connection.
RTCRtpSender.getCapabilities() static function - Web APIs
example the function below returns a boolean indicating whether or not the device supports sending h.264 video on an rtcrtpsender.
RTCRtpStreamStats.kind - Web APIs
see browser compatibility below to determine how this affects the browsers you're targeting.
RTCRtpSynchronizationSource - Web APIs
while the published specification describes this as an interface, it has since been changed to a dictionary in follow-up drafts.
RTCRtpTransceiver.currentDirection - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
RTCRtpTransceiver.setCodecPreferences() - Web APIs
the following code snippet demonstrates how to get both the list of codecs supported by the transceiver's rtcrtpsender and rtcrtpreceiver.
RTCRtpTransceiverDirection - Web APIs
each describes how the transceiver's associated rtcrtpsender and rtcrtpreceiver behave as shown in the table below.
RTCRtpTransceiverInit - Web APIs
sendencodings optional a list of encodings to allow when sending rtp media from the rtcrtpsender.
RTCSctpTransport.state - Web APIs
its value is one of the following: connecting the initial state when the connection is being estabilished.
RTCSessionDescription.toJSON() - Web APIs
syntax var jsonvalue = sd.tojson(); the result value is a json object containing the following values: "type", containing the value of the rtcsessiondescription.type property and can be one of the following values: "offer", "answer", "pranswer" or null.
RTCSessionDescription.type - Web APIs
the allowed values are those of an enum of type rtcsdptype: "offer", the description is the initial proposal in an offer/answer exchange.
RTCStatsReport - Web APIs
the statistic category names are members of the enumerated type rtcstatstype, as follows: candidate-pair an rtcicecandidatepairstats object providing statistics related to an rtcicetransport.
RTCTrackEvent() - Web APIs
this object has the following properties: receiver the rtcrtpreceiver which is being used to receive the track's media.
RTCTrackEventInit.transceiver - Web APIs
the transceiver pairs the track's receiver with an rtcrtpsender to allow bidirectional communication.
RTCTrackEventInit - Web APIs
properties rtctrackeventinit inherits properties from the eventinit dictionary, and also includes the following properties: receiver the rtcrtpreceiver which is being used to receive the track's media.
RadioNodeList - Web APIs
<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/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="no...
Range.commonAncestorContainer - Web APIs
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.
Range.compareNode() - Web APIs
WebAPIRangecompareNode
the following function can be used as replacement: function rangecomparenode(range, node) { var noderange = node.ownerdocument.createrange(); try { noderange.selectnode(node); } catch (e) { noderange.selectnodecontents(node); } var nodeisbefore = range.compareboundarypoints(range.start_to_start, noderange) == 1; var nodeisafter = range.compareboundarypoints(range.end_to_end, noderange...
Range.getBoundingClientRect() - Web APIs
the bounding client rectangle contains everything selected in the range.</p> css #highlight { background: yellow; position: absolute; z-index: -1; } p { width: 200px; } javascript const range = document.createrange(); range.setstartbefore(document.getelementsbytagname('b').item(0), 0); range.setendafter(document.getelementsbytagname('b').item(1), 0); const clientrect = range.getboundingclientrect(); const highlight = document.getelementbyid('highlight'); highlight.style.left = `${clientrect.x}px`;...
Range.selectNodeContents() - Web APIs
html <p id="p"><b>use the buttons below</b> to select or deselect the contents of this paragraph.</p> <button id="select-button">select paragraph</button> <button id="deselect-button">deselect paragraph</button> javascript const p = document.getelementbyid('p'); const selectbutton = document.getelementbyid('select-button'); const deselectbutton = document.getelementbyid('deselect-button'); selectbutton.addeventlistener('click', e =...
Range.setEnd() - Web APIs
WebAPIRangesetEnd
exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node.
Range.setStart() - Web APIs
WebAPIRangesetStart
setting the start point below (lower in the document) the end point will result in a collapsed range with the start and end points both set to the specified start position.
Range.toString() - Web APIs
WebAPIRangetoString
look at the output below.</p> <p id="log"></p> javascript const range = document.createrange(); range.setstartbefore(document.getelementsbytagname('b').item(0), 0); range.setendafter(document.getelementsbytagname('b').item(1), 0); document.getelementbyid('log').textcontent = range.tostring(); result specifications specification status comment domthe definition of 'range.tostring()' in that specification.
ReadableByteStreamController - Web APIs
the readablebytestreamcontroller interface of the streams api represents a controller allowing control of a readablestream's state and internal queue.
ReadableStream.getReader() - Web APIs
examples in the following simple example, a previously-created custom readablestream is read using a readablestreamdefaultreader created using getreader().
ReadableStream.pipeThrough() - Web APIs
examples in the following example (see unpack chunks of a png for the full code running live, and png-transform-stream for the source code), an image is fetched and its body retrieved as a readablestream.
ReadableStreamBYOBReader.read() - Web APIs
the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, done: false }.
ReadableStreamBYOBReader - Web APIs
properties readablestreambyobreader.closed read only allows you to write code that responds to an end to the streaming process.
ReadableStreamBYOBRequest - Web APIs
a view, as mentioned below, refers to a typed array representing the destination region to which the associated readablebytestreamcontroller controller can write generated data.
ReadableStreamDefaultController.close() - Web APIs
examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code).
ReadableStreamDefaultController.enqueue() - Web APIs
examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code).
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
examples in the following simple example, a previously-created custom readablestream is read using a readablestreamdefaultreader created using getreader().
ReadableStreamDefaultReader.cancel() - Web APIs
examples in the following simple example, a previously-created custom readablestream is read using a readablestreamdefaultreader created using getreader().
ReadableStreamDefaultReader.read() - Web APIs
the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, done: false }.
RelativeOrientationSensor.RelativeOrientationSensor() - Web APIs
syntax var relativeorientationsensor = new relativeorientationsensor([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.
RelativeOrientationSensor - Web APIs
examples basic example the following example, which is loosely based on intel's orientation phone demo, instantiates an relativeorientationsensor with a frequency of 60 times a second.
ReportingObserver - Web APIs
the reportingobserver interface of the reporting api allows you to collect and access reports.
ReportingObserverOptions - Web APIs
the reportingobserveroptions dictionary of the reporting api allows options to be set in the constructor when creating a reportingobserver.
Request.context - Web APIs
WebAPIRequestcontext
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request context in a variable: var myrequest = new request('flowers.jpg'); var mycontext = myrequest.context; // returns the empty string by default ...
Request.credentials - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request credentials in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.credentials; // returns "same-origin" by default specifications specification status comment fetchthe definition of 'creden...
Request.integrity - Web APIs
WebAPIRequestintegrity
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request integrity value in a variable: var myrequest = new request('flowers.jpg'); var myintegrity = myrequest.integrity; specifications specification status comment fetchthe definition of 'integrity' in that specification.
Request.method - Web APIs
WebAPIRequestmethod
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the method of the request in a variable: var myrequest = new request('flowers.jpg'); var mymethod = myrequest.method; // get specifications specification status comment fetchthe definition of 'method' in that specification.
Request.referrer - Web APIs
WebAPIRequestreferrer
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request referrer in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrer; // returns "about:client" by default specifications specification status comment fetchthe definition of 'referrer' in that specification.
Request.referrerPolicy - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the request referrer policy in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrerpolicy; // returns "" by default specifications specification status comment fetchthe definition of 'referr...
Request.url - Web APIs
WebAPIRequesturl
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then save the url of the request in a variable: var myrequest = new request('flowers.jpg'); var myurl = myrequest.url; // "http://mdn.github.io/fetch-examples/fetch-request/flowers.jpg" specifications specification status comment fetchthe definition of 'url' in that specification.
ResizeObserver() - Web APIs
the callback will generally follow a pattern along the lines of: function(entries, observer) { for (let 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.contentboxs...
ResizeObserver.unobserve() - Web APIs
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...
ResizeObserver - Web APIs
implementations should, if they follow the specification, invoke resize events before paint and after layout.
ResizeObserverEntry.contentBoxSize - Web APIs
examples the following snippet is taken from the resize-observer-border-radius.html (see source) example.
ResizeObserverEntry.contentRect - Web APIs
examples the following snippet is taken from the resize-observer-text.html (see source) example.
ResizeObserverEntry.target - Web APIs
examples the following snippet is taken from the resize-observer-border-radius.html (see source) example.
Response.headers - Web APIs
WebAPIResponseheaders
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.headers); // returns a headers{} object response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'headers' in that specification.
Response.ok - Web APIs
WebAPIResponseok
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.ok); // returns true if the response returned successfully response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'ok' in that specification.
Response.status - Web APIs
WebAPIResponsestatus
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.status); // returns 200 response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'status' in that specification.
Response.statusText - Web APIs
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.statustext); // returns "ok" if the response returned successfully response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'statustext' in that specificati...
Response.url - Web APIs
WebAPIResponseurl
var myimage = document.queryselector('img'); var myrequest = new request('flowers.jpg'); fetch(myrequest).then(function(response) { console.log(response.url); // returns /docs/web/api/response/flowers.jpg response.blob().then(function(myblob) { var objecturl = url.createobjecturl(myblob); myimage.src = objecturl; }); }); specifications specification status comment fetchthe definition of 'url' in that specification.
SVGAltGlyphDefElement - Web APIs
<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/svgaltglyphdefelement" target="_top"><rect x="1" y="1" width="210" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="106" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgaltglyphdefelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;...
format - Web APIs
syntax string = myglyph.format; myglyph.format = string; value the format values listed below are taken from css2([css2], section15.3.5).
SVGAltGlyphItemElement - Web APIs
<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/svgaltglyphitemelement" target="_top"><rect x="1" y="1" width="220" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgaltglyphitemelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: ...
SVGAnimateColorElement - Web APIs
<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/svganimatecolorelement" target="_top"><rect x="1" y="1" width="220" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svganimatecolorelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events:...
SVGAnimateElement - Web APIs
<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 x1="121" y1="2...
SVGAnimateMotionElement - Web APIs
<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 x1...
SVGAnimateTransformElement - Web APIs
<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"/><l...
SVGAnimationElement: beginEvent event - Web APIs
mples 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" /> </circle> </svg> <hr> <ul> </ul> ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; padding: 10px 30px; } let svgelem = document.queryselector('svg'); let animateelem = document.queryselector('animatemotion'); let list = document.queryselector('ul'); animateelem.addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeateve...
SVGAnimationElement: endEvent event - Web APIs
s="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" /> </circle> </svg> <hr> <button>stop animation</button> <ul> </ul> ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; padding: 10px 30px; } let svgelem = document.queryselector('svg'); let animateelem = document.queryselector('animatemotion'); let list = document.queryselector('ul'); let btn = document.queryselector('button'); animateelem.addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); ...
SVGAnimationElement: repeatEvent event - Web APIs
mples 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" /> </circle> </svg> <hr> <ul> </ul> ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; padding: 10px 30px; } let svgelem = document.queryselector('svg'); let animateelem = document.queryselector('animatemotion'); let list = document.queryselector('ul'); animateelem.addeventlistener('beginevent', () => { let listitem = document.createelement('li'); listitem.textcontent = 'beginevent fired'; list.appendchild(listitem); }) animateelem.addeventlistener('repeateven...
SVGAnimationElement - Web APIs
<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" align...
SVGCircleElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 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" y...
SVGClipPathElement - Web APIs
<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...
SVGComponentTransferFunctionElement - Web APIs
<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 1...
SVGCursorElement - Web APIs
<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 11...
SVGDefsElement - Web APIs
<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 x1="121" y1="25" x2=...
SVGDescElement - Web APIs
<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 x1="121" y1="25" x2=...
SVGElement: abort event - Web APIs
the abort event is fired when page loading is stopped before an svg element has been allowed to load completely.
SVGEllipseElement - Web APIs
<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"/><...
SVGExternalResourcesRequired - Web APIs
<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/svgexternalresourcesrequired" target="_top"><rect x="1" y="1" width="280" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="141" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="mid...
SVGFEBlendElement - Web APIs
<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 x1="121" y1="2...
SVGFEColorMatrixElement - Web APIs
<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 x1...
SVGFEComponentTransferElement - Web APIs
<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="non...
SVGFECompositeElement - Web APIs
<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 x1="12...
SVGFEConvolveMatrixElement - Web APIs
<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"/><l...
SVGFEDiffuseLightingElement - Web APIs
<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"/>...
SVGFEDisplacementMapElement - Web APIs
<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"/>...
SVGFEDistantLightElement - Web APIs
<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 ...
SVGFEDropShadowElement - Web APIs
<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 x1="...
SVGFEFloodElement - Web APIs
<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 x1="121" y1="2...
SVGFEFuncAElement - Web APIs
<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 x1="121" y1="2...
SVGFEFuncBElement - Web APIs
<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 x1="121" y1="2...
SVGFEFuncGElement - Web APIs
<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 x1="121" y1="2...
SVGFEFuncRElement - Web APIs
<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 x1="121" y1="2...
SVGFEGaussianBlurElement - Web APIs
<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 ...
SVGFEImageElement - Web APIs
<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 x1="121" y1="2...
SVGFEMergeElement - Web APIs
<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 x1="121" y1="2...
SVGFEMergeNodeElement - Web APIs
<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 x1="12...
SVGFEMorphologyElement - Web APIs
<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 x1="...
SVGFEOffsetElement - Web APIs
<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 x1="121" y1=...
SVGFEPointLightElement - Web APIs
<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 x1="...
SVGFESpecularLightingElement - Web APIs
<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"...
SVGFESpotLightElement - Web APIs
<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 x1="12...
SVGFETileElement - Web APIs
<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 x1="121" y1="25"...
SVGFETurbulenceElement - Web APIs
<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 x1="...
SVGFilterElement - Web APIs
<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 11...
SVGFilterPrimitiveStandardAttributes - Web APIs
<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/svgfilterprimitivestandardattributes" target="_top"><rect x="1" y="1" width="360" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgfilterprimitivestand...
SVGFontElement - Web APIs
<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/svgfontelement" target="_top"><rect x="1" y="1" width="140" height="50" fill="#f4f7f8" 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">svgfontelement</text><...
SVGFontFaceElement - Web APIs
<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/svgfontfaceelement" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgf...
SVGFontFaceFormatElement - Web APIs
<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/svgfontfaceformatelement" target="_top"><rect x="1" y="1" width="240" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="121" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" align...
SVGFontFaceNameElement - Web APIs
<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/svgfontfacenameelement" target="_top"><rect x="1" y="1" width="220" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-bas...
SVGFontFaceSrcElement - Web APIs
<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/svgfontfacesrcelement" target="_top"><rect x="1" y="1" width="210" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="106" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baselin...
SVGFontFaceUriElement - Web APIs
<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/svgfontfaceurielement" target="_top"><rect x="1" y="1" width="210" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="106" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baselin...
SVGForeignObjectElement - Web APIs
<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,...
SVGGElement - Web APIs
<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 x1="121" y1="25" x2="151" ...
SVGGeometryElement - Web APIs
<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="...
SVGGlyphElement - Web APIs
<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/svgglyphelement" target="_top"><rect x="1" y="1" width="150" height="50" fill="#f4f7f8" 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">svgglyphelement</tex...
SVGGlyphRefElement - Web APIs
<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/svgglyphrefelement" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgglyphrefelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} pro...
SVGGradientElement - Web APIs
<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="#d4...
getBBox() - Web APIs
the svggraphicselement.getbbox() allows us to determine the coordinates of the smallest rectangle in which the object fits.
SVGGraphicsElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
SVGHKernElement - Web APIs
<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/svghkernelement" target="_top"><rect x="1" y="1" width="150" height="50" fill="#f4f7f8" 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">svghkernelement</t...
SVGImageElement - Web APIs
<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 x1="121" y1="25" x...
SVGLineElement - Web APIs
<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...
SVGLinearGradientElement - Web APIs
<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 ...
SVGMPathElement - Web APIs
<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 x1="121" y1="25" x...
SVGMaskElement - Web APIs
<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...
SVGMatrix - Web APIs
WebAPISVGMatrix
exceptions a domexception with the code no_modification_allowed_err is raised when attempting updating a read-only attribute or when the object itself is read-only.
SVGMeshElement - Web APIs
<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/svgmeshelement" target="_top"><rect x="1" y="1" width="140" height="50" fill="#f4f7f8" 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">svgmeshelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;}...
SVGMetadataElement - Web APIs
<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 x1="121" y1=...
SVGMissingGlyphElement - Web APIs
<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/svgmissingglyphelement" target="_top"><rect x="1" y="1" width="220" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="111" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-basel...
SVGNumber - Web APIs
WebAPISVGNumber
note: if the svgnumber is read-only, a domexception with the code no_modification_allowed_err is raised on an attempt to change the value.
SVGPathElement - Web APIs
<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 x1="121" y1="25" x2=...
SVGPatternElement - Web APIs
<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 x1="121" y1="2...
SVGPolygonElement - Web APIs
<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 ...
SVGPolylineElement - Web APIs
<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...
SVGPreserveAspectRatio - Web APIs
exceptions on setting: a domexception with code no_modification_allowed_err is raised on an attempt to change the value of an attribute on a read only object.
SVGRadialGradientElement - Web APIs
<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 ...
SVGRect - Web APIs
WebAPISVGRect
<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/svgrect" target="_top"><rect x="1" y="1" width="75" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" tex...
SVGRectElement - Web APIs
<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...
SVGRenderingIntent - Web APIs
<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/svgrenderingintent" target="_top"><rect x="1" y="1" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="91" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgrenderingintent</text></a></svg></div> a:hover...
SVGSetElement - Web APIs
<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 x1="121" y1="25" x2="1...
SVGSolidcolorElement - Web APIs
<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/svgsolidcolorelement" target="_top"><rect x="1" y="1" width="200" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="101" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgsolidcolorelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} ...
SVGStopElement - Web APIs
<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 x1="121" y1="25" x2=...
SVGSwitchElement - Web APIs
<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 x1="121" y1="25"...
SVGSymbolElement - Web APIs
<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 x1="121" y1="25"...
SVGTRefElement - Web APIs
<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/svgtrefelement" target="_top"><rect x="1" y="1" width="140" height="50" fill="#f4f7f8" 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">svgtrefelement</text><...
SVGTSpanElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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...
SVGTextContentElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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" tex...
SVGTextElement - Web APIs
<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 x1="121" y1="25" x2...
SVGTextPathElement - Web APIs
<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 x1="121" y1=...
SVGTextPositioningElement - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/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-baseli...
SVGTitleElement - Web APIs
<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 x1="121" y1="25" x...
SVGURIReference - Web APIs
<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/svgurireference" target="_top"><rect x="1" y="1" width="150" height="50" fill="#f4f7f8" 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">svgurireference</text></a></svg></div> a:hover text { fill: #0095dd; poin...
SVGUnitTypes - Web APIs
<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/svgunittypes" target="_top"><rect x="1" y="1" width="120" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="61" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">svgunittypes</text></a></svg></div> ...
SVGUseElement - Web APIs
<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...
SVGVKernElement - Web APIs
<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/svgvkernelement" target="_top"><rect x="1" y="1" width="150" height="50" fill="#f4f7f8" 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">svgvkernelement</t...
SVGZoomAndPan - Web APIs
<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/svgzoomandpan" target="_top"><rect x="1" y="1" width="130" height="50" fill="#f4f7f8" 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">svgzoomandpan</text></a></svg></div...
Screen.colorDepth - Web APIs
WebAPIScreencolorDepth
syntax bitdepth = window.screen.colordepth; example // check the color depth of the screen if ( window.screen.colordepth < 8) { // use low-color version of page } else { // use regular, colorful page } specification specification status comment css object model (cssom) view modulethe definition of 'screen.colordepth' in that specification.
Screen - Web APIs
WebAPIScreen
void seteventhandler(domstring type, eventhandler handler) eventhandler geteventhandler(domstring type) example if (screen.pixeldepth < 8) { // use low-color version of page } else { // use regular, colorful page } specification specification status comment css object model (cssom) view modulethe definition of 'screen' in that specification.
ScreenOrientation.lock() - Web APIs
one of the following: "any" "natural" "landscape" "portrait" "portrait-primary" "portrait-secondary" "landscape-primary" "landscape-secondary" return value a promise.
ScriptProcessorNode.bufferSize - Web APIs
example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
ScriptProcessorNode.onaudioprocess - Web APIs
} example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode.
ScrollToOptions.left - Web APIs
examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e.
ScrollToOptions.top - Web APIs
examples in our scrolltooptions example (see it live) we include a form that allows the user to enter three values — two numbers representing the left and top properties (i.e.
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
this can include the following properties, but bear in mind that if you do include an eventinitdict, certain properties must be included (marked below with required): blockeduri: the blockeduri of the securitypolicyviolationevent.
Selection.deleteFromDocument() - Web APIs
once you do, you can remove the selected content by clicking the button below.</p> <button>delete selected text</button> javascript let button = document.queryselector('button'); button.addeventlistener('click', deleteselection); function deleteselection() { let selection = window.getselection(); selection.deletefromdocument(); } result specifications specification status comment selection apithe definition of 'selection.deletefromdocume...
Sensor - Web APIs
WebAPISensor
interfaces based on sensor below is a list of interfaces based on the sensor interface.
ServiceWorker.state - Web APIs
it can be one of the following values: installing, installed, activating, activated, or redundant.
ServiceWorker - Web APIs
it returns one of the following values: installing, installed, activating, activated, or redundant.
ServiceWorkerContainer.startMessages() - Web APIs
the startmessages() method of the serviceworkercontainer interface explicitly starts the flow of messages being dispatched from a service worker to pages under its control (e.g.
ServiceWorkerGlobalScope: activate event - Web APIs
bubbles no cancelable no interface extendableevent event handler property serviceworkerglobalscope.onactivate examples the following snippet shows how you could use an activate event handler to upgrade a cache.
ServiceWorkerGlobalScope: contentdelete event - Web APIs
bubbles no cancelable no interface contentindexevent event handler property oncontentdelete examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item.
ServiceWorkerGlobalScope: install event - Web APIs
bubbles no cancelable no interface extendableevent event handler property serviceworkerglobalscope.oninstall examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', ...
ServiceWorkerGlobalScope: message event - Web APIs
bubbles no cancelable no interface extendablemessageevent event handler property onmessage examples in the below example a page gets a handle to the serviceworker object via serviceworkerregistration.active, and then calls its postmessage() function.
ServiceWorkerGlobalScope.onactivate - Web APIs
}; examples the following snippet shows how you could use an activate event handler to upgrade a cache.
ServiceWorkerGlobalScope.oncontentdelete - Web APIs
}; examples the following example uses a contentdelete event handler to remove cached content related to the deleted index item.
ServiceWorkerGlobalScope.oninstall - Web APIs
}; examples the following snippet shows how an install event handler can be used to populate a cache with a number of responses, which the service worker can then use to serve assets offline: this.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/galle...
ServiceWorkerGlobalScope.onmessage - Web APIs
note: service workers define the extendable event to allow extending the lifetime of the event.
ServiceWorkerGlobalScope.onpush - Web APIs
}) example the following example takes data from a pushevent and displays it on all of the service worker's clients.
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
the following example causes a newly installed service worker to progress into the activating state, regardless of whether there is already an active service worker.
ServiceWorkerMessageEvent.ServiceWorkerMessageEvent() - Web APIs
init optional an initialisation object, which should contain the following parameters: data: the event's data — this can be any type.
ServiceWorkerMessageEvent.data - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.lastEventId - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.origin - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.ports - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.source - Web APIs
examples when the following code is used inside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerRegistration.index - Web APIs
the index read-only property of the serviceworkerregistration interface returns a reference to the contentindex interface, which allows for indexing of offline content.
ServiceWorkerRegistration.unregister() - Web APIs
example the following simple example registers a service worker example, but then immediately unregisters it again: if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw-test/sw.js', {scope: 'sw-test'}).then(function(registration) { // registration worked console.log('registration succeeded.'); registration.unregister().then(function(boolean) { // if boolean = true, unregist...
ServiceWorkerRegistration.update() - Web APIs
example the following simple example registers a service worker example then adds an event handler to a button so you can explicitly update the service worker whenever desired: if ('serviceworker' in navigator) { navigator.serviceworker.register('/sw-test/sw.js', {scope: 'sw-test'}).then(function(registration) { // registration worked console.log('registration succeeded.'); button.onclick = function(...
SharedWorker.port - Web APIs
WebAPISharedWorkerport
example the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
SharedWorker - Web APIs
the following code snippet shows creation of a sharedworker object using the sharedworker() constructor.
SharedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
SharedWorkerGlobalScope - Web APIs
workerglobalscope.dump() allows you to write a message to stdout — i.e.
Slottable - Web APIs
WebAPISlottable
the slottable mixin defines features that allow nodes to become the contents of a <slot> element — the following features are included in both element and text.
SourceBuffer.appendWindowEnd - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.appendWindowStart - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.mode - Web APIs
WebAPISourceBuffermode
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.timestampOffset - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBuffer.trackDefaults - Web APIs
exceptions the following exceptions may be thrown when setting a new value for this property.
SourceBufferList: indexed property getter - Web APIs
the indexed property getter of the sourcebufferlist interface allows the sourcebuffer objects in the list to be accessed with an array operator (i.e.
SpeechGrammar.SpeechGrammar() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var newgrammar = new speechgrammar(); newgrammar.src = '#jsgf v1.0; grammar names; public <name> = chris | kirsty | mike;' speechrecognitionlist[1] = newgrammar; // should add the new speechgrammar object...
SpeechGrammar.src - Web APIs
WebAPISpeechGrammarsrc
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; console.log(speechrecognitionlist[0].src); // should return the same as the contents of the grammar variable console.log(speechrecognitionlist[0].weight); // should return 1 - the same as the weight set ...
SpeechGrammar.weight - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; console.log(speechrecognitionlist[0].src); // should return the same as the contents of the grammar variable console.log(speechrecognitionlist[0].weight); // should return 1 - the same as the weight set ...
SpeechGrammar - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; console.log(speechrecognitionlist[0].src); // should return the same as the contents of the grammar variable console.log(speechrecognitionlist[0].weight); // should return 1 - the same as the weight set ...
SpeechGrammarList.SpeechGrammarList() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; specifications specification status comment web speech apithe definition of 'speechgrammarlist' in that specification.
SpeechGrammarList.addFromString() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; specifications specification status comment web speech apithe definition of 'addfromstring()' in that specification.
SpeechGrammarList.addFromURI() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; speechrecognitionlist.addfromuri('http://www.example.com/grammar.txt'); // adds a second grammar to the list.
SpeechGrammarList.length - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; speechrecognitionlist.length; // should return 1.
SpeechRecognition() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; //recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.abort() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.')...
SpeechRecognition.continuous - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.grammars - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; //recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.interimResults - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; //recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.lang - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; //recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.maxAlternatives - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; //recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; ...
SpeechRecognition.start() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.')...
SpeechRecognition.stop() - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.')...
SpeechRecognition - Web APIs
= aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' var recognition = new speechrecognition(); var speechrecognitionlist = new speechgrammarlist(); speechrecognitionlist.addfromstring(grammar, 1); recognition.grammars = speechrecognitionlist; recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.maxalternatives = 1; var diagnostic = document.queryselector('.output'); var bg = document.query...
SpeechRecognitionEvent.results - Web APIs
specifically this object will contain all final results that have been returned, followed by the current best hypothesis for all interim results.
SpeechRecognitionEvent - Web APIs
speechrecognitionevent.resultindex read only returns the lowest index value result in the speechrecognitionresultlist "array" that has actually changed.
SpeechRecognitionResult.item() - Web APIs
the item getter of the speechrecognitionresult interface is a standard getter that allows speechrecognitionalternative objects within the result to be accessed via array syntax.
SpeechRecognitionResult - Web APIs
speechrecognitionresult.length read only returns the length of the "array" — the number of speechrecognitionalternative objects contained in the result (also referred to as "n-best alternatives".) methods speechrecognitionresult.item a standard getter that allows speechrecognitionalternative objects within the result to be accessed via array syntax.
SpeechRecognitionResultList.item() - Web APIs
the item getter of the speechrecognitionresultlist interface is a standard getter — it allows speechrecognitionresult objects in the list to be accessed via array syntax.
SpeechRecognitionResultList - Web APIs
methods speechrecognitionresultlist.item a standard getter that allows speechrecognitionresult objects in the list to be accessed via array syntax.
SpeechSynthesis.onvoiceschanged - Web APIs
with chrome however, you have to wait for the event to fire before populating the list, hence the bottom if statement seen below.
SpeechSynthesisUtterance.SpeechSynthesisUtterance() - Web APIs
examples the following snippet is excerpted from our speech synthesizer demo.
SpeechSynthesisUtterance.pitch - Web APIs
it can range between 0 (lowest) and 2 (highest), with 1 being the default pitch for the current platform or voice.
SpeechSynthesisUtterance.rate - Web APIs
it can range between 0.1 (lowest) and 10 (highest), with 1 being the default pitch for the current platform or voice, which should correspond to a normal speaking rate.
SpeechSynthesisUtterance.volume - Web APIs
syntax var myvolume = speechsynthesisutteranceinstance.volume; speechsynthesisutteranceinstance.volume = 0.5; value a float that represents the volume value, between 0 (lowest) and 1 (highest.) if ssml is used, this value will be overridden by prosody tags in the markup.
SpeechSynthesisVoice.localService - Web APIs
the localservice read-only property of the speechsynthesisvoice interface returns a boolean indicating whether the voice is supplied by a local speech synthesizer service (true), or a remote speech synthesizer service (false.) this property is provided to allow differentiation in the case that some voice options are provided by a remote service; it is possible that remote voices might have extra latency, bandwidth or cost associated with them, so such distinction may be useful.
SpeechSynthesisVoice - Web APIs
examples the following snippet is excerpted from our speech synthesiser demo.
StereoPannerNode.StereoPannerNode() - Web APIs
options optional options are as follows: pan: a floating point number in the range [-1,1] indicating the position of an audionode in an output image.
StereoPannerNode - Web APIs
it is an audionode audio-processing module that positions an incoming audio stream in a stereo image using a low-cost equal-power panning algorithm.
Storage.clear() - Web APIs
WebAPIStorageclear
examples the following function creates three data entries in local storage, and then deletes them by using clear().
Storage.getItem() - Web APIs
WebAPIStoragegetItem
example the following function retrieves three data items from local storage, then uses them to set custom styles on a page.
Storage.key() - Web APIs
WebAPIStoragekey
examples the following function iterates over the local storage keys: function foreachkey(callback) { for (var i = 0; i < localstorage.length; i++) { callback(localstorage.key(i)); } } the following function iterates over the local storage keys and gets the value set for each key: for(var i =0; i < localstorage.length; i++){ console.log(localstorage.getitem(localstorage.key(i))); } note: for a real wo...
Storage.length - Web APIs
WebAPIStoragelength
example the following function adds three data items to the local storage for the current domain, then returns the number of items in the storage: function populatestorage() { localstorage.setitem('bgcolor', 'yellow'); localstorage.setitem('font', 'helvetica'); localstorage.setitem('image', 'cats.png'); return localstorage.length; // should return 3 } note: for a real world example, see our web storage demo.
Storage.removeItem() - Web APIs
example the following function creates three data items inside local storage, then removes the image data item.
Storage - Web APIs
WebAPIStorage
it allows, for example, the addition, modification, or deletion of stored data items.
StorageEvent - Web APIs
<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/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="#d4dd...
Using writable streams - Web APIs
the second object is optional, and allows you to specify a custom queueing strategy to use for your stream, which takes the form of an instance of bytelengthqueuingstrategy or countqueuingstrategy.
StylePropertyMap - Web APIs
<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/stylepropertymap" 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">stylepropertym...
SubmitEvent - Web APIs
properties in addition to the properties listed below, this interface inherits the properties of its parent interface, event.
SubtleCrypto.decrypt() - Web APIs
exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g.
SubtleCrypto.encrypt() - Web APIs
exceptions the promise is rejected when the following exceptions are encountered: invalidaccesserror raised when the requested operation is not valid for the provided key (e.g.
SubtleCrypto.generateKey() - Web APIs
exceptions the promise is rejected when the following exception is encountered: syntaxerror raised when the result is a cryptokey of type secret or private but keyusages is empty.
SubtleCrypto.sign() - Web APIs
WebAPISubtleCryptosign
exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the signing key is not a key for the request signing algorithm or when trying to use an algorithm that is either unknown or isn't suitable for signing.
SubtleCrypto.verify() - Web APIs
exceptions the promise is rejected when the following exception is encountered: invalidaccesserror raised when the encryption key is not a key for the requested verifying algorithm or when trying to use an algorithm that is either unknown or isn't suitable for a verify operation.
SyncEvent.SyncEvent() - Web APIs
options are as follows: tag: a developer-defined unique identifier for this syncevent.
SyncEvent - Web APIs
WebAPISyncEvent
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: 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...
TaskAttributionTiming - Web APIs
<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/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.isElementContentWhitespace - Web APIs
syntax b = textnode.iselementcontentwhitespace; example in the example below, we create a node with mixed display and whitespace characters and the attribute is false.
Text.splitText() - Web APIs
WebAPITextsplitText
exceptions thrown a domexception with a value of index_size_err is thrown if the specified offset is negative or is greater than the number of 16-bit units in the node's text; a domexception with a value of no_modification_allowed_err is thrown if the node is read-only.
TextDecoder() - Web APIs
example var textdecoder1 = new textdecoder("iso-8859-2"); var textdecoder2 = new textdecoder(); var textdecoder3 = new textdecoder("csiso2022kr", {fatal: true}); // allows encodingerror exception to be thrown.
TextDecoder.prototype.decode() - Web APIs
options optional is a textdecodeoptions dictionary with the property: stream a boolean flag indicating that additional data will follow in subsequent calls to decode().
TextDecoder.prototype.encoding - Web APIs
it can be one of the following values: the recommended encoding for the web: 'utf-8'.
TextEncoder.prototype.encodeInto() - Web APIs
string = sourcepara.textcontent; const textencoder = new textencoder(); const utf8 = new uint8array(string.length); let encodedresults = textencoder.encodeinto(string, utf8); resultpara.textcontent += 'bytes read: ' + encodedresults.read + ' | bytes written: ' + encodedresults.written + ' | encoded result: ' + utf8; polyfill the polyfill below may be a bit long because of the switch cases and utilization of native textencoder.prototype.encode in safari when available, but it is well worth the length because of the gains in performance.
TextEncoder.encoding - Web APIs
it can only have the following value utf-8.
TextMetrics.width - Web APIs
WebAPITextMetricswidth
you can get a textmetrics object using the following code: const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); let text = ctx.measuretext('foo'); // textmetrics object text.width; // 16; specifications specification html living standardthe definition of 'textmetrics.width' in that specification.
TimeEvent - Web APIs
WebAPITimeEvent
<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/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="#d4...
Touch.force - Web APIs
WebAPITouchforce
in following code snippet, the touchstart event handler iterrates through the targettouches list and logs the force value of each touch point but the code could invoke different processing depending on the value.
Touch.pageX - Web APIs
WebAPITouchpageX
in following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the touch points and then releases all contacts with the surface.
Touch.pageY - Web APIs
WebAPITouchpageY
in following simple code snippet, we assume the user initiates one or more touch contacts on the source element, moves the touch points and then releases all contacts with the surface.
Touch.radiusX - Web APIs
WebAPITouchradiusX
the following simple code snippet, registers a single handler for the touchstart, touchmove and touchend events.
Touch.screenX - Web APIs
WebAPITouchscreenX
in following simple code snippet, we assume the user initiates multiple touch contacts on an element with an id of source and then releases contacts with the surface.
Touch.target - Web APIs
WebAPITouchtarget
in following simple code snippet, we assume the user initiates one or more touch contacts on the source element.
TouchEvent() - Web APIs
toucheventinit optional is a toucheventinit dictionary, having the following fields: "touches", optional and defaulting to [], of type touch[], that is a list of objects for every point of contact currently touching the surface.
TouchEvent.altKey - Web APIs
WebAPITouchEventaltKey
in following code snippet, the touchstart event handler logs the state of the event's modifier keys.
TouchEvent.targetTouches - Web APIs
in following code snippet, the function compares the length of the touches list to the the length of the targettouches list and returns true if the lengths are the same and returns false otherwise.
TouchEvent.touches - Web APIs
in following code snippet, the touchstart event handler checks the length of the touchevent.touches list to determine the number of touch points that were activated and then invokes different handlers depending on the number of touch points.
TrackDefault.TrackDefault() - Web APIs
errors when this constructor is invoked, the following errors can occur: error explanation invalidaccesserror the supplied language is not a valid language code, e.g.
TrackDefaultList.TrackDefault() - Web APIs
the trackdefault() getter method of the trackdefaultlist interface allows the trackdefault objects in the list to be accessed with an array operator (i.e.
TrackDefaultList - Web APIs
trackdefaultlist.trackdefault() this getter allows the trackdefault objects in the list to be accessed with an array operator (i.e.
TrackEvent() - Web APIs
eventinfo optional an optional dictionary providing additional information configuring the new event; it can contain the following fields in any combination: track optional the track to which the event refers; this is null by default, but should be set to a videotrack, audiotrack, or texttrack as appropriate given the type of track.
TransformStream - Web APIs
methods none examples anything-to-uint8array stream in the following example, a transform stream passes through all chunks it receives as uint8array values.
TransitionEvent.initTransitionEvent() - Web APIs
the following value is allowed: value meaning transitionend the transition completed.
UIEvent() - Web APIs
WebAPIUIEventUIEvent
uieventinit optional is a uieventinit dictionary, having the following fields: detail: optional and defaulting to 0, of type long, that is a event-dependant value associated with the event.
sourceCapabilities - Web APIs
for example, many user agents allow a window to be resized with a mouse or a keyboard, but this detail is not exposed to the web platform in any way, and so the sourcecapabilities of a resize event will typically be null.
UIEvent - Web APIs
WebAPIUIEvent
<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/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-anch...
URL.hash - Web APIs
WebAPIURLhash
the hash property of the url interface is a usvstring containing a '#' followed by the fragment identifier of the url.
URL.host - Web APIs
WebAPIURLhost
the host property of the url interface is a usvstring containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', followed by the port of the url.
URL.pathname - Web APIs
WebAPIURLpathname
the pathname property of the url interface is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path).
URL.pathname - Web APIs
the pathname property of the url interface is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path).
URL.search - Web APIs
WebAPIURLsearch
the search property of the url interface is a search string, also called a query string, that is a usvstring containing a '?' followed by the parameters of the url.
URL.search - Web APIs
WebAPIURLsearch?q=123
the search property of the url interface is a search string, also called a query string, that is a usvstring containing a '?' followed by the parameters of the url.
URL.searchParams - Web APIs
WebAPIURLsearchParams
the searchparams readonly property of the url interface returns a urlsearchparams object allowing access to the get decoded query arguments contained in the url.
URLSearchParams() - Web APIs
examples the following example shows how to create a urlsearchparams object from a url string.
URLSearchParams.append() - Web APIs
as shown in the example below, if the same key is appended multiple times it will appear in the parameter string multiple times for each value.
URLSearchParams.entries() - Web APIs
the entries() method of the urlsearchparams interface returns an iterator allowing iteration through all key/value pairs contained in this object.
URLSearchParams.forEach() - Web APIs
the foreach() method of the urlsearchparams interface allows iteration through all values contained in this object via a callback function.
URLSearchParams.keys() - Web APIs
the keys() method of the urlsearchparams interface returns an iterator allowing iteration through all keys contained in this object.
URLSearchParams.set() - Web APIs
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.
URLSearchParams.values() - Web APIs
the values() method of the urlsearchparams interface returns an iterator allowing iteration through all values contained in this object.
URLUtilsReadOnly.hash - Web APIs
the urlutilsreadonly.hash read-only property returns a domstring containing a '#' followed by the fragment identifier of the url.
URLUtilsReadOnly.origin - Web APIs
the urlutilsreadonly.origin read-only property is a domstring containing the unicode serialization of the origin of the represented url, that is, for http and https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified).
URLUtilsReadOnly.pathname - Web APIs
the urlutilsreadonly.pathname read-only property returns a domstring containing an initial '/' followed by the path of the url.
URLUtilsReadOnly.search - Web APIs
the urlutilsreadonly.search read-only property returns a domstring containing a '?' followed by the parameters of the url.
URL API - Web APIs
WebAPIURL API
the filltablewithparameters() function below takes as input a htmltableelement object representing a <table>.
USB.getDevices() - Web APIs
WebAPIUSBgetDevices
example the following example logs the product name and serial number of paired devices to the console.
USB - Web APIs
WebAPIUSB
calling this function triggers the user agent's pairing flow.
USBDevice.claimInterface() - Web APIs
example the following example shows claiminterface() in the context of connecting to a usb device.
USBDevice.clearHalt() - Web APIs
example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer.
USBDevice.configuration - Web APIs
example the following example uses this property to test for the existence of a usbconfiguration property to select a configuration before claiming an interface.
USVString - Web APIs
WebAPIUSVString
usvstring is equivalent to domstring except for not allowing unpaired surrogate codepoints.
UserDataHandler - Web APIs
operation (unsigned short) is an operation type integer (see below).
ValidityState.patternMismatch - Web APIs
examples given the following: <p> <label>enter your phone number in the format (123)456-7890 (<input name="tel1" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit area code" size="2"/>)- <input name="tel2" type="tel" pattern="[0-9]{3}" placeholder="###" aria-label="3-digit prefix" size="2"/> - <input name="tel3" type="tel" pattern="[0-9]{4}" placeholder="####" aria-label="4-digit number" size="...
ValidityState.stepMismatch - Web APIs
given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepmismatch will be true.
ValidityState.typeMismatch - Web APIs
type attribute conformance input type value expected value email x@y or x@y.z email address, with or without tld url x: or x://y.z protocol or full url with protocol examples given the following: <p> <label> enter an email address: <input type="email" value="example.com"/> </label> </p> <p> <label> enter a url: <input type="url" value="example.com"/> </label> </p> input:invalid { border: red solid 3px; } the above each produce a typemismatch because the email address is just a domain and the url has no protocol the typemismatch occurs when there is a dis...
Vibration API - Web APIs
continued vibrations some basic setinterval and clearinterval action will allow you to create persistent vibration: var vibrateinterval; // starts vibration at passed in level function startvibrate(duration) { navigator.vibrate(duration); } // stops vibration function stopvibrate() { // clear interval and stop persistent vibrating if(vibrateinterval) clearinterval(vibrateinterval); navigator.vibrate(0); } // start persistent vibration at given duration an...
VideoPlaybackQuality.totalVideoFrames - Web APIs
var videoelem = document.getelementbyid("my_vid"); var quality = videoelem.getvideoplaybackquality(); if ((quality.corruptedvideoframes + quality.droppedvideoframes)/quality.totalvideoframes > 0.1) { lostframesthresholdexceeded(); } a similar algorithm might be used to attempt to switch to a lower-resolution video that requires less bandwidth, in order to avoid dropping frames.
VideoTrack.kind - Web APIs
WebAPIVideoTrackkind
the string is one of those found in video track kind strings below.
VideoTrack.label - Web APIs
WebAPIVideoTracklabel
the list is filtered to only allow certain track kinds through.
WEBGL_compressed_texture_atc - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_compressed_texture_etc - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_compressed_texture_etc1 - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_compressed_texture_pvrtc - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_compressed_texture_s3tc - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_compressed_texture_s3tc_srgb - Web APIs
compressed textures reduce the amount of memory needed to store a texture on the gpu, allowing for higher resolution textures or more of the same resolution textures.
WEBGL_debug_renderer_info - Web APIs
the webglrenderingcontext.getparameter() method can help you to detect which features are supported and the failifmajorperformancecaveat context attribute lets you control if a context should be returned at all, if the performance would be dramatically slow.
WEBGL_debug_shaders.getTranslatedShaderSource() - Web APIs
the webgl_debug_shaders.gettranslatedshadersource() method is part of the webgl api and allows you to debug a translated shader.
WEBGL_draw_buffers.drawBuffersWEBGL() - Web APIs
the webgl_draw_buffers.drawbufferswebgl() method is part of the webgl api and allows you to define the draw buffers to which all fragment colors are written.
WEBGL_lose_context.loseContext() - Web APIs
the webgl_lose_context.losecontext() method is part of the webgl api and allows you to simulate losing the context of a webglrenderingcontext context.
WEBGL_lose_context.restoreContext() - Web APIs
the webgl_lose_context.restorecontext() method is part of the webgl api and allows you to simulate restoring the context of a webglrenderingcontext object.
WaveShaperNode.WaveShaperNode() - Web APIs
options optional options are as follows: curve: the shaping curve used for the waveshaping effect.
WebGL2RenderingContext.getUniformBlockIndex() - Web APIs
examples // assuming a shader with the following declaration: // uniform ubodata { // mat4 foo; // } instancename; // use the block name, not the instance name: var blockindex = gl.getuniformblockindex(program, 'ubodata'); specifications specification status comment webgl 2.0the definition of 'getuniformblockindex' in that specification.
WebGL2RenderingContext.renderbufferStorageMultisample() - Web APIs
the webgl2renderingcontext.renderbufferstoragemultisample() method of the webgl 2 api returns creates and initializes a renderbuffer object's data store and allows specifying a number of samples to be used.
WebGL2RenderingContext.texImage3D() - Web APIs
gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_rev (pixels must be null) source one of the following objects can be used as a pixel source for the texture: arraybufferview, imagebitmap, imagedata, htmlimageelement, htmlcanvaselement, htmlvideoelement.
WebGL2RenderingContext.texStorage2D() - Web APIs
possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb8_aplha8 gl.rgb5_a1 gl.rgba4 gl.rgba16f gl.rgba32f gl.rgba8ui unlike opengl 3.0, webgl 2 doesn't support the following etc2 and eac compressed texture formats (see section 5.37 in the webgl 2 spec).
WebGL2RenderingContext.texSubImage3D() - Web APIs
gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_rev gl.unsigned_int_10f_11f_11f_rev gl.unsigned_int_5_9_9_9_rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_rev (pixels must be null) pixels one of the following objects can be used as a pixel source for the texture: arraybufferview, a uint8array must be used if type is gl.unsigned_byte.
WebGL2RenderingContext.uniform[1234][uif][v]() - Web APIs
see the syntax table below.
WebGL2RenderingContext.uniformMatrix[234]x[234]fv() - Web APIs
see the syntax below.
WebGL2RenderingContext.vertexAttribIPointer() - Web APIs
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.
WebGL2RenderingContext - Web APIs
webgl2renderingcontext.renderbufferstoragemultisample() creates and initializes a renderbuffer object's data store and allows specifying the number of samples to be used.
WebGLBuffer - Web APIs
when working with webglbuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindbuffer() webglrenderingcontext.createbuffer() webglrenderingcontext.deletebuffer() webglrenderingcontext.isbuffer() examples creating a buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createbuffer(); specifications specification status comment webgl 1.0the definition of 'webglbuffer' in that specification.
WebGLContextEvent - Web APIs
<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/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-anch...
WebGLFramebuffer - Web APIs
when working with webglframebuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindframebuffer() webglrenderingcontext.createframebuffer() webglrenderingcontext.deleteframebuffer() webglrenderingcontext.isframebuffer() examples creating a frame buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createframebuffer(); specifications specification status comment webgl 1.0the definition ...
WebGLProgram - Web APIs
this is shown in the code below.
WebGLRenderbuffer - Web APIs
when working with webglrenderbuffer objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindrenderbuffer() webglrenderingcontext.createrenderbuffer() webglrenderingcontext.deleterenderbuffer() webglrenderingcontext.isrenderbuffer() examples creating a render buffer var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var buffer = gl.createrenderbuffer(); specifications specification status comme...
WebGLRenderingContext.activeTexture() - Web APIs
examples the following call selects gl.texture1 as the current texture.
WebGLRenderingContext.attachShader() - Web APIs
examples the following code attaches pre-existing shaders to a webglprogram.
WebGLRenderingContext.bindBuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.copy_read_buffer: buffer for copying from one buffer object to another.
WebGLRenderingContext.bindFramebuffer() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.draw_framebuffer: equivalent to gl.framebuffer.
WebGLRenderingContext.bindTexture() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.blendEquation() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination.
WebGLRenderingContext.disable() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard deactivates that primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.drawingBufferHeight - Web APIs
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.
WebGLRenderingContext.drawingBufferWidth - Web APIs
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.
WebGLRenderingContext.enable() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.getActiveUniform() - Web APIs
the type attribute of the return value will be one of the following: gl.float gl.float_vec2 gl.float_vec3 gl.float_vec4 gl.int gl.int_vec2 gl.int_vec3 gl.int_vec4 gl.bool gl.bool_vec2 gl.bool_vec3 gl.bool_vec4 gl.float_mat2 gl.float_mat3 gl.float_mat4 gl.sampler_2d gl.sampler_cube when using a webgl 2 context, the following values are possible additionally: gl.unsigned_int gl.unsigned_int_vec2 gl.unsigned_int_vec3 gl.unsigned...
WebGLRenderingContext.getError() - Web APIs
gl.invalid_operation the specified command is not allowed for the current state.
WebGLRenderingContext.getProgramParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.transform_feedback_buffer_mode: returns a glenum indicating the buffer mode when transform feedback is active.
WebGLRenderingContext.getRenderbufferParameter() - Web APIs
when using a webgl 2 context, the following value is available additionally: gl.renderbuffer_samples: returns a glint indicating the number of samples of the image of the currently bound renderbuffer.
WebGLRenderingContext.getTexParameter() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.getVertexAttrib() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.vertex_attrib_array_integer: returns a glboolean indicating whether or not an integer data type is in the vertex attribute array at the given index.
WebGLRenderingContext.isContextLost() - Web APIs
the user updates their graphics driver on an operating system that allows graphics drivers to be updated without restarting the system.
WebGLRenderingContext.isEnabled() - Web APIs
when using a webgl 2 context, the following values are available additionally: constant description gl.rasterizer_discard primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage.
WebGLRenderingContext.makeXRCompatible() - Web APIs
exceptions this method doesn't throw traditional exceptions; instead, the promise rejects with one of the following errors as the value passed into the rejection handler: aborterror switching the context over to the webxr-compatible context failed.
WebGLRenderingContext.renderbufferStorage() - Web APIs
gl.depth_stencil when using a webgl 2 context, the following values are available additionally: gl.r8 gl.r8ui gl.r8i gl.r16ui gl.r16i gl.r32ui gl.r32i gl.rg8 gl.rg8ui gl.rg8i gl.rg16ui gl.rg16i gl.rg32ui gl.rg32i gl.rgb8 gl.rgba8 gl.srgb8_alpha8 (also available as an extension for webgl 1, see below) gl.rgb10_a2 gl.rgba8ui gl.rgba8i gl.rgb10_a2ui gl.rgba16ui ...
WebGLRenderingContext.stencilFunc() - Web APIs
gl.enable(gl.stencil_test); gl.stencilfunc(gl.less, 0, 0b1110011); to get the current stencil function, reference value, or other stencil information, query the following constants with getparameter().
WebGLRenderingContext.stencilFuncSeparate() - Web APIs
gl.enable(gl.stencil_test); gl.stencilfuncseparate(gl.front, gl.less, 0.2, 1110011); to get the current stencil function, reference value, or other stencil information, query the following constants with getparameter().
WebGLRenderingContext.texParameter[fi]() - Web APIs
when using a webgl 2 context, the following values are available additionally: gl.texture_3d: a three-dimensional texture.
WebGLRenderingContext.vertexAttrib[1234]f[v]() - Web APIs
examples const a_foobar = gl.getattriblocation(shaderprogram, 'foobar'); //either set each component individually: gl.vertexattrib3f(a_foobar, 10.0, 5.0, 2.0); //or provide a float32array: const floatarray = new float32array([10.0, 5.0, 2.0]); gl.vertexattrib3fv(a_foobar, floatarray); // we want to load the following 3x3 matrix into attribute named "matrix3x3" // 0 1 2 // 3 4 5 // 6 7 8 const matrix3x3location = gl.getattriblocation(shaderprogram, 'matrix3x3'); gl.vertexattrib3f(matrix3x3location, 0, 3, 6); gl.vertexattrib3f(matrix3x3location + 1, 1, 4, 7); gl.vertexattrib3f(matrix3x3location + 2, 2, 5, 8); specifications specification status comment webgl 1.0the definition o...
WebGLRenderingContext - Web APIs
the webgl context the following properties and methods provide general information and functionality to deal with the webgl context: webglrenderingcontext.canvas a read-only back-reference to the htmlcanvaselement.
WebGLSampler - Web APIs
when working with webglsampler objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.createsampler() webgl2renderingcontext.deletesampler() webgl2renderingcontext.issampler() webgl2renderingcontext.bindsampler() webgl2renderingcontext.getsamplerparameter() examples creating a webglsampler object in this example, gl must be a webgl2renderingcontext.
WebGLShaderPrecisionFormat.precision - Web APIs
examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).precision; // 23 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).precision; // 0 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.precision' in that specification.
WebGLShaderPrecisionFormat.rangeMax - Web APIs
examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).rangemax; // 127 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).rangemax; // 24 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.rangemax' in that specification.
WebGLShaderPrecisionFormat.rangeMin - Web APIs
examples var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); gl.getshaderprecisionformat(gl.vertex_shader, gl.medium_float).rangemin; // 127 gl.getshaderprecisionformat(gl.fragment_shader, gl.low_int).rangemin; // 24 specifications specification status comment webgl 1.0the definition of 'webglshaderprecisionformat.rangemin' in that specification.
WebGLSync - Web APIs
WebAPIWebGLSync
when working with webglsync objects, the following methods of the webgl2renderingcontext are useful: webgl2renderingcontext.fencesync() webgl2renderingcontext.deletesync() webgl2renderingcontext.issync() webgl2renderingcontext.clientwaitsync() webgl2renderingcontext.waitsync() webgl2renderingcontext.getsyncparameter() examples creating a webglsync object in this example, gl must be a webgl2renderingcontext.
WebGLTexture - Web APIs
when working with webgltexture objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.bindtexture() webglrenderingcontext.createtexture() webglrenderingcontext.deletetexture() webglrenderingcontext.istexture() examples creating a texture var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var texture = gl.createtexture(); specifications specification status comment webgl 1.0the definition of 'webgltexture' in...
WebGLUniformLocation - Web APIs
when working with webgluniformlocation objects, the following methods of the webglrenderingcontext are useful: webglrenderingcontext.getuniformlocation() webglrenderingcontext.uniform() examples getting an uniform location var canvas = document.getelementbyid('canvas'); var gl = canvas.getcontext('webgl'); var location = gl.getuniformlocation(webglprogram, 'uniformname'); specifications specification status comment webgl 1.0the definition of 'webgluniformlocation' in that specification.
WebGLVertexArrayObject - Web APIs
when working with webglvertexarrayobject objects, the following methods are useful: webgl2renderingcontext.createvertexarray() webgl2renderingcontext.deletevertexarray() webgl2renderingcontext.isvertexarray() webgl2renderingcontext.bindvertexarray() webgl 1: the oes_vertex_array_object extension allows you to use vertex array objects in a webgl 1 context.
A basic 2D WebGL animation example - Web APIs
compiling an individual shader the compileshader() function, below, is called by buildshaderprogram() to compile a single shader.
Clearing by clicking - Web APIs
<p>a very simple webgl program that still shows some color and user interaction.</p> <p>you can repeatedly click the empty canvas or the button below to change color.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="color-switcher">press here to switch color</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : inline-block; font-si...
Simple color animation - Web APIs
<p>a simple webgl program that shows color animation.</p> <p>you can click the button below to toggle the color animation on or off.</p> <canvas id="canvas-view">your browser does not seem to support html5 canvas.</canvas> <button id="animation-onoff"> press here to <strong>[verb goes here]</strong> the animation </button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; backgr...
Data in WebGL - Web APIs
WebAPIWebGL APIData
//init colors var vertexcolors = [ vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), // green vec4( 0.0, 0.0, 0.0, 1.0 ), // black vec4( 1.0, 0.0, 0.0, 1.0 ), // red vec4( 1.0, 1.0, 0.0, 1.0 ), // yellow vec4( 0.0, 1.0, 0.0, 1.0 ), // green ]; var cbuffer = gl.createbuffer(); //continued //create buffer to store colors and reference it to "vcolor" which is in glsl gl.bindbuffer( gl.array_buff...
Animating objects with WebGL - Web APIs
we can do that by creating a new variable to track the time at which we last animated (let's call it then), then adding the following code to the end of the main function var then = 0; // draw the scene repeatedly function render(now) { now *= 0.001; // convert to seconds const deltatime = now - then; then = now; drawscene(gl, programinfo, buffers, deltatime); requestanimationframe(render); } requestanimationframe(render); this code uses requestanimationframe to ask the browser to call th...
Animating textures in WebGL - Web APIs
then in main() in place of the call to loadtexture() in the previous example, we call inittexture() followed by setupvideo() .
Creating 3D objects using WebGL - Web APIs
const facecolors = [ [1.0, 1.0, 1.0, 1.0], // front face: white [1.0, 0.0, 0.0, 1.0], // back face: red [0.0, 1.0, 0.0, 1.0], // top face: green [0.0, 0.0, 1.0, 1.0], // bottom face: blue [1.0, 1.0, 0.0, 1.0], // right face: yellow [1.0, 0.0, 1.0, 1.0], // left face: purple ]; // convert the array of colors into a table for all the vertices.
Getting started with WebGL - Web APIs
the html fragment below declares a canvas that our sample will draw into.
WebGL types - Web APIs
WebAPIWebGL APITypes
the following types are used in webgl interfaces.
Lifetime of a WebRTC session - Web APIs
this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running.
WebRTC Statistics API - Web APIs
the table below shows the statistic categories and the corresponding dictionaries; for each statistic category, the full hierarchy of rtcstats-based dictionaries are listed, so you can easily find all the available values.
WebSocket.readyState - Web APIs
syntax var readystate = awebsocket.readystate; value one of the following unsigned short values: value state description 0 connecting socket has been created.
WebSocket.send() - Web APIs
WebAPIWebSocketsend
it may be one of the following types: usvstring a text string.
Writing a WebSocket server in Java - Web APIs
if it is 126, the following 2 bytes (16-bit unsigned integer), if 127, the following 8 bytes (64-bit unsigned integer, the most significant bit must be 0) are the length.
WebXR performance guide - Web APIs
consider the following function drawscene(gl, view, programinfo, buffers, texture, deltatime) { ...
Web Animations API - Web APIs
the web animations api allows for synchronizing and timing changes to the presentation of a web page, i.e.
Web Bluetooth API - Web APIs
the web bluetooth api provides the ability to connect and interact with bluetooth low energy peripherals.
Web Speech API - Web APIs
grammar is defined using jspeech grammar format (jsgf.) speech synthesis is accessed via the speechsynthesis interface, a text-to-speech component that allows programs to read out their text content (normally via the device's default speech synthesiser.) different voice types are represented by speechsynthesisvoice objects, and different parts of text that you want to be spoken are represented by speechsynthesisutterance objects.
WheelEvent() - Web APIs
wheeleventinit optional is a wheeleventinit dictionary, having the following fields: "deltax", optional and defaulting to 0.0, is a double representing the horizontal scroll amount in the deltamode unit.
WheelEvent - Web APIs
<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/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-anch...
Window.alert() - Web APIs
WebAPIWindowalert
the following text is shared between this article, dom:window.prompt and dom:window.confirm dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed.
Window.close() - Web APIs
WebAPIWindowclose
this is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open.
Window.closed - Web APIs
WebAPIWindowclosed
examples change the url of a window from a popup the following example demonstrates how a popup window can change the url of the window that opened it.
Window.confirm() - Web APIs
WebAPIWindowconfirm
example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces: notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they prevent the user from accessing the rest of the program's interface until the dialog box is closed.
Window.content - Web APIs
WebAPIWindowcontent
syntax var windowobject = window.content; example executing the following code in a chrome xul window with a <browser type="content-primary"/> element in it draws a red border around the first div on the page currently displayed in the browser: content.document.getelementsbytagname("div")[0].style.border = "solid red 1px"; specification none.
Window.crypto - Web APIs
WebAPIWindowcrypto
this object allows web pages access to certain cryptographic related services.
Window.customElements - Web APIs
examples the most common example you'll see of this property being used is to get access to the customelementregistry.define() method to define and register a new custom element, e.g.: let customelementregistry = window.customelements; customelementregistry.define('my-custom-element', mycustomelement); however, it is usually shortened to something like the following: customelements.define('element-details', class extends htmlelement { constructor() { super(); const template = document .getelementbyid('element-details-template') .content; const shadowroot = this.attachshadow({mode: 'open'}) .appendchild(template.clonenode(true)); } } ); see our web-components-examples repo for more usage examples.
window.dump() - Web APIs
WebAPIWindowdump
however, this use of dump is not affected by the preference mentioned below -- it will always be shown.
Window.external - Web APIs
WebAPIWindowexternal
methods the external object has the following methods: method description addsearchprovider(descriptionurl) dummy function; does nothing.
Window: hashchange event - Web APIs
the hashchange event is fired when the fragment identifier of the url has changed (the part of the url beginning with and following the # symbol).
Window.history - Web APIs
WebAPIWindowhistory
for security reasons the history object doesn't allow the non-privileged code to access the urls of other pages in the session history, but it does allow it to navigate the session history.
Window.innerHeight - Web APIs
graphical example the following figure shows the difference between outerheight and innerheight.
window.location - Web APIs
WebAPIWindowlocation
location.assign("http://www.mozilla.org"); // or location = "http://www.mozilla.org"; example #2: force reloading the current page from the server location.reload(true); example #3 consider the following example, which will reload the page by using the replace() method to insert the value of location.pathname into the hash: function reloadpagewithhash() { var initialpage = location.pathname; location.replace('http://example.com/#' + initialpage); } example #4: display the properties of the current url in an alert dialog: function showloc() { var olocation = location, alog = ["propert...
Window.locationbar - Web APIs
syntax objref = window.locationbar example the following complete html example shows how the visible property of the locationbar object is used.
Window.menubar - Web APIs
WebAPIWindowmenubar
syntax objref = window.menubar example the following complete html example demonstrates how the visible property of the menubar object is used.
Window.onbeforeinstallprompt - Web APIs
}); window.onbeforeinstallprompt = function(event) { ...}; example the following example uses the beforeinstallprompt event to make an install button operable, by using the event inside a click handler.
Window.outerHeight - Web APIs
graphical example the following figure shows the difference between outerheight and innerheight.
Window.pageYOffset - Web APIs
css iframe { width: 620px; height: 450px; border: 1px solid black; } #info { margin-top: 20px; font: 16px "open sans", "helvetica", "arial"; } result the result follows.
Window.requestFileSystem() - Web APIs
specify window.temporary if it's acceptable for the browser to delete the files at its own discretion, such as if storage space runs low, or window.persistent if you need the files to remain in place unless the user or the web site or app explicitly permit it.
window.requestIdleCallback() - Web APIs
this enables developers to perform background and low priority work on the main event loop, without impacting latency-critical events such as animation and input response.
Window.screen - Web APIs
WebAPIWindowscreen
syntax let screenobj = window.screen; example if (screen.pixeldepth < 8) { // use low-color version of page } else { // use regular, colorful page } specifications specification status comment css object model (cssom) view modulethe definition of 'window.screen' in that specification.
Window.scrollbars - Web APIs
WebAPIWindowscrollbars
syntax objref = window.scrollbars example the following complete html example shows how the visible property of the scrollbars object is used.
Window.sidebar - Web APIs
WebAPIWindowsidebar
methods the sidebar object returned has the following methods: method description (seamonkey) description (firefox) addpanel(title, contenturl, "") adds a sidebar panel.
Window.window - Web APIs
WebAPIWindowwindow
thus, the following expressions all return the same window object: window.window window.window.window window.window.window.window // ...
WindowEventHandlers.onafterprint - Web APIs
the beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed.
WindowEventHandlers.onbeforeprint - Web APIs
the beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then revert those changes after printing has completed.
WindowEventHandlers.onhashchange - Web APIs
'location1' : 'location2'; } the hashchange event the dispatched hashchange event has the following properties: field type description newurl domstring the new url to which the window is navigating.
WindowEventHandlers.onpopstate - Web APIs
examples for example, a page at http://example.com/example.html running the following code will generate alerts as indicated: window.onpopstate = function(event) { alert("location: " + document.location + ", state: " + json.stringify(event.state)); }; history.pushstate({page: 1}, "title 1", "?page=1"); history.pushstate({page: 2}, "title 2", "?page=2"); history.replacestate({page: 3}, "title 3", "?page=3"); history.back(); // alerts "location: http://example.com/example.htm...
WindowOrWorkerGlobalScope.btoa() - Web APIs
see "unicode strings" below for more detail.
WindowOrWorkerGlobalScope.caches - Web APIs
example the following example shows how you'd use a cache in a service worker context to store assets offline.
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
example run the script below in the context of a web page and click on the page once.
self.createImageBitmap() - Web APIs
one of pixelated, low (default), medium, or high.
WindowOrWorkerGlobalScope.indexedDB - Web APIs
example the following code creates a request for a database to be opened asychronously, after which the database is opened when the request's onsuccess handler is fired: var db; function opendb() { var dbopenrequest = window.indexeddb.open('todolist'); dbopenrequest.onsuccess = function(e) { db = dbopenrequest.result; } } specifications specification status comment indexed database api draftthe definition of 'indexeddb' in that specification.
WindowOrWorkerGlobalScope.origin - Web APIs
examples executed from inside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e.
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
ction (url) { if (this._cache[url]) { queuemicrotask(() => { this._setdata(this._cache[url]); this.dispatchevent(new event("load")); }); } else { fetch(url).then(res => res.arraybuffer()).then(data => { this._cache[url] = data; this._setdata(data); this.dispatchevent(new event("load")); }); } }; when queuemicrotask() isn't available the code below is basically a monkey-patch for queuemicrotask() for modern engines.
WindowOrWorkerGlobalScope - Web APIs
each of these interfaces can, of course, add more features in addition to the ones listed below.
Worker.onmessage - Web APIs
WebAPIWorkeronmessage
} example the following code snippet shows creation of a worker object using the worker() constructor.
Worker.terminate() - Web APIs
WebAPIWorkerterminate
example the following code snippet shows creation of a worker object using the worker() constructor, which is then immediately terminated.
Worker - Web APIs
WebAPIWorker
example the following code snippet creates a worker object using the worker() constructor, then uses the worker object: var myworker = new worker('/worker.js'); var first = document.queryselector('input#number1'); var second = document.queryselector('input#number2'); first.onchange = function() { myworker.postmessage([first.value, second.value]); console.log('message posted to worker'); } for a full example,...
WorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you wanted to close your worker instance from inside the worker itself, you could call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
WorkerGlobalScope.console - Web APIs
example this property allows you to have access to a browser console for debugging purposes, inside a worker.
WorkerGlobalScope.importScripts() - Web APIs
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.
WorkerGlobalScope.location - Web APIs
example if you called the following in a document served at localhost:8000 console.log(location); inside a worker (which would basically be the equivalent of self.console.log(self.location);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerlocation object written to the console — something like the following: workerlocation {hash: "", search: "", pathname: "/worker.js", port: "8000", hostname: "localhost"…} ...
WorkerGlobalScope.navigator - Web APIs
example if you call the following console.log(navigator); inside a worker (which would basically be the equivalent of self.console.log(self.navigator);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workernavigator object written to the console — something like the following: object {online: true, useragent: "mozilla/5.0 (macintosh; intel mac os x 10_10_1) ap…ml, like gecko) chrome/40.0.2214.93 safari/537...
WorkerGlobalScope.onclose - Web APIs
}; example the following code snippet shows an onclose handler set inside a worker: self.onclose = function() { console.log('your worker instance has been closed'); } specifications this feature is no longer defined in any specifications.
WorkerGlobalScope.onerror - Web APIs
}; example the following code snippet shows an onerror handler set inside a worker: self.onerror = function() { console.log('there is an error inside your worker!'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onerror' in that specification.
WorkerGlobalScope.onlanguagechange - Web APIs
}; example the following code snippet shows an onlanguagechange handler set inside a worker: self.onlanguagechange = function() { console.log('your preferred language settings have been changed'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onlanguagechange' in that specification.
WorkerGlobalScope.onoffline - Web APIs
}; example the following code snippet shows an onoffline handler set inside a worker: self.onoffline = function() { console.log('your worker is now offline'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onoffline' in that specification.
WorkerGlobalScope.ononline - Web APIs
}; example the following code snippet shows an ononline handler set inside a worker: self.ononline = function() { console.log('your worker is now online'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.ononline' in that specification.
WorkerGlobalScope.performance - Web APIs
example if you called console.log(performance); inside a worker (which would basically be the equivalent of self.console.log(self.performance);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerperformance object written to the console — something like the following: workerperformance {now: function} __proto__: workerperformance constructor: function workerperformance() { [native code] } now: function now() { [native code] } __proto__: object you could use this performance object to return performance data, as you might do with a normal performance object.
WorkerGlobalScope.self - Web APIs
example if you called console.log(self); inside a worker, you will get a worker global scope of the same type as that worker object written to the console — something like the following: dedicatedworkerglobalscope { undefined: undefined, infinity: infinity, math: mathconstructor, nan: nan, intl: object…} infinity: infinity array: function array() { [native code] } arguments: null caller: null isarray: function isarray() { [native code] } length: 1 name: "array" observe: function observe() { [native code] } prototype: array[...
WorkerNavigator.connection - Web APIs
this could be used to select high definition content or low definition content based on the user's connection.
WorkerNavigator - Web APIs
the workernavigator interface represents a subset of the navigator interface allowed to be accessed from a worker.
WritableStream.getWriter() - Web APIs
examples the following example illustrates several features of this interface.
WritableStream - Web APIs
examples the following example illustrates several features of this interface.
WritableStreamDefaultController - Web APIs
the writablestreamdefaultcontroller interface of the the streams api represents a controller allowing control of a writablestream's state.
WritableStreamDefaultWriter.WritableStreamDefaultWriter() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
WritableStreamDefaultWriter.close() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
WritableStreamDefaultWriter.ready - Web APIs
example the following example shows two uses of the ready property.
WritableStreamDefaultWriter.write() - Web APIs
examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy.
XDomainRequest - Web APIs
the requested url's server must have the access-control-allow-origin header set to either all ("*") or to include the origin of the request.
XMLDocument - Web APIs
<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-a...
Using XMLHttpRequest in IE6 - Web APIs
in all modern browsers, you can create a new xmlhttprequest object using the following code: var request = new xmlhttprequest() however, if you need to also support internet explorer 6 and older, you need to extend your code like this: if (window.xmlhttprequest) { //firefox, opera, ie7, and other browsers will use the native object var request = new xmlhttprequest(); } else { //ie 5 and 6 will use the activex control var request = new activexobject("microsoft.xmlhttp"); } see also using xmlhttprequest ...
XMLHttpRequest() - Web APIs
mozsystem boolean: setting this flag to true allows making cross-site connections without requiring the server to opt-in using cors.
XMLHttpRequest.getAllResponseHeaders() - Web APIs
note: in modern browsers, the header names are returned in all lower case, as per the latest spec.
XMLHttpRequest.readyState - Web APIs
an xhr client exists in one of the following states: value state description 0 unsent client has been created.
XMLHttpRequest.responseText - Web APIs
the read-only xmlhttprequest property responsetext returns the text received from a server following a request being sent.
XMLHttpRequest.sendAsBinary() - Web APIs
however, on google chrome, when you try to send an arraybuffer, the following warning message will appear: arraybuffer is deprecated in xmlhttprequest.send().
XMLHttpRequest.status - Web APIs
example var xhr = new xmlhttprequest(); console.log('unsent: ', xhr.status); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onprogress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 * done: 200 */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.statusText - Web APIs
example var xhr = new xmlhttprequest(); console.log('0 unsent', xhr.statustext); xhr.open('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onprogress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4 done', xhr.statustext); }; xhr.send(null); /** * outputs the following: * * 0 unsent * 1 opened * 3 loading ok * 4 done ok */ specifications specification status comment xmlhttprequest living standard whatwg living standard ...
XMLHttpRequest.upload - Web APIs
the following events can be triggered on an upload object and used to monitor the upload: event event listener description loadstart onloadstart the upload has begun.
XMLHttpRequest - Web APIs
<div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.076923076923077%; vertical-align: middle; overflow: hidden;"><svg style="display: 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" tex...
XMLHttpRequestEventTarget - Web APIs
<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="middle">eventtarget</text></a><polyline points...
XMLHttpRequestResponseType - Web APIs
ms-stream the response is part of a streaming download; this response type is only allowed for download requests, and is only supported by internet explorer.
XMLSerializer.serializeToString() - Web APIs
the following types are also permitted as descendants of the root node, in addition to node and attr: documenttype document documentfragment element comment text processinginstruction attr if any other type is encountered, a typeerror exception is thrown.
XMLSerializer - Web APIs
note: in the real world, you should usually instead call importnode() method to import the new node into the dom, then call one of the following methods to add the node to the dom tree: the document and element methods append() and prepend() the node.replacewith() method (to replace an existing node with the new one) the document.insertadjacentelement() and element.insertadjacentelement() methods.
XPathEvaluator.createExpression() - Web APIs
example the following example shows the use of the evaluate() method.
XPathExpression - Web APIs
example the following example shows the use of the xpathexpression interface.
XPathResult.booleanValue - Web APIs
example the following example shows the use of the booleanvalue property.
XPathResult.invalidIteratorState - Web APIs
example the following example shows the use of the invaliditeratorstate property.
XPathResult.iterateNext() - Web APIs
example the following example shows the use of the iteratenext() method.
XPathResult.numberValue - Web APIs
example the following example shows the use of the numbervalue property.
XPathResult.resultType - Web APIs
example the following example shows the use of the resulttype property.
XPathResult.singleNodeValue - Web APIs
example the following example shows the use of the singlenodevalue property.
XPathResult.snapshotItem() - Web APIs
example the following example shows the use of the snapshotitem() method.
XPathResult.snapshotLength - Web APIs
example the following example shows the use of the snapshotlength property.
XPathResult.stringValue - Web APIs
example the following example shows the use of the stringvalue property.
XRBoundedReferenceSpace.boundsGeometry - Web APIs
the read-only xrboundedreferencespace property boundsgeometry is an array of dompointreadonly objects which specifies the points making up a polygon inside which the viewer is allowed to move.
XRInputSource.gripSpace - Web APIs
as shown in the diagram above, the coordinate system is oriented as follows: the x-axis is perpendicular to the palm of the user's hand, with the direction extending outward from the back of the hand being +x if the controller is in the user's right hand or -x if the controller is in the left hand.
XRInputSource.handedness - Web APIs
the value, which comes from the xrhandedness enumerated type, is one of the following: none the input controller is not associated with one of the user's hands.
XRInputSource.targetRayMode - Web APIs
the target ray will be drawn originating at the viewer's eyes and will follow the direction in which they're looking.
XRInputSource.targetRaySpace - Web APIs
this shared space represents the same location as the space returned by the xrsession method requestreferencespace(), but is maintained as a different object to allow for future enhancements to the api.
XRInputSource - Web APIs
this is followed by a squeezeend, which is also sent if the action is aborted rather than completed.
XRInputSourceArray.length - Web APIs
examples in this example, a game that requires at least one input source uses length to check this before proceeding to allow the user to play the game.
XRInputSourceEvent.inputSource - Web APIs
example the snippet below shows a handler for the select event which looks specifically for events which happen on gaze input devices.
XRInputSourceEvent - Web APIs
examples the code below sets up handlers for primary action events in order to determine when the user clicks on (shoots at/pokes at/whatever) objects in the scene.
XRInputSourceEventInit - Web APIs
it also offers the following: frame an xrframe object representing the event frame during which the event took place.
XRInputSourcesChangeEvent() - Web APIs
example the following snippet of code creates a new xrinputsourceschangeevent object indicating that a single new input source, described by an xrinputsource object named newinputsource, has been added to the system.
XRInputSourcesChangeEvent.added - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system.
XRInputSourcesChangeEvent.removed - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system.
XRInputSourcesChangeEvent - Web APIs
examples the following example shows how to set up an event handler which uses inputsourceschange events to detect newly-available pointing devices and to load their models in preparation to display them in the next animation frame.
XRPermissionDescriptor.mode - Web APIs
usage notes examples the example below checks to ensure that permission has been granted to allow the user to use webxr for an immersive virtual reality experience.
XRPermissionStatus - Web APIs
properties in addition to the properties listed below, xrpermissionstatus includes the properties defined by its parent interface, permissionstatus.
XRReferenceSpaceEvent.transform - Web APIs
the transform is defined using the old coordinate system, which allows it to be used to convert coordinates from the pre-event coordinate system to the post-event coordiante system.
XRReferenceSpaceEvent - Web APIs
properties in addition to inheriting the properties available on the parent interface, event, xrreferencespaceevent objects include the following properties: referencespace read only an xrreferencespace indicating the reference space that generated the event.
XRReferenceSpaceEventInit.transform - Web APIs
the transform is defined using the old coordinate system, which allows it to be used to convert coordinates from the pre-event coordinate system to the post-event coordiante system.
XRRenderState.baseLayer - Web APIs
see the examples below to see how to use updaterenderstate() to set the current xrwebgllayer used for rendering the scene.
XRRenderState - Web APIs
properties the followiing properties are available on xrrenderstate objects.
XRRigidTransform.matrix - Web APIs
hus, for an array [a0, a1, a2, ..., a13, a14, a15], the matrix looks like this: [a[0]a[4]a[8]a[12]a[1]a[5]a[9]a[13]a[2]a[6]a[10]a[14]a[3]a[7]a[11]a[15]]\begin{bmatrix} a[0] & a[4] & a[8] & a[12]\\ a[1] & a[5] & a[9] & a[13]\\ a[2] & a[6] & a[10] & a[14]\\ a[3] & a[7] & a[11] & a[15]\\ \end{bmatrix} the first time matrix is requested, it gets computed; after that, it's should be cached to avoid slowing down to compute it every time you need it.
XRSession.cancelAnimationFrame() - Web APIs
example in the example below we see code which starts up a webxr session if immersive vr mode is supported.
XRSession: select event - Web APIs
examples the following example uses addeventlistener() to set up a handler for the select event.
XRSession: squeeze event - Web APIs
examples the following example uses addeventlistener() to set up a handler for the squeeze event.
XRSessionEvent() - Web APIs
event types the following events are represented using the xrsessionevent interface, and are permitted values for its type property.
XRSessionInit - Web APIs
properties the following parameters are all optional.
XRSpace - Web APIs
WebAPIXRSpace
interfaces based on xrspace below is a list of interfaces based on the xrspace interface.
XRSystem: devicechange event - Web APIs
this is shown in the example below.
XRSystem: isSessionSupported() - Web APIs
exceptions rather than throwing true exceptions, issessionsupported() rejects the returned promise, passing to the rejection handler a domexception whose name is one of the following strings.
XRTargetRayMode - Web APIs
the target ray will be drawn originating at the viewer's eyes and will follow the direction in which they're looking.
XRView - Web APIs
WebAPIXRView
this allows the two views, when projected in isolation into the appropriate eyes, to simulate a 3d world.
XRViewerPose - Web APIs
properties in addition to the properties inherited from xrpose, xrviewerpose includes the following: views read only an array of xrview objects, one for each viewpoint on the scene which is needed to represent the scene to the user.
XRWebGLLayer.framebuffer - Web APIs
the opaque framebuffer is functionally nearly the same as a standard webgl framebuffer, except for the differences covered in the section how opaque framebuffers are special below.
XRWebGLLayer.ignoreDepthValues - Web APIs
this is demonstrated in the snippet of code below: const gllayeroptions = { ignoredepthvalues: true }; let gllayer = new xrwebgllayer(xrsession, gl, gllayeroptions); specifications specification status comment webxr device apithe definition of 'xrwebgllayer.ignoredepthvalues' in that specification.
XRWebGLLayer - Web APIs
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.
XRWebGLLayerInit.ignoreDepthValues - Web APIs
using a depth buffer while compositing allows the xr compositor to help ensure the compositing is done as accurately as possible.
Generating HTML - Web APIs
the final xslt stylesheet looks as follows: figure 6 : final xslt stylesheetview example | view source xsl stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:myns="http://devedge.netscape.com/2002/de"> <xsl:output method="html" /> <xsl:template match="/"> <html> <head> <title>...
XSL Transformations in Mozilla FAQ - Web APIs
but mixing parsing with xslt is brittle and we rather not support d-o-e than either crash or be even slower.
XSLTProcessor - Web APIs
properties non-web-exposed properties the following properties are [chromeonly] and not exposed to web content: [chromeonly] attribute unsigned long xsltprocessor.flags flags that tweak the behavior of the processor.
msGetRegionContent - Web APIs
the msgetregioncontent returns an array of range instances corresponding to the content from the region flow that is positioned in the region.
Web APIs
WebAPI
below is a list of all the apis and interfaces (object types) that you may be able to use while developing your web app or site.
ARIA guides - Accessibility
a few guidelines to follow that ensure better accessibility, like using drag and drop for placement of the widgets.
Using the aria-activedescendant attribute - Accessibility
the information provided below is one of those opinions and therefore not normative.
Using the aria-hidden attribute - Accessibility
examples in the example below, the paragraph is not exposed to the accessibility api (e.g.
Using the aria-label attribute - Accessibility
examples example 1: multiple labels in the example below, a button is styled to look like a typical "close" button, with an x in the middle.
Using the aria-orientation attribute - Accessibility
examples example 1: the snippet below shows a simple slider that is oriented vertically.
Using the aria-relevant attribute - Accessibility
values a space-delimited list of one or more of the following values: additions element nodes added to the accessibility tree within the live region; should be considered relevant.
Using the aria-valuenow attribute - Accessibility
examples example 1: the snippet below shows a simple slider with a current value of 4.
Using the aria-valuetext attribute - Accessibility
examples example 1: the snippet below shows a simple slider for selecting a day of the week.
Using the article role - Accessibility
assistive technologies may provide a feature allowing the user to navigate the hierarchy of any nested article elements.
ARIA: tabpanel role - Accessibility
then post full details in best practices section below.
ARIA: article role - Accessibility
it is the only role allowed as a direct child of an element with the feed role.
ARIA: grid role - Accessibility
if cells, rows, or columns can be selected, the following key combination are commonly used: key combination action ctrl + space select the column that contains the focus.
ARIA: List role - Accessibility
for example, our above example should be rewritten as follows: <ul> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ul> or use an ordered list if the order of the list items matters: <ol> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ol> note: the aria list/listitem roles don't distinguish between ordered and unordered lists.
ARIA: Listitem role - Accessibility
for example, our above example should be rewritten as follows: <ul> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ul> or use an ordered list if the order of the list items matters: <ol> <li>list item 1</li> <li>list item 2</li> <li>list item 3</li> </ol> note: the aria list/listitem roles don't distinguish between ordered and unordered lists.
ARIA: img role - Accessibility
for example, take the following code: <div role="img" aria-label="that cat is so funny"> <p> &#x1f408; &#x1f602; </p> </div> &#x1f408; &#x1f602; are entity references for emojis read out as "cat" and "face with tears of joy", but this doesn't necessarily make sense — the implied meaning is possibly more like "that cat is so funny", so we include that in an aria-label along with role="img".
ARIA: row role - Accessibility
if the interaction provides for the selection state of individual cells, if left to right and top to botton navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead.
ARIA: tab role - Accessibility
delete when allowed removes the currently selected tab from the tab list.
ARIA: heading role - Accessibility
examples the following shows a typical page structure.
Forms - Accessibility
the following pages provide various techniques for improving the accessibility of web forms: basic form hints: adding hints and descriptions for invalid or required fields alerts: using alerts to provide client-side validation error messages multi-part labels: enabling complex form labels with a control inside each label see also the yahoo!
ARIA - Accessibility
videos following talks are a great way to understand aria: aria, accessibility apis and coding like you give a damn!
Accessibility FAQ - Accessibility
for interface design with xul, follow the accessibile xul authoring guidelines (archive.org).
HTML To MSAA - Accessibility
remarks the table below shows how gecko maps html elements to msaa.
Robust - Accessibility
this can generally be achieved by following web standards and testing rigorously.
-moz-image-region - CSS: Cascading Style Sheets
this allows elements to use different pieces of the same image to improve performance.
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
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.
-moz-outline-radius - CSS: Cascading Style Sheets
/* 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.
-webkit-text-security - CSS: Cascading Style Sheets
examples obscuring a text input try typing in the field below.
-webkit-text-stroke - CSS: Cascading Style Sheets
/* width and color values */ -webkit-text-stroke: 4px navy; text-stroke: 4px navy; /* global values */ -webkit-text-stroke: inherit; -webkit-text-stroke: initial; -webkit-text-stroke: unset; text-stroke: inherit; text-stroke: initial; text-stroke: unset; constituent properties this property is a shorthand for the following css properties: -webkit-stroke-color -webkit-stroke-width syntax values <length> the width of the stroke.
-webkit-touch-callout - CSS: Cascading Style Sheets
this property allows disabling that behavior.
:-moz-last-node - CSS: Cascading Style Sheets
syntax :-moz-last-node examples css span:-moz-last-node { background-color: lime; } html <p> <span>this does not match.</span> <span>this matches!</span> </p> <p> <span>this doesn't match because it's followed by text.</span> blahblah.
:-moz-locale-dir(ltr) - CSS: Cascading Style Sheets
(this can vary from window to window, and even from tab to tab.) it also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics.
:-moz-locale-dir(rtl) - CSS: Cascading Style Sheets
(this can vary from window to window, and even from tab to tab.) it also allows extensions to work even when they don't support the user's default locale, since they can support both left-to-right and right-to-left layouts regardless of locale specifics.
:-moz-only-whitespace - CSS: Cascading Style Sheets
examples html <div> </div> css :root { overflow: hidden; max-width: 100vw; max-height: 100vh; } div { background-color: #ccc; box-sizing: border-box; height: 100vh; min-height: 16px; min-height: 1rem; } div { border: 4px solid red; } :-moz-only-whitespace { border-color: lime; } result specifications briefly defined as :blank in selectors level 4, but then the functionality was merged into :empty and :blank redefined...
:-moz-suppressed - CSS: Cascading Style Sheets
syntax :-moz-suppressed examples styling elements that have been blocked :-moz-suppressed { background: yellow; padding: 8px; } specifications not part of any standard.
:-moz-ui-valid - CSS: Cascading Style Sheets
this pseudo-class is applied according to the following rules: if the control does not have focus, and the value is valid, apply this pseudo-class.
:-moz-window-inactive - CSS: Cascading Style Sheets
html <div id="mybox"> <p>this is a box!</p> </div> css #mybox { background: linear-gradient(to bottom, yellow, cyan); width: 200px; height: 200px; } #mybox:-moz-window-inactive { background: cyan; } result the result of this code is shown below.
::-webkit-file-upload-button - CSS: Cascading Style Sheets
syntax selector::-webkit-file-upload-button examples html <form> <label for="fileupload">upload file</label><br> <input type="file" id="fileupload"> </form> css input, label { display: block; } input[type=file]::-webkit-file-upload-button { border: 1px solid grey; background: #fffaaa; } below is the example for you to try.
::-webkit-meter-optimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-optimum-value css pseudo-element styles the <meter> element when its value is inside the low-high range.
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
the ::-webkit-meter-suboptimum-value pseudo-element gives a yellow color to the <meter> element when the value attribute falls outside of the low-high range.
::-webkit-progress-bar - CSS: Cascading Style Sheets
normally it's only visible as the unfilled portion of the bar, since by default it's rendered below the ::-webkit-progress-value pseudo-element.
::-webkit-search-results-button - CSS: Cascading Style Sheets
the ::-webkit-search-results-button css pseudo-element represents a button (the "search results button") at the left edge of an <input> of type="search" which when clicked displays a menu which allows the user to choose from previous recent search queries.
::after (:after) - CSS: Cascading Style Sheets
WebCSS::after
working draft allows animations on properties defined on pseudo-elements.
::grammar-error - CSS: Cascading Style Sheets
allowable properties only a small subset of css properties can be used in a rule with ::grammar-error in its selector: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow syntax ::grammar-error examples simple document grammar check in this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown.
::marker - CSS: Cascading Style Sheets
WebCSS::marker
::marker { color: blue; font-size: 1.2em; } allowable properties only certain css properties can be used in a rule with ::marker as a selector: all font properties the white-space property color text-combine-upright, unicode-bidi and direction properties the content property all animation and transition properties the specification states that additional css properties may be supported in future.
::placeholder - CSS: Cascading Style Sheets
it is important to ensure that the contrast ratio between the color of the placeholder text and the background of the input is high enough that people experiencing 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.
::spelling-error - CSS: Cascading Style Sheets
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.
:active - CSS: Cascading Style Sheets
WebCSS:active
</p> css a:link { color: blue; } /* unvisited links */ a:visited { color: purple; } /* visited links */ a:hover { background: yellow; } /* hovered links */ a:active { color: red; } /* active links */ p:active { background: #eee; } /* active paragraphs */ result active form elements html <form> <label for="my-button">my button: </label> <button id="my-button" type="button">try clicking me or my label!</button> </form> css form :active { color: red; } form button { background: white; } result spe...
:dir() - CSS: Cascading Style Sheets
WebCSS:dir
formal syntax :dir( ltr | rtl ) examples html <div dir="rtl"> <span>test1</span> <div dir="ltr">test2 <div dir="auto">עִבְרִית</div> </div> </div> css :dir(ltr) { background-color: yellow; } :dir(rtl) { background-color: powderblue; } result specifications specification status comment html living standardthe definition of ':dir(ltr)' in that specification.
:enabled - CSS: Cascading Style Sheets
WebCSS:enabled
/* selects any enabled <input> */ input:enabled { color: blue; } syntax :enabled examples the following example makes the color of text and button <input>s green when enabled, and gray when disabled.
:focus-visible - CSS: Cascading Style Sheets
accessibility concerns low vision make sure the visual focus indicator can be seen by people with low vision.
:focus - CSS: Cascading Style Sheets
WebCSS:focus
syntax :focus examples html <input class="red-input" value="i'll be red when focused."><br> <input class="blue-input" value="i'll be blue when focused."> css .red-input:focus { background: yellow; color: red; } .blue-input:focus { background: yellow; color: blue; } result accessibility concerns make sure the visual focus indicator can be seen by people with low vision.
:fullscreen - CSS: Cascading Style Sheets
#fs-toggle:not(:fullscreen) { background-color: #afa; } when the document is in full-screen mode, the following css applies instead, setting the background color to a pale shade of red.
:has() - CSS: Cascading Style Sheets
WebCSS:has
examples matching <a> elements that directly contain an <img> the following selector matches only <a> elements that directly contain an <img> child: a:has(> img) matching <h1> elements that are followed by a <p> the following selector matches <h1> elements only if they have a <p> element directly following them: h1:has(+ p) specifications specification status comment selectors level 4the definition of ':has()' in that specification.
:host() - CSS: Cascading Style Sheets
WebCSS:host()
'='<attr-modifier> = i | s examples selectively styling shadow hosts the following snippets are taken from our host-selectors example (see it live also).
:hover - CSS: Cascading Style Sheets
WebCSS:hover
allows :hover to be applied to any pseudo-element.
:invalid - CSS: Cascading Style Sheets
WebCSS:invalid
however, it does apply a style (a red "glow" using the box-shadow property) to the :-moz-ui-invalid pseudo-class, which applies in a subset of cases for :invalid.
:not() - CSS: Cascading Style Sheets
WebCSS:not
working draft extends its argument to allow some non-simple selectors.
:nth-child() - CSS: Cascading Style Sheets
:nth-child(n+7) represents the seventh and all following elements: 7 [=0+7], 8 [=1+7], 9 [=2+7], etc.
:only-child - CSS: Cascading Style Sheets
this is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.
:root - CSS: Cascading Style Sheets
WebCSS:root
/* selects the root element of the document: <html> in the case of html */ :root { background: yellow; } syntax :root examples declaring global css variables :root can be useful for declaring global css variables: :root { --main-color: hotpink; --pane-padding: 5px 42px; } specifications specification status comment selectors level 4the definition of ':root' in that specification.
:target - CSS: Cascading Style Sheets
WebCSS:target
/* selects an element with an id matching the current url's fragment */ :target { border: 2px solid black; } for example, the following url has a fragment (denoted by the # sign) that points to an element called section2: http://www.example.com/index.html#section2 the following element would be selected by a :target selector when the current url is equal to the above: <section id="section2">example</section> syntax :target examples a table of contents the :target pseudo-class can be used to highlight the portion of a page that has been linked to from a table of contents.
fallback - CSS: Cascading Style Sheets
syntax /* keyword values */ fallback: lower-alpha; fallback: custom-gangnam-style; description if the specified fallback style is also unable to construct a representation, then its fallback style will be used.
suffix - CSS: Cascading Style Sheets
" (full stop followed by a space)computed valueas specified formal syntax <symbol>where <symbol> = <string> | <image> | <custom-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>?
symbols - CSS: Cascading Style Sheets
this must be one of the following data types: <string> <image> (note: this value is "at risk" and may be removed from the specification.
@document - CSS: Cascading Style Sheets
WebCSS@document
*") { /* css rules here apply to: - the page "http://www.w3.org/" - any page whose url begins with "http://www.w3.org/style/" - any page whose url's host is "mozilla.org" or ends with ".mozilla.org" - any standalone video - any page whose url starts with "https:" */ /* make the above-mentioned pages really ugly */ body { color: purple; background: yellow; } } specifications initially in css conditional rules module level 3, @document has been postponed to level 4.
font-display - CSS: Cascading Style Sheets
the timeline is divided into the three periods below which dictate the rendering behavior of any elements using the font face.
font-family - CSS: Cascading Style Sheets
the font-family css descriptor allows authors to specify the font family for the font specified in an @font-face rule.
src - CSS: Cascading Style Sheets
WebCSS@font-facesrc
specifies an external reference consisting of a <url>, followed by an optional hint using the format() function to describe the format of the font resource referenced by that url.
unicode-range - CSS: Cascading Style Sheets
description the purpose of this descriptor is to allow the font resources to be segmented so that a browser only needs to download the font resource needed for the text content of a particular page.
any-pointer - CSS: Cascading Style Sheets
syntax the any-pointer feature is specified as a keyword value chosen from the list below.
aspect-ratio - CSS: Cascading Style Sheets
examples the example below is contained in an <iframe>, which creates its own viewport.
color-gamut - CSS: Cascading Style Sheets
syntax the color-gamut feature is specified as a keyword value chosen from the list below.
color - CSS: Cascading Style Sheets
WebCSS@mediacolor
examples html <p>this text should be black on non-color devices, red on devices with a low number of colors, and greenish on devices with a high number of colors.</p> css p { color: black; } /* any color device */ @media (color) { p { color: red; } } /* any color device with at least 8 bits per color component */ @media (min-color: 8) { p { color: #24ba13; } } result specifications specification status comment media queries level ...
display-mode - CSS: Cascading Style Sheets
syntax the display-mode feature is specified as a keyword value chosen from the list below.
height - CSS: Cascading Style Sheets
WebCSS@mediaheight
examples html <div>watch this element as you resize your viewport's height.</div> css /* exact height */ @media (height: 360px) { div { color: red; } } /* minimum height */ @media (min-height: 25rem) { div { background: yellow; } } /* maximum height */ @media (max-height: 40rem) { div { border: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'height' in that specification.
light-level - CSS: Cascading Style Sheets
examples this code will likely not work on any devices (device compatibility is low).
pointer - CSS: Cascading Style Sheets
WebCSS@mediapointer
syntax the pointer feature is specified as a keyword value chosen from the list below.
prefers-color-scheme - CSS: Cascading Style Sheets
examples the elements below have an initial color theme.
prefers-reduced-data - CSS: Cascading Style Sheets
examples note: no browser currently implements this feature so the following example will not work.
prefers-reduced-transparency - CSS: Cascading Style Sheets
examples note: no browser currently implements this feature so the following example will not work.
resolution - CSS: Cascading Style Sheets
WebCSS@mediaresolution
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.
scan - CSS: Cascading Style Sheets
WebCSS@mediascan
syntax the scan feature is specified as a single keyword value chosen from the list below.
scripting - CSS: Cascading Style Sheets
WebCSS@mediascripting
syntax the scripting feature is specified as a keyword value chosen from the list below.
width - CSS: Cascading Style Sheets
WebCSS@mediawidth
examples html <div>watch this element as you resize your viewport's width.</div> css /* exact width */ @media (width: 360px) { div { color: red; } } /* minimum width */ @media (min-width: 35rem) { div { background: yellow; } } /* maximum width */ @media (max-width: 50rem) { div { border: 2px solid blue; } } result specifications specification status comment media queries level 4the definition of 'width' in that specification.
min-zoom - CSS: Cascading Style Sheets
syntax /* keyword value */ min-zoom: auto; /* <number> values */ min-zoom: 0.8; min-zoom: 2.0; /* <percentage> value */ min-zoom: 150%; values auto the user agent will set the document's lower zoom factor limit.
user-zoom - CSS: Cascading Style Sheets
accessibility concerns disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content.
Adjacent sibling combinator - CSS: Cascading Style Sheets
the adjacent sibling combinator (+) separates two selectors and matches the second element only if it immediately follows the first element, and both are children of the same parent element.
Alternative style sheets - CSS: Cascading Style Sheets
details any stylesheet in a document falls into one of the following categories: persistent (no rel="alternate", no title=""): always applies to the document.
At-rules - CSS: Cascading Style Sheets
WebCSSAt-rule
they begin with an at sign, '@' (u+0040 commercial at), followed by an identifier and includes everything up to the next semicolon, ';' (u+003b semicolon), or the next css block, whichever comes first.
Detecting CSS animation support - CSS: Cascading Style Sheets
l'.split(' '), pfx = '', elem = document.createelement('div'); if( elem.style.animationname !== undefined ) { animation = true; } if( animation === false ) { for( var i = 0; i < domprefixes.length; i++ ) { if( elem.style[ domprefixes[i] + 'animationname' ] !== undefined ) { pfx = domprefixes[ i ]; animationstring = pfx + 'animation'; keyframeprefix = '-' + pfx.tolowercase() + '-'; animation = true; break; } } } for starters we define a few variables.
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.
CSS Basic User Interface - CSS: Cascading Style Sheets
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.
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
in the example below, a container with a single item inside has been turned into a flex container for the purpose of being able to use the alignment properties.
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
the properties which apply to multi-column layouts are detailed below.
Mastering margin collapsing - CSS: Cascading Style Sheets
<p>this paragraph has a <code>.4rem</code> margin between it and the text above.</p> <p>my bottom margin collapses with my parent, yielding a bottom margin of <code>2rem</code>.</p> </div> <p>i am <code>2rem</code> below the element above.</p> css div { margin: 2rem 0; background: lavender; } p { margin: .4rem 0 1.2rem 0; background: yellow; } result specifications specification status comment css level 2 (revision 1)the definition of 'margin collapsing' in that specification.
CSS Basic Box Model - CSS: Cascading Style Sheets
reference properties properties controlling the flow of content in a box overflow overflow-x overflow-y properties controlling the size of a box height width max-height max-width min-height min-width properties controlling the margins of a box margin margin-bottom margin-left margin-right margin-top margin-trim properties controlling the paddings of a box padding padding-bottom padding-left padding-right padding-top other properties visibility guides introduction to the css box model explains one of the fundamental concept of css: the b...
CSS Conditional Rules - CSS: Cascading Style Sheets
css conditional rules is a css module that allows to define a set of rules that will only apply based on the capabilities of the processor or the document the style sheet is being applied to.
Consistent list indentation - CSS: Cascading Style Sheets
if you want to reproduce the default display in netscape 6.x, you write: ul {margin-left: 0; padding-left: 40px;} if you're more interested in following the internet explorer/opera model, then: ul {margin-left: 40px; padding-left: 0;} of course, you can fill in your own preferred values.
CSS Namespaces - CSS: Cascading Style Sheets
css namespaces is a css module that allows authors to specify xml namespaces in css.
Using z-index - CSS: Cascading Style Sheets
in the following example, the layers' stacking order is rearranged using z-index.
Stacking with floated blocks - CSS: Cascading Style Sheets
floating blocks are placed between non-positioned blocks and positioned blocks: the background and borders of the root element descendant non-positioned blocks, in order of appearance in the html floating blocks descendant positioned elements, in order of appearance in the html actually, as you can see in the example below, the background and border of the non-positioned block (div #4) is completely unaffected by floating blocks, but the content is affected.
Stacking context example 1 - CSS: Cascading Style Sheets
in terms of stacking contexts, div #1 and div #3 are simply assimilated into the root element, and the resulting hierarchy is the following: root stacking context div #2 (z-index 1) div #4 (z-index 2) note: div #1 and div #3 are not translucent.
Stacking context example 3 - CSS: Cascading Style Sheets
so a third-level menu will be stacked under the following second-level menus, because all second-level menus share the same z-index value and the default stacking rules apply.
CSS Scrollbars - CSS: Cascading Style Sheets
.scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple green; scrollbar-width: thin; } html <div class="scroller"> veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
Using the :target pseudo-class in selectors - CSS: Cascading Style Sheets
thus, to add a border to the #example fragment, we would write: #example:target { border: 1px solid black; } targeting all elements if the intent is to create a "blanket" style that will apply to all targeted elements, then the universal selector comes in handy: :target { color: red; } example in the following example, there are five links that point to elements in the same document.
CSS Text - CSS: Cascading Style Sheets
WebCSSCSS Text
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 Decoration - CSS: Cascading Style Sheets
be careful when removing the text decoration on anchors since users often depend on the underline to denote hyperlinks.</p> <p class="underover">this text has lines above <em>and</em> below it.</p> <p class="thick">this text has a really thick purple underline in supporting browsers.</p> <p class="blink">this text might blink for you, depending on the browser you use.</p> specifications specification status comment css text decoration module level 4 working draft css text decoration module level 3 candidate recommendation ...
CSS data types - CSS: Cascading Style Sheets
WebCSSCSS Types
index the data types defined by the set of css specifications include the following: <angle> <angle-percentage> <angular-color-hint> <angular-color-stop> <attr-fallback> <attr-name> <basic-shape> <blend-mode> <calc-product> <calc-sum> <calc-value> <color> <color-stop> <color-stop-angle> <counter-style> <custom-ident> <dimension> <filter-function> <flex> <frequency> <frequency-percentage> <gradient> <ident> <image> <integer> <length> <length-percentage> <number> <number-percentage> <percentage> <pos...
CSS Custom Properties for Cascading Variables - CSS: Cascading Style Sheets
css custom properties for cascading variables is a css module that allows for the creation of custom properties that can be used over and over.
Class selectors - CSS: Cascading Style Sheets
elements with class="spacious" */ .spacious { margin: 2em; } /* all <li> elements with class="spacious" */ li.spacious { margin: 2em; } /* all <li> elements with a class list that includes both "spacious" and "elegant" */ /* for example, class="elegant retro spacious" */ li.spacious.elegant { margin: 2em; } syntax .class_name { style properties } note that this is equivalent to the following attribute selector: [class~=class_name] { style properties } examples css .red { color: #f33; } .yellow-bg { background: #ffa; } .fancy { font-weight: bold; text-shadow: 4px 4px 3px #77f; } html <p class="red">this paragraph has red text.</p> <p class="red yellow-bg">this paragraph has red text and a yellow background.</p> <p class="red fancy">this paragraph has red text and "...
Questions about CSS - CSS: Cascading Style Sheets
WebCSSFAQ
cascading style sheets (css) is a rule-based language allowing developers to define styles to apply to html elements (or other markup structures).
General sibling combinator - CSS: Cascading Style Sheets
the general sibling combinator (~) separates two selectors and matches the second element only if it follows the first element (though not necessarily immediately), and both are children of the same parent element.
ID selectors - CSS: Cascading Style Sheets
/* the element with id="demo" */ #demo { border: red 2px solid; } syntax #id_value { style properties } note that syntactically (but not specificity-wise), this is equivalent to the following attribute selector: [id=id_value] { style properties } examples css #identified { background-color: skyblue; } html <div id="identified">this div has a special id on it!</div> <div>this is just a regular div.</div> result specifications specification status comment selectors level 4the definition of 'id selectors' in that specification.
Card - CSS: Cascading Style Sheets
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.
Column layouts - CSS: Cascading Style Sheets
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.
Cookbook template - CSS: Cascading Style Sheets
recipe change the path to the example below to point to your merged example.
Paged media - CSS: Cascading Style Sheets
it allows you to set page breaks, control printable area, style left and right pages differently, and control breaks inside elements.
Pseudo-elements - CSS: Cascading Style Sheets
index of standard pseudo-elements ::after (:after) ::backdrop ::before (:before) ::cue ::cue-region ::first-letter (:first-letter) ::first-line (:first-line) ::grammar-error ::marker ::part() ::placeholder ::selection ::slotted() ::spelling-error browser lowest version support of internet explorer 8.0 :pseudo-element 9.0 :pseudo-element ::pseudo-element firefox (gecko) 1.0 (1.0) :pseudo-element 1.0 (1.5) :pseudo-element ::pseudo-element opera 4.0 :pseudo-element 7.0 :pseudo-element ::pseudo-element safari (webkit) 1.0 (85) :pseudo-element ::pseudo-eleme...
Selector list - CSS: Cascading Style Sheets
#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-unsupported, h3 { font-family: sans-serif } this is because a single unsupported selector in a selector list invalidates the whole rule.
Universal selectors - CSS: Cascading Style Sheets
recommendation defines behavior regarding namespaces and adds hint that omitting the selector is allowed within pseudo-elements css level 2 (revision 1)the definition of 'universal selector' in that specification.
all - CSS: Cascading Style Sheets
WebCSSall
it also behaves as a block element: the text that follows it is beneath it.
<angle> - CSS: Cascading Style Sheets
WebCSSangle
syntax the <angle> data type consists of a <number> followed by one of the units listed below.
aspect-ratio - CSS: Cascading Style Sheets
this property is not yet implemented in browsers, however some browsers are implementing this internally in order to provide the aspect ratio mapping described below.
backface-visibility - CSS: Cascading Style Sheets
(this property has no effect on 2d transforms, which have no perspective.) syntax /* keyword values */ backface-visibility: visible; backface-visibility: hidden; /* global values */ backface-visibility: inherit; backface-visibility: initial; backface-visibility: unset; the backface-visibility property is specified as one of the keywords listed below.
background-clip - CSS: Cascading Style Sheets
rder.</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 status comment ...
background-color - CSS: Cascading Style Sheets
accessibility 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.
background-origin - CSS: Cascading Style Sheets
syntax /* keyword values */ background-origin: border-box; background-origin: padding-box; background-origin: content-box; /* global values */ background-origin: inherit; background-origin: initial; background-origin: unset; the background-origin property is specified as one of the keyword values listed below.
block-size - CSS: Cascading Style Sheets
formal definition initial valueautoapplies tosame as width and heightinheritednopercentagesblock-size of containing blockcomputed valuesame as width and heightanimation typea length, percentage or calc(); formal syntax <'width'> examples block size with vertical text html <p class="exampletext">example text</p> css .exampletext { writing-mode: vertical-rl; background-color: yellow; block-size: 200px; } result specifications specification status comment css logical properties and values level 1the definition of 'block-size' in that specification.
border-block-end-style - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples dashed border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 5px solid blue; border-block-end-style: dashed; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-end-style' in that specification.
border-block-end-width - CSS: Cascading Style Sheets
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 <'border-top-width'> examples border width with veritcal text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 1px solid blue; border-block-end-width: 5px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-end-width' in that specification.
border-block-start-color - CSS: Cascading Style Sheets
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> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 10px solid blue; border-block-start-color: red; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-start-color' in that specification.
border-block-start-style - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples dashed border wtih vertical text 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-block-start-style: dashed; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-start-style' in that specification.
border-block-start-width - CSS: Cascading Style Sheets
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 <'border-top-width'> examples border width with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 1px solid blue; border-block-start-width: 5px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-start-width' in that specification.
border-block-style - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples dashed border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 5px solid blue; border-block-style: dashed; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-style' in that specification.
border-block-width - CSS: Cascading Style Sheets
formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typediscrete formal syntax <'border-top-width'> examples border width with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 1px solid blue; border-block-width: 5px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-block-width' in that specification.
border-bottom-left-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-bottom-right-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-bottom - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-bottom-color border-bottom-style border-bottom-width syntax border-bottom: 1px; border-bottom: 2px dotted; border-bottom: medium dashed blue; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
border-color - CSS: Cascading Style Sheets
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 */ border-color: red #f015ca; /* top | vertical | bottom */ border-color: red rgb(240,30,50,.7) green; /* top | right | bottom | left */ border-color: red yellow green blue; /* global values */ border-color: inherit; bord...
border-end-end-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-end-start-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-image-outset - CSS: Cascading Style Sheets
the parts of the border image that are rendered outside the element's border box with border-image-outset do not trigger overflow scrollbars and don't capture mouse events.
border-image-repeat - CSS: Cascading Style Sheets
/ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat: round; border-image-repeat: space; /* vertical | horizontal */ border-image-repeat: round stretch; /* global values */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: unset; the border-image-repeat property may be specified using one or two values chosen from the list of values below.
border-image-source - CSS: Cascading Style Sheets
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.
border-inline-end-color - CSS: Cascading Style Sheets
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.
border-inline-end-style - CSS: Cascading Style Sheets
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.
border-inline-end-width - CSS: Cascading Style Sheets
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 <'border-top-width'> examples applying a border with vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 1px solid blue; border-inline-end-width: 5px; } results specifications specification status comment css logical properties and values level 1the definition of 'border-inline-end-width' in that specification.
border-inline-start-color - CSS: Cascading Style Sheets
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.
border-inline-start-style - CSS: Cascading Style Sheets
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.
border-inline-start-width - CSS: Cascading Style Sheets
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 <'border-top-width'> 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: 1px solid blue; border-inline-start-width: 5px; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-start-width' in that specification.
border-inline-style - CSS: Cascading Style Sheets
formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <'border-top-style'> examples html content <div> <p class="exampletext">example text</p> </div> css content div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 5px solid blue; border-inline-style: dashed; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-style' in that specification.
border-inline-width - CSS: Cascading Style Sheets
formal definition initial valuemediumapplies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueabsolute length; 0 if the border style is none or hiddenanimation typediscrete formal syntax <'border-top-width'> examples html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; border: 1px solid blue; border-inline-width: 5px 10px; } specifications specification status comment css logical properties and values level 1the definition of 'border-inline-width' in that specification.
border-left - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-left-color border-left-style border-left-width syntax border-left: 1px; border-left: 2px dotted; border-left: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
border-right - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-right-color border-right-style border-right-width syntax border-right: 1px; border-right: 2px dotted; border-right: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
border-start-end-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-start-start-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-top-left-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-top-right-radius - CSS: Cascading Style Sheets
as absolute length it can be expressed in any unit allowed by the css <length> data type.
border-top - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: border-top-color border-top-style border-top-width syntax border-top: 1px; border-top: 2px dotted; border-top: medium dashed green; the three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
box-align - CSS: Cascading Style Sheets
WebCSSbox-align
syntax the box-align property is specified as one of the keyword values listed below.
box-direction - CSS: Cascading Style Sheets
/* keyword values */ box-direction: normal; box-direction: reverse; /* global values */ box-direction: inherit; box-direction: initial; box-direction: unset; syntax the box-direction property is specified as one of the keyword values listed below.
box-orient - CSS: Cascading Style Sheets
/* 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.
box-pack - CSS: Cascading Style Sheets
WebCSSbox-pack
syntax the box-pack property is specified as one of the keyword values listed below.
column-fill - CSS: Cascading Style Sheets
syntax /* keyword values */ column-fill: auto; column-fill: balance; column-fill: balance-all; /* global values */ column-fill: inherit; column-fill: initial; column-fill: unset; the column-fill property is specified as one of the keyword values listed below.
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
syntax /* keyword value */ column-gap: normal; /* <length> values */ column-gap: 3px; column-gap: 2.5em; /* <percentage> value */ column-gap: 3%; /* global values */ column-gap: inherit; column-gap: initial; column-gap: unset; the column-gap property is specified as one of the values listed below.
column-rule - CSS: Cascading Style Sheets
syntax column-rule: dotted; column-rule: solid 8px; column-rule: solid blue; column-rule: thick inset blue; /* global values */ column-rule: inherit; column-rule: initial; column-rule: unset; the column-rule property is specified as one, two, or three of the values listed below, in any order.
column-width - CSS: Cascading Style Sheets
syntax /* keyword value */ column-width: auto; /* <length> values */ column-width: 60px; column-width: 15.5em; column-width: 3.3vw; /* global values */ column-width: inherit; column-width: initial; column-width: unset; the column-width property is specified as one of the values listed below.
counter-increment - CSS: Cascading Style Sheets
my-counter -1; /* increment "counter1" by 1, and decrement "counter2" by 4 */ counter-increment: counter1 counter2 -4; /* do not increment/decrement anything: used to override less specific rules */ counter-increment: none; /* global values */ counter-increment: inherit; counter-increment: initial; counter-increment: unset; the counter-increment property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>.
counter-reset - CSS: Cascading Style Sheets
er; /* set "my-counter" to -1 */ counter-reset: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-reset: counter1 1 counter2 4; /* cancel any reset that could have been set in less specific rules */ counter-reset: none; /* global values */ counter-reset: inherit; counter-reset: initial; counter-reset: unset; the counter-reset property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>.
counter-set - CSS: Cascading Style Sheets
et: my-counter; /* set "my-counter" to -1 */ counter-set: my-counter -1; /* set "counter1" to 1, and "counter2" to 4 */ counter-set: counter1 1 counter2 4; /* cancel any counter that could have been set in less specific rules */ counter-set: none; /* global values */ counter-set: inherit; counter-set: initial; counter-set: unset; the counter-set property is specified as either one of the following: a <custom-ident> naming the counter, followed optionally by an <integer>.
counter() - CSS: Cascading Style Sheets
WebCSScounter
| symbols()where <counter-style-name> = <custom-ident> examples default value compared to upper roman html <ol> <li></li> <li></li> <li></li> </ol> css ol { counter-reset: listcounter; } li { counter-increment: listcounter; } li::after { content: "[" counter(listcounter) "] == [" counter(listcounter, upper-roman) "]"; } result decimal-leading-zero compared to lower-alpha html <ol> <li></li> <li></li> <li></li> </ol> css ol { counter-reset: count; } li { counter-increment: count; } li::after { content: "[" counter(count, decimal-leading-zero) "] == [" counter(count, lower-alpha) "]"; } result specifications specification status comment css lists module level 3the definition of 'css counters' i...
<dimension> - CSS: Cascading Style Sheets
WebCSSdimension
syntax the syntax of <dimension> is a <number> immediately followed by a unit which is an identifier.
<display-box> - CSS: Cascading Style Sheets
see the accessibility concerns section below for more details.
<display-internal> - CSS: Cascading Style Sheets
examples css tables example the following example demonstrates laying out a simple form using css table layout.
empty-cells - CSS: Cascading Style Sheets
syntax /* keyword values */ empty-cells: show; empty-cells: hide; /* global values */ empty-cells: inherit; empty-cells: initial; empty-cells: unset; the empty-cells property is specified as one of the keyword values listed below.
sepia() - CSS: Cascading Style Sheets
the sepia() css function converts the input image to sepia, giving it a warmer, more yellow/brown appearance.
flex-basis - CSS: Cascading Style Sheets
formal definition initial valueautoapplies toflex items, including in-flow pseudo-elementsinheritednopercentagesrefer to the flex container's inner main sizecomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typea length, percentage or calc(); formal syntax content | <'width'> examples setting flex item initial sizes html <ul class="container"> <li class="flex flex1">1: flex-basis test</li> <li class="flex flex2">2: ...
<flex> - CSS: Cascading Style Sheets
syntax the <flex> data type is specified as a <number> followed by the unit fr.
font-kerning - CSS: Cascading Style Sheets
in the image below, for instance, the examples on the left do not use kerning, while the ones on the right do: syntax the font-kerning property is specified as one of the keyword values listed below.
font-language-override - CSS: Cascading Style Sheets
for instance, if a typeface doesn't have proper rules for the azeri language, you can force the font to use turkish glyphs, which follow similar rules.
font-synthesis - CSS: Cascading Style Sheets
syntax this property can take any one of the following forms: the keyword value none.
font-variant-ligatures - CSS: Cascading Style Sheets
* <historical-lig-values> */ font-variant-ligatures: contextual; /* <contextual-alt-values> */ font-variant-ligatures: no-contextual; /* <contextual-alt-values> */ /* global values */ font-variant-ligatures: inherit; font-variant-ligatures: initial; font-variant-ligatures: unset; the font-variant-ligatures property is specified as one of the keyword values listed below.
font-variant-position - CSS: Cascading Style Sheets
syntax the font-variant-position property is specified as one of the keyword values listed below.
gap (grid-gap) - CSS: Cascading Style Sheets
WebCSSgap
tage> value */ gap: 16%; gap: 100%; /* two <length> values */ gap: 20px 10px; gap: 1em 0.5em; gap: 3vmin 2vmax; gap: 0.5cm 2mm; /* one or two <percentage> values */ gap: 16% 100%; gap: 21px 82%; /* calc() values */ gap: calc(10% + 20px); gap: calc(20px + 10%) calc(10% - 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'>.
image() - CSS: Cascading Style Sheets
while this can and should be done by including a background-color on every background image, the css image() function allows adding allows only including background colors should an image fail to load, which means you can add a fall back color should a transparent png/gif/webp not load.
Inheritance - CSS: Cascading Style Sheets
notes the inherit keyword allows authors to explicitly specify inheritance.
initial-letter-align - CSS: Cascading Style Sheets
/* keyword values */ initial-letter-align: auto; initial-letter-align: alphabetic; initial-letter-align: hanging; initial-letter-align: ideographic; /* global values */ initial-letter-align: inherit; initial-letter-align: initial; initial-letter-align: unset; syntax one of the keyword values listed below.
inline-size - CSS: Cascading Style Sheets
formal definition initial valueautoapplies tosame as width and heightinheritednopercentagesinline-size of containing blockcomputed valuesame as width and heightanimation typea length, percentage or calc(); formal syntax <'width'> examples setting inline size in pixels html <p class="exampletext">example text</p> css .exampletext { writing-mode: vertical-rl; background-color: yellow; inline-size: 110px; } result specifications specification status comment css logical properties and values level 1the definition of 'inline-size' in that specification.
inset-block-end - CSS: Cascading Style Sheets
ueautoapplies topositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'> examples setting block end offset html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; position: relative; inset-block-end: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-block-end' in that specification.
inset-block-start - CSS: Cascading Style Sheets
autoapplies topositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'> examples setting block start offset html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-block-start: 20px; background-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'inset-block-start' in that specification.
inset-inline-end - CSS: Cascading Style Sheets
lueautoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'> examples setting inline end offset html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; position: relative; inset-inline-end: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline-end' in that specification.
inset-inline-start - CSS: Cascading Style Sheets
autoapplies topositioned elementsinheritednopercentageslogical-width of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'> examples setting inline start offset html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; position: relative; inset-inline-start: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset-inline-start' in that specification.
inset - CSS: Cascading Style Sheets
WebCSSinset
ositioned elementsinheritednopercentageslogical-height of containing blockcomputed valuesame as box offsets: top, right, bottom, left properties except that directions are logicalanimation typea length, percentage or calc(); formal syntax <'top'>{1,4} examples setting offsets for an element html <div> <span class="exampletext">example text</span> </div> css div { background-color: yellow; width: 150px; height: 120px; position: relative; } .exampletext { writing-mode: sideways-rl; position: absolute; inset: 20px 40px 30px 10px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'inset' in that specification.
isolation - CSS: Cascading Style Sheets
WebCSSisolation
syntax /* keyword values */ isolation: auto; isolation: isolate; /* global values */ isolation: inherit; isolation: initial; isolation: unset; the isolation property is specified as one of the keyword values listed below.
left - CSS: Cascading Style Sheets
WebCSSleft
itions itself in relation to it.</p> </div> <div id="example_2"> <pre> position: relative; top: 0; right: 0; </pre> <p>relative position in relation to its siblings.</p> </div> <div id="example_3"> <pre> float: right; position: relative; top: 20px; left: 20px; </pre> <p>relative to its sibling div above, but removed from flow of content.</p> <div id="example_4"> <pre> position: absolute; bottom: 10px; right: 20px; </pre> <p>absolute position inside of a parent with relative position</p> </div> <div id="example_5"> <pre> position: absolute; right: 0; left: 0; top: 200px; </pre> <p>absolute position with both left a...
letter-spacing - CSS: Cascading Style Sheets
unlike a value of 0, this keyword allows the user agent to alter the space between characters in order to justify text.
list-style-position - CSS: Cascading Style Sheets
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 keyword values listed below.
margin-block-end - CSS: Cascading Style Sheets
0applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typea length formal syntax <'margin-left'> examples setting block end margin html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-rl; margin-block-end: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block-end' in that specification.
margin-block-start - CSS: Cascading Style Sheets
pplies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typea length formal syntax <'margin-left'> examples setting block start margin html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-block-start: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-block-start' in that specification.
margin-inline-end - CSS: Cascading Style Sheets
applies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typea length formal syntax <'margin-left'> examples setting inline end margin html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-inline-end: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline-end' in that specification.
margin-inline-start - CSS: Cascading Style Sheets
plies tosame as margininheritednopercentagesdepends on layout modelcomputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, autoanimation typea length formal syntax <'margin-left'> examples setting inline start margin html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; margin-inline-start: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'margin-inline-start' in that specification.
mask-border-repeat - CSS: Cascading Style Sheets
d value */ mask-border-repeat: stretch; mask-border-repeat: repeat; mask-border-repeat: round; mask-border-repeat: space; /* vertical | horizontal */ mask-border-repeat: round stretch; /* global values */ mask-border-repeat: inherit; mask-border-repeat: initial; mask-border-repeat: unset; the mask-border-repeat property may be specified using one or two values chosen from the list of values below.
mask-border-source - CSS: Cascading Style Sheets
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.
mask-border-width - CSS: Cascading Style Sheets
orizontal */ mask-border-width: 2em 3em; /* top | horizontal | bottom */ mask-border-width: 5% 15% 10%; /* top | right | bottom | left */ mask-border-width: 5% 2em 10% auto; /* global values */ mask-border-width: inherit; mask-border-width: initial; mask-border-width: unset; the mask-border-width property may be specified using one, two, three, or four values chosen from the list of values below.
mask-border - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: mask-border-mode mask-border-outset mask-border-repeat mask-border-slice mask-border-source mask-border-width syntax /* source | slice */ mask-border: url('border-mask.png') 25; /* source | slice | repeat */ mask-border: url('border-mask.png') 25 space; /* source | slice | width */ mask-border: url('border-mask.png') 25 / 35px; /* source | slice | width | outset | repeat | mode */ mask-border: url('border-mask.png') 25 / 35px / 12px space alpha; values <'mask-border-source'> the source image.
mask-clip - CSS: Cascading Style Sheets
WebCSSmask-clip
s */ mask-clip: no-clip; /* non-standard keyword values */ -webkit-mask-clip: border; -webkit-mask-clip: padding; -webkit-mask-clip: content; -webkit-mask-clip: text; /* multiple values */ mask-clip: padding-box, no-clip; mask-clip: view-box, fill-box, border-box; /* global values */ mask-clip: inherit; mask-clip: initial; mask-clip: unset; syntax one or more of the keyword values listed below, separated by commas.
mask-mode - CSS: Cascading Style Sheets
WebCSSmask-mode
/* keyword values */ mask-mode: alpha; mask-mode: luminance; mask-mode: match-source; /* multiple values */ mask-mode: alpha, match-source; /* global values */ mask-mode: inherit; mask-mode: initial; mask-mode: unset; syntax the mask-mode property is specified as one or more of the keyword values listed below, separated by commas.
mask-type - CSS: Cascading Style Sheets
WebCSSmask-type
syntax the mask-type property is specified as one of the keyword values listed below.
max-inline-size - CSS: Cascading Style Sheets
efinition initial value0applies tosame as width and heightinheritednopercentagesinline-size of containing blockcomputed valuesame as max-width and max-heightanimation typea length, percentage or calc(); formal syntax <'max-width'> examples setting max inline size in pixels html <p class="exampletext">example text</p> css .exampletext { writing-mode: vertical-rl; background-color: yellow; block-size: 100%; max-inline-size: 200px; } result specifications specification status comment css logical properties and values level 1the definition of 'max-inline-size' in that specification.
min-block-size - CSS: Cascading Style Sheets
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'> examples setting minimum block size for vertical text html <p class="exampletext">example text</p> css .exampletext { writing-mode: vertical-rl; background-color: yellow; min-block-size: 200px; } result specifications specification status comment css logical properties and values level 1the definition of 'min-block-size' in that specification.
min-inline-size - CSS: Cascading Style Sheets
nitial value0applies tosame as width and heightinheritednopercentagesinline-size of containing blockcomputed valuesame as min-width and min-heightanimation typea length, percentage or calc(); formal syntax <'min-width'> examples setting minimum inline size for vertical text html <p class="exampletext">example text</p> css .exampletext { writing-mode: vertical-rl; background-color: yellow; block-size: 5%; min-inline-size: 200px; } result specifications specification status comment css logical properties and values level 1the definition of 'min-inline-size' in that specification.
min() - CSS: Cascading Style Sheets
WebCSSmin
the min() function can be used anywhere a <length>, <frequency>, <angle>, <time>, <percentage>, <number>, or <integer> is allowed.
mix-blend-mode - CSS: Cascading Style Sheets
l,body { height: 100%; box-sizing: border-box; background: #eee; } .grid { width: 100%; display: flex; font: 1em monospace; } .row { display: flex; flex: 1 auto; flex-direction: row; flex-wrap: wrap; height: auto; } .col { display: flex; flex: 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%)...
object-fit - CSS: Cascading Style Sheets
syntax the object-fit property is specified as a single keyword chosen from the list of values below.
offset - CSS: Cascading Style Sheets
WebCSSoffset
constituent properties this property is a shorthand for the following css properties: offset-anchor offset-distance offset-path offset-position offset-rotate syntax /* offset position */ offset: auto; offset: 10px 30px; offset: none; /* offset path */ offset: ray(45deg closest-side); offset: path('m 100 100 l 300 100 l 200 300 z'); offset: url(arc.svg); /* offset path with distance and/or rotation */ offset: url(circle.svg) 100px; offset: url(circle.svg) 40%; offset: url(circle.svg) 30deg; offset: url(circle.svg) 50px 20deg; /* including offset anchor */ offset: ray(45deg closest-side) / 40px 20px; of...
order - CSS: Cascading Style Sheets
WebCSSorder
this will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader.
orphans - CSS: Cascading Style Sheets
WebCSSorphans
(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.
outline-offset - CSS: Cascading Style Sheets
formal definition initial value0applies toall elementsinheritednocomputed valueas specified, but with relative lengths converted into absolute lengthsanimation typea length formal syntax <length> examples setting outline offset in pixels html <p>gallia est omnis divisa in partes tres.</p> css p { outline: 1px dashed red; outline-offset: 10px; background: yellow; border: 1px solid blue; margin: 15px; } result specifications specification status comment css basic user interface module level 3the definition of 'outline-offset' in that specification.
outline-width - CSS: Cascading Style Sheets
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.
padding-block-end - CSS: Cascading Style Sheets
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> css content div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-block-end: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block-end' in that specification.
padding-block-start - CSS: Cascading Style Sheets
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 div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-block-start: 20px; background-color: #c8c800; } result specifications specification status comment css logical properties and values level 1the definition of 'padding-block-start' in that specification.
padding-inline-end - CSS: Cascading Style Sheets
formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typea length formal syntax <'padding-left'> examples setting inline end padding for vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-inline-end: 20px; background-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'padding-inline-end' in that specification.
padding-inline-start - CSS: Cascading Style Sheets
formal definition initial value0applies toall elementsinheritednopercentageslogical-width of containing blockcomputed valueas <length>animation typea length formal syntax <'padding-left'> examples setting inline start padding for vertical text html <div> <p class="exampletext">example text</p> </div> css div { background-color: yellow; width: 120px; height: 120px; } .exampletext { writing-mode: vertical-lr; padding-inline-start: 20px; background-color: #c8c800; } specifications specification status comment css logical properties and values level 1the definition of 'padding-inline-start' in that specification.
padding - CSS: Cascading Style Sheets
WebCSSpadding
constituent properties this property is a shorthand for the following css properties: padding-bottom padding-left padding-right padding-top syntax /* apply to all four sides */ padding: 1em; /* vertical | horizontal */ padding: 5% 10%; /* top | horizontal | bottom */ padding: 1em 2em 2em; /* top | right | bottom | left */ padding: 5px 1em 0 2em; /* global values */ padding: inherit; padding: initial; padding: unset; the padding property may be spe...
page-break-after - CSS: Cascading Style Sheets
a subset of values should be aliased as follows: page-break-after break-after auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element.
page-break-before - CSS: Cascading Style Sheets
a subset of values should be aliased as follows: page-break-before break-before auto auto left left right right avoid avoid always page formal definition initial valueautoapplies toblock-level elements in the normal flow of the root element.
paint() - CSS: Cascading Style Sheets
WebCSSpaint
<li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> <li>item 16</li> <li>item 17</li> <li>item 18</li> <li>item 19</li> <li>item 20</li> </ul> css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklets/hilite.js'); li { --boxcolor: hsla(55, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 2px); } li:nth-of-type(3n) { --boxcolor: hsla(155, 90%, 60%, 1.0); background-image: paint(hollowhighlights, filled, 3px); } li:nth-of-type(3n+1) { --boxcolor: hsla(255, 90%, 60%, 1.0); background-image: paint(hollowhighlights, stroke, 1px); } we've included a custom property in the selector block defining a boxcolor.
<percentage> - CSS: Cascading Style Sheets
syntax the <percentage> data type consists of a <number> followed by the percentage sign (%).
perspective - CSS: Cascading Style Sheets
html the html below creates four copies of the same box, with the perspective set at different values.
radial-gradient() - CSS: Cascading Style Sheets
<linear-color-stop> a color-stop's <color> value, followed by an one or two optional stop positions (either a <percentage> or a <length> along the gradient's axis).
repeating-radial-gradient() - CSS: Cascading Style Sheets
<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).
Resolved value - CSS: Cascading Style Sheets
see the specification link below for more per-property details.
revert - CSS: Cascading Style Sheets
WebCSSrevert
so in the below example, we set custom font-weight in a global stylesheet, but then try to unset and revert.
rotate - CSS: Cascading Style Sheets
WebCSSrotate
the rotate css property allows you to specify rotation transforms individually and independently of the transform property.
scale - CSS: Cascading Style Sheets
WebCSSscale
the scale css property allows you to specify scale transforms individually and independently of the transform property.
scroll-margin-block - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: scroll-margin-block-end scroll-margin-block-start syntax /* <length> values */ scroll-margin-block: 10px; scroll-margin-block: 1em .5em ; /* global values */ scroll-margin-block: inherit; scroll-margin-block: initial; scroll-margin-block: unset; values <length> an outset from the corresponding edge of the scroll container.
scroll-padding-block-end - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-block-start - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-bottom - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-inline-end - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-inline-start - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-left - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-right - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-padding-top - CSS: Cascading Style Sheets
this allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport.
scroll-snap-coordinate - CSS: Cascading Style Sheets
ate25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>at coordinate (50, 0)</p> <div class="scrollcontainer 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; ...
scroll-snap-destination - CSS: Cascading Style Sheets
on25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>at coordinate (50, 0)</p> <div class="scrollcontainer destination50"> <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-points-x: repeat(100%); scroll-snap-type: mandatory; scroll-snap-destination: 20px 0; font-size: 0; } .destination0 { scroll-snap-destination: 0 0; } .destination25 { scroll-snap-destination: 25px 0; } .destination50 { scroll-snap-destination: 50px 0; } .scrollcontainer > div { width: 100px; height: 100px; display: inline-block; ...
scroll-snap-type - CSS: Cascading Style Sheets
rtl</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> </div> css /* setup */ html, body, .holster { height: 100%; } .holster { display: flex; align-items: center; justify-content: space-between; flex-flow: column nowrap; font-family: monospace; } .container { display: flex; overflow: auto; outline: 1px dashed lightgray; flex: none; } .container.x { width: 100%; height: 128px; flex-flow: row nowrap; } .container.y { width: 256px; height: 256px; flex-flow: column nowrap; } /* scroll-snap */ .x.mandatory-scroll-snapping { scroll-snap-type: x mandatory; } .y.mandatory-scrol...
scrollbar-color - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples coloring overflow scrollbars css .scroller { width: 300px; height: 100px; overflow-y: scroll; scrollbar-color: rebeccapurple green; } html <div class="scroller">veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.
Specified value - CSS: Cascading Style Sheets
the specified value for a given property is determined according to the following rules: if the document's style sheet explicitly specifies a value for the property, the given value will be used.
symbols() - CSS: Cascading Style Sheets
WebCSSsymbols
[ <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.
text-align - CSS: Cascading Style Sheets
l; text-align: start; text-align: end; text-align: match-parent; /* character-based alignment in a table column */ text-align: "."; text-align: "." center; /* block alignment values (non-standard syntax) */ text-align: -moz-center; text-align: -webkit-center; /* global values */ text-align: inherit; text-align: initial; text-align: unset; the text-align property is specified in one of the following ways: using the keyword values start, end, left, right, center, justify, justify-all, or match-parent.
text-decoration-color - CSS: Cascading Style Sheets
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.
text-emphasis-style - CSS: Cascading Style Sheets
open the shape is hollow.
text-indent - CSS: Cascading Style Sheets
negative values are allowed.
text-justify - CSS: Cascading Style Sheets
text-justify: none; text-justify: auto; text-justify: inter-word; text-justify: inter-character; text-justify: distribute; /* deprecated value */ syntax the text-justify property is specified as a single keyword chosen from the list of values below.
text-orientation - CSS: Cascading Style Sheets
syntax /* keyword values */ text-orientation: mixed; text-orientation: upright; text-orientation: sideways-right; text-orientation: sideways; text-orientation: use-glyph-orientation; /* global values */ text-orientation: inherit; text-orientation: initial; text-orientation: unset; the text-orientation property is specified as a single keyword from the list below.
text-shadow - CSS: Cascading Style Sheets
each shadow is specified as two or three <length> values, followed optionally by a <color> value.
text-size-adjust - CSS: Cascading Style Sheets
the text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it.
touch-action - CSS: Cascading Style Sheets
this will prevent people experiencing low vision conditions from being able to read and understand page content.
transform-box - CSS: Cascading Style Sheets
/* keyword values */ transform-box: content-box; transform-box: border-box; transform-box: fill-box; transform-box: stroke-box; transform-box: view-box; /* global values */ transform-box: inherit; transform-box: initial; transform-box: unset; syntax the transform-box property is specified as one of the keyword values listed below.
matrix() - CSS: Cascading Style Sheets
cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 cartesian coordinates on ℝ3 homogeneous coordinates on ℝℙ3 ac bd actxbdty001 actxbdty001 ac0txbd0ty00100001 [a b c d tx ty] the values represent the following functions: matrix( scalex(), skewy(), skewx(), scaley(), translatex(), translatey() ) examples html <div>normal</div> <div class="changed">changed</div> css div { width: 80px; height: 80px; background-color: skyblue; } .changed { transform: matrix(1, 2, -1, 1, 80, 80); background-color: pink; } result specifications specification status comment ...
scale() - CSS: Cascading Style Sheets
if you need to include such animations on your website, you should provide a control to allow users to turn off animations, preferrably site-wide.
transform-origin - CSS: Cascading Style Sheets
the keywords are convenience shorthands and match the following <percentage> values: keyword value left 0% center 50% right 100% top 0% bottom 100% formal definition initial value50% 50% 0applies totransformable elementsinheritednopercentagesrefer to the size of bounding boxcomputed valuefor <length> the absolute value, otherwise a percentageanimation typesimple list of le...
transform-style - CSS: Cascading Style Sheets
we also provide a checkbox allowing you to toggle between this, and transform-style: flat.
transform - CSS: Cascading Style Sheets
WebCSStransform
if you need to include such animations on your website, you should provide a control to allow users to turn off animations, preferrably site-wide.
transition - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: transition-delay transition-duration transition-property transition-timing-function syntax /* apply to 1 property */ /* property name | duration */ transition: margin-right 4s; /* property name | duration | delay */ transition: margin-right 4s 1s; /* property name | duration | timing function */ transition: margin-right 4s ease-in-out; /* property name | duration | ...
translate - CSS: Cascading Style Sheets
WebCSStranslate
the translate css property allows you to specify translation transforms individually and independently of the transform property.
<url> - CSS: Cascading Style Sheets
WebCSSurl
relative urls are allowed, and are relative to the url of the stylesheet (not to the url of the web page).
Used value - CSS: Cascading Style Sheets
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 padding-bottom, padding-left, padding-right, padding-top text-indent spe...
user-modify - CSS: Cascading Style Sheets
syntax the -moz-user-modify property is specified as one of the keyword values from the list below.
var() - CSS: Cascading Style Sheets
WebCSSvar
) note: the syntax of the fallback, like that of custom properties, allows commas.
width - CSS: Cascading Style Sheets
WebCSSwidth
syntax /* <length> values */ width: 300px; width: 25em; /* <percentage> value */ width: 75%; /* keyword values */ width: max-content; width: min-content; width: fit-content(20em); width: auto; /* global values */ width: inherit; width: initial; width: unset; the width property is specified as either: one of the following keyword values: min-content, max-content, fit-content, auto.
word-spacing - CSS: Cascading Style Sheets
allows up to three values describing the optimum, minimum, and maximum value.
z-index - CSS: Cascading Style Sheets
WebCSSz-index
syntax /* keyword value */ z-index: auto; /* <integer> values */ z-index: 0; z-index: 3; z-index: 289; z-index: -1; /* negative values to lower the priority */ /* global values */ z-index: inherit; z-index: initial; z-index: unset; the z-index property is specified as either the keyword auto or an <integer>.
CSS: Cascading Style Sheets
WebCSS
previously development of various parts of css specification was done synchronously, which allowed versioning of the latest recommendation.
exsl:object-type() - EXSLT
returns the object's type, which will be one of the following: string number boolean node-set rtf external specifications exslt - exsl:object-type ...
Math (math) - EXSLT
WebEXSLTmath
math:highest()math:highest() returns the node in the specified node-set with the highest value (where the highest value calculated using math:max()).math:lowest()math:lowest() returns the node in the specified node-set with the lowest value (where the lowest value calculated using math:min()).math:max()math:max() returns the maximum value of a node-set.math:min()math:min() returns the minimum value of a node-set.
regexp:match() - EXSLT
WebEXSLTregexpmatch
for example: <xsl:for-each select="regexp:match('http://developer.mozilla.org/en/docs/firefox_3_for_developers', '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"> part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> this code generates the following output: part 1 = http://developer.mozilla.org/en/docs/firefox_3_for_developers part 2 = http part 3 = developer.mozilla.org part 4 = part 5 = /en/docs/firefox_3_for_developers specifications exslt - regexp:match ...
regexp:test() - EXSLT
WebEXSLTregexptest
the character flags are: g global match has no effect for this function; it's allowed for consistency with other regexp functions.
Regular expressions (regexp) - EXSLT
WebEXSLTregexp
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the exslt regular expressions package provides functions that allow testing, matching, and replacing text using javascript style regular expressions.
Strings (str) - EXSLT
WebEXSLTstr
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the exslt strings package provides functions that allow the manipulation of strings.
Ajax - Developer guides
WebGuideAJAX
this feature allows web apps to obtain an html resource as a parsed dom using xmlhttprequest.
Writing Web Audio API code that works in every browser - Developer guides
if it's using, for example, oscillatornode, you will have to wait until it is supported, or maybe, if you're really eager, hack in some replacement using scriptprocessornode, which allows you to write a node with callbacks that get called periodically, so that your javascript code generates or processes audio.
Media events - Developer guides
you can easily watch for these events, using code such as the following: var v = document.getelementsbytagname("video")[0]; v.addeventlistener("seeked", function() { v.play(); }, true); v.currenttime = 10.0; this example fetches the first video element in the document and attaches an event listener to it, watching for the seeked event, which is sent whenever a seek operation completes.
Mouse gesture events - Developer guides
direction constants the direction field in the gesture events can take one of the following values: simplegestureevent.direction_left leftward swipe.
Using device orientation with 3D transforms - Developer guides
3d"); window.addeventlistener("deviceorientation", function(e) { // again, use vendor-prefixed transform property elem.style.transform = "rotatey(" + ( -e.gamma ) + "deg)" + "rotatex(" + e.beta + "deg) " + "rotatez(" + - ( e.alpha - 180 ) + "deg) "; }); rotate3d to orientation should you ever need to convert a rotate3d axis-angle to orientation euler angles, you can use the following algorithm: // convert a rotate3d axis-angle to deviceorientation angles function orient( aa ) { var x = aa.x, y = aa.y, z = aa.z, a = aa.a, c = math.cos( aa.a ), s = math.sin( aa.a ), t = 1 - c, // axis-angle to rotation matrix rm00 = c + x*x * t, rm10 = z*s + y*x * t, rm20 = -y*s + z*x * t, rm01 = -z*s + x*y * t, ...
Introduction to Web development - Developer guides
tizag css tutorials an easy-to-follow reference for those wishing to learn css through short, concise tutorials.
Mobile Web Development - Developer guides
WebGuideMobile
optimizing images to help users whose devices have low or expensive bandwidth, you can optimize images by loading images appropriate to the device screen size and resolution.
Optimization and performance - Developer guides
the most notable tools are listed below.
The Web Open Font Format (WOFF) - Developer guides
WebGuideWOFF
it uses a compressed version of the same table-based sfnt structure used by truetype, opentype, and open font format, but adds metadata and private-use data structures, including predefined fields allowing foundries and vendors to provide license information if desired.
Developer guides
ajax ajax is a term that defines a group of technologies allowing web applications to make quick, incremental updates to the user interface without reloading the entire browser page.
HTML attribute: capture - HTML: Hypertext Markup Language
examples when set on a file input type, operating systems with microphones and cameras will display a user interface allowing the selection from an existing file or the creating of a new one.
HTML attribute: maxlength - HTML: Hypertext Markup Language
constraint validation while the browser will generally prevent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only toolong property of a validitystate object will be true.
HTML attribute: size - HTML: Hypertext Markup Language
WebHTMLAttributessize
type="text" size="15" id="fruit"> <label for="vegetable">enter a vegetable</label> <input type="text" id="vegetable"> <select name="fruits" size="5"> <option>banana</option> <option>cherry</option> <option>strawberry</option> <option>durian</option> <option>blueberry</option> </select> <select name="vegetables" size="5"> <option>carrot</option> <option>cucumber</option> <option>cauliflower</option> <option>celery</option> <option>collard greens</option> </select> specifications specification status html living standardthe definition of 'size attribute' in that specification.
<acronym> - HTML: Hypertext Markup Language
WebHTMLElementacronym
summary the html acronym element (<acronym>) allows authors to clearly indicate a sequence of characters that compose an acronym or abbreviation for a word.
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
WebHTMLElementb
content categories flow content, phrasing content, palpable content.
<bdo>: The Bidirectional Text Override element - HTML: Hypertext Markup Language
WebHTMLElementbdo
content categories flow content, phrasing content, palpable content.
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementbgsound
src this attribute specifies the url of the sound file to be played, which must be one of the following types: .wav, .au, or .mid.
<big>: The Bigger Text element - HTML: Hypertext Markup Language
WebHTMLElementbig
examples here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern css syntax instead.
<code>: The Inline Code element - HTML: Hypertext Markup Language
WebHTMLElementcode
content categories flow content, phrasing content, palpable content.
<command>: The HTML Command element - HTML: Hypertext Markup Language
WebHTMLElementcommand
content categories flow content, phrasing content, metadata content.
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
WebHTMLElementdatalist
content categories flow content, phrasing content.
<figcaption>: The Figure Caption element - HTML: Hypertext Markup Language
permitted content flow content.
<frame> - HTML: Hypertext Markup Language
WebHTMLElementframe
frameborder this attribute allows you to specify a frame’s border.
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
WebHTMLElementhead
the end tag may be omitted if the first thing following the <head> element is not a space character or a comment.
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
WebHTMLElementi
content categories flow content, phrasing content, palpable content.
<isindex> - HTML: Hypertext Markup Language
WebHTMLElementisindex
example <head> <isindex prompt="search document..." action="/search"> </head> in past browsers, this would generate, at parse time, a dom tree equivalent to the following html: <form action="/search"> <hr> <label> search document...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementmarquee
truespeed by default, scrolldelay values lower than 60 are ignored.
theme-color - HTML: Hypertext Markup Language
WebHTMLElementmetanametheme-color
example <meta name="theme-color" content="#4285f4"> the following image shows the effect that the <meta> element above will have on a document displayed in chrome running on an android mobile device.
<multicol>: The HTML Multi-Column Layout element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementmulticol
the html multi-column layout element (<multicol>) was an experimental element designed to allow multi-column layouts and must not be used.
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnextid
html "1.k" - version 1 (first release) in this first published draft of html, <nextid> is the same as it would take in html 2, finally allowing the use of a name instead of only a number for its attribute value.
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
WebHTMLElementnoembed
show an alternative content <embed type="vide/webm" src="/media/examples/flower.mp4" width="200" height="200"> <noembed> <h1>alternative content</h1> </noembed> </embed> ...
<optgroup> - HTML: Hypertext Markup Language
WebHTMLElementoptgroup
the end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content.
<option>: The HTML Option element - HTML: Hypertext Markup Language
WebHTMLElementoption
the end tag is optional if this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content.
<param>: The Object Parameter element - HTML: Hypertext Markup Language
WebHTMLElementparam
permitted parents an <object> before any flow content.
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
the html plaintext element (<plaintext>) renders everything following the start tag as raw text, ignoring any following html.
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
WebHTMLElementq
content categories flow content, phrasing content, palpable content.
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
WebHTMLElementrb
tag omission the end tag can be omitted if the element is immediately followed by an <rt>, <rtc>, or <rp> element or another <rb> element, or if there is no more content in the parent element.
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
WebHTMLElementrp
permitted content text tag omission the end tag can be omitted if the element is immediately followed by an <rt> or another <rp> element, or if there is no more content in the parent element.
<rt>: The Ruby Text element - HTML: Hypertext Markup Language
WebHTMLElementrt
tag omission the end tag may be omitted if the <rt> element is immediately followed by an <rt> or <rp> element, or if there is no more content in the parent element permitted parents a <ruby> element.
<rtc>: The Ruby Text Container element - HTML: Hypertext Markup Language
WebHTMLElementrtc
tag omission the closing tag can be omitted if it is immediately followed by a <rb>, <rtc> or <rt> element opening tag or by its parent closing tag.
<ruby> - HTML: Hypertext Markup Language
WebHTMLElementruby
content categories flow content, phrasing content, palpable content.
<slot> - HTML: Hypertext Markup Language
WebHTMLElementslot
content categories flow content, phrasing content permitted content transparent events slotchange tag omission none, both the starting and ending tag are mandatory.
<spacer> - HTML: Hypertext Markup Language
WebHTMLElementspacer
<spacer> is an obsolete html element which allowed insertion of empty spaces on pages.
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
WebHTMLElementsummary
examples below are some examples showing <summary> in use.
<tbody>: The Table Body element - HTML: Hypertext Markup Language
WebHTMLElementtbody
examples below are some examples showing the use of the <tbody> element.
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
WebHTMLElementtfoot
one of the sixteen predefined color strings may be used: black = "#000000" green = "#008000" silver = "#c0c0c0" lime = "#00ff00" gray = "#808080" olive = "#808000" white = "#ffffff" yellow = "#ffff00" maroon = "#800000" navy = "#000080" red = "#ff0000" blue = "#0000ff" purple = "#800080" teal = "#008080" fuchsia = "#ff00ff" aqua = "#00ffff" usage note: do not use this attribute, as it is non-standard and only implemented some versions of microsoft internet explorer: th...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
WebHTMLElementtrack
the following keywords are allowed: subtitles subtitles provide translation of content that cannot be understood by the viewer.
<wbr> - HTML: Hypertext Markup Language
WebHTMLElementwbr
content categories flow content, phrasing content.
<xmp> - HTML: Hypertext Markup Language
WebHTMLElementxmp
the html2 specification recommended that it should be rendered wide enough to allow 80 characters per line.
autocapitalize - HTML: Hypertext Markup Language
the attribute must take one of the following values: off or none: no autocapitalization is applied (all letters default to lowercase) on or sentences: the first letter of each sentence defaults to a capital letter; all other letters default to lowercase words: the first letter of each word defaults to a capital letter; all other letters default to lowercase characters: all letters should default to uppercase the autocapitalize attribute doesn’t affect behavior when typing on a physical keyboard.
class - HTML: Hypertext Markup Language
classes allow css and javascript to select and access specific elements via the class selectors or functions like the dom method document.getelementsbyclassname.
draggable - HTML: Hypertext Markup Language
draggable can have the following values: true: the element can be dragged.
dropzone - HTML: Hypertext Markup Language
it can have the following values: copy, which indicates that dropping will create a copy of the element that was dragged.
inputmode - HTML: Hypertext Markup Language
it can have the following values: none no virtual keyboard.
itemid - HTML: Hypertext Markup Language
however, the following example correctly illustrates that a urn may also be used.
itemtype - HTML: Hypertext Markup Language
it is left to such specifications to define whether multiple items of the same global identifier (whether on the same page or different pages) are allowed to exist, and what processing rules for that vocabulary are, with respect to handling the case of multiple items with the same id.
lang - HTML: Hypertext Markup Language
a 2-or-3-character code that defines the basic language, typically written in all lowercase.
part - HTML: Hypertext Markup Language
part names allows css to select and style specific elements in a shadow tree via the ::part pseudo-element.
style - HTML: Hypertext Markup Language
this attribute and the <style> element have mainly the purpose of allowing for quick styling, for example for testing purposes.
tabindex - HTML: Hypertext Markup Language
if multiple elements share the same positive tabindex value, their order relative to each other follows their position in the document source.
title - HTML: Hypertext Markup Language
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 may inherit it from its parent, and so on.
translate - HTML: Hypertext Markup Language
it can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized.
x-ms-format-detection - HTML: Hypertext Markup Language
the x-ms-format-detection attribute determines whether data formats within the element’s text, like phone numbers, are automatically converted to followable links.
Microdata - HTML: Hypertext Markup Language
search engines benefit greatly from direct access to this structured data because it allows search engines to understand the information on web pages and provide more relevant results to users.
Microformats - HTML: Hypertext Markup Language
search engines benefit greatly from direct access to this structured data because it allows them to understand the information on web pages and provide more relevant results to users.
Common MIME types - HTTP
interchange format (gif) image/gif .htm .html hypertext markup language (html) text/html .ico icon format image/vnd.microsoft.icon .ics icalendar format text/calendar .jar java archive (jar) application/java-archive .jpeg .jpg jpeg images image/jpeg .js javascript text/javascript, per the following specifications: https://html.spec.whatwg.org/multipage/#scriptinglanguages https://html.spec.whatwg.org/multipage/#dependencies:willful-violation https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/ .json json format application/json .jsonld json-ld format application/ld+json .mid .midi musical instrume...
Reason: CORS header ‘Origin’ cannot be added - HTTP
this can happen if the javascript code is running with enhanced privileges allowing it access to multiple domains' content, for example.
Connection management in HTTP/1.x - HTTP
conclusion improved connection management allows considerable boosting of performance in http.
Cross-Origin Resource Policy (CORP) - HTTP
these vulnerabilities allowed sensitive data disclosure due to a race condition which arose as part of speculative execution functionality, designed to improve performance.
Accept-Charset - HTTP
browsers usually don't send this header, as the default value for each resource is usually correct and transmitting it would allow fingerprinting.
Accept-Language - HTTP
this consists of a 2-3 letter base language tag representing the language, optionally followed by additional subtags separated by '-'.
Accept-Patch - HTTP
accept-patch in response to any method means that patch is allowed on the resource identified by the request-uri.
Access-Control-Max-Age - HTTP
the access-control-max-age response header indicates how long the results of a preflight request (that is the information contained in the access-control-allow-methods and access-control-allow-headers headers) can be cached.
Clear-Site-Data - HTTP
it allows web developers to have more control over the data stored locally by a browser for their origins.
Connection - HTTP
if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done.
CSP: referrer - HTTP
syntax content-security-policy: referrer <referrer-policy>; where <referrer-policy> can be one of the following values: "no-referrer" the referer header will be omitted entirely.
CSP: require-sri-for - HTTP
examples if you set your site to require sri for script and styles using this directive: content-security-policy: require-sri-for script style <script> elements like the following will be loaded as they use a valid integrity attribute.
Content-Type - HTTP
browsers will do mime sniffing in some cases and will not necessarily follow the value of this header; to prevent this behavior, the header x-content-type-options can be set to nosniff.
Cross-Origin-Embedder-Policy - HTTP
allows the document to fetch cross-origin resources without giving explicit permission through the cors protocol or the cross-origin-resource-policy header.
Cross-Origin-Resource-Policy - HTTP
header type response header forbidden header name no syntax cross-origin-resource-policy: same-site | same-origin | cross-origin examples the response header below will cause compatible user agents to disallow cross-origin no-cors requests: cross-origin-resource-policy: same-origin for more examples, see https://resourcepolicy.fyi/.
DNT - HTTP
WebHTTPHeadersDNT
header type request header forbidden header name yes syntax dnt: 0 dnt: 1 dnt: null directives 0 the user prefers to allow tracking on the target site.
Device-Memory - HTTP
the header takes on the following values: 0.25, 0.5, 1, 2, 4, 8.
If-None-Match - HTTP
note that the server generating a 304 response must generate any of the following header fields that would have been sent in a 200 (ok) response to the same request: cache-control, content-location, date, etag, expires, and vary.
Proxy-Authenticate - HTTP
it authenticates the request to the proxy server, allowing it to transmit the request further.
Public-Key-Pins - HTTP
some browsers might allow other hashing algorithms than sha-256 in the future.
Referrer-Policy - HTTP
these resources follow a referrer policy as well: external css stylesheets use the default policy (no-referrer-when-downgrade), unless it's overwritten via a referrer-policy http header on the css stylesheet’s response.
Retry-After - HTTP
the retry-after response http header indicates how long the user agent should wait before making a follow-up request.
Upgrade - HTTP
WebHTTPHeadersUpgrade
http/2 explicitly disallows the use of this mechanism/header; it is specific to http/1.1.
User-Agent - HTTP
see below for further details and examples.
WWW-Authenticate - HTTP
the only allowed value is the case insensitive string "utf-8".
X-Content-Type-Options - HTTP
the x-content-type-options response http header is a marker used by the server to indicate that the mime types advertised in the content-type headers should not be changed and be followed.
X-XSS-Protection - HTTP
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.
CONNECT - HTTP
WebHTTPMethodsCONNECT
request has body no successful response has body yes safe no idempotent no cacheable no allowed in html forms no syntax connect www.example.com:443 http/1.1 example some proxy servers might need authority to create a tunnel.
DELETE - HTTP
WebHTTPMethodsDELETE
request has body may successful response has body may safe no idempotent yes cacheable no allowed in html forms no syntax delete /file.html http/1.1 example request delete /file.html http/1.1 responses if a delete method is successfully applied, there are several response status codes possible: a 202 (accepted) status code if the action will likely succeed but has not yet been enacted.
GET - HTTP
WebHTTPMethodsGET
request has body no successful response has body yes safe yes idempotent yes cacheable yes allowed in html forms yes syntax get /index.html specifications specification title rfc 7231, section 4.3.1: get hypertext transfer protocol (http/1.1): semantics and content ...
HEAD - HTTP
WebHTTPMethodsHEAD
request has body no successful response has body no safe yes idempotent yes cacheable yes allowed in html forms no syntax head /index.html specifications specification title rfc 7231, section 4.3.2: head hypertext transfer protocol (http/1.1): semantics and content ...
PUT - HTTP
WebHTTPMethodsPUT
request has body yes successful response has body no safe no idempotent yes cacheable no allowed in html forms no syntax put /new.html http/1.1 example request put /new.html http/1.1 host: example.com content-type: text/html content-length: 16 <p>new file</p> responses if the target resource does not have a current representation and the put request successfully creates one, then the origin server must inform the user agent by sending a 201 (created) response.
103 Early Hints - HTTP
WebHTTPStatus103
the http 103 early hints information response status code is primarily intended to be used with the link header to allow the user agent to start preloading resources while the server is still preparing a response.
202 Accepted - HTTP
WebHTTPStatus202
the request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.
404 Not Found - HTTP
WebHTTPStatus404
apache servers can be configured using an .htaccess file and a code snippet like the following example.
406 Not Acceptable - HTTP
WebHTTPStatus406
if a server returns such an error status, the body of the message should contain the list of the available representations of the resources, allowing the user to choose among them.
416 Range Not Satisfiable - HTTP
WebHTTPStatus416
the 416 response message contains a content-range indicating an unsatisfied range (that is a '*') followed by a '/' and the current length of the resource.
501 Not Implemented - HTTP
WebHTTPStatus501
if the server does recognize the method, but intentionally does not support it, the appropriate response is 405 method not allowed.
About JavaScript - JavaScript
for a more in depth discussion of javascript programming follow the javascript resources links below.
JavaScript Guide - JavaScript
chapters this guide is divided into several chapters: introduction about this guide about javascript javascript and java ecmascript tools hello world grammar and types basic syntax & comments declarations variable scope variable hoisting data structures and types literals control flow and error handling if...else switch try/catch/throw error objects loops and iteration for while do...while break/continue for..in for..of functions defining functions calling functions function scope closures arguments & parameters arrow functions expressions and operators assignment & comparisons arithmetic operators bitwise & log...
JavaScript language resources - JavaScript
the following ecmascript standards have been approved or are being worked on: name links release date description current editions ecma-262 10th edition pdf, html, working draft, repository 2019 ecmascript 2019 language specification ecma-262 9th edition pdf, html, working draft, repository 2018 ecmascript 2018 language specification ecma-402 5th edition working draft, repository 2018 ecmascript 2018 internationalization api specification obsolete/historical editions ecma-262 pdf...
static - JavaScript
} examples using static in classes the following example demonstrates several things: how a static method is implemented on a class.
The legacy Iterator protocol - JavaScript
an object is an legacy iterator when it implements a next() method with the following semantics, and throws stopiteration at the end of iteration.
TypeError: property "x" is non-configurable and can't be deleted - JavaScript
message typeerror: calling delete on 'x' is not allowed in strict mode (edge) typeerror: property "x" is non-configurable and can't be deleted.
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
märz 2017" or, you can make use of the intl.datetimeformat object, which allows you to cache an object with most of the computations done so that formatting is fast.
SyntaxError: test for equality (==) mistyped as assignment (=)? - JavaScript
for example, do not use the following code: if (x = y) { // do the right thing } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment.
SyntaxError: identifier starts immediately after numeric literal - JavaScript
the following fails: var 1life = 'foo'; // syntaxerror: identifier starts immediately after numeric literal var foo = 1life; // syntaxerror: identifier starts immediately after numeric literal alert(1.foo); // syntaxerror: identifier starts immediately after numeric literal you will need to rename your variable to avoid the leading number.
RangeError: invalid date - JavaScript
however, depending on the implementation, non–conforming iso format strings, may also throw rangeerror: invalid date, like the following cases in firefox: new date('foo-bar 2014'); new date('2014-25-23').toisostring(); new date('foo-bar 2014').tostring(); this, however, returns nan in firefox: date.parse('foo-bar 2014'); // nan for more details, see the date.parse() documentation.
URIError: malformed URI sequence - JavaScript
an urierror will be thrown if there is an attempt to encode a surrogate which is not part of a high-low pair, for example: encodeuri('\ud800'); // "urierror: malformed uri sequence" encodeuri('\udfff'); // "urierror: malformed uri sequence" a high-low pair is ok.
RangeError: repeat count must be non-negative - JavaScript
the range of allowed values can be described like this: [0, +∞).
TypeError: "x" is read-only - JavaScript
message typeerror: assignment to read-only properties is not allowed in strict mode (edge) typeerror: "x" is read-only (firefox) typeerror: 0 is read-only (firefox) typeerror: cannot assign to read only property 'x' of #<object> (chrome) typeerror: cannot assign to read only property '0' of [object array] (chrome) error type typeerror what went wrong?
SyntaxError: redeclaration of formal parameter "x" - JavaScript
redeclaring the same variable within the same function or block scope using let is not allowed in javascript.
SyntaxError: "x" is a reserved identifier - JavaScript
these are reserved in strict mode and sloppy mode: enum the following are only reserved when they are found in strict mode code: implements interface let package private protected public static examples strict and non-strict reserved keywords the enum identifier is generally reserved.
SyntaxError: function statement requires a name - JavaScript
the following syntax without a name after the function keyword is valid then.
Method definitions - JavaScript
given the following code: const obj = { foo: function() { // ...
Array.prototype[@@unscopables] - JavaScript
property attributes of array.prototype[@@unscopables] writable no enumerable no configurable yes examples use in with environments the following code works fine in es5 and below.
Array() constructor - JavaScript
syntax [element0, element1, ..., elementn] new array(element0, element1[, ...[, elementn]]) new array(arraylength) parameters elementn a javascript array is initialized with the given elements, except in the case where a single argument is passed to the array constructor and that argument is a number (see the arraylength parameter below).
Array.prototype.copyWithin() - JavaScript
the copywithin() method shallow copies part of an array to another location in the same array and returns it without modifying its length.
Array.prototype.includes() - JavaScript
the example below illustrates includes() method called on the function's arguments object.
Array.of() - JavaScript
for more information, see: array.of() array.from() proposal array.of() polyfill polyfill running the following code before any other code will create array.of() if it's not natively available.
Array.prototype.toSource() - JavaScript
description the tosource method returns the following values: for the built-in array object, tosource returns the following string indicating that the source code is not available: function array() { [native code] } for instances of array, tosource returns a string representing the source code.
AsyncFunction - JavaScript
it can be obtained with the following code: object.getprototypeof(async function(){}).constructor syntax new asyncfunction([arg1[, arg2[, ...argn]],] functionbody) parameters arg1, arg2, ...
Atomics.add() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.and() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.compareExchange() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.exchange() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.load() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.or() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.store() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.sub() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
Atomics.wait() - JavaScript
note: this operation only works with a shared int32array and may not be allowed on the main thread.
Atomics.xor() - JavaScript
exceptions throws a typeerror, if typedarray is not one of the allowed integer types.
BigInt.asIntN() - JavaScript
const max = 2n ** (64n - 1n) - 1n; bigint.asintn(64, max); // ↪ 9223372036854775807n bigint.asintn(64, max + 1n); // ↪ -9223372036854775807n // negative because of overflow specifications specification ecmascript (ecma-262)the definition of 'bigint.asintn()' in that specification.
BigInt.asUintN() - JavaScript
const max = 2n ** 64n - 1n; bigint.asuintn(64, max); // ↪ 18446744073709551615n bigint.asuintn(64, max + 1n); // ↪ 0n // zero because of overflow specifications specification ecmascript (ecma-262)the definition of 'bigint.asuintn()' in that specification.
BigInt - JavaScript
type information when tested against typeof, a bigint will give "bigint": typeof 1n === 'bigint' // true typeof bigint('1') === 'bigint' // true when wrapped in an object, a bigint will be considered as a normal "object" type: typeof object(1n) === 'object' // true operators the following operators may be used with bigints (or object-wrapped bigints): +, *, -, **, %.
Boolean.prototype.toSource() - JavaScript
examples native function for the built-in boolean object, tosource returns the following string indicating that the source code is not available: function boolean() { [native code] } specifications not part of any standard.
Boolean.prototype.toString() - JavaScript
examples using tostring() in the following code, flag.tostring() returns "true": var flag = new boolean(true); var myvar = flag.tostring(); specifications specification ecmascript (ecma-262)the definition of 'boolean.prototype.tostring' in that specification.
DataView.prototype.setBigInt64() - JavaScript
upon overflow, it will be negative (-9223372036854775808n).
DataView.prototype.setBigUint64() - JavaScript
upon overflow, it will be zero (0n).
Date.UTC() - JavaScript
examples using date.utc() the following statement creates a date object with the arguments treated as utc instead of local: let utcdate = new date(date.utc(2018, 11, 1, 0, 0, 0)); specifications specification ecmascript (ecma-262)the definition of 'date.utc' in that specification.
Date.prototype.getDate() - JavaScript
examples using getdate() the second statement below assigns the value 25 to the variable day, based on the value of the date object xmas95.
Date.prototype.getDay() - JavaScript
examples using getday() the second statement below assigns the value 1 to weekday, based on the value of the date object xmas95.
Date.prototype.getFullYear() - JavaScript
examples using getfullyear() the following example assigns the four-digit value of the current year to the variable year.
Date.prototype.getHours() - JavaScript
examples using gethours() the second statement below assigns the value 23 to the variable hours, based on the value of the date object xmas95.
Date.prototype.getMilliseconds() - JavaScript
examples using getmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds: var today = new date(); var milliseconds = today.getmilliseconds(); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.getmilliseconds' in that specification.
Date.prototype.getMinutes() - JavaScript
examples using getminutes() the second statement below assigns the value 15 to the variable minutes, based on the value of the date object xmas95.
Date.prototype.getMonth() - JavaScript
examples using getmonth() the second statement below assigns the value 11 to the variable month, based on the value of the date object xmas95.
Date.prototype.getSeconds() - JavaScript
examples using getseconds() the second statement below assigns the value 30 to the variable seconds, based on the value of the date object xmas95.
Date.prototype.getUTCDate() - JavaScript
examples using getutcdate() the following example assigns the day portion of the current date to the variable day.
Date.prototype.getUTCDay() - JavaScript
examples using getutcday() the following example assigns the weekday portion of the current date to the variable weekday.
Date.prototype.getUTCFullYear() - JavaScript
examples using getutcfullyear() the following example assigns the four-digit value of the current year to the variable year.
Date.prototype.getUTCHours() - JavaScript
examples using getutchours() the following example assigns the hours portion of the current time to the variable hours.
Date.prototype.getUTCMilliseconds() - JavaScript
examples using getutcmilliseconds() the following example assigns the milliseconds portion of the current time to the variable milliseconds.
Date.prototype.getUTCMinutes() - JavaScript
examples using getutcminutes() the following example assigns the minutes portion of the current time to the variable minutes.
Date.prototype.getUTCMonth() - JavaScript
examples using getutcmonth() the following example assigns the month portion of the current date to the variable month.
Date.prototype.getUTCSeconds() - JavaScript
examples using getutcseconds() the following example assigns the seconds portion of the current time to the variable seconds.
Date.prototype.getYear() - JavaScript
var xmas = new date('december 25, 2000 23:15:00'); var year = xmas.getyear(); // returns 100 years below 1900 the second statement assigns the value -100 to the variable year.
Date.now() - JavaScript
engines which have not been updated to support this method can work around the absence of this method using the following shim: if (!date.now) { date.now = function now() { return new date().gettime(); }; } examples reduced time precision to offer protection against timing attacks and fingerprinting, the precision of date.now() might get rounded depending on browser settings.
Date.prototype.setMonth() - JavaScript
so, 0 represents january, 11 represents december, -1 represents december of the previous year, and 12 represents january of the following year.
Date.prototype.toISOString() - JavaScript
engines which have not been updated to support this method can work around the absence of this method using the following shim: if (!date.prototype.toisostring) { (function() { function pad(number) { if (number < 10) { return '0' + number; } return number; } date.prototype.toisostring = function() { return this.getutcfullyear() + '-' + pad(this.getutcmonth() + 1) + '-' + pad(this.getutcdate()) + 't' + pad(this.getutchours()) + ':' + ...
Date.prototype.toLocaleTimeString() - JavaScript
in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // formats below assume the local time zone of the locale; // america/los_angeles for the us // us english uses 12-hour time with am/pm console.log(date.tolocaletimestring('en-us')); // → "7:00:00 pm" // british english uses 24-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')); // → "...
Date.prototype.toSource() - JavaScript
examples native function for the built-in date object, tosource() returns the following string indicating that the source code is not available: function date() { [native code] } specifications not part of any standard.
Date.prototype.toString() - JavaScript
examples using tostring() the following assigns the tostring() value of a date object to myvar: var x = new date(); var myvar = x.tostring(); // assigns a string value to myvar in the same format as: // mon sep 08 1998 14:36:22 gmt-0700 (pdt) specifications specification ecmascript (ecma-262)the definition of 'date.prototype.tostring' in that specification.
Date.prototype.toTimeString() - JavaScript
in spidermonkey, this consists of the date portion (day, month, and year) followed by the time portion (hours, minutes, seconds, and time zone).
Error.prototype.lineNumber - JavaScript
see the browser compatability table below.
Error.prototype.toSource() - JavaScript
naturally, the string containing the source follows the structure of the error constructor.
Error.prototype.toString() - JavaScript
its semantics are as follows (assuming object and string have their original values): error.prototype.tostring = function() { 'use strict'; var obj = object(this); if (obj !== this) { throw new typeerror(); } var name = this.name; name = (name === undefined) ?
FinalizationRegistry.prototype.register() - JavaScript
examples using register the following registers the target object referenced by target, passing in the held value "some value" and passing the target object itself as the unregistration token: registry.register(target, "some value", target); the following registers the target object referenced by target, passing in another object as the held value, and not passing in any unregistration token (which means target can't be unregis...
Function() constructor - JavaScript
examples specifying arguments with the function constructor the following code creates a function object that takes two arguments.
Function.displayName - JavaScript
by entering the following in a console, it should display as something like "function my function()": var a = function() {}; a.displayname = 'my function'; a; // "function my function()" when defined, the displayname property returns the display name of a function: function dosomething() {} console.log(dosomething.displayname); // "undefined" var popup = function(content) { console.log(content); }; popup.displayname = 'show popup'; console.log(popup.displayname); // "show popup" defining a displayname in function expressions you can define a function with a displa...
Function.prototype.toSource() - JavaScript
examples native functions for the built-in function object, tosource() returns the following string indicating that the source code is not available: function function() { [native code] } custom functions for custom functions, tosource() returns the javascript source that defines the object as a string.
Generator.prototype.next() - JavaScript
examples using next() the following example shows a simple generator and the object that the next method returns: function* gen() { yield 1; yield 2; yield 3; } const g = gen(); // "generator { }" g.next(); // "object { value: 1, done: false }" g.next(); // "object { value: 2, done: false }" g.next(); // "object { value: 3, done: false }" g.next(); // "object { value: undefined, done: true }" using ...
Generator.prototype.return() - JavaScript
examples using return() the following example shows a simple generator and the return method.
Generator.prototype.throw() - JavaScript
examples using throw() the following example shows a simple generator and an error that is thrown using the throw method.
GeneratorFunction - JavaScript
it could be obtained by evaluating the following code.
Intl.Collator.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used.
Intl.Collator.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl.Collator - JavaScript
examples using collator the following example demonstrates the different potential results for a string occurring before, after, or at the same level as another: console.log(new intl.collator().compare('a', 'c')); // → a negative value console.log(new intl.collator().compare('c', 'a')); // → a positive value console.log(new intl.collator().compare('a', 'a')); // → 0 note that the results shown in the code above can vary b...
Intl.DateTimeFormat.prototype.formatRangeToParts() - JavaScript
the intl.datetimeformat.prototype.formatrangetoparts() method allows locale-specific tokens representing each part of the formatted date range produced by datetimeformat formatters.
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
description the resulting object has the following properties: locale the bcp 47 language tag for the locale actually used.
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl.DateTimeFormat - JavaScript
in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: var date = new date(date.utc(2012, 11, 20, 3, 0, 0)); // results below use the time zone of america/los_angeles (utc-0800, pacific standard time) // us english uses month-day-year order console.log(new intl.datetimeformat('en-us').format(date)); // → "12/19/2012" // british english uses day-month-year order console.log(new intl.datetimeformat('en-gb').format(date)); // → "19/12/2012" // korean uses year-month-day order console.log(new intl.datetimeformat('ko-...
Intl.DisplayNames.prototype.resolvedOptions() - JavaScript
description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used.
Intl.DisplayNames.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl​.ListFormat.prototype​.format() - JavaScript
examples using format the following example shows how to create a list formatter using the english language.
Intl​.List​Format​.prototype​.resolvedOptions() - JavaScript
description the object returned by resolvedoptions() has the following properties: locale the bcp 47 language tag for the locale actually used.
Intl.ListFormat.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl.Locale.prototype.calendar - JavaScript
the following table shows all the valid unicode calendar key strings, along with a description of the calendar era they represent.
Intl.Locale.prototype.collation - JavaScript
below is a table with the available collation types, taken from the unicode collation specification.
Intl.Locale.prototype.hourCycle - JavaScript
the hour cycle type can have several different values, which are listed in the table below.
Intl.Locale.prototype.toString() - JavaScript
the tostring method allows locale instances to be provided as an argument to existing intl constructors, serialized in json, or any other context where an exact string representation is useful.
Intl.Locale - JavaScript
description the intl.locale object was created to allow for easier manipulation of unicode locales.
Intl.NumberFormat.prototype.format() - JavaScript
this is considered a historical artefact, as part of a convention which is no longer followed for new features, but is preserved to maintain compatibility with existing programs.
Intl.NumberFormat.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl.PluralRules.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
an object that may have the following property: localematcher the locale matching algorithm to use.
Map.prototype.set() - JavaScript
examples using set() let mymap = new map() // add new elements to the map mymap.set('bar', 'foo') mymap.set(1, 'foobar') // update an element in the map mymap.set('bar', 'baz') using the set() with chaining since the set() method returns back the same map object, you can chain the method call like below: // add new elements to the map with chaining.
Math.E - JavaScript
examples using math.e the following function returns e: function getnapier() { return math.e; } getnapier(); // 2.718281828459045 specifications specification ecmascript (ecma-262)the definition of 'math.e' in that specification.
Math.LN10 - JavaScript
examples using math.ln10 the following function returns the natural log of 10: function getnatlog10() { return math.ln10; } getnatlog10(); // 2.302585092994046 specifications specification ecmascript (ecma-262)the definition of 'math.ln10' in that specification.
Math.LN2 - JavaScript
examples using math.ln2 the following function returns the natural log of 2: function getnatlog2() { return math.ln2; } getnatlog2(); // 0.6931471805599453 specifications specification ecmascript (ecma-262)the definition of 'math.ln2' in that specification.
Math.LOG10E - JavaScript
examples using math.log10e the following function returns the base 10 logarithm of e: function getlog10e() { return math.log10e; } getlog10e(); // 0.4342944819032518 specifications specification ecmascript (ecma-262)the definition of 'math.log10e' in that specification.
Math.LOG2E - JavaScript
examples using math.log2e the following function returns the base 2 logarithm of e: function getlog2e() { return math.log2e; } getlog2e(); // 1.4426950408889634 specifications specification ecmascript (ecma-262)the definition of 'math.log2e' in that specification.
Math.PI - JavaScript
examples using math.pi the following function uses math.pi to calculate the circumference of a circle with a passed radius.
Math.SQRT1_2 - JavaScript
examples using math.sqrt1_2 the following function returns 1 over the square root of 2: function getroot1_2() { return math.sqrt1_2; } getroot1_2(); // 0.7071067811865476 specifications specification ecmascript (ecma-262)the definition of 'math.sqrt1_2' in that specification.
Math.SQRT2 - JavaScript
examples using math.sqrt2 the following function returns the square root of 2: function getroot2() { return math.sqrt2; } getroot2(); // 1.4142135623730951 specifications specification ecmascript (ecma-262)the definition of 'math.sqrt2' in that specification.
Math.acosh() - JavaScript
polyfill for all x≥1x \geq 1, we have arcosh(x)=ln(x+x2-1)\operatorname {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right) and so this can be emulated with the following function: math.acosh = math.acosh || function(x) { return math.log(x + math.sqrt(x * x - 1)); }; examples using math.acosh() math.acosh(-1); // nan math.acosh(0); // nan math.acosh(0.5); // nan math.acosh(1); // 0 math.acosh(2); // 1.3169578969248166 for values less than 1 math.acosh() returns nan.
Math.asinh() - JavaScript
polyfill math.asinh can be emulated with the following function: if (!math.asinh) math.asinh = function(x) { var absx = math.abs(x), w if (absx < 3.725290298461914e-9) // |x| < 2^-28 return x if (absx > 268435456) // |x| > 2^28 w = math.log(absx) + math.ln2 else if (absx > 2) // 2^28 >= |x| > 2 w = math.log(2 * absx + 1 / (math.sqrt(x * x + 1) + absx)) else var t = x * x, w = math.log1p(absx + ...
Math.atanh() - JavaScript
polyfill for |x|<1\left|x\right| < 1, we have artanh(x)=12ln(1+x1-x)\operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right) so this can be emulated by the following function: math.atanh = math.atanh || function(x) { return math.log((1+x)/(1-x)) / 2; }; examples using math.atanh() math.atanh(-2); // nan math.atanh(-1); // -infinity math.atanh(0); // 0 math.atanh(0.5); // 0.5493061443340548 math.atanh(1); // infinity math.atanh(2); // nan for values greater than 1 or less than -1, nan is returned.
Math.cbrt() - JavaScript
polyfill for all x≥0x \geq 0, have x3=x1/3\sqrt[3]{x} = x^{1/3} so this can be emulated by the following function: if (!math.cbrt) { math.cbrt = (function(pow) { return function cbrt(x){ // ensure negative numbers remain negative: return x < 0 ?
Math.ceil() - JavaScript
examples using math.ceil() the following example shows example usage of math.ceil().
Math.log10() - JavaScript
examples using math.log10() math.log10(2); // 0.3010299956639812 math.log10(1); // 0 math.log10(0); // -infinity math.log10(-2); // nan math.log10(100000); // 5 polyfill this can be emulated with the following function: math.log10 = math.log10 || function(x) { return math.log(x) * math.log10e; }; specifications specification ecmascript (ecma-262)the definition of 'math.log10' in that specification.
Math.log1p() - JavaScript
polyfill this can be emulated with the following function: math.log1p = math.log1p || function(x) { x = number(x); if (x < -1 || x !== x) return nan; if (x === 0 || x === infinity) return x; var nearx = (x + 1) - 1; return nearx === 0 ?
Math.max() - JavaScript
examples using math.max() math.max(10, 20); // 20 math.max(-10, -20); // -10 math.max(-10, 20); // 20 getting the maximum element of an array array.reduce() can be used to find the maximum element in a numeric array, by comparing each value: var arr = [1,2,3]; var max = arr.reduce(function(a, b) { return math.max(a, b); }); the following function uses function.prototype.apply() to get the maximum of an array.
Math.round() - JavaScript
if it is less than 0.5, the argument is rounded to the integer with the lower absolute value.
Math.tan() - JavaScript
examples using math.tan() math.tan(1); // 1.5574077246549023 because the math.tan() function accepts radians, but it is often easier to work with degrees, the following function accepts a value in degrees, converts it to radians and returns the tangent.
Math - JavaScript
in javascript, we can do this with the following: 50 * math.tan(degtorad(60)).
Number.MAX_VALUE - JavaScript
examples using max_value the following code multiplies two numeric values.
Number.NEGATIVE_INFINITY - JavaScript
examples using negative_infinity in the following example, the variable smallnumber is assigned a value that is smaller than the minimum value.
Number.POSITIVE_INFINITY - JavaScript
examples using positive_infinity in the following example, the variable bignumber is assigned a value that is larger than the maximum value.
Number.isNaN() - JavaScript
polyfill the following works because nan is the only value in javascript which is not equal to itself.
Number.prototype.toExponential() - JavaScript
implementations are allowed to support larger and smaller values as well.
Number.prototype.toFixed() - JavaScript
implementations are allowed to support larger and smaller values as chosen.
Number.prototype.toPrecision() - JavaScript
implementations are allowed to support larger and smaller values as well.
Number.prototype.toSource() - JavaScript
examples native function for the built-in number object, tosource() returns the following string indicating that the source code is not available: function number() { [native code] } for instances of number, tosource() returns a string representing the source code.
Object() constructor - JavaScript
examples creating a new object let o = new object() o.foo = 42 console.log(o) // object { foo: 42 } using object given undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(undefined) let o = new object(null) specifications specification ecmascript (ecma-262)the definition of 'object constructor' in that specification.
Object.prototype.__defineGetter__() - JavaScript
description the __definegetter__ allows a getter to be defined on a pre-existing object.
Object.prototype.__defineSetter__() - JavaScript
description the __definesetter__ method allows a setter to be defined on a pre-existing object.
Object.entries() - JavaScript
polyfill to add compatible object.entries() support in older environments that do not natively support it, you can use any of the following: a demonstration implementation of object.entries in the tc39/proposal-object-values-entries (if you don't need any support for ie); a polyfill in the es-shims/object.entries repositories; or, you can use the simple, ready-to-deploy polyfill listed below: if (!object.entries) { object.entries = function( obj ){ var ownprops = object.keys( obj ), i = ownprops.length, ...
Object.getOwnPropertyDescriptor() - JavaScript
a property descriptor is a record with some of the following attributes: value the value associated with the property (data descriptors only).
Object.is() - JavaScript
two values are the same if one of the following holds: both undefined both null both true or both false both strings of the same length with the same characters in the same order both the same object (means both object have same reference) both numbers and both +0 both -0 both nan or both non-zero and both not nan and both have the same value this is not the same as being equal according to the == operator.
Object.prototype.isPrototypeOf() - JavaScript
description the isprototypeof() method allows you to check whether or not an object exists within another object's prototype chain.
Object.keys() - JavaScript
polyfill to add compatible object.keys support in older environments that do not natively support it, copy the following snippet: // from /docs/web/javascript/reference/global_objects/object/keys if (!object.keys) { object.keys = (function() { 'use strict'; var hasownproperty = object.prototype.hasownproperty, hasdontenumbug = !({ tostring: null }).propertyisenumerable('tostring'), dontenums = [ 'tostring', 'tolocalestring', 'valueof', 'hasownpro...
Object.setPrototypeOf() - JavaScript
warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, currently a very slow operation in every browser and javascript engine.
Object.prototype.toLocaleString() - JavaScript
see the list below.
Promise.any() - JavaScript
const perr = new promise((resolve, reject) => { reject("always fails"); }); const pslow = new promise((resolve, reject) => { settimeout(resolve, 500, "done eventually"); }); const pfast = new promise((resolve, reject) => { settimeout(resolve, 100, "done quick"); }); promise.any([perr, pslow, pfast]).then((value) => { console.log(value); // pfast fulfils first }) // expected output: "done quick" rejections with aggregateerror promise.any() rejects with an aggregateerror ...
Promise.race() - JavaScript
examples asynchronicity of promise.race this following example demonstrates the asynchronicity of promise.race: // we are passing as argument an array of promises that are already resolved, // to trigger promise.race as soon as possible var resolvedpromisesarray = [promise.resolve(33), promise.resolve(44)]; var p = promise.race(resolvedpromisesarray); // immediately logging the value of p console.log(p); // using settimeout we can execute code ...
Promise.resolve() - JavaScript
has a "then" method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value.
Proxy.revocable() - JavaScript
description a revocable proxy is an object with following two properties {proxy: proxy, revoke: revoke}.
RangeError() constructor - JavaScript
the rangeerror() constructor creates an error when a value is not in the set or range of allowed values.
Comparing Reflect and Object methods - JavaScript
the table below details the differences between the methods available on the object and reflect apis.
Reflect.defineProperty() - JavaScript
description the reflect.defineproperty method allows precise addition to or modification of a property on an object.
Reflect.get() - JavaScript
description the reflect.get method allows you to get a property on an object.
Reflect.has() - JavaScript
description the reflect.has method allows you to check if a property is in an object.
Reflect.isExtensible() - JavaScript
description the reflect.isextensible method allows you determine if an object is extensible (whether it can have new properties added to it).
Reflect.preventExtensions() - JavaScript
description the reflect.preventextensions() method allows you to prevent new properties from ever being added to an object (i.e., prevents future extensions to the object).
Reflect.set() - JavaScript
description the reflect.set method allows you to set a property on an object.
Reflect - JavaScript
the reflect object provides the following static functions which have the same names as the proxy handler methods.
RegExp.prototype[@@match]() - JavaScript
for example, the following two examples return same result.
RegExp.prototype[@@matchAll]() - JavaScript
for example, the following two examples return same result.
RegExp.prototype[@@replace]() - JavaScript
for example, following two examples return same result.
RegExp.prototype[@@search]() - JavaScript
for example, the following two examples return the same result.
RegExp.prototype[@@split]() - JavaScript
for example, the following two examples return the same result.
RegExp.rightContext ($') - JavaScript
the non-standard rightcontext property is a static and read-only property of regular expressions that contains the substring following the most recent match.
RegExp.prototype.sticky - JavaScript
ith the sticky flag var str = '#foo#'; var regex = /foo/y; regex.lastindex = 1; regex.test(str); // true regex.lastindex = 5; regex.test(str); // false (lastindex is taken into account with sticky flag) regex.lastindex; // 0 (reset after match failure) anchored sticky flag for several versions, firefox's spidermonkey engine had a bug with regard to the ^ assertion and the sticky flag which allowed expressions starting with the ^ assertion and using the sticky flag to match when they shouldn't.
RegExp.prototype.toSource() - JavaScript
examples native function for the built-in regexp object, tosource() returns the following string indicating that the source code is not available: function regexp() { [native code] } for instances of regexp, tosource() returns a string representing the source code.
RegExp.prototype.toString() - JavaScript
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: ...
Set.prototype.delete() - JavaScript
let's checkout below how to delete an object from a set.
Set.prototype.forEach() - JavaScript
examples logging the contents of a set object the following code logs a line for each element in a set object: function logsetelements(value1, value2, set) { console.log('s[' + value1 + '] = ' + value2); } new set(['foo', 'bar', undefined]).foreach(logsetelements); // logs: // "s[foo] = foo" // "s[bar] = bar" // "s[undefined] = undefined" specifications specification ecmascript (ecma-262)the definition of 'set.prototype.fore...
String.prototype.big() - JavaScript
examples using big() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <fontsize=7>hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate ...
String.prototype.blink() - JavaScript
examples using blink() the following example uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ...
String.prototype.bold() - JavaScript
examples using bold() the following example uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.bold' in that specification.
String.prototype.concat() - JavaScript
examples using concat() the following example combines strings into a new string.
String.prototype.endsWith() - JavaScript
however, you can polyfill string.prototype.endswith() with the following snippet: if (!string.prototype.endswith) { string.prototype.endswith = function(search, this_len) { if (this_len === undefined || this_len > this.length) { this_len = this.length; } return this.substring(this_len - search.length, this_len) === search; }; } examples using endswith() let str = 'to be, or not to be, that is the question.' console.log(str.endswith('question.')) ...
String.prototype.fixed() - JavaScript
examples using fixed() the following example uses the fixed method to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.fixed()); // "<tt>hello, world</tt>" specifications specification ecmascript (ecma-262)the definition of 'string.prototype.fixed' in that specification.
String.prototype.fontcolor() - JavaScript
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.
String.prototype.fontsize() - JavaScript
examples using fontsize() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipula...
String.fromCharCode() - JavaScript
for this reason, it's more convenient to use string.fromcodepoint() (part of the es2015 standard), which allows for returning supplementary characters based on their actual code point value.
String.prototype.includes() - JavaScript
for example, the following expression returns false: 'blue whale'.includes('blue') // returns false polyfill this method has been added to the ecmascript 2015 specification and may not be available in all javascript implementations yet.
String.prototype.italics() - JavaScript
examples using italics() the following example uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.italics' in that specification.
String.prototype.lastIndexOf() - JavaScript
for example, the following expression returns -1: 'blue whale, killer whale'.lastindexof('blue'); // returns -1 examples using indexof() and lastindexof() the following example uses indexof() and lastindexof() to locate values in the string "brave new world".
String length - JavaScript
counts code units instead of characters, if you want to get the number of characters you need something like this: function getcharacterlength (str) { // the string iterator that is used here iterates over characters, // not mere code units return [...str].length; } console.log(getcharacterlength('a\ud87e\udc04z')); // 3 // while not recommended, you could add this to each string as follows: object.defineproperty(string.prototype, 'charlength', { get () { return getcharacterlength(this); } }); console.log('a\ud87e\udc04z'.charlength); // 3 examples basic usage let x = 'mozilla'; let empty = ''; console.log(x + ' is ' + x.length + ' code units long'); /* "mozilla is 7 code units long" */ console.log('the empty string has a length of ' + empty.length); // expected out...
String.prototype.link() - JavaScript
examples using link() the following example displays the word "mdn" as a hypertext link that returns the user to the mozilla developer network.
String.prototype.padEnd() - JavaScript
if the value is lower than str.length, the current string will be returned as-is.
String.raw() - JavaScript
// the following is equivalent to // `t${0}e${1}s${2}t`: string.raw({ raw: 'test' }, 0, 1, 2); // 't0e1s2t' specifications specification ecmascript (ecma-262)the definition of 'string.raw' in that specification.
String.prototype.small() - JavaScript
examples using small() the following example uses string methods to change the size of a string: var worldstring = 'hello, world'; console.log(worldstring.small()); // <small>hello, world</small> console.log(worldstring.big()); // <big>hello, world</big> console.log(worldstring.fontsize(7)); // <font size="7">hello, world</fontsize> with the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getelementbyid('yourelemid').style.fontsize ...
String.prototype.startsWith() - JavaScript
however, you can polyfill string.prototype.startswith() with the following snippet: if (!string.prototype.startswith) { object.defineproperty(string.prototype, 'startswith', { value: function(search, rawpos) { var pos = rawpos > 0 ?
String.prototype.strike() - JavaScript
examples using strike() the following example uses string methods to change the formatting of a string: var worldstring = 'hello, world'; console.log(worldstring.blink()); // <blink>hello, world</blink> console.log(worldstring.bold()); // <b>hello, world</b> console.log(worldstring.italics()); // <i>hello, world</i> console.log(worldstring.strike()); // <strike>hello, world</strike> specifications specification ecmascript (ecma-262)the definition of 'string.prototype.strike' in that sp...
String.prototype.sub() - JavaScript
examples using sub() and sup() methods the following example uses the sub() and sup() methods to format a string: var supertext = 'superscript'; var subtext = 'subscript'; console.log('this is what a ' + supertext.sup() + ' looks like.'); // this is what a <sup>superscript</sup> looks like console.log('this is what a ' + subtext.sub() + ' looks like.'); // this is what a <sub>subscript</sub> looks like.
String.prototype.substr() - JavaScript
to use this feature in jscript, you can use the following code: // only run when the substr() function is broken if ('ab'.substr(-1) != 'b') { /** * get the substring of a string * @param {integer} start where to start the substring * @param {integer} length how many characters to return * @return {string} */ string.prototype.substr = function(substr) { return function(start, length) { // call the original met...
String.prototype.sup() - JavaScript
examples using sub() and sup() methods the following example uses the sub() and sup() methods to format a string: var supertext = 'superscript'; var subtext = 'subscript'; console.log('this is what a ' + supertext.sup() + ' looks like.'); // "this is what a <sup>superscript</sup> looks like." console.log('this is what a ' + subtext.sub() + ' looks like.'); // "this is what a <sub>subscript</sub> looks like." specifications specification ecmascript (ecma-262)the definition of 'string.prototype.sup' in that specif...
String.prototype.toSource() - JavaScript
examples native function for the built-in string object, tosource() returns the following string indicating that the source code is not available: function string() { [native code] } for instances of string or string literals, tosource() returns a string representing the source code.
String.prototype.toString() - JavaScript
examples using tostring() the following example displays the string value of a string object: var x = new string('hello world'); console.log(x.tostring()); // logs 'hello world' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.tostring' in that specification.
String.prototype.trimEnd() - JavaScript
in some engines this means: string.prototype.trimright.name === "trimend"; examples using trimend() the following example displays the lowercase string ' foo': var str = ' foo '; console.log(str.length); // 8 str = str.trimend(); console.log(str.length); // 6 console.log(str); // ' foo' specifications specification ecmascript (ecma-262)the definition of 'string.prototype.trimend' in that specification.
String.prototype.trimStart() - JavaScript
} } })(proto,'trimstart'); })(window); /* es6: (w=>{ const string=w.string, proto=string.prototype; ((o,p)=>{ if(p in o?o[p]?false:true:true){ const r=/^\s+/; o[p]=o.trimleft||function(){ return this.replace(r,'') } } })(proto,'trimstart'); })(window); */ examples using trimstart() the following example displays the lowercase string 'foo ': var str = ' foo '; console.log(str.length); // 8 str = str.trimstart(); console.log(str.length); // 5 console.log(str); // 'foo ' specifications specification ecmascript (ecma-262)the definition of ' string.prototype.trimstart' in that specification.
Symbol() constructor - JavaScript
it creates a new symbol each time: symbol('foo') === symbol('foo') // false new symbol(...) the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number).
Symbol.for() - JavaScript
global symbol registry the global symbol registry is a list with the following record structure and it is initialized empty: a record in the global symbol registry field name value [[key]] a string key used to identify a symbol.
Symbol.match - JavaScript
property attributes of symbol.match writable no enumerable no configurable no examples disabling the isregexp check the following code will throw a typeerror: '/bar/'.startswith(/bar/); // throws typeerror, as /bar/ is a regular expression // and symbol.match is not modified.
Symbol.matchAll - JavaScript
the following two examples return same result: 'abc'.matchall(/a/); /a/[symbol.matchall]('abc'); this method exists for customizing match behavior within regexp subclasses.
Symbol.search - JavaScript
property attributes of symbol.search writable no enumerable no configurable no examples custom string search class caseinsensitivesearch { constructor(value) { this.value = value.tolowercase(); } [symbol.search](string) { return string.tolowercase().indexof(this.value); } } console.log('foobar'.search(new caseinsensitivesearch('bar'))); // expected output: 3 specifications specification ecmascript (ecma-262)the definition of 'symbol.search' in that specification.
Symbol.species - JavaScript
description the species accessor property allows subclasses to override the default constructor for objects.
Symbol.toPrimitive - JavaScript
property attributes of symbol.toprimitive writable no enumerable no configurable no examples modifying primitive values converted from an object following example describes how symbol.toprimitive property can modify the primitive value converted from an object.
Symbol.prototype.toSource() - JavaScript
examples native function for the built-in symbol object, tosource returns the following string indicating that the source code is not available: "function symbol() { [native code] }" for instances of symbol, tosource returns a string representing the source code.
Symbol.unscopables - JavaScript
property attributes of symbol.unscopables writable no enumerable no configurable no examples scoping in with statements the following code works fine in es5 and below.
Symbol - JavaScript
it creates a new symbol each time: symbol('foo') === symbol('foo') // false the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this prevents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number).
TypedArray.prototype.every() - JavaScript
examples testing size of all typed array elements the following example tests whether all elements in the typed array are bigger than 10.
TypedArray.prototype.fill() - JavaScript
use the following "polyfill" along with the array.prototype.fill() polyfill.
TypedArray.prototype.filter() - JavaScript
examples filtering out all small values the following example uses filter() to create a filtered typed array that has all elements with values less than 10 removed.
TypedArray.prototype.find() - JavaScript
examples find a prime number in a typed array the following example finds an element in the typed array that is a prime number (or returns undefined if there is no prime number).
TypedArray.prototype.findIndex() - JavaScript
for (i in this) { if (evaluator(this[i], i, this)) { return i; } } return -1; } for (i in this) { if (evaluator.call(thisarg, this[i], i, this)) { return i; } } return -1; }; examples find the index of a prime number in a typed array the following example finds the index of an element in the typed array that is a prime number (or returns -1 if there is no prime number).
TypedArray.prototype.forEach() - JavaScript
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 tha...
TypedArray.prototype.reduce() - JavaScript
syntax typedarray.reduce(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
TypedArray.prototype.reduceRight() - JavaScript
syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: previousvalue the value previously returned in the last invocation of the callback, or initialvalue, if supplied (see below).
TypedArray.prototype.some() - JavaScript
examples testing size of all typed array elements the following example tests whether any element in the typed array is bigger than 10.
TypedArray.prototype.toString() - JavaScript
for example, the following code creates a typed array and uses tostring to convert the array to a string.
WeakMap - JavaScript
primitive data types as keys are not allowed (e.g.
WeakRef - JavaScript
note: please see the avoid where possible section below.
WebAssembly.CompileError() constructor - JavaScript
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" console.log(e.name); // "compileerror" console.log(e.filename); // "somefile" console.l...
WebAssembly.CompileError - JavaScript
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" console.log(e.name); // "compileerror" console.log(e.filename); // "somefile" console.l...
WebAssembly.Instance.prototype.exports - JavaScript
the exports readonly property of the webassembly.instance object prototype returns an object containing as its members all the functions exported from the webassembly module instance, to allow them to be accessed and used by javascript.
WebAssembly.LinkError() constructor - JavaScript
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" console.log(e.name); // "linkerror" console.log(e.filename); // "somefile" console.log(e.linenum...
WebAssembly.LinkError - JavaScript
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" console.log(e.name); // "linkerror" console.log(e.filename); // "somefile" console.log(e.linenum...
WebAssembly.Memory.prototype.buffer - JavaScript
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.
WebAssembly.Memory.prototype.grow() - JavaScript
examples using grow the following example creates a new webassembly memory instance with an initial size of 1 page (64kib), and a maximum size of 10 pages (640kib).
WebAssembly.Module.exports() - JavaScript
examples using exports the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends it to a worker using postmessage().
WebAssembly.Module.imports() - JavaScript
examples using imports the following example (see imports.html source code; see it live also) compiles the loaded simple.wasm module.
WebAssembly.Module - JavaScript
examples sending a compiled module to a worker the following example (see our index-compile.html demo on github, and view it live also) compiles the loaded simple.wasm byte code using the webassembly.compilestreaming() method and then sends the resulting module instance to a worker using postmessage().
WebAssembly.RuntimeError() constructor - JavaScript
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" console.log(e.name); // "runtimeerror" console.log(e.filename); // "somefile" console.l...
WebAssembly.RuntimeError - JavaScript
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" console.log(e.name); // "runtimeerror" console.log(e.filename); // "somefile" console.l...
WebAssembly.Table.prototype.get() - JavaScript
examples using get the following example (see table.html on github, and view it live also) compiles and instantiates the loaded table.wasm byte code using the webassembly.instantiatestreaming() method.
WebAssembly.Table.prototype.set() - JavaScript
examples using table.set the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 references.
WebAssembly.Table - JavaScript
examples creating a new webassembly table instance the following example (see table2.html source code and live version) creates a new webassembly table instance with an initial size of 2 elements.
WebAssembly.compile() - JavaScript
examples using compile the following example compiles the loaded simple.wasm byte code using the compile() function and then sends it to a worker using postmessage().
WebAssembly.compileStreaming() - JavaScript
examples compile streaming the following example (see our compile-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles it to a webassembly.module object.
WebAssembly.instantiateStreaming() - JavaScript
examples instantiating streaming the following example (see our instantiate-streaming.html demo on github, and view it live also) directly streams a .wasm module from an underlying source then compiles and instantiates it, the promise fulfilling with a resultobject.
WebAssembly.validate() - JavaScript
examples using validate the following example (see the validate.html source code, and see it live too) fetches a .wasm module and converts it into a typed array.
escape() - JavaScript
note: this function was used mostly for url queries (the part of a url following ?)—not for escaping ordinary string literals, which use the format "\xhh".
isNaN() - JavaScript
such values do not necessarily represent overflow conditions.
undefined - JavaScript
in the following code, the variable x is not initialized, and the if statement evaluates to true.
Addition assignment (+=) - JavaScript
syntax operator: x += y meaning: x = x + y examples using addition assignment // assuming the following variables // foo = 'foo' // bar = 5 // baz = true // number + number -> addition bar += 2 // 7 // boolean + number -> addition baz += 1 // 2 // boolean + boolean -> addition baz += false // 1 // number + string -> concatenation bar += 'foo' // "5foo" // string + boolean -> concatenation foo += false // "foofalse" // string + string -> concatenation foo += 'bar' // "foobar" specificat...
Assignment (=) - JavaScript
syntax operator: x = y examples simple assignment and chaining // assuming the following variables // x = 5 // y = 10 // z = 25 x = y // x is 10 x = y = z // x, y and z are all 25 specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Bitwise AND (&) - JavaScript
for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to second bit, and so on.
Bitwise NOT (~) - JavaScript
for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to second bit, and so on.
Bitwise OR (|) - JavaScript
for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to second bit, and so on.
Bitwise XOR (^) - JavaScript
for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to first bit, second bit to second bit, and so on.
Division assignment (/=) - JavaScript
syntax operator: x /= y meaning: x = x / y examples using division assignment // assuming the following variable // bar = 5 bar /= 2 // 2.5 bar /= 'foo' // nan bar /= 0 // infinity specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Exponentiation (**) - JavaScript
for example, in bash, the ** operator is defined to have a lower precedence than unary operators.
Exponentiation assignment (**=) - JavaScript
syntax operator: x **= y meaning: x = x ** y examples using exponentiation assignment // assuming the following variable // bar = 5 bar **= 2 // 25 bar **= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Grouping operator ( ) - JavaScript
syntax ( ) description the grouping operator consists of a pair of parentheses around an expression or sub-expression to override the normal operator precedence so that expressions with lower precedence can be evaluated before an expression with higher priority.
Inequality (!=) - JavaScript
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.
Less than (<) - JavaScript
syntax x < y description the operands are compared using the abstract relational comparison algorithm, which is roughly summarised below: first, objects are converted to primitives using symbol.toprimitive.
Logical OR assignment (||=) - JavaScript
in other words, x ||= y is equivalent to: x || (x = y); and not equivalent to the following which would always perform an assignment: x = x || y; note that this behavior is different to mathematical and bitwise assignment operators.
Multiplication assignment (*=) - JavaScript
syntax operator: x *= y meaning: x = x * y examples using multiplication assignment // assuming the following variable // bar = 5 bar *= 2 // 10 bar *= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Nullish coalescing operator (??) - JavaScript
see below for more examples.
Optional chaining (?.) - JavaScript
this is equivalent to the following, except that the temporary variable is in fact not created: let temp = obj.first; let nestedprop = ((temp === null || temp === undefined) ?
Pipeline operator (|>) - JavaScript
this allows the creation of chained function calls in a readable manner.
Remainder assignment (%=) - JavaScript
syntax operator: x %= y meaning: x = x % y examples using remainder assignment // assuming the following variable // bar = 5 bar %= 2 // 1 bar %= 'foo' // nan bar %= 0 // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
Strict inequality (!==) - JavaScript
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.
Subtraction assignment (-=) - JavaScript
syntax operator: x -= y meaning: x = x - y examples using subtraction assignment // assuming the following variable // bar = 5 bar -= 2 // 3 bar -= 'foo' // nan specifications specification ecmascript (ecma-262)the definition of 'assignment operators' in that specification.
function* expression - JavaScript
examples using function* the following example defines an unnamed generator function and assigns it to x.
in operator - JavaScript
examples basic usage the following examples show some uses of the in operator.
yield* - JavaScript
examples delegating to another generator in following code, values yielded by g1() are returned from next() calls just like those which are yielded by g2().
block - JavaScript
it allows you to use multiple statements where javascript expects only one statement.
debugger - JavaScript
syntax debugger; examples using the debugger statement the following example shows code where a debugger statement has been inserted, to invoke a debugger (if one exists) when the function is called.
function* - JavaScript
the function* declaration (function keyword followed by an asterisk) defines a generator function, which returns a generator object.
function declaration - JavaScript
you can use the function before you declared it: hoisted(); // logs "foo" function hoisted() { console.log('foo'); } note that function expressions are not hoisted: nothoisted(); // typeerror: nothoisted is not a function var nothoisted = function() { console.log('bar'); }; examples using function the following code declares a function that returns the total amount of sales, when given the number of units sold of products a, b, and c.
if...else - JavaScript
for example, do not use the following code: if (x = y) { /* do something */ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment.
var - JavaScript
this is called hoisting, and is discussed further below.
Transitioning to strict mode - JavaScript
differences from non-strict to strict syntax errors when adding 'use strict';, the following cases will throw a syntaxerror before the script is executing: octal syntax var n = 023; with statement using delete on a variable name delete myvariable; using eval or arguments as variable or function argument name using one of the newly reserved keywords (in prevision for ecmascript 2015): implements, interface, let, package, private, protected, public, static, and yield declaring f...
JavaScript reference - JavaScript
format intl.displaynames intl.listformat intl.locale intl.numberformat intl.pluralrules intl.relativetimeformat webassembly webassembly webassembly.module webassembly.instance webassembly.memory webassembly.table webassembly.compileerror webassembly.linkerror webassembly.runtimeerror statements javascript statements and declarations control flowblock break continue empty if...else switch throw try...catch declarations var let const functions and classes function function* async function return class iterations do...while for for each...in for...in for...of for await...of while other debugger import label with expressions and operators javascript express...
dir - Web app manifests
WebManifestdir
the dir member can be set to one of the following values: auto — text direction is determined by the user agent ltr — left to right rtl — right to left the directionality-capable members are: name short_name description note: if the value is omitted or set to auto, the browser will use the unicode bidirectional algorithm to make a best guess about the text's direction.
orientation - Web app manifests
values orientation can take one of the following values: any natural landscape landscape-primary landscape-secondary portrait portrait-primary portrait-secondary examples "orientation": "portrait-primary" specification specification status comment feedback web app manifestthe definition of 'orientation' in that specification.
related_applications - Web app manifests
examples "related_applications": [ { "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.example.app1", "id": "com.example.app1" }, { "platform": "itunes", "url": "https://itunes.apple.com/app/example-app1/id123456789" } ] related application values application objects may contain the following values: member description platform the platform on which the application can be found.
scope - Web app manifests
examples if the scope is relative, the manifest url is used as a base url: "scope": "/app/" the following scope limits navigation to the current site: "scope": "https://example.com/" finally, the following example limits navigation to a subdirectory of the current site: "scope": "https://example.com/subdirectory/" specification specification status comment feedback web app manifestthe definition of 'scope' in that specification.
serviceworker - Web app manifests
examples "serviceworker": { "src": "./serviceworker.js", "scope": "/app", "type": "", "update_via_cache": "none" } values service worker contain the following values (only src is required): member description src the url to download the service worker script from.
shortcuts - Web app manifests
examples the following is a list of shortcuts a calendar app might have: "shortcuts" : [ { "name": "today's agenda", "url": "/today", "description": "list of events planned for today" }, { "name": "new event", "url": "/create/event" }, { "name": "new reminder", "url": "/create/reminder" } ] specification specification status comment feedback ...
start_url - Web app manifests
note: the start_url member is purely advisory, and a user agent may ignore it or allow the user to alter it at install time or afterwards.
Values - MathML
constants a replacement for the deprecated constants below is: veryverythinmathspace => 0.05555555555555555em verythinmathspace => 0.1111111111111111em thinmathspace => 0.16666666666666666em mediummathspace => 0.2222222222222222em thickmathspace => 0.2777777777777778em verythickmathspace => 0.3333333333333333em veryverythickmathspace => 0.3888888888888889em constant value veryverythinmathspace ...
<maction> - MathML
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> <mn>2</mn> </mrow> <mrow> <mn>4</mn> <mo>&sdot;</mo> <mn>2</mn> </mrow> </mfrac> <mfrac> <mn>3</mn> <mn>4</mn> </mfrac> </maction> </math> specificatio...
<menclose> - MathML
a2 + b2 box roundedbox a2 + b2 rounded box circle a2 + b2 circle left a2 + b2 line to the left of the contents right a2 + b2 line to the right of the contents top a2 + b2 line above of the contents bottom a2 + b2 line below of the contents updiagonalstrike a2 + b2 strikeout line through contents from lower left to upper right downdiagonalstrike a2 + b2 strikeout line through contents from upper left to lower right verticalstrike a2 + b2 vertical strikeout line through contents horizontalstrike a2 + b2 ...
<mi> - MathML
WebMathMLElementmi
the following values are allowed: normal (default value for more than one character) ; example bold ; example italic (default value for a single character) ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; example fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-...
<mover> - MathML
WebMathMLElementmover
use the following syntax: <mover> base overscript </mover> attributes accent if true the over-script is an accent, which is drawn closer to the base expression.
<mpadded> - MathML
prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) the mathml2 pseudo-unit lspace was allowed, which is no longer present in the mathml3 recommendation and has been removed now.
<mrow> - MathML
WebMathMLElementmrow
it allows for more intelligent line-breaking and indentation.
<ms> - MathML
WebMathMLElementms
the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; example fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-serif-bold-italic ; example monospace ; example initial ; ...
<mspace> - MathML
WebMathMLElementmspace
depth the desired depth (below the baseline) of the space (see length for values and units).
<msqrt> - MathML
WebMathMLElementmsqrt
the square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>.
<msup> - MathML
WebMathMLElementmsup
it uses the following syntax: <msup> base superscript </msup>.
<mtext> - MathML
WebMathMLElementmtext
the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ; example script ; example bold-script ; example fraktur ; example sans-serif ; example bold-sans-serif ; example sans-serif-italic ; example sans-serif-bold-italic ; example monospace ; example normal (de...
<munder> - MathML
WebMathMLElementmunder
it uses the following syntax: <munder> base underscript </munder> attributes accentunder if true, the element is an accent, which is drawn closer to the base expression.
<munderover> - MathML
it uses the following syntax: <munderover> base underscript overscript </munderover> attributes accent if true, the overscript is an accent, which is drawn closer to the base expression.
Examples - MathML
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.
Media type and format guide: image, audio, and video content - Web media technologies
WebMediaFormats
web audio codec guide a guide to the audio codecs allowed for by the common media containers, as well as by the major browsers.
Guide to streaming audio and video - Web media technologies
hls uses playlists to allow the user to not only select the media to stream, but also to choose among versions or forms of the same media.
Using images in HTML - Web media technologies
WebMediaimages
it supports a wide range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image.
Lazy loading - Web Performance
polyfill include this polyfill to provide support for older and currently incompatible browsers: loading-attribute-polyfill intersection observer api intersection observers allow the user to know when an observed element enters or exits the browser’s viewport.
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
knowing your user trends helps you better define your business plan and, from a monitoring perspective, allows you to identify key areas to target for optimization and performance improvements.
Using dns-prefetch - Web Performance
this could be a file loaded later or link target a user tries to follow.
PWA developer guide - Progressive web apps (PWAs)
--->>> titles below are just for the list; give articles good seo names and feel free to tweak those and this as needed...
Progressive loading - Progressive web apps (PWAs)
we'll expain this below.
Responsive Navigation Patterns - Progressive web apps (PWAs)
the following present several ways to handle navigation on large and small screens.
Web technology reference
below you'll find links to a selection of key documentation for each.
alphabetic - SVG: Scalable Vector Graphics
the alphabetic attribute defines the lower baseline of a font.
bbox - SVG: Scalable Vector Graphics
WebSVGAttributebbox
only one element is using this attribute: <font-face> usage notes value <string> default value none animatable no <string> a comma-separated list of exactly four numbers specifying, in order, the lower left x, lower left y, upper right x, and upper right y of the bounding box for the complete font.
bias - SVG: Scalable Vector Graphics
WebSVGAttributebias
this allows representation of values that would otherwise be clamped to 0 or 1.
by - SVG: Scalable Vector Graphics
WebSVGAttributeby
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"> <animate attributename="width" fill="freeze" by="50" dur="3s"/> </rect> </svg> usage notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated.
clip-path - SVG: Scalable Vector Graphics
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> html,body,svg { height:100% } <svg viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <clippath id="myclip" clippathunits="objectboundingbox"> <circle cx=".5" cy=".5" r=".5" /> </clippath> <!-- top-left: apply a custom defined clipping path --> <rect x="1" y="1" width="8" height="8" strok...
color-interpolation-filters - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element 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 ...
color-interpolation - SVG: Scalable Vector Graphics
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>, <defs>, <ellipse>, <foreignobject>, <g>, <glyph>, <image>, <line>, <lineargradient>, <marker>, <mask>, <missing-glyph>, <path>, <pattern>, <polygon>, <polyline>, <radialgradient>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, and <use> usage notes value auto | srgb | linearrgb default va...
color-profile - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it only has an effect on the following element: <image> usage notes value auto | srgb | <name> | <iri> default value auto animatable yes auto all colors are presumed to be defined in the srgb color space unless a more precise embedded profile is specified within content data.
color-rendering - SVG: Scalable Vector Graphics
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>, <defs>, <ellipse>, <foreignobject>, <g>, <glyph>, <image>, <line>, <lineargradient>, <marker>, <mask>, <missing-glyph>, <path>, <pattern>, <polygon>, <polyline>, <radialgradient>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, and <use> html, body, svg { height: 100%; } <svg viewbox="0 0 480 200" xmlns="...
cursor - SVG: Scalable Vector Graphics
WebSVGAttributecursor
elements the following elements can use the cursor attribute container elements » graphics elements » browser compatibility the compatibility table on this page is generated from structured data.
data-* - SVG: Scalable Vector Graphics
WebSVGAttributedata-*
the * can be replaced by any characters allowed in xml's rules for names, with the following restrictions: can't start with xml.
direction - SVG: Scalable Vector Graphics
for other cases, such as when using right-to-left languages, it may be sufficient to add the direction attribute to the outermost <svg> element, and allow that direction to inherit to all text elements: note: as a presentation attribute, direction can be used as a css property.
fill-rule - SVG: Scalable Vector Graphics
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.
fill - SVG: Scalable Vector Graphics
WebSVGAttributefill
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>.
filterRes - SVG: Scalable Vector Graphics
too large of a value may result in slow processing and large memory usage.
flood-color - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following two elements: <feflood> and <fedropshadow> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="flood1"> <feflood flood-color="skyblue" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="seagreen" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood2)...
flood-opacity - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following two elements: <feflood> and <fedropshadow> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="flood1"> <feflood flood-color="seagreen" flood-opacity="1" x="0" y="0" width="200" height="200"/> </filter> <filter id="flood2"> <feflood flood-color="seagreen" flood-opacity="0.3" x="0" y="0" width="200" height="200"/> </filter> <rect x="0" y="0" width="200" height="200" style="filter: url(#flood1);" /> <rect x="0" y="0" widt...
font-family - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-family="arial, helvetica, sans-serif">sans serif</text> <text x="100" y="20" font-family="monospace">monospace</text> </svg> usage notes value [ <family-name> | <generic-family> ]#where ...
font-size - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-size="smaller">smaller</text> <text x="100" y="20" font-size="2em">2em</text> </svg> usage notes value <absolute-size> | <relative-size> | <length-percentage> default value medium ...
font-stretch - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> usage notes value <font-stretch-absolute>where <font-stretch-absolute> = normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage> default value normal animatable yes specifications specification status comment ...
font-style - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but only has an effect on the following five elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-style="normal">normal font style</text> <text x="150" y="20" font-style="italic">italic font style</text> </svg> usage notes value normal | italic | oblique default value normal animatable yes for a description of th...
font-variant - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 250 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-variant="normal">normal text</text> <text x="100" y="20" font-variant="small-caps">small-caps text</text> </svg> usage notes value normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contex...
font-weight - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 200 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" font-weight="normal">normal text</text> <text x="100" y="20" font-weight="bold">bold text</text> </svg> usage notes value normal | bold | bolder | lighter | <number> default value normal an...
from - SVG: Scalable Vector Graphics
WebSVGAttributefrom
four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> html, body, svg { height: 100%; } <svg viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" height="100"> <animate attributename="width" fill="freeze" from="100" to="150" dur="3s"/> </rect> </svg> usage notes value see below default value none animatable no the exact value type for this attribute depends on the value of the attribute that will be animated.
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value <angle> default value 0deg animatable no <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees.
glyph-orientation-vertical - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value auto | <angle> default value auto animatable no auto fullwidth ideographic and fullwidth latin text will be set with a glyph orientation of 0 degrees.
gradientTransform - SVG: Scalable Vector Graphics
this allows for things such as skewing the gradient.
id - SVG: Scalable Vector Graphics
WebSVGAttributeid
candidate recommendation defines the allowed values in more detail.
image-rendering - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following element: <image> usage notes value auto | optimizespeed | optimizequality default value auto animatable yes auto indicates that the user agent shall make appropriate tradeoffs to balance speed and quality, but quality shall be given more importance than speed.
in - SVG: Scalable Vector Graphics
WebSVGAttributein
the value can be either one of the six keywords defined below, or a string which matches a previous result attribute value within the same <filter> element.
k1 - SVG: Scalable Vector Graphics
WebSVGAttributek1
the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0"...
k2 - SVG: Scalable Vector Graphics
WebSVGAttributek2
the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="1" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="10" k3="0" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0"...
k3 - SVG: Scalable Vector Graphics
WebSVGAttributek3
the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="1" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="10" k4="0" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="0"...
k4 - SVG: Scalable Vector Graphics
WebSVGAttributek4
the pixel composition is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 only one element is using this attribute: <fecomposite> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <filter id="composite1" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="1" k2="0" k3="0" k4="0" /> </filter> <filter id="composite2" x="0" y="0" width="100%" height="100%"> <fecomposite in2="sourcegraphic" operator="arithmetic" k1="10" k2="0" k3="0" k4="0.3" /> </filter> <image href="https://mdn.mozillademos.org/files/12668/mdn.svg" x="...
kerning - SVG: Scalable Vector Graphics
WebSVGAttributekerning
as a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> html, body, svg { height: 100%; font: 36px verdana, helvetica, arial, sans-serif; } <svg viewbox="0 0 150 125" xmlns="http://www.w3.org/2000/svg"> <text x="10" y="30" kerning="auto">auto</text> <text x="10" y="70" kerning="0">number</text> <text x="10" y="110" kerning="20px">length</text> </svg> usage notes ...
keyPoints - SVG: Scalable Vector Graphics
if there's a semicolon at the end of the value, optionally followed by white space, both the semicolon and the trailing white space are ignored.
letter-spacing - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <altglyph>, <text>, <textpath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewbox="0 0 400 30" xmlns="http://www.w3.org/2000/svg"> <text y="20" letter-spacing="2">bigger letter-spacing</text> <text x="200" y="20" letter-spacing="-0.5">smaller letter-spacing</text> </svg> usage notes value normal | <length> default value n...
marker-end - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, 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="...
marker-mid - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, 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="bla...
marker-start - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, 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="...
markerHeight - SVG: Scalable Vector Graphics
candidate recommendation allowed percentage and number values.
markerWidth - SVG: Scalable Vector Graphics
candidate recommendation allowed percentage and number values.
name - SVG: Scalable Vector Graphics
WebSVGAttributename
unlike the syntax allowed between the parentheses of the local(…) clause in an @font-face rule src descriptor, the font name specified in this attribute is not surrounded in single or double quotes.
opacity - SVG: Scalable Vector Graphics
WebSVGAttributeopacity
as a presentation attribute, it can be applied to any element 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" ...
operator - SVG: Scalable Vector Graphics
arithmetic this value indicates that the source graphic defined in the in attribute and the destination graphic defined in the in2 attribute are combined using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 where: i1 and i2 indicate the corresponding pixel channel values of the input image, which map to in and in2 respectively, and k1,k2,k3,and k4 indicate the values of the attributes with the same name.
orient - SVG: Scalable Vector Graphics
WebSVGAttributeorient
note: this allows a single arrowhead marker to be defined that can be used for both the start and end of a path, i.e.
overline-position - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the overline-position attribute: <font-face> ...
overline-thickness - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the overline-thickness attribute: <font-face> ...
patternTransform - SVG: Scalable Vector Graphics
note: as of svg2, it is also allowed to use the css transform property.
rendering-intent - SVG: Scalable Vector Graphics
only one element is using this attribute: <color-profile> usage notes value auto | perceptual | relative-colorimetric | saturation | absolute-colorimetric default value auto animatable yes auto this value allows the user agent to determine the best intent based on the content type.
rotate - SVG: Scalable Vector Graphics
WebSVGAttributerotate
usage notes value auto | auto-reverse | <number> default value 0 animatable no the auto and auto-reverse values allow the animated element's rotation to change dynamically as it travels along the path.
rx - SVG: Scalable Vector Graphics
WebSVGAttributerx
with a value lower or equal to zero the ellipse won't be drawn at all.
ry - SVG: Scalable Vector Graphics
WebSVGAttributery
with a value lower or equal to zero the ellipse won't be drawn at all.
shape-rendering - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <circle cx="100" cy="100" r="100" shape-rendering="geometricprecision"/> <circle cx="320" cy="100" r="100" shape-rendering="crispedges"/> </svg> usage notes value auto | optimizespeed | crispedges | geometricprecision default value auto ...
startOffset - SVG: Scalable Vector Graphics
150%) are allowed.
stemh - SVG: Scalable Vector Graphics
WebSVGAttributestemh
for example, the main vertical stems of roman characters will differ from the thin stems on serifed "m" and "n", plus there may be different widths for uppercase and lowercase characters in the same font.
stop-color - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following element: <stop> usage notes value currentcolor | <color> <icccolor> default value black animatable yes currentcolor this keyword denotes the current fill color and can be specified in the same manner as within a <paint> specification for the fill and stroke attributes.
strikethrough-position - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the strikethrough-position attribute: <font-face> ...
strikethrough-thickness - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the strikethrough-thickness attribute: <font-face> ...
stroke-dasharray - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element, but it only has effect on the following twelve elements: <altglyph> <circle> <ellipse> <path> <line> <polygon> <polyline> <rect> <text> <textpath> <tref> <tspan> html,body,svg { height:100% } <svg viewbox="0 0 30 10" xmlns="http://www.w3.org/2000/svg"> <!-- no dashes nor gaps --> <line x1="0" y1="1" x2="30" y2="1" stroke="black" /> <!-- dashes and gaps of the same size --> <line x1="0" y1="3" x2="30" y2="3" stroke="black" stroke-dasharray="4" /> <!-- dashes and gap...
stroke - SVG: Scalable Vector Graphics
WebSVGAttributestroke
as a presentation attribute, it can be applied to any element but it has effect only on the following 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="g...
style - SVG: Scalable Vector Graphics
WebSVGAttributestyle
the style attribute allows to style an element using css declarations.
tabindex - SVG: Scalable Vector Graphics
the tabindex attribute allows you to control whether an element is focusable and to define the relative order of the element for the purposes of sequential focus navigation.
target - SVG: Scalable Vector Graphics
WebSVGAttributetarget
the name must be a valid xml name [xml11], and should not start with an underscore (u+005f low line character), to meet the requirements of a valid browsing context name from html.
text-anchor - SVG: Scalable Vector Graphics
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 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- materialisation of anchors --> <path d="m60,15 l60,110 m30,40 l90,40 m30,75 l90,75 m30,110 l90,110" stroke="grey" /> <!-- anchors in action --> <text text-anchor="start" x="60" y="40">a</text> <text text-ancho...
text-decoration - SVG: Scalable Vector Graphics
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-deco...
text-rendering - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following element: <text> html, body, svg { height: 100%; } <svg viewbox="0 0 140 40" xmlns="http://www.w3.org/2000/svg"> <text y="15" text-rendering="geometricprecision">geometric precision</text> <text y="35" text-rendering="optimizelegibility">optimized legibility</text> </svg> usage notes value auto | optimizespeed | optimizelegibility | geometricprecision default value auto animatable yes a...
textLength - SVG: Scalable Vector Graphics
candidate recommendation allowed percentages and numbers as values.
underline-position - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the underline-position attribute: <font-face> ...
underline-thickness - SVG: Scalable Vector Graphics
usage context categories none value <number> animatable no normative document svg 1.1 (2nd edition) elements the following elements can use the underline-thickness attribute: <font-face> ...
unicode-bidi - SVG: Scalable Vector Graphics
as a presentation attribute, it can be applied to any element but it has effect only on the following eleven elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value normal | embed | isolate | bidi-override | isolate-override | plaintext default value normal animatable no for a description of the values, please refer to the css unicode-bidi property.
vector-effect - SVG: Scalable Vector Graphics
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.
version - SVG: Scalable Vector Graphics
WebSVGAttributeversion
it is only allowed on the root <svg> element.
viewBox - SVG: Scalable Vector Graphics
WebSVGAttributeviewBox
note: values for width or height lower or equal to 0 disable rendering of the element.
word-spacing - SVG: Scalable Vector Graphics
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" word-spacing="2">bigger spacing between words</text> <text x="0" y="40" word-spacing="-0.5">smaller spacing between words</text> </svg> usage notes value normal | <length> animatable ...
Compatibility sources - SVG: Scalable Vector Graphics
the following sources are used for the compatibility tables on svg elements and attributes: https://developer.mozilla.org/en/svg_in_firefox together with its revision history for firefox http://www.webkit.org/projects/svg/status.xml together with its recorded archive for webkit, safari and chrome http://www.opera.com/docs/specs/opera9/svg/ and accompanying pages for opera >= 9, http://www.opera.com/docs/specs/opera8/ for opera 8 http://blogs.msdn.com/b/ie/archive/2010/03/18/svg-in-ie9-roadmap.aspx for hints on ie9 support status the svg support charts at codedread.com for basic checks against the w3c test suite wikipedia for basic hints, not normative ...
<altGlyph> - SVG: Scalable Vector Graphics
WebSVGElementaltGlyph
the <altglyph> svg element allows sophisticated selection of the glyphs used to render its child character data.
<animateColor> - SVG: Scalable Vector Graphics
usage context categoriesbasic shape element, graphics element, shape elementpermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes conditional processing attributes core attributes animation event attributes xlink attributes animation attribute target attributes animation timing attributes animation value attributes animation addition attributes externalresourcesrequired specific attributes by from to dom interface this element...
<animateMotion> - SVG: Scalable Vector Graphics
100" xmlns="http://www.w3.org/2000/svg"> <path fill="none" stroke="lightgrey" d="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> <circle r="5" fill="red"> <animatemotion dur="10s" repeatcount="indefinite" path="m20,50 c20,-50 180,150 180,50 c180-50 20,150 20,50 z" /> </circle> </svg> usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<mpath> attributes keypoints this attribute indicate, in the range [0,1], how far is the object along the path for each keytimes associated values.
<clipPath> - SVG: Scalable Vector Graphics
WebSVGElementclipPath
ons, 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>' in that specification.
<cursor> - SVG: Scalable Vector Graphics
WebSVGElementcursor
usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes conditional processing attributes core attributes xlink attributes externalresourcesrequired specific attributes x y xlink:href dom interface this element implements the svgcursorelement interface.
<defs> - SVG: Scalable Vector Graphics
WebSVGElementdefs
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>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphi...
<feBlend> - SVG: Scalable Vector Graphics
WebSVGElementfeBlend
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 mode dom interface this element implements the svgfeblendelement interface.
<feComposite> - SVG: Scalable Vector Graphics
if the arithmetic operation is chosen, each result pixel is computed using the following formula: result = k1*i1*i2 + k2*i1 + k3*i2 + k4 where: i1 and i2 indicate the corresponding pixel channel values of the input image, which map to in and in2 respectively k1, k2, k3 and k4 indicate the values of the attributes with the same name usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attribu...
<feDiffuseLighting> - SVG: Scalable Vector Graphics
example the following example show the effect of the <fediffuselighting> element on a circle with each light source available.
<feDisplacementMap> - SVG: Scalable Vector Graphics
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in in2 scale xchannelselector ychannelselector dom interface this element implements the svgfedisplacementmapelement interface.
<feDistantLight> - SVG: Scalable Vector Graphics
usage context categorieslight source elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes specific attributes azimuth elevation dom interface this element implements the svgfedistantlightelement interface.
<feDropShadow> - SVG: Scalable Vector Graphics
value type: <number>; default value: 2; animatable: yes global attributes core attributes most notably: id styling attributes class, style filter primitive attributes height, in, result, x, y, width presentation attributes most notably: flood-color, flood-opacity usage notes categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <script>, <set> specifications specification status comment filter effects module level 1the definition of '<fedropshadow>' in that specification.
<feFlood> - SVG: Scalable Vector Graphics
WebSVGElementfeFlood
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <animatecolor>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes flood-color flood-opacity dom interface this element implements the svgfefloodelement interface.
<feFuncA> - SVG: Scalable Vector Graphics
WebSVGElementfeFuncA
usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncaelement interface.
<feFuncB> - SVG: Scalable Vector Graphics
WebSVGElementfeFuncB
usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncbelement interface.
<feFuncG> - SVG: Scalable Vector Graphics
WebSVGElementfeFuncG
usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncgelement interface.
<feFuncR> - SVG: Scalable Vector Graphics
WebSVGElementfeFuncR
usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes transfer function attributes specific attributes none dom interface this element implements the svgfefuncrelement interface.
<feGaussianBlur> - SVG: Scalable Vector Graphics
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in stddeviation edgemode dom interface this element implements the svgfegaussianblurelement interface.
<feImage> - SVG: Scalable Vector Graphics
WebSVGElementfeImage
the <feimage> svg filter primitive fetches image data from an external source and provides the pixel data as output (meaning if the external source is an svg image, it is rasterized.) usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <animatetransform>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes xlink attributes class style externalresourcesrequired specific attributes preserveaspectratio xlink:href dom interface this element implements the svgfeimageelement interface.
<feMergeNode> - SVG: Scalable Vector Graphics
usage context categoriesnonepermitted contentany number of the following elements, in any order:<animate>, <set> example <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="feoffset" x="-40" y="-20" width="100" height="200"> <feoffset in="sourcegraphic" dx="60" dy="60" /> <fegaussianblur in="sourcegraphic" stddeviation="5" result="blur2" /> <femerge> <femergenode in="blur2" /> <femergenode in="sourcegraphic" /> </femerge> </filter> <rect x="40" y="40" width="100" height="100" style="stroke: #000000; fill: green; filter: url(#feoffset);" /> ...
<feMorphology> - SVG: Scalable Vector Graphics
usage context categoriesfilter primitive elementpermitted contentany number of the following elements, in any order:<animate>, <set> attributes global attributes core attributes presentation attributes filter primitive attributes class style specific attributes in operator radius dom interface this element implements the svgfemorphologyelement interface.
<feSpecularLighting> - SVG: Scalable Vector Graphics
the lighting calculation follows the standard specular component of the phong lighting model.
<filter> - SVG: Scalable Vector Graphics
WebSVGElementfilter
usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elementsfilter primitive elements<animate>, <set> attributes global attributes core attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes x y width height filterres filterunits primitiveunits xlink:href dom interface this element implements the svgfilterelement interface.
<font-face-src> - SVG: Scalable Vector Graphics
usage context categoriesfont elementpermitted contentone or more of the following elements, in any order:<font-face-name>, <font-face-uri> attributes global attributes core attributes specific attributes none dom interface this element implements the svgfontfacesrcelement interface.
<font-face-uri> - SVG: Scalable Vector Graphics
usage context categoriesfont elementpermitted contentany number of the following elements, in any order:<font-face-format> attributes global attributes core attributes xlink attributes specific attributes xlink:href dom interface this element implements the svgfontfaceurielement interface.
<font> - SVG: Scalable Vector Graphics
WebSVGElementfont
usage context categoriesfont elementpermitted contentany number of the following elements, in any order:descriptive elements<font-face>, <glyph>, <hkern>, <missing-glyph>, <vkern> attributes global attributes core attributes presentation attributes class style externalresourcesrequired specific attributes horiz-origin-x horiz-origin-y horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgfontelement interface.
<glyph> - SVG: Scalable Vector Graphics
WebSVGElementglyph
usage context categoriestext content 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>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y unicode glyph-name orientation arabic-form lang dom interface this element implements the svgglyphelement interface.
<hatch> - SVG: Scalable Vector Graphics
WebSVGElementhatch
usage context categoriesnever-rendered element, paint server elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<hatchpath>, <script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes x y pitch rotate hatchunits hatchcontentunits transform href dom interface this element implements the svghatchelement interface.
<hatchpath> - SVG: Scalable Vector Graphics
WebSVGElementhatchpath
usage context categoriesnonepermitted contentany number of the following elements, in any order:animation elementsdescriptive elements<script>, <style> attributes global attributes core attributes global event attributes presentation attributes style attributes specific attributes d offset dom interface this element implements the svghatchpathelement interface.
<hkern> - SVG: Scalable Vector Graphics
WebSVGElementhkern
the <hkern> svg element allows to fine-tweak the horizontal distance between two glyphs.
<linearGradient> - SVG: Scalable Vector Graphics
endering, 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 scalable vector graphics (svg) 2the definition of '<lineargradient>' in that specification.
<mask> - SVG: Scalable Vector Graphics
WebSVGElementmask
nguage 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>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment css masking module lev...
<metadata> - SVG: Scalable Vector Graphics
WebSVGElementmetadata
candidate recommendation allowed global event attributes on the element.
<missing-glyph> - SVG: Scalable Vector Graphics
usage context categoriesnonepermitted 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>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> attributes global attributes core attributes presentation attributes class style specific attributes d horiz-adv-x vert-origin-x vert-origin-y vert-adv-y dom interface this element implements the svgmissingglyphelement interface.
<pattern> - SVG: Scalable Vector Graphics
WebSVGElementpattern
ering, 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>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> specifications specification status comment scalable vector graphi...
<radialGradient> - SVG: Scalable Vector Graphics
endering, 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 scalable vector graphics (svg) 2the definition of '<radialgradient>' in that specification.
<stop> - SVG: Scalable Vector Graphics
WebSVGElementstop
value type: <opacity>; default value: 1; 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: color, display, stop-color, stop-opacity, visibility usage notes categoriesgradient elementpermitted contentany number of the following elements, in any order:<animate>, <animatecolor>, <set> specifications specification status comment scalable vector graphics (svg) 2the definition of '<stop>' in that specification.
<style> - SVG: Scalable Vector Graphics
WebSVGElementstyle
the svg <style> element allows style sheets to be embedded directly within svg content.
<switch> - SVG: Scalable Vector Graphics
WebSVGElementswitch
usage context categoriescontainer elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elements<a>, <foreignobject>, <g>, <image>, <svg>, <switch>, <text>, <use> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes class style externalresourcesrequired transform dom interface this element implements the svgswitchelement in...
<tref> - SVG: Scalable Vector Graphics
WebSVGElementtref
usage context categoriestext content element, text content child elementpermitted contentany number of the following elements, in any order:descriptive elements<animate>, <animatecolor>, <set> attributes global attributes conditional processing attributes core attributes graphical event attributes presentation attributes xlink attributes class style externalresourcesrequired specific attributes xlink:href dom interface this element implements the svgtrefelement interface.
<view> - SVG: Scalable Vector Graphics
WebSVGElementview
usage context categoriesnonepermitted contentany number of the following elements, in any order:descriptive elements attributes global attributes aria attributes » core attributes » global event attributes » externalresourcesrequired specific attributes viewbox preserveaspectratio zoomandpan viewtarget example svg <svg width="600" height="200" viewbox="0 0 600 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <radialgradient id="gradient"> <stop offset="0%" stop-color="#8cffa0" /> <stop offset="100%" stop-color="#8ca0ff" /> </radialgradient> </defs> <circle r="50" cx="180" cy="50" style="fill:url(#gradient)"/> <...
<vkern> - SVG: Scalable Vector Graphics
WebSVGElementvkern
the <vkern> svg element allows to fine-tweak the vertical distance between two glyphs in top-to-bottom fonts.
Example - SVG: Scalable Vector Graphics
mote.prototype.capvelocity = function() { var max = parseint( document.getelementbyid('max_velocity').value ); if( max < this.vx ) this.vx = max; else if( -max > this.vx ) this.vx = -max; if( max < this.vy ) this.vy = max; else if( -max > this.vy ) this.vy = -max; } // mote::capposition() -- apply an upper/lower limit // on mote position.
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
doesn't completely follow <svg:use> cascading rules (bug 265894).
Scripting - SVG: Scalable Vector Graphics
WebSVGScripting
although the adobe svg viewer plugin allows the use of functionname(), it's not the preferred way to do things.
SVG image element - SVG: Scalable Vector Graphics
« previousnext » the svg <image> element allows for raster images to be rendered within an svg object.
SVG Tutorial - SVG: Scalable Vector Graphics
WebSVGTutorial
introducing svg from scratch introduction getting started positions basic shapes paths fills and strokes gradients patterns texts basic transformations clipping and masking other content in svg filter effects svg fonts svg image tag tools for svg svg and css the following topics are more advanced and hence should get their own tutorials.
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
if svg works with the new profile, then simply delete the new profile and go about cleaning your old profile using the steps in the section below.
SVG: Scalable Vector Graphics
WebSVG
this allows developers to create rich animations and interactive images.
How to fix a website with blocked mixed content - Web security
this follows a practice adopted by internet explorer (since version 9) and chrome.
XML introduction - XML: Extensible Markup Language
comments <!-- comment --> "correct" xml (valid and well-formed) Сorrect design rules for an xml document to be correct, the following conditions must be fulfilled: document must be well-formed.
Comparison of CSS Selectors and XPath - XPath
xpath feature css equivalent ancestor, parent or preceding-sibling axis :has() selector attribute axis attribute selectors child axis child combinator descendant axis descendant combinator following-sibling axis general sibling combinator or adjacent sibling combinator self axis :scope or :host selector ...
string - XPath
a number is converted as follows: nan is converted to the string nan.
translate - XPath
however, this is the closest we have at present to a function that can convert a string to uppercase or lowercase.
Functions - XPath
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the following is an annotated list of core xpath functions and xslt-specific additions to xpath, including a description, syntax, a list of arguments, result-type, source in the appropriate w3c recommendation, and degree of present gecko support.
<xsl:apply-imports> - XSLT: Extensible Stylesheet Language Transformations
sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet.
<xsl:copy> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementcopy
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:copy> element transfers a shallow copy (the node and any associated namespace node) of the current node to the output document.
<xsl:import> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementimport
generally speaking, the contents of the imported stylesheet have a lower import precedence than that of the importing stylesheet.
<xsl:text> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementtext
optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context.
<xsl:value-of> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementvalue-of
optional attributes disable-output-escaping (netscape does not serialize the result of transformation - the "output" below - so this attribute is essentially irrelevant in context.
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElement
for example, assume that a variable "image-dir" is defined as follows: <xsl:variable name="image-dir">/images</xsl:variable> the expression to be evaluated is placed inside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> this would result in the following: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its s...
Resources - XSLT: Extensible Stylesheet Language Transformations
xsl results firefox extension (presently awaiting review) - allows one to experiment with xsl, by applying xsl stylesheets (which are manually entered, found via a url or on the file-system) to an xml document (the currently-loaded document or a manually entered/pasted one).
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
the example allows sorting the content multiple times, alternating between ascending and descending order.
Basic Example - XSLT: Extensible Stylesheet Language Transformations
this allows fetching of data after the page has been loaded, without initiating a fresh page load.
Introduction - XSLT: Extensible Stylesheet Language Transformations
xslt allows the author to directly manipulate the structure of a document.
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
document.importnode() allows transferring a dom fragment between documents, in this case from an html document to an xml document.
Exported WebAssembly functions - WebAssembly
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.
Loading and running WebAssembly code - WebAssembly
the following sections explain.