Search completed in 1.08 seconds.
HTMLImageElement.alt - Web APIs
the htmlimageelement property
alt provides fallback (
alternate) text to display when the image specified by the <img> element is not loaded. this may be the case because of an error, because the user has disabled the loading of images, or because the image simply hasn't finished loading yet. perhaps the most important reason to use the
alt tag is to support accessibility, as the
alt text may be used by screen readers and other assistive technologies to help differently-abled users make full use of your content. it will be read aloud or sent to the touch device, for example, to support visually impaired users. ...
...simply hasn't finished loading yet. perhaps the most important reason to use the
alt tag is to support accessibility, as the
alt text may be used by screen readers and other assistive technologies to help differently-abled users make full use of your content. it will be read aloud or sent to the touch device, for example, to support visually impaired users. think of it like this: when choosing
alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page. the
alternate text is displayed in the space the image would occupy and should be able to take the place of the image without
altering the meaning of the page. ...
...mpaired users. think of it like this: when choosing
alt strings for your images, imagine what you would say when reading the page to someone over the phone without mentioning that there's an image on the page. the
alternate text is displayed in the space the image would occupy and should be able to take the place of the image without
altering the meaning of the page. syntax htmlimageelement.
alt =
alttext; let
alttext = htmlimageelement.
alt; value a domstring which contains the
alternate text to display when the image is not loaded or for use by assistive devices. the
alt attribute is officially mandatory; it's meant to always be specified. if the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal importance), you may speci...
...And 15 more matches
font-variant-alternates - CSS: Cascading Style Sheets
the font-variant-
alternates css property controls the usage of
alternate glyphs. these
alternate glyphs may be referenced by
alternative names defined in @font-feature-values. ...
... the font-variant-
alternates css property controls the usage of
alternate glyphs. these
alternate glyphs may be referenced by
alternative names defined in @font-feature-values. ...
... the font-variant-
alternates css property controls the usage of
alternate glyphs. these
alternate glyphs may be referenced by
alternative names defined in @font-feature-values. ...
...And 10 more matches
RTCIceServer.credentialType - Web APIs
this process is detailed in rfc 7635. this property was formerly called token. ...
...this process is detailed in rfc 7635. this property was formerly called token. ...
...this process is detailed in rfc 7635. this property was formerly called token. ...
...And 7 more matches
SpeechRecognition.maxAlternatives - Web APIs
examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
... examples this code is excerpted from our speech color changer example. ...
...And 5 more matches
Alternative style sheets - CSS: Cascading Style Sheets
specifying
alternative style sheets in a web page provides a way for users to see multiple versions of a page, based on their needs or preferences. firefox lets the user select the stylesheet using the view > page style submenu. internet explorer also supports this feature (beginning with ie 8), also accessed from view > page style. chrome requires an extension to use the feature (as of version 48). the web page can also provide its own user interface to let the user switch styles. an example: specifying the
alternative stylesheets the
alternate stylesheets are commonly specified using a <link> element with rel="
alternate stylesheet" and title="..." attributes. for example: <link href="reset.css" rel="stylesheet" type="text/css"> <link href="default.css" rel="stylesheet" type="text/css"...
...ce to let the user switch styles. an example: specifying the
alternative stylesheets the
alternate stylesheets are commonly specified using a <link> element with rel="
alternate stylesheet" and title="..." attributes. for example: <link href="reset.css" rel="stylesheet" type="text/css"> <link href="default.css" rel="stylesheet" type="text/css" title="default style"> <link href="fancy.css" rel="
alternate stylesheet" type="text/css" title="fancy"> <link href="basic.css" rel="
alternate stylesheet" type="text/css" title="basic"> in this example, the styles "default style", "fancy", and "basic" will be listed in the page style submenu, with "default style" pre-selected. when the user selects a different style, the page will immediately be re-rendered using that style sheet. no matter what st...
...ault style" pre-selected. when the user selects a different style, the page will immediately be re-rendered using that style sheet. no matter what style is selected, the rules from the reset.css stylesheet will always be applied. try it out click here for a working example you can try out. details any stylesheet in a document falls into one of the following categories: persistent (no rel="
alternate", no title=""): always applies to the document. preferred (no rel="
alternate", with title="..." specified): applied by default, but disabled if an
alternate stylesheet is selected. there can only be one preferred stylesheet, so providing stylesheets with different title attributes will cause some of them to be ignored. see correctly using titles with external stylesheets for a more detaile...
...And 5 more matches
globalThis - JavaScript
on the web you can use window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use global. ...
...on the web you can use window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use global. ...
...rs only self will work. in node.js none of these work, and you must instead use global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('return this')(), but environments that disable eval(), like csp in browsers, prevent use of function in this way. the glob
althis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. in this way, you can access the global object in a consistent manner without having to know which environment the code is being run in.to help you remember the ...
...And 5 more matches
SpeechRecognitionAlternative - Web APIs
examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
... examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
...esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...And 2 more matches
<altGlyph> - SVG: Scalable Vector Graphics
usage context categoriestext content element, text content child elementpermitted contentany elements or character data attributes x this attribute defines the corresponding absolute x-coordinates for rendering the element. value type: <list-of-coordinates> ; default value: absolute x-coordinate of ancestor <text> or <tspan>; animatable: yes y this attribute defines the corresponding absolute y-coordinates for rendering the element. value type: <list-of-coordinates> ; default value: absolute y-coordinate of ancestor <text> or <tspan>; animatable: yes dx this attribute indicates a shift along the x-axis on the position of the element. ...
...: yes (non-additive) glyphref the glyph identifier, the format of which is dependent on the format defined by the format attribute of the given font. value type: <string> ; default value: none; animatable: no format the format of the given font. ...
... default value: none; animatable: no format the format of the given font. value type: <string> ; default value: none; animatable: no xlink:href an <iri> reference either to a <glyph> element in an svg document or to an <
altglyphdef> element. if the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the character(s) that are inside of the <
altglyph> element. if the reference is to an <
altglyphdef> element, then if an appropriate set of
alternate glyphs is located from processing the <
altglyphdef> element, then those
alternate glyphs are rendered instead of the character(s) that are inside of the <
altglyph> element. value type: <iri> ; default value: none; animatable: no global attributes core attributes most notably: id lang ...
...And 2 more matches
Event.explicitOriginalTarget - Web APIs
the explicit original target of the event. (mozilla-specific) if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. ...
...mozilla-specific) if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happen over text nodes (see bug 185889), and in that case currenttarget will show the parent and explicitorigin
altarget will show the text node. ...
...ent was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happen over text nodes (see bug 185889), and in that case currenttarget will show the parent and explicitorigin
altarget will show the text node. explicitorigin
altarget differs from origin
altarget in that it will never contain anonymous content. ...
...nodes (see bug 185889), and in that case currenttarget will show the parent and explicitorigin
altarget will show the text node. explicitorigin
altarget differs from origin
altarget in that it will never contain anonymous content. example this property can be used with <command> to get the event details of the original object calling the command. function mycommand(ev) { alert(ev.explicitorigin
altarget.nodename); // returns 'menuitem' } <xul:command id="my-cmd-anaction" oncommand="mycommand(event);"/> <xul:menulist> <xul:menupopup> <xul:menuitem label="get my element name!" command="my-cmd-anaction"/> </xul:menupopup> </menulist> specifications this is a mozilla-specific property. defined in /dom/public/idl/events/nsidomnsevent.idl this event property is not defined in the w3.
MouseEvent.altKey - Web APIs
the mouseevent.
altkey read-only property is a boolean that indicates whether the
alt key was pressed or not when a given mouse event occurs. be aware that the browser can't always detect the
alt key on some operating systems. on some linux variants, for example, a left mouse click combined with the
alt key is used to move or resize windows. note: on macintosh keyboards, this key is also known as the option key. syntax var
altkeypressed = instanceofmouseevent.
altkey return value a boolean, where true indicates that the key is pressed, and false indicates that the key is not pressed. example this example logs the
altkey property when you trigger a click event. ...
...ove or resize windows. note: on macintosh keyboards, this key is also known as the option key. syntax var
altkeypressed = instanceofmouseevent.
altkey return value a boolean, where true indicates that the key is pressed, and false indicates that the key is not pressed. example this example logs the
altkey property when you trigger a click event. ...
...e indicates that the key is pressed, and false indicates that the key is not pressed. example this example logs the
altkey property when you trigger a click event. html <p>click anywhere to test the <code>
altkey</code> property.</p> <p id="log"></p> javascript let log = document.queryselector('#log'); document.addeventlistener('click', logkey); function logkey(e) { log.textcontent = `the
alt key is pressed: ${e.
altkey}`; } result specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'mouseevent.
altkey' in that specification. obsolete no change from document object model (dom) level 2 events specification. document object model (dom) level 2 events specificationthe definition of...
... obsolete initial definition. ...
SVGAltGlyphDefElement - Web APIs
the svg
altglyphdefelement interface corresponds to the <
altglyphdef> element. ...
...felement interface corresponds to the <
altglyphdef> element. ...
...te; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/svg
altglyphdefelement" 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">svg
altglyphdefelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: this interface was removed in the svg 2 specification. properties this interface doesn't implement any specific properties, but inherits properties from its parent interface, svgelement. methods this interface doesn't implement any specific methods, but inherits methods from its pare...
... recommendation initial definition ...
SVGAltGlyphItemElement - Web APIs
the svg
altglyphitemelement interface corresponds to the <
altglyphitem> element. ...
...element interface corresponds to the <
altglyphitem> element. ...
...e; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/svg
altglyphitemelement" 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">svg
altglyphitemelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: this interface was removed in the svg 2 specification. properties this interface doesn't implement any specific properties, but inherits properties from its parent interface, svgelement. methods this interface doesn't implement any specific methods, but inherits methods from its par...
... recommendation initial definition ...
SpeechRecognitionAlternative.confidence - Web APIs
the confidence read-only property of the speechrecognitionresult interface returns a numeric estimate of how confident the speech recognition system is that the recognition is correct. note: mozilla's implementation of confidence is still being worked on — at the moment, it always seems to return 1. syntax var myconfidence = speechrecognition
alternativeinstance.confidence; returns a number betwen 0 and 1. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the...
...esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. ...
... // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log('confidence: ' + event.results[0][0].confidence); } specifications specification status comment web speech apithe definition of 'confidence' in that specification. draft ...
USBAlternateInterface - Web APIs
the usb
alternateinterface interface of the webusb api provides information about a particular configuration of an interface provided by the usb device. an interface includes one or more
alternate settings which can configure a set of endpoints based on the operating mode of the device. constructor usb
alternateinterface.usb
alternateinterface creates a new usb
alternateinterface object which will be populated with information about the
alternate interface of the provided usbinterface with the given
alternate setting number. properties usb
alternateinterface.
alternatesettingread only returns the
alternate setting number of this interface. this is equal to the b
alternatesetting field of the interface descriptor defining this interface. ...
...a new usb
alternateinterface object which will be populated with information about the
alternate interface of the provided usbinterface with the given
alternate setting number. properties usb
alternateinterface.
alternatesettingread only returns the
alternate setting number of this interface. this is equal to the b
alternatesetting field of the interface descriptor defining this interface. usb
alternateinterface.interfaceclassread only returns the class of this interface. this is equal to the binterfaceclass field of the interface descriptor defining this interface. standardized values for this field are defined by the usb implementers forum. a value of 0xff indicates a vendor-defined interface. usb
alternateinterface.interfacesubclassread only returns the subclass of this interface. t...
...nterface. standardized values for this field are defined by the usb implementers forum. a value of 0xff indicates a vendor-defined interface. usb
alternateinterface.interfacesubclassread only returns the subclass of this interface. this is equal to the binterfacesubclass field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass field. usb
alternateinterface.interfaceprotocolread only returns the protocol supported by this interface. this is equal to the binterfaceprotocol field of the interface descriptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usb
alternateinterface.interfacenameread only returns the name of the interface, if one is provided by the device. thi...
...e interface descriptor defining this interface. the meaning of this value depends on the interfaceclass and interfacesubclass fields. usb
alternateinterface.interfacenameread only returns the name of the interface, if one is provided by the device. this is the value of the string descriptor with the index specified by the iinterface field of the interface descriptor defining this interface. usb
alternateinterface.endpointsread only returns an array containing instances of the usbendpoint interface describing each of the endpoints that are part of this interface. specifications specification status comment webusbthe definition of 'usb
alternateinterface' in that specification. draft initial definition. ...
USBDevice.clearHalt() - Web APIs
valid values are 'in' or 'out'. endpointnumber indicates the number of the endpoint to clear. the promise will reject if an invalid endpoint is supplied. return value a promise. example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer. ...
...valid values are 'in' or 'out'. endpointnumber indicates the number of the endpoint to clear. the promise will reject if an invalid endpoint is supplied. return value a promise. example the following example shows how to test for and clear a 'stall' condition in the result of a data transfer. ...
... draft initial definition. ...
... draft initial definition. ...
Alt-Svc - HTTP
the
alt-svc http response header is used to advertise
alternative services through which the same resource can be reached. an
alternative service is defined by a protocol/host/port combination. syntax
alt-svc: clear
alt-svc: <protocol-id>=<
alt-authority>; ma=<max-age>
alt-svc: <protocol-id>=<
alt-authority>; ma=<max-age>; persist=1 clear the special value ''clear" indicates that the origin requests all
alternatives for that origin to be invalidated. <protocol-id> the alpn protocol identifier. examples include h2 for http/2 and h3-25 for draft 25 of the http/3 protocol. <
alt-authority> the quoted string specifying the
alternative authority which consists of an optional host override, a colon, and a mandatory port number. ...
...requests all
alternatives for that origin to be invalidated. <protocol-id> the alpn protocol identifier. examples include h2 for http/2 and h3-25 for draft 25 of the http/3 protocol. <
alt-authority> the quoted string specifying the
alternative authority which consists of an optional host override, a colon, and a mandatory port number. ma=<max-age>optional the number of seconds for which the
alternative service is considered fresh. if omitted, it defaults to 24 hours.
alternative service entries can be cached for up to <max-age> seconds, minus the age of the response (from the age header). if the cached entry expires, the client can no longer use this
alternative service for new connections. ...
... ma=<max-age>optional the number of seconds for which the
alternative service is considered fresh. if omitted, it defaults to 24 hours.
alternative service entries can be cached for up to <max-age> seconds, minus the age of the response (from the age header). if the cached entry expires, the client can no longer use this
alternative service for new connections. persist=1optional usually cached
alternative service entries are cleared on network configuration changes. use of the persist=1 parameter ensures that the entry is not deleted through such changes. multiple entries can be specified in a single
alt-svc header using comma as separator. in that case, early entries are considered more preferable. ...
...
alternative service for new connections. persist=1optional usually cached
alternative service entries are cleared on network configuration changes. use of the persist=1 parameter ensures that the entry is not deleted through such changes. multiple entries can be specified in a single
alt-svc header using comma as separator. in that case, early entries are considered more preferable. example
alt-svc: h2=":443"; ma=2592000;
alt-svc: h2=":443"; ma=2592000; persist=1
alt-svc: h2="
alt.example.com:443", h2=":443"
alt-svc: h3-25=":443"; ma=3600, h2=":443"; ma=3600 specifications specification status comment rfc 7838 ietf rfc initial definition. ...
gestalt - Archive of obsolete content
for information on that function, see inside macintosh: operating system utilities. this method returns null on unix and windows platforms. ...
...for information on that function, see inside macintosh: operating system utilities. this method returns null on unix and windows platforms. ...
...only) retrieves information about the operating environment. method of install object syntax int gest
alt ( string selector ); parameters the gest
alt method takes the following parameters: selector the selector code for the information you want. returns returns the requested information. the format depends on the select code specified in the selector parameter. description the gest
alt method is a wrapper for the gest
alt function of the macintosh toolbox. for information on that function, see inside macintosh: operating system utilities. this method returns null on unix and windows platforms. ...
browser.altClickSave
false (default) no action triggered (see bug 736985). ...
... false (default) no action triggered (see bug 736985). ...
... false (default) no action triggered (see bug 736985). ...
PRIntervalTime
a platform-dependent type that represents a monotonically increasing integer--the nspr runtime clock. syntax #include <prinrval.h> typedef pruint32 printerv
altime; #define pr_interval_min 1000ul #define pr_interval_max 100000ul #define pr_interval_no_wait 0ul #define pr_interval_no_timeout 0xfffffffful description the units of printerv
altime are platform-dependent. they are chosen to be appropriate for the host os, yet provide sufficient resolution and period to be useful to clients. the increasing interval value represented by printerv
altime wraps. it should therefore never be used for intervals greater than approximately 6 hours. interval times are accurate regardless of host processing requirements and are very cheap to acquire. the constants pr_interval_min and pr_interva...
... the reserved constants pr_interval_no_wait and pr_interval_no_timeout have special meaning for nspr. they indicate that the process should wait no time (return immediately) or wait forever (never time out), respectively. important note the counters used for interval times are allowed to overflow. ...
...it no time (return immediately) or wait forever (never time out), respectively. important note the counters used for interval times are allowed to overflow. since the sampling of the counter used to define an arbitrary epoch may have any 32-bit value, some care must be taken in the use of interval times. the proper coding style to test the expiration of an interval is as follows: if ((printerv
altime)(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 printerv
altime (231-1), the expression shown above provides the expected result even if the signs of now and epoch differ. the resolution of a printerv
altime object is defined by the api. nspr guarantees that there will be at leas...
SVGAltGlyphElement - Web APIs
the svg
altglyphelement interface represents an <
altglyph> element. this interface makes it possible to implement more sophisticated and particular glyph characters. for some textal representations as: ligatures (e.g. æ, ß, etc ), special-purpose fonts (e.g. musical symbols) or even
alternate glyphs such as asian text strings it is required that a different set of glyphs be used than the normal given character data. properties this interface also inherits properties from its parent interface, svggraphicselement. svg
altglyphelement.glyphref it corresponds to the attribute glyphref on the given element. it's data type is 'string'. it defines the glyph identifier, whose format is dependent on the ‘format’ of the given font. ...
...it's data type is 'string'. this property specifies the format of the given font. ...
...tglyphelement.format it corresponds to the attribute format on the given element. it's data type is 'string'. this property specifies the format of the given font. methods this interface has no methods but inherits methods from its parent, svgelement. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'svg
altglyphelement' in that specification. recommendation initial definition ...
SpeechRecognitionAlternative.transcript - Web APIs
the transcript read-only property of the speechrecognitionresult interface returns a string containing the transcript of the recognised word(s). for continuous recognition, leading or trailing whitespace will be included where necessary so that concatenation of consecutive speechrecognitionresults produces a proper transcript of the session. syntax var mytranscript = speechrecognition
alternativeinstance.transcript; returns a domstring. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array /...
...esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'transcript' in that specification. dr...
KeyboardEvent.altKey - Web APIs
the keyboardevent.
altkey read-only property is a boolean that indicates if the
alt key (option or ⌥ on os x) was pressed (true) or not (false) when the event occured. syntax var
altkeypressed = instanceofkeyboardevent.
altkey return value boolean examples <html> <head> <title>
altkey example</title> <script type="text/javascript"> function showchar(e){ alert( "key keydown: " + string.fromcharcode(e.charcode) + "\n" + "charcode: " + e.charcode + "\n" + "
alt key keydown: " + e.
altkey + "\n" ); } </script> </head> <body onkeydown="showchar(event);"> <p> press any character key, with or without holding down the
alt key.<br /> you can also use the shift key together with the
alt key. </p> </body> </html> specifications specification status comment ...
... obsolete initial definition. ...
msRealTime - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. msre
altime is a read/write property which specifies whether or not to enable low-latency playback on the media element. this proprietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msre
altime; 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 playb...
...rietary property is specific to internet explorer and microsoft edge. syntax ptr = object.msre
altime; 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. you must set the msre
altime before setting the src property in code. msre
altime should not be used in non-real-time or non-communication scenarios, such as audio and/or video playback, as this can affects playback startup latency of audio and video playback. ...
RTCIceCredentialType - Web APIs
values oauth the rtciceserver requires the use of oauth 2.0 to authenticate in order to use the ice server described. this process is detailed in rfc 7635. this property was formerly called token. password the rtciceserver requires a username and password to authenticate prior to using the described ice server. obsolete values the following values are no longer part of the webrtc specification, but were in the past. token authenticating with the ice server requires the use of an oauth 2.0 token as defined in rfc 7635. this value has been renamed to oauth. ...
...s the following values are no longer part of the webrtc specification, but were in the past. token authenticating with the ice server requires the use of an oauth 2.0 token as defined in rfc 7635. this value has been renamed to oauth. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicecredenti
altype' in that specification. candidate recommendation initial specification. ...
TouchEvent.altKey - Web APIs
summary a boolean value indicating whether or not the
alt (
alternate) key is enabled when the touch event is created. if the
alt key is enabled, the attribute's value is true. otherwise, it is false. this property is read only . syntax var
altenabled = touchevent.
altkey; return value
altenabled true if the
alt key is enabled for this event; and false if the
alt is not enabled. example this example illustrates how to access the touchevent key modifier properties: touchevent.
altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. in following code snippet, the touchstart event handler logs the state of the event's modifier keys. ...
... example this example illustrates how to access the touchevent key modifier properties: touchevent.
altkey, touchevent.ctrlkey, touchevent.metakey and touchevent.shiftkey. in following code snippet, the touchstart event handler logs the state of the event's modifier keys. someelement.addeventlistener('touchstart', function(e) { // log the state of this event's modifier keys console.log("
altkey = " + e.
altkey); console.log("ctrlkey = " + e.ctrlkey); console.log("metakey = " + e.metakey); console.log("shiftkey = " + e.shiftkey); }, false); specifications specification status comment touch events – level 2 draft non-stable version. touch events recommendation initial definition. ...
alternatingbackground - Archive of obsolete content
« xul reference home
alternatingbackground obsolete since gecko 2.0 type: boolean if true, the background of the tree's rows will
alternate between two colors. you can use the :-moz-tree-row css style to do this instead. ...
externalToolbars - Archive of obsolete content
« xul reference extern
altoolbars type: array of elements an array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox. ...
PR_IntervalToMicroseconds
converts platform-dependent intervals to standard clock microseconds. syntax #include <prinrval.h> pruint32 pr_interv
altomicroseconds(printerv
altime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in microseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToMilliseconds
converts platform-dependent intervals to standard clock milliseconds. syntax #include <prinrval.h> pruint32 pr_interv
altomilliseconds(printerv
altime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in milliseconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_IntervalToSeconds
converts platform-dependent intervals to standard clock seconds. syntax #include <prinrval.h> pruint32 pr_interv
altoseconds(printerv
altime ticks); parameter ticks the number of platform-dependent intervals to convert. returns equivalent in seconds of the value passed in the ticks parameter. description conversion may cause overflow, which is not reported. ...
PR_LocalTimeParameters
this time should be specified in gmt. returns a time parameters structure that expresses the time zone offsets at the specified time. ...
Event.originalTarget - Web APIs
the original target of the event before any retargetings. (mozilla-specific) in presence of xbl anonymous content this will be the anonymous node the event originally fired on. see anonymous content#event_flow_and_targeting for more details. note: origin
altarget may also be native anonymous content (see bug 208427), in which case it's useless for non-privileged code. see also comparison of event targets example need an example that makes sense here specification this is a mozilla-specific property. defined in /dom/public/idl/events/nsidomnsevent.idl this event property is not defined in the w3.org dom level 2 events ...
GeolocationCoordinates.altitude - Web APIs
the geolocationcoordinates.
altitude read-only property is a double representing the
altitude of the position in meters, relative to sea level. this value is null if the implementation cannot provide this data. syntax let
alt = geolocationcoordinatesinstance.
altitude value a double representing the
altitude of the position in meters, relative to sea level. specifications specification status comment geolocation apithe definition of 'coordinates.
altitude' in that specification. recommendation initial definition ...
GeolocationCoordinates.altitudeAccuracy - Web APIs
the geolocationcoordinates.
altitudeaccuracy read-only property is a strictly positive double representing the accuracy, with a 95% confidence level, of the
altitude expressed in meters. this value is null if the implementation doesn't support measuring
altitude. syntax let
altacc = geolocationcoordinatesinstance.
altitudeaccuracy value a positive double representing the accuracy, with a 95% confidence level, of the
altitude expressed in meters. specifications specification status comment geolocation apithe definition of 'geolocationcoordinates.
altitudeaccuracy' in that specification. recommendation initial specification. ...
RTCIceCandidateStats.mozLocalTransport - Web APIs
the non-standard mozilla extension to the rtcicecandidatestats dictionary, mozloc
altransport, has been supplanted by the standard relayprotocol property. syntax instead of using mozloc
altransport, you should use code like this: loc
altransport = rtcicecandidatestats.relayprotocol; specifications not part of any specification. ...
SVGAltGlyphElement.glyphRef - Web APIs
it has the same meaning as the ‘glyphref’ property on the svgglyphrefelement interface of the <glyphref> element. syntax string = myglyph.glyphref; myglyph.glyphref = string; value the return value is a glyph identifier, the value of which depends on the format of the given font. example myglyph.glypref = "#glyphid"; specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyphref' in that specification. ...
USBDevice.selectAlternateInterface() - Web APIs
the select
alternateinterface() method of the usbdevice interface returns a promise that resolves when the specified
alternative endpoint is selected. syntax var promise = usbdevice.select
alternateinterface(interfacenumber,
alternatesetting) parameters interfacenumber the index of one of the interfaces supported by the device. interfaces are device-specific.
alternatesetting the configuration of the selected interface. return value a promise. specifications specification status comment webusbthe definition of 'select
alternateinterface()' in that specification. draft initial definition. ...
<altGlyphDef> - SVG: Scalable Vector Graphics
the <
altglyphdef> svg element defines a substitution representation for glyphs. usage context categoriestext content elementpermitted contenteither: one or more <glyphref> elements, or one or more <
altglyphitem> elements attributes global attributes core attributes specific attributes none dom interface this element implements the svg
altglyphdefelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<
altglyphdef>' in that specification. recommendation initial definition ...
<altGlyphItem> - SVG: Scalable Vector Graphics
the <
altglyphitem> element provides a set of candidates for glyph substitution by the <
altglyph> element. usage context categoriestext content elementpermitted contentone or more <glyphref> elements example attributes global attributes core attributes specific attributes none dom interface this element implements the svg
altglyphitemelement interface. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of '<
altglyphitem>' in that specification. recommendation initial definition ...
Index - Web APIs
eb audio api, resume the resume() method of the audiocontext interface resumes the progression of time in an audio context that has previously been suspended. 135 audiocontext.suspend() api, audio, audiocontext, method, reference, web audio api, suspend the suspend() method of the audiocontext interface suspends the progression of time in the audio context, temporarily h
alting audio hardware access and reducing cpu/battery usage in the process — this is useful if you want an application to power down the audio hardware when it will not be using an audio context for a while. 136 audiocontextlatencycategory api, audio, audio context, audiocontextlatencycategory, enum, interface, media, reference, type, web audio, web audio api, latency the audio...
...d messageport. it can be used to communicate between the processor and the audioworkletnode to which it belongs. 215 audioworkletprocessor.process api, audio, audioworkletnode, audioworkletprocessor, experimental, method, process, reference, web audio api the process() method of an audioworkletprocessor-derived class implements the audio processing algorithm of the processor.
although the method is not a part of the audioworkletprocessor interface, each class that derives from it must have it implemented. 216 authenticatorassertionresponse api, authentication, authenticatorassertionresponse, interface, reference, web authentication api, webauthn the authenticatorassertionresponse interface of the web authentication api is returned by credentialscontai...
...cardrequest dictionary can optionally be provided to specify an array of domstrings representing the card types that the retailer supports (e.g. credit, debit, prepaid). 256 basiccardresponse api, basic card payment, basiccardresponse, experimental, interface, payment request, payment request api, reference the basiccardresponse dictionary (related to the payment request api,
although defined in the basic card payment spec) defines an object structure for payment response details such as the number/expiry date of the card used to make the payment, and the billing address. 257 basiccardresponse.billingaddress api, basic card payment, basiccardresponse, experimental, payment request, payment request api, property, reference, billingaddress the billingad...
...And 66 more matches
Fullscreen API - Web APIs
full-screen mode simply by pressing the esc (or f11) key, rather than waiting for the site or app to programmatically do so. make sure you provide, somewhere in your user interface, appropriate user interface elements that inform the user that this option is available to them. note: navigating to another page, changing tabs, or switching to another application using any application switcher (or
alt-tab) will likewise exit full-screen mode. example in this example, a video is presented in a web page. pressing the return or enter key lets the user toggle between windowed and full-screen presentation of the video. view live examples watching for the enter key when the page is loaded, this code is run to set up an event listener to watch for the enter key. document.addeventlistener("keyp...
...data and send us a pull request. ...
...s a pull request. ...
...And 36 more matches
Setting up the Gecko SDK
this dialog, click finish. microsoft studio creates a new project per your specification and presents you with the standard project view. adding the gecko sdk to the project settings in order to build anything that uses gecko, you have to further modify the project so that it knows where to find the gecko sdk on the disk. to edit project settings, select settings from the project menu (or press
alt-f7). most of the changes you make in the following steps apply to all configurations of the project (both debug and optimized), so select "all configurations" from the settings for dropdown menu: on the c/c++ tab, select the preprocessor category. this window is where you add the include paths to the gecko sdk as well as two preprocessor defines: xpcom_glue mozilla_strict_api at a minim...
... this allows you to created the component without sending any extra dlls set path=%path%;d:\projects\xulrunner-sdk\sdk\bin;d:\projects\xulrunner-sdk\bin this tells the command prompt where to find the gecko tools, importantly (xpidl, regxpcom, and gmake). building the sample built sample in d:\projects\sample the idl this step is fairly straight forward. first create the idl file. ...
...dk\sdk\bin;d:\projects\xulrunner-sdk\bin this tells the command prompt where to find the gecko tools, importantly (xpidl, regxpcom, and gmake). building the sample built sample in d:\projects\sample the idl this step is fairly straight forward. first create the idl file. ...
...And 26 more matches
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
full support 68notes disabled notes combinators in the selector list argument may not match correctly (see bug 842157).disabled from version 68: this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). to change preferences in chrome, visit chrome://flags. no support 66 — 71notes
alternate name disabled notes combinators in the selector list argument may not match correctly (see bug 842157).
alternate name uses the non-standard name: :matches()disabled from version 66 until version 71 (exclusive): this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). to change preferences in chrome, visit chrome://flags. ...
...ctor list argument may not match correctly (see bug 842157).
alternate name uses the non-standard name: :matches()disabled from version 66 until version 71 (exclusive): this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). to change preferences in chrome, visit chrome://flags. ...
...ug 842157).
alternate name uses the non-standard name: :matches()disabled from version 66 until version 71 (exclusive): this feature is behind the #enable-experimental-web-platform-features preference (needs to be set to enabled). to change preferences in chrome, visit chrome://flags. ...
...And 26 more matches
MathML Torture Test
ola</option> <option value="texgyretermes">tex gyre termes</option> <option value="xits">xits</option> </select> <br/> </p> <table> <tr> <td></td> <th scope="col">as rendered by tex</th> <th scope="col">as rendered by your browser</th></tr> <tr> <td>1</td> <td><img src="https://udn.realityripple.com/samples/45/d5a0dbbca3.png" width="38" height="22"
alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mn>2</mn> </msup> </mrow> </math> </td></tr> <tr> <td>2</td> <td><img src="https://udn.realityripple.com/samples/b8/da4a50ea34.png" width="30" heig...
...k, 16.2-16.3" /></td> <td> <math display="block"> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mn>2</mn> </msup> </mrow> </math> </td></tr> <tr> <td>2</td> <td><img src="https://udn.realityripple.com/samples/b8/da4a50ea34.png" width="30" height="17"
alt="texbook, 16.2-16.3" /></td> <td> <math display="block"> <!-- <mrow> <msub><mi></mi><mn>2</mn></msub> <msub><mi>f</mi><mn>3</mn></msub> </mrow> --> <mrow> <mmultiscripts> <mi>f</mi> <mn>3</mn><none/> <mprescripts/> <mn>2</mn><none/> </mmulti...
...</mi><mn>3</mn></msub> </mrow> --> <mrow> <mmultiscripts> <mi>f</mi> <mn>3</mn><none/> <mprescripts/> <mn>2</mn><none/> </mmultiscripts> </mrow> </math> </td></tr> <tr> <td>3</td> <td><img src="https://udn.realityripple.com/samples/8a/1d0e6e073c.png" width="58" height="47"
alt="texbook, 17-17.1" /></td> <td> <math display="block"> <mrow> <mfrac> <mrow> <mi>x</mi> <mo>+</mo> <msup> <mi>y</mi> <mn>2</mn> </msup> </mrow> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> ...
...And 24 more matches
filter - CSS: Cascading Style Sheets
filter: blur(5px) <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">original image</th> <th style="text-align: left;" scope="col">live example</th> <th style="text-align: left;" scope="col">svg equivalent</th> <th style="text-align: left;" scope="col">static 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"> ...
...iewbox="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> <td><img
alt="test_form_s.jpg" id="img4" class="internal default" src="/files/3711/test_form_2_s.jpg" style="width: 100%;" /></td> </tr> </tbody> </table> html { height:100%; } body { font: 14px/1.286 "lucida grande", "lucida sans unicode", "dejavu sans", lucida, arial, helvetica, sans-serif; color: rgb(51, 51, 51); height:100%; overflow:hidden; } #img2 { width:100%; height:auto; -webki...
...er> </filter> </svg> <table class="standard-table"> <thead> <tr> <th style="text-align: left;" scope="col">original image</th> <th style="text-align: left;" scope="col">live example</th> <th style="text-align: left;" scope="col">svg equivalent</th> <th style="text-align: left;" scope="col">static example</th> </tr> </thead> <tbody> <tr> <td><img
alt="test_form.jpg" id="img1" class="internal default" src="/files/3708/test_form.jpg" style="width: 100%;" /></td> <td><img
alt="test_form.jpg" id="img2" class="internal default" src="/files/3708/test_form.jpg" style="width: 100%;" /></td> <td><div class="svg-container"><svg xmlns="http://www.w3.org/2000/svg" id="img3" viewbox="0 0 286 217" color-interpolation-filters="srgb"> <filter id...
...And 20 more matches
Guide to the Fullscreen API - Web APIs
fullscreenenabled property tells you whether or not the document is currently in a state that would allow fullscreen mode to be requested. things your users want to know you'll want to be sure to let your users know that they can press the esc key (or f11) to exit fullscreen mode. in addition, navigating to another page, changing tabs, or switching to another application (using, for example,
alt-tab) while in fullscreen mode exits fullscreen mode as well. example in this example, a video is presented in a web page. pressing the return or enter key lets the user toggle between windowed and fullscreen presentation of the video. view live examples watching for the enter key when the page is loaded, this code is run to set up an event listener to watch for the enter key. document.addev...
...data and send us a pull request. ...
...s a pull request. ...
...And 19 more matches
Images in HTML - Learn web development
ove code would give us the following result: note: elements like <img> and <video> are sometimes referred to as replaced elements. this is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself. ...
... elements like <img> and <video> are sometimes referred to as replaced elements. this is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself. note: you can find the finished example from this section running on github (see the source code too.)
alternative text the next attribute we'll look at is
alt. ...
...tion running on github (see the source code too.)
alternative text the next attribute we'll look at is
alt. 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. for example, our above code could be modified like so: <img src="images/dinosaur.jpg"
alt="the head and torso of a dinosaur skeleton; it has a large head with long sharp teeth"> the easiest way to test your
alt text is to purposely misspell your filename. ...
...And 18 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
image into the document. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the above example shows usage of the <img> element: the src attribute is required, and contains the path to the image you want to embed. the
alt attribute holds a text description of the image, which isn't mandatory but is incredibly useful for accessibility — screen readers read this description out to their users so they know what the image means.
alt text is also displayed on the page if the image can't be loaded for some reason: for example, network errors, content blocking, or linkrot. there are many other attributes to achieve v...
...rl of the page the user is currently on. the image is corrupted in some way that prevents it from being loaded. the image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the image is in a format not supported by the user agent. attributes this element includes the global attributes.
alt defines an
alternative text description of the image. note: browsers do not always display images. there are a number of situations in which a browser might not display images, such as: non-visual browsers (such as those used by people with visual impairments) the user chooses not to display images (saving bandwidth, privacy reasons) the image is invalid or an unsupported type in...
...t always display images. ...
...And 18 more matches
HTML: A good basis for accessibility - Learn web development
cer row --> <tr id="spacer" height="10"> <td> </td> </tr> <!-- footer row --> <tr id="footer" bgcolor="#ffffff"> <td colspan="6"> <p>©copyright 2050 by nobody. all rights reversed.</p> </td> </tr> </table> if you try to navigate this using a screen reader, it will probably tell you that there's a table to be looked at (
although some screen readers can guess the difference between table layouts and data tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not wide...
...ands table example — you can see a few accessibility aids at work here: table headers are defined using <th> elements — you can also specify if they are headers for rows or columns using the scope attribute. this gives you complete groups of data that can be consumed by screen readers as single units. ...
......
...And 16 more matches
HTML: A good basis for accessibility - Learn web development
cer row --> <tr id="spacer" height="10"> <td> </td> </tr> <!-- footer row --> <tr id="footer" bgcolor="#ffffff"> <td colspan="6"> <p>©copyright 2050 by nobody. all rights reversed.</p> </td> </tr> </table> if you try to navigate this using a screen reader, it will probably tell you that there's a table to be looked at (
although some screen readers can guess the difference between table layouts and data tables). you'll then likely (depending on which screen reader you're using) have to go down into the table as an object and look at its features separately, then get out of the table again to carry on navigating the content. table layouts are a relic of the past — they made sense back when css support was not wide...
...ands table example — you can see a few accessibility aids at work here: table headers are defined using <th> elements — you can also specify if they are headers for rows or columns using the scope attribute. this gives you complete groups of data that can be consumed by screen readers as single units. ...
......
...And 16 more matches
Index - Archive of obsolete content
the code snippets on this page will let your site work until these new features are more widely available. 190 isdefaultnamespace no summary! 191 js xpcom code snippets, javascript, xpcom, about:, nsiabout...
...y of things. this page applies to thunderbird (mail/news). 491 java in firefox extensions add-ons, extensions, java if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread,
although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., 492 javascript os.shared m...
...d control the statusbar of the browser. you can find the complete sourcecode in the status-bar-panel.js file in your jetpack repository. 548 litmus tests litmus tests are (non-automated) tests that are documented in the litmus database. see http://litmus.mozilla.org. 549 mac os x build prerequisites/fink fink is a package management system for mac os x,
alternative to macports. it doesn't seem to be as well maintained (in terms of available packages) as macports, so it is strongly suggested that you use macports instead of fink. 550 makefile.mozextension.2 this makefile is a modification of the makefile.mozextention, found in makefile for packaging an extension - mozillazine knowledge base (2005). 551 measuring add-o...
...And 15 more matches
nsINavBookmarksService
ed along. void changebookmarkuri( in nsiuri olduri, obsolete since gecko 1.9 in long long aitemid, in nsiuri anewuri ); parameters olduri obsolete since gecko 1.9 the uri of the item to be changed. aitemid the item whose bookmark uri needs to be changed. anewuri the new uri. obsolete since gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this method creates a dynamic container under the given parent folder. long long createdynamiccontainer( in long long aparentfolder, in autf8string aname, in astring acontractid, in long aindex ); parameters aparentfolder the id of the parent folder. aname...
...e uri of the bookmark, in this case "mozilla.org". note: will only return bookmarks in the first 3 levels of redirection (1 -> 2 -> 3 -> auri). nsiuri getbookmarkedurifor( in nsiuri auri ); parameters auri the uri that needs to be checked if it is bookmarked or not. return value native code only!getbookmarkfolderstarray obsolete since gecko 1.9 (firefox 3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. tarray version of getbookmarkfolders() for ease of use in c++ code. pass in a reference to a tarray; it will get cleared and filled with the resulting list of folder ids. void getbookmarkfolderstarray( in nsiuri auri, in print64array aresult ); parameters auri ...
...auri, out unsigned long count, optional [array, retval, size_is(count)] out long long bookmarks ); parameters auri the uri whose list of bookmark ids is to be retrieved. count the count of bookmark ids. bookmarks the list of bookmark ids. native code only!getbookmarkidsforuritarray obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this method is a tarray version of getbookmarkidsforuri() for ease of use in c++ code. pass in a reference to a tarray; it will get cleared and filled with the resulting list of folder ids. void getbookmarkidsforuritarray( in nsiuri auri, in print64array aresult ); ...
...And 15 more matches
SubtleCrypto.unwrapKey() - Web APIs
e unwrapkey() method supports the same algorithms as the wrapkey() method. examples note: you can try the working examples on github. unwrapping a "raw" key in this example we unwrap an aes-gcm symmetric key. the key was exported in "raw" format and encrypted using the aes-kw algorithm, with a key derived from a password. to unwrap, we ask the user for the password and use pbkdf2 and some s
alt to derive the aes-kw unwrapping key. the s
alt needs to be the same as the s
alt that was used to derive the original aes-kw key wrapping key. once we have the unwrapping key we pass it into unwrapkey() with the wrapped key and other parameters. see the complete code on github. /* s
alt that is to be used in derivation of the key-wrapping key, alongside the password the user supplies. this must ma...
...e the aes-kw unwrapping key. the s
alt needs to be the same as the s
alt that was used to derive the original aes-kw key wrapping key. once we have the unwrapping key we pass it into unwrapkey() with the wrapped key and other parameters. see the complete code on github. /* s
alt that is to be used in derivation of the key-wrapping key, alongside the password the user supplies. this must match the s
alt value that was originally used to derive the key. */ const s
altbytes = [89,113,135,234,168,204,21,36,55,93,1,132,242,242,192,156]; /* the wrapped key itself. */ const wrappedkeybytes = [171,223,14,36,201,233,233,120,164,68,217,192,226,80, 224,39,199,235,239,60,212,169,100,23,61,54,244,197,160,80,109,230,207, 225,57,197,175,71,80,209]; /* convert an array of byte values to an arraybuffer...
... your password"); let enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* derive an aes-kw key using pbkdf2. */ async function getunwrappingkey() { // 1. ...
...And 14 more matches
imgIContainer
ore the previous(composited) frame. obsolete since gecko 2.0 kblendsource 0 all color components of the frame, including alpha, const long kblendover = 1; // the frame should be composited onto the output buffer. obsolete since gecko 2.0 methods native code only!addrestoredata obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void addrestoredata( [array, size_is(acount), const] in char data, in unsigned long acount ); parameters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendfram...
...me. try to avoid using it. void addrestoredata( [array, size_is(acount), const] in char data, in unsigned long acount ); parameters data missing description acount missing description exceptions thrown missing exception missing description native code only!appendframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. adds to the end of the list of frames. void appendframe( in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength ); parameters ax ...
...description awidth missing description aheight missing description aformat missing description imagedata missing description imagelength missing description exceptions thrown missing exception missing description native code only!appendpalettedframe obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void appendpalettedframe( in print32 ax, in print32 ay, in print32 awidth, in print32 aheight, in gfximageformat aformat, in pruint8 apalettedepth, [array, size_is(imagelength)] out pruint8 imagedata, out unsigned long imagelength, [array, size_is(palette...
...And 13 more matches
Index
e of nss's expectation to operate with an nss database, it's mandatory that you perform an initialization call, where you tell nss which database you will be using. in the most simple scenario, the programmer will provide a directory on your filesystem as a parameter to the init function, and nss is designed to do the rest. it will detect and open an existing database, or it can create a new one.
alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public por...
... only. when dealing with certificates (x.509), file formats such as pkcs#12 (certificates and keys), pkcs#7 (signed data), and message formats as cms, we should mention asn.1, which is a syntax for storing structured data in a very efficient (small sized) presentation. it was originally developed for telecommunication systems at times where it was critical to minimize data as much as possible (
although it still makes sense to use that principle today for good performance). in order to process data available in the asn.1 format, the usual approach is to parse it and transfer it to a presentation that requires more space but is easier to work with, such as (nested) c data structures. over the time nss has received three different asn.1 parser implementations, each having their own specific p...
...th their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it will be necessary to try multiple different
alternative routes while searching for (z), in a recursive manner. only the newer verification engine (internally named libpkix) is capable of doing that properly. it's worth mentioning the extended validation (ev) principle, which is an effort by software vendors and cas to define a stricter set of rules for issuing certificates for web site certificates. instead of simply verifying that the requ...
...And 12 more matches
Background Tasks API - Web APIs
eratively scheduled background tasks</a> using the <code>requestidlecallback()</code> method. </p> <div class="container"> <div class="label">decoding quantum filament tachyon emissions...</div> <progress id="progress" value="0"></progress> <div class="button" id="startbutton"> start </div> <div class="label counter"> task <span id="currenttasknumber">0</span> of <span id="tot
altaskcount">0</span> </div> </div> <div class="logbox"> <div class="logheader"> log </div> <div id="log"> </div> </div> the progress box uses a <progress> element to show the progress, along with a label with sections that are changed to present numeric information about the progress. in addition, there's a "start" button (creatively given the id "startbutton"), which the user will u...
...rogress { width: 100%; padding-top: 6px; } javascript content now that the document structure is defined, construct the javascript code that will do the work. the goal: to be able to add requests to call functions to a queue, with an idle callback that runs those functions whenever the system is idle for long enough a time to make progress. ...
... long enough a time to make progress. variable declarations let tasklist = []; let tot
altaskcount = 0; let currenttasknumber = 0; let taskhandle = null; these variables are used to manage the list of tasks that are waiting to be performed, as well as status information about the task queue and its execution: tasklist is an array of objects, each representing one task waiting to be run. tot
altaskcount is a counter of the number of tasks that have been added to the queue; it will only go up, never down. we use this to do the math to present progress as a precentage of total work to do. currenttasknumber is used to track how many tasks have been processed so far. ...
...And 12 more matches
How to build a binary XPCOM component using Visual Studio
ding arguments and return types, of the component. component implementation using c++. the implementation is where the methods actually do the work. component factory module, also in c++. the factory is in charge of creating instances of the implementations. let’s specify a simple interface: #include "nsisupports.idl" [scriptable, uuid(263ed1ba-5cc1-11db-9673-00e08161165f)] interface ispeci
althing : nsisupports { attribute astring name; long add(in long a, in long b); }; remember to generate your own guid. the next step is to compile the idl into a type-library (*.xpt) and a c++ header file (*.h), which we can use to define our implementation object. the blank vc++ project has a bat file that will create the xpt and the h files. the command executes xpidl.exe twice, like this: {...
...he command executes xpidl.exe twice, like this: {path_to_geckosdk}\bin\xpidl.exe -m header -i..\gecko-sdk\idl {your_idl_file} {path_to_geckosdk}\bin\xpidl.exe -m typelib -i..\gecko-sdk\idl {your_idl_file} the generated h file actually has a skeleton implementation (commented out). you can take the code and create implementation h and cpp files. ...
...ice, like this: {path_to_geckosdk}\bin\xpidl.exe -m header -i..\gecko-sdk\idl {your_idl_file} {path_to_geckosdk}\bin\xpidl.exe -m typelib -i..\gecko-sdk\idl {your_idl_file} the generated h file actually has a skeleton implementation (commented out). you can take the code and create implementation h and cpp files. ...
...And 11 more matches
SubtleCrypto.wrapKey() - Web APIs
h as aes-gcm is that aes-kw does not require an initialization vector. to use aes-kw, the input must be a multiple of 64 bits. aes-kw is specified in rfc 3394. examples note: you can try the working examples out on github. raw wrap this example wraps an aes key. it uses "raw" as the export format and aes-kw, with a password-derived key, to encrypt it. see the complete code on github. let s
alt; /* get some key material to use as input to the derivekey method. the key material is a password supplied by the user. */ function getkeymaterial() { const password = window.prompt("enter your password"); const enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* giv...
...input to the derivekey method. the key material is a password supplied by the user. */ function getkeymaterial() { const password = window.prompt("enter your password"); const enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* given some key material and some random s
alt derive an aes-kw key using pbkdf2. */ function getkey(keymaterial, s
alt) { return window.crypto.subtle.derivekey( { "name": "pbkdf2", s
alt: s
alt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-kw", "length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* wrap the given key. */ async function wrapcryptokey(keytowrap) { ...
...eturn window.crypto.subtle.derivekey( { "name": "pbkdf2", s
alt: s
alt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-kw", "length": 256}, true, [ "wrapkey", "unwrapkey" ] ); } /* wrap the given key. */ async function wrapcryptokey(keytowrap) { // get the key encryption key const keymaterial = await getkeymaterial(); s
alt = window.crypto.getrandomvalues(new uint8array(16)); const wrappingkey = await getkey(keymaterial, s
alt); return window.crypto.subtle.wrapkey( "raw", keytowrap, wrappingkey, "aes-kw" ); } /* generate an encrypt/decrypt secret key, then wrap it. */ window.crypto.subtle.generatekey( { name: "aes-gcm", length: 256, }, true, ["encrypt", "decrypt"] ) .then((sec...
...And 10 more matches
Perceivable - Accessibility
ility guidelines (wcag) 2.0 and 2.1. perceivable states that users must be able to perceive it in some way, using one or more of their senses. note: to read the w3c definitions for perceivable and its guidelines and success criteria, see principle 1: perceivable - information and user interface components must be presentable to users in ways they can perceive. guideline 1.1 — providing text
alternatives for non-text content the key here is that text can be converted to other forms that people with disabilities can use. for example, it can be spoken by a screenreader, converted to large print, or represented on a braille display. non-text content refers to multimedia such as images, audio, and video. success criteria how to conform to the criteria practical resource ...
...ies can use. for example, it can be spoken by a screenreader, converted to large print, or represented on a braille display. non-text content refers to multimedia such as images, audio, and video. ...
... it can be spoken by a screenreader, converted to large print, or represented on a braille display. non-text content refers to multimedia such as images, audio, and video. success criteria how to conform to the criteria practical resource 1.1.1 provide text equivalents (a) all images that convey meaningful content should be given suitable
alternative text. text
alternatives. complex images or charts should have an accessible
alternative provided, either on the same page or via a link. use a regular link instead of a longdesc attribute. a text description may work, or an accessible data table (see html table advanced features and accessibility). see other text
alternative mechanisms for the argument against longdesc. multimedia ...
...And 10 more matches
OpenType font features guide - CSS: Cascading Style Sheets
ile others are left to the designer or developer to choose to enable in specific scenarios. in addition to broad feature sets like ligatures or lining figures (numerals that line up evenly as opposed to 'oldstyle', which look more like lower-case letters), there are also very specific ones such as stylistic sets (which might include several specific variants of glyphs meant to be used together),
alternates (which might be one or more variants of the letter 'a'), or even language-specific
alterations for east asian languages. in the latter case, these
alterations are actually necessary to properly express the language, so they go beyond the more stylistic preference of most other opentype features. caution: there are many css attributes defined to leverage font features, but unfortunately m...
...serif pro, ibm plex serif, dancing script, and kokoro (all available and free to use, most are on google fonts and other services). kerning (font-kerning) this refers to the spacing between specific glyph pairings. this is generally on by default (as recommended by the opentype specification). it should be noted that if letter-spacing is also set on your text, that is applied after kerning. ...
..., dancing script, and kokoro (all available and free to use, most are on google fonts and other services). kerning (font-kerning) this refers to the spacing between specific glyph pairings. this is generally on by default (as recommended by the opentype specification). it should be noted that if letter-spacing is also set on your text, that is applied after kerning. ...
...And 10 more matches
Web video codec guide - Web media technologies
loss of sharpness the act of removing data in the process of encoding video requires that some details be lost. if enough compression is applied, parts or potentially all of the image could lose sharpness, resulting in a slightly fuzzy or hazy appearance. lost sharpness can make text in the image difficult to read, as text—especially small text—is very detail-oriented content, where minor
alterations can significantly impact legibility. ringing lossy compression algorithms can introduce ringing, an effect where areas outside an object are contaminated with colored pixels generated by the compression algorithm. this happens when an algorithm that uses blocks that span across a sharp boundary between an object and its background. this is particularly common at higher compression level...
...n your needs. in the end, the decisions about what sacrifices you're able to make are entirely up to you and/or your design team. codec details av1 the aomedia video 1 (av1) codec is an open format designed by the alliance for open media specifically for internet video. it achieves higher data compression rates than vp9 and h.265/hevc, and as much as 50% higher rates than avc. av1 is fully roy
alty-free and is designed for use by both the <video> element and by webrtc. av1 currently offers three profiles: main, high, and professional with increasing support for color depths and chroma subsampling. in addition, a series of levels are specified, each defining limits on a range of attributes of the video. these attributes include frame dimensions, image area in pixels, display and decode rat...
... avc (h.264) the mpeg-4 specification suite's advanced video coding (avc) standard is specified by the identical itu h.264 specification and the mpeg-4 part 10 specification. it's a motion compensation based codec that is wi...
...And 10 more matches
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
using eval in add-ons is almost always unnecessary, and many times even a security vulnerability. moreover, code using eval is harder to parse for a human mind, is often pretty complex, and relies on assumptions that are not necessarily true in the future or even now. this article is aimed at presenting
alternatives to common eval uses in add-ons and other javascript code. add-on authors are strongly encouraged to update their code to eliminate all instances of eval, no matter if the add-on is to be hosted in the mozilla add-ons gallery or not. in order to host your add-on with mozilla it is crucial to minimize or completely eliminate eval use in order to receive a positive review and have your add-on made public. if it cannot be easily proven that an eval() call is benign and necessary b...
...heir code to eliminate all instances of eval, no matter if the add-on is to be hosted in the mozilla add-ons gallery or not. in order to host your add-on with mozilla it is crucial to minimize or completely eliminate eval use in order to receive a positive review and have your add-on made public. if it cannot be easily proven that an eval() call is benign and necessary because there are no viable
alternatives, a mozilla add-ons gallery reviewer will generally reject the submission! parsing json mozilla provides native json support since firefox 3. there is simply no need to parse json using eval. additionally, parsing json retrieved from a remote location becomes a security vulnerability when parsed with the eval function. basically, you are executing remote code with full chrome access; t...
...in of the data is usually known in all instances and where vulnerabilities would have a much smaller impact. what about jsonp? jsonp, which really is just another script tag containing generated, remotely retrieved code, is generally not secure. it might be possible to execute any retrieved jsonp code in an unprivileged sandbox (which is complicated!), but if you have a choice, just avoid jsonp
altogether! passing around functions/code as strings often you'll want to pass functions or code to other functions, most notoriously settimeout and addeventlistener. often this is done passing around strings. // do not use! settimeout("dosomething();", 100); addeventlistener("load", "myaddon.init(); myaddon.onload();", true); setinterval(am_i_a_string_or_function_reference_qmark, 100); that in ...
...And 9 more matches
Handling common accessibility problems - Learn web development
most people immediately think of making sure websites/apps are usable by people with disabilities, for example: visually impaired people using screen readers or magnification/zoom to access text people with motor function impairments using the keyboard (or other non-mouse features) to activate website functionality. ...
... users of older devices that might not have the latest browsers. users of lower spec devices that might have slow processors. in a way, this whole module is about accessibility — cross browser testing makes sure that your sites can be used by as many people as possible. ...
...the element that is currently focused on the page. note: this technique will only work if you set your original event handlers via event handler properties (e.g. onclick). addeventlistener won't work. this is a lot of extra hassle to build the functionality back in. and there's bound to be other problems with it. better to just use the right element for the right job in the first place. text
alternatives text
alternatives are very important for accessibility — if a person has a visual or hearing impairment that stops them being able to see or hear some content, then this is a problem. the simplest text
alternative available is the humble
alt attribute, which we should include on all images that contain relevant content. this should contain a description of the image that successfully ...
...And 9 more matches
Text labels and names - Accessibility
er 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. there are a number of different types of problems in this category, found in different contexts, and each has its own solution. the different problems and solutions are discussed in the sections below. use
alt attribute to label area elements that have the href attribute in image maps, give each <area> element an
alt attribute containing a name that describes what resources the areas links to. failure to do so makes an image map hard to use for users of assistive technology — they need
alternative text to be able to understand the purpose of an image. examples the following example show a simple i...
...ve the href attribute in image maps, give each <area> element an
alt attribute containing a name that describes what resources the areas links to. failure to do so makes an image map hard to use for users of assistive technology — they need
alternative text to be able to understand the purpose of an image. 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. ...
...le to understand the purpose of an image. 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. select an area for more information on that area." /> <map id="map1" name="map1"> <area shape="rect" coords="0,0,30,30" href="reference.html"
alt="reference" /> <area shape="rect" coords="34,34,100,100" href="media.html"
alt="audio visual lab" /> </map> see the <area> element reference page for a live interactive example. ...
...And 9 more matches
min-width - CSS: Cascading Style Sheets
full support 33safari ios full support 11 full support 11 full support 7prefixed prefixed implemented with the vendor prefix: -webkit-samsung internet android full support 5.0
alternate name full support 5.0
alternate name
alternate name uses the non-standard name: -webkit-fill-availablemax-contentchrome full support 46 full support 46 full support 25prefixed prefixed implemented with the vendor ...
... noopera full support 15prefixed full support 15prefixed prefixed implemented with the vendor prefix: -webkit-safari full support 11 full support 11 full support 2
alternate name
alternate name uses the non-standard name: intrinsicwebview android full support 46 full support 46 full support ≤37prefixed prefixed implemented with the vendor prefix: -webkit-chrome android full support ...
... 66 full support 4prefixed prefixed implemented with the vendor prefix: -moz-opera android full support 33safari ios full support 11 full support 11 full support 1
alternate name
alternate name uses the non-standard name: intrinsicsamsung internet android full support 5.0min-contentchrome full support 46 full support 46 full support 25prefixed prefixed implemented with the vendor pref...
...And 9 more matches
Link types - HTML: Hypertext Markup Language
in html, link types indicate the relationship between two documents, in which one links to the other using an <a>, <area>, <form>, or <link> element. ...
...ween two documents, in which one links to the other using an <a>, <area>, <form>, or <link> element. 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. ...
...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. if the type is set to application/rss+xml or application/atom+xml, the link defines a syndication feed. the first one defined on the page is the default. ...
...And 9 more matches
Fundamental text and font styling - Learn web development
georgia s...
... georgia serif times n...
... in the late 90s and early 2000s): name generic type notes arial sans-serif it's often considered best practice to also add helvetica as a preferred
alternative to arial as,
although their font faces are almost identical, helvetica is considered to have a nicer shape, even if arial is more broadly available. courier new monospace some oses have an
alternative (possibly older) version of the courier new font called courier. it's considered best practice to use both with courier new as the preferred
alternative. georgia serif times new roman serif some oses have an
alternative (possibly older) version of the times new roman font called times. it's considered best practice to use both with times new roman as the pre...
...And 8 more matches
Mozilla’s UAAG evaluation report
notes/plans checkpoint title status notes/plans 2.1 render content according to specification. (p1) vg renders html, css, and a number of graphic image formats. does not contradict current specifications for html and css rendering. 2.2 provide text view. (p1) c also known as view source. 2.3 render conditional content. ...
...der content according to specification. (p1) vg renders html, css, and a number of graphic image formats. does not contradict current specifications for html and css rendering. 2.2 provide text view. (p1) c also known as view source. 2.3 render conditional content. (p1) vg
alt for img: rendered when images turned off. see meta bug 41924 for open issues with the
alt attribute. ...
...tml and css rendering. 2.2 provide text view. (p1) c also known as view source. 2.3 render conditional content. (p1) vg
alt for img: rendered when images turned off. see meta bug 41924 for open issues with the
alt attribute. title for *any* element: rendered as tooltip longdesc for img element: in context menu - properties content of object element: ?
alt for area element: ?
alt for input element: ? acronym element: supported abbr element: supported abbr attribute for td/th: not supported summary for table: supported title for frame: ? longdesc for frame: not supported, see bug 3658 noframe for frame: must use user style sheets to render this. a ui for this would be good. noscript for script: must use user style...
...And 8 more matches
KeyboardEvent.getModifierState() - Web APIs
e. the value must be one of the keyboardevent.key values which represent modifier keys, or the string "accel" . this is case-sensitive. modifier keys on internet explorer ie9 uses "scroll" for "scrolllock" and "win" for "os". ...
...st be one of the keyboardevent.key values which represent modifier keys, or the string "accel" . this is case-sensitive. modifier keys on internet explorer ie9 uses "scroll" for "scrolllock" and "win" for "os". ...
...f the keyboardevent.key values which represent modifier keys, or the string "accel" . this is case-sensitive. modifier keys on internet explorer ie9 uses "scroll" for "scrolllock" and "win" for "os". ...
...And 8 more matches
<input type="image"> - HTML: Hypertext Markup Language
form of an image rather than text. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. value none — the value attribute should not be specified. events none. supported common attributes
alt, src, width, height, formaction, formenctype, formmethod, formnovalidate, formtarget idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. additional attributes in addition to the attributes shared by all <input> elements, image button inputs ...
...get idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. ...
... idl attributes none. methods none. value <input type="image"> elements do not accept value attributes. the path to the image to be displayed is specified in the src attribute. ...
...And 8 more matches
XUL accessibility guidelines - Archive of obsolete content
ly left to right, top to bottom. navigation order may vary depending on the nature of the application or the reading direction of the language. ensure that tab order is logical and all interactive elements can be accessed simply without the use of a mouse. you should be able to perform all functionality either directly in the application or through menu items or the context menu. trees provide
alternative functionality for inaccessible operations. the column picker and column headers in xul trees are not keyboard accessible, consistent with the standard tree behavior on most contemporary operating systems. it is therefore necessary to provide a keyboard accessible
alternative for accessing this functionality. the firefox "bookmarks manager" provides an example of how to make trees more ...
...on a click of the right mouse button. the oncontextmenu event and context attribute work with the correct platform-specific context menu triggers, including the keyboard button and appropriate mouse clicks. mouse dependent scripting functionality associated with mouse events such as onmouseover, onmousemove, and ondrag can only be activated with the use of the mouse. provide keyboard-accessible
alternative access points for this functionality. consider using context menu items or other xul elements along with keyboard shortcuts. scrolling ensure that scrolling is keyboard accessible. many xul elements can be set to scroll using css. other elements, such as arrowscrollbox and listbox, are made to scroll automatically. as a general rule, elements set to scroll are inaccessible if the user c...
...eating the jump operation and thereby skipping ahead one form field. initial dialog focus the initial focus in a xul dialog (i.e., the focus when the dialog is first opened) should always be on a specific control, not on the dialog itself. in a tabbed dialog, focus should normally start on the first control in the selected tab. ...
...And 7 more matches
AudioParam.cancelAndHoldAtTime() - Web APIs
n/browser-compat-data and send us a pull request. ...
...t-data and send us a pull request. ...
...ame: cancelvaluesandholdattime()edge full support ≤79firefox no support noie no support noopera full support 44 full support 44 no support ? ...
...And 7 more matches
TextEncoder.prototype.encodeInto() - Web APIs
ut it is well worth the length because of the gains in performance. ...
... in performance. ...
... "use strict"; var log = math.log; var ln2 = math.ln2; var clz32 = math.clz32 || function(x) {return 31 - log(x >>> 0) / ln2 | 0}; var fromcharcode = string.fromcharcode; var patchedu8array = window.uint8array || array; var textencoderprototype = textencoder["prototype"]; var glob
altextencoder = window["textencoder"]; var glob
altextencoderprototype; var glob
altextencoderinstance; ////////////////////////////////////////////////////////////////////////////////////// function encoderreplacer(nonasciichars){ // make the utf string into a binary utf-8 encoded string var point = nonasciichars.charcodeat(0)|0; if (0xd800 <= point && point <= 0xdbff) { var nextcode = nonasciichars.charcodeat(1)|0; // defaults to 0 wh...
...And 7 more matches
max-width - CSS: Cascading Style Sheets
css3 sizing.ie no support noopera full support 44safari full support 6.1prefixed full support 6.1prefixed prefixed implemented with the vendor prefix: -webkit- full support 2
alternate name
alternate name uses the non-standard name: intrinsicwebview android full support 46 full support 46 full support ≤37prefixed prefixed implemented with the vendor prefix: -webkit-chrome android full support ...
...so, the definition of fit-content is simpler than in css3 sizing.opera android full support 43safari ios full support 7prefixed full support 7prefixed prefixed implemented with the vendor prefix: -webkit- full support 1
alternate name
alternate name uses the non-standard name: intrinsicsamsung internet android full support 5.0max-content experimentalchrome full support 46 full support 46 full support 22prefixed prefixed implemented with th...
...refix: -moz-ie no support noopera full support 44safari full support 6.1prefixed full support 6.1prefixed prefixed implemented with the vendor prefix: -webkit- full support 2
alternate name
alternate name uses the non-standard name: intrinsicwebview android full support 46 full support 46 full support ≤37prefixed prefixed implemented with the vendor prefix: -webkit-chrome android full support ...
...And 7 more matches
The box model - Learn web development
th an understanding of how it works and the terminology that relates to it. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the css box model, what makes up the box model and how to switch to the
alternate model. block and inline boxes in css we broadly have two types of boxes — block boxes and inline boxes. these characteristics refer to how the box behaves in terms of page flow, and in relation to other boxes on the page: if a box is defined as a block, it will behave in the following ways: the box will break onto a new line. the box will extend in the inline direction to fil...
...ncentrate on the outer display type. what is the css box model? the full css box model applies to block boxes, inline boxes only use some of the behavior defined in the box model. the model defines how the different parts of a box — margin, border, padding, and content — work together to create a box that you can see on the page. to add some additional complexity, there is a standard and an
alternate box model. parts of a box making up a block box in css we have the: content box: the area where your content is displayed, which can be sized using properties like width and height. padding box: the padding sits around the content as white space; its size can be controlled using padding and related properties. border box: the border box wraps the content and any padding. its size and...
...+ 25 + 5 + 5), and the height 210px (150 + 25 + 25 + 5 + 5), as the padding and border are added to the width used for the content box. note: the margin is not counted towards the actual size of the box — sure, it affects the total space that the box will take up on the page, but only the space outside the box. the box's area stops at the border — it does not extend into the margin. the
alternative css box model you might think it is rather inconvenient to have to add up the border and padding to get the real size of the box, and you would be right! for this reason, css had an
alternative box model introduced some time after the standard box model. using this model, any width is the width of the visible box on the page, therefore the content area width is that width minus the width...
...And 6 more matches
Accessible Toolkit Checklist
the right iaccessible for each event. the checklist this checklist is currently only for microsoft windows, but should be expanded to include information about linux and os x. it is maintained by the mozilla accessibility community. contributions are welcome. general dialogs/windows/general escape key cancels dialogs and refocuses the previously focused on the parent window. ...
...osoft windows, but should be expanded to include information about linux and os x. it is maintained by the mozilla accessibility community. contributions are welcome. general dialogs/windows/general escape key cancels dialogs and refocuses the previously focused on the parent window.
alt+f4 closes windows, similar to escape but even works on dialogs without cancel button
alt+space opens window menu with restore, move, size, minimize, maximize, close the move and size options must be usable with the arrow keys on the keyboard in windows, initial focus goes to first focusable widget that is not a clickable tabbed property sheet label making tab order definable. default tab order should be in document order. tab order must wrap, not have invisibl...
...g what this iaccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a table cell, etc. get_accstate: a 32 bit field representing possible on/off states, such as focused, focusable, selected, selectable, visible, protected (for passwords), checked, etc. get_acckeyboardshortcut: what is the keyboard shortcut for this iaccessible (underlined
alt+combo mnemonic) get_accfocus: which child is focused? get_accselection: which children of this item are selected? acclocation: get the x,y coordinates, and the height and width of this iaccessible node. accnavigate: navigate to the first/last child, previous/next sibling, up, down, left or right from this iaccessible. [important, but no need to implement up...
...And 6 more matches
nsITextInputProcessor
ied, the methods don't dispatch the "keyup" event. key required. when you dispatch printable key events, this value should be the text to be inputted. even if the key event shouldn't cause text input actually, e.g., ctrl key is pressed, this value should be the text when such modifiers causing suppressing text input are not pressed. for example, ctrl+c should be "c", ctrl+shift+cshould be "c",
altgr+c may be "©" and then, ctrl+
altgr+c should be "©". when you dispatch non-printable key events, this value should be one of the key names defined by dom level 3 keyboardevent key values or registered by gecko with "moz" prefix. code optional, but should be specified when you emulate pc keyboard operation. the value should be one of the physical key names defined by dom level 3 keyboardeven...
...boardevent key values or registered by gecko with "moz" prefix. code optional, but should be specified when you emulate pc keyboard operation. the value should be one of the physical key names defined by dom level 3 keyboardevent code values. keycode optional, but should be specified when you dispatch printable key events. when you emulate pc keyboard, deciding the value may be complicated.
although the rules to decide the keycode value are different on each web browser, you should use same rules as gecko because your events are dispatched on gecko. basically, gecko decides a keycode value for a printable key from ascii character which is inputted with a far simpler modifier state. see "printable keys in standard position" section of keyboardevent.keycode for the strict rules of gecko. ...
...y); // this inactivates capslock state. tip.keyup(capslockkey); // this doesn't modify capslock state. ...
...And 6 more matches
nsIXPConnect
bject); void initclasses(in jscontextptr ajscontext, in jsobjectptr aglobaljsobj); nsixpconnectjsobjectholder initclasseswithnewwrappedglobal(in jscontextptr ajscontext, in nsisupports acomobj, in nsiidref aiid, in nsiprincipal aprincipal, in nsisupports aextraptr, in pruint32 aflags); nsivariant jstovariant(in jscontextptr ctx, in jsval value); nsivariant jsv
altovariant(in jscontextptr cx, in jsvalptr ajsval); void movewrappers(in jscontextptr ajscontext, in jsobjectptr aoldscope, in jsobjectptr anewscope); [noscript,notxpcom] void notejscontext(in jscontextptr ajscontext, in nscctraversalcallbackref acb); void releasejscontext(in jscontextptr ajscontext, in prbool nogc); void removejsholder(in voidptr aholder); nat...
...pt,notxpcom] void getcaller( out jscontextptr ajscontext, out jsobjectptr aobject ); parameters ajscontext missing description aobject missing description return value missing description exceptions thrown missing exception missing description native code only!getcowforobject obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. wrap a jsval in a chrome object wrapper. jsval getcowforobject( in jscontextptr ajscontext, in jsobjectptr aparent, in jsobjectptr awrappedobj ); parameters ajscontext a context to use to create objects. aparent the parent to create the wrapper with. awrap...
... jsobjectptr ascope, in nsiclassinfo aclassinfo ); parameters ajscontext missing description ascope missing description aclassinfo missing description return value missing description exceptions thrown missing exception missing description native code only!getwrapperforobject obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns an xpcnativewrapper, xpcsafejsobjectwrapper, or xpccrossoriginwrapper for the given object based on the principal, scope, and filename flags that are passed in. note: in c++, the out jsval parameter must already be a strong gc root. jsval getwrapperforobject( ...
...And 6 more matches
HTML attribute: rel - HTML: Hypertext Markup Language
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. every keyword within a space seperated value should be unique within that value. values for the rel attribute, and the elements for which each is relevant rel value description <link> <a> and <area> <form>
alternate
alternate representations of the current document. link link not allowed author author of the current document or article. link link not allowed bookmark permalink for the nearest ancestor section. not allowed link not allowed canonical preferred url for the current document. link not allowed not allowed dns...
...: apple's ios does not use this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. ...
...se this link type, nor the sizes attribute, like others mobile browsers do, to select a webpage icon for web clip or a start-up placeholder. instead it uses the non-standard apple-touch-icon and apple-touch-startup-image respectively. the shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. ...
...And 6 more matches
Defining Cross-Browser Tooltips - Archive of obsolete content
summary: authors are used to having
alt text appear as a "tooltip" above images, but that's not how it was meant to be used. learn how to define "tooltips" in a cross-browser, standards-friendly way. authors are used to using the
alt attribute to create "tooltips" in web browsers. the classic example is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the
alt attribute are displayed as a "tooltip." gecko-based browsers such as mozilla, netscape 6+, and compuserve 7 do not support this behavior. see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. ...
...is a "tooltip" of an image; when the user pauses the mouse pointer over an image, the contents of the
alt attribute are displayed as a "tooltip." gecko-based browsers such as mozilla, netscape 6+, and compuserve 7 do not support this behavior. see bug 25537 for a lengthy, sometimes passionate discussion of gecko's behavior in this regard. the problem according to the html 4.01 definition of the
alt attribute:
alt = text cs for user agents that cannot display images, forms, or applets, this attribute specifies
alternate text. the language of the
alternate text is specified by the lang attribute. in other words,
alt text should only be displayed when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images). in a visual browser...
...gents that cannot display images, forms, or applets, this attribute specifies
alternate text. the language of the
alternate text is specified by the lang attribute. in other words,
alt text should only be displayed when a user agent cannot display the primary content of the element (e.g., a text-mode browser that cannot display images). in a visual browser, the image should be displayed and the
alt text should not. this assumes that the browser can find the image and that it supports the image format used; if either of these is not true, and the image cannot be displayed, then the
alt text should be displayed in place of the missing image. on the other hand, the html 4.01 definition of the title attribute states: title = text cs this attribute offers advisory information about the elem...
...And 5 more matches
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
is nsdsuricontentlistener, which corresponds to a docshell and handles most of the data types that mozilla handles internally. nsiexternalhelperappservice if we can't do anything else with a load, we give it to the nsiexternalhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
...illa handles internally. nsiexternalhelperappservice if we can't do anything else with a load, we give it to the nsiexternalhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
...ppservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth. ...
...And 5 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
tests. introduction in an ideal world, we could author html, xml, css and javascript and only worry about the w3c and ecma standards. however, we don't quite live in such a world yet. due to bugs, incomplete implementations of the standards and legacy browsers, web developers must be able to determine which browser a visitor is using and provide the appropriate content and scripting code path.
although browser detection is perhaps the most common scripting task that every web developer faces, it seems that the variety of different strategies in use for detecting browsers is unlimited. as a member of the netscape evangelism team who has spent over a year investigating existing web content, i can say without a doubt that most compatibility problems found on the web today are due to a lack of...
... can say without a doubt that most compatibility problems found on the web today are due to a lack of understanding of the standards combined with inadequate and inappropriate browser detection strategies. this article is intended to provide an overview of browser detection strategies and best practices. for more specific gecko recommendations, please see the gecko compatibility handbook gecko
although many web developers are aware of firefox, mozilla, and netscape browsers, far fewer are aware that these browsers are members of an entire family of user agents based upon the gecko layout engine which includes the commercial browser compuserve 7, and open source browsers such as epiphany, galeon, camino, kmeleon, and seamonkey. gecko was designed from the ground up to be compliant with the...
...the browser provided. server side browser detection using user agent strings was born. user agent strings are defined in the http protocol and are available to web servers (see rfc 1945 - hypertext transfer protocol 1.0 and rfc 2068 - hypertext transfer protocol 1.1). the most common approach at this time was to distinguish user agents by vendor and version using the reported user agent string.
although this approach was considered reasonable at the time, this approach caused problems for browser vendors right from the beginning. the original netscape browsers used a user agent string which began with the code name for the netscape browser followed by its version number, e.g. mozilla/version followed by a comment token which gave additional information regarding the operating system being u...
...And 5 more matches
Add a hitmap on top of an image - Learn web development
tyled with css) are preferable to image maps for several reasons: text links are lightweight, maintainable, often more seo-friendly, and support accessibility needs (e.g., screen readers, text-only browsers, translation services). how to insert an image map, properly step 1: the image not just any image is acceptable. the image must make it clear what happens when people follow image links.
alt text is mandatory, of course, but many people never see it. the image must clearly indicate where hotspots begin and end. hotspots must be large enough to tap comfortably, at any viewport size. how large is large enough? 72 × 72 css pixels is a good minimum, with additional generous gaps between touch targets. the map of the world at 50languages.com (as of time of writing) illustrates the prob...
...ably, at any viewport size. how large is large enough? 72 × 72 css pixels is a good minimum, with additional generous gaps between touch targets. the map of the world at 50languages.com (as of time of writing) illustrates the problem perfectly. it’s much easier to tap russia or north america than albania or estonia. ...
...a good minimum, with additional generous gaps between touch targets. the map of the world at 50languages.com (as of time of writing) illustrates the problem perfectly. it’s much easier to tap russia or north america than albania or estonia. you insert your image much the same way as always (with an <img> element and
alt text). if the image is only present as a navigation device, you may write
alt="", provided you furnish appropriate
alt text in the <area> elements later on. ...
...And 5 more matches
Responsive images - Learn web development
wser several image files, either all showing the same thing but containing different numbers of pixels (resolution switching), or different images suitable for different space allocations (art direction). note: the new features discussed in this article — srcset/sizes/<picture> — are all supported in release versions of modern desktop and mobile browsers (including microsoft's edge browser,
although not internet explorer.) how do you create responsive images? in this section, we'll look at the two problems illustrated above and show how to solve them using html's responsive image features. you should note that we will be focusing on the html <img>s for this section, as seen in the content area of the example above — the image in the site header is only for decoration, and therefor...
...itching: different sizes so, what is the problem that we want to solve with resolution switching? we want to display identical image content, just larger or smaller depending on the device — this is the situation we have with the second content image in our example. the standard <img> element traditionally only lets you point the browser to a single source file: <img src="elva-fairy-800w.jpg"
alt="elva dressed as a fairy"> we can however use two new attributes — srcset and sizes — to provide several additional source images along with hints to help the browser pick the right one. you can see an example of this in our responsive.html example on github (see also the source code): <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600p...
...s — srcset and sizes — to provide several additional source images along with hints to help the browser pick the right one. you can see an example of this in our responsive.html example on github (see also the source code): <img srcset="elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w" sizes="(max-width: 600px) 480px, 800px" src="elva-fairy-800w.jpg"
alt="elva dressed as a fairy"> the srcset and sizes attributes look complicated, but they're not too hard to understand if you format them as shown above, with a different part of the attribute value on each line. each value contains a comma-separated list, and each part of those lists is made up of three sub-parts. let's run through the contents of each now: srcset defines the set of images we wil...
...And 5 more matches
Mozilla Web Developer FAQ
s text/html. width and height do not apply to non-replaced inline elements such as (by default) <span>. text-align: center; centers inline content within a block. it does not (and should not) center the block box itself. a block is centered by setting its margin-left and margin-right to auto and its width to a value that makes the block narrower than its containing block. it is also possible,
although not very likely, that you are seeing a bug. javascript doesn’t work! why? some proprietary document objects such as document.all and document.layers are not part of the w3c dom and are not supported in mozilla. (there is partial undetectable support for document.all, though, in newer versions of mozilla. however, that functionality only exists for compatibility with sites authored specif...
...interoperability, and checking for a particular browser defeats that purpose. when working with the dom, it is better to check for the existence of the methods and objects you are planning on using. ...
...k for the existence of the methods and objects you are planning on using. 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? contrary to a popular belief stemming from the behavior of a couple browsers running on the windows platform,
alt isn’t an abbreviation for ‘tooltip’ but for ‘
alternative’. ...
...And 5 more matches
Index
uide a hashtable is a data construct that stores a set of items. each item has a key that identifies the item. items are found, added, and removed from the hashtable by using the key. hashtables may seem like arrays, but there are important differences: 123 mozilla::services namespace developing mozilla, xpcom the services c++ namespace offers an easy and efficient
alternative for obtaining a service as compared to the indirect xpcom approach: getservice(), callgetservice(), etc methods are expensive and should be avoided when possible. 124 xpcom ownership guidelines xpcom ...naturally. if you create a temporary object, obviously it's up to you to destroy it. that's a sure sign of ownership. if you create an object with a longer lifespan, y...
...y: @mozilla.org/inspector/dom-utils;1 as a service: 192 jsdistackframe interfaces, interfaces:scriptable, needscontent, needshelp, xpcom, xpcom interface reference strict mode is on. warnings reported as errors. makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'. private data for this object is an nsisupports object. attempting to
alter this bit will result in an ns_error_illegal_value. opt_* values above, or'd together. last version set on this context. scripts typically select this with the "language" attribute. see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. private data for this context, if it is an nsisupports, |null| otherwise. retrieve the underlying...
... jsdiephemeral interface. once a jsdistackframe has been invalidated all method and property accesses will throw a ns_error_not_available exception. 193 moziasyncfavicons interfaces, interfaces:scriptable, places nsifaviconservice handles this interface, so you do not need to directly create a new service. simply queryinterface() the nsifaviconservice to this interface. as an
alternative, you can just use placesutils.favicons from javascript. 194 moziasynchistory interfaces, interfaces:scriptable, places, xpcom interface reference implemented by: @mozilla.org/browser/history;1 as a service: 195 mozicoloranalyzer interfaces, interfaces:scriptable, places, reference, xpcom api reference, xpcom interface reference given an image uri,...
...And 5 more matches
Deprecated tools - Firefox Developer Tools
over the course of devtools development, we have added several experimental panels to try out new ideas. not all of these have had wide adoption, and due to the cost of maintenance, seldom used panels are eventually removed. we have created this list of deprecated or removed panels. this page documents the deprecated panels and the bugs that track their removal.
although these panels have been removed, you still have access to the old code, and there are
alternative webextensions that you can try to get similar functionality. when we deprecate a panel, we begin by getting feedback from the community to determine the impact of removing that panel. once we have decided to remove the panel, we will provide a warning message, and finally, we will remove the panel from the codebase. you may se...
... you open the panel for one of these tools, you will also see a warning message about its removal. scratchpad scratchpad is deprecated as of firefox 70 (bug 1565380), and will be removed as of firefox 72 (bug 1519103). description scratchpad provided an environment for experimenting with javascript code. you can write, run, and examine the result of code that interacts with the web page.
alternatives in firefox 71+, you can write multi-line javascript code in the web console editor mode, making it similar to the scratchpad. the editor mode can be triggered clicking on the icon on the right of the console input, or with ctrl + b (cmd + b on macos) when in editor mode, the enter key adds a new line in the input, and you can evaluate the expression using ctrl + enter (cmd + enter on m...
...ut content to a file using ctrl + s (cmd + s on macos). webide and connect page webide was deprecated as of firefox 69 disabled as of firefox 70 (bug 1539451). removed as of firefox 71 (bug 1539462). description webide allowed you to connect the firefox developer tools to remote browsers, such as firefox for android. it was also intended to support application development for firefox os.
alternatives remote debugging is available in about:debugging as of firefox 68. features not ported to about:debugging are: wifi debugging for firefox for android, application development. features that are planned but not ported yet: remote browser screenshots and edit remote browser configuration. more details on the mailing-list thread. canvas debugger bugzilla issue: bug 1403938 removed as of...
...And 5 more matches
KeyboardEvent: code values - Web APIs
keyc" "keyc" 0x002f "keyv" "keyv" 0x0030 "keyb" "keyb" 0x0031 "keyn" "keyn" 0x0032 "keym" "keym" 0x0033 "comma" "comma" 0x0034 "period" "period" 0x0035 "slash" "slash" 0x0036 "shiftright" "shiftright" 0x0037 "numpadmultiply" "numpadmultiply" 0x0038 "
altleft" "
altleft" 0x0039 "space" "space" 0x003a "capslock" "capslock" 0x003b "f1" "f1" 0x003c "f2" "f2" 0x003d "f3" "f3" 0x003e "f4" "f4" 0x003f "f5" "f5" 0x0040 "f6" "f6" 0x0041 "f7" "f7" 0x0042 "f8" "f8" 0x0043 "f9" "f9" 0x...
...004b "numpad4" "numpad4" 0x004c "numpad5" "numpad5" 0x004d "numpad6" "numpad6" 0x004e "numpadadd" "numpadadd" 0x004f "numpad1" "numpad1" 0x0050 "numpad2" "numpad2" 0x0051 "numpad3" "numpad3" 0x0052 "numpad0" "numpad0" 0x0053 "numpaddecimal" "numpaddecimal" 0x0054 (
alt + printscreen) "printscreen" "" 0x0055 "unidentified" "" 0x0056 "intlbackslash" "intlbackslash" 0x0057 "f11" "f11" 0x0058 "f12" "f12" 0x0059 "numpadequal" "" 0x005a "unidentified" "" 0x005b "unidentified" "f13" 0x005c "unidentified" "f14...
... "audiovolumeup" "volumeup" (was "volumeup" until chrome 50) 0xe031 "unidentified" "" 0xe032 "browserhome" "browserhome" 0xe033, 0xe034 "unidentified" "" 0xe035 "numpaddivide" "numpaddivide" 0xe036 "unidentified" "" 0xe037 "printscreen" "printscreen" 0xe038 "
altright" "
altright" 0xe039, 0xe03a "unidentified" "" 0xe03b "unidentified" "help" 0xe03c~ 0xe044 "unidentified" "" 0xe045 "numlock" "numlock" 0xe046 (ctrl + pause) "pause" "pause" 0xe047 "home" "home" 0xe048 "arrowup" "arrowup" 0xe049 "pageup" "pageu...
...And 5 more matches
Index - Archive of obsolete content
itlebarcolor xul attributes, xul reference no summary! 12 afterselected xul attributes, xul reference no summary! 13 align reference, référence(2), xul no summary! 14 allowevents xul attributes, xul reference no summary! 15 allownegativeassertions xul attributes, xul reference no summary! 16
alternatingbackground xul attributes, xul reference no summary! 17 alwaysopenpopup xul attributes, xul reference no summary! 18 attribute xul attributes, xul reference no summary! 19 autofillaftermatch xul attributes, xul reference no summary! 20 autocheck xul attributes, xul reference no summary! 21 ...
... editor xul properties, xul reference no summary! 700 editortype xul properties, xul reference no summary! 701 emptytext xul properties, xul reference no summary! 702 enablecolumndrag xul properties, xul reference no summary! 703 eventnode xul properties, xul reference no summary! 704 extern
altoolbars toolbars, xul, xul reference no summary! 705 findmode no summary! 706 firstordinalcolumn xul properties, xul reference no summary! 707 firstpermanentchild xul properties, xul reference no summary! 708 flex xul properties, xul reference no summary! 709 flexgroup no summary! ...
... are generated from a query, content is generated in the same order as the results. for an xml datasource, generated content will be output in the order corresponding to the results of the xpath query expression. for an sqlite datasource, the generated content corresponds to the order of results of the sql query. for an rdf datasource, again, the results are in the order the query generates them,
although except in the case of an rdf seq, this order is arbitrary as rdf triples don't occur in any particular order. when the reference node is an rdf seq container and the results are in that container, however, the template builder orders the results in the order the items appear in the seq. for instance, the photos are listed in the same order in this example as they appear in the seq in the dat...
...And 4 more matches
Keyboard Shortcuts - Archive of obsolete content
only triggered when the user is focused on a particular element). creating a keyboard shortcut xul provides methods in which you can define keyboard shortcuts. we've already seen in the section on menus that we can define an attribute called accesskey which specifies the key which a user can press to activate the menu or menu item. in the example below, the file menu can be selected by pressing
alt + f together (or some other key combination for a specific platform). once the file menu is open, the close menu item can be selected by pressing c. example 1 : source view <menubar id="sample-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem id="close-command" label="close" accesskey="c"/> </menupopup> </menu> </menubar> you ca...
...le" accesskey="f"> <menupopup id="file-popup"> <menuitem id="close-command" label="close" accesskey="c"/> </menupopup> </menu> </menubar> you can also use the accesskey attribute on buttons. when the key is pressed in this case, the button is selected. you might want to set up more general keyboard shortcuts however. for example, pressing ctrl + c to copy text to the clipboard.
although shortcuts such as this might not always be valid, they will usually work any time the window is open. usually, a keyboard shortcut will be allowed at any time and you can check to see whether it should do something using a script. for example, copying text to the clipboard should only work when some text is selected. key element xul provides an element, key, which lets you define a keyboar...
...s the shift key and r. the key attribute (note that it has the same name as the element itself) can be used to indicate which key should be pressed, in this case r. you could add any character for this attribute to require that key to be pressed. the modifiers that must be pressed are indicated with the modifiers attribute. it is a space-separated list of modifier keys, which are listed below.
alt the user must press the
alt key. on the macintosh, this is the option key. control the user must press the ctrl key. meta the user must press the meta key. this is the command key on the macintosh. shift the user must press the shift key. os the user must press the win key. this is the super key or the hyper key on linux. if this value is used, typically the key combination conflicts wit...
...And 4 more matches
Examples - Archive of obsolete content
--> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" xml:lang="en-us"> <head> ...
...his document contains inline css rules contained in a <code>style</code> element and surrounded by a sgml comment. </p> <p> note how the css rules for the background are applied in netscape 7.x, mozilla, opera 7 and internet explorer 5.5+. ...
... element and surrounded by a sgml comment. </p> <p> note how the css rules for the background are <strong>not</strong> applied in netscape 7.x, mozilla and opera 7 and that internet explorer 5.5+ can not display the page correctly at all. ...
...And 4 more matches
CSS and JavaScript accessibility best practices - Learn web development
s, lining up labels and inputs, and getting them looking neat and tidy. you shouldn't however deviate too much from the expected visual feedback form elements receive when they are focused, which is basically the same as links (see above). you could style form focus/hover states to make this behaviour more consistent across browsers or fit in better with your page design, but don't get rid of it
altogether — again, people rely on these clues to help them know what is going on. tables tables for presenting tabular data. you can see a good, simple example of table html and css in our table-css.html example (see it live also). table css generally serves to make the table fit better into your design and look less ugly. it is a good idea to make sure the table headers stand out (normally us...
...k them with an asterisk and in red. hiding things there are many instances where a visual design will require that not all content is shown at once. for example, in our tabbed info box example (see source code) we have three panels of information, but we are positioning them on top of one another and providing tabs that can be clicked to show each one (it is also keyboard accessible — you can
alternatively use tab and enter/return to select them). screen reader users don't care about any of this — they are happy with the content as long as the source order makes sense, and they can get to it all. absolute positioning (as used in this example) is generally seen as one of the best mechanisms of hiding content for visual effect, because it doesn't stop screen readers from getting to it.
... button that activate functions. as we looked at in our html: a good basis for accessibility article, the key considerations are: good semantics: using the right element for the right job. for example, making sure you use headings and paragraphs, and <button> and <a> elements making sure content is available as text, either directly as text content, good text labels for form elements, or text
alternatives, e.g.
alt text for images. we also looked at an example of how to use javascript to build in functionality where it is missing — see building keyboard accessibility back in. this is not ideal — really you should just use the right element for the right job — but it shows that it is possible in situations where for some reason you can't control the markup that is used. another way...
...And 4 more matches
Styling tables - Learn web development
t in a sequence, inside a <thead> element") and given them set percentage widths. the entire column width follows the width of its heading, making for a nice way to size your table columns. chris coyier discusses this technique in more detail in fixed table layouts. ...
...ll any container it is put in, and be nicely responsive (
although it would still need some more work to get it looking good on narrow screen widths). a border-collapse value of collapse is a standard best practice for any table styling effort. ...
... fonts that is suitable for a table about punk bands. you can go there and find a different one if you like; you'll just have to replace our provided <link> element and custom font-family declaration with the ones google fonts gives you. ...
...And 4 more matches
Getting started with React - Learn web development
for react applications. using it will allow you spend more time building your app, and less time fussing with setup. requirements in order to use create-react-app, you need to have node.js installed. it's recommended that you use the long-term support (lts) version. node includes npm (the node package manager), and npx (the node package runner). you may also use the yarn package manager as an
alternative, but we'll assume you are using npm in this set of tutorials. see package management basics for more information on npm and yarn. if you're using windows, you will need to install some software to give you parity with unix/macos terminal in order to use the terminal commands mentioned in this tutorial. gitbash (which comes as part of the git for windows toolset) or windows subsystem for ...
...hey serve a single, obvious purpose. let's open src/app.js, since our browser is prompting us to edit it. this file contains our first component, app, and a few other lines of code: import react from 'react'; import logo from './logo.svg'; import './app.css'; function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo"
alt="logo" /> <p> edit <code>src/app.js</code> and save to reload. </p> <a classname="app-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > learn react </a> </header> </div> ); } export default app; the app.js file consists of three main parts: some import statem...
...ts use pascal-case variable names, like helloworld, to make it clear that a given jsx element is a react component, and not a regular html tag. if you were to rename the app function to app, your browser would show you an error. let's look at app more closely. function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo"
alt="logo" /> <p> edit <code>src/app.js</code> and save to reload. </p> <a classname="app-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > learn react </a> </header> </div> ); } the app function returns a jsx expression. this expression defines what your browser...
...And 4 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
these three top-level variables. ...
... to prove it, go to that array, and try changing some of the todo object's completed property values, and even add a new todo object. observe how the numbers in the message are updated appropriately. ...
...ot being updated. read on to find out why this is happening and how we can solve it. reactive todos as we've already seen, every time the value of a component top-level variable is modified svelte knows how to update the ui. in our app, the todos array value is updated directly every time a todo is toggled or deleted, and so svelte will update the dom automatically. the same is not true for tot
altodos and completedtodos, however. in the following code they are assigned a value when the component is instantiated and the script is executed, but after that, their values are not modified: let tot
altodos = todos.length let completedtodos = todos.filter(todo => todo.completed).length we could recalculate them after toggling and removing todos, but there's an easier way to do it. we can tell s...
...And 4 more matches
Package management basics - Learn web development
to remove the packages. in addition, package managers handle duplicate dependencies (something that becomes important and common in front-end development). in the case of npm (and javascript- and node-based package managers) you have two options for where you install your dependencies. as we touched on in the previous article, dependencies can be installed globally or locally to your project.
although there tend to be more pros for installing globally, the pros for installing locally are more important — such as code portability and version locking. for example, if your project relied on webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or returned to it much later on, the configuration would still work. if a different vers...
...mitigate this dependencies are installed locally to a project. to see local dependencies really shine, all you need to do is try to download and run an existing project — if it works and all the dependencies work right out of the box, then you have local dependencies to thank for the fact that the code is portable. note: npm is not the only package manager available. a successful and popular
alternative package manager is yarn. yarn resolves the dependencies using a different algorithm that can mean a faster user experience. there are also a number of other emerging clients, such as pnpm. package registries for a package manager to work, it needs to know where to install packages from, and this comes in the form of a package registry. the registry is a central place that a package is ...
...that you’ll find again. 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. just press return to accept the default parcel-experiment. version: the starting version number...
...And 4 more matches
Gecko info for Windows accessibility vendors
dynamically much faster. roles, states and events: please read the msaa documentation on msdn if you are unfamiliar with these. in general we abbreviate by removing redundant words. for example, we may say event_alert instead of the full event_system_alert. msaa tree vs. dom tree - what's the relation? the msaa tree and the dom tree are parallel structures,
although the msaa tree is a subset of the dom tree. queryservice() can be used to switch between the interfaces (iaccessible, isimpledomdocument, isimpledomnode and isimpledomtext). if there is no msaa node for a dom node, or vice-versa, queryservice() will return null. anything that is focusable or conveys important information about the structure of the document is exposed in the msaa tree of i...
...tact the mozilla accessibility community ): iaccessible methods that we don't currently support: get_acchelp get_acchelptopic put_accname put_accvalue we do not currently support the visual basic (idispatch) bindings for iaccessible. we do not currently support directional navigation via accnavigate() we do not currently support scroll bars as iaccessible objects,
although we do support event_scrollingend and isimpledomnode::scrollto(), explained below. we do not currently support state_moveable, state_sizeable or state_marqueed. we do not currently support role_system_row,
although internet explorer doesn't either, and the reason seems apparent. it is not obvious where the role_system_row should exist in the tree when the html rowspan attribute is use...
...aceid, /* [out] */ bstr __rpc_far *attribvalues); the get_computedstyle method is used to find out the cumulative, computed results for all style rules applied to a node. the return value numstyleproperties specifies the number of style properties for this node, and the last 2 parameters return 2 arrays corresponding to style property name and style property value. another [in] parameter, use
alternativemediaproperties, indicates whether you want style information for the default media type (usually screen), or a set of
alternative media types specified in nsisimpledomdocument::set_
alternateviewmediatype(mediatypestring) . see the w3c's website for a list of official media type name. unfortunately, at this time the argument use
alternateview is ignored. hresult get_computedstyle( /* ...
...And 4 more matches
nsIEditorIMESupport
positionstring, in nsiprivatetextrangelistptr atextrange, in nstexteventreplyptr areply); native code only! obsolete since gecko 2.0 attributes attribute type description composing boolean whether this editor has active ime transaction. read only. methods native code only!begincomposition obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. handles the start of inline input composition. void begincomposition( in nstexteventreplyptr areply ); parameters areply endcomposition() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) handles the end of inline input ...
...one. forcecompositionend() force the composition end. void forcecompositionend(); parameters none. native code only!getpreferredimestate get preferred ime status of current widget. void getpreferredimestate( out unsigned long astate ); parameters astate native code only!getquerycaretrect obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. ...
...s obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. get the query caret rect. void getquerycaretrect( in nsquerycaretrecteventreplyptr areply ); parameters areply native code only!getreconversionstring obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. get the reconversion string. void getreconversionstring( in nsreconversioneventreplyptr areply ); parameters areply notifyimeonblur() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. ...
...And 4 more matches
SpeechRecognitionResult.length - Web APIs
syntax var mylength = speechrecognitionresultinstance.length; returns a number. examples this code is excerpted from our speech color changer example. ...
... syntax var mylength = speechrecognitionresultinstance.length; returns a number. examples this code is excerpted from our speech color changer example. ...
... syntax var mylength = speechrecognitionresultinstance.length; returns a number. examples this code is excerpted from our speech color changer example. ...
...And 4 more matches
StorageManager.persist() - Web APIs
thub.com/mdn/browser-compat-data and send us a pull request. ...
...owser-compat-data and send us a pull request. ...
... ≤79firefox full support 55ie ? opera full support yessafari ? ...
...And 4 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
is no way for either of you to see the difference. a third party can tell the difference, but the two of you cannot. if you are a camera, you can achieve the same visual result both by moving the camera or by moving everything around the camera. and that's our solution. since we can't move the camera, we move the world around it. our renderer needs to know where we imagine the camera to be, then
alter the position of every visible object to simulate that position and orientation. thus, instead of referring to an actual camera object, the term camera is used in webgl and webxr programming to refer to an object describing the position and viewing direction of a hypothetical viewer of the scene, whether there's an actual object present in 3d space or not. points of view since the camera is a ...
...amples include world of warcraft, tomb raider, and fortnite. this category also includes games where the camera is placed just over the player's shoulder. some 3d games offer the ability to change your point of view, such as to look out the various windows of an aircraft in a flight simulator, or to see the views from all the security cameras within the game level (a common feature of spy and ste
alth-based games). this ability is also used by games offering weapons with scopes, where the view isn't quite based off the head's position in the same way anymore. 3d games might also provide the ability for non-players to observe the action, either by positioning an invisible avatar of sorts or by choosing a fixed virtual camera to watch from. in advanced 3d games, a camera or camera-like object...
...y perform normalization. once you've determined the matrix representing the combination of movements you wish the camera to make, you need to reverse it, because you're not moving the camera. since you're actually moving everything except the camera, take the inverse of the transform matrix to get an inverse transform matrix. this inverse matrix can then be applied to the objects in the world to
alter their positions and orientations to simulate the desired camera position. this is why the xrrigidtransform object used by webxr to represent transforms includes an inverse property. the inverse property is another xrrigidtransform object which is the inverse of the parent transform. since the xrview representing the view has a transform property which is an xrrigidtransform providing the camer...
...And 4 more matches
ARIA Test Cases - Accessibility
ign to test the alert expected at behavior: a screen reader or screen magnifier must speak an alert when it becomes visible. a screen magnifier should move the current view to the alert or open a new panel with the alert information optional, but desired: if there are widgets within the alert, their role and any keyboard mnemonic (accesskey) should be spoken. for example, "options, button,
alt+shift+t" should be spoken if there is an options button in the alert with
alt+shift+t as an accesskey. markup used: role="alert" notes: results: at firefox ie opera safari jaws 9 passed fail n/a n/a jaws 10 passed fail - - voiceover (leopard) n/a n/a - fail window-eyes passed- not announced ...
...pass pass zoom (leopard) pass n/a pass pass zoomtext fail- announced as 'alert' pass - - orca - - - - button basic button button with description dojo nightly build -- lots of other types of buttons there as well. expected at behavior: when focus falls on a button, a screen reader speaks the text of the button plus
alternative text of any images within the button (the accessible name of the button). the word "button" is also spoken before or after the accessible name. markup used: notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 pass in non-v-pc mode, pass in v-pc-mode also if the button's text is not provided via labelledby or la...
...e entire groupbox should be read by a screen reader. when the button is focused, the description of the button should be read after the button's label and role are read by the screen reader. regression testers should test both tabbing forward and back, to make sure that the groupbox description and button description are both read when the button is the first item focused in the groupbox. (al)
alternatively, description are not read automatically but may be accessible from a hotkey. however, if the screen reader does not at least indicate that the description exists, users are likely to miss important information. markup used: role="description" and aria-describedby notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaw...
...And 4 more matches
Using CSS animations - CSS: Cascading Style Sheets
through keyframes, by establishing acceleration curves. animation-delay configures the delay between the time the element is loaded and the beginning of the animation sequence. animation-iteration-count configures the number of times the animation should repeat; you can specify infinite to repeat the animation indefinitely. animation-direction configures whether or not the animation should
alternate direction on each run through the sequence or reset to the start point and repeat itself. animation-fill-mode configures what values are applied by the animation before and after it is executing. animation-play-state lets you pause and resume the animation sequence. defining the animation sequence using keyframes once you’ve configured the animation’s timing, you need to define t...
...time in silence: at last the caterpillar took the hookah out of its mouth, and addressed her in a languid, sleepy voice.</p> making it move back and forth that made it repeat, but it’s very odd having it jump back to the start each time it begins animating. what we really want is for it to move back and forth across the screen. ...
...king it move back and forth that made it repeat, but it’s very odd having it jump back to the start each time it begins animating. what we really want is for it to move back and forth across the screen. ...
...And 4 more matches
Video player styling basics - Developer guides
this has now been changed to use a data-state attribute, which this code already uses to handle its fullscreen implementation. this "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling. javascri...
...t; background-size:contain; background-repeat:no-repeat; } by default, all <button> elements have a border, so this is removed. since background images will be used to display appropriate icons, the background colour of the button is set to be transparent, non-repeated, and the element should fully contain the image. simple :hover and :focus states are then set for each button that simply
alters the opacity of the button: .controls button:hover, .controls button:focus { opacity:0.5; } to obtain appropriate button images, a set of free common control set icons was downloaded from the web. each image was then converted to a base64 encoded string (using an online base64 image encoder), since the images are quite small, the resultant encoded strings are quite short. since some butto...
...s its width initially set to 0% (it is updated via javascript) and it also has its background colour set. there are some browser-specific properties that need to be set to ensure that firefox and chrome use the required colour for the progress bar: .controls progress::-moz-progress-bar { background-color:#0095dd; } .controls progress::-webkit-progress-value { background-color:#0095dd; }
although the same properties are set to the same value, these rules need to be defined separately, otherwise chrome ignores it. javascript that's really it for the immediate styling; the next task is making a number of javascript changes to ensure that everything works as expected. control visibility the first change is simple: the data-state for showing the video controls when javascript is avai...
...And 4 more matches
HTTP Index - HTTP
pening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. though often based on a tcp/ip layer, it can be used on any reliable transport layer, that is, a protocol that doesn't lose messages silently like udp does. rudp — the reliable update of udp — is a suitable
alternative. 2 a typical http session http in client-server protocols, like http, sessions consist of three phases: 3 an overview of http html, http, overview, webmechanics, l10n:priority http isthe foundation of any data exchange on the web and it is a client-server protocol, which means requests are initiated by the recipient, usually the web browser. a com...
...he preflight request is always an options and doesn't use the same method as the actual request. 63 age caching, http, response, header the age header contains the time in seconds the object has been in a proxy cache. 64 allow entity header, http, http header, reference, header the allow header lists the set of methods support by a resource. 65
alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the
alt-svc header is used to list
alternate ways to reach this website. 66 authorization http, http header, reference, request header, header the http authorization request header contains the credentials to authenticate a user agent with a server, usually after the server has res...
...uage(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 73 content-length http, headers, reference the content-length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 74 content-location http, reference, header the content-location header indicates an
alternate location for the returned data. the principal use is to indicate the url of a resource transmitted as the result of content negotiation. 75 content-range http, http header, reference, response header, header the content-range response http header indicates where in a full body message a partial message belongs. 76 content-security-policy csp, content secu...
...And 4 more matches
Image file type and format guide - Web media technologies
when animated gifs began to be widely used for short "videos", memes, and other simple animation sequences. another popular feature of gif is support for interlacing, where rows of pixels are stored out of order so that partially-received files can be displayed in lower quality. this is particularly useful when network connections are slow. gif is a good choice for simple images and animations,
although converting full color images to gif can result in unsatisfactory dithering. typically, modern content should use png for lossless and indexed still images, and should consider using apng for lossless animation sequences. mime type image/gif file extension(s) .gif specification gif87a specification gif89a specification browser compatibility ...
...and 16 each pixel is comprised of four d-pixel color components: red, green, blue, and the alpha sample indicating how opaque the pixel is. compression lossless, optionally indexed color like gif licensing ©2003 w3c® (mit, ercim, keio), all rights reserved. w3c liability, trademark, document use and software licensing rules apply. no known roy
alty-bearing patents. svg (scalable vector graphics) svg is an xml-based vector graphics format that specifies the contents of an image as a set of drawing commands that create shapes, lines, apply colors, filters, and so forth. svg files are ideal for diagrams, icons, and other images which can be accurately drawn at any size. as such, svg is popular for user interface elements in modern web...
... including with the <img> and <picture> elements, the background-image css property, and so forth. svg is an ideal choice for images which can be represented using a series of drawing commands, especially if the size at which the image will be rendered is unknown or may vary, since svg will smoothly scale to the desired size. it's not generally useful for strictly bitmap or photographic images,
although it is possible to include bitmap images within an svg. mime type image/svg+xml file extension(s) .svg specification w3.org/tr/svg2 browser compatibility feature chrome edge firefox internet explorer opera safari svg support 4 12 ...
...And 4 more matches
xlink:href - SVG: Scalable Vector Graphics
the xlink:href attribute defines a reference to a resource as a reference iri. the exact meaning of that link depends on the context of each element using it. note: svg 2 removed the need for the xlink namespace, so instead of xlink:href you should use href. ...
..., <textpath>, <tref>, and <use>} html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a xlink:href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> a for <a>, xlink:href defines the location of the referenced object. ...
...tref>, and <use>} html, body, svg { height: 100%; } <svg viewbox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a xlink:href="https://developer.mozilla.org/"><text x="10" y="25">mdn web docs</text></a> </svg> a for <a>, xlink:href defines the location of the referenced object. ...
...And 4 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
ndards across an organization. there are numerous standards organizations that affect how and why we do what we do. for example, in the accounting arena there is fasb (financial accounting standards board) and iasb (international accounting standards board). all businesses are expected and required to follow the guidelines set forth by the fasb. when auditors evaluate an organizations financial he
alth, they do so by following the fasb rules. focusing on the software development portion of an organization, there are numerous standards bodies that can affect development decisions. for example, if an organization is developing a web-based client, they may have to adhere to standards imposed by these organizations: ansi (american national standards institute ) atsc (advanced television syste...
...izations make is to use proprietary methods, software, code, or standards. following a proprietary path has led many organizations down disastrous paths. case in point: xerox corporation. xerox was clearly ahead of their time in the early 1980’s when they designed and developed the star office system. it was an elegant workstation with an iconic desktop developed by the engineers at parc (palo
alto research center). the star office system offered functionality that neither microsoft nor apple has been able to match with their current offerings. the engineers developed star on a proprietary development operating system known as pilot. pilot had a highly-integrated debugging tool called co-pilot that allowed the xerox development organization to quickly and easily debug issues. however, wha...
...er they are accessing a web site from their desktop, phone, or handheld. consequently, if an organization offers a suite of products they must ensure that the user experience is consistent and predictable across the product line. consistency to be successful, organizations need to understand this user expectation and provide a consistent experience across their product offerings. when usability
alters too much across products, users complain. apple and microsoft have learned this lesson well. when a macintosh user shifted from mac os 8.x to mac os 9.x, the interface and desktop metaphor was virtually unchanged. users could quickly and easily shift from one version to the next. however, when mac os x was released, apple completely revamped the interface and desktop metaphor. that change cau...
...And 3 more matches
RDF in Mozilla FAQ - Archive of obsolete content
components .classes["@mozilla.org/rdf/rdf-service;1"] .getservice(components.interfaces.nsirdfservice); // ...and from it, get the datasource. ...
...arks = components. classes["@mozilla.org/rdf/datasource;1?name=bookmarks"]. getservice(components.interfaces.nsirdfdatasource); // now do something interesting with it... if (bookmarks.hasassertion( rdf.getresource("http://home.netscape.com/nc-rdf#bookmarksroot"), rdf.getresource("http://home.netscape.com/nc-rdf#child"), rdf.getresource("http://home.netscape.com/nc-rdf#person
altoolbarfolder"), true) { // ... }
alternatively, some datasources have "special" rdf-friendly contractids that make it easy to instantiate the datasource using either the nsirdfserivce's getdatasource() method or the datasources attribute on a xul template. these contractids are of the form @mozilla.org/rdf/datasource;1?name=name and are accessable via getdatasource() and the datasource...
...mplate. <tree datasources="rdf:bookmarks"> ... ...
...And 3 more matches
Desktop mouse and keyboard controls - Game development
e game we can support keyboard input in games built with phaser by enabling the basic cursor keys in the create() function using the createcursorkeys() function: this.cursors = this.input.keyboard.createcursorkeys(); this creates four directional arrow keys for us: this.cursors.left; this.cursors.right; this.cursors.up; this.cursors.down; you can also define the keys on your own and offer an
alternative, w a s d control mechanism for example: this.keyleft = this.input.keyboard.addkey(phaser.keycode.a); this.keyright = this.input.keyboard.addkey(phaser.keycode.d); this.keyup = this.input.keyboard.addkey(phaser.keycode.w); this.keydown = this.input.keyboard.addkey(phaser.keycode.s); to support both the cursor and w a s d keys, we need to do this: if(this.cursors.left.isdown || this.keyl...
...move left } else if(this.cursors.right.isdown || this.keyright.isdown) { // move right } if(this.cursors.up.isdown || this.keyup.isdown) { // move up } else if(this.cursors.down.isdown || this.keydown.isdown) { // move down } in the update() function we can now move the player's ship in any direction using one of the two sets of movement key options. we can also offer firing control
alternatives. for cursor keys the natural shooting button would be on the other side of the keyboard, so the player can use the other hand — for example the x key. for w a s d keys it can be the space bar: this.keyfire1 = this.input.keyboard.addkey(phaser.keycode.x); this.keyfire2 = this.input.keyboard.addkey(phaser.keycode.spacebar); in the update() function we can easily check if any of those t...
...remember: it's a secret, so don't tell anyone! how to play we've implemented the controls, and now we should inform the player about their options to control the game — they wouldn't know about them otherwise. when showing the how to play screen where the various ways to control the ship in the game are shown, instea...
...And 3 more matches
2D maze game with device orientation - Game development
ch other we will store the elapsed time — players can then try to improve on their best game completion time. to implement this we have to create a variable for storing the actual number of seconds elapsed from the start of the game, and to show it for the player in the game. ...
... it for the player in the game. let’s define the variables in the create function first: this.timer = 0; // time elapsed in the current level this.tot
altimer = 0; // time elapsed in the whole game then, right after that, we can initialize the necessary text objects to display this information to the user: this.timertext = this.game.add.text(15, 15, "time: "+this.timer, this.fontbig); this.tot
altimetext = this.game.add.text(120, 30, "total time: "+this.tot
altimer, this.fontsmall); we’re defining the top and left positions of the text, the content that will be shown and the styling applied to the text. we have this printed out on the screen, but it would be good to update the values every second: this.time.events.loop(phaser.timer.second, this.updatecounter, this); this loop, also in ...
...me.events.loop(phaser.timer.second, this.updatecounter, this); this loop, also in the create function, will execute the updatecounter function every single second from the beginning of the game, so we can apply the changes accordingly. this is how the complete updatecounter function looks: updatecounter: function() { this.timer++; this.timertext.settext("time: "+this.timer); this.tot
altimetext.settext("total time: "+(this.tot
altimer+this.timer)); }, as you can see we’re incrementing the this.timer variable and updating the content of the text objects with the current values on each iteration, so the player sees the elapsed time. finishing the level and the game the ball is rolling on the screen, the timer is working and we have the hole created that we have to reach. now le...
...And 3 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
http) is the underlying network protocol that enables transfer of hypermedia documents on the web, typically between a browser and a server so that humans can read them. the current version of the http specification is called http/2. 197 http header glossary, http header, webmechanics an http header is a field of an http request or response that passes additional information,
altering or precising the semantics of the message or of the body. headers are case-insensitive, begins at the start of a line and are immediately followed by a ':' and a value depending of the header itself. the value finish at the next crlf or at the end of the message. 198 http/2 glossary, http, infrastructure, reference, web performance, l10n:priority http/2 is a major revisi...
... and padding have no impact, though horizontal margin and padding do. 238 jpeg beginner, composing, glossary, images, jpeg jpeg (joint photographic experts group) is a commonly used method of lossy compression for digital images. 239 json codingscripting, glossary, intro, json, l10n:priority javascript object notation (json) is a data-interchange format.
although not a strict subset, json closely resembles a subset of javascript syntax. though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. 240 jank beginner, codingscripting, glossary, performance, web performance jank refers to sluggishness in a user interface, usually caused by executing lo...
...rd search a keyword is a word or phrase that describes content. online keywords are used as queries for search engines or as words identifying content on websites. 245 lgpl glossary, license, openpractices, remixing, sharing lgpl (gnu lesser general public license) is a free software license published by the free software foundation. the lgpl provides a more permissive
alternative for the strictly copyleft gpl. while any derivative work using a gpl-licensed program must be released under the same terms (free to use, share, study, and modify), the lgpl only requires the lgpl-licensed component of the derivative program to continue using the lgpl, not the whole program. lgpl is usually used to license shared components such as libraries (.dll, .so, .jar, etc.). ...
...And 3 more matches
What is accessibility? - Learn web development
s people without disabilities, and so are their disabilities. the key lesson here is to think beyond your own computer and how you use the web, and start learning about how others use it — you are not your users. the main types of disability to consider are explained below, along with any special tools they use to access web content (known as assistive technologies, or ats). note: the world he
alth organization's disability and he
alth fact sheet states that "over a billion people, about 15% of the world's population, have some form of disability", and "between 110 million and 190 million adults have significant difficulties in functioning." people with visual impairments people with visual impairments include people with blindness, low-level vision, and color blindness. many people with...
...me os), and talkback (android). it is a good idea to familiarise yourself with screen readers; you should also set up a screen reader and have a play around with it, to get an idea of how it works. see our cross-browser testing screen readers guide for more details on using them. the below video also provides a brief example of what the experience is like. in terms of statistics, the world he
alth organization estimates that "285 million people are estimated to be visually impaired worldwide: 39 million are blind and 246 have low vision." (see visual impairment and blindness). that's a large and significant population of users to just miss out on because your site isn't coded properly — almost the same size as the population of the united states of america. people with hearing impairme...
...ents otherwise known as people with auditory impairments or deaf people, this group of people has either low hearing levels or no hearing at all. hearing-impaired people do use ats (see assistive devices for people with hearing, voice, speech, or language disorders), but there are not really special ats specific for computer/web use. there are, however, specific techniques for providing textual
alternatives to audio content which range from simple text transcripts to text tracks (i.e. captions) that can be displayed along with video. an article, later on, will discuss these. hearing-impaired people also represent a significant userbase — "466 million people worldwide have disabling hearing loss", says the world he
alth organization's deafness and hearing loss fact sheet. people with mobi...
...And 3 more matches
HTML basics - Learn web development
hat they are clearly inside or outside one another. if they overlap as shown above, then your web browser will try to make the best guess at what you were trying to say, which can lead to unexpected results. so don't do it! empty elements some elements have no content and are called empty elements. take the <img> element that we already have in our html page: <img src="images/firefox-icon.png"
alt="my test image"> this contains two attributes, but there is no closing </img> tag and no inner content. this is because an image element doesn't wrap content to affect it. its purpose is to embed an image in the html page in the place it appears. anatomy of an html document that wraps up the basics of individual html elements, but they aren't handy on their own. now we'll look at how individua...
... html elements, but they aren't handy on their own. now we'll look at how individual elements are combined to form an entire html page. let's revisit the code we put into our index.html example (which we first met in the dealing with files article): <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src="images/firefox-icon.png"
alt="my test image"> </body> </html> here, we have the following: <!doctype html> — the doctype. it is required preamble. in the mists of time, when html was young (around 1991/92), doctypes were meant to act as links to a set of rules that the html page had to follow to be considered good html, which could mean automatic error checking and other useful things. however these days, they don't ...
...ge is loaded in. it is also used to describe the page when you bookmark/favourite it. <body></body> — the <body> element. this contains all the content that you want to show to web users when they visit your page, whether that's text, images, videos, games, playable audio tracks or whatever else. images let's turn our attention to the <img> element again: <img src="images/firefox-icon.png"
alt="my test image"> as we said before, it embeds an image into our page in the position it appears. it does this via the src (source) attribute, which contains the path to our image file. we have also included an
alt (
alternative) attribute. in this attribute, you specify descriptive text for users who cannot see the image, possibly because of the following reasons: they are visually impaired. ...
...And 3 more matches
Framework main features - Learn web development
dit component to go with each article. this component needs to display a portrait of the author and a short byline about them. in order to know what image to render, and what byline to print, authorcredit needs accept some props. ...
...nt to go with each article. this component needs to display a portrait of the author and a short byline about them. in order to know what image to render, and what byline to print, authorcredit needs accept some props. ...
... byline about them. in order to know what image to render, and what byline to print, authorcredit needs accept some props. a react representation of this authorcredit component might look something like this: function authorcredit(props) { return ( <figure> <img src={props.src}
alt={props.
alt} /> <figcaption>{props.byline}</figcaption> </figure> ); } {props.src}, {props.
alt}, and {props.byline} represent where our props will be inserted into the component. ...
...And 3 more matches
TypeScript support in Svelte - Learn web development
this creates a starter project that includes typescript support, which you can then modify as you wish. then you'll have to tell npm to download dependencies and start the project in development mode, like we usually do: npm install npm run dev adding typescript support to an existing svelte project to add typescript support to an existing svelte project you can follow these instructions.
alternatively, you can download the setuptypescript.js file to a scripts folder inside your project's root folder, and then run node scripts/setuptypescript.js. you can even use degit to download the script. that's what we will do to start porting our application to typescript. note: remember that you can run npx degit opensas/mdn-svelte-tutorial/07-typescript-support svelte-todo-typescript to get...
... let headingel: htmlelement finally, you'll notice the following error reported, related to where we set the tabindex attribute. that's because typescript is type-checking the <h2> element and expects tabindex to be of type number. to fix it, replace tabindex="-1" with tabindex={-1}, like this: <h2 id="list-heading" bind:this={headingel} tabindex={-1}>{completedtodos} out of {tot
altodos} items completed</h2> this way typescript can prevent us from incorrectly assigning it to a string variable. newtodo.svelte next we will take care of newtodo.svelte. as usual, add the lang='ts' attribute. the warning will indicate that we have to specify a type for the nameel variable. set its type to htmlelement like this: let nameel: htmlelement // reference to th...
...check our application's .svelte files. if you want to also check the .ts files you can run npm run validate && npx tsc --noemit, which tells the typescript compiler to check for errors without generating the .js output files. you could even add a script to your package.json file that runs that command. we'll start with stores.js. rename the file to stores.ts. ...
...And 3 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
ve picked the status heading because it's near the list of todos, and it's a way to give a visual feedback about the removal of the task, as well as indicating what's happened to screenreader users. first we'll extract the status heading to its own component. create a new file — components/todosstatus.svelte. ...
...ndicating what's happened to screenreader users. first we'll extract the status heading to its own component. create a new file — components/todosstatus.svelte. ...
...to do this, replace the block that begins with let newtodoid with this: $: newtodoid = todos.length ? math.max(...todos.map(t => t.id)) + 1 : 1 everything works...
...And 3 more matches
Handling common JavaScript problems - Learn web development
rite one simple bit of code (see jquery.ajax()). jquery (or whatever library you are using) will then handle the differences in the background, so you don't have to. things have improved significantly since then; modern browsers do a good job of supporting "classic javascript features", and the requirement to use such code has diminished as the requirement to support older browsers has lessened (
although bear in mind that they have not gone away
altogether). these days, most cross-browser javascript problems are seen: when poor-quality browser-sniffing code, feature-detection code, and vendor prefix usage block browsers from running code they could otherwise use just fine. when developers make use of new/nascent javascript features (for example ecmascript 6 / ecmascript next features, m...
...ng bad browser sniffing code, later on, for more details. note: some features are known to be undetectable — see modernizr's list of undetectables. note: feature detection will be covered in a lot more detail in its own dedicated article, later in the module. libraries javascript libraries are essentially third party units of code that you can attach to your page, providing you with a we
alth of ready-made functionality that can be used straight away, saving you a lot of time in the process. a lot of javascript libraries probably came into existence because their developer was writing a set of common utility functions to save them time when writing future projects, and decided to release them into the wild because other people might find them useful too. javascript libraries tend to...
...lse it is stored), etc. note: javascripting.com gives you a good idea of just how many javascript libraries there are available, and can be useful for finding libraries for specific purposes. library usage at a basic level tends to consist of downloading the library's files (javascript, possibly some css or other dependencies too) and attaching them to your page (e.g. via a <script> element),
although there are normally many other usage options for such libraries, like installing them as bower components, or including them as dependencies via the webpack module bundler. you will have to read the libraries' individual install pages for more information. note: you will also come across javascript frameworks in your travels around the web, like ember and angular. whereas libraries are ofte...
...And 3 more matches
Gecko Keypress Event
gecko 1.9 key handling changed significantly after beta 5 (bug 359638, bug 429510 and the bugs on which they depend). the changes were risky so late in the release schedule, but they were necessary for fixing the many key handling bugs. charcode of dom keypress event if a keypress event is fired without any modifier keys (ctrl/
alt(option)/meta(win/command)), then the properties of the event are the same as they were in gecko1.8.1. that is, when the currently selected keyboard layout produces a unicode character (according to the current state of capslock and numlock), the charcode property contains that character. when the keypress event includes modifier keys, sometimes the charcode value is replaced with an ascii character according to the following rules. the accel key depends...
...character. this behavior helps the internationalization of web applications that have custom shortcut keys. if gecko doesn't replace the charcode with an ascii character, the web application developers would need to consider all non-latin keyboard layouts (arabic, greek, hebrew, russian, etc.). the charcode value depends on the state of capslock and numlock (except they are currently ignored if
alt (option) is down on mac - see bug 432953). there are also some differences between the platforms, as described in the following sections. windows the charcode is replaced only when ctrl is down but
alt is not down. if the os-provided character cannot be entered without using the ctrl key, then, gecko does not replace the character. e.g., ctrl+shift+'2' on persian keyboard layout inputs a zwnj,...
...replacing the original (non-ascii) characters on these keys means that there are some accessibility issues for non-latin keyboard layout users as many non-ascii characters will not be available for shortcuts. therefore, web application developers should use only letters, ascii numerals, plus sign, and minus sign for custom shortcut keys. linux the charcode is replaced only when ctrl is down but
alt and meta are not down. if the character provided by the keyboard layout cannot be entered without ctrl key, then, gecko does not replace the character (as on windows). mac the charcode is replaced when meta (command) or ctrl is down. if the current keyboard layout is dvorak-qwerty layout or a non-latin layout, the command key switches the keyboard layout to the us qwerty keyboard layout tempo...
...And 3 more matches
nsACString_internal
ing hierarchy. it represents a single contiguous array of characters, which may or may not be null-terminated. this type is not instantiated directly. a sub-class is instantiated instead. for example, see nststring. names: nsastring for wide characters nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
...ated directly. a sub-class is instantiated instead. for example, see nststring. names: nsastring for wide characters nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
... nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
...And 3 more matches
nsAString (External)
class declaration this header provides wrapper classes around the frozen string api which are roughly equivalent to the internal string classes. ...
... class declaration this header provides wrapper classes around the frozen string api which are roughly equivalent to the internal string classes. ...
...i which are roughly equivalent to the internal string classes. ...
...And 3 more matches
nsAString_internal
ing hierarchy. it represents a single contiguous array of characters, which may or may not be null-terminated. this type is not instantiated directly. a sub-class is instantiated instead. for example, see nststring. names: nsastring for wide characters nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
...tiated directly. a sub-class is instantiated instead. for example, see nststring. names: nsastring for wide characters nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
...ters nsacstring for narrow characters many of the accessors on nstsubstring are inlined as an optimization. ...
...And 3 more matches
EffectTiming.direction - Web APIs
iteration element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including direction. the value of direction corresponds directly to animationeffecttimingreadonly.direction in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. syntax var timingproperties = { direction: "normal" | "reverse" | "
alternate" | "
alternate-reverse" }; timingproperties.direction = "normal" | "reverse" | "
alternate" | "
alternate-reverse"; value a domstring which specifies the direction in which the animation should play as well as what to do when the playback reaches the end of the animation sequence in the current direction. it can take one of the following values, with the default being "normal": "normal"...
...es the direction in which the animation should play as well as what to do when the playback reaches the end of the animation sequence in the current direction. 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. ...
...the default being "normal": "normal" the animation runs forwards, from beginning to end, in the way we experience the flow of time. "reverse" the animation runs backwards, or "rewinds." "
alternate" the animation switches direction after each iteration, going forward through the animation sequence the first iteration, then backward through the sequence the second iteration, and so forth. ...
...And 3 more matches
Comparison of Event Targets - Web APIs
he call that triggered this event, eg: element.dispatchevent(event) event.currenttarget dom event interface the eventtarget whose eventlisteners are currently being processed. as the event capturing and bubbling occurs, this value changes. event.relatedtarget dom mouseevent interface identifies a secondary target for the event. event.explicitorigin
altarget event.webidl if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitorigin
altarget will show the text node. unlike .orig...
...get event.webidl if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitorigin
altarget will show the text node. unlike .origin
altarget, .explicitorigin
altarget will never contain anonymous content. event.origin
altarget event.webidl the original target of the event, before any retargetings. see anonymous content#event_flow_and_targeting for details. event.composedtarget event.webidl the original non-native target of the event before composition from shadow dom. use of explicitoriginal...
...rigin
altarget will never contain anonymous content. event.origin
altarget event.webidl the original target of the event, before any retargetings. see anonymous content#event_flow_and_targeting for details. event.composedtarget event.webidl the original non-native target of the event before composition from shadow dom. ...
...And 3 more matches
ARIA: img role - Accessibility
the aria img role can be used to identify multiple elements inside page content that should be considered as a single image. these elements could be images, code snippets, text, emojis, or other content that can be combined to deliver information in a visual manner. ...
... to deliver information in a visual manner. <div role="img" aria-label="description of the overall image"> <img src="graphic1.png"
alt=""> <img src="graphic2.png"> </div> description any set of content that should be consumed as a single image (which could include images, video, audio, code snippets, emojis, or other content) can be identified using role="img". you shouldn't count on the
alt text of individual elements images for conveying context to assistive technologies; most screenreaders will consider the element with role="img" set on it to be to be like a black box, and not access the individual elements inside it. ...
...code snippets, emojis, or other content) can be identified using role="img". you shouldn't count on the
alt text of individual elements images for conveying context to assistive technologies; most screenreaders will consider the element with role="img" set on it to be to be like a black box, and not access the individual elements inside it. ...
...And 3 more matches
Web accessibility for seizures and physical reactions - Accessibility
ual images, even in the absence of motion or flicker, can trigger seizures in patients with photosensitive epilepsy” the epilepsy foundation, in its article, "shedding light on photosensitivity, one of epilepsy's most complex conditions" talks about static images and patterns. "static or moving patterns of discernable light and dark stripes have the same effect as flashing lights because of the
alternation of dark and bright areas." the epilepsy foundation of america working group is able to "quantify" the problem a little. "a pattern with the potential for provoking seizures contains clearly discernible stripes, numbering more than five light-dark pairs of stripes in any orientation" in addition to stripes, checkered patterns have also been known to cause photosensitive seizures, accordin...
... bright areas." the epilepsy foundation of america working group is able to "quantify" the problem a little. "a pattern with the potential for provoking seizures contains clearly discernible stripes, numbering more than five light-dark pairs of stripes in any orientation" in addition to stripes, checkered patterns have also been known to cause photosensitive seizures, according to cedars-sinai.
although static images are possible as triggers, they are less consistent. the trigger that is well established and strong is flashing/strobe lights. dr. selim benbadis of usf's comprehensive epilepsy program notes, "the only thing that is really documented is flashing lights, which can trigger seizures in patients with photosensitive epilepsy. only a few types of epilepsies are photosensitive though...
...rogram notes, "the only thing that is really documented is flashing lights, which can trigger seizures in patients with photosensitive epilepsy. only a few types of epilepsies are photosensitive though, and the vast majority of epilepsies are not." in addition to seizures brought about by photosensitivity, listening to certain pieces of music can also trigger what are called musicogenic seizures,
although these types of seizures seem to be much more rare. for a great introduction on the topic of musicogenic seizures, visit epilepsy ontario's web page on musicogenic seizures. seizures and epilepsy are not the same. in its article, "a revised definition of epilepsy" the epilepsy foundation notes that…"a seizure is an event and epilepsy is the disease involving recurrent unprovoked seizures."...
...And 3 more matches
max-height - CSS: Cascading Style Sheets
css3 sizing.ie no support noopera full support 44safari full support 6.1prefixed full support 6.1prefixed prefixed implemented with the vendor prefix: -webkit- full support 2
alternate name
alternate name uses the non-standard name: intrinsicwebview android full support 46 full support 46 full support ≤37prefixed prefixed implemented with the vendor prefix: -webkit-chrome android full support ...
...so, the definition of fit-content is simpler than in css3 sizing.opera android full support 43safari ios full support 7prefixed full support 7prefixed prefixed implemented with the vendor prefix: -webkit- full support 1
alternate name
alternate name uses the non-standard name: intrinsicsamsung internet android full support 5.0 full support 5.0 full support 1.5prefixed prefixed implemented with the vendor prefix: -webkit-max-contentchrome full support ...
...full support 11 full support 11 full support 9prefixed prefixed implemented with the vendor prefix: -webkit-samsung internet android full support 5.0stretch experimentalchrome full support 28
alternate name full support 28
alternate name
alternate name uses the non-standard name: -webkit-fill-availableedge full support 79
alternate name full support 79
alternate name
alternate name uses the non-standard name: -webkit-fill-availablefirefox no...
...And 3 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
attribute to define the types of files that the control can select. <input type="file" accept="image/*, text/*" name="file"/> hidden a control that is not displayed but whose value is submitted to the server. there is an example in the next column, but it's hidden! image a graphical submit button. displays an image defined by the src attribute. the
alt attribute displays if the image src is missing. <input type="image" name="image" src=""
alt="image input"/> month a control for entering a month and year, with no time zone. <input type="month" name="month"/> html5 number a control for entering a number. displays a spinner and adds default validation when supported. displays a numeric keypad ...
...n a given input type—are instead documented on those types' pages. this element includes the global attributes. those with extra importance as it relates to <input> are highlighted. attributes for the <input> element include global html attributes and: attribute type or types description accept file hint for expected file type in file upload controls
alt image
alt attribute for the image type. required for accessibility autocomplete all hint for form autofill feature autofocus all automatically focus the form control when the page is loaded capture file media capture input method in file upload controls checked radio, checkbox whether the command or control is checked dirn...
...he form as part of a name/value pair. width image same as width attribute for <img> a few additional non-standard attributes are listed following the descriptions of the standard attributes. individual attributes accept valid for the file input type only, the accept attribute defines which file types are selectable in a file upload control. see the file input type.
alt valid for the image button only, the
alt attribute provides
alternative text for the image, displaying the value of the attribute if the image src is missing or otherwise fails to load. see the image input type. autocomplete (not a boolean attribute!) the autocomplete attribute takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the...
...And 3 more matches
accesskey - HTML: Hypertext Markup Language
ays you can specify multiple space-separated characters, and the browser will use the first one it supports. however, this does not work in most browsers. ie/edge uses the first one it supports without problems, provided there are no conflicts with other commands. ...
... the first one it supports. however, this does not work in most browsers. ie/edge uses the first one it supports without problems, provided there are no conflicts with other commands. ...
...ot work in most browsers. ie/edge uses the first one it supports without problems, provided there are no conflicts with other commands. ...
...And 3 more matches
Details of the object model - JavaScript
ifferent from a class. in javascript, "instance" does not have this technical meaning because javascript does not have this difference between classes and instances. however, in talking about javascript, "instance" can be used informally to mean an object created using a particular constructor function. so, in this example, you could informally say that jane is an instance of engineer. similarly,
although the terms parent, child, ancestor, and descendant do not have formal meanings in javascript; you can use them informally to refer to objects higher or lower in the prototype chain. creating objects with simple definitions object hierarchy the following hierarchy is created using the code on the right side. individual objects = jim, sally, mark, fred, jane, etc. "instances" created f...
... specific to a single object, you assign a value to the object, as follows: mark.bonus = 3000; now, the mark object has a bonus property, but no other workerbee has this property. if you add a new property to an object that is being used as the prototype for a constructor function, you add that property to all objects that inherit properties from the prototype. for example, you can add a speci
alty property to all employees with the following statement: employee.prototype.speci
alty = 'none'; as soon as javascript executes this statement, the mark object also has the speci
alty property with the value of "none". the following figure shows the effect of adding this property to the employee prototype and then overriding it for the engineer prototype. adding properties more flexible cons...
...perties to the employee or workerbee prototypes, those properties are not inherited by the engineer object. for example, assume you have the following statements: function engineer(name, projs, mach) { this.base = workerbee; this.base(name, 'engineering', projs); this.machine = mach || ''; } var jane = new engineer('doe, jane', ['navigator', 'javascript'], 'belau'); employee.prototype.speci
alty = 'none'; the jane object does not inherit the speci
alty property. you still need to explicitly set up the prototype to ensure dynamic inheritance. assume instead you have these statements: function engineer(name, projs, mach) { this.base = workerbee; this.base(name, 'engineering', projs); this.machine = mach || ''; } engineer.prototype = new workerbee; var jane = new engineer('doe, jan...
...And 3 more matches
Web audio codec guide - Web media technologies
sample size the larger the samples, the more detail each sample can contain, resulting in more accurate representation of each sample. depends on the codec; codecs typically have an internal sample format that may or may not be the same as the original sample size. but more source detail may make the encoded file larger; it will never make it smaller. of course, these effects can be
altered by decisions made while encoding the audio. for example, if the encoder is configured to reduce the sample rate, the sample rate's effect on the output file will be reduced in kind. for more information about these and other features of audio data, see audio data format and structure in digital audio concepts. the effect of codec configuration on encoded audio output audio codecs typically...
...dio data for subwoofers, for example. when you see the number of audio channels written in the form x.y (such as 2.1 or 5.1), the number after the decimal point, y, is the number of lfe channels. for example, mp3 supports one lfe channel, while aac supports up to 16. in addition to providing audio for specific speakers in a sound system, some codecs may allow audio channels to be used to provide
alternative audio, such as vocals in different languages or descriptive audio for visually impaired people. audio frequency bandwidth the audio frequency bandwidth of a codec indicates the range of audio frequencies that can be represented using the codec. some codecs operate specifically by eliminating audio that falls outside a given frequency range. there is a correlation between the sample rate...
...see voiceage licensing for details [1] while the chrome browser does not support amr, chrome os supports amr-nb (narrowband) and amr-wb (wideband). [2] the firefox browser doesn't support amr; however, the boot to gecko platform does support both narrow and wideband amr in 3gp containers. flac (free lossless audio codec) flac (free lossless audio codec) is a lossless audio cod...
...And 3 more matches
dx - SVG: Scalable Vector Graphics
the dx attribute indicates a shift along the x-axis on the position of an element or its content. ...
... if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are ...
... if there are multiple values, dx defines a shift along the x-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphs, the remaining glyphs use a value of 0. if there are more values than glyphs, extra ...
...And 3 more matches
dy - SVG: Scalable Vector Graphics
the dy attribute indicates a shift along the y-axis on the position of an element or its content. ...
... if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there ar...
... if there are multiple values, dy defines a shift along the y-axis for each individual glyph relative to the preceding glyph. if there are less values than glyphes, the remaining glyphes use a value of 0. if there are more values than glyphes, ext...
...And 3 more matches
HTML to DOM - Archive of obsolete content
the code snippets on this page will let your site work until these new features are more widely available. safely parsing simple html to dom when using xmlhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier manipulation. however, there are potential dangers involved in injecting remote content in a privileged context in your extension, so it can be desirable to parse the html safely. the function below will safely parse simple html and return a dom object which can be manipulated like web page elements. ...
...navigation.allowauth = false; frame.webnavigation.allowimages = false; frame.webnavigation.allowjavascript = false; frame.webnavigation.allowmetaredirects = true; frame.webnavigation.allowplugins = false; frame.webnavigation.allowsubframes = false; // listen for load frame.addeventlistener("load", function (event) { // the document of the html in the dom var doc = event.origin
altarget; // skip blank page or frame if (doc.location.href == "about:blank" || doc.defaultview.frameelement) return; // do something with the dom of doc alert(doc.location.href); // when done remove frame or set location "about:blank" settimeout(function (){ var frame = document.getelementbyid("sample-frame"); // remove frame // frame.destroy(); // if u...
...f = "about:blank"; },10); }, true); } // load a page frame.contentdocument.location.href = "http://www.mozilla.org/"; // or // frame.webnavigation.loaduri("http://www.mozilla.org/",components.interfaces.nsiwebnavigation,null,null,null); if you are starting with an html string, you can convert it to a data uri and use that to load in the browser element. using a hidden xul iframe (
alternate example) sometimes, a browser element is overkill, or does not meet your needs, or you can't fulfill its requirements. while working on donkeyfire, i discovered the iframe xul element, and it is very easy to implement it. as an example, i will show a browser overlay .xul file, and some javascript code to access it. here is some xul code you can add to your browser overlay .xul file. don'...
...And 2 more matches
Install Manifests - Archive of obsolete content
t must conform to the rules specified in extension versioning, update and compatibility. for firefox/thunderbird 1.5, see toolkit version format. examples <em:version>2.0</em:version> <em:version>1.0.2</em:version> <em:version>0.4.1.2005090112</em:version> firefox 1.5 / xulrunner 1.8 - add-ons that do not use a valid version format will not be installed. the version format is different from,
although backwards-compatible with, 1.0's. for add-ons hosted on addons.mozilla.org - mozilla's update website may repackage your add-on and correct or reject malformed version strings. optional property reference you may need to supply these properties, depending on the capabilities of your add-on. abouturl the chrome:// url of the extension's about dialog box. this is only useful to extensions...
...ons list. the icon will be displayed at 32x32 in firefox 3.6 and lower. in firefox 4.0 and later the icon can be up to 48x48 pixels in size. if this property is not specified, a default icon is used. <em:iconurl>chrome://myext/skin/icon.png</em:iconurl> note: for the above example to work you will also have to add a skin package line to your chrome.manifest file. see chrome registration#skin.
alternatively you can place your icon in the directory specified in your content package line. gecko 1.9.2 note starting in gecko 1.9.2 (firefox 3.6), you can also simply include your icon, named icon.png, in the base directory of the add-on. this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an iconurl entry. icon64url a chrome:// ur...
...is missing an iconurl entry. icon64url a chrome:// url to a 64x64 pixel icon to display in the add-on's details view . if this property is not specified, the smaller icon above will be used. <em:icon64url>chrome://myext/skin/icon64.png</em:icon64url> note: for the above example to work you will also have to add a skin package line to your chrome.manifest file. see chrome registration#skin.
alternatively you can place your icon in the directory specified in your content package line. gecko 2.0 note starting in gecko 2.0 (firefox 4.0), you can also simply include your icon, named icon64.png, in the base directory of the add-on. this allows your add-on's icon to be displayed even when the add-on is disabled, or if the manifest is missing an icon64url entry. localized allows you to ...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
plications. xul, on the other hand, was conceived from the ground up as a markup language for user interfaces, and makes it possible to insert ui components with sophisticated features just by writing tags, without any particular scripting. unlike languages with formal specifications that have been standardized by bodies like the w3c, xul currently does not have an explicit specification. note:
although there is a specification document, its markup is based on implementations and markup as of 2001, and current xul differs from it in many aspects. for the latest xul specifications, please see the xul reference on mdc and the xul page in the mozilla wiki. for each element that i explain in this chapter, i will illustrate it with a source code example. you can type these examples up and open ...
...3). <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). use the ordinal attribute to
alter their order. the ordinal attribute takes positive integer values, which are used to order the box’s layout—in the example in listing 5, the buttons would be laid out in the order button3, button2, button1 (figure 4). if multiple elements have the same ordinal value, they will be laid out in the same relative order they appear in the source code. the default value for ordinal is 1. <vbox> ...
...t your code inside a cdata section as shown in listing 18; this will avoid errors caused by mistakenly reading "&" and other characters as the beginnings of entity references. <script type="application/javascript"><![cdata[ var nodes = gbrowser.mtabcontainer.childnodes; for (var i = 0; i < nodes.length; i++) alert(nodes[i].label); ]]></script> listing 18: embedding a script in xul note:
although embedding javascript is permitted, it's generally encouraged that you instead place your javascript code in an external file. browser and tabbrowser xul allows you to use inline frames. you can set the src attribute of an iframe element to the uri of another xul document or web page, and it will be displayed there. but iframes are rarely used in xul—in practice, the browser element is us...
...And 2 more matches
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
ylesheets used at any one time. the breakdown: 1 master screen media file which imports 4 files: a base file (bulk of formatting) a file for finance/table formatting color file (override colors and background images for specific color scheme) temp file (used for styles associated with temporary features and ad-related pages) 1 print media file 1 aural media file 3 master
alternate style sheets which import 1 file each the 3 imported files set
alternate font sizes (small, large, larger) how much did the size of a typical wired news page shrink? the html went from 32 kb down to 19 kb, but images increased from 8 to 13 kb. we've noted that some of the file size comparison's aren't necessarily fair, because we're not comparing apples to apples-- we're compa...
... worked for the wired news design. by eliminating tables that were strictly used for layout, we significantly cut back on the amount of markup and useless tags in our html, and gained a structure that is much easier to maintain. now that the content is not locked into a specific table structure, we have much more flexibility in how we present that content. a few changes to the css can completely
alter the presentation of thousands of pages. as a very welcome side benefit, we also believe the accessibility of wired news will dramatically improve without the clutter of nested layout tables. are you setting up your columns with floats or positioning? in trying to eliminate that last table i was using to set the column structure of our pages, i took a close look at both floated divs and positi...
...rs and images to save on printer ink. fonts are sized in point (pt) units and use serif faces for improved legibility on a printed page. our stories are logically the most printed pages of the site. technically, with the print media css file, we didn't have to generate a separate print template for stories. however, since some of our stories are broken up into 2 or 3 pages, we created a slightly
altered template for print versions which pulls the entire text of the story into one (web) page. since we had a separate template to work with, we changed the media attribute of the linked print style sheet to "all", and eliminated the links to normal screen media files. this allows us to temporarily display on screen the same formatting to be used for printing that page. so what advantages does th...
...And 2 more matches
MMgc - Archive of obsolete content
nal delete mmgc contains a page allocator called gcheap, which allocates large blocks (megabytes) of memory from the system and doles out 4kb pages to the unmanaged memory allocator (fixedmalloc) and the managed memory allocator (gc). mmgc namespace the mmgc library is in the c++ namespace mmgc. you can qualify references to classes in the library; for example: mmgc::gc, mmgc::gcfinalizedobject.
alternately, you can open the mmgc namespace in your c++ source so that you can refer to the objects more concisely: using namespace mmgc; ... gc* gc = gc::getgc(this); gcobject* gcobject; gc class the class mmgc::gc is the main class of the gc. it represents a full, self-contained instance of the garbage collector. it may be multiply instantiated; you may have multiple instances of the garbage ...
...nces. the gc typically is constructed early in your program's initialization, and then passed to operations like operator new for allocating gc objects. there are a few methods that you may need to call directly, such as alloc and free. gc::alloc, gc::free the alloc and free methods are garbage-collected analogs for malloc and free. memory allocated with alloc doesn't need to be explicitly freed,
although it can be freed with free if it is known that there are no other references to it. alloc is often used to allocate arrays and other objects of variable size that contain gc pointers or are otherwise desirable to have in managed memory. these flags may be passed to alloc to control the allocation type. /** * flags to be passed as second argument to alloc */ enum allocflags { kzero=1, kcon...
... if a finalized object holds a reference to an rcobject, it may safely call decrementref on the rcobject. threading the gc routines are not currently thread safe, we're operating under the assumption that none of the player spawned threads create gc'd things. if this isn't true we hope to eliminate other threads from doing this and if we can't do that we will be forced to make our gc thread safe,
although we hope we don't have to do that. threading gets more complicated because it makes sense to re-write chunkmalloc and chunkallocbase to get their blocks from the gcheap. they can also take advantage of the 4k boundary to eliminate the 4 byte per allocation pen
alty. troubleshooting mmgc dealing with bugs gc bugs are hard. forgetting a write barrier if you forget to put a write barrier on a poi...
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
element(aid){ return (document.getelementbyid) ? document.getelementbyid(aid) : document.all[aid]); } differences between mozilla and internet explorer first, i'll discuss the differences in the way html behaves between mozilla and internet explorer. tooltips legacy browsers introduced tooltips into html by showing them on links and using the value of the
alt attribute as a tooltip's content. the latest w3c html specification created the title attribute, which is meant to contain a detailed description of the link. modern browsers will use the title attribute to display tooltips, and mozilla only supports showing tooltips for that attribute and not the
alt attribute. entities html markup can contain several entities, which the w3c web standards body...
...explorer. </a> mozilla follows the css specification correctly and will change the color to green in this example. you can use two ways to make mozilla behave like internet explorer and not change the color of the text when hovered over: first, you can change the css rule to be a:link:hover {color: green;}, which will only change the color if the element is a link (has an href attribute).
alternatively, you can change the markup and close the opened <a /> before the start of the text -- the anchor will continue to work this way. quirks versus standards mode older legacy browsers, such as internet explorer 4, rendered with so-called quirks under certain conditions. while mozilla aims to be a standards-compliant browser, it has three modes that support older web pages created with th...
... function handleevent(aevent) { var myevent = window.event ? window.event : aevent; } </script> the properties and functions that the event object exposes are also often named differently in mozilla and internet explorer, as table 4 shows. table 4. event properties differences between mozilla and internet explorer internet explorer name mozilla name description
altkey
altkey boolean property that returns whether the
alt key was pressed during the event. cancelbubble stoppropagation() used to stop the event from bubbling farther up the tree. clientx clientx the x coordinate of the event, in relation to the element viewport. clienty clienty the y coordinate of the event, in relation to the element viewport. ...
...And 2 more matches
Elements - Archive of obsolete content
ute indicates whether style rules from the document will affect anonymous content generated by the xbl binding. if this attribute is true, styles from the document will also be applied to the xbl generated anonymous content. content <!element content any> <!attlist content id id #implied > a binding can specify new content that is placed inside the bound element.
although you can see this content on screen as if it was directly in the file, this content is anonymous and is hidden from the normal dom. to access anonymous nodes on an xbl bound element, you can use the getanonymouselementbyattribute and getanonymousnodes functions. the only xbl element that can appear inside the content tag is the children tag. attributes on the <content> element in the binding ...
... can be obtained directly from the bound element. the property tag must be inside the implementation tag. id - the id attribute is a document-unique identifier. name - the name of the property. this is the name used to refer to the property on the bound element. readonly - the readonly attribute is used to designate a property as read-only. if set to true, the value of the property cannot be
altered. if this attribute is omitted, the property will be readable and writable. onget - the onget attribute's value is a script that executes when the value of the property is requested. if this attribute is set, any initial value contained underneath the element will be ignored. the return value of the script represents the value of the property that will be returned to the requestor. a property...
... this attribute is set, any initial value contained underneath the element will be ignored. the return value of the script represents the value of the property that will be returned to the requestor. a property getter can also be specified as a child of the property element using the getter tag. onset - the onset attribute's value is a script that executes when the value of the property is being
altered. if this attribute is set, any initial value contained underneath the element will be ignored. within the script, the parameter val represents the new value being assigned. a property setter can also be specified as a child of the property element using a setter tag. getter <!element getter pcdata> <!attlist getter id id #implied > the getter element con...
...And 2 more matches
XUL Structure - Archive of obsolete content
on for all xul files. you can load xul files from your own machine by opening them in the browser, or by double-clicking the file in your file manager. remember that remote xul will have significant restrictions on what it can do, and does not work with current firefox versions! document types: html xml xul css mozilla uses a distinctly different kind of document object (dom) for html and xul,
although they share much of the same functionality. there are three main types of document in mozilla: html, xml, and xul. naturally, the html document is used for html documents, the xul document is used for xul documents, and the xml document is used for other types of xml documents. since xul is also xml, the xul document is a subtype of the more generic xml document. there are subtle differences ...
...indow and the address book dialogs. the packages that are provided with mozilla are located within the chrome directory, which is in the directory where you built mozilla. the chrome directory is where you find all the files that describe the user interface used by the mozilla browser, mail client, and other applications. typically, you put all the xul files for an application in this directory,
although extensions are installed in the extensions directory for a particular user. just copying a xul file into the chrome directory doesn't give the file any extra permissions, nor can it be accessed via a chrome url. to gain the extra privileges, you will need to create a manifest file and put that in the chrome directory. this file is easy to create, as it is typically only a couple of lines lon...
...nu and toolbar. you will commonly use this feature in more complex xul applications since you wouldn't want the browser ui to exist around your dialog boxes. the files for a package are usually combined into a single jar file. a jar file may be created and examined using a zip utility. for instance, you can open the jar files in mozilla's chrome directory to see the basic structure of a package.
although it's normal to combine the files into a jar file, packages may also be accessed in expanded form into a directory.
although you don't normally distribute a package this way, it is handy during development since you can edit the file directly and then reload the xul file without having to repackage or reinstall the files. by default, mozilla applications parse xul files and scripts, and stor...
...And 2 more matches
-ms-filter - Archive of obsolete content
mple shows how to use an inline style sheet to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_h.htm <img style="filter:progid:dximagetransform.microsoft.motionblur(strength=50) progid:dximagetransform.microsoft.basicimage(mirror=1)" src="/workshop/samples/author/dhtml/graphics/cone.jpg" height="80px" width="80px"
alt="cone"> the following example shows how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to start the filter.</p> // call the function. <div id="filterfrom" style="position: absolute; width: 200px; height: 250px; background-co...
...ws how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to start the filter.</p> // call the function. ...
...age to start the filter.</p> // call the function. ...
...And 2 more matches
Correctly Using Titles With External Stylesheets - Archive of obsolete content
this can lead to a stylesheet being ignored, which is typically not what an author intends to do. why titles matter the title attribute affects how your external stylesheet is applied to a document. ...
...a document. in fact, the use of the title attribute is so significant that html 4.01 categorizes stylesheets according to the presence or absence of a title. by including a title attribute, you can control whether a particular stylesheet always affects a document, or if it is only used under certain circumstances. there are three kinds of stylesheets that are possible: persistent, preferred, and
alternate stylesheets. authors will be most familiar with persistent stylesheets, of which any number may be applied to a document at once. a persistent stylesheet is one which has no title attribute and a value of stylesheet supplied for the rel attribute. a document may refer to one or more persistent stylesheets, all of which are used in the presentation of the document. a preferred stylesheet, ...
... applied to the document. the specification does not supply a procedure to decide which one should be used, so user agents are free to make whatever choice they like. therefore, any link to a stylesheet that includes a title attribute cannot be persistent, and is likely to be ignored by the web browser. any link element referring to a stylesheet with a title attribute must be either preferred or
alternate, depending on the value of the rel attribute. in a document that refers to
alternate stylesheets, the preferred stylesheet will be used so long as none of the
alternate stylesheets are selected by the user. thus, when the document is loaded, the browser will use all of the persistent stylesheets and one preferred stylesheet (but remember, there should only be one preferred stylesheet). onc...
...And 2 more matches
Accessible multimedia - Learn web development
this article shows how. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of what accessibility is. objective: to understand the accessibility issues behind multimedia, and how to overcome them. ...
...n't as easy to ensure accessibility for — multimedia. images, videos, <canvas> elements, flash movies, etc., aren't as easily understood by screenreaders or navigated by the keyboard, and we need to give them a helping hand. but don't despair — here we will help you navigate through the techniques available for making multimedia more accessible. ...
... them a helping hand. but don't despair — here we will help you navigate through the techniques available for making multimedia more accessible. simple images we already covered simple text
alternatives for html images in our html: a good basis for accessibility article — you can refer back to there for the full details. in short, you should ensure that where possible visual content has an
alternative text available for screenreaders to pick up and read to their users. ...
...And 2 more matches
Index - Learn web development
er, codingscripting, google maps, learn, nytimes, third party, youtube this article has given you a useful introduction to using third-party apis to add functionality to your websites. 63 video and audio apis api, article, audio, beginner, codingscripting, guide, javascript, learn, video i think we've taught you enough in this article. the htmlmediaelement api makes a we
alth of functionality available for creating simple video and audio players, and that's only the tip of the iceberg. see the "see also" section below for links to more complex and interesting functionality. 64 introducing javascript objects article, assessment, beginner, codingscripting, guide, javascript, learn, objects, tutorial in javascript, most things are objects, from core...
... types of code blocks such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. 90 build your own function article, beginner, codingscripting, functions, guide, javascript, learn, tutorial, build, invoke, l10n:priority, parameters with most of the essential theory de
alt with in the previous article, this article provides practical experience. here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. 91 function return values article, beginner, codingscripting, functions, guide, javascript, learn, return, return values, l10n:priority there's one last es...
...g javascript. 102 learn to style html using css beginner, css, codingscripting, debugging, landing, style, topic, length, specificity cascading stylesheets — or css — is the first technology you should start learning after html. while html is used to define the structure and semantics of your content, css is used to style it and lay it out. for example, you can use css to
alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. 103 css building blocks beginner, css, learn, building blocks this module carries on where css first steps left off — now you've gained familiarity with the language and its syntax, and got some basic experience with using it, its time to di...
...And 2 more matches
Manipulating documents - Learn web development
riting web pages and apps, one of the most common things you'll want to do is manipulate the document structure in some way. this is usually done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article we'll look at how to use the dom in detail, along with some other interesting apis that can
alter your environment in interesting ways. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript — including javascript objects. objective: to gain familiarity with the core dom apis, and the other apis commonly associated with dom and document manipulation the important parts of a web browser web browsers are very complicated p...
...is the actual page loaded into the window, and is represented in javascript by the document object. you can use this object to return and manipulate information on the html and css that comprises the document, for example get a reference to an element in the dom, change its text content, apply new styles to it, create new elements and add them to the current element as children, or even delete it
altogether. in this article we'll focus mostly on manipulating the document, but we'll show a few other useful bits besides. the document object model the document currently loaded in each one of your browser tabs is represented by a document object model. this is a "tree structure" representation created by the browser that enables the html structure to be easily accessed by programming language...
...ple.html (see it live also). try opening this up in your browser — it is a very simple page containing a <section> element inside which you can find an image, and a paragraph with a link inside. ...
...And 2 more matches
Introduction to client-side frameworks - Learn web development
overview: client-side javascript frameworks next we begin our look at frameworks with a general overview of the area, looking at a brief history of javascript and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what
alternatives there are to client-side frameworks. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand how client-side javascript frameworks came to exist, what problems they solve, what
alternatives there are, and how to go about choosing one. a brief history when javascript debuted in 1996, it added occasional interactivity and excitement to a web that was, up until then, composed of static documents. the web became no...
...dern javascript frameworks has made it much easier to build highly dynamic, interactive applications. a framework is a library that offers opinions about how software gets built. 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 he
alth and longevity of software. javascript frameworks power much of the impressive software on the modern web – including many of the websites you likely use every day. mdn web docs, which you are currently reading this on, uses the react/reactdom framework to power its front end. what frameworks are out there? there are many frameworks out there, but currently the "big four" are considered to b...
...rrently reading this on, uses the react/reactdom framework to power its front end. what frameworks are out there? there are many frameworks out there, but currently the "big four" are considered to be the following. ember ember was initially released in december 2011 as a continuation of work that started in the sproutcore project. it is an older framework that has less users than more modern
alternatives such as react and vue, but it still enjoys a fair amount of popularity due to its stability, community support, and some clever coding principles. start learning ember angular angular is an open-source web application framework led by the angular team at google and by a community of individuals and corporations. it is a complete rewrite from the same team that built angularjs. angula...
...And 2 more matches
Software accessibility: Where are we today?
endors created products and software which helped people who could not perform one of the four basic tasks to use common computer applications. ...
... one of the four basic tasks to use common computer applications. ...
...ead portions of the screen comprehension software, which allows a dyslexic or learning disabled computer user to see and hear text as it is manipulated on the computer screen in fact, the entire adaptive technology industry has grown up around these issues. one great place to go and learn about this industry is the csun conference in los angeles, which takes place every year in mid-late march.
alternative ways to access the screen's contents most computer programs are so visual, they are difficult or impossible to use for persons with visual impairments. this need not be the case. here's how non-print readers use desktop software today: text-to-speech (tts) makes the computer talk to the user: those who can't read print at all usually use talking programs (text-to-speech). t...
...And 2 more matches
NSS tools : certutil
and key database file. this argument is provided to support legacy servers. most applications do not use a database prefix. -p phone specify a contact telephone number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile or curve-name read an
alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used,certutil generates its own pqg value. pqg files are created with a separate dsa utility. elliptic curve name is one of the ones from suite b: nistp256, nistp384, nistp521 if nss has been compiled with support curves outside of suite b: sect163k1, nistk163, sect16...
...th the -v argument. -x force the key and certificate database to open in read-write mode. this is used with the -u and -l command options. -x use certutil to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate ca. -y exp set an
alternate exponent value to use in generating a new rsa public key for the database, instead of the default value of 65537. the available
alternate values are 3 and 17. -z noise-file read a seed value from the specified file to generate a new private and public key pair. this argument makes it possible to use hardware-generated s...
... keywords are available: + serverauth + clientauth + codesigning + emailprotection + timestamp + ocspresponder + stepup + critical x.509 certificate extensions are described in rfc 5280. ...
...And 2 more matches
NSS Tools certutil
. bracket theoutput-file string with quotation marks if it contains spaces. if this argument is not used the output destination defaults to standard output. -p phone specify a contact telephone number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile read an
alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, the key database tool generates its own pqg value. pqg files are created with a separate dsa utility. -r display a certificate's binary der encoding when listing information about that certificate with the -l option. -s subject identify a...
...set. if this argument is not used, the validity period begins at the current system time. the length of the validity period is set with the -v argument. -x use the certificate database tool to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate ca. -y exp set an
alternate exponent value to use in generating a new rsa public key for the database, instead of the default value of 65537. the available
alternate values are 3 and 17. -z noise-file read a seed value from the specified binary file to use in generating a new rsa private and public key pair. this argument makes it possible to use hardware-generated seed values and unneces...
.... -6 add an extended key usage extension to a certificate that is being created or added to the database. extended key usage extensions are described in standard x.509 v3 certificate extensions in appendix a.3 of thered hat certificate system administration guide. ...
...And 2 more matches
Parser API
dy: [ statement ]; } a block statement, i.e., a sequence of statements surrounded by braces. interface expressionstatement <: statement { type: "expressionstatement"; expression: expression; } an expression statement, i.e., a statement consisting of a single expression. interface ifstatement <: statement { type: "ifstatement"; test: expression; consequent: statement;
alternate: statement | null; } an if statement. interface labeledstatement <: statement { type: "labeledstatement"; label: identifier; body: statement; } a labeled statement, i.e., a statement prefixed by a break/continue label. interface breakstatement <: statement { type: "breakstatement"; label: identifier | null; } a break statement. interface continuestatement <: sta...
...dy: statement; } a for/of statement. interface letstatement <: statement { type: "letstatement"; head: [ variabledeclarator ]; body: statement; } a let statement. note: the let statement form is spidermonkey-specific. interface debuggerstatement <: statement { type: "debuggerstatement"; } a debugger statement. note: the debugger statement is new in ecmascript 5th edition,
although spidermonkey has supported it for years. declarations interface declaration <: statement { } any declaration node. note that declarations are considered statements; this is because declarations can appear in any statement context in the language recognized by the spidermonkey parser. note: declarations in arbitrary nested scopes are spidermonkey-specific. interface functiondeclaration ...
... argument: expression; prefix: boolean; } an update (increment or decrement) operator expression. interface logicalexpression <: expression { type: "logicalexpression"; operator: logicaloperator; left: expression; right: expression; } a logical operator expression. interface conditionalexpression <: expression { type: "conditionalexpression"; test: expression;
alternate: expression; consequent: expression; } a conditional expression, i.e., a ternary ?/: expression. interface newexpression <: expression { type: "newexpression"; callee: expression; arguments: [ expression ]; } a new expression. interface callexpression <: expression { type: "callexpression"; callee: expression; arguments: [ expression ]; } a function or metho...
...And 2 more matches
XPIDL
one of the fundamental types, or any other type declared via a typedef, interface, or a native type. native types are types which correspond to a given c++ type. most native types are not scriptable: if it is not present in the list above, then it is certainly not scriptable (some of the above, particularly jsid, are not scriptable). the contents of the parentheses of a native type declaration (
although native declarations without parentheses are parsable, i do not trust that they are properly handled by the xpidl handlers) is a string equivalent to the c++ type. xpidl itself does not interpret this string, it just literally pastes it anywhere the native type is used. the interpretation of the type can be modified by having properties on the native declaration: table 3: native type defin...
...tants are technically legal at the top level, but xpidl i forbids them from being placed there; instead, they must be in an interface. the only constants supported are those which become integer types when compiled to source code; string constants and floating point constants, though parseable, cannot be made into a header or xpt file. constants are emitted in header files using anonymous enums,
although there is an outstanding patch that combines adjacent constants into the same anonymous enums to quiet enum mismatch warnings. interfaces specifying interfaces is the primary purpose of using xpidl. interfaces are basically a collection of constants, methods, and attributes; in mozilla, these are the primary ways in which javascript code can interact with native c++ code. furthermore, inter...
...h other functions). for example, the method '[binaryname(foo)] void bar();' becomes 'nsresult foo()' in native code (note that capitalization is still applied). however, the capitalization is not applied when using binaryname with attributes; i.e., [binaryname(foo)] readonly attribute quux bar; becomes getfoo(quux**) in native code. attributes named 'iid' and methods named 'getiid' are forbidden,
although this is checked before binaryname conversion. the implicit_jscontext and optional_argc parameters are properties which help native code implementations determine how the call was made from script. if implicit_jscontext is present on a method, then an additional jscontext *cx parameter is added just after the regular list which receives the context of the caller. if optional_argc is present,...
...And 2 more matches
DOMMatrixReadOnly - Web APIs
a 4×4 matrix is suitable to describe any rotation and translation in 3d. this interface should be available inside web workers, though some implementations doesn't allow it yet. properties this interface doesn't inherit any properties. is2d read only a boolean flag whose value is true if the matrix was initialized as a 2d matrix. ...
...red in order to perform 2d rotations and translations. 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 doesn't inherit any methods. none of the following methods
alter the original matrix. dommatrixreadonly.flipx() returns a new dommatrix created by flipping the source matrix around its x-axis. this is equivalent to multiplying the matrix by dommatrix(-1, 0, 0, 1, 0, 0). the original matrix is not modified. dommatrixreadonly.flipy() returns a new dommatrix created by flipping the source matrix around its y-axis. this is equivalent to multiplying the ma...
...pping the source matrix around its y-axis. this is equivalent to multiplying the matrix by dommatrix(1, 0, 0, -1, 0, 0). the original matrix is not modified. dommatrixreadonly.inverse() returns a new dommatrix created by inverting the source matrix. if the matrix cannot be inverted, the new matrix's components are all set to nan and its is2d property is set to false. the original matrix is not
altered. dommatrixreadonly.multiply() returns a new dommatrix created by computing the dot product of the source matrix and the specified matrix: a⋅b. if no matrix is specified as the multiplier, the matrix is multiplied by a matrix in which every element is 0 except the bottom-right corner and the element immediately above and to its left: m33 and m34. these have the default value of 1. the orig...
...And 2 more matches
FileSystemDirectoryReader - Web APIs
if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...m/mdn/browser-compat-data and send us a pull request. ...
...ompat-data and send us a pull request. ...
...And 2 more matches
Drag Operations - Web APIs
y element, including images and links. however, for these last two, the default value is true, so you would only use the draggable attribute with a value of false to disable dragging of these elements. note: when an element is made draggable, text or other elements within it can no longer be selected in the normal way by clicking and dragging with the mouse. instead, the user must hold down the
alt key to select text with the mouse, or use the keyboard. starting a drag operation in this example, a listener is added for the dragstart event by using the ondragstart attribute. <p draggable="true" ondragstart="event.datatransfer.setdata('text/plain', 'this text may be dragged')"> this text <strong>may</strong> be dragged. </p> when a user begins to drag, the dragstart event is fired. i...
... however, you can use setdragimage() to specify a custom drag feedback image. event.datatransfer.setdragimage(image, xoffset, yoffset); three arguments are necessary. the first is a reference to an image. this reference will typically be to an <img> element, but it can also be to a <canvas> or any other element. the feedback image will be generated from whatever the image looks like on screen,
although for images, they will be drawn at their original size. the second and third arguments to the setdragimage() method are offsets where the image should appear relative to the mouse pointer. it is also possible to use images and canvases that are not in a document. this technique is useful when drawing custom drag images using the canvas element, as in the following example: function dragwith...
..., should be set within one of these events to specify which single operation should be performed. valid values for dropeffect are none, copy, move, or link. the combination values are not used for this property. with the dragenter and dragover event, the dropeffect property is initialized to the effect that the user is requesting. the user can modify the desired effect by pressing modifier keys.
although the exact keys used vary by platform, typically the shift and control keys would be used to switch between copying, moving, and linking. the mouse pointer will change to indicate which operation is desired. for instance, for a copy, the cursor might appear with a plus sign next to it. you can modify the dropeffect property during the dragenter or dragover events, if for example, a particula...
...And 2 more matches
Key Values - Web APIs
aries varies varies modifier keys modifiers are special keys which are used to generate special characters or cause special actions when used in combination with other keys. examples include the shift and control keys, and lock keys such as caps lock and numlock. keyboardevent.key value description virtual keycode windows mac linux android "
alt" [5] the
alt (
alternative) key. vk_menu (0x12) vk_lmenu (0xa4) vk_rmenu (0xa5) kvk_option (0x3a) kvk_rightoption (0x3d) gdk_key_
alt_l (0xffe9) gdk_key_
alt_r (0xffea) qt::key_
alt (0x01000023) keycode_
alt_left (57) keycode_
alt_right (58) "
altgraph" [5] the
altgr or
altgraph (
alternate graphics) key. enables the iso level 3 shift modifier (where shi...
...toggles the capital character lock on and off for subsequent input. vk_capital (0x14) kvk_capslock (0x39) gdk_key_caps_lock (0xffe5) qt::key_capslock (0x01000024) keycode_caps_lock (115) "control" the control, ctrl, or ctl key. allows typing control characters. ...
...ed), and gdk_key_hyper_r (0xffee) on linux. [2] internet explorer (tested on release 9 and 11) reports "scroll" instead of "scrolllock" for the scroll lock key. [3] firefox did not add support for the symbol key until firefox 37. [4] firefox generates the key value "os" for the super and hyper keys, instead of "super" and "hyper". [5] chrome 67 and firefox 63 now correctly interpret the right
alt key for keyboard layouts which map that key to
altgr. see firefox bug bug 900750 and chrome bug 25503 for further details. whitespace keys keyboardevent.key value description virtual keycode windows mac linux android "enter" the enter or ↵ key (sometimes labeled return). vk_return (0x0d) kvk_return (0x24) kvk_ansi_keypadenter (0x4c) ...
...And 2 more matches
SpeechRecognitionResult - Web APIs
the speechrecognitionresult interface of the web speech api represents a single recognition match, which may contain multiple speechrecognition
alternative objects. properties speechrecognitionresult.isfinal read only a boolean that states whether this result is final (true) or not (false) — if so, then this is the final time this result will be returned; if not, then this result is an interim result, and may be updated later on. ...
... objects. properties speechrecognitionresult.isfinal read only a boolean that states whether this result is final (true) or not (false) — if so, then this is the final time this result will be returned; if not, then this result is an interim result, and may be updated later on. speechrecognitionresult.length read only returns the length of the "array" — the number of speechrecognition
alternative objects contained in the result (also referred to as "n-best
alternatives".) methods speechrecognitionresult.item a standard getter that allows speechrecognition
alternative objects within the result to be accessed via array syntax. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent resul...
...esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...And 2 more matches
TextRange - Web APIs
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. a textrange object represents a fragment of text in a document, similar to the standard defined range interface. this object is used to represent a specific piece of text in the document. for example, when you hold down the mouse to select the content on the page, you create a typical textrange. it is implemented in ie, then a textrange object can be created by element.createtextrange() or document.selection.createrange(). ...
...ined range interface. this object is used to represent a specific piece of text in the document. for example, when you hold down the mouse to select the content on the page, you create a typical textrange. it is implemented in ie, then a textrange object can be created by element.createtextrange() or document.selection.createrange(). note that this interface is not supported in non ie browsers.
alternative selection and range interfaces can be used. properties textrange.boundingheightread only returns the height of the rectangle bound to the textrange object. textrange.boundingleftread only returns the distance between the left edge of the rectangle that binds the textrange object and the left edge that completely contains the textrange object. textrange.boundingtopread only ...
...ycommandstate() returns the boolean indicating the current state of the specified command. you can also see document.querycommandstate(). textrange.querycommandvalue() returns the domstring indicating the current value of the specified command. you can also see document.querycommandvalue(). textrange.scrollintoview() scroll the range to the visible range (top or bottom). it can be used as an
alternative to element.scrollintoview in the lower version of ie. textrange.select() select the current range (i.e. the blue selection seen by the user). textrange.setendpoint() sets the end point of the current range based on the bounds of other textrange. example the following example is valid under ie9. the example gets the textrange through document.selection, and sets the specified elemen...
...And 2 more matches
Lighting a WebXR setting - Web APIs
however, there are issues and details to keep in mind while creating your lighting code, especially for augmented reality (ar) applications. this guide discusses these topics. and while this article provides brief reminders as to how lighting works in general, it is not by any means a tutorial in lighting or a guide to how to create a properly-lit 3d scene. flashback: simulating lighting in 3d
although this article isn't a comprehensive guide to lighting a 3d scene, it's useful to provide a brief reminder as to how lighting works in general. fundamentally, simulating lighting in a virtual scene involves computing how much light from each light source is received by the eye after interacting with and reflecting off of each object in the scene. reflection of light a diagram showing how ...
...ion, Θr, is equal to the angle of incidence, except it's on the opposite side of the normal vector. the reflected ray, then, departs along at that angle off the normal. this is the law of reflection. this is the foundation for much of what's involved in shading a scene, and comes into play in terms of how different types of light source behave. the reflected light ray's color may, of course, be
altered in intensity and/or hue due to the light's interaction with the surface, but the angle is always the same. components of a light source a light source has three major components; each component is in essence a type of light there are three kinds of light that can affect the color and brightness of objects and their pixels as displayed on the viewer's screen or headset. a sphere with on...
...he effect of ambient light is computed by simply multiplying the intensity of the light source by the reflectance of the surface at the pixel's location. the color and intensity of every pixel in the scene is affected exactly the same way, regardless of where it is in the scene or the direction it's facing. 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. because the bouncing and scattering of light can be expensive to compute in real time, especially if multiple light sources are involved, it's common to use ambient lighting to simulate the scattered light caused by all the other light sources in the scene, instead of actually calculating the tr...
...And 2 more matches
Using the Web Speech API - Web APIs
semi-colons, just like in javascript. the first line — #jsgf v1.0; — states the format and version used. this always needs to be included first. the second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equals sign are the
alternative values that will be recognised and accepted as appropriate values for the term. note how each is separated by a pipe character. you can have as many terms defined as you want on separate lines following the above structure, and include fairly complex grammar definitions. for this basic demo, we are just keeping things simple. plugging the grammar into our speech recognition the next ...
...e), or just a single result each time recognition is started (false). speechrecognition.lang: sets the language of the recognition. setting this is good practice, and therefore recommended. speechrecognition.interimresults: defines whether the speech recognition system should return interim results, or just final results. final results are good enough for this simple demo. speechrecognition.max
alternatives: sets the number of
alternative potential matches that should be returned per result. this can sometimes be useful, say if a result is not completely clear and you want to display a list if
alternatives for the user to choose the correct one from. but it is not needed for this simple demo, so we are just specifying one (which is actually the default anyway.) recognition.grammars = spee...
...if a result is not completely clear and you want to display a list if
alternatives for the user to choose the correct one from. but it is not needed for this simple demo, so we are just specifying one (which is actually the default anyway.) recognition.grammars = speechrecognitionlist; recognition.continuous = false; recognition.lang = 'en-us'; recognition.interimresults = false; recognition.max
alternatives = 1; starting the speech recognition after grabbing references to the output <div> and the html element (so we can output diagnostic messages and update the app background color later on), we implement an onclick handler so that when the screen is tapped/clicked, the speech recognition service will start. this is achieved by calling speechrecognition.start(). the foreach() method is us...
...And 2 more matches
Web APIs
specifications this is a list of all the apis that are available. ...
...ushmanager pushmessagedata pushregistrationmanager pushsubscription r rtcansweroptions rtccertificate rtcconfiguration rtcdtmfsender rtcdtmftonechangeevent rtcdatachannel rtcdatachannelevent rtcdtlstransport rtcerror rtcerrorevent rtcicecandidate rtcicecandidateinit rtcicecandidatepair rtcicecandidatepairstats rtcicecandidatestats rtcicecandidatetype rtcicecomponent rtcicecredenti
altype rtcicegathererstate rtciceparameters rtciceprotocol rtcicerole rtciceserver rtcicetcpcandidatetype rtcicetransport rtcicetransportstate rtcidentityassertion rtcidentityerrorevent rtcidentityevent rtcinboundrtpstreamstats rtcnetworktype rtcofferansweroptions rtcofferoptions rtcoutboundrtpstreamstats rtcpeerconnection rtcpeerconnectioniceerrorevent rtcpeerconnectioniceevent rtcremoteou...
...ller readablestream readablestreambyobreader readablestreambyobrequest readablestreamdefaultcontroller readablestreamdefaultreader relativeorientationsensor renderingcontext report reportingobserver reportingobserveroptions request requestdestination resizeobserver resizeobserverentry response rsahashedimportparams rsahashedkeygenparams rsaoaepparams rsapssparams s svgaelement svg
altglyphdefelement svg
altglyphelement svg
altglyphitemelement svgangle svganimatecolorelement svganimateelement svganimatemotionelement svganimatetransformelement svganimatedangle svganimatedboolean svganimatedenumeration svganimatedinteger svganimatedlength svganimatedlengthlist svganimatednumber svganimatednumberlist svganimatedpoints svganimatedpreserveaspectratio svganimatedrect svganimate...
...And 2 more matches
Cognitive accessibility - Accessibility
, with a single column mobile design. all information, including structure and relationships conveyed through the presentation, should be available in a form that can be perceived by all users to achieve this goal. for example, the information could be spoken aloud via a narration tool. making your content capable of being understood by the software is a good way to help ensure it can be used by
alternate presentational modes. time it is important to allow users the time they require to complete tasks. guideline 2.2 states "provide users enough time to read and use content." a time limit is any process that happens without user initiation after a set time or on a periodic basis, such as being logged out after 30 minutes or having 15 minutes to make a purchase. people with cognitive disabi...
... process that happens without user initiation after a set time or on a periodic basis, such as being logged out after 30 minutes or having 15 minutes to make a purchase. people with cognitive disabilities may require more time to read content, or to perform functions such as filling out forms. solutions include providing users enough additional time to complete tasks or eliminate time constraints
altogether. timers options for adjusting time requirements include: allowing the user to turn off or adjust the time to at least 10 times the original limit before encountering it. alerting the user and providing a buffer of at least 20 seconds to extend the timeout duration by a factor of 10 with a simple action, such as hitting the space bar. provide a toggle on content that allows ...
...ons may need more time to read and to understand. for improved usability remove any time limit. timed content should also be avoided, with exceptions for non-interactive synchronized media and real-time events. people with attention deficit disorders should be able to focus on content without distractions. the user should be able to postpone or suppress interruptions, except situations involving
altering a person to an emergency. this provides access to people with cognitive disabilities by enabling them to focus on the main purpose of the content. enable the user to postpone content updates by providing a way to request content updates rather than updating automatically. also, enable a way to make nonessential alerts optional. ensure that people can continue an activity without loss of dat...
...And 2 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
pact than others. font size, font style (some fonts are so thin or fancy that they present accessibility problems on their own), background color, the size of the background space around the text, even pixel densities and more all affect how color is delivered from the screen. (see understanding success criterion 1.4.3: contrast) a viewer's distance from the screen, the ambient background, the he
alth of his eyes, and more all affect how that color is received by the viewer. how the viewer perceives color after it gets to his eyes is yet another matter, and can be affected by overall he
alth. 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. color, contrast, and luminance a...
...b is hardware-oriented, reflecting the use of crts, and that rgb is non-intuitive. that said, hsl colors incorporate lightness, not luminance, and this is a significant consideration. note that in that same section of the css color module 3, there are algorigthms available to translate the hsl to rgb. newer technologies, such as opengl and direct3d incorporate support for the srgb gamma curve,
although some articles for opengl reference use of rgba rather than srgb. webgl is usually in the rgba format; see an example of how it is used in "clearing with colors". where accessibility is concerned, however, standards and guidelines are currently written predominantly using the srgb color space, especially as it applies to color contrast ratios. in speaking specifically to relative luminanc...
...it comes to "perceiving" colors, not all colors are created equal. our eyes are tuned to perceive certain colors, red, blue, and green, but we do not perceive these colors with equal strength. according to the article, hypersensitive cones, the authors note that "by population, about 64% of the cones are red-sensitive, about 32% green sensitive, and about 2% are blue sensitive." surprisingly,
although cones that are blue-sensitive typically make up the fewest number of cones, they are also the most "sensitive" to color. put another way, as humans, the color blue is perceived differently than other colors, for multiple reasons. first, because the blue cones are actually the most sensitive of the three, second, we have fewer blue cones than red or green, and third, it so happens that thes...
...And 2 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
rid items there is a mention in the specification of anonymous grid items. these are created if you have a string of text inside your grid container, that is not wrapped in any other element. in the example below we have three grid items, assuming you had set the parent with a class of grid to display: grid. the first is an anonymous item as it has no enclosing markup, this item will always be de
alt with via the auto-placement rules. the other two are grid items enclosed in a div, they might be auto-placed or you could place these with a positioning method onto your grid. <div class="grid"> i am a string and will become an anonymous item <div>a grid item</div> <div>a grid item</div> </div> anonymous items are always auto-placed because there is no way to target them. therefore if yo...
... grid-auto-flow: dense; list-style: none; margin: 1em auto; padding: 0; max-width: 800px; } .wrapper li { border: 1px solid #ccc; } .wrapper li.landscape { grid-column-end: span 2; } .wrapper li img { display: block; object-fit: cover; width: 100%; height: 100%; } <ul class="wrapper"> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li><img src="https://udn.re...
...e"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png"
alt="placeholder"></li> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png"
alt="placeholder"></li> <li class="landscape"><img src="https://udn.realityripple.com/samples/62/643f590dbc.png"
alt="placeholder"></li> <li><img src="https://udn.realityripple.com/samples/72/ab41das78e.png"
alt="placeholder"></li> <li><img src="https://udn.realityripple.com/samples/72/ab41das78...
...And 2 more matches
animation-direction - CSS: Cascading Style Sheets
the animation-direction css property sets whether an animation should play forward, backward, or
alternate back and forth between playing the sequence forward and backward. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. ...
...s stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* single animation */ animation-direction: normal; animation-direction: reverse; animation-direction:
alternate; animation-direction:
alternate-reverse; /* multiple animations */ animation-direction: normal, reverse; animation-direction:
alternate, reverse, normal; /* global values */ animation-direction: inherit; animation-direction: initial; animation-direction: unset; values normal the animation plays forwards each cycle. in other words, each time the animation cycles, the animation will r...
...he animation will reset to the beginning state and start over again. this is the default value. reverse the animation plays backwards each cycle. in other words, each time the animation cycles, the animation will reset to the end state and start over again. animation steps are performed backwards, and timing functions are also reversed. for example, an ease-in timing function becomes ease-out.
alternate the animation reverses direction each cycle, with the first iteration being played forwards. the count to determine if a cycle is even or odd starts at one.
alternate-reverse the animation reverses direction each cycle, with the first iteration being played backwards. the count to determine if a cycle is even or odd starts at one. note: when you specify multiple comma-separated values...
...And 2 more matches
font-variant-ligatures - CSS: Cascading Style Sheets
values normal this keyword leads to the activation of the usual ligatures and contextual ...
... values normal this keyword leads to the activation of the usual ligatures and contextual forms needed for correct rendering. the ligatures and forms activated depend on th...
...<historical-lig-values> these values control the ligatures used historically, in old books, like the german tz digraph being displayed ß. they correspond to the opentype values hlig. two values are possible: historical-ligatures activating these ligatures. no-historical-ligatures deactivating the ligatures. note that the keyword normal usually deactivates these ligatures. <contextual-
alt-values> these values control whether letters adapt to their context—that is, whether they adapt to the surrounding letters. these values correspond to the opentype values c
alt. two values are possible: contextual specifies that the contextual
alternates are to be used. note that the keyword normal usually activates these ligatures too. no-contextual prevents their use. formal defin...
...And 2 more matches
font-variant - CSS: Cascading Style Sheets
iant, (that is, normal or small-caps), by using the font shorthand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: 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 initial value of normal. longhand properti...
... 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 initial value of normal. longhand properties of font-variant are: font-variant-caps, font-variant-numeric, font-variant-
alternates, font-variant-ligatures, and font-variant-east-asian. none sets the value of the font-variant-ligatures to none and the values of the other longhand property as normal, their initial value. <common-lig-values>, <discretionary-lig-values>, <historical-lig-values>, <contextual-
alt-values> specifies the keywords related to the font-variant-ligatures longhand property. the possible values ...
...-variant-ligatures longhand property. the possible values are: common-ligatures, no-common-ligatures, discretionary-ligatures, no-discretionary-ligatures, historical-ligatures, no-historical-ligatures, contextual, and no-contextual. stylistic(), historical-forms, styleset(), character-variant(), swash(), ornaments(), annotation() specifies the keywords and functions related to the font-variant-
alternates longhand property. small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-values>, ordinal, slashed-zero specifies the keywords related to the font-variant-numeric longhand property. the possible values ar...
...And 2 more matches
object-fit - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax the object-fit property is specified as a single keyword chosen from the list of values below. ...
...uld result in a smaller concrete object size. ...
...mentsinheritednocomputed valueas specifiedanimation typediscrete formal syntax fill | contain | cover | none | scale-down examples setting object-fit for an image html <section> <h2>object-fit: fill</h2> <img class="fill" src="https://udn.realityripple.com/samples/ae/248a9938d9.png"
alt="mdn logo"> <img class="fill narrow" src="https://udn.realityripple.com/samples/ae/248a9938d9.png"
alt="mdn logo"> <h2>object-fit: contain</h2> <img class="contain" src="https://udn.realityripple.com/samples/ae/248a9938d9.png"
alt="mdn logo"> <img class="contain narrow" src="https://udn.realityripple.com/samples/ae/248a9938d9.png"
alt="mdn logo"> <h2>object-fit: cover</h2> <img class="cover" src="https://udn.realityripple.com/samples/ae/248a9938d9.png"
alt="mdn logo"> <img class="c...
...And 2 more matches
Creating a cross-browser video player - Developer guides
76"> <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&image=img/poster.jpg&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>© blender foundation | <a href="http://mango.blender.org">mango.blender.org</a></f...
... <progress> element later). mute mute.addeventlistener('click', function(e) { video.muted = !video.muted; }); the mute button is a simple toggle button that uses the media api's muted attribute to mute the video: this is a boolean indicating whether the video is muted or not. to get it to toggle, we set it to the inverse of itself. ...
...on(e) { video.muted = !video.muted; }); the mute button is a simple toggle button that uses the media api's muted attribute to mute the video: this is a boolean indicating whether the video is muted or not. to get it to toggle, we set it to the inverse of itself. ...
...And 2 more matches
<picture>: The Picture element - HTML: Hypertext Markup Language
the browser will consider each child <source> element and choose the best match among them. if no matches are found—or the browser doesn't support the <picture> element—the url of the <img> element's src attribute is selected. the selected image is then presented in the space occupied by the <img> element. the source for this interactive example is stored in a github repository. ...
...ibes the size and other attributes of the image and its presentation. it provides a fallback in case none of the offered <source> elements are able to provide a usable image. common use cases for <picture>: art direction. cropping or modifying images for different media conditions (for example, loading a simpler version of an image which has too many details, on smaller displays). offering
alternative image formats, for cases where certain formats are not supported. saving bandwidth and speeding page load times by loading the most appropriate image for the viewer's display. if providing higher-density versions of an image for high-dpi (retina) display, use srcset on the <img> element instead. this lets browsers opt for lower-density versions in data-saving modes, and you don't have ...
...cture>. the media attribute the media attribute specifies a media condition (similar to a media query) that the user agent will evaluate for each <source> element. if the <source>'s media condition evaluates to false, the browser skips it and evaluates the next element inside <picture>. <picture> <source srcset="mdn-logo-wide.png" media="(min-width: 600px)"> <img src="mdn-logo-narrow.png"
alt="mdn"> </picture> the srcset attribute the srcset attribute is used to offer list of possible images based on size. it is composed of a comma-separated list of image descriptors. each image descriptor is composed of a url of the image, and either... 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 ...
...And 2 more matches
Evolution of HTTP - HTTP
text transfer protocol (http). a client to display (and accidentally edit) these documents, the first web browser called worldwideweb. a server to give access to the document, an early version of httpd. these four building blocks were completed by the end of 1990, and the first servers were already running outside of cern by early 1991. on august 6th 1991, tim berners-lee's post on the public
alt.hypertext newsgroup is now considered as the official start of the world wide web as a public project. the http protocol used in those early phases was very simple, later dubbed http/0.9, and sometimes as the one-line protocol. http/0.9 – the one-line protocol the initial version of http had no version number; it has been later called 0.9 to differentiate it from the later versions. http/0.9...
...ions 1.0, 1.1, 1.2, and 1.3 appearing successfully to close vulnerabilities. during the same time, the need for an encrypted transport layer raised: the web left the relative trustiness of a mostly academic network, to a jungle where advertisers, random individuals or criminals compete to get as much private information about people, try to impersonate them or even to replace data transmitted by
altered ones. as the applications built over http became more and more powerful, having access to more and more private information like address books, e-mail, or the geographic position of the user, the need to have tls became ubiquitous even outside the e-commerce use case. using http for complex applications the original vision of tim berners-lee for the web wasn't a read-only medium. he envisio...
...h more data is transmitted over significantly more http requests. http/1.1 connections need requests sent in the correct order. theoretically, several parallel connections could be used (typically between 5 and 8), bringing considerable overhead and complexity. for example, http pipelining has emerged as a resource burden in web development. in the first half of the 2010s, google demonstrated an
alternative way of exchanging data between client and server, by implementing an experimental protocol spdy. this amassed interest from developers working on both browsers and servers. defining an increase in responsiveness, and solving the problem of duplication of data transmitted, spdy served as the foundations of the http/2 protocol. the http/2 protocol has several prime differences from the htt...
...And 2 more matches
Browser detection using the user agent - HTTP
on't yet support, and you want to send those users to an older web site with fewer features but that you know will work. this is the worst reason to use user agent detection because odds are eventually all the other browsers will catch up. in addition, it is not practical to test every one of the less popular browsers and test for them. you should never do user agent sniffing. there is always the
alternative of doing feature detection instead. do you want to provide different html depending on which browser is being used? this is usually a bad practice, but there are some cases in which this is necessary. in these cases, you should first analyze your situation to be sure it's really necessary. can you prevent it by adding some non-semantic <div> or <span> elements? the difficulty of succ...
...really after. people use user agent sniffing to detect if the users' device is touch-friendly and has a small screen so they can optimize their website accordingly. while user agent sniffing can sometimes detect these, not all devices are the same: some mobile devices have big screen sizes, some desktops have a small touchscreen, some people use smart tv's which are an entirely different ballgame
altogether, and some people can dynamically change the width and height of their screen by flipping their tablet on its side! so, user agent sniffing is definitely not the way to go. thankfully, there are much better
alternatives. use navigator.maxtouchpoints to detect if the user's device has a touchscreen. then, default back to checking the user agent screen only if (!("maxtouchpoints" in navigator...
...e desktop version. rather, try to have fewer columns of information in a longer page on smaller screens while having more columns with a shorter page on larger screen sizes. this effect can be easily achieved using css flexboxes, sometimes with floats as a partial fallback. also try to move less relevant/important information down to the bottom and group the page's content together meaningfully.
although it is off-topic, perhaps the following detailed example might give you insights and ideas that persuade you to forgo user agent sniffing. let us imagine a page composed of boxes of information; each box is about a different feline breed or canine breed. each box has an image, an overview, and a historical funfact. the pictures are kept to a maximum reasonable size even on large screens. for ...
...And 2 more matches
Critical rendering path - Web Performance
of steps the browser goes through to convert the html, css, and javascript into pixels on the screen. 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. the document object model is created as the html is parsed. the html may request javascript, which may, in turn,
alter the dom. the html includes or makes requests for styles, which in turn builds the css object model. the browser engine combines the two to create the render tree. layout determines the size and location of everything on the page. once layout is determined, pixels are painted to the screen. optimizing the critical rendering path improves the time to first render. understanding and optimizing th...
... app starts with an html request. the server returns the html - response headers and data. the browser then begins parsing the html, converting the received bytes to the dom tree. the browser initiates requests every time it finds links to external resources, be they stylesheets, scripts, or embedded image references. some requests are blocking, which means the parsing of the rest of the html is h
alted until the imported asset is handled. the browser continues to parse the html making requests and building the dom, until it gets to the end, at which point it constructs the css object model. with the dom and cssom complete, the browser builds the render tree, computing the styles for all the visible content. after the render tree is complete, layout occurs, defining the location and size of al...
...n with later parsing should not be rendered to the screen. in terms of selector performance, less specific selectors are faster than more specific ones. for example, .foo {} is faster than .bar .foo {} because when the browser finds .foo, in the second scenario, it has to walk up the dom to check if .foo has an ancestor .bar. the more specific tag requires more work from the browser, but this pen
alty is not likely worth optimizing. if you measure the time it takes to parse css, you'll be amazed at how fast browsers truly are. the more specific rule is more expensive because it has to traverse more nodes in the dom tree - but that extra expense is generally minimal. measure first. optimize as needed. specificity is likely not your low hanging fruit. when it comes to css, selector performance...
...And 2 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
we also have a mid-width layout, which is aimed at working well on tablets and narrow laptop screens. this is created by all of the css inside the first media query: @media all and (max-width: 1024px) { x-card:nth-child(1), x-card:nth-child(2) { width: 50%; } x-card:nth-child(3) { width: 100%; clear: left; } x-card:nth-child(3) img { width: 20%; } } so here we're
altering the widths of the columns and removing the float of the third column (and adding clearing to guard against any float funny business). we've also
altered the width of the images inside the third container (no longer a column — this is the gallery) so that now you get five per line (it was previously three per line). narrow screen/mobile layout we then have a narrow screen layout, design...
...on a cinema display), the layout stops getting wider, and just centers in the space available. this is pretty simple to achieve. you could use a min-width media query to fix the <body> width at a certain point: @media all and (min-width: 1400px) { body { width: 1400px; margin: 0 auto; } } but it's actually easier to just set the following rule instead, and get rid of the media query
altogether: body { max-width: 1400px; margin: 0 auto; } orientation fail we also came across some problems with orientation: the mobile-app layout of our example app is designed for portrait orientation, and looks terrible when viewed on a device in landscape orientation. to fix this, we added in a media query that only applies its contents to the markup when device is viewed in landscape orie...
... removes the top margin from the x-card contents so you don't end up with an unsightly gap at the top of the screen in landscape mode. changes the sizing of the control buttons (e.g. take picture, delete photo) so they don't look too big and sit properly on the screen. this results in the following layout: note:...
...And 2 more matches
x - SVG: Scalable Vector Graphics
the x attribute defines a x-axis coordinate in the user coordinate system. ...
... value list of <length> default value none animatable yes feblend for <feblend>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> ...
... value list of <length> default value none animatable yes feblend for <feblend>, x defines the minimum x coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% a...
...And 2 more matches
y - SVG: Scalable Vector Graphics
the y attribute defines a y-axis coordinate in the user coordinate system. ...
... value list of <length> default value none animatable yes feblend for <feblend>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> ...
... value list of <length> default value none animatable yes feblend for <feblend>, y defines the minimum y coordinate for the rendering area of the primitive. value <length> | <percentage> default value 0% a...
...And 2 more matches
SVG documentation index - SVG: Scalable Vector Graphics
acing attribute specifies spacing behavior between words. 250 writing-mode needsexample, svg, svg attribute the writing-mode attribute specifies whether the initial inline-progression-direction for a <text> element shall be left-to-right, right-to-left, or top-to-bottom. the writing-mode attribute applies only to <text> elements; the attribute is ignored for <tspan>, <tref>, <
altglyph> and <textpath> sub-elements. (note that the inline-progression-direction can change within a <text> element due to the unicode bidirectional algorithm and properties direction and unicode-bidi.) 251 x svg, svg attribute the x attribute defines a x-axis coordinate in the user coordinate system. 252 x-height deprecated, svg, svg attribute the x-height...
...o the construction, drawing, and layout of vector images and diagrams. here you'll find reference documentation for each of the svg elements. 294 <a> element, reference, svg, svg container the <a> svg element creates a hyperlink to other web pages, files, locations in the same page, email addresses, or any other url. it is very similar to html’s <a> element. ...
...'ll find reference documentation for each of the svg elements. 294 <a> element, reference, svg, svg container the <a> svg element creates a hyperlink to other web pages, files, locations in the same page, email addresses, or any other url. it is very similar to html’s <a> element. ...
...And 2 more matches
SDK and XUL Comparison - Archive of obsolete content
advantages of the sdk simplicity the sdk provides high-level javascript apis to simplify many common tasks in add-on development, and tool support which greatly simplifies the process of developing, testing, and packaging an add-on. compatibility
although we can't promise we'll never break a high-level api, maintaining compatibility across firefox versions is a top priority for us. we've designed the apis to be forward-compatible with the new multiple process architecture (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. security if they're not carefu...
... with the new multiple process architecture (codenamed electrolysis) planned for firefox. we also expect to support both desktop and mobile firefox using a single edition of the sdk: so you'll be able to write one extension and have it work on both products. security if they're not carefully designed, firefox add-ons can open the browser to attack by malicious web pages. ...
... security if they're not carefully designed, firefox add-ons can open the browser to attack by malicious web pages.
although it's possible to write insecure add-ons using the sdk, it's not as easy, and the damage that a compromised add-on can do is usually more limited. restartlessness add-ons built with the sdk can be installed without having to restart firefox.
although you can write traditional add-ons that are restartless, you can't use xul overlays in them, so most traditional add-ons would have to be substantially rewritten anyway. user experience best practices the ui components available in the sdk are designed to align with the usability guidelines for firefox, giving your users a better, more consistent experience. ...
...firefox functionality via xpcom. the sdk's supported apis expose a relatively small set of this functionality. 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.
alternatively, you can load third-party modules, which extend the sdk's core apis. note that by doing this you lose some of the benefits of programming with the sdk including simplicity, compatibility, and to a lesser extent security. ...
CSS3 - Archive of obsolete content
of the contextual inter-glyph spacing via the css font-kerning property. the choice of language-specific glyphs via the css font-language-override property. the choice of glyphs with specific opentype features via the css font-feature-settings property. the control of the aspect ratio to use when fallback fonts are selected via the css font-size-adjust property. the choice of
alternative font faces using the css font-stretch, font-variant-
alternates, font-variant-caps, font-variant-east-asian, font-variant-ligatures, font-variant-numeric, and font-variant-position properties. it also extends the related css font-variant shorthand property and introduces the @font-feature-values at-rule. the control of the automatic generation of an oblique or bold face when none are ...
... css counter styles level 3 candidate recommendation testing modules css images module level 3 candidate recommendation defines the <image> data type. extends the url() syntax to support image slices using media fragments. adds: the dppx unit to the <resolution> data type. the image() function as a more flexible
alternative to url() to define an image from an url. at risk: due to insufficient browser support, standardization of the image() function may be postponed to the next iteration of this module. support for linear-gradient(), repeating-linear-gradient(), radial-gradient() and repeating-radial-gradient(). the ability to define how a replaced element should fit in its element, using the ...
...rking draft css easing functions level 1 working draft css logical properties and values level 1 editor's draft modules in the revising phase modules that are in the revising phase are much less stable than those in the refining phase. often the syntax is still under scrutiny and may evolve a lot, in a non-compatible way.
alternative syntaxes are tested and often implemented. css paged media module level 3 working draft css object model (cssom) view module working draft css intrinsic & extrinsic sizing module level 3 working draft css ruby layout module level 1 working draft css overflow module...
...() and repeating-conic-gradient() functional notation describing a new type of gradient. the image-rendering property that allow to define how resize of the object should be handled. modules in the rewriting phase modules that are in the rewriting phase are outdated and require to be rewritten. the syntax is still under scrutiny and may evolve a lot, in a non-compatible way.
alternative syntaxes are tested and often implemented. css generated content module level 3 working draft abandoned modules non-element selectors module level 1 working draft ...
The Joy of XUL - Archive of obsolete content
ation developers and their managers to xul so they can not only understand why mozilla's platform is based on it, but how they might adopt it for their own use. xul (pronounced "zool") is mozilla's xml-based user interface language that lets you build feature rich cross-platform applications that can run connected to or disconnected from the internet. these applications are easily customized with
alternative text, graphics, and layout so they can be readily branded or localized for various markets. web developers already familiar with dynamic html (dhtml) will learn xul quickly and can start building applications right away. also described are some reasons application developers might choose to leverage xul and mozilla technology for building cross-platform applications. this same investigat...
...e often satisfied by different people. xul provides a clear separation among the client application definition and programmatic logic ("content" consisting of xul, xbl, and javascript), presentation ("skin" consisting of css and images), and language-specific text labels ("locale" consisting of dtds and string bundles in .properties files). the layout and appearance of xul applications can be
altered independently of the application definition and logic. further, the application can be localized for different languages and regions independently of its logic or presentation. this degree of separation results in applications that are easier to maintain by programmers and readily customized by designers and language translators. the work flow of these interdependent activities is more e...
...ecial features for customers with a completely independent code base. this leads to an overall solution that is easier and less costly to maintain in the long run. there is an additional benefit to overlays for software developers who intend to add features to mozilla that they wish to keep proprietary. the netscape public license (npl) and mozilla public license (mpl) require developers who
alter original work (source code files that are provided with mozilla) to release the source code for these changes to their customers. overlays can be used to add features to mozilla without contaminating the original open source code with proprietary
alterations. xpcom/xpconnect xpcom and xpconnect are complementary technologies that enable the integration of external libraries with...
...latforms is trivial.the calendar originated as a linux application with no consideration given to porting it to other platforms. but later, when the original developer (oeone corporation) contributed the source to the mozilla project, the calendar had to be migrated to the windows and macintosh platforms. the ui for the xul application required zero porting effort because it worked with almost no
alteration on both new platforms. similarly, since the ui code is written in javascript, the interaction logic worked with no effort. however, since the libical library is written in c, more significant effort was required to migrate this component to the other platforms. fortunately, an implementation of the libical library was already available for macintosh so, with the cross platform nature of x...
Templates - Archive of obsolete content
method in which we create elements from data supplied by rdf, either from an rdf file or from an internal datasource. numerous datasources are provided with mozilla such as bookmarks, history and mail messages. more details on these will be provided in the later section. usually, elements such as treeitems and menuitems will be populated with data. however, you can use other elements if you want
although they are more useful for specialized cases. nevertheless, we'll start with these other elements because trees and menus require more code. to allow the creation of elements based on rdf data, you need to provide a simple template which will be duplicated for each element that is created. essentially, you provide only the first element and the remaining elements are constructed based on the ...
...cates where in the datasource you would like to retrieve data from. in the case of the bookmarks, the value nc:bookmarksroot is used to indicate the root of the bookmarks hierarchy. other values that you can use will depend on the datasource you are using. if you are using your own rdf file as a datasource, the value will usually correspond to the value of an about attribute on an rdf bag, seq or
alt element. inside the template by adding these two attributes to the box above, it allows the generation of elements using the template. however, the elements inside the template need to be declared differently. you may notice in the example above that the button has a uri attribute and an unusual value for the label attribute. an attribute value inside the template that begins with 'rdf:' indic...
...dicates that the element is expected to be built from a template. note that it isn't the template tag that determines whether content is built, it is the datasources attribute. when this attribute is present, an object called a builder is added to the element which is responsible for building the content from the template. in javascript you can access the builder object with the builder property,
although usually you would only need to do this to have the builder regenerate the content in situations where it is not done automatically. there are two different types of builders. the first is a content builder and is used in most situations, and the other is a tree builder which is used only for trees. content builder the content builder takes the content inside the template element and dupli...
... inside the template element and duplicates it for each row. for instance, if the user had ten bookmarks in the example above, ten label elements would be created and added as children of the vbox element. if you were to use dom functions to traverse the tree, you will find these elements there and can query their properties. these elements get displayed, but the template itself is not displayed,
although it still exists in the document tree. in addition, the id of each of the labels will be set to the rdf resource for that row. the content builder always starts at the place where uri="rdf:*" is specfied. if the uri attribute is placed on an element lower in the element tree, the elements outside are only created once. in the example below, one hbox will be created and it will be filled with...
Introduction to SSL - Archive of obsolete content
ent and a server to be encrypted by the sending software and decrypted by the receiving software, thus providing a high degree of confidentiality. confidentiality is important for both parties to any private transaction. in addition, all data sent over an encrypted ssl connection is protected with a mechanism for detecting tampering-that is, for automatically determining whether the data has been
altered in transit. the ssl protocol includes two sub-protocols: the ssl record protocol and the ssl handshake protocol. the ssl record protocol defines the format used to transmit data. the ssl handshake protocol involves using the ssl record protocol to exchange a series of messages between an ssl-enabled server and an ssl-enabled client when they first establish an ssl connection. this exchange ...
...ndshake", the server sends the client a certificate to authenticate itself. the client uses the certificate in step 3 to authenticate the identity the certificate claims to represent. to authenticate the binding between a public key and the server identified by the certificate that contains the public key, an ssl-enabled client must receive a "yes" answer to the four questions shown in figure 2. ...
...m that ca and proceeds. at this point, the client has determined that the server certificate is valid. it is the client's responsibility to take step 4 before step 5. does the domain name in the server's certificate match the domain name of the server itself? this step confirms that the server is actually located at the same network address specified by the domain name in the server certificate.
although step 4 is not technically part of the ssl protocol, it provides the only protection against a form of security attack known as "man in the middle." clients must perform this step and must refuse to authenticate the server or establish a connection if the domain names don't match. if the server's actual domain name matches the domain name in the server certificate, the client goes on to step ...
...nt and server. the hash of the data is then encrypted with the private key that corresponds to the public key in the certificate being presented to the server. to authenticate the binding between the public key and the person or other entity identified by the certificate that contains the public key, an ssl-enabled server must receive a "yes" answer to the first four questions shown in figure 3.
although the fifth question is not part of the ssl protocol, red hat servers can be configured to support this requirement to take advantage of the user's entry in an ldap directory as part of the authentication process. an ssl-enabled server goes through these steps to authenticate a user's identity: does the user's public key validate the user's digital signature? the server checks that the u...
Responsive design - Learn web development
xt in the early days of web design, pages were built to target a particular screen size. if the user had a larger or smaller screen than the designer expected, results ranged from unwanted scrollbars to overly long line lengths, and poor use of space. 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. it is an idea that changed the way we design for a multi-device web, and in this article, we'll help you understand the main techniques you need to know to master it. prerequisites: html basics (study introduction to html), and an idea of how css works (study css first steps and css building blocks.) ...
... it, but not grow larger and become pixellated if the column becomes wider than the image. the third key component was the media query. media queries enable the type of layout switch that cameron adams had previously explored using javascript, using only css. rather than having one layout for all screen sizes, the layout could be changed. sidebars could be repositioned for the smaller screen, or
alternate navigation could be displayed. it is important to understand that responsive web design isn't a separate technology — it is a term used to describe an approach to web design or a set of best practices, used to create a layout that can respond to the device being used to view the content. in marcotte's original exploration this meant flexible grids (using floats) and media queries, howev...
... be downloading an image several times the size of what they actually see in the browser window. in addition, you may not want the same image aspect ratio on mobile as on desktop. for example, it might be nice to have a square image for mobile, but show the same scene as a landscape image on desktop. or, acknowledging the smaller size of an image on mobile you might want to show a different image
altogether, one which is more easily understood at a small screen size. these things can't be achieved by simply scaling down an image. responsive images, using the <picture> element and the <img> srcset and sizes attributes solve both of these problems. you can provide multiple sizes along with "hints" (meta data that describes the screen size and resolution the image is best suited for), and the b...
... the layout goes to the two column version. on mobile the heading is smaller: on desktop, however, we see the larger heading size: note: see this example in action: example, source code. as this approach to typography shows, you do not need to restrict media queries to only changing the layout of the page. they can be used to tweak any element to make it more usable or attractive at
alternate screen sizes. using viewport units for responsive typography an interesting approach is to use the viewport unit vw to enable responsive typography. 1vw is equal to one percent of the viewport width, meaning that if you set your font size using vw, it will always relate to the size of the viewport. h1 { font-size: 6vw; } the problem with doing the above is that the user loses the abil...
What is CSS? - Learn web development
{ color: black; } you will find that you quickly learn some values, whereas others you will need to look up. the individual property pages on mdn give you a quick way to look up properties and their values when you forget, or want to know what else you can use as a value. note: you can find links to all the css property pages (along with other css features) listed on the mdn css reference.
alternatively, you should get used to searching for "mdn css-feature-name" in your favourite search engine whenever you need to find out more information about a css feature. for example, try searching for "mdn color" and "mdn font-size"! css modules as there are so many things that you could style using css, the language is broken down into modules. you'll see reference to these modules as you ex...
...droid full support 1.0system-uichrome full support 56edge full support 79firefox no support no no support no full support 43notes
alternate name notes supported on macos only.
alternate name uses the non-standard name: -apple-systemie no support noopera full support 43safari full support 9notes
alternate name full support 9notes
alternate name notes s...
... on macos only.
alternate name uses the non-standard name: -apple-systemie no support noopera full support 43safari full support 9notes
alternate name full support 9notes
alternate name notes supported since macos 10.11.
alternate name uses the non-standard name: -apple-systemwebview android full support 56chrome android full support 56firefox android no support noopera android full support 43safari ios full support ...
...on-standard name: -apple-systemwebview android full support 56chrome android full support 56firefox android no support noopera android full support 43safari ios full support 9
alternate name full support 9
alternate name
alternate name uses the non-standard name: -apple-systemsamsung internet android full support 6.0legend full support full support no support ...
How can we design for all types of users? - Learn web development
tra easy to read the text, to help visually-impaired people and people using their phones on the street. the w3c defines a good color mix with an algorithm that calculates luminosity ratio between foreground and background. the calculation may seem pretty complicated, but we can rely on tools to do the job for us. let's download and install the paciello group's colour contrast analyser. note:
alternatively you can find a number of contrast checkers online, such as webaim's color contrast checker. we suggest a local checker because it comes packaged with an on-screen color picker to find out a color value. for instance, let's test the colors on this page and see how we fare in the colour contrast analyser: the luminosity contrast ratio between text and background is 8.30:1, which exce...
...with class container. we can style the div either to set its width (using the width property) or its maximum width so that it never gets too large (using the max-width property). 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. images images can be either decorative or informative, but there's no guarantee that your users can see them. for example, visually impaired users rely on a screen reader, which can only handle text. your readers may be using a very strict intranet that blocks images originating from a cdn. your ...
...which can only handle text. your readers may be using a very strict intranet that blocks images originating from a cdn. your readers may have disabled images to save bandwidth, especially on mobile devices (see below). decorative images they're just for decoration and don't convey any real information. they could most often be replaced by a background image. make sure they feature an empty
alt attribute: <img src="deco.gif"
alt=""> so they don't clog up the text. informative images they are used to convey information, hence their name. they can, for instance, feature a graph, or show a person's gesture, or any other information. at minimum, you must provide a relevant
alt attribute. if the image can be described succinctly, you can provide an
alt attribute and nothing more. if the ...
... same data), or resort to a longdesc attribute. this attribute's value is a url pointing towards a resource explicitly describing in detail the image's content. note: the use and even the existence of longdesc has been debated for quite some time. please refer to the w3c's image description extension (longdesc) for the full explanation and thorough examples. audio/video you must also provide
alternatives to multimedia content. subtitling/close-captioning you should include captions in your video to cater to visitors who can't hear the audio. some users have hearing challenges, lack functioning speakers, or work in a noisy environment (like on the train). transcript subtitles only work if somebody watches the video. many users don't have time, or lack the proper plugin or codec. add...
How to build custom form controls - Learn web development
x design. 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). this is achieved with
alt + down on windows. we didn't implement this in our example, but it would be easy to do so, as the mechanism has already been implemented for the click event. defining the html structure and (some) semantics now that the control's basic functionality has been decided upon, it's time to start building it. the first step is to define its html structure and to give it some basic semantics. here i...
... check out the final source code if you want to move forward, the code in this example needs some improvement before it becomes generic and reusable. this is an exercise you can try to perform. two hints to help you in this: the first argument for all our functions is the same, which means those functions need the same context. building an object to share that context would be wise. an
alternative approach: using radio buttons in the above example, we reinvented a <select> element using non-semantic html, css, and javascript. this select was selecting one option from a limited number of options, which is the same functionality of a same-named group of radio buttons. we could therefore reinvent this using radio buttons instead; let's look at this option. we can start with a compl...
...er is on the last button takes them to the first button; it doesn't stop at the top and bottom of the option list like a <select> does. we'll leave adding this missing functionality as a reader exercise. conclusion we have seen all the basics of building a custom form control, but as you can see it's not trivial to do. before creating your own customized control, consider whether html provides
alternative elements that can be used to adequately support your requirements. if you do need to create a custom control, it is often easier to rely on third-party libraries instead of building your own. but, if you do create your own, modify existing elements, or use a framework to implement a pre-baked control, remember that creating a usable and accessible form control is more complicated than it ...
...stead of building your own. but, if you do create your own, modify existing elements, or use a framework to implement a pre-baked control, remember that creating a usable and accessible form control is more complicated than it looks. here are a few libraries you should consider before coding your own: jquery ui axe accessible custom select dropdowns msdropdown nice forms if you do create
alternative controls via radio buttons, your own javascript, or with a 3rd party library, ensure it is accessible and feature-proof; that is, it needs to be able to work better with a variety of browsers whose compatibility with the web standards they use vary. have fun! ...
Document and website structure - Learn web development
all rights reversed.</p> </footer> </body> </html> take some time...
...better semantic block element to use, or don't want to add any specific meaning. for example, imagine a shopping cart widget that you could choose to pull up at any point during your time on an e-commerce site: <div class="shopping-cart"> <h2>shopping cart</h2> <ul> <li> <p><a href=""><strong>silver earrings</strong></a>: $99.95.</p> <img src="../products/3333-0985/thumb.png"
alt="silver earrings"> </li> <li> ... </li> </ul> <p>total cost: $237.89</p> </div> this isn't really an <aside>, as it doesn't necessarily relate to the main content of the page (you want it viewable from anywhere). it doesn't even particularly warrant using a <section>, as it isn't part of the main content of the page. so a <div> is fine in this case. we've included a headin...
...tic change in the text (such as a change in topic or scene). visually it just looks like a horizontal line. as an example: <p>ron was backed into a corner by the marauding netherbeasts. scared, but determined to protect his friends, he raised his wand and prepared to do battle, hoping that his distress call had made it through.</p> <hr> <p>meanwhile, harry was sitting at home, staring at his roy
alty statement and pondering when the next spin off series would come out, when an enchanted distress letter flew through his window and landed in his lap. he read it hazily and sighed; "better get back to work then", he mused.</p> would render like this: planning a simple website once you've planned out the structure of a simple webpage, the next logical step is to try to work out what content...
... live together on different pages. this is very similar to a technique called card sorting. now try to sketch a rough sitemap — have a bubble for each page on your site, and draw lines to show the typical workflow between pages. the homepage will probably be in the center, and link to most if not all of the others; most of the pages in a small site should be available from the main navigation,
although there are exceptions. you might also want to include notes about how things might be presented. active learning: create your own sitemap try carrying out the above exercise for a website of your own creation. what would you like to make a site about? note: save your work somewhere; you might need it later on. test your skills! you've reached the end of this article, but can you remem...
Drawing graphics - Learn web development
canvas. <canvas width="320" height="240"> <p>your browser doesn't support canvas. boo hoo!</p> </canvas> of course, the above message is really unhelpful! in a real example you'd want to relate the fallback content to the canvas content. for example, if you were rendering a constantly updating graph of stock prices, the fallback content could be a static image of the latest stock graph, with
alt text saying what the prices are in text. creating and sizing our canvas let's start by creating our own canvas that we draw future experiments on to. first make a local copy of our 0_canvas_start.html file, and open it in your text editor. add the following code into it, just below the opening <body> tag: <canvas class="mycanvas"> <p>add suitable fallback here.</p> </canvas> ...
...anvas, because once it's drawn, it's part of the canvas, and is not an individual accessible element or object. instead, you have to erase and redraw, either by erasing the entire frame and redrawing everything, or by having code that knows exactly what parts need to be erased and only erases and redraws the minimum area of the canvas necessary. optimizing animation of graphics is an entire speci
alty of programming, with lots of clever techniques available. those are beyond what we need for our example, though! in general, the process of doing a canvas animation involves the following steps: clear the canvas contents (e.g. with fillrect() or clearrect()). save state (if necessary) using save() — this is needed when you want to save settings you've updated on the canvas before continui...
...ut out of the source image, with the x value as sprite multiplied by 102 (where sprite is the sprite number between 0 and 5) and the y value always 0. parameters 4 and 5 specify the size of the slice to cut out — 102 pixels by 148 pixels. parameters 6 and 7 specify the top-left corner of the box into which to draw the slice on the canvas — the x position is 0 + posx, meaning that we can
alter the drawing position by
altering the posx value. parameters 8 and 9 specify the size of the image on the canvas. we just want to keep its original size, so we specify 102 and 148 as the width and height. now we'll
alter the sprite value after each draw — well, after some of them anyway. add the following block to the bottom of the draw() function: if (posx % 13 === 0) { i...
...re, shading: three.flatshading } ); cube = new three.mesh(geometry, material); scene.add(cube); draw(); }); there's a bit more to take in here, so let's go through it in stages: we first create a cube global variable so we can access our cube from anywhere in the code. next, we create a new textureloader object, then call load() on it. load() takes two parameters in this case (
although it can take more): the texture we want to load (our png), and a function that will run when the texture has loaded. inside this function we use properties of the texture object to specify that we want a 2 x 2 repeat of the image wrapped around all sides of the cube. next, we create a new boxgeometry object and a new meshlambertmaterial object, and bring them together in a mesh to create o...
Command line crash course - Learn web development
a command line and a terminal? generally you'll find these two terms used interchangeably. technically, a terminal is software that starts and connects to a shell. a shell is your session and session environment (where things like the prompt and shortcuts might be customised). the command line is the literal line where you enter commands and the cursor blinks. do you have to use the terminal?
although there's a great we
alth of tools available from the command line, if you're using tools like visual studio code there's also a mass of extensions that can be used as a proxy to using terminal commands without needing to use the terminal directly. however, you won’t find a code editor extension for everything you want to do — you’ll have to get some experience with the terminal eventuall...
...for that, we'll add awk to the mix (which is a programming language akin to javascript or ruby or python, just a lot older!). try running this: curl /docs/web/api/fetch -l -i | grep location | awk '{ print...
...plementary npm-centric tool called npx), which offers a gateway to installing additional command line tools. node.js and npm work the same across all systems: macos, windows, and linux. install npm on your system now, by going to the url above and downloading an running a node.js installer appropriate to your operating system. if prompted, make sure to include npm as part of the installation.
although we'll look at a number of different tools in the next article onwards, we'll cut our teeth on prettier. prettier is an opinionated code formatter that has "few options". fewer options tends to mean simpler. given how tooling can sometimes get out of hand in terms of complexity, "few options" can be very appealing. where to install our cli tools? before we dive into installing prettier, the...
...on't have access to these tools, for example if you are sharing the codebase over a tool like git. uses less disk space related to the previous point, it makes project code harder to replicate (if you install your tools locally, they can be set up as dependencies and installed with npm install). always the same version feels like any other unix command
although the cons list is shorter, the negative impact of global installing is potentially much larger than the benefits. however, for now we'll err on the side of simplicity and install globally to keep things simple. we'll look more at local installs and why they're good in the next article. installing prettier for this article we will install prettier as a global command line utility. prettier ...
Accessibility Features in Firefox
s 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. the f7 key toggles this feature on/off. tabbed browsing helps keyboard users by putting all of the browsed documents in one firefox application window rather than cluttering the
alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. a "smart keywords" feature enhances this even further by allowing cust...
... up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the search tool's web site. custom searches can be added to this quick search bar and the user can switch between them by choosing from a drop down available via the standard
alt+down arrow key combination. the built-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. the find bar allows for quick navigation to links and text searching without opening a separate dialog -- this allows more convenient use by screen magnification user...
...right-click contextual menus, change the status bar text, etc. you can furthermore control javascript capabilities to remove scrollbars, toolbars or system buttons like minimize, close and maximize by editing the about:config related properties or by editing accordingly the user.js file as explained in this "disable other javascript window features" document. moving back and forward by web page (
alt+left and
alt+right) occurs near-instantaneously the download manager provides keyboard access to all of your recent downloads operating system "look and feel" support: mozilla's default skin will match the colors and sizes currently being used in your desktop. mozilla can follow the system appearance whether it's high or low contrast, with large or small fonts. text files used in configuration...
...ng accessibility problems in some web sites. customize your experience! many users are finding the true greatness of firefox lies in support for third party extensions. extensions are small add-ons which can change your browser experience as you see fit. extensions can easily be installed or removed with the extension manager in the tools menu. here are some examples of accessible extensions,
although there are hundreds more to try (thank you to the gw micro knowledge base for some of this information): adblock plus removes ads (and other objects, like banners) from web pages greasemonkey lets you add bits of javascript ("user scripts") to any web page to change its behavior. in much the same way that user css lets you take control of a web page's style, user scripts let you easily co...
CSUN Firefox Materials
links to get there. 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. the f7 key toggles this feature on/off. tabbed browsing helps keyboard users by putting all of the browsed documents in one firefox application window rather than cluttering the
alt+tab order which makes keyboard navigation within the entire windows os much simpler. both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. a "smart keywords" feature enhances this even further by allowing cu...
...up the word "punditry" in an online dictionary. these smart keywords can be setup via the context menu for the search field on the desired website. integrated web search via ctrl+k is much faster to use than first going to the search tool's web site. custom searches can be added to this quick search bar and the user can switch between them by choosing from a drop down available via the standard
alt+down arrow key combination. the built-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. caret browsing allows you to move through web content one letter a time. you can even select web content and copy it to the clipboard. -- all with the keyboard m...
...uilt-in text zoom feature can be accessed with the ctrl+plus and ctrl+minus hotkeys. the accessibility extension may be installed on top of firefox, allowing keyboard access to document structure. caret browsing allows you to move through web content one letter a time. you can even select web content and copy it to the clipboard. -- all with the keyboard moving back and forward by web page (
alt+left and
alt+right) occurs near-instantaneously the download manager provides keyboard access to all of your recent downloads customize your experience! many users are finding the true greatness of firefox lies in support for third party extensions. extensions are small add-ons which can change your browser experience as you see fit. extensions can easily be installed or removed with the exten...
...keyboard access to all of your recent downloads customize your experience! many users are finding the true greatness of firefox lies in support for third party extensions. extensions are small add-ons which can change your browser experience as you see fit. extensions can easily be installed or removed with the extension manager in the tools menu. here are some examples of accessible extensions,
although there are hundreds more to try (thank you to the gw micro knowledge base for some of this information): adblock plus removes ads (and other objects, like banners) from web pages greasemonkey lets you add bits of javascript ("user scripts") to any web page to change its behavior. in much the same way that user css lets you take control of a web page's style, user scripts let you easily c...
Theme concepts
themes developed using the webextensions api in firefox enable you to change the look of the browser by adding images to the header area of the firefox browser; this is the area behind the menu bar, toolbars, address bar, search bar, and tab strip. these theme options can be implemented as static themes (
although the theme images themselves may be animated) or as dynamic themes created in a browser extension. if you have a lightweight theme it will be converted to this new theme format automatically before lightweight themes are deprecated. you do not need to port your theme. however, please feel free to update your themes to use any of the new features described here. static themes static themes are specified using the same resources as a browser extension: a manifest.json file to def...
...tter approach is to use a narrower image with a transparent left edge so that it fades to the background color. for example, we could use this image combined with a complementary background color, to create this effect in the header see details about this theme in the themes example weta_fade. obviously, you can still provide a single wide image if you prefer. multiple image themes as an
alternative to creating a single image theme, you have the option to use multiple images. these images can be individually anchored to locations within the header, with the option to apply tiling to each image. depending on the effect you want to create you may need to suppress the mandatory "theme_frame": image with an empty or transparent image. you would use an empty or transparent image if, for ...
...: "empty.png", "additional_backgrounds": [ "weta_for_tiling.png"] }, and the images tiling with: "properties": { "additional_backgrounds_alignment": [ "top" ], "additional_backgrounds_tiling": [ "repeat" ] }, full details of how to setup this theme can be found in the themes example weta_tiled. full detais of the alignment and tiling options can be found in the "theme" key description. ...
... using the theme generator for self-hosted static themes, a new version can be updated through amo by following the above steps or be handled by you through an updateurl or external application updates. a new version will need to be signed through the developer hub. if you are uploading a packaged file, the version number must be higher than the current version number dynamic themes as an
alternative to defining a static theme, you can use the theme api to control the theme used in firefox from within a browser extension. there are a couple of use cases for this option: to bundle a theme with a browser extension, as an added extra. create a dynamic theme that changes under programmatic control. and, obviously, you can combine the two and bundle a programmatically controlled them...
Eclipse CDT
introduction eclipse cdt (c/c++ development tools) is an open-source ide for c and c++ development with advanced code assistance (inheritance/call graph explorer, jump to definition, refactoring, autocomplete, syntax highlighting, and so on). system requirements eclipse will use a lot of memory to fully index the mozilla source tree to provide code assistance features (easily 4 gb of ram,
although this will drop to just over 1 gb if you restart after indexing is complete). therefore, it is not recommended for use if your machine only has 4 gb of ram. installing eclipse regarding llvm4eclipsecdt, do not install or select this toolchain for mozilla development. this plugin is intended mainly for managed projects but we use an unmanaged project for mozilla (since it has its own build ...
...h more frequently since the source changes more frequently. in principle, you can set the index to rebuild automatically by opening the workspace preferences, selecting "c/c++ > indexer", and reenabling "automatically update the index". however, you may find this too disruptive, since re-indexing will then happen very frequently and code assistance can be broken while the index is rebuilding. the
alternative is to leave that option disabled and update the index manually as necessary. to update the index manually, use the context menu in the project explorer tab on the left side of the window. to rebuild for changes in an individual directory (for example, to take account of some changes that you yourself made) select "index > freshen all files" on that directory. to rebuild the entire index (...
...t to work you also either need to find the existing bindings for that key combination (using the bindings column to sort by key combination helps with this) and remove them, or else you need to make your binding very specific by setting the "when" field to "c/c++ editor" instead of the more general "editing text". opening files you can quickly open a file by name using cmd-shift-r/ctrl-shift-r.
although eclipse doesn't do fuzzy matching when you type a file name, it does allow you to use wildcards. to quickly switch between a source file and its header file, use ctrl-tab. to quickly switch to a recently viewed document use cmd-f6/ctrl-f6. if you want to change this awkward key binding, the command you need to rebind is "next editor". to show a filterable list of open documents (similar t...
... the caller in nsobjectframe.cpp because that caller is wrapped in "#ifndef xp_macosx". just something to keep in mind. ;-) to jump to the definition of a symbol (or the declaration of a symbol if already at the definition), hover over the symbol, hold down the ctrl/cmd key, move the mouse slightly to linkify the symbol, then click on it. (having to move the mouse slightly is eclipse bug 26873).
alternately, you can jump to the definition of the symbol under the cursor by pressing f3. to do a c++ symbol search select "search > c/c++" from the menubar, or use ctrl-h and select the "c/c++" search tab. to quickly find the definition of an enum, class, method, etc. use ctrl-shift-t/cmd-shift-t. to get a list of autocomplete options in an editor tab, start typing the name of an identifier and ...
Obsolete Build Caveats and Tips
f mozillabuild (prior to 1.6), if you download version 7.1 of the windows 7 sdk (which is the current version available), your build will fail, often while building cairo with "ocidl.h" errors. in order to fix this issue, you need to use the latest version of mozillabuild. windows vista sdk obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this is the sdk that mozilla-1.9.1 (firefox 3.5) builds used to be built against. features that depend on this sdk include: windows vista parental controls file associations and application registration on vista and above ability to display the uac shield icon in the...
...dows xp service pack 2 and .net framework 2.0 installed before installing the vista sdk. use visual studio 2008 professional. gecko 1.9.2 through 11: if you would like to use this sdk, add ac_add_options --with-windows-version=600 to your .mozconfig. windows server 2003 r2 platform sdk obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this is your only option if you're on windows 2000. this also used to be necessary for building a default gecko 1.9.2 through 8 with visual c++ express editions (see atlbase.h for more). you can download the sdk from the microsoft download center. you need to install ...
...s available free from microsoft. visual c++ 10 is available from microsoft as part of the free visual c++ 2010 express edition. visual c++ 9 is available from microsoft as part of the free visual c++ 2008 express edition with sp1 (make sure you get this and not the one without sp1!). you do not need to install the silverlight runtime or the sql server 2008 express edition when offered.
alternatively you can install the command-line compiler as part of the windows 7 sdk, but you are then expected to use the included windbg debugger. the visual c++ 8 command-line compiler is included with the vista sdk, but you are then expected to use the included windbg debugger. from configuring build options [en-us] note: starting with gecko 5.0, building firefox has become extremely simpl...
..., using a comma-separated list, such as "mk_add_options moz_co_project=browser,mail,calendar,suite,xulrunner". this setting is ignored by most mozilla project branches, which now use mercurial instead of cvs for source control. note: starting in gecko 2.0, objdir builds are enabled by default. if you do not specify a moz_objdir it will be automatically set to @topsrcdir@/obj-@config_guess@
alternatively, you can run client.mk directly from your objdir, using make -f <path_to_srcdir>/client.mk. note: starting in gecko 5.0, if you don't specify an application, --enable-application=browser is assumed, thereby building firefox. ...
Storage access policy: Block cookies from trackers
this policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. this article explains how the policy works and how you can test it. testing in firefox this cookie policy has been available in firefox since version 63. ...
...htly. the cookie policy can be enabled in other versions of firefox through the content blocking settings (these steps will vary by version; the linked documentation includes a dropdown to select the appropriate firefox version). report broken sites if you find a website broken as a result of this change, file a bug under the tracking protection component within the firefox product on bugzilla.
alternatively you can report broken sites directly in firefox by clicking "report a problem" in the content blocking section of the control center (this shortcut may not be available in all versions of firefox). tracking protection explained how does firefox determine which resources are tracking resources? firefox uses the tracking protection list to determine which resources are tracking resourc...
...s to create a new broadcastchannel will throw a securityerror exception. shared worker: attempts to create a new sharedworker will throw a securityerror exception. service worker: attempts to create a new serviceworker will throw a securityerror exception. dom cache: calls to cachestorage will always reject with a securityerror. browser caches: the http cache, the image cache, and the
alternative services (
alt-svc) cache are all partitioned for tracking resources, such that each top-level origin will have a separate partition and tracking resources on different top-level origins will be cached separate from each other. network connections: tls sessions will not be resumed using a session ticket when an https connection is made to an embedded third-party resource that is class...
...ibility heuristics that grant storage access to third-party resources classified as trackers when a user interacts with those third parties. we do this when we expect that not granting access would cause the web page to break. we also support an initial implementation of the storage access api, through which embedded <iframe>s can request storage access by calling document.requeststorageaccess().
although both of these approaches provide the same level of storage access, we recommend third parties switch to using the storage access api in order to guarantee their access to storage. automatic storage access upon interaction in order to improve web compatibility, firefox currently includes some heuristics to grant storage access automatically to third parties that receive user interaction. th...
Application Translation with Mercurial
ry once. mozillabuild must be installed into an absolute file path without whitespaces, else it will break. file comparison program for the translation, it is recommend to use file comparison program to compare the english file (containing the new texts) with the file of your locale (which is still missing the new strings). this example uses winmerge: download and install it. a comparison of
alternatives (e.g. for linux and mac os) is available on wikipedia. file and text editor for editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to compare it to the english one, or special functionality is required (e.g. bookmarking untranslated lines). use a text e...
...han a few strings, you usually want to keep track of what has already been translated (and later if the text has been tested in the product as fitting into the available area and suiting the functionality it describes). this guide achieves this with the firefox extension scrapbook. you installed scrapbook earlier, now open it in firefox either by calling it from the firefox menu bar (press the
alt key to show it if necessary) using "view" > "sidebar" > "scrapbook" or by clicking its toolbar button which you likely have to add by toolbar customization if you didn't do this before. drag the tab with the localization error showing missing and obsolete strings to the sidebar. after scrapbook has saved the web page to your local disk, click with the right mouse button on the page in the sideb...
...ime by calling hg qref again. now export the patch to the file system using the qexport command which is defined in the .hgrc file (see above): hg qexport > ../firefox-29-aboutprivatebrowsing-v1.patch this creates a patch file called firefox-29-aboutprivatebrowsing-v1.patch containing the changes in the parent directory of de-mozilla-aurora (in this example: c:\mozilla\). proof-reading and
altering the patch now proof-read the patch. this detects often more than 90 percent of the possible reasons for the reviewer to not accept the patch. if you find that changes have to be done, edit the real aboutprivatebrowsing.dtd file from the localization repository, save it and follow the steps from exporting the changes as patch (see above). validating the translation in the product this guid...
...leading the translation of the locale. this information can be found on the page of the localization team. submit the bug report. now you have to wait for the review of that person. this can happen on the same day, on the next weekend or later, but should happen in the timeframe given for the localization of aurora. if the person requests changes, follow the instructions under proof-reading and
altering the patch. if the reviewer accepts the changes, the patch will get uploaded and your translation will officially be added to firefox. ...
Localization and Plurals
the order in which the plural forms are listed is the same order you need to localize a word, separated by semi-colons. for example, english uses plural rule 1, and localizing plurals would require a string of "plural;plurals" where the first word is the singular form and the second is the general plural form. ...
..., 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, … plural rule #2 (2 forms) families: romanic (french, brazilian portuguese), lingala is 0 or 1: 0, 1 everything else: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, … plural rule #3 (3 forms) families: b
altic (latvian, latgalian) ends in 0: 0 ends in 1, excluding 11: 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, … everything else: 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49, 52, 53, … plural rule #4 (4 fo...
... 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, … everything else: 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, … plural rule #6 (3 forms) families: b
altic (lithuanian) ends in 1, excluding 11: 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, … ends in 0 or ends in 11-19: 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 211, 212, 213, 214, ...
...09, 210, … everything else but is 0 and ends in 00-02, excluding 0-2: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, … ends in 00-02, excluding 0-2: 100, 101, 102, 200, 201, 202, … is 0: 0 plural rule #13 (4 forms) families: semitic (m
altese) is 1: 1 is 0 or ends in 01-10, excluding 1: 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, … ends in 11-19: 11, 12, 13, 14, 15, 16, 17, 18, 19, 111, 112, 113, 114, 115, 116, 117, 118, 119, 211, 212, 213, 214, 215, 216, 217, 218, 219, … everything else: 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32...
Mozilla Style System Documentation
the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. ...
... the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. ...
... the css specification describes formatting objects that correspond to elements in the content model and formatting objects that correspond to pseudo-elements. ...
...propriate location in the rule tree or on the style context. problems: dynamic style changes often destroy too much data. css stylesheet backend css stylesheet loading [this section needs to be written. i'm reluctant to write it both since i don't know much about it.] problems:a bunch the code needs to be rewritten to prevent stylesheets from blocking the parser and to reduce string copying (
although that partly goes with parsing).] parsing stylesheet representation problems: the stylesheet representation uses way too much memory. other nsistylesheet implementations problems: some of the html style information is implemented in the content node classes. it should be consolidated so that the style system code can be moved back within the layout dll and nsistylecontext can be de-com-i...
Interval Timing
such parameters are common in nspr functions such as those used for i/o operations and operations on condition variables. nspr 2.0 provides interval times that are efficient in terms of performance and storage requirements. ...
...such parameters are common in nspr functions such as those used for i/o operations and operations on condition variables. nspr 2.0 provides interval times that are efficient in terms of performance and storage requirements. ...
...ing a time-of-day clock that gets reset due to some administrative action). the counters have no fixed epoch and have a finite period. to make use of these counters, the application must declare a point in time, the epoch, and an amount of time elapsed since that epoch, the interval. in almost all cases the epoch is defined as the value of the interval timer at the time it was sampled. ...
...orm-dependent intervals converting platform-dependent intervals to standard clock units getting the current interval and ticks per second pr_intervalnow pr_tickspersecond converting standard clock units to platform-dependent intervals pr_secondstointerval pr_millisecondstointerval pr_microsecondstointerval converting platform-dependent intervals to standard clock units pr_interv
altoseconds pr_interv
altomilliseconds pr_interv
altomicroseconds ...
sslfnc.html
or of pr_connect. if this option is off, then pr_connect configures the ssl socket to handshake as a client. if it is on, then pr_connect configures the ssl socket to handshake as a server, even though it connected as a tcp client. ssl_enable_fdx tells the ssl library whether the application will have two threads, one reading and one writing, or just one thread doing reads and writes
alternately. the factory setting for this option (which is the default, unless the application changes the default) is off (pr_false), which means that the application will not do simultaneous reads and writes. an application that wishes to do sumultaneous reads and writes should set this to pr_true. in nss 2.8, the ssl_enable_fdx option only affects the behavior of non-blocking ssl socke...
...d ssl_handshake_as_server with ssl_enabledefault and ssl_enable, see ssl_optionset. the ssl protocol is defined to be able to handle simultaneous two-way communication between applications at each end of an ssl connection. two-way simultaneous communication is also known as "full duplex", abbreviated fdx. however, most application protocols that use ssl are not two-way simultaneous, but two-way
alternate, also known as "half dupled"; that is, each end takes turns sending, and each end is either sending, or receiving, but not both at the same time. for an application to do full duplex, it would typically have two threads sharing the socket; one doing all the reading and the other doing all the writing. the ssl_enable_fdx option tells the ssl library whether the application will have tw...
...ch end is either sending, or receiving, but not both at the same time. for an application to do full duplex, it would typically have two threads sharing the socket; one doing all the reading and the other doing all the writing. the ssl_enable_fdx option tells the ssl library whether the application will have two threads, one reading and one writing, or just one thread doing reads and writes
alternately. ssl_v2_compatible_hello tells the ssl library whether or not to send ssl3 client hello messages in ssl2-compatible format. if an ssl3 client hello message is sent to a server that only understands ssl2 and not ssl3, then the server will interpret the ssl3 client hello as a very large message, and the connection will usually seem to "hang" while the ssl2 server expects more data that ...
... behavior of pr_connect. if this option is off, then pr_connect configures the ssl socket to handshake as a client. if it is on, then pr_connect configures the ssl socket to handshake as a server, even though it connected as a tcp client. ssl_enable_fdx tells the ssl library whether the application will have two threads, one reading and one writing, or just one thread doing reads and writes
alternately. the factory setting for this option (which is the default, unless the application changes the default) is off (pr_false), which means that the application will not do simultaneous reads and writes. an application that needs to do simultaneous reads and writes should set this to pr_true. in nss 2.8, the ssl_enable_fdx option only affects the behavior of nonblocking ssl sockets. ...
certutil
nd key database file. this option is provided as a special case. changing the names of the certificate and key databases is not recommended. -p phone specify a contact telephone number to include in new certificates or certificate requests. bracket this string with quotation marks if it contains spaces. -q pqgfile read an
alternate pqg value from the specified file when generating dsa key pairs. if this argument is not used, certutil generates its own pqg value. pqg files are created with a separate dsa utility. -q curve-name set the elliptic curve name to use when generating ecc key pairs. a complete list of ecc curves is given in the help (-h). -r ...
... with the -v argument. -x force the key and certificate database to open in read-write mode. this is used with the -u and -l command options. -x use certutil to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate ca. -y exp set an
alternate exponent value to use in generating a new rsa public key for the database, instead of the default value of 65537. the available
alternate values are 3 and 17. -z noise-file read a seed value from the specified file to generate a new private and public key pair. this argument makes it possible to use hardware-generated seed values o...
...le: o serverauth o clientauth o codesigning o emailprotection o timestamp o ocspresponder o stepup o critical x.509 certificate extensions are described in rfc 5280. ...
...amp o ocspresponder o stepup o critical x.509 certificate extensions are described in rfc 5280. -7 emailaddrs add a comma-separated list of email addresses to the subject
alternative name extension of a certificate or certificate request that is being created or added to the database. subject
alternative name extensions are described in section 4.2.1.7 of rfc 3280. -8 dns-names add a comma-separated list of dns names to the subject
alternative name extension of a certificate or certificate request that is being created or added to the database. subject
alternative name extensions are described in section 4.2.1.7 of rfc 3280. ...
A Web PKI x509 certificate primer
ions not described on rfc 5280, but that is out of the scope of this document. extensions can be marked as critical or non-critical, conforming certificate verification libraries should stop processing verification when encountering a critical extension that they do not understand ( and should continue processing if the extension is marked as non-critical) mozila::pkix has this behavior. subject
alternate name this extension defines what other names (such as dns names) are valid for this certificate. 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). it can also b...
...years. 2. generate csr using this command: openssl req -new -key key.pem -days 1096 -extensions v3_ca -batch -out example.csr -utf8 -subj '/cn=www.example.com' this creates a new certificate signing request (csr) that will be valid for 3 years. 3. write extensions file by creating a new file with name openssl.ss.cnf with the following contents: basicconstraints = ca:false subject
altname =dns:www.example.com extendedkeyusage =serverauth 4. self-sign csr (using sha256) and append the extensions described in the file "openssl x509 -req -sha256 -days 3650 -in example.csr -signkey key.pem -set_serial $any_integer -extfile openssl.ss.cnf -out example.pem" you can now use example.pem as your certfile cas included in firefox when you visit a secure website, firefox w...
...red secure for the next 4 years. generate csr "openssl req -new -key key.pem -days 1096 -extensions v3_ca -batch -out example.csr - utf8 -subj '/cn=www.example.com' make a new certificate signing request (csr) that will be valid for 3 years. ...
...ertificate is improperly formatted or the certificate has been tampered with re-issue the certificate with the bad signature sec_error_cert_bad_access_location the ocsp uri in the authorityinformationaccess extension is improperly formed re-generate the certificate with a well-formed ocsp uri sec_error_cert_not_in_name_space a certificate has a common name or subject
alternative name that is not in the namespace of an issuing certificate re-issue the certificate with names that are within the namespace of all certificates in the chain sec_error_cert_signature_algorithm_disabled a certificate has been signed with an obsolete algorithm re-sign the certificate using a modern algorithm sec_error_expired_certificate a certificate is too o...
nsIDBFolderInfo
on missing description getcharptrproperty() string getcharptrproperty( in string propertyname ); parameters propertyname missing description return value missing description exceptions thrown missing exception missing description native code only!getlocale obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getlocale( in nsstring result ); parameters result missing description exceptions thrown missing exception missing description native code only!getmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)...
... some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getlocale( in nsstring result ); parameters result missing description exceptions thrown missing exception missing description native code only!getmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getmailboxname( in nsstring boxname ); parameters boxname missing description exceptions thrown missing exception missing description getproperty() astring getproperty( in string propertyname ); parameters propertyname ...
... missing description sethighwater() void sethighwater( in nsmsgkey highwater, in boolean force ); parameters highwater missing description force missing description exceptions thrown missing exception missing description native code only!setlocale obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void setlocale( in nsstring locale ); parameters locale missing description exceptions thrown missing exception missing description native code only!setmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)...
... some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void setlocale( in nsstring locale ); parameters locale missing description exceptions thrown missing exception missing description native code only!setmailboxname obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void setmailboxname( in nsstring newboxname ); parameters newboxname missing description exceptions thrown missing exception missing description setproperty() void setproperty( in string propertyname, in astring propertystr ); parame...
nsIDOMEvent
get whose eventlisteners are currently being processed. this is particularly useful during capturing and bubbling. read only. defaultprevented boolean used to indicate whether preventdefault() has been called for this event. read only. eventphase unsigned short used to indicate which phase of event flow is currently being evaluated. read only. ...
...read only. ...
...iginal target of the event. if the event was retargeted for some reason other than an anonymous boundary crossing, this will be set to the target before the retargeting occurs. for example, mouse events are retargeted to their parent node when they happen over text nodes (bug 185889), and in that case .target will show the parent and .explicitorigin
altarget will show the text node. .explicitorigin
altarget differs from .origin
altarget in that it will never contain anonymous content. read only. istrusted boolean read only. origin
altarget nsidomeventtarget the original target of the event, before any retargetings. read only. target nsidomeventtarget used to indicate the eventtarget to which the event was originally dispatched. read only. t...
...load 0x00080000 unload 0x00100000 xfer_done 0x00200000 abort 0x00400000 error 0x00800000 locate 0x01000000 move 0x02000000 resize 0x04000000 forward 0x08000000 help 0x10000000 back 0x20000000 text 0x40000000
alt_mask 0x00000001 control_mask 0x00000002 shift_mask 0x00000004 meta_mask 0x00000008 methods violates the xpcom interface guidelines deserialize() boolean deserialize( in constipcmessageptr amsg, out voidptr aiter ); parameters amsg aiter return value native code only!duplicateprivatedata void duplicatep...
Page inspector keyboard shortcuts - Firefox Developer Tools
show/hide more information about current property (computed view o...
... show/hide more information about current property (computed view only, when a property is selected) enter or space return...
... show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter...
...ue by 10 shift + up arrow shift + up arrow shift + up arrow decrement selected value by 10 shift + down arrow shift + down arrow shift + down arrow increment selected value by 0.1
alt + up arrow (ctrl + up arrow from firefox 60 onwards.)
alt + up arrow
alt + up arrow (ctrl + up arrow from firefox 60 onwards.) decrement selected value by 0.1
alt + down arrow (ctrl + down arrow from firefox 60 onwards).
alt + down arrow
alt + down arrow (ctrl + down arrow from firefox 60 onwards). show/hide more information about current property (computed view only, when a property is selected) enter or space return or space enter or space open mdn reference page about current property (computed view only, when a property...
Document.readyState - Web APIs
// but sub-resources such as images, stylesheets and frames are still loading. var span = document.createelement("span"); span.textcontent = "a <span> element."; document.body.appendchild(span); break; case "complete": // the page is fully loaded. ...
...lesheets and frames are still loading. var span = document.createelement("span"); span.textcontent = "a <span> element."; document.body.appendchild(span); break; case "complete": // the page is fully loaded. ...
...e "complete": // the page is fully loaded. ...
...is fully loaded. ...
Document Object Model (DOM) - Web APIs
the dom represents a document with a logical tree. each branch of the tree ends in a node, and each node contains objects. dom methods allow programmatic access to the tree. with them, you can change the document's structure, style, or content. ...
...nced to become htmlelement and various subclasses, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. ...
...ment and various subclasses, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. ...
...es, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. ...
EffectTiming.fill - Web APIs
not applied to the element if the current time is outside the range of times during which the animation is running, while "forwards" ensures that once the animation's end time has been passed, the element will continue to be drawn in the state it was in at its last rendered frame. note that authors are discouraged from using fill modes to persist the effect of an animation indefinitely. see the
alternatives to fill modes section below for approaches that are simpler and more performant. element.animate(), and keyframeeffect() accept an object of timing properties including fill. the value of fill corresponds directly to fill in effecttiming objects returned by gettiming() in animationeffect and keyframeeffect. syntax var timingproperties = { fill: "none" | "forwards" | "backwards" | ...
...n should take to run, how many times it should run, what state the element should be in before the animation begins and after it ends, and so forth. here we specify that the animation should take 2000 milliseconds (2 seconds) to complete, should only run once, and that the fill mode should be "none". as defined above, the "none" fill mode means that the element will be rendered in its natural, un
altered condition anytime the animation isn't actively running. document.getelementbyid("animatebutton").addeventlistener("click", event => { document.getelementbyid("box").animate( boxrotationkeyframes, boxrotationtiming ); }, false); the rest of the code is pretty simple: it adds an event listener to the "animate" button so that when it's clicked by the user, the box is animated by ca...
...when used to persist the effect of an animation indefinitely, however, they have a number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified style indefi...
...s overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using fill modes to persist an animation, it is often simpler to set the final value of the animation effect directly in specified style: elem.animate({ transform: 'translatey(100px)' }, 200).finished.then(() => { elem.style.transform = 'translatey(100px)'; });
alternatively, it may be simpler still to set the final value in specified style before triggering the animation and then animate from the start value. this is the approach used in flip animation. elem.style.transform = 'translatey(100px)'; elem.animate({ transform: 'none', offset: 0 }, 200); for some complex effects where animations layer on top of one another, it may be necessary to use a fill m...
EventTarget.addEventListener() - Web APIs
efits are as follows: it allows adding more than a single handler for an event. this is particularly useful for ajax libraries, javascript modules, or any other kind of code that needs to work well with other libraries/extensions. it gives you finer-grained control of the phase when the listener is activated (capturing vs. bubbling). it works on any dom element, not just html elements. the
alternative, older way to register event listeners, is described below. adding a listener during event dispatch if an eventlistener is added to an eventtarget while it is processing an event, that event does not trigger the listener. however, that same listener may be triggered during a later stage of event flow, such as the bubbling phase. multiple identical event listeners if multiple identical...
...er is to make it accessible to the scope in which the event listener is declared. const mybutton = document.getelementbyid('my-button-id'); const somestring = 'data'; mybutton.addeventlistener('click', function() { console.log(somestring); // expected value: 'data' somestring = 'data again'; }); console.log(somestring); // expected value: 'data' (will never output 'data again') note:
although inner scopes have access to const, let variables from outer scopes, you cannot expect any changes to these variables to be accessible after the event listener definition, within the same outer scope. why? simply because by the time the event listener would execute, the scope in which it was defined would have already finished executing. getting data into and out of an event listener using ...
...html elements are resized. polyfill you can work around addeventlistener(), removeeventlistener(), event.preventdefault(), and event.stoppropagation() not being supported by internet explorer 8 by using the following code at the beginning of your script. the code supports the use of handleevent() and also the domcontentloaded event. note: usecapture is not supported, as ie 8 does not have any
alternative method. the following code only adds ie 8 support. this ie 8 polyfill only works in standards mode: a doctype declaration is required. (function() { if (!event.prototype.preventdefault) { event.prototype.preventdefault=function() { this.returnvalue=false; }; } if (!event.prototype.stoppropagation) { event.prototype.stoppropagation=function() { this.cancelbu...
...he default value of the passive option to true for the touchstart and touchmove events on the document-level nodes window, document, and document.body. this prevents the event listener from being called, so it can't block page rendering while the user is scrolling. note: see the compatibility table below if you need to know which browsers (and/or which versions of those browsers) implement this
altered behavior. you can override this behavior by explicitly setting the value of passive to false, as shown here: /* feature detection */ let passiveifsupported = false; try { window.addeventlistener("test", null, object.defineproperty( {}, "passive", { get: function() { passiveifsupported = { passive: false }; } } ) ); } catch(err) {} window.addeve...
FileSystemDirectoryEntry - Web APIs
ured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...//github.com/mdn/browser-compat-data and send us a pull request. ...
...n/browser-compat-data and send us a pull request. ...
... no support noopera full support yesprefixed full support yesprefixed prefixed implemented with the vendor prefix: webkitsafari full support 11.1webview android full support ≤37
alternate name full support ≤37
alternate name
alternate name uses the non-standard name: directoryentrychrome android full support 18
alternate name full support 18
alternate name
alternate name uses the non-standard name: directoryentryfirefox android ...
FileSystemEntry - Web APIs
om structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ut https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ub.com/mdn/browser-compat-data and send us a pull request. ...
...refixed prefixed implemented with the vendor prefix: webkitfirefox full support 50ie no support noopera no support nosafari full support 11.1webview android full support ≤37
alternate name full support ≤37
alternate name
alternate name uses the non-standard name: entrychrome android full support 18
alternate name full support 18
alternate name
alternate name uses the non-standard name: entryfirefox android full support ...
FileSystemFileEntry - Web APIs
erated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...e check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ps://github.com/mdn/browser-compat-data and send us a pull request. ...
...refixed prefixed implemented with the vendor prefix: webkitfirefox full support 50ie no support noopera no support nosafari full support 11.1webview android full support ≤37
alternate name full support ≤37
alternate name
alternate name uses the non-standard name: fileentrychrome android full support 18
alternate name full support 18
alternate name
alternate name uses the non-standard name: fileentryfirefox android full su...
HTMLImageElement - Web APIs
ructor image() the image() constructor creates and returns a new htmlimageelement object representing an html <img> element which is not attached to any dom tree. it accepts optional width and height parameters. when called without parameters, new image() is equivalent to calling document.createelement("img"). properties inherits properties from its parent, htmlelement. htmlimageelement.
alt a domstring that reflects the
alt html attribute, thus indicating the
alternate fallback content to be displayed if the image has not been loaded. htmlimageelement.complete read only returns a boolean that is true if the browser has finished fetching the image, whether successful or not. that means this value is also true if the image has no src value indicating an image to load. htmlimageel...
...d image is corrupted in some way that prevents it from being loaded. the specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the specified image is in a format not supported by the user agent. ...
... is corrupted in some way that prevents it from being loaded. the specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the specified image is in a format not supported by the user agent. ...
...e to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the specified image is in a format not supported by the user agent. example var img1 = new image(); // image constructor img1.src = 'image1.png'; img1.
alt = '
alt'; document.body.appendchild(img1); var img2 = document.createelement('img'); // use dom htmlimageelement img2.src = 'image2.jpg'; img2.
alt = '
alt text'; document.body.appendchild(img2); // using first image in the document alert(document.images[0].src); specifications specification status comment css object model (cssom) view modulethe definition of 'extensions to htmlimageelement' in that specification. working draft added the x and y properties. html living standardthe definition of 'html...
KeyboardEvent - Web APIs
he keyboard. the event type (keydown, keypress, or keyup) identifies what kind of keyboard activity occurred. 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. when you need to handle text input, use the input event instead. keyboard events may not be fired if the user is using an
alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. <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"><...
...stance, is on the left side of the keyboard. examples include the left control key, the left command key on a macintosh keyboard, or the left shift key. dom_key_location_right 0x02 the key is one which may exist in multiple positions on the keyboard and, in this case, is located on the right side of the keyboard. examples include the right shift key and the right
alt key (option on a mac keyboard). dom_key_location_numpad 0x03 the key is located on the numeric keypad, or is a virtual key associated with the numeric keypad if there's more than one place the key could originate from. the numlock key does not fall into this group and is always encoded with the location dom_key_location_standard. examples include the digits on the num...
...s more than one place the key could originate from. the numlock key does not fall into this group and is always encoded with the location dom_key_location_standard. examples include the digits on the numeric keypad, the keypad's enter key, and the decimal point on the keypad. properties this interface also inherits properties of its parents, uievent and event. keyboardevent.
altkey read only returns a boolean that is true if the
alt ( option or ⌥ on os x) key was active when the key event was generated. keyboardevent.code read only returns a domstring with the code value of the physical key represented by the event. warning: this ignores the user's keyboard layout, so that if the user presses the key at the "y" position in a qwerty keyboard layout (near the middl...
...s a boolean that is true if the key is being held down such that it is automatically repeating. keyboardevent.shiftkey read only returns a boolean that is true if the shift key was active when the key event was generated. methods this interface also inherits methods of its parents, uievent and event. keyboardevent.getmodifierstate() returns a boolean indicating if a modifier key such as
alt, shift, ctrl, or meta, was pressed when the event was created. obsolete methods keyboardevent.initkeyevent() initializes a keyboardevent object. this was implemented only by firefox, and is no longer supported even there; instead, you should use the keyboardevent() constructor. keyboardevent.initkeyboardevent() initializes a keyboardevent object. this is now deprecated. you should ins...
PannerNode - Web APIs
e default value is "inverse". pannernode.maxdistance a double value representing the maximum distance between the audio source and the listener, after which the volume is not reduced any further. pannernode.orientationx represents the horizontal position of the audio source's vector in a right-hand cartesian coordinate system. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 1. pannernode.orientationy represents the vertical position of the audio source's vector in a right-hand cartesian coordinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.orientationz represents the longitudinal (back and...
...dinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.orientationz represents the longitudinal (back and forth) position of the audio source's vector in a right-hand cartesian coordinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.panningmodel an enumerated value determining which spatialisation algorithm to use to position the audio in 3d space. ...
...the default is value is 0. ...
...the audio in a right-hand cartesian coordinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.positiony represents the vertical position of the audio in a right-hand cartesian coordinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.positionz represents the longitudinal (back and forth) position of the audio in a right-hand cartesian coordinate system. the default is 0. while this audioparam cannot be directly changed, its value can be
altered using its value property. the default is value is 0. pannernode.refdistance a double value representing the refe...
SubtleCrypto.deriveBits() - Web APIs
=> { // alice then generates a secret using her private key and bob's public key. // bob could generate the same secret using his private key and alice's public key. derivesharedsecret(aliceskeypair.privatekey, bobskeypair.publickey); }); }); pbkdf2 in this example we ask the user for a password, then use it to derive some bits using pbkdf2. see the complete code on github. let s
alt; /* get some key material to use as input to the derivebits method. the key material is a password supplied by the user. */ function getkeymaterial() { const password = window.prompt("enter your password"); const enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* de...
...eymaterial() { const password = window.prompt("enter your password"); const enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* derive some bits from a password supplied by the user. ...
..., enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* derive some bits from a password supplied by the user. ...
...enc.encode(password), {name: "pbkdf2"}, false, ["derivebits", "derivekey"] ); } /* derive some bits from a password supplied by the user. ...
Touch events - Web APIs
ion provides additional tips on how to handle touch events in your web application. handling clicks since calling preventdefault() on a touchstart or the first touchmove event of a series prevents the corresponding mouse events from firing, it's common to call preventdefault() on touchmove rather than touchstart. that way, mouse events can still fire and things like links will continue to work.
alternatively, some frameworks have taken to refiring touch events as mouse events for this same purpose. (this example is oversimplified and may result in strange behavior. it is only intended as a guide.) function ontouch(evt) { evt.preventdefault(); if (evt.touches.length > 1 || (evt.type == "touchend" && evt.touches.length > 0)) return; var newevt = document.createevent("mouseevents")...
...this behavior i...
...this behavior is not well defined in the touch events spec and results in different behavior for different browsers (i.e., ios will prevent...
...this behavior is not well defined in the touch events spec and results in different behavior for different browsers (i.e., ios will prevent zooming but still allow panning with both fingers; andro...
Web Video Text Tracks Format (WebVTT) - Web APIs
example of a cue 1 - title crawl 00:00:05.000 --> 00:00:10.000 line:0 position:20% size:60% align:start some time ago in a place rather distant.... cue identifier the identifier is a name that identifies the cue. it can be used to reference the cue from a script. it must not contain a newline and cannot contain the string "-->". it must end with a single newline. they do not have to be unique,
although it is common to number them (e.g., 1, 2, 3, ...). example 8 - cue identifier from example 7 1 - title crawl example 9 - common usage of identifiers webvtt 1 00:00:22.230 --> 00:00:24.606 this is the first subtitle. 2 00:00:30.739 --> 00:00:34.074 this is the second. 3 00:00:34.159 --> 00:00:35.743 third cue timings a cue timing indicates when the cue is shown. it has a start and en...
...rt></ruby> voice tag (<v></v>) similar to class tag, also used to style the contained text using css. example 20 - voice tag <v bob>text</v> interfaces there are two interfaces or apis used in webvtt which are: vttcue interface it is used for providing an interface in document object model api, where different attributes supported by it can be used to prepare and
alter the cues in number of ways. constructor is the first point for starting the cue which is defined using the default constructor vttcue(starttime, endtime, text) where starting time, ending time and text for cue can be adjusted. after that we can set the region for that particular cue to which this cue belongs using cue.region. vertical, horizontal, line, linealign, position, positionalign, text...
...constructor is the first point for starting the cue which is defined using the default constructor vttcue(starttime, endtime, text) where starting time, ending time and text for cue can be adjusted. after that we can set the region for that particular cue to which this cue belongs using cue.region. vertical, horizontal, line, linealign, position, positionalign, text, size and align can be used to
alter the cue and its formation, just like we can
alter the objects form, shape and visibility in html using css. but the vttcue interface is within the webvtt provides the vast range of adjustment variables which can be used directly to
alter the cue. following interface can be used to expose webvtt cues in dom api: enum autokeyword { "auto" }; enum directionsetting { "" /* horizontal */, "rl", "lr...
...we can categorize them for better understanding relating to each interface in webvtt: vttcue the methods which are available in this interface are: getcueashtml to get the html of that cue. vtt constructor for creating new objects of cues. autokeyword. directionsetting: to set the direct...
Basic concepts behind Web Audio API - Web APIs
audio routing graph. several sources — with different types of channel layout — are supported even within a single context. this modular design provides the flexibility to create complex audio functions with dynamic effects. audio nodes are linked via their inputs and outputs, forming a chain that starts with one or more sources, goes through one or more nodes, then ends up at a destination.
although, you don't have to provide a destination if you, say, just want to visualize some audio data. a simple, typical workflow for web audio would look something like this: create the audio context. inside the context, create sources — such as <audio>, oscillator, or stream. create effects nodes, such as reverb, biquad filter, panner, or compressor. choose the final destination for the aud...
...way for doing precise audio manipulation. note: to get a time in seconds from a frame count, simply divide the number of frames by the sample rate. to get a number of frames from a number of samples, simply divide by the channel count. here's a couple of simple examples: var context = new audiocontext(); var buffer = context.createbuffer(2, 22050, 44100); note: in digital audio, 44,100 hz (
alternately represented as 44.1 khz) is a common sampling frequency. why 44.1khz? firstly, because the hearing range of human ears is roughly 20 hz to 20,000 hz. via the nyquist–shannon sampling theorem, the sampling frequency must be greater than twice the maximum frequency one wishes to reproduce. therefore, the sampling rate has to be greater than 40 khz. secondly, signals must be low-pas...
...e, but in practice you will be unable to properly reproduce high frequency content, or treble sound. planar versus interleaved buffers the web audio api uses a planar buffer format. the left and right channels are stored like this: llllllllllllllllrrrrrrrrrrrrrrrr (for a buffer of 16 frames) this is very common in audio processing: it makes it easy to process each channel independently. the
alternative is to use an interleaved buffer format: lrlrlrlrlrlrlrlrlrlrlrlrlrlrlrlr (for a buffer of 16 frames) this format is very common for storing and playing back audio without much processing, for example a decoded mp3 stream. the web audio api exposes only planar buffers, because it's made for processing. it works with planar, but converts the audio to interleaved when it is sent to the ...
...nput channel with the same index. input channels with no corresponding output channels are dropped. visualizations in general, audio visualizations are achieved by accessing an output of audio data over time, usually gain or frequency data, and then using a graphical technology to turn that into a visual output, such as a graph. the web audio api has an analysernode available that doesn't
alter the audio signal passing through it. instead it outputs audio data that can be passed to a visualization technology such as <canvas>. you can grab data using the following methods: analysernode.getfloatfrequencydata() copies the current frequency data into a float32array array passed into it. analysernode.getbytefrequencydata() copies the current frequency data into a uint8array (un...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
its delay to 2147483647 ms, since it's specified as a signed integer in the idl. examples example 1: basic syntax the following example demonstrates setinterval()'s basic syntax. var intervalid = window.setinterval(mycallback, 500, 'parameter 1', 'parameter 2'); function mycallback(a, b) { // your code here // parameters are purely optional. console.log(a); console.log(b); } example 2:
alternating two colors the following example calls the flashtext() function once a second until the stop button is pressed. <!doctype html> <html> <head> <meta charset="utf-8" /> <title>setinterval/clearinterval example</title> <script> var nintervid; function changecolor() { nintervid = setinterval(flashtext, 1000); } function flashtext() { var oelem = document...
...rval = function (vcallback, ndelay /*, argumenttopass1, argumenttopass2, etc. */) { var aargs = array.prototype.slice.call(arguments, 2); return __nativesi__(vcallback instanceof function ? function () { vcallback.apply(null, aargs); } : vcallback, ndelay); }; window.setinterval.ispolyfill = true; } another possibility is to use an anonymous function to call your callback,
although this solution is a bit more expensive. example: var intervalid = setinterval(function() { myfunc('one', 'two', 'three'); }, 1000); another possibility is to use function's bind. example: var intervalid = setinterval(function(arg1) {}.bind(undefined, 10), 1000); inactive tabs requires gecko 5.0(firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) starting in gecko 5.0 (firefox 5.0 / ...
.... minidaemon - a framework for managing timers in pages requiring many timers, it can often be difficult to keep track of all of the running timer events. one approach to solving this problem is to store information about the state of a timer in an object. following is a minimal example of such an abstraction. the constructor architecture explicitly avoids the use of closures. it also offers an
alternative way to pass the this object to the callback function (see the "this" problem for details). the following code is also available on github. for a more complex but still modular version of it (daemon) see javascript daemons management. this more complex version is nothing but a big and scalable collection of methods for the daemon constructor. however, the daemon constructor itself is noth...
... to mitigate the potential impact this can have on performance, once intervals are nested beyond five levels deep, the browser will automatically enforce a 4 ms minimum value for the interval. attempts to specify a value less than 4 ms in deeply-nested calls to setinterval() will be pinned to 4 ms. browsers may enforce even more stringent minimum values for the interval under some circumstances,
although these should not be common. note also that the actual amount of time that elapses between calls to the callback may be longer than the given delay; see reasons for delays longer than specified in windoworworkerglobalscope.settimeout() for examples. ensure that execution duration is shorter than interval frequency if there is a possibility that your logic could take longer to execute than t...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
rd for exposing accessibility. myth: msaa is too slow reality: assistive technology vendors have found ways around most of the performance problems related to out-of-process com method calls. just make sure to have decent performance on your end. myth: "msaa sucks" reality: this statement may come from another engineer or even an employee of an at vendor. and what are they recommending for an
alternative, a proprietary solution? msaa is by no means perfect, but it is the only thing that will make your custom ui elements work with most assistive technologies. try to be careful that at vendors do not lock you into a prioprietary solution that will work with only their products. related myth: msaa is not supported by at vendors reality: it's a standard, and it is supported by jaws, window-...
...one with isimpledomnode (you can qi to it from iaccessible). this is likely to be a painful road even if you are a major player, in terms of getting the cooperation of at vendors. it may be a good enough solution; however, if what you need is jaws, dragon and zoomtext support. zoomtext and dragon can get by with your msaa support., and jaws can be scripted (even by external developers) to support
alternative interfaces. don't use msaa if you're working with a small number of at vendors, you can get everyone to agree on a different solution, and you're sure that you won't be needing to support other assistive technologies later. deciding which msaa features to support msaa methods - cheat sheet for developers the iaccessible interface is used in a tree of iaccessible's, each one represent...
... a 32 bit field representing possible on/off states, such as focused, focusable, selected, selectable, visible, protected (for passwords), checked, etc. [important] get_acchelp: get context sensitive help for the iaccessible. get_acchelptopic: we don't use this, it's only if the windows help system is used. get_acckeyboardshortcut: what is the keyboard shortcut for this iaccessible (underlined
alt+combo mnemonic) get_accfocus: which child is focused? [important] get_accselection: which children of this item are selected? get_accdefaultaction: get a description or name of the default action for this component, such as "jump" for links. accselect: select the item associated with this iaccessible. [important] acclocation: get the x,y coordinates, and the height and width of this iaccessi...
...simpledomnode, and vice versa for a round trip. however, one might qi isimpledomnode to iaccessible only to find it is null, which means that particular node in question is not exposed in the iaccessible tree. see the following diagram for examples of nodes that do no support iaccessible. msaa tree vs. dom tree - what's the relationship? the msaa tree and the dom tree are parallel structures,
although the msaa tree is a subset of the dom tree. queryinterface() can be used to switch between the interfaces used in the two trees (iaccessible and isimpledomnode). if there is no msaa node for a dom node, paccessible->queryinterface(iid_iaccessible) will return null. a variety of implementations for iaccessible there are two main kinds of classes in mozilla's accessibility class hierarchy, pl...
@font-feature-values - CSS: Cascading Style Sheets
the @font-feature-values css at-rule lets you use a common name in the font-variant-
alternates property for features activated differently in opentype. this can help simplify your css when using multiple fonts. the @font-feature-values at-rule may be used either at the top level of your css or inside any css conditional-group at-rule. syntax feature value blocks @swash specifies a feature name that will work with the swash() functional notation of font-variant-
alternates. a swash feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @annotation specifies a feature name that will work with the annotation() functional notation of font-variant-
alternates. an annotation feature value definition allows only one value: ident1: 2 is valid, but ident2: 2...
...s only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @annotation specifies a feature name that will work with the annotation() functional notation of font-variant-
alternates. an annotation feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @ornaments specifies a feature name that will work with the ornaments() functional notation of font-variant-
alternates. an ornaments feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @stylistic specifies a feature name that will work with the stylistic() functional notation of font-variant-
alternates. a stylistic feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @styleset specifies a feature name that will work with the s...
... allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @stylistic specifies a feature name that will work with the stylistic() functional notation of font-variant-
alternates. a stylistic feature value definition allows only one value: ident1: 2 is valid, but ident2: 2 4 isn't. @styleset specifies a feature name that will work with the styleset() functional notation of font-variant-
alternates. a stylset feature value definition allows an unlimited number of values: ident1: 2 4 12 1 maps to the opentype values ss02, ss04, ss12, and ss01. note that values higher than 99 are valid, but don't map to any opentype values and are ignored. @character-variant specifies a feature name that will work with the character-variant() functional notation of font-variant-
alternates. a characte...
... working draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out htt...
<color> - CSS: Cascading Style Sheets
e #-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. to learn more about using color in html, see applying color to html elements using css. syntax the <color> data type is specified using one of the options listed below. ...
... there are a few caveats to consider when using color keywords: html only recognizes the 16 basic color keywords found in css1, using a specific algorithm to convert unrecognized values (often to completely different colors). ...
...from the corresponding color on x11 systems since manufacturers sometimes tailor x11 colors to their specific hardware. note: the list of accepted keywords has undergone many changes during the evolution of css: css level 1 only included 16 basic colors, called the vga colors as they were taken from the set of displayable colors on vga graphics cards. css level 2 added the orange keyword.
although various colors not in the specification (mostly adapted from the x11 colors list) were supported by early browsers, it wasn't until svg 1.0 and css colors level 3 that they were formally defined. they are called the extended color keywords, the x11 colors, or the svg colors. css colors level 4 added the rebeccapurple keyword to honor web pioneer eric meyer. specification keyw...
... css color module level 3the definition of '<color>' in that specification. recommendation deprecates system colors. adds svg colors and rgba(), hsl(), and hsla() functional notations. css level 2 (revision 1)the definition of '<color>' in that specification. recommendation...
content - CSS: Cascading Style Sheets
the content css property replaces an element with a generated value. objects inserted using the content property are anonymous replaced elements. ...
...ing the content property are anonymous replaced elements. ...
...e; content: no-open-quote; content: no-close-quote; /* except for normal and none, several values can be used simultaneously */ content: open-quote chapter_counter; /* global values */ content: inherit; content: initial; content: unset; syntax values none the pseudo-element is not generated. normal computes to none for the ::before and ::after pseudo-elements. <string> specifies the "
alt text" for the element. this value can be any number of text characters. non-latin characters must be encoded using their unicode escape sequences: for example, \000a9 represents the copyright symbol. <image> an <image>, denoted by the <url> or <gradient> data type, or part of the webpage, defined by the element() function, denoting the content to display. <counter>() the value of a css counte...
... recommendation initial definition ...
Cross-browser audio basics - Developer guides
users will have a fast network connection. note: this value is often ignored on mobile platforms. <audio preload="auto"> ... </audio> controls we specify the controls attribute when we require the browser to provide us with its default playback controls. <audio controls> ... </audio> src as mentioned above, you can use the <source> element to specify one or more source audio files.
alternatively, you can include the src attribute directly on the <audio> element to specify a single source file. <audio src="audiofile.mp3"> ... </audio> type as mentioned above, to be sure that the browser knows what type of file is being specified, it's good practice to specify a type attribute alongside the src attribute. the type attribute specifies the mime type or internet media type of t...
...ecify a single source file. <audio src="audiofile.mp3"> ... </audio> type as mentioned above, to be sure that the browser knows what type of file is being specified, it's good practice to specify a type attribute alongside the src attribute. the type attribute specifies the mime type or internet media type of the file. <audio src="audiofile.mp3" type="audio/mpeg"> ... </audio> fallbacks
although the vast majority of browsers now support the <audio> element, you may want to cater for those that don't, such as ie<9. such browsers can be covered using a simple link to the media file, as we showed earlier, or via a fallback written in a plugin technology such as adobe flash or microsoft silverlight. for example, mediaelement.js includes flash fallbacks, which are used something like th...
...ing the audio element with javascript in addition to being able to specify various attributes in html, the <audio> element comes complete with several properties and methods that you can manipulate via javascript. given the following html: <audio id="my-audio" src="audiofile.mp3"> ... </audio> you can grab the <audio> element like this: var myaudio = document.getelementbyid('my-audio');
alternatively, you can create a new element. here's an example of creating an <audio> element, setting the media to play, playing and pausing, and then playing from 5 seconds into the audio: var myaudio = document.createelement('audio'); if (myaudio.canplaytype('audio/mpeg')) { myaudio.setattribute('src','audiofile.mp3'); } if (myaudio.canplaytype('audio/ogg')) { myaudio.setattribute('src','au...
.... this event can be used to trigger the displaying of playback progress. myaudio.addeventlistener("timeupdate", function() { //update something related to playback progress }); playing the playing event is initiated when playback is ready to start after having being paused due to lack of media data. waiting the waiting event is triggered when playback has stopped due to lack of media data,
although it is expected to resume once data becomes available. play the play event is initiated after the play() method is returned or when the autoplay attribute has caused playback to begin. this is when the state of the media switches from paused to playing. pause the pause event is triggered after the pause() method is returned. this is when the states switch from playing to paused. ended t...
Audio and Video Delivery - Developer guides
int for exploring the various delivery mechanisms of web based media and compatibility with popular browsers. the audio and video elements whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats,
although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. 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). if the browser doesn't sup...
...ive streaming are hls and mpeg-dash. mse has been designed with dash in mind. mse defines byte streams according to isobmff and m2ts (both supported in dash, the latter supported in hls). generally speaking, if you are interested in standards, are looking for flexibility, or wish to support most modern browsers, you are probably better off with dash. note: currently safari does not support dash
although dash.js will work on newer versions of safari scheduled for release with osx yosemite. dash also provides a number of profiles including simple ondemand profiles that no preprocessing and splitting up of media files. there are also a number of cloud based services that will convert your media to both hls and dash. for further information see live streaming web audio and video. custo...
...o/ogg"): http://jplayer.org/video/ogv/big_buck_bunny_trailer.ogv (play the ogg video live.) if these don't play then the browser you are testing doesn't support the given format. consider using a different format or using a fallback. if these work but the files you are supplying don't, there are two possible issues: 1. the media server is not delivering the correct mime types with the file
although this is usually supported, you may need to add the following to your media server's .htaccess file. # addtype type/subtype extension addtype audio/mpeg mp3 addtype audio/mp4 m4a addtype audio/ogg ogg addtype audio/ogg oga addtype video/mp4 mp4 addtype video/mp4 m4v addtype video/ogg ogv addtype video/webm webm addtype video/webm webmv 2. your files have been encoded incorrectly your fil...
...source could be decoded another way to show the fallback content of a video, when none of the sources could be decoded in the current browser, is to add an error handler on the last source element. ...
<a>: The Anchor element - HTML: Hypertext Markup Language
'click', event => event.target.href = canvas.todataurl() ); result security and privacy <a> elements can have consequences for users’ security and privacy. see referer header: privacy and security concerns for information. using target="_blank" without rel="noreferrer" and rel="noopener" makes the website vulnerable to window.opener api exploitation attacks (vulnerability description),
although note that, in newer browser versions (e.g. firefox 79+) setting target="_blank" implicitly provides the same protection as setting rel="noopener". accessibility strong link text the content inside a link should indicate where the link goes, even out of context. inaccessible, weak link text a sadly common mistake is to only link the words “click here” or “here”: <p> learn more...
...indow, or application opens unexpectedly. older screen-reading software may not even announce the behavior. ...
... announce the behavior. ...
... wikipedia (opens in new tab) </a> link to a non-html resource <a href="2017-annual-report.ppt"> 2017 annual report (powerpoint) </a> if an icon is used to signify link behavior, make sure it has
alt text: <a target="_blank" href="https://www.wikipedia.org"> wikipedia <img
alt="(opens in new tab)" src="newtab.svg"> </a> <a href="2017-annual-report.ppt"> 2017 annual report <img
alt="(powerpoint file)" src="ppt-icon.svg"> </a> webaim: links and hypertext - hypertext links mdn / understanding wcag, guideline 3.2 g200: opening new windows and tabs from a link only when necessary g201: giving users advanced warning when opening a new window skip links a skip link is a link placed as early as possible in <body> content that points to the beginning of the page's main con...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
gle icon; therefore most of the time the sizes attribute contains only one entry. ms's ico format does, as well as apple's icns. ico is more ubiquitous, so you should use this format if cross-browser support is a concern (especially for old ie versions). title the title attribute has special semantics on the <link> element. when used on a <link rel="stylesheet"> it defines a preferred or an
alternate stylesheet. incorrectly using it may cause the stylesheet to be ignored. type this attribute is used to define the type of the content linked to. the value of the attribute should be a mime type such as text/html, text/css, and so on. the common use of this attribute is to define the type of stylesheet being referenced (such as text/css), but given that css is the only stylesheet language...
...e with the opposite link type value. for example, to establish the reverse link for made, specify author. also this attribute doesn't stand for "revision" and must not be used with a version number, even though many sites misuse it in this way. ...
...le, to establish the reverse link for made, specify author. also this attribute doesn't stand for "revision" and must not be used with a version number, even though many sites misuse it in this way. examples including a stylesheet to include a stylesheet in a page, use the following syntax: <link href="style.css" rel="stylesheet"> providing
alternative stylesheets you can also specify
alternative style sheets. ...
...e following syntax: <link href="style.css" rel="stylesheet"> providing
alternative stylesheets you can also specify
alternative style sheets. the user can choose which style sheet to use by choosing it from the view > page style menu. this provides a way for users to see multiple versions of a page. <link href="default.css" rel="stylesheet" title="default style"> <link href="fancy.css" rel="
alternate stylesheet" title="fancy"> <link href="basic.css" rel="
alternate stylesheet" title="basic"> providing icons for different usage contexts you can include links to several different icons on the same page, and the browser will choose which one works best for its particular context using the rel and sizes values as hints. <!-- third-generation ipad with high-resolution retina display: --> ...
Index - HTTP
he preflight request is always an options and doesn't use the same method as the actual request. 15 age caching, http, response, header the age header contains the time in seconds the object has been in a proxy cache. 16 allow entity header, http, http header, reference, header the allow header lists the set of methods support by a resource. 17
alt-svc draft, http, http header, needscompattable, needscontent, needsexample, reference the
alt-svc header is used to list
alternate ways to reach this website. 18 authorization http, http header, reference, request header, header the http authorization request header contains the credentials to authenticate a user agent with a server, usually after the server has res...
...uage(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. 25 content-length http, headers, reference the content-length entity header indicates the size of the entity-body, in bytes, sent to the recipient. 26 content-location http, reference, header the content-location header indicates an
alternate location for the returned data. the principal use is to indicate the url of a resource transmitted as the result of content negotiation. 27 content-range http, http header, reference, response header, header the content-range response http header indicates where in a full body message a partial message belongs. 28 content-security-policy csp, http, refere...
...omain directive controls whether the current document is allowed to set document.domain. when this policy is enabled, attempting to set document.domain will fail and cause a securityerror domexception to be be thrown. 74 forwarded http, http header, reference, request header, header the forwarded header contains information from the client-facing side of proxy servers that is
altered or lost when a proxy is involved in the path of the request. 75 from http, reference, header the from request header contains an internet email address for a human user who controls the requesting user agent. 76 host http, reference, header the host request header specifies the domain name of the server (for virtual hosting), and (optionally) the tcp ...
...> or <object> . sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. 122 x-xss-protection http, reference, security, xss, header the http x-xss-protection response header is a feature of internet explorer, chrome and safari that stops pages from loading when they detect reflected cross-site scripting (xss) attacks.
although these protections are largely unnecessary in modern browsers when sites implement a strong content-security-policy that disables the use of inline javascript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support csp. ...
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
error type warning what went wrong? javascript 1.6's for each (variable in obj) statement is deprecated, and will be removed in the near future. examples object iteration for each...in has been used to iterate over the specified object values. ...
...s: var object = { a: 10, b: 20 }; for (var x of object.values(object)) { console.log(x); // 10 // 20 } array iteration for each...in has been used to iterate over specified array elements. deprecated syntax var array = [10, 20, 30]; for each (var x in array) { console.log(x); // 10 // 20 // 30 }
alternative standard syntax this is now possible with for...of (es2015) loops as well. var array = [10, 20, 30]; for (var x of array) { console.log(x); // 10 // 20 // 30 } iterating over a null-able array for each...in does nothing if the specified value is null or undefined, but for...of will throw an exception in these cases. depreca...
...iterating over a null-able array for each...in does nothing if the specified value is null or undefined, but for...of will throw an exception in these cases. deprecated syntax function func(array) { for each (var x in array) { console.log(x); } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(undefined); // prints nothing
alternative standard syntax to rewrite for each...in statements so that values can be null or undefined with for...of as well, you need to guard around for...of. function func(array) { if (array) { for (var x of array) { console.log(x); } } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(undefined); // prints nothing ...
...efined); // prints nothing iterating over an object's key-value pair deprecated syntax there's a deprecated idiom to iterate over the specified object's key-value pairs using for each...in and the deprecated iterator object. ...
Arrow function expressions - JavaScript
arrow function expressions are ill suited as methods, and they cannot be used as constructors. syntax basic syntax (param1, param2, …, paramn) => { statements } (param1, param2, …, paramn) => expression // equivalent to: => { return expression; } // parentheses are optional when there's only one parameter name: (singleparam) => { statements } singleparam => { statements } // the parameter list for a function with no parameters should be written with a pair of parentheses. ...
...ctor. this.age++; }, 1000); } var p = new person(); in ecmascript 3/5, the this issue was fixable by assigning the value in this to a variable that could be closed over. function person() { var that = this; that.age = 0; setinterval(function growup() { // the callback refers to the `that` variable of which // the value is the expected object. that.age++; }, 1000); }
alternatively, a bound function could be created so that a preassigned this value would be passed to the bound target function (the growup() function in the example above). an arrow function does not have its own this. the this value of the enclosing lexical scope is used; arrow functions follow the normal variable lookup rules. so while searching for this which is not present in the current scope, ...
...ctions do not have their own arguments object. thus, in this example, arguments is simply a reference to the arguments of the enclosing scope: var arguments = [1, 2, 3]; var arr = () => arguments[0]; arr(); // 1 function foo(n) { var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n return f(); } foo(3); // 6 in most cases, using rest parameters is a good
alternative to using an arguments object. function foo(n) { var f = (...args) => args[0] + n; return f(10); } foo(1); // 11 arrow functions used as methods as stated previously, arrow function expressions are best suited for non-method functions. let's see what happens when we try to use them as methods: 'use strict'; var obj = { // does not create a new scope i: 10, b: () => console.lo...
... '=>' however, this can be amended by putting the line break after the arrow or using parentheses/braces as seen below to ensure that the code stays pretty and fluffy. you can also put line breaks between arguments. var func = (a, b, c) => 1; var func = (a, b, c) => ( 1 ); var func = (a, b, c) => { return 1 }; var func = ( a, b, c ) => 1; // no syntaxerror thrown parsing order
although the arrow in an arrow function is not an operator, arrow functions have special parsing rules that interact differently with operator precedence compared to regular functions. let callback; callback = callback || function() {}; // ok callback = callback || () => {}; // syntaxerror: invalid arrow-function arguments callback = callback || (() => {}); // ok examples basic usage // an...
Authoring MathML - MathML
note that ua string sniffing is not the most reliable method and might break from version to version: var ua = navigator.useragent; var isgecko = ua.indexof("gecko") > -1 && ua.indexof("khtml") === -1 && ua.indexof('trident') === -1; var iswebkit = ua.indexof('app...
... you may need to synchronize the javascript converter with other javascript programs on your page. texzilla has an <x-tex> custom element, that can be used to write things like <x-tex>\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1</x-tex> and get it automatically converted into mathml. this is still a work-in-progress, but could be improved in the future thanks to web components and shadow dom.
alternatively, you can use the more traditional javascript parsing of expressions at load time as all the other tools in this section do. one simple client-side conversion tools is asciimathml. just download the asciimathml.js script and copy it to your web site. then on your web pages, add a <script> tag to load asciimathml and the mathematical expressions delimited by ` (grave accent) will be auto...
...he relevant javascript and css files on your web site and reference them in your page header (see the copy-me.html file from the zip archive for an example). one of the advantage of jqmath over the previous scripts is that it will automatically add some simple css rules to do the mathematical layout and make the formulas readable on browsers with limited mathml support. command-line programs an
alternative way is to parse the simple syntax before publishing your web pages. that is, you use command-line programs to generate them and publish these static pages on your server. pros: you get static web pages: the latex source don't need to be parsed at each page load, the mathml code is exposed to web crawlers and you can put them easily on any web server. binary programs may run fa...
...eoffice have an equation editor (file → new → formula). it is semi-wysiwyg: you enter the source of the formula using the equation panel/keyboard and a preview of the formula is regularly refreshed. the editor uses its own syntax "starmath" for the source but mathml is also generated when the document is saved. to get the mathml code, save the document as mml and open it with any text editor.
alternatively, you can extract the odf file (which is actually a zip archive) and open an xml file called content.xml. amaya is the w3c's web editor, which is able to handle mathml inside xhtml documents. use the elements and the special chars panels to create various advanced mathematical constructs. simple text such as a+2 is automatically parsed and the appropriate mathml markup is generated. o...
SVG element reference - SVG: Scalable Vector Graphics
nt>, <solidcolor> renderable elements <a>, <circle>, <ellipse>, <foreignobject>, <g>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textpath>, <tspan>, <unknown>, <use> shape elements <circle>, <ellipse>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect> structural elements <defs>, <g>, <svg>, <symbol>, <use> text content elements <
altglyph>, <
altglyphdef>, <
altglyphitem>, <glyph>, <glyphref>, <textpath>, <text>, <tref>, <tspan> text content child elements <
altglyph>, <textpath>, <tref>, <tspan> uncategorized elements <clippath>, <color-profile>, <cursor>, <filter>, <foreignobject>, <hatchpath>, <meshpatch>, <meshrow>, <script>, <style>, <view> obsolete and deprecated elements warning: these are old svg elements which ar...
...>, <color-profile>, <cursor>, <filter>, <foreignobject>, <hatchpath>, <meshpatch>, <meshrow>, <script>, <style>, <view> obsolete and deprecated elements warning: these are old svg elements which are deprecated and should not be used. ...
...ofile>, <cursor>, <filter>, <foreignobject>, <hatchpath>, <meshpatch>, <meshrow>, <script>, <style>, <view> obsolete and deprecated elements warning: these are old svg elements which are deprecated and should not be used. ...
...>, <filter>, <foreignobject>, <hatchpath>, <meshpatch>, <meshrow>, <script>, <style>, <view> obsolete and deprecated elements warning: these are old svg elements which are deprecated and should not be used. ...
platform/xpcom - Archive of obsolete content
or service has been registered by using the isregistered() function: if (xpcom.isregistered(factory)) xpcom.unregister(factory); globals constructors factory(options) parameters options : object required options: name type component constructor constructor for the component this factory creates. this will typically return a descendant of unknown,
although it may return a custom object that satisfies the nsisupports interface. optional options: name type contract string a contract id. users of xpcom can use this value to retrieve the factory from components.classes: var factory = components.classes['@me.org/request'] var component = factory.createinstance(ci.nsirequest); this param...
...g: function() { return this.pending; }, resume: function() { console.log('resuming...'); }, suspend: function() { console.log('suspending...'); }, cancel: function() { console.log('canceling...'); } }); this component definition: specifies that we support nsirequest using the interfaces property. initializes pending in initialize() adds our implementation of the nsirequest interface
although request also implements nsisupports, there is no need to add it here, because the base class unknown declares support for nsisupports and this is accounted for when retrieving objects. we can register a factory for this component by using the factory class to associate its constructor with its contract id: var { factory } = require('sdk/platform/xpcom'); var { cc, ci } = require('chrome');...
...upports. factory use this class to register an xpcom factory. to register a factory for a component, construct a factory, giving it: a constructor for the component a contract id and/or a class id // create and register the factory var factory = factory({ contract: '@me.org/mycomponent', component: mycomponent }); the component constructor typically returns a descendant of unknown,
although it may return a custom object that satisfies the nsisupports interface. the contract id and/or class id may be used by xpcom clients to retrieve the factory. if a class id is not given, a new one will be generated. the contract id and class id are accessible as the values of the contract and id properties, respectively. by default, the factory is registered when it is created and unregiste...
jpm - Archive of obsolete content
ome && npm install jpm to run jpm from a terminal when installed locally, you must add the directory "$home/node_modules/.bin/" to your terminal's path first. 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 after installation, at the command prompt, type: jpm you should see a screen summarizing the available jpm commands. note that unlike cfx, jpm is available in every command prompt you start, as long as you installed it with th...
...rted from jpm 1.0.4 onwards. this command retrieves a new xpi for your add-on signed by mozilla. this allows you to self-host your add-on so that users can install it without error when signed add-ons are required. you can sign an xpi you've already generated by passing the xpi file in the --xpi argument, like this: jpm sign --api-key ${jwt_issuer} --api-secret ${jwt_secret} --xpi <xpi file>
alternatively, you can omit the --xpi argument, in which case jpm sign will generate an xpi from the current directory (or --addon-dir). jpm sign --api-key ${jwt_issuer} --api-secret ${jwt_secret} this submits an xpi it to the addons.mozilla.org signing api, then downloads a signed xpi to the working directory if it passes validation. to get values for --api-key and --api-secret, you will need to ...
...d. if you need changes to the profile to persist, add the --no-copy argument. however beware that jpm might also apply changes to the profile, setting some preferences that will make it unusable for daily usage. developing without browser restarts because jpm run restarts the browser each time you invoke it, it can be a little cumbersome if you are making very frequent changes to an add-on. an
alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run jpm post --post-url http://localhost:8888/, to make an xpi and post it. you could even automate this workflow with a simple scrip...
Miscellaneous - Archive of obsolete content
the meaning of the action preference is shown in the following table mousewheel.withxxxkey.action result 0 scroll by lines. if set, you will receive dommousescroll events. 1 scroll by page. 2 move around in the history. if set, you will not receive dommousescroll e...
...nddispatcher.focusedwindow.document; var inputlist = pagedoc.getelementsbytagname('input'); for (var i=1; i<inputlist.length; i++) { inputlist.item(i). addeventlistener("focus", function(e) {onfocusinput(e);}, false); inputlist.item(i). ...
...n = { _bundle: components.classes["@mozilla.org/intl/stringbundle;1"] .getservice(components.interfaces.nsistringbundleservice) .createbundle("chrome://myext/locale/myext.properties"), getlocalizedmessage: function(msg) { return this._bundle.getstringfromname(msg); } }; alert(common.getlocalizedmessage("invalid.url")) another similar
alternative (using both getstringfromname and formatstringfromname), is: var fcbundle = components.classes["@mozilla.org/intl/stringbundle;1"] .getservice(components.interfaces.nsistringbundleservice) .createbundle("chrome://myext/locale/myext.properties"); function getstr(msg, args){ //get localised message if (args){ args = array.prototype.slice.call(arguments,...
On page load - Archive of obsolete content
content"); // browser if(appcontent){ appcontent.addeventlistener("domcontentloaded", myextension.onpageload, true); } var messagepane = document.getelementbyid("messagepane"); // mail if(messagepane){ messagepane.addeventlistener("load", function(event) { myextension.onpageload(event); }, true); } }, onpageload: function(aevent) { var doc = aevent.origin
altarget; // doc is document that triggered "onload" event // do something with the loaded page. // doc.location is a location object (see below for a link). // you can use it to make your code executed on certain pages only. if(doc.location.href.search("forum") > -1) alert("a forum page is loaded"); // add event listener for page unload aevent.origin
altarget.defaultvie...
... if you are running code on a page load it is likely you would want to run some cleanup code on page unload. ...
....onpageunload, false); and add your code to onpageunload method. basic onpageload for a browser window var myextension = { init: function() { // the event can be domcontentloaded, pageshow, pagehide, load or unload. if(gbrowser) gbrowser.addeventlistener("domcontentloaded", this.onpageload, false); }, onpageload: function(aevent) { var doc = aevent.origin
altarget; // doc is document that triggered the event var win = doc.defaultview; // win is the window for the doc // test desired conditions and do something // if (doc.nodename != "#document") return; // only documents // if (win != win.top) return; //only top window. // if (win.frameelement) return; // skip iframes/frames alert("page is loaded \n" +do...
JavaScript Object Management - Archive of obsolete content
indow.settimeout and window.setinterval to control timed code execution. in case you're using javascript code modules or xpcom objects, where a window object is not readily available, use an nsitimer instead. this post suggests a way to achieve a true zero ms timeout, as a simple way to achieve parallelism in js code. notice the way we send callback functions as parameters, and the use of an
alternate reference for this which we always name that. this is all necessary due to a javascript feature (quirk would be a better word for it) called method binding. the consequence of doing this wrong is to have a this reference that doesn't do what you expected it to do. there are a few workarounds for this, and we use the ones we have found to be the most elegant and clear to read. the general...
...nside the function, declare a variable called that that equals this, and use that in the anonymous function. javascript has a host of features that make it extremely flexible, but it also has some disadvantages, as it is not as strict as other languages, such as java. a clear example of this is the fact that there are no private or public keywords that allow you to protect object members. as a
alternative for this, a naming standard is frequently used to distinguish private and public members. there's no scope enforcement whatsoever, but this standard give others the chance to "play nice" and don't use private members. use "_" at the beginning of private attributes and methods in js objects. for example: _stringbundle, _createusernode(). exercise here's a short exercise to test a pa...
...me); this is something you can do with js in general. you can use it in jsm, chrome, even on regular web pages. since entities tend to be used all throughout an application, we think that having those classes defined at the module level is the best approach. jsm is the best solution to handle objects that are window-independent. in the following section we'll discuss xpcom, which is an older
alternative to jsm and one of the foundations of mozilla applications. you shouldn't skip that section because there are many common situations in extension development where you'll have to use xpcom, maybe even implement xpcom components of your own. « previousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Setting up an extension development environment - Archive of obsolete content
profile(s) created automatically when you run other versions of firefox earlier. choose default and uncheck "don't ask at startup" checkbox. click "start firefox". now when you start any version of firefox you may choose any profile you like. development command flags as of gecko 2 (firefox 4), javascript files are cached ("fastload"). the -purgecaches command-line flag disables this behavior.
alternatively, you can set the moz_purge_caches environment variable. see this bug for more information. development preferences there is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier. however, these preferences can degrade performance, so you may want to use a separate development profile when you ...
...ager automatically restarts the application at startup sometimes, which may mean you won't have time to see the messages logged before the automatic restart happens. to see them, prevent the automatic restart by setting the environment no_em_restart to 1 before starting the application.) nglayout.debug.disable_xul_fastload = true. for gecko 2.0+ (firefox 4.0+). see this bug for more information.
although the bug has been closed, it is believed that this pref is still relevant. you might also want to set dom.report_all_js_exceptions = true. see exception logging in javascript for details. devtools.errorconsole.deprecation_warnings = true. detect deprecated code use. warning: never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debu...
... file that points to an extension that is installed in a location other than the user profile. get the extension id from the extension's install.rdf file. create a file in the "extensions" directory under your profile directory with the extension's id as the file name (for example "your_profile_directory/extensions/{46d1b3c0-db7a-4b1a-863a-6ee6f77ecb58}"). (how to find your profile directory)
alternatively, rather than using a guid, create a unique id using the format "name@yourdomain" (for example chromebug@mydomain.com) - then the proxy filename will be same as that id, with no curly brackets {}. the contents of this file should be the path to the directory that contains your install.rdf file, for example /full/path/to/yourextension/ on mac and linux, and c:\full\path\to\yourextensi...
Supporting search suggestions in search plugins - Archive of obsolete content
optional element is an array of descriptions for each of the suggestions in thecompletion list . these can be any additional information the search engine might want to return to be displayed by the browser, such as the number of results available for that search. descriptions are not supported in firefox, and are ignored if any are specified. query urls this optional element is an array of
alternate urls for each of the suggestions in thecompletion list . for example, if you want to offer a map link instead of just a search result page for a given suggestion, you can return an url to a map in this array. if you don't specify a query url, the default query is used based on the search described by the <url> element in the search plugin's xml description. query urls are not supporte...
...e search described by the <url> element in the search plugin's xml description. query urls are not supported in firefox, and are ignored. this enhancement request - the handling of a selected suggestion, namely calling of a full specified url as proposed in the opensearch standard - is tracked in bug 386591. ...
...in addition, the method you use to select suggestions is entirely up to you. note: firefox requires that suggest requests complete within 500ms for suggestions to be displayed. ...
Tabbed browser - Archive of obsolete content
the code given is for a menuitem, but will work equally well for other xul elements. this will only work in an overlay of browser.xul. xul: <menuitem oncommand="myextension.f...
... generic removetab method, which accepts a xul tab element as its single parameter. changing active tab this moves one tab forward (to the right). gbrowser.tabcontainer.advanceselectedtab(1, true); this moves one tab to the left. gbrowser.tabcontainer.advanceselectedtab(-1, true); detecting page load see also code snippets:on page load function examplepageload(event) { if (event.origin
altarget instanceof components.interfaces.nsidomhtmldocument) { var win = event.origin
altarget.defaultview; if (win.frameelement) { // frame within a tab was loaded. win should be the top window of // the frameset. if you don't want do anything when frames/iframes // are loaded in this web page, uncomment the following line: // return; // find the root document: ...
...d do the loadcontext stuff below try { loadcontext = interfacerequestor.getinterface(ci.nsiloadcontext); } catch (ex) { try { loadcontext = subject.loadgroup.notificationcallbacks.getinterface(ci.nsiloadcontext); } catch (ex2) {} } } catch (ex0) {} if (!loadcontext) { //no load context so dont do anything
although you can run this, which is your old code //this probably means that its loading an ajax call or like a google ad thing return null; } else { var contentwindow = loadcontext.associatedwindow; if (!contentwindow) { //this channel does not have a window, its probably loading a resource //this probably means that its loading an ajax cal...
Notes on HTML Reflow - Archive of obsolete content
frames, for example, for a text frame when the text must be wrapped. some reflows are immediate in response to user or script actions; for example, resizing the window or changing the document's default font. these are dispatched directly from the presentation shell (e.g., nsipresshell::stylechangereflow), and affect the entire frame tree. other reflows are incremental and are de
alt with asynchronously; for example, when content streams in from the network. incremental reflows are queued by the presentation shell for batched dispatch. reflow state the reflow state object, nshtmlreflowstate, is used to pass constraining information "down" from parent frames to child frames. for example, a <div> with a constrained width (e.g., set via the css width property) would not...
...ected when an incremental reflow reaches its target frame , described below. reflow metrics the reflow metrics object, nshtmlreflowmetrics, is used to propagate information from child frames back to the parent. for example, the dimensions of each child frame of an unconstrained <div> would be passed back to the <div>'s frame via the nshtmlreflowmetrics object. incremental reflow
although all of the reflow in gecko attempts to re-use as much existing state as possible (and is in therefore some sense "incremental") an incremental reflow corresponds to a reflow that is specifically targeted at an individual frame in the frame hierarchy. a frame requests a incremental reflow (or one is requested on a frame's behalf) when something about the frame itself has changed. scheduling. ...
...contentchanged indicates that the content corresponding to the target frame has changed somehow; for example, the text associated with a text frame has been modified. in reality, the only frame that responds to this sort of reflow is the block frame. the block frame treats this sort of change as a `full reflow' (i.e., as a resize). this makes me believe that we could probably eliminate this class
altogether. stylechanged indicates that the stylistic information corresponding to the target frame has changed; for example, the font size has increased. this causes the frame to mutate the reflow state's reason to stylechange, which is propagated recursively to the entire subtree beneath the target frame. reflowdirty indicates that container frame has decided to coalesce several ...
The new nsString class implementation (1999) - Archive of obsolete content
trings between modules that may not use nsstrimpl implementation. this is the most generic approach, but offers reference counted strings. there are implications regarding this implementation, notably dealing with api changes throughout gecko. notably, nsstrings in api's will be discouraged in public api's. these api's will need to be rewritten using nsstrimpl references instead. as an
alternative, programmers can pass nsistrings between modules. i18n issues another concern (mainly of the i18n team) has to do with the use of a 1-byte (ascii) nscstring at all. the i18n team correctly points out that that anarchy will prevail if judicious control over their use is not mandated. the problem stems from assumptions that programmers make regarding ascii strings; the typical assumpti...
.... it is recognized that (ascii) nscstring's are useful in the following contexts: whenever calling libraries that expect a char* variant whenever maximum memory efficiency is essential i would argue that only the first case is normatively legitimate. the i18n folks will tell you it's better to use a wide string and convert to 1-byte forms for this purpose even though there is a performance pen
alty for doing so. since i have to acknowledge the idiom, i have made nscstring available but note that it should be used sparingly. memory management a principal enhancement of the new architecture is pluggable memory allocators. all nsstring subclasses provide their own default allocator implementations, but programmers are free to use their own. in the new prototype nsstrimpl and nsstring classes,...
...mary concerns of our i18n team. first, nsstrimpl offers charset conversion hooks for use during construction, comparison and assignment. (these are stubbed out today awaiting their review and implementation). second, they are concerned that programmers be prevented from abusing the string classes in a number of ways. to wit: they want to ensure that the underlying buffers cannot be corrupted or
altered erroneously they want to ensure that the appropriate set of conversion functions get applied they want some control over the usage pattern of strings, such that the 2-byte (ucs2) form is used whenever possible, and some restrictions are applied to the use of 1-byte (ascii) nscstrings. original document information author: rick gessner last updated date: january 20, 1999 copyright...
List of commands - Archive of obsolete content
d_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...on
altoolbar.js http://lxr.mozilla.org/seamonkey/sou...rceoverlay.xul http://lxr.mozilla.org/seamonkey/sou...extoverlay.xul http://lxr.mozilla.org/seamonkey/sou...lityoverlay.js http://lxr.mozilla.org/seamonkey/sou...oomoverlay.xul http://lxr.mozilla.org/seamonkey/sou...toroverlay.xul http://lxr.mozilla.org/seamonkey/sou...ark.properties http://lxr.mozilla.org/seamonkey/sou...kmarks-temp.js http...
...md_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_expandfolder cmd_bm_export cmd_bm_find cmd_bm_import cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_newseparator cmd_bm_open cmd_bm_openinnewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectall cmd_bm_setnewbookmarkfolder cmd_bm_setnewsearchfolder cmd_bm_setperson
altoolbarfolder cmd_bm_sortfolder cmd_bm_sortfolderbyname cmd_close cmd_closeothertabs cmd_closewindow cmd_copy cmd_copyimage cmd_copylink cmd_cut cmd_delete cmd_editpage cmd_findtypelinks cmd_findtypetext cmd_gotoline cmd_handlebackspace cmd_handleshiftbackspace cmd_minimizewindow cmd_neweditor cmd_neweditordraft cmd_neweditortemplate cmd_newnavigator cmd_newnavigatortab cmd_n...
...also obtained from http://www.mozilla.org/unix/customizing.html ...
Namespaces - Archive of obsolete content
container providing context for the items ... 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. an xml namespace is identified by an unique name (called a uri, not a url, even though it can look like a url). an uri is any string,
although most people choose a url-based uri because urls are an easy way to hope for uniqueness.
although there's nothing preventing someone else from using the namespace http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul, it's fairly unlikely anyone would choose that accidentally. even if they did accidentally choose it, they may not define the same elements as xul anyway (e.g., <textbox/...
...r that http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul is the default namespace for the element and its descendant elements (unless further overridden by a default namespace on a descendant element), and that any element without a namespace (i.e., no prefix and colon) belongs to the default namespace. that's why we can write the shorthand <textbox/> instead of <xul:textbox/> in xul (
although the latter is just as correct when not using http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul as the default namespace) -- the xul namespace is defined as the default on the topmost element. in other words, a default namespace permits a kind of short-hand to be used for all descendants of an element. here's a question: what namespace contains the element foo in the xml document ...
....mozilla.org/keymaster/gatekeeper/there.is.only.xul as the default namespace) -- the xul namespace is defined as the default on the topmost element. in other words, a default namespace permits a kind of short-hand to be used for all descendants of an element. here's a question: what namespace contains the element foo in the xml document below? <foo/> the answer is that it's in no namespace, or
alternately, it's in the namespace denoted by the empty string: <foo xmlns=""/> this second example is semantically equivalent to the first. now, a second question: what namespaces are the bar, baz, and quux attributes in? <foo bar="value"> <element xmlns="namespace!" baz="value"> <element quux="value"/> </element> </foo> bar is obviously not in a namespace. what about baz and q...
Additional Template Attributes - Archive of obsolete content
late attribute on the root element set to the id of a template. <listbox datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" template="phototemplate"/> ... <template id="phototemplate"> ... </template> this template will be shared with any other element that references the id 'phototemplate'. the listbox here does not have any children,
although it may do. if you did add children, they act just like the static content as if the template was present. however, it is possible to use different static content for each usage, even though the template is shared. the datasources and ref attributes also differ for each usage, so it is possible to use a shared template to display the same structure multiple times but with different starting n...
...ag inside a query, while the member variable is determined by the value of the uri attribute inside the action body. it is also possible to be explicit about the two variables by using two attributes on the <template> element. <template container="?first" member="?item"> the container and member attributes can be used to specify the container and member variables. this isn't particularly useful
although there is a very slight optimization since the builder does not need to scan the action body looking for the member variable when compiling the queries and rules. you might also use these attributes just to make the code clearer when using very complex queries. one possible advantage is when using the simple rdf query syntax where you don't specify variables; instead you use the special 'rdf...
...s implied. by using the container and member attributes, you can use specific variables instead. <hbox datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> <template container="?start" member="?photo"> <rule> <image uri="?photo" src="?photo"/> </rule> </template> </hbox> in this example, the ?photo variable can be used instead of 'rdf:*' (
although you can use either even if you specify the member variable). this may make the code clearer as to its function. we could use the container variable ?start in the action body also. if you are using the simple syntax and want to use the container variable in the content, you must use the container attribute since there is no other way to refer to it. note also that a rule element is needed her...
Multiple Rule Example - Archive of obsolete content
images/t/canal.jpg, ?phototitle = canal) (?start = http://www.xulplanet.com/rdf/myphotos, ?photo = http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ?phototitle = obelisk) the first result matches the first rule and contains variables for the two additional predicates that were examined in the conditions. since the second rule doesn't refer to these variables, they will not be filled in.
although the canal photo has a date, the second rule doesn't use it, so you cannot refer to the ?date variable in this rule. but, you could use a <binding> to get the date without requiring it to match the conditions. of course, the variable doesn't have to be ?date in the second rule. you might notice that the ?title variable is used in the first rule whereas the ?phototitle variable is used for the...
...e variable is used in the first rule whereas the ?phototitle variable is used for the second rule, despite that they both store the value of the title predicate. there is no reason for this -- it is only used in this example to show that there is no connection between the variables used in the two rules. you can use different variables if it makes sense in the context of the template or the data,
although in this example it would seem more reasonable to use the same variable name. the only exception to this is that the container and member variables (those that are referred to in the uri attributes), must be the same in all rules. in this example, the container variable is ?start and the member variable is ?photo. if different variables were used for these, the rules would not work properly. ...
...ame in all rules. in this example, the container variable is ?start and the member variable is ?photo. if different variables were used for these, the rules would not work properly. the reason for this is due to the manner in which the builder processes the data. looking back at the results listed above, the palace photo appears twice so the second one will be removed, leaving only three matches.
although the builder actually generates mutliple matches for one resource, in many cases it isn't necessary to be aware of this detail when creating templates. it is usually sufficient to assume that earlier rules are used to filter results much like an if-else construct in a programming language. if the last rule has no specific conditions (for example a simple rule with no attributes on the <rule> ...
Grids - Archive of obsolete content
the columns that are used and the rows that are used. just like html tables, you put content such as labels and buttons inside the rows. however, the grid allows either row or column based organization so you may put content in either rows or in columns. it is most common to use rows, as with a table. however, you can still use columns to specify the size and appearance of the columns in a grid.
alternatively, you can put content inside the columns, and use the rows to specify the appearance. we'll look at the case of organizing elements by row first. declaring a grid to declare a set of rows, use the rows tag, which should be a child element of grid. inside that you should add row elements, which are used for each row. inside the row element, you should place the content that you want ins...
...laceholders to specify how many there are. you may add the flex attribute to a row to make it flexible. the content is placed inside in each column. the first element inside each column element is placed in the first row, the second element in the second row and the third element is placed in the third row. if you put content in both the columns and the rows, the content will overlap each other,
although they will align in a grid properly. it creates an effect much like a grid of stack elements. the order of the elements in the grid determines which is displayed on top and which is placed underneath. if the rows element is placed after the columns element, the content within the rows is displayed on top. if the columns element is placed after the rows element, the content within the columns...
...n"/> <button label="grape"/> </row> <row flex="1"> <button label="strawberry"/> <button label="raspberry"/> <button label="peach"/> </row> </rows> </grid> the first column and both rows have been made flexible. this will result in every cell in the first column being flexible horizontally. in addition, every cell will be flexible vertically because both rows are flexible,
although the first row is more so. the cell in the first column and first row (the cherry button) will be flexible by a factor of 5 horizontally and flexible by a factor of 10 vertically. the next cell, (lemon) will only be flexible vertically. the flex attribute has also been added to the grid element so that the entire grid is flexible, otherwise it would only grow in one direction. column spanni...
Simple Menu Bars - Archive of obsolete content
nds. menuitem an individual command on a menu. this would be placed in a menupopup. menuseparator a separator bar on a menu. this would be placed in a menupopup. you can customize the menus on the menubar to have whatever you want on them on all platforms except the macintosh. this is because the macintosh has its own special menu along the top of the screen controlled by the system.
although you can create custom menus, any special style rules or non-menu elements that you place on a menu may not be applied. you should keep this is mind when creating menus. example of a simple menu bar example 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menuitem label="new"/> <m...
...ate a vertical menubar by setting the orient attribute to vertical. menu element the menu element works much like the button element. it accepts some of the same attributes plus some additional ones: id the unique identifier of the menu title button. label the text to appear on the menu, such as file or edit. disabled this boolean attribute determines whether the menu is disabled.
although you can, there's rarely a need to disable an entire menu. this attribute can be set to either true or false. of course, the latter is the default. accesskey this is the key that the user can press to activate the menu item. this letter is typically shown underlined on the menu title. mozilla will look at the label attribute and add an underline character to the character specified here.
...bute can be set to either true or false. of course, the latter is the default. accesskey this is the key that the user can press to activate the menu item. this letter is typically shown underlined on the menu title. mozilla will look at the label attribute and add an underline character to the character specified here. for that reason, you should specify a character that exists in the text (
although the key will still work if it doesn't). the menu element is normally placed on a menubar,
although it does not have to be. however, it will be given a different look. the image here shows what the earlier example would look like without the menu bar. menupopup element the menupopup element creates the popup window containing the menu commands. it is a type of box which defaults to a ve...
XUL element attributes - Archive of obsolete content
space-separated list of rdf properties or resources. context type: id should be set to the value of the id of the popup element that should appear when the user context-clicks on the element. a context-click varies on each platform. usually it will be a right click. you can use the special value '_child' to indicate the first menupopup child of the element. ...
...the element should have a template element as a child. for rdf templates, the specified datasources are combined into a single composite datasource which holds the data from all of the datasources. this composite datasource is accesssible via a script through the database property. ...
...fies the pixel position of the left edge of the element relative to the left edge of the stack. maxheight type: string (representing an integer) the maximum height of the element. this corresponds to the max-height css property. maxwidth type: string (representing an integer) the maximum width of the element. this corresponds to the max-width css property. menu type: id
alternate name for the popup attribute, but also has a corresponding script property 'menu'. minheight type: string (representing an integer) the minimum height of the element. this corresponds to the min-height css property. minwidth type: string (representing an integer) the minimum width of the element. this corresponds to the min-width css property. mousethrough type: on...
key - Archive of obsolete content
uld appear next to a menuitem label if that menuitem is associated with the key element via its key attribute. modifiers type: space-separated list of the values below a list of modifier keys that should be pressed to invoke the keyboard shortcut. multiple keys may be separated by spaces or commas. keys will map to other keys on platforms that do not have them. shift: the shift key.
alt: the
alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since
alt+letter combinations are reserved for entering special characters in text. meta: the meta key. on the macintosh, this is the command key. control: the control key. os: windows logo key on windows, super or hyper key on linux. this shouldn't be specified dire...
...y on windows, super or hyper key on linux. this shouldn't be specified directly because it may conflict with system wide shortcut key. accel: the key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. access: the access key for activating menus and other elements. on windows, this is the
alt key, used in conjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. phase type: string the event phase where the handler is invoked. this should...
...ey="" modifiers="control"/> <key keycode="" modifiers="control"/> modifying attributes in case you want to change one of the <key>'s attributes, such as the modifiers attribute, the keyset element has to be re-added to its parent node; otherwise the new attributes won't be applied. for example: // modify some attributes let key = document.getelementbyid(key_id); key.setattribute("modifiers", "
alt shift"); // apply the changes let keyset = document.getelementbyid(keyset_id); keyset.parentnode.appendchild(keyset); ...
toolbox - Archive of obsolete content
ot be collapsed and expanded. note: gecko 2.0 adds support for external toolbars. these are toolbars that are not children of a toolbox. you can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. ...
...oolbars by setting the toolboxid property on the toolbar. the external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's extern
altoolbars property. more information is available in the xul tutorial. if you'd like to detect when toolbars in a toolbox are changed, see toolbar customization events. ...
...ement, sortdirection, sortresource, sortresource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width properties accessible type: nsiaccessible returns the accessibility object for the element. customtoolbarcount firefox only type: integer the number of custom toolbars currently within the toolbox. extern
altoolbars type: array of elements an array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox. palette firefox only type: element the toolbarpalette within the toolbox. toolbarset firefox only type: element the toolbarset within the toolbox. methods inherited methods ad...
Archived Mozilla and build documentation - Archive of obsolete content
to process this audio data and to create new audio data. java in firefox extensions if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread,
although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., java...
..., like internet explorer 4, that were built before the conception of w3c standards inherited many quirks. in this article, i will describe mozilla's quirks mode, which provides strong backwards html compatibility with internet explorer and other legacy browsers. monitoring downloads firefox 3 makes it easier than ever to monitor the status of downloads.
although it was possible to do so in previous versions of firefox, it was previously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any number of listeners to observe downloads. mozilla application framework the mozilla application framework: for powerful, easy to develop cross-platform applications mozilla crypto ...
...com is a tree configuration that builds a minimal set of libraries (shared mostly) that can be used to get all features of xpcom. the contents of this standalone xpcom in general are: stress testing consume.exe from the windows server 2003 resource kit tools can consume various resources: physical memory, cpu time, page file, disk space and even the kernel pool.
although for win2003, it should install into winxp fine (win2000 compatibility is unknown). the only downside is you can't specify how much of the resource to use, only which one to consume. also be warned: always remember the -time option, or you may be hitting that physical reset button sooner than you would have liked! structure of an installable bundle ...
Gecko Compatibility Handbook - Archive of obsolete content
rietary html that will work as expected in each browser. gecko browsers will ignore both internet explorer and netscape navigator 4 proprietary html tags. so, a page may not display in gecko browsers as it does in internet explorer 4 or in netscape navigator 4. the prime example of this is the use of netscape navigator 4 proprietary <layer>, commonly used in site navigation. for standards-based
alternatives, see updating dhtml web pages for next generation browsers. an html page can be quickly checked for the use of proprietary html markup by submitting the page to the w3's html validator using the html 4.01 doctype. we will have more to say about doctypes later in this article, but essentially the doctype is supposed to indicate to a browser what version of html is used in the page. the ...
...lines state that empty elements can be coded by following the tag name with a space followed with as slash as in <tag />. to be backwardly compatible you must have a space before the trailing />. in addition, you must only use the xml empty tag notation for html elements that are always empty - and not for html elements that have optional ending tags. for example, it is ok to code <br> as <br />
although there is no benefit to do so in html documents. but it is not ok to code <option> as <option />. to understand why, consider the following: html without optional ending tags equivalent html with optional ending tags <select> <option>optionvalue </select> <select> <option>optionvalue</option> </select> now consider if we used the xml empty t...
...reasons listed above. this is also the case for older versions of web authoring tools such as macromedia's dreamweaver 2 and 3. newer versions of these apis and tools do support gecko however. for example, dynapi is now maintained at sourceforge and offers a gecko-compatible version. newer versions of web authoring tools support gecko. wrong doctype problem: an incorrect doctype can completely
alter a page's presentation. gecko, internet explorer for mac os and internet explorer 6 all use a technique called doctype sniffing to determine if a page is to be laid out in a fashion compatible with the older browsers or if it is to be laid out in a fashion compatible with the w3 standards. using the appropriate doctype in an html document allows a web page author to continue to support the ol...
Syndicating content with RSS - Archive of obsolete content
page(s). adding a special <a> element to html page(s). we've already discussed the first step—creating rss feeds— so we'll focus on the other two steps here. adding the <link> often the data in an rss feed is also made available on an html web page. when this is the case, the html web page can let people and machines know about the feed by using the <link> element, like this: <link rel="
alternate" type="application/rss+xml" href="http://example.com/feed" /> adding the <a> while use of the html <link> element is powerful, it is mostly hidden. to advertise the rss feed in a more direct way, the html <a> element can be used. this mimics the <link> element discussed above. linking from the the html web page where the data in an rss feed is also contained makes the rss feed available...
...cation/rss+xml" href="http://example.com/feed" /> adding the <a> while use of the html <link> element is powerful, it is mostly hidden. to advertise the rss feed in a more direct way, the html <a> element can be used. this mimics the <link> element discussed above. linking from the the html web page where the data in an rss feed is also contained makes the rss feed available for use: <a rel="
alternate" type="application/rss+xml" href="http://example.com/feed">...</a> feed icons rss (and other) feeds use a special icon. it is recommended that you too use this icon when creating the special <a> link to your feed. the icon looks like the following: you can get more icons like this from feed icons. (other sizes and colors, along with their source files, are available too.) advanced...
.../rss+xml" href="http://example.com/feed">...</a> feed icons rss (and other) feeds use a special icon. it is recommended that you too use this icon when creating the special <a> link to your feed. the icon looks like the following: you can get more icons like this from feed icons. (other sizes and colors, along with their source files, are available too.) advanced syndication techniques
although this advanced technique for syndication is not required, support of this is recommended, especially for web sites and applications with high performance needs. the http protocol, one of the core technologies behind the web, provides a way of prioritizing the content type that an http client prefers to receive. this technique takes advantage by having the client prefer rss (over html or othe...
What is RSS - Archive of obsolete content
this page explains what rss is. you will not yet be creating your own rss files, but you will be seeing how rss is commonly used and simple example rss files for these common uses. you will also be getting a little history on rss. what is rss? the most popular versions of rss are xml-based markup languages used for syndication. (
although rdf-based rss formats exist, namely the deprecated rss 0.90 and rss 1.0.) common uses of rss syndication are for the syndication of news web sites, of blogs, of internet radio, and of internet television. this tutorial teaches rss 2.0, but makes an effort to point out issues with other versions of rss. rss is almost never written by hand; it is almost always created by server-side software (usually written in a language like php, java, c#, or pyth...
...l" so it remained only a draft, and never became a replacement for userland's rss 0.92. in august 2002 userland released a draft for rss 0.94. like rss 0.93, this version of rss was never made "final" and was also only a draft, and never became a replacement for userland's rss 0.92. so at this point we still had netscape's rss 0.91, the rss-dev working group's rss 1.0, and userland's rss 0.92. (
although some were using rss 0.93 and rss 0.94 even though they weren't supposed to.) in september 2002 userland released rss 2.0. rss 2.0 was meant to be a replacement for rss 0.92 (and the rss 0.93 and rss 0.94 drafts that no one was supposed to use). userland bumped up the version number all the way up to 2.0 because the rss-dev working group already used 1.0 with their rdf-based rss 1.0. so at ...
...erland bumped up the version number all the way up to 2.0 because the rss-dev working group already used 1.0 with their rdf-based rss 1.0. so at this point we had netscape's rss 0.91, the rss-dev working group's rss 1.0, and userland's rss 2.0. now, the story doesn't quite end there. in november 2002 and again in january 2003, rss 2.0 was changed from its original specification by userland. and
although these are each different, they all label themselves as rss 2.0 on the <rss> element. so now, at this point, we still have netscape's rss 0.91 (since netscape never deprecated it)
although most people don't use it anymore. most people use either the rdf-based rss 1.0 or the xml-based rss 2.0, with the xml-based rss 2.0 seeming to be the most popular. (this tutorial uses rss 2.0.) how rss is...
TCP/IP Security - Archive of obsolete content
curity, available from https://csrc.nist.gov/publications/nistpubs/.) the use of tls typically requires each application to support tls; however, unlike application layer controls, which typically involve extensive customization of the application, transport layer controls such as tls are much less intrusive because they do not need to understand the application’s functions or characteristics.
although using tls may require modifying some applications, tls is a well-tested protocol that has several implementations that have been added to many applications, so it is a relatively low-risk option compared to adding protection at the application layer. traditionally tls has been used to protect http-based communications and can be used with ssl portal vpns. network layer. controls at this l...
...rotecting ip information. nevertheless, in many cases, controls at another layer are better suited to providing protection than network layer controls. for example, if only one or two applications need protection, a network layer control may be excessive. transport layer protocols such as ssl are most commonly used to provide security for communications with individual http-based applications,
although they are also used to provide protection for communication sessions of other types of applications such as smtp, point of presence (pop), internet message access protocol (imap), and file transfer protocol (ftp). because all major web browsers include support for tls, users who wish to use web-based applications that are protected by tls normally do not need to install any client software o...
... key—a value known only to the two parties exchanging data. the data can only be decrypted by someone who has the secret key. integrity. ssl can determine if data has been changed (intentionally or unintentionally) during transit. the integrity of data can be assured by generating a message authentication code (mac) value, which is a keyed cryptographic checksum of the data. if the data is
altered and the mac is recalculated, the old and new macs will differ. peer authentication. each ssl endpoint can confirm the identity of the other ssl endpoint with which it wishes to communicate, ensuring that the network traffic and data is being sent from the expected host. ssl authentication is typically performed one-way, authenticating the server to the client, but it can be performed mutua...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
media.com/downloads/"> here.</a></p> </object> </object> web authors have to specify anobtainment mechanism in mozilla-based browsers -- the browser won't automatically retrieve plugins that are missing if you don't specify where to get the plugin from using the codebase attribute. ...
...adding an additional layer of convenience in the form of automatic retrieval is the subject of a bug 180411 in the mozilla open source code. ...
... <param name="sounds" value="1.au|2.au|3.au|4.au|5.au|6.au|7.au|8.au|9.au|0.au" /> <param name="pause" value="200" /> <p>you need the java plugin. get it from <a href="http://java.sun.com/products/plugin/index.html">here.</a></p> </object> the above code mentions a version specific mime type, and if the mozilla-based browser such as netscape 7 doesn't have jre 1.4.1_01 installed, the
alternate text is displayed. it isn't always necessary to give such a version specific mime type. if you aren't taking advantage of any version specific features, a more generic mime type such as application/x-java-vm will do the job just as well. the configuration parameters for the applet, including the class which contains the initial entry point (animator.class, referenced by the "code" param ele...
Anatomy of a video game - Game development
ew frame (while the previous frame is handled by the display). go through the list of requestanimationframe callbacks and invoke them. perform garbage collection and other per-frame tasks when the above callbacks stop controlling the main thread. sleep (unless an event interrupts the browser's nap) until the monitor is ready for your image (vsync) and repeat. you can think about developing re
altime applications as having a budget of time to do work. all of the above steps must take place every 16-and-a-half milliseconds to keep up with a 60 hz display. browsers invoke your code as early as possible to give it maximum computation time. your main thread will often start workloads that are not even on the main thread (such as rasterization or shaders in webgl). long calculations can be perf...
...kip rendering frames or interpolate extra ones depending on their performance. you can count on all users updating non-cosmetic variables at the same constant frequency minus hiccups. much more complicated to program than the basic loops we saw earlier. user input is completely ignored until the next update (even if the user has a fast device). the mandatory interpolation has a performance pen
alty. a separate update and draw method could look like the following example. for the sake of demonstration, the example is based on the third bullet point, just without using web workers for readability (and, let's be honest, writability). note: this example, specifically, is in need of technical review. /* * starting with the semicolon is in case whatever line of code above this example * re...
...k = mygame.lasttick + mygame.ticklength; // now lasttick is this tick. update( mygame.lasttick ); } } mygame.lasttick = performance.now(); mygame.lastrender = mygame.lasttick; // pretend the first draw was on first update. mygame.ticklength = 50; // this sets your simulation to run at 20hz (50ms) setinitialstate(); main(performance.now()); // start the cycle })(); another
alternative is to simply do certain things less often. if a portion of your update loop is difficult to compute but insensitive to time, you might consider scaling back its frequency and, ideally, spreading it out into chunks throughout that lengthened period. an implicit example of this is found over at the artillery blog for artillery games, where they adjust their rate of garbage generation to opt...
Index - Game development
ads, games, javascript, controllers that's it! we have successfully implemented gamepad controls in our game — try connecting any popular controller like the xbox 360 one and see for yourself how fun it is to avoid the asteroids and shoot the aliens with a gamepad. 32 desktop mouse and keyboard controls controls, desktop, games, javascript, keyboard, mouse ok, we've de
alt with touch, keyboard and mouse controls. now let's move on to look at how to set up the game to be controlled using a console gamepad, using the gamepad api. 33 mobile touch controls controls, games, javascript, mobile, pointer, touch that covers adding touch controls for mobile; in the next article we'll see how to add keyboard and mouse support. 34 unconventiona...
...game development, consisting of building the game world or level map out of small, regular-shaped images called tiles. this results in performance and memory usage gains — big image files containing entire level maps are not needed, as they are constructed by small images or image fragments multiple times. this set of articles covers the basics of creating tile maps using javascript and canvas (
although the same high level techniques could be used in any programming language.) 36 square tilemaps implementation: scrolling maps canvas, games, javascript, atlas, scrolling, spritesheet, tilemap, tiles this article covers how to implement scrolling square tilemaps using the canvas api. 37 square tilemaps implementation: static maps canvas, games, javascript, s...
... canvas, games, javascript, phaser, tutorial, bouncing now that physics have been introduced, we can start implementing collision detection into the game — first we'll look at the walls. 45 build the brick field 2d, beginner, canvas, games, javascript, phaser, tutorial building the brick field is a little bit more complicated than adding a single object to the screen,
although it's still easier with phaser than in pure javascript. let's explore how to create a group of bricks and print them on screen using a loop. 46 buttons 2d, beginner, buttons, canvas, games, javascript, phaser, tutorial instead of starting the game right away we can leave that decision to the player by adding a start button they can press. let's investigate how to do that.
Building up a basic demo with A-Frame - Game development
ese attributes can be manipulated to create the illusion of animation. rotation there's a special <a-animation> entity that can help us animate elements. add the <a-animation> element seen below to the <a-box> element as a child, as shown: <a-box color="#0095dd" rotation="20 40 0" position="0 1 0"> <a-animation attribute="rotation" from="20 0 0" to="20 360 0" direction="
alternate" dur="4000" repeat="indefinite" easing="ease"> </a-animation> </a-box> as with any other entities, you can define key properties for the animation. we'll be animating the rotation attribute from 20 0 0 to 20 360 0, so it will do a full spin. the animation direction is set to
alternate so the animation will be played forward, and then back. the duration is set to 4 seconds, a...
...om geometry like the torus, in much the same way. ...
...again, the animation is being repeated indefinitely. moving we could use the <a-animation> to change the position of the third shape, or we could use javascript instead. ...
Audio for Web games - Game development
t. however, preloading is still useful — without it, there would always need to be some client-server communication required before playing can commence. concurrent audio playback a requirement of many games is the need to play more than one piece of audio at the same time; for example, there might be background music playing along with sound effects for various things happening in the game.
although the situation is soon going to get better with the adoption of the web audio api, the current most widely-supported method — using the vanilla <audio> element — leads to patchy results on mobile devices. element — results in patchy results on mobile devices. testing and support here's a table that shows what mobile platforms support the features talked about above. mobile suppo...
... playback you may have some degree of success. note: concurrent audio playback is tested using our concurrent audio test example, where we attempt to play three pieces of audio at the same time using the standard audio api. note: simple autoplay functionality is tested with our autoplay test example. note: volume changeability is tested with our volume test example. mobile workarounds
although mobile browsers can present problems, there are ways to work around the issues detailed above. audio sprites audio sprites borrow their name from css sprites, which is a visual technique for using css with a single graphic resource to break it into a series of sprites. we can apply the same principle to audio so that rather than having a bunch of small audio files that take time to load an...
...h means it's now possible to write web-based games with native-quality audio for ios. as the web audio api allows precise timing and control of audio playback, we can use it to play samples at specific moments, which is a crucial immersive aspect of gaming. you want those explosions to be accompanied by a thundering boom, not followed by one, after all. background music with the web audio api
although we can use the <audio> element to deliver linear background music that doesn't change in reaction to the game environment, the web audio api is ideal for implementing a more dynamic musical experience. you may want music to change depending on whether you are trying to build suspense or encourage the player in some way. music is an important part of the gaming experience and depending on the...
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
they can log or keep statistics. what is important here is that by calling a safe method, the client doesn't request any server change itself, and therefore won't create an unnecessary load or burden for the server. ...
...they can log or keep statistics. what is important here is that by calling a safe method, the client doesn't request any server change itself, and therefore won't create an unnecessary load or burden for the server. ...
...d on-the-fly, as long as the generating script guarantees safety: it should not trigger external effects, like triggering an order in an e-commerce web site. it is the responsibility of the application on the server to implement the safe semantic correctly, the webserver itself, being apache, nginx or iis, can't enforce it by itself. in particular, an application should not allow get requests to
alter its state. a call to a safe method, not changing the state for the server: get /pagex.html http/1.1 a call to a non-safe method, that may change the state of the server: post /pagex.html http/1.1 a call to an idempotent but non-safe method: delete /idx/delete http/1.1 learn more general knowledge definition of safe in the http specification. technical knowledge description of ...
WAI-ARIA basics - Learn web development
d 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">. as an example, you could use aria-labelledby to specify that a key description contained in a <div> is the label for multiple table cells, or you could use it as an
alternative to image
alt text — specify existing information on the page as an image's
alt text, rather than having to repeat it inside the
alt attribute. you can see an example of this at text
alternatives. states — special properties that define the current conditions of elements, such as aria-disabled="true", which specifies to a screenreader that a form input is currently disabled. states di...
...don't change throughout the lifecycle of an app, whereas states can change, generally programmatically via javascript. an important point about wai-aria attributes is that they don't affect anything about the web page, except for the information exposed by the browser's accessibility apis (where screenreaders get their information from). wai-aria doesn't affect webpage structure, the dom, etc.,
although the attributes can be useful for selecting elements by css. note: you can find a useful list of all the aria roles and their uses, with links to futher information, in the wai-aria spec — see definition of roles. the spec also contains a list of all the properties and states, with links to further information — see definitions of states and properties (all aria-* attributes). where ...
...ond the semantics available in html5. you'll see a lot more about these semantics and the power of aria properties/attributes below, especially in the accessibility of non-semantic controls section. for now though, let's look at how aria can help with dynamic content updates. dynamic content updates content loaded into the dom can be easily accessed using a screenreader, from textual content to
alternative text attached to images. traditional static websites with largely text content are therefore easy to make accessible for people with visual impairments. the problem is that modern web apps are often not just static text — they tend to have a lot of dynamically updating content, i.e. content that updates without the entire page reloading via a mechanism like xmlhttprequest, fetch, or do...
Positioning - Learn web development
s. we'd like you to follow along with the exercises on your local computer, if possible — grab a copy of 0_basic-flow.html from our github repo (source code here) and use that as a starting point. introducing positioning the whole idea of positioning is to allow us to override the basic document flow behavior described above, to produce interesting effects. what if you want to slightly
alter the position of some boxes inside a layout from their default layout flow position, to give a slightly quirky, distressed feel? positioning is your tool. or if you want to create a ui element that floats over the top of other parts of the page, and/or always sits in the same place inside the browser window no matter how much the page is scrolled? positioning makes such layout work possible. th...
...px; border-radius: 5px; } .positioned { position: sticky; top: 30px; left: 30px; } an interesting and common use of position: sticky is to create a scrolling index page where different headings stick to the top of the page as they reach it. ...
...ground-color: black; color: white; padding: 10px; position: sticky; top: 0; left: 0; margin: 1em 0; } body { width: 500px; height: 1400px; margin: 0 auto; } dt { background-color: black; color: white; padding: 10px; position: sticky; top: 0; left: 0; margin: 1em 0; } <h1>sticky positioning</h1> <dl> <dt>a</dt> <dd>apple</dd> <dd>ant</dd> <dd>
altimeter</dd> <dd>airplane</dd> <dt>b</dt> <dd>bird</dd> <dd>buzzard</dd> <dd>bee</dd> <dd>banana</dd> <dd>beanstalk</dd> <dt>c</dt> <dd>calculator</dd> <dd>cane</dd> <dd>camera</dd> <dd>camel</dd> <dt>d</dt> <dd>duck</dd> <dd>dime</dd> <dd>dipstick</dd> <dd>drone</dd> <dt>e</dt> <dd>egg</dd> <dd>elephant</dd> <dd>eg...
Supporting older browsers - Learn web development
ten very worried about the experience of 1% of users in an old version of internet explorer, while not considering at all the far greater number who have accessibility needs. what is the support for the features you want to use? once you know the browsers that come to your site, you can assess any technology that you want to use against how well it is supported and how easily you can provide an
alternative for visitors who do not have that technology available. we are trying to make this easy for you at mdn, by providing browser compatibility information on each page detailing a css property. for example, take a look at the page for grid-template-columns. at the bottom of this page is a table, which lists major browsers along with the version they began supporting this property. another ...
... created to fix up the table structure are not created. multiple-column layout for certain layouts you could use multi-col as a fallback, if your container has any of the column-* properties defined on it and then becomes a grid container, the multicol behaviour will not happen. flexbox as a fallback for grid flexbox has greater browser support than grid due to being supported by ie10 and 11,
although do check out the information later in this lesson explaining the rather patchy and confusing support for flexbox in older browsers. if you make a flex container into a grid container, any flex property applied to the children will be ignored. for many layout tweaks in older browsers, you may find you can give a decent experience by using css in this way. we add a simpler layout based on ol...
... and tutorials in existence; this useful guide helps you check what you are looking at and can also help if you need flex support in very old browsers. the ie10 and 11 prefixed version of grid the css grid specification was initially prototyped in internet explorer 10; this means that while ie10 and ie11 do not have modern grid support, they do have a version of grid layout that is very usable,
although different to the modern specification documented on this site. the ie10 and 11 implementations is -ms- prefixed, which means you can use it for these browsers and it will be ignored by non-microsoft browsers. edge does still understand the old syntax, however, so take care that everything is safely overwritten in your modern grid css. the guide to progressive enhancement in grid layout can...
How CSS is structured - Learn web development
xample, perhaps you're working with a content management system where you are blocked from modifying external css files. but for sites with more than one page, an internal stylesheet becomes a less efficient way of working. to apply uniform css styling to multiple pages using internal stylesheets, you must have an internal stylesheet in every web page that will use the styling. the efficiency pen
alty carries over to site maintenance too. with css in internal stylesheets, there is the risk that even one simple styling change may require edits to multiple web pages. inline styles inline styles are css declarations that affect a single html element, contained within a style attribute. the implementation of an inline style in an html document might look like this: <!doctype html> <html> <he...
...8"> <title>my css experiments</title> <link rel="stylesheet" href="styles.css"> </head> <body> <p>create your test html here</p> </body> </html> styles.css: /* create your test css here */ p { color: red; } when you find css that you want to experiment with, replace the html <body> contents with some html to style, and then add your test css code to your css file. as an
altenative, you can also use the interactive editor below. read on and have fun! selectors a selector targets html to apply styles to content. we have already discovered a variety of selectors in the getting started with css tutorial. if css is not applying to content as-expected, your selector may not match the way you think it should match. each css rule starts with a selector—or a list of...
...% helvetica, arial, sans-serif; padding: 1em; margin: 0 auto; max-width: 33em; } @media (min-width: 70em) { body { font-size: 130%; } } h1 { font-size: 1.5em; } div p, #id:first-line { background-color: red; border-radius: 3px; } div p { margin: 0; padding: 1em; } div p + p { padding-top: 0; } the next example shows the equivalent css in a more compressed format.
although the two examples work the same, the one below is more difficult to read. body {font: 1em/150% helvetica, arial, sans-serif; padding: 1em; margin: 0 auto; max-width: 33em;} @media (min-width: 70em) { body {font-size: 130%;} } h1 {font-size: 1.5em;} div p, #id:first-line {background-color: red; border-radius: 3px;} div p {margin: 0; padding: 1em;} div p + p {padding-top: 0;} for your own ...
HTML forms in legacy browsers - Learn web development
f css one of the big issues with html forms is styling form widgets with css. form controls appearance is browser and operating system specific. for example, the input of color type looks different in safari, chrome and firefox browser, but the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker. it's generally a good idea to not
alter the default appearance of form control because
altering one css property value may
alter some input types but not others. for example, if you declare input { font-size: 2rem; }, it will impact number, date, and text, but not color or range. if you
alter a property, that may impact the appearance of the widget in unexpected ways. for example, [value] { background-color: #ccc; } may have been use...
...don't. as you can see from the complexity of the property compatibility table for form widgets article, it's very difficult. even if it's still possible to do a few adjustments on text elements (such as sizing or font color), there are always side effects. the best approach remains to not style html form widgets at all. but you can still apply styles to all the surrounding items. and, if you must
alter the default styles of your form widgets, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. you can also investigate some hard techniques such as rebuilding widgets with javascript. but in that case, do not hesitate to charge your client for such foolishness. feature detection and polyfills css and javascript are awesome technologies, ...
...erience than having exactly the same functionality in all browsers. as a last reminder, just always think about the end users. conclusion as you can see, considering browser and operating system default form control appearance is important. there are many techniques to handle these issue; however mastering all of them is beyond the scope of this article. the basic premise is to consider whether
altering the default implemenation is worth the work before embarking on the challenge. if you read all the articles of this html forms guide, you should now be at ease with using forms. ...
JavaScript basics - Learn web development
te: the reason the instructions (above) place the <script> element near the bottom of the html file is that the browser reads code in the order it appears in the file. if the javascript loads first and it is supposed to affect the html that hasn't loaded yet, there could be problems. placing javascript near the bottom of an html page is one way to accommodate this dependency. to learn more about
alternative approaches, see script loading strategies. what happened? the heading text changed to hello world! using javascript. you did this by using a function called queryselector() to grab a reference to your heading, and then store it in a variable called myheading. this is similar to what we did using css selectors. when you want to do something to an element, you need to select it first. f...
... see if the two are equal. if this comparison returns true, the first block of code runs. if the comparison is not true, the second block of code—after the else statement—runs instead. functions functions are a way of packaging functionality that you wish to reuse. it's possible to define a body of code as a function that executes when you call the function name in your code. this is a good
alternative to repeatedly writing the same code. you have already seen some uses of functions previously. for example: let myvariable = document.queryselector('h1'); alert('hello!'); these functions, document.queryselector and alert, are built into the browser. if you see something which looks like a variable name, but it's followed by parentheses— () —it is likely a function. fu...
...ctor('html').onclick = function() {}; is equivalent to let myhtml = document.queryselector('html'); myhtml.onclick = function() {}; it's just shorter. supercharging our example website with this review of javascript basics completed (above), let's add some new features to our example site. adding an image changer in this section, you will learn how to use javascript and dom api features to
alternate the display of one of two images. this change will happen as a user clicks the displayed image. choose an image you want to feature on your example site. ideally, the image will be the same size as the image you added previously, or as close as possible. save this image in your images folder. rename the image firefox2.png. add the javascript below to your main.js file. (also delete yo...
Define terms with HTML - Learn web development
an operate on all abbreviations uniformly. just as with any new keyword, you should define your abbreviations the first time they occur. <p> <dfn><abbr>html</abbr> (hypertext markup language)</dfn> is a description language used to structure documents on the web. </p> the html spec does indeed set aside the title attribute for expanding the abbreviation. however, this is not an acceptable
alternative for providing an inline expansion. the contents of title are completely hidden from your users, unless they're using a mouse and they happen to hover over the abbreviation. the spec duly acknowledges this as well. improve accessibility <dfn> marks the keyword defined, and indicates that the current paragraph defines the keyword. in other words, there's an implicit relationship between ...
... the whole paragraph, you can use the aria-describedby attribute to associate a term more formally with its definition: <p> <span id="ff"> <dfn aria-describedby="ff">firefox</dfn> is the web browser created by the mozilla foundation. </span> you can download it at <a href="http://www.mozilla.org">mozilla.org</a> </p> assistive technology can often use this attribute to find a text
alternative to a given term. you can use aria-describedby on any tag enclosing a keyword to be defined (not just the <dfn> element). aria-describedby references the id of the element containing the description. how to build a description list description lists are just what they claim to be: a list of terms and their matching descriptions (e.g., definition lists, dictionary entries, faqs, and key-v...
...ng description follows immediately, contained within one or more <dd> elements. enclose the whole description list with a <dl> element. a simple example here's a simple example describing kinds of food and drink: <dl> <dt>jambalaya</dt> <dd> rice-based entree typically containing chicken, sausage, seafood, and spices </dd> <dt>sukiyaki</dt> <dd> japanese speci
alty consisting of thinly sliced meat, vegetables, and noodles, cooked in sake and soy sauce </dd> <dt>chianti</dt> <dd> dry italian red wine originating in tuscany </dd> </dl> the basic pattern, as you can see, is to
alternate <dt> terms with <dd> descriptions. if two or more terms occur in a row, the following description applies to all of them. if two or more descript...
HTML text fundamentals - Learn web development
d to make sure we are using the correct elements, giving our content the correct meaning, function, or appearance. in this context the <h1> element is also a semantic element, which gives the text it wraps around the role (or meaning) of "a top level heading on your page." <h1>this is a top level heading</h1> by default, the browser will give it a large font size to make it look like a heading (
although you could style it to look like anything you wanted using css). more importantly, its semantic value will be used in multiple ways, for example by search engines and screen readers (as mentioned above). on the other hand, you could make any element look like a top level heading. consider the following: <span style="font-size: 32px; margin: 21px 0; display: block;">is this a top level headi...
...all the ingredients into a paste. <ul> <li>if you want a coarse "chunky" hummus, process it for a short time.</li> <li>if you want a smooth hummus, process it for a longer time.</li> </ul> </li> </ol> try going back to the previous active learning example and updating the second list like this. ...
...similarly, in written language we tend to stress words by putting them in italics. for example, the following two sentences have different meanings. i am glad you weren't late. i am glad you weren't late. the first sentence sounds genuinely relieved that the person wasn't late. ...
Adding vector graphics to the Web - Learn web development
he different ways in which you can add svg vector graphics to your web pages. the quick way: <img> to embed an svg via an <img> element, you just need to reference it in the src attribute as you'd expect. you will need a height or a width attribute (or both if your svg has no inherent aspect ratio). if you have not already done so, please read images in html. <img src="equilateral.svg"
alt="triangle with all three sides equal" height="87" width="100" /> pros quick, familiar image syntax with built-in text equivalent available in the
alt attribute. you can make the image into a hyperlink easily by nesting the <img> inside an <a> element. the svg file can be cached by the browser, resulting in faster loading times for any page that uses the image loaded in the future. ...
...ubleshooting and cross-browser support for browsers that don't support svg (ie 8 and below, android 2.3 and below), you could reference a png or jpg from your src attribute and use a srcset attribute (which only recent browsers recognize) to reference the svg. this being the case, only supporting browsers will load the svg — older browsers will load the png instead: <img src="equilateral.png"
alt="triangle with equal sides" srcset="equilateral.svg"> you can also use svgs as css background images, as shown below. in the below code, older browsers will stick with the png that they understand, while newer browsers will load the svg: background: url("fallback.png") no-repeat center; background-image: url("image.svg"); background-size: contain; like the <img> method described above, inserti...
...while, just to support obsolescent browsers. how to embed an svg with an <iframe> you can open svg images in your browser just like webpages. so embedding an svg document with an <iframe> is done just like we studied in from <object> to <iframe> — other embedding technologies. here's a quick review: <iframe src="triangle.svg" width="500" height="500" sandbox> <img src="triangle.png"
alt="triangle with three unequal sides" /> </iframe> this is definitely not the best method to choose: cons iframes do have a fallback mechanism, as you can see, but browsers only display the fallback if they lack support for iframes
altogether. moreover, unless the svg and your current webpage have the same origin, you cannot use javascript on your main webpage to manipulate the svg. active ...
From object to iframe — other embedding technologies - Learn web development
someone else made it, assume it's dangerous until proven otherwise." besides security, you should also be aware of intellectual property issues. most content is copyrighted, offline and online, even content you might not expect (for example, most images on wikimedia commons). never display content on your webpage unless you own it or the owners have given you written, unequivocal permission. pen
alties for copyright infringement are severe. again, you can never be too cautious. if the content is licensed, you must obey the license terms. for example, the content on mdn is licensed under cc-by-sa. that means, you must credit us properly when you quote our content, even if you make substantial changes. use https https is the encrypted version of http. you should serve your websites using h...
... if you make substantial changes. use https https is the encrypted version of http. you should serve your websites using https whenever possible: https reduces the chance that remote content has been tampered with in transit, https prevents embedded content from accessing content in your parent document, and vice versa. using https requires a security certificate, which can be expensive (
although let's encrypt makes things easier) — if you can't get one, you may serve your parent document with http. however, because of the second benefit of https above, no matter what the cost, you must never embed third-party content with http. (in the best case scenario, your user's web browser will give them a scary warning.) all reputable companies that make content available for embedding via ...
...ons back one by one (inside the sandbox="" attribute value) — see the sandbox reference entry for all the available options. one important note is that you should never add both allow-scripts and allow-same-origin to your sandbox attribute — in that case, the embedded content could bypass the same-origin policy that stops sites from executing scripts, and use javascript to turn off sandboxing
altogether. note: sandboxing provides no protection if attackers can fool people into visiting malicious content directly (outside an iframe). if there's any chance that certain content may be malicious (e.g., user-generated content), please serve it from a different domain to your main site. configure csp directives csp stands for content security policy and provides a set of http headers (meta...
Aprender y obtener ayuda - Learn web development
er to jump straight in and start playing with code. this is also a reasonable approach, and some learning sites tend to favor it. codecademy for example is a learning site where the tutorials mainly consist of interactive code editors where you have to directly write code and see if the desired result was achieved. many mdn web docs reference pages provide interactive examples too, where you can
alter the code and see how the live result changes. and there is also nothing wrong with creating your own code examples on your computer, or in an online code editor like jsbin, codepen, or glitch. in fact, you'll be called to do so as part of this course when you are learning! note: online code editors are also really useful for sharing code you've written, for example, if you are collaborating o...
... diffuse learning you do in that time can often help you to figure out a solution to the problem you were facing. it is also physically bad to work for too long without a break — looking at a monitor for too long can hurt your eyes, and sitting still for too long can be bad for your back or legs. we'd recommend taking a 15 minutes break every hour to 90 minutes. eat, exercise, and sleep. eat he
althily, get regular exercise, and make sure you get enough sleep. this sounds obvious, but it is easy to forget when you get really into coding. factor these essential ingredients into your schedule, and make sure you are not doing your learning time instead of these things. give yourself rewards. it's true that all work and no play makes jack a dull boy. you should try to schedule fun things to do...
... if your problem is affecting all browsers, or whether it only occurs in one or a small number of browsers. if it is only affecting one browser, for example, you can use that browser to narrow down the search. example searches might look like: <video> playback doesn't work in the ios browser. firefox doesn't seem to support the beetlejuice api. using mdn the site you are already on has a we
alth of information available to you — both reference material for looking up code syntax, and guides/tutorials for learning techniques. we've provided most of the answers to the questions you'll have about web development fundamentals in this part of mdn. if you are stuck, then it is good to re-read the associated articles to see if you missed anything. if you are not sure which article to read,...
Deploying our app - Learn web development
ed to actually deploy) it's possible to deploy during development to either share work in progress or to have a pre-release for some other purpose. 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.
although netlify offers a drag and drop deployment service, we are intending to trigger a new deployment to netlify each time we push to a github repo. it's exactly these kinds of connected services that we would encourage you to look for when deciding on your own build toolchain. we can commit our code and push to github and the updated code will automatically trigger the entire build routine. if a...
...e git add . command is a bit of a sledgehammer approach — it will add all local changes you’ve worked on in one go. if you want finer control over what you add, then use git add -p for an interactive process, or add individual files using git add path/to/file. now all the code is staged, we can commit; run the following command: git commit -m ’committing initial code’ note:
although you're free to write whatever you wish in the commit message, there's some useful tips around the web on good commit messages. keep them short, concise, and descriptive, so they clearly describe what the change does. finally the code needs to be pushed to your github hosted repository. let's do that now. over at github, visit https://github.com/new and create your own repositor...
...and ensure it's in the correct format. if not, the test will fail and will prevent the project from going live. to do anything else would be beyond the scope of this module — testing is a huge subject that really requires its own separate module. we are hoping that this section will at least make you aware of the need for testing, and will plant the seed that inspires you to go and learn more.
although the test for this project does not include a test framework, as with all things in the front-end development world, there are a slew of framework options. the test itself isn't what is important. what is important is how the failure or success is handled. some deployment platforms will include a specific method for testing as part of their pipeline. products like github, gitlab, etc., all s...
Introducing a complete toolchain - Learn web development
such as a way to backup your work in a remote place, and a mechanism to work in a team on the same project without fear of overwriting each other's code. it might be obvious to some, but it bears repeating: git is not the same thing as github. git is the revision control tool, whereas github is an online store for git repositories (plus a number of useful tools for working with them). note that,
although we're using github in this chapter, there are several
alternatives including gitlab and bitbucket, and you could even host your own git repositories. using revision control in your projects and including it as part of the toolchain will help manage the evolution of your code. it offers a way to "commit" blocks of work as you progress, along with comments such as "x new feature implemented",...
...e commands from the command line in one go, such as npm run tidy-code. using special "git hooks" to test if the code is formatted before a commit. using code editor plugins to run prettier commands each time a file is saved. note: what is a git hook? git (not github) provides a system that lets us attach pre- and post- actions to the tasks you perform with git (such as committing your code).
although git hooks can be a bit overly complicated (in this author's opinion), once they're in place they can be very powerful. if you're interested in using hooks, husky is a greatly simplified route into using hooks. for vs code, one useful extension is the prettier code formatter by esben petersen, which lets vscode automatically format code upon saving. this means that any file in the project w...
...low these steps: add a single file called .postcssrc to the root of your project directory. add the following contents to the new file, which will automagically give us full access to the latest css features: { "plugins": { "postcss-preset-env": { "stage": 0 } } } that’s all we need to do — remember that parcel installs the dependencies for us by default!
although this stage of our toolchain can be quite painful, because we've chosen a tool that purposely tries to reduce configuration and complexity, there's really nothing more we need to do during the development phase. modules are correctly imported, nested css is correctly transformed to "regular css", and our development is unimpeded by the build process. now our software is ready to be written! ...
Accessibility API cross-reference
, or general types, such as button, menu item, text, etc. they also define a list of possible object states, such as focused, read-only, checked, etc. an interesting problem is that mozilla, safari/khtml, opera, staroffice and other apps are cross-platform, but there is currently no cross-platform accessibility api. the ipc mechanisms used by current generation api's are also not cross-platform,
although communication for some cross-platform accessibility api of the future could be done through sockets. these tables describe how various accessibility apis define possible roles of an object, and states. all accessibility apis to date define a list of possible object roles, or general types, such as button, menu item, text, etc. they also define a list of possible object states, such as focus...
...., tooltips may be drawn on the glass pane layer. glass_pane glass_pane n/a multiple adjacent panes that can be sized relative to each other by dragging a grippy on their border split_pane split_pane n/a an object that can be drawn into and is used to trap events. ...
... children. n/a expandable expandable implied by the presence of the aria-expanded attribute, regardless of value can extend selection extselectable n/a n/a not clipped to boundary of parent, does not auto-move with parent floating n/a n/a identifies the next element (or elements) in an
alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order. very poor support in user agents and ats, and no sufficient techniques available n/a n/a aria-flowto indicates the availability and type of interactive popup element, such as menu or dialog, that can ...
How Mozilla's build system works
rator writes out makefiles. when config.status runs, you'll see the following output: reticulating splines... finished reading 1096 moz.build files into 1276 descriptors in 2.40s backend executed in 2.39s 2188 total backend files. 0 created; 1 updated; 2187 unchanged total wall time: 5.03s; cpu time: 3.79s; efficiency: 75% what this is saying is that a total of 1,096 moz.build files were read.
altogether, 1,276 data structures describing the build configuration were derived from them. it took 2.40s wall time just to read these files and produce the data structures. the 1,276 data structures were fed into the build backend, which then determined it had to manage 2,188 files derived from those data structures. most of the files already existed and didn't need to be changed. however, one was ...
...tadataemitter is then fed into a build backend. a build backend is simply an instance of a child class of a buildbackend from base.py (in the mozbuild.backend package now, not mozbuild.frontend). the child class implements methods for processing individual class instances as well as common hook points, such as processing has finished. see recursivemake.py for an implementation of a buildbackend.
although we call the base class buildbackend, the class doesn't need to be focused with building at all. if you wanted to create a consumer that performed a line count of all c++ files or generated a clang compilation database, for example, this would be an acceptable use of a buildbackend. technically, we don't need to feed the treemetadataemitter output into a buildbackend: it's possible to create...
...ile to package jars. below is an example: depth = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk include $(topsrcdir)/config/rules.mk as you can see, there are no extra variables to define. if a jar.mn file exists in the same directory as this makefile.in, it will automatically be processed.
although the common practice is to have a resources directory that contains the jar.mn and chrome files, you may also put a jar.mn file in a directory that creates a library, in which case it will be processed. related links see the glossary of makefile variables for information about specific variables and how to use them. original document information author: brian ryner copyright informati...
Eclipse CDT Manual Setup
w taken care of by the mach project generation code. for now it's stored here until that integration happens in order that the eclipse cdt page isn't hugely cluttered with mostly redundant information, make setting up eclipse look much more complicated than it is nowadays. 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). some of it like the section on building the index and usage tips are still relevant, and other parts still may provide useful background information to understand it in more detail on how eclipse works. you can expect it to take an hour or so to work through these instructions if you're doing so for the first time. (this as...
..."build automatically" in "c/c++ > indexer", disable "automatically update the index" turning off automatic indexing prevents the cpu intensive indexer from running at various stages during the steps below before we're ready. select "general > content types", expand "text > c source file > c++ source file", click "add" and add "*.mm". eclipse cdt doesn't currently understand objective-c files (
although there is a project that promises to add objective-c support), so for now, this is the best we can do to give eclipse a chance of expanding its understanding of the source into the objective-c files. select "general > editors > text editors". if you want line numbers, tick "show line numbers". if you want a column marker to mark the 80th column to help with formatting code to mozilla's 80 ch...
...ation for the source files by processing a build log from a full, clean build made using -j1 -w. since such a non-parallel, full build would take a very long time, we're going to cheat and set eclipse's "build" action to run jwatt's just-print-mozilla-build.py script instead. this script will complete in about 30 seconds on a warm tree (files cached in ram) if your object directory is up to date,
although eclipse will take several minutes to process the "build output" that it produces. download just-print-mozilla-build.py and change its permissions to make it executable ('chmod a+x just-print-mozilla-build.py'). if you don't put just-print-mozilla-build.py somewhere in your path, then go back to the initial project properties section where you set just-print-mozilla-build.py and specify its...
SVG Guidelines
luding: the typical "created with editor" comments non-standard editor specific tags and attributes (sketch:foo, illustrator:foo, sopodi:foo, …) the xml namespace definition that comes with the latter (xmlns:sketch, xmlns:sopodi, …) other metadata in addition to non-standard editor metadata, standard compliant metadata also exists. typical examples of this are <title> and <desc> tags.
although this kind of data is supported by the browser, it can only be displayed when the svg is opened in a new tab. plus, in most of the cases, the filename is quite descriptive so it's recommended to remove that kind of metadata since it doesn't bring much value. you shouldn't include doctypes in your svgs either; they are a source of many issues, and the svg wg recommends not to include them. se...
.... tools tools can help to clean svg files. note, however that some of the rules stated above can be hard to detect with automated tools since they require too much context-awareness. to this date, there doesn't seem to be a tool that handles all of the above. ...
... of the above. ...
mach
hat. if the mozconfig environment variable is set, use the file pointed to in that variable. if the current working directory mach is invoked with is inside an object directory, the mozconfig used when creating that object directory is used. the default mozconfig search logic is applied. here are some examples: # use an explicit mozconfig file. $ mozconfig=/path/to/mozconfig ./mach build #
alternatively (for persistent mozconfig usage): $ export mozconfig=/path/to/mozconfig $ ./mach build # let's pretend the mozconfig environment variable isn't set. this will use # the mozconfig from the object directory. $ cd objdir-firefox $ mach build adding mach to your shell's search path if you add mach to your path (by modifying the path environment variable to include your source directory, ...
...ryptic error message) - in the former case, people don't need to discover your tool from a blog post, wiki page, or word of mouth). so this 3rd point does not make much sense, does it? are there any known issues? yes, of course several! mach is still relatively young ("born" in 2012) and there are a number of bugs and numerous areas for improvement. some larger known issues include: mintty (
alternative terminal emulator on windows) doesn't work. text encoding issues (especially on windows where latin-1 is not the default system encoding). failed commands spew lots of extra error output, e.g. you will see a big mach error message when all that happened was an invoked command returned a non-0 exit code - possibly expectedly so in mozilla! generally, mach is known to work pretty well w...
...enting a mach command for it. some other cases where you should consider implementing something as a mach command: when your tool is a random script in the tree. random scripts are hard to find and may not conform to coding conventions or best practices. mach provides a framework in which your tool can live that will put it in a better position to succeed than if it were on its own. when the
alternative is a make target. the build team generally does not like one-off make targets that aren't part of building (read: compiling) the tree. this includes things related to testing and packaging. these weigh down make files and add to the burden of maintaining the build system. instead, you are encouraged to implement ancillary functionality in not make (preferably python). if you do implement ...
Cross Process Object Wrappers
e blocked by the content process, then a slow content process could cause firefox to become unresponsive to users. converting synchronous code to be asynchronous can be difficult and time-consuming. as a migration aid, the messaging framework enables frame scripts to make content objects available to chrome through a wrapper called a cross process object wrapper, also known as a cpow. however,
although cpows are convenient, they have serious limitations and can cause responsiveness problems, so should only be used when necessary and only as a migration aid. passing cpows from frame scripts frame scripts can send messages to chrome using one of two global functions: sendasyncmessage() or sendsyncmessage(). the optional third parameter to each of these functions is an object whose properti...
...s a common pattern is to get the xul <browser> that corresponds to a content document. to enable this, gbrowser.getbrowserfordocument and gbrowser.getbrowserforcontentwindow can be passed a cpow for the content document and content window, respectively, and return the xul <browser> that these documents / windows belong to. both return null if no such browser can be found. limitations of cpows
although cpows can be convenient they have several major limitations, which are listed below. cpows and platform apis you can't pass cpows into platform apis that expect to receive dom objects. for example, you can't pass a cpow into nsifocusmanager.setfocus(). also, from firefox 47 onwards, browser code can no longer perform unsafe cpow operations. this means that as an add-on developer, you shou...
...iveness the lack of a synchronous api on the chrome side is intentional: because the chrome process runs the firefox ui, any responsiveness problems affect the whole browser. by making the chrome process block on the content process, cpows break this principle and allow unresponsive content process to make the whole browser unresponsive. see safe and unsafe cpows for more on this. performance
although the wrapper looks just like an object completely contained in the chrome script scope, it's really just a reference to an object in the content process. when you access a property of the wrapper, it sends a synchronous message to the content process and returns the result. this means it is many times slower to use than an object. message ordering cpows can violate assumptions you might mak...
Embedding Tips
call the loaduri method with the appropriate uri and flags. this interface also has methods for reloading, stopping a load and going back and forward in the history. how do i block a load? implement the nsiwebprogresslistener interface and register it with the appropriate web browser object via the nsiwebbrowser::addwebbrowserlistener() method. use the callbacks for after-the-fact cancellation.
alternatively, implement a nsiuricontentlistener as described below. how do i watch/intercept a load before it happens? implement the nsiuricontentlistener interface, and register it with the appropriate web browser object via the nsiwebbrowser::parenturicontentlistener attribute. watch for changes in nsiuricontentlistener::onstarturiopen(). you can abort the uri load at this point if you don't wan...
...ontent type. how do i copy items to the clipboard? obtain the nsiclipboardcommands interface from the appropriate web browser object via nsiserviceprovider::getinterface (or the do_getinterface() helper method). how do i save a document or data to disk? query for the nsiwebbrowserpersist interface implemented on the web browser object and call the saveuri() or savedocument() methods on that.
alternatively, create a standalone webbrowser persist object and call the nsiwebbrowserpersist interface on that to save uris and documents. this is recommended if you intend anything other than the uri or document your browser is looking at. register your own nsiwebprogresslistener object to listen for progress and state notifications. how do i save / upload a document / data to a web or ftp site? ...
...script constructor instead of a javascript property: catman->addcategoryentry("javascript global constructor", "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(previous)); that way you will be able to do: var my_comp = new my_prop_name(); this was taken from weirdal's excellent "burning chrome" article. how do i specify
alternate locations for profiles? specify a profile directory in your implementation of nsidirectoryserviceprovider passed to xre_initembedding. use xre_notifyprofile to make gecko actually use a profile location. how do i change the user agent string? the default useragent is set using the value from your application.ini/nsxreappdata. you can override this default using the "general.useragent.ove...
How to get a stacktrace for a bug report
if you file a bug report in bugzilla about a crash you should include a stacktrace (call stack) in your report. a stacktrace will tell mozilla developers what crashed and provide a starting point for investigating its cause. this article describes how to use the mozilla crash reporter (breakpad) to get a crash id, which our engineers can use to get a stacktrace, and
alternative ways to get a stacktrace if you can't get a crash id. requirements you need a binary build of firefox from mozilla.org. seamonkey and thunderbird also support crash reporting. mozilla's crash report server currently only has debug information for mozilla builds and thus the crash reporter cannot work if you use a build from a linux distribution or if you compile from source code. in these cases you will need...
...an't get a crash id. requirements you need a binary build of firefox from mozilla.org. seamonkey and thunderbird also support crash reporting. mozilla's crash report server currently only has debug information for mozilla builds and thus the crash reporter cannot work if you use a build from a linux distribution or if you compile from source code. in these cases you will need to use one of the
alternative methods listed below. note: when filing a crash report, it is important to know whether the crash occurs with firefox safe mode. this helps engineers determine whether a particular extension or plugin is the cause of the crash. how to get a crash id with the mozilla crash reporter 1. crash and submit a report to the system. the mozilla crash reporter window should au...
...n your operating system: windows : %appdata%\mozilla\firefox\crash reports\submitted\ os x : ~/library/application support/firefox/crash reports/submitted/ linux : ~/.mozilla/firefox/crash reports/submitted/ each file in this folder contains one submitted crash report id. you can check the modified or creation time for each file to discern which crash reports are relevant to your bug report.
alternative ways to get a stacktrace if the mozilla crash reporter doesn't come up or isn't available you will need to obtain a stacktrace manually: windows see the article create a stacktrace with windbg for information on how to do this. for a full process dump, see how to get a process dump with windows task manager [en-us] os x run /applications/utilities/console.app. expand "~/library/log...
Downloads.jsm
methods createdownload() creates a new download object. promise<download> createdownload( object aproperties ); parameters aproperties provides the initial properties for the newly created download. this matches the serializable representation of a download object. some of the most common properties in this object include: source: string containing the uri for the download source.
alternatively, may be an nsiuri, a downloadsource object, or an object with the following properties: url: string containing the uri for the download source. isprivate: optional indicates whether the download originated from a private window. if omitted, the download is public. referrer: optional string containing the referrer uri of the download source. can be omitted or null if no r...
...aining the uri for the download source. isprivate: optional indicates whether the download originated from a private window. if omitted, the download is public. referrer: optional string containing the referrer uri of the download source. can be omitted or null if no referrer should be sent or the download source is not http. target: string containing the path of the target file.
alternatively, may be an nsifile, a downloadtarget object, or an object with the following properties: path: string containing the path of the target file. saver: optional string representing the class of the download operation. if omitted, defaults to "copy".
alternatively, may be the serializable representation of a downloadsaver object. promise resolves to the newly created...
...o cancel or restart the download programmatically. for that, you should obtain a reference to a download object using the createdownload() function. since the download cannot be restarted, any partially downloaded data will not be kept in case the download fails. promise fetch( asource, atarget, object aoptions ); parameters asource string containing the uri for the download source.
alternatively, may be an nsiuri or a downloadsource object. atarget string containing the path of the target file.
alternatively, may be an nsifile or a downloadtarget object. aoptions optional an optional object used to control the behavior of this function. you may pass an object with a subset of the following fields: isprivate: optional indicates whether the download originated from a priv...
source-editor.jsm
represent the default values for each of the available configuration options. see the editor configuration object for details on configuring the editor. ...
...the context menu. expandtab boolean a boolean value indicating whether or not tab characters should be expanded out to spaces. this value is overridden by the user preference named by sourceeditor.prefs.expand_tab. highlightcurrentline boolean a boolean value indicating whether or not to highlight the line on which the text caret is currently located. initi
altext string the default initial text to be in the editor when it's created. by default, this is the empty string, indicating there should be no text on startup. keys array an array of objects defining custom keyboard bindings. see xxxxx for details. mode string a string indicating the default syntax highlighting mode; by default, the content is assumed to be pl...
...dings. see xxxxx for details. mode string a string indicating the default syntax highlighting mode; by default, the content is assumed to be plain text. see editor mode constants for permitted values. placeholdertext string the default initial text to be in the editor when it's created; by default, an empty string. this is deprecated starting in firefox 13; use initi
altext instead. deprecated since gecko 13.0 readonly boolean a boolean value indicating whether or not the source editor should be read only. showannotationruler boolean a boolean value indicating whether or not to display the annotations gutter/ruler. see xxxxx for details. showlinenumbers boolean a boolean value indicating whether or not the line numbe...
Creating localizable web applications
gn in") . "</a> : " . _("forgot your password?"), $locale_conf->url('/'), $locale_conf->url('/signin'));?> </p> snippet 7. bad: <p class="description"><?= _("<strong>description:</strong>");?></p> snippet 8. good: <p class="description"><strong><?= _("description:");?></strong></p> snippet 9. good: <h1> <?printf("<a href=\"%s\"><img src=\"/static/img/logo.png\"
alt=\"" . _("mozilla labs personas") . "\" /></a>", $locale_conf->url('/'));?> </h1> snippet 10. better: <h1> <a href="<?= $locale_conf->url('/') ?>"> <img src="/static/img/logo.png"
alt="<?= /* l10n: link title attribute */ _("mozilla labs personas"); ?> " /> </a> </h1> ...but don't sacrifice flexibility don't sacrifice flexibility trying to satisfy the rule above. make sure ...
...with # ... or // ...). in either way, use a consistent prefix for localization-related comments, e.g. "l10n". when extracting strings with xgettext you will be able to include only comments starting with this prefix using the --add-comments=prefix option, for example xgettext --add-comments=l10n. snippet 1. bad: <h1> <a href="<?= $locale_conf->url('/') ?>"> <img src="/static/img/logo.png"
alt="<?= _("mozilla labs personas"); ?>" /> </a> </h1> snippet 2. good: <h1> <a href="<?= $locale_conf->url('/') ?>"> <img src="/static/img/logo.png"
alt="<?= /* l10n: link title attribute */ _("mozilla labs personas") ?> " /> </a> </h1> snippet 3. bad: <p class="added"><? printf(_("<strong>added:</strong> %s"), $persona['date']);?></p> snippet 4. good: <p class="added"><? printf(...
... bad: image 5 & snippet 1. good: image file (/img/tignish/firefox/performance-chart.png): html: (in this case, no gettext was used and the localizers worked on pure html files) <div id="performance-chart"> <h4>firefox performance: fast — faster — <em>fastest</em></h4> <p>results of a sunspider test on a windows xp machine</p> <img src="/img/tignish/firefox/performance-chart.png"
alt="firefox 2, firefox 3, firefox 3.5 performance chart" /> <ul> <li>18,148 ms</li> <li>3,669 ms</li> <li>1,524 ms!</li> </ul> </div> in the above example, not only does the text above the clock charts require translation, but so do the milliseconds captions below them. many languages use different number formats than english, like 18 148 or 18.148. also, the last caption includes ...
Memory reporting
flexible and integrate well with dmd. the amallocsizeof parameter allows mozilla::mallocsizeof functions with dmd-specific hooks to be passed in when they are used by memory reporters, but functions without such hooks (such as moz_malloc_size_of) can also be passed in when they are used in other circumstances. some other things to note. please use size_t for the sizes in functions like this.
although nsimemoryreporter uses int64_t, this is because (a) you can't use size_t in idl, and (b) not every "amount" is a bytes measurement. so it's best to mostly use size_t and convert to int64_t as late as possible. you don't always need both sizeofexcludingthis and sizeofincludingthis. implement one or both as needed. if you have both, sizeofexcludingthis is the interesting one; sizeofincludingt...
...ling b::sizeofexcludingthis instead of d::sizeofexcludingthis, and thus we'll fail to measure any objects that d's fields point to. d::sizeofexcludingthis must also call b::sizeofexcludingthis, to ensure that any objects pointed to by fields inherited from b are measured. however, if d does not have any of its own fields that point to other objects, then d::sizeofexcludingthis is not necessary.
alternatively, if d does have fields that point to other objects but you don't want to measure them because they're insignificant, then d::sizeofexcludingthis is again not necessary. but it's a good idea to add a comment indicating this decision not to measure, and the names of the unmeasured fields. the obvious place for this comment is within d, but if b has many sub-classes like that, it might be ...
...ory. in this case it's often clearer to increment the numbers rather than assigning to them, especially if you're measuring multiple entities and summing their measurements. for example: void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, size_t *afoosizeout, size_t* abarsizeout) const { *afoosizeout += ...; *abarsizeout += ...; }
alternatively, you could create a struct: struct foobarsizes { size_t mfoo; size_t mbar; foobarsizes() { mozilla::podzero(this); } } void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, foobarsizes* asizes) const { asizes->mfoo += ...; asizes->mbar += ...; } note the add prefix that makes this incrementing behaviour clear. obviously, if...
PR_IntervalNow
returns the value of nspr's free-running interval timer. syntax #include <prinrval.h> printerv
altime pr_intervalnow(void); returns a printerv
altime object. description you can use the value returned by pr_intervalnow() to establish epochs and to determine intervals (that is, compute the difference between two times). pr_intervalnow() is both very efficient and nonblocking, so it is appropriate to use (for example) while holding a mutex. the most common use for pr_intervalnow() is to establish an epoch and test for the expiration of intervals. in this case, you typically call pr_intervalnow() in a sequence that looks like this: pruint32 interval = ... ; // milliseconds // ... ...
...times). pr_intervalnow() is both very efficient and nonblocking, so it is appropriate to use (for example) while holding a mutex. the most common use for pr_intervalnow() is to establish an epoch and test for the expiration of intervals. in this case, you typically call pr_intervalnow() in a sequence that looks like this: pruint32 interval = ... ; // milliseconds // ... ...
... pr_intervalnow() is to establish an epoch and test for the expiration of intervals. in this case, you typically call pr_intervalnow() in a sequence that looks like this: pruint32 interval = ... ; // milliseconds // ... ...
PR_TicksPerSecond
pr_pr_tickspersecond() allows you to discover exactly what that relationship is. ...
...pr_pr_tickspersecond() allows you to discover exactly what that relationship is. ...
...h> pruint32 pr_tickspersecond(void); returns an integer between 1000 and 100000 indicating the number of ticks per second counted by printerv
altime on the current platform. this value is platform-dependent and does not change after nspr is initialized. description the value returned by pr_tickspersecond() lies between pr_interval_min and pr_interval_max. the relationship between a printerv
altime tick and standard clock units is platform-dependent. pr_pr_tickspersecond() allows you to discover exactly what that relationship is. seconds per tick (the inverse of pr_pr_tickspersecond()) is always between 10 microseconds and 1 millisecond. ...
An overview of NSS Internals
e of nss's expectation to operate with an nss database, it's mandatory that you perform an initialization call, where you tell nss which database you will be using. in the most simple scenario, the programmer will provide a directory on your filesystem as a parameter to the init function, and nss is designed to do the rest. it will detect and open an existing database, or it can create a new one.
alternatively, should you decide that you don't want to work with any persistent recording of certificates, you may initialize nss in a no-database mode. usually, nss will flush all data to disk as soon as new data has been added to permanent storage. storage consists of multiple files: a key database file, which contains your secret keys, and a certificate database file which contains the public por...
... only. when dealing with certificates (x.509), file formats such as pkcs#12 (certificates and keys), pkcs#7 (signed data), and message formats as cms, we should mention asn.1, which is a syntax for storing structured data in a very efficient (small sized) presentation. it was originally developed for telecommunication systems at times where it was critical to minimize data as much as possible (
although it still makes sense to use that principle today for good performance). in order to process data available in the asn.1 format, the usual approach is to parse it and transfer it to a presentation that requires more space but is easier to work with, such as (nested) c data structures. over the time nss has received three different asn.1 parser implementations, each having their own specific p...
...th their business, they might make deals with established cas and receive so-called cross-signing-certificates. as a result, when searching for a trust path from (a) to a trusted anchor (root) certificate (z), the set of candidate issuer certificates might have different issuer names (referring to the second or higher issuer level). as a consequence, it will be necessary to try multiple different
alternative routes while searching for (z), in a recursive manner. only the newer verification engine (internally named libpkix) is capable of doing that properly. it's worth mentioning the extended validation (ev) principle, which is an effort by software vendors and cas to define a stricter set of rules for issuing certificates for web site certificates. instead of simply verifying that the requ...
NSS tools : crlutil
orresponding to the private key used to sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. * add issuer
alternative name extension: the issuer
alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issuer
altnames non-critical name-list where: subj
altnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names * add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence number for a given crl scope and crl issuer. this extension allows users to easily de...
NSS tools : pk12util
sql:]directory] [-p dbprefix] [-k slotpasswordfile|-k slotpassword] [-w p12filepasswordfile|-w p12filepassword] for example, this prints the default ascii output: # pk12util -l certs.p12 enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. ...
...this allows the certificates to be fed to another application that supports .p12 files. ...
...icate is written to a sequentially-number file, beginning with file0001.der and continuing through file000n.der, incrementing the number for every certificate: # pk12util -l test.p12 -r enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: s
alt: 45:2e:6a:a0:03:4d:7b:a1:63:3c:15:ea:67:37:62:1f iteration count: 1 (0x1) certificate friendly name: thawte personal freemail issuing ca - thawte consulting certificate friendly name: thawte freemail member's thawte consulting (pty) ltd. id password encryption pkcs#12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. p...
NSS Tools crlutil
ign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...ifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. add issuer
alternative name extension: the issuer
alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issuer
altnames non-critical name-list where: subj
altnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence number for a given crl scope and crl issuer. t...
NSS tools : crlutil
e private key used to sign a crl. authkeyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...eyid critical [key-id | dn cert-serial] where: authkeyident: identifies the name of an extension critical: value of 1 of 0. should be set to 1 if this extension is critical or 0 otherwise. key-id: key identifier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. ...
...ier represented in octet string. dn:: is a ca distinguished name cert-serial: authority certificate serial number. * add issuer
alternative name extension: the issuer
alternative names extension allows additional identities to be associated with the issuer of the crl. defined options include an rfc822 name (electronic mail address), a dns name, an ip address, and a uri. issuer
altnames non-critical name-list where: subj
altnames: identifies the name of an extension should be set to 0 since this is non-critical extension name-list: comma separated list of names * add crl number extension: the crl number is a non-critical crl extension which conveys a monotonically increasing sequence number for a given crl scope and crl issuer. this extension allows ...
NSS tools : pk12util
slotpasswordfile|-k slotpassword] [-w p12filepasswordfile|-w p12filepassword] for example, this prints the default ascii output: # pk12util -l certs.p12 enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. ...
...:62:1f iteration count: 1 (0x1) certificate: data: version: 3 (0x2) serial number: 13 (0xd) signature algorithm: pkcs #1 sha-1 with rsa encryption issuer: "e=personal-freemail@thawte.com,cn=thawte personal freemail c a,ou=certification services division,o=thawte consulting,l=cape t own,st=western cape,c=za" ....
alternatively, the -r prints the certificates and then exports them into separate der binary files. this allows the certificates to be fed to another application that supports .p12 files. each certificate is written to a sequentially-number file, beginning with file0001.der and continuing through file000n.der, incrementing the number for every certificate: # pk12util -l test.p12 -r ent...
...lly-number file, beginning with file0001.der and continuing through file000n.der, incrementing the number for every certificate: # pk12util -l test.p12 -r enter password for pkcs12 file: key(shrouded): friendly name: thawte freemail member's thawte consulting (pty) ltd. id encryption algorithm: pkcs #12 v2 pbe with sha-1 and 3key triple des-cbc parameters: s
alt: 45:2e:6a:a0:03:4d:7b:a1:63:3c:15:ea:67:37:62:1f iteration count: 1 (0x1) certificate friendly name: thawte personal freemail issuing ca - thawte consulting certificate friendly name: thawte freemail member's thawte consulting (pty) ltd. id password encryption pkcs#12 provides for not only the protection of the private keys but also the certificate a...
JS_DumpHeap
try to avoid using it. this article covers features introduced in spidermonkey 1.8 debug only. dump the object graph of heap-allocated things. syntax bool js_dumpheap(jsruntime *rt, file *fp, void* startthing, jsgctracekind kind, void *thingtofind, size_t maxdepth, void *thingtoignore); name type description cx jscontext * pointer to a js context. every jscontext is permanently associated with a jsruntime; each jsruntime contains a gc heap. fp file * file for the dump output. ...
...ng. if this is non-null, js_dumpheap only dumps paths in the object graph leading to the specified thing. maxdepth size_t the upper bound on the number of edges to descend from the graph roots. thingtoignore void * null or a pointer to a gc thing that will be ignored during graph traversal. enum jsgctracekind { // these trace kinds have a publicly exposed,
although opaque, c++ type. // note: the order here is determined by our value packing. other users // should sort alphabetically, for consistency. jstrace_object = 0x00, jstrace_string = 0x01, jstrace_symbol = 0x02, jstrace_script = 0x03, // shape details are exposed through js_traceshapecyclecollectorchildren. jstrace_shape = 0x04, // the kind associated w...
...ode = 0x1f, jstrace_lazy_script = 0x2f, jstrace_type_object = 0x3f, jstrace_last = jstrace_type_object }; description see bug 378261 for detail. when tracing a thing, the gc needs to know about the layout of the object it is looking at. there are a fixed number of different layouts that the gc knows about. the "trace kind" is a static map which tells which layout a gc thing has.
although this map is public, the details are completely hidden. not all of the matching c++ types are exposed, and those that are, are opaque. see js::value::gckind() and jstracecallback in <codde>tracer.h</codde> for more details. see also bug 378261 bug 1122842 ...
Detailed XPCOM hashtable guide
are often much easier and safer to use in c++ code, as many potential casting errors are easily avoided. you must declare an entry struct type, deriving from pldhashentryhdr. this entry struct should contain whatever data you wish to store in the hashtable (any pointer or fixed-length data type). note: because of the double-hashing implementation, entries may move in memory when the hashtable is
altered. if you need entry pointers to remain constant, you may want to consider using plhashtable instead. you must also initialize a pldhashtableops structure. this serves similarly to a vtable in c++, with pointers to appropriate user-defined functions that initialize, compare, and match entries. because pldhash does not know what datatype your key is, all functions that work with keys are declar...
...e pldhash, above). it also declares functions that manipulate the key. in most cases, the functions of this entry class can be entirely inline. for examples of entry classes, see the declarations at xpcom/glue/nshashkeys.h. the template parameter is the entry class. you must use the init() function to initalize the table properly. at this point, use the functions putentry/getentry/removeentry to
alter the hashtable. the iterator class will do iteration, but beware that the iteration will occur in a seemingly-random order (no sorting). nsthashtables can be allocated on the stack, as class members, or on the heap. entry pointers can and do change when items are added to or removed from the hashtable. do not keep long-lasting pointers to entries. because of this, nsthashtable is not inhere...
...able stores a pointer to the object, and deletes that object when the entry is removed. the important files to read are xpcom/glue/nsbasehashtable.h and xpcom/glue/nshashkeys.h. these classes can be used on the stack, as a class member, or on the heap. initialize using the init() function; you can specify whether you need thread-safety at this time. use the put(), get(), and remove() methods to
alter the table. using nsthashtable as a hash-set a hash set only tracks the existence of keys: it does not associate data with the keys. this can be done using nsthashtable<nssomehashkey>. the appropriate entries are getentry and putentry. future plans nsisimpleenumerator support the (obsolete) nshashtable has a wrapper that exposes an nsisimpleenumerator on its items. i will add this support t...
nsACString (External)
class declaration <map id="classes" name="classes"><area
alt="" coords="1005,6,1096,54" href="http://developer.mozilla.org/en/nsacstring_(external)" shape="rect" title="nsacstring_(external)"> <area
alt="" coords="980,102,1121,150" href="http://developer.mozilla.org/en/nscstringcontainer_(external)" shape="rect" title="nscstringcontainer_(external)"> <area
alt="" coords="571,198,707,246" href="http://developer.mozilla.org/en/nscstring_external" shape="rect" title="nscstring_external"> <area
alt="" coords="731,198,955,246" href="http://developer.mozilla.org/en/nsdependentcsubstring_external" shape="rect" title="nsdependentcsubstring_external"> <area
alt="" coords="979,198,1123,246" href="http://developer.mozilla.org/en/promiseflatcstring_(external)" shape="rect" title="promiseflatcstri...
...illa.org/en/nscstring_external" shape="rect" title="nscstring_external"> <area
alt="" coords="731,198,955,246" href="http://developer.mozilla.org/en/nsdependentcsubstring_external" shape="rect" title="nsdependentcsubstring_external"> <area
alt="" coords="979,198,1123,246" href="http://developer.mozilla.org/en/promiseflatcstring_(external)" shape="rect" title="promiseflatcstring_(external)"> <area
alt="" coords="1147,198,1259,246" href="http://developer.mozilla.org/en/nscautostring_(external)" shape="rect" title="nscautostring_(external)"> <area
alt="" coords="5,294,208,342" href="http://developer.mozilla.org/en/nsdependentcstring_external" shape="rect" title="nsdependentcstring_external"> <area
alt="" coords="232,294,475,342" href="http://developer.mozilla.org/en/ns_convertutf16toutf8_externa...
...org/en/nscautostring_(external)" shape="rect" title="nscautostring_(external)"> <area
alt="" coords="5,294,208,342" href="http://developer.mozilla.org/en/nsdependentcstring_external" shape="rect" title="nsdependentcstring_external"> <area
alt="" coords="232,294,475,342" href="http://developer.mozilla.org/en/ns_convertutf16toutf8_external" shape="rect" title="ns_convertutf16toutf8_external"> <area
alt="" coords="499,294,779,342" href="http://developer.mozilla.org/en/ns_lossyconvertutf16toascii_external" shape="rect" title="ns_lossyconvertutf16toascii_external"> <area
alt="" coords="803,294,925,342" href="http://developer.mozilla.org/en/nsliteralcstring_(external)" shape="rect" title="nsliteralcstring_(external)"></map> method overview beginreading endreading charat ...
nsIDOMMouseScrollEvent
cko 1.9.2 note prior to gecko 1.9.2, this inherited from nsisupports instead of from nsidommouseevent. method overview void initmousescrollevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in long axis); attributes attribute type description axis long indicates which mouse wheel axis changed; this will be either horizontal_axis or vertical_axis. read only. constants constant ...
... 2 the vertical (y) axis. methods initmousescrollevent() initializes the progress event object. void initmousescrollevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in long axis ); parameters typearg the type of event. must be one of "abort", "error", "load", "loadstart", or "progress". canbubblearg specifies whether or not the created event will bubble. cancelablearg specifies whether...
...ordinates. screenyarg the y coordinate at which the event occurred, in screen coordinates. clientxarg the x coordinate at which the event occurred, in client coordinates. clientyarg the y coordinate at which the event occurred, in client coordinates. ctrlkeyarg true if the control key was down when the event occurred, otherwise false.
altkeyarg true if the
alt key was down when the event occurred, otherwise false. shiftkeyarg true if the shift key was down when the event occurred, otherwise false. metakeyarg true if the meta key was down when the event occurred, otherwise false. buttonarg indicates which mouse button was pressed when the event occurred, if any. relatedtargeta...
nsIDOMSimpleGestureEvent
application. consumers should use event.preventdefault() to prevent default behavior when consuming events. method overview void initsimplegestureevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in unsigned long directionarg, in double deltaarg); attributes attribute type description delta double the delta value indicating how far the gesture moved. for update events, this indicates the movement since the previous update; for...
...clockwise 2 clockwise rotation. methods initsimplegestureevent() initializes the gesture event. ...
... deltaarg the value to assign to the delta attribute. ...
nsIDOMWindowUtils
ly. audiomuted boolean with this it's possible to mute all the mediaelements in this window. we have audiomuted and audiovolume to preserve the volume across mute/umute. audiovolume float range: greater or equal to 0. the real volume level is affected by the volume of all ancestor windows. constants constant value description modifier_
alt 0x0001 getmodifierstate("
alt") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_control 0x0002 getmodifierstate("control") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_shift 0x0004 getmodifierstate("shift") of...
...except sendnative*event(). modifier_shift 0x0004 getmodifierstate("shift") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_meta 0x0008 getmodifierstate("meta") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_
altgraph 0x0010 getmodifierstate("
altgraph") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_capslock 0x0020 getmodifierstate("capslock") of the send event will return true if this is specified for amodifiers of send*event() except sendnative*event(). modifier_fn 0x0040 getmodifierstate("f...
...tscrollframe optional ); parameters atype ax ay abutton aclickcount amodifiers modifiers pressed. using constants defined in nsidomnsevent. obsolete since gecko 15.0 using constants defined as modifier_*. aignorerootscrollframe optional sendmousescrollevent() obsolete since gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. synthesize a mouse scroll event for a window. the event types supported are: dommousescroll mozmousepixelscroll. events are sent in coordinates offset by ax and ay from the window. cannot be accessed from unprivileged context (not content-accessible) will throw a dom se...
nsINavHistoryResultViewer
inavhistoryresultobserver interface, which is similar but allows multiple clients to observe the result at once. 1.0 66 introduced gecko 1.9 obsolete gecko 2.0 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: most methods in this interface were renamed in gecko 1.9.2, and others have slightly different parameter lists. method overview void containerclosed(in nsinavhistorycontainerresultnode acontainernode); void containeropened(in nsinavhistoryconta...
...avhistoryresultnode newitem, in unsigned long index); void nodeinserted(in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode , in unsigned long anewindex); void sortingchanged(in unsigned short sortingmode); attributes attribute type description result nsinavhistoryresult the nsinavhistoryresult this viewer monitors.
although this attribute is read-write, you should not
alter it directly; instead, use the nsinavhistoryresult.viewer attribute to set the viewer. methods containerclosed() called when a container node's state changes from closed to opened. void containerclosed( in nsinavhistorycontainerresultnode acontainernode ); parameters acontainernode the container node whose state changed. ...
...the node to insert into the container; it may be either a leaf or another container. anewindex the index at which to insert the item. remarks the item previously at the specified index (if any) as well as everything below it, is shifted down by one. sortingchanged() called when the sorting order is changed to a particular mode. for trees, this would update the column headers to reflect the
altered sorting. void sortingchanged( in unsigned short sortingmode ); parameters sortingmode one of the nsinavhistoryqueryoptions.sort_by_* constants, indicating the softing mode. remarks this method is only called to update the sorting user interface. invalidateall() is called as well if the sorting changes, in order to cause the contents to update properly. see also nsinavhistoryr...
nsIPluginHost
y. native code only! methods native code only!createtempfiletopost to create temp file with content len header in, it will use by http post. nsifile createtempfiletopost( in string apostdataurl ); parameters apostdataurl return value native code only!createtmpfiletopost obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to create temp file with content len header in, it will use by http post. void createtmpfiletopost( in string apostdataurl, out string atmpfilename ); parameters apostdataurl atmpfilename native code only!deletepluginnativewindow deletes plugin nativ...
...imetype ); parameters amimetype return value getplugincount() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void getplugincount( out unsigned long aplugincount ); parameters aplugincount native code only!getpluginfactory obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. nsiplugin getpluginfactory( in string amimetype ); parameters amimetype return value native code only!getpluginname get the plugin name for the plugin instance. void getpluginname( in nsiplugininstance ainstance, [shared] out string apluginname ); ...
...f aoutpostdata. reloadplugins() causes the plugins directory to be searched again for new plugin libraries. void reloadplugins( in boolean reloadpages ); parameters reloadpages indicates whether currently visible pages should also be reloaded. native code only!setisscriptableinstance obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. to notify the plugin manager that the plugin created a script object. void setisscriptableinstance( in nsiplugininstance ainstance, in boolean ascriptable ); parameters ainstance ascriptable native code only!setupplugininstance void setupplugininstance...
nsIXULBrowserWindow
xpfe/appshell/public/nsixulbrowserwindow.idlscriptable provides methods that may be called from the internals of the browser area to tell the containing xul window to update its user interface. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) the xulbrowserwindow attribute exists on the nsixulwindow interface
although both firefox and seamonkey also store their nsixulbrowserwindow reference in the global xulbrowserwindow object accessible from javascript code. note: the xulbrowserwindow object offered to javascript code provides a great many more methods and attributes than those listed here, which are only the ones available to c++ code. see the documentation for xulbrowserwindow for details. method overview astring onbefore...
...lbrowserwindow reference in the global xulbrowserwindow object accessible from javascript code. note: the xulbrowserwindow object offered to javascript code provides a great many more methods and attributes than those listed here, which are only the ones available to c++ code. see the documentation for xulbrowserwindow for details. method overview astring onbeforelinktraversal(in astring origin
altarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab); void setjsdefaultstatus(in astring status); void setjsstatus(in astring status); void setoverlink(in astring link, in nsidomelement element); methods onbeforelinktraversal() called before traversing a link to determine the appropriate target into which to load the link. this may be used, for example, to redirect links...
... in nsidomelement element); methods onbeforelinktraversal() called before traversing a link to determine the appropriate target into which to load the link. this may be used, for example, to redirect links into new tabs or windows when it's not desirable to replace the content in the current tab (such as when the link is clicked in an app tab). astring onbeforelinktraversal( in astring origin
altarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters origin
altarget the specified target for the link. linkuri the uri of the link that is about to be traversed. linknode the nsidomnode representing the dom node in which the link is located. isapptab whether or not the link being clicked is in an app tab. return value a string indicating the revised target fo...
nsIZipWriter
the operations in the order they were added to the queue. operations performed on the queue throw any errors that occur out to the observer. attempting to perform a synchronous operation on the interface while the background queue is in progress will throw an ns_error_in_progress exception. file and directory names should use slashes ("/") as separators and should not begin with a slash. note:
although it is not necessary to add directory entries in order to add file entries within them, some zip utilities may have problems with that, so it may be best to add the directory entries explicitly first. implemented by: @mozilla.org/zipwriter;1. to create an instance, use: var zipwriter = components.classes["@mozilla.org/zipwriter;1"] .createinstance(components.interfaces.nsizi...
...ormed when processqueue() is called. exceptions thrown ns_error_not_initialized no zip file is open. ns_error_file_already_exists the specified path already exists in the zip file. ns_error_in_progress the zip writer is already performing another operation. addentrydirectory() adds a new directory entry to the zip file. if azipentry does not end with "/" then it will be added. note:
although it is not necessary to add directory entries in order to add file entries within them, some zip utilities may have problems with that, so it may be best to add the directory entries explicitly first. void addentrydirectory( in autf8string azipentry, in prtime amodtime, in boolean aqueue ); parameters azipentry the path of the directory entry to add to the zip file.note: you must...
...failing to open the file, such as if the file is corrupt or in an unsupported format. processqueue() processes all queued items until the entire queue has been processed or an error occurs. the observer is notified when the first operation begins and when the last operation completes. any failures are passed to the observer. the zip writer will be busy until the queue is complete or an error h
alts processing of the queue early. in the event of an early failure, the remaining items stay in the queue; calling processqueue() again will continue where operations left off. void processqueue( in nsirequestobserver aobserver, in nsisupports acontext ); parameters aobserver the observer to receive notifications from the queue. acontext the context to pass to the observer. exception...
Mozilla
file that describes the search engine, its url, and the parameters that need to be passed to that url. creating reftest-based unit tests the reftest harness compares the display of two web pages. if the bitmaps resulting from displaying the two files in an 800x1000 window are identical, the test passes. if they differ, the test fails. or,
alternatively, the conditions can be reversed (a != test rather than an == test). the power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. re...
... if you file a bug report in bugzilla about a crash you should include a stacktrace (call stack) in your report. a stacktrace will tell mozilla developers what crashed and provide a starting point for investigating its cause. this article describes how to use the mozilla crash reporter (breakpad) to get a crash id, which our engineers can use to get a stacktrace, and
alternative ways to get a stacktrace if you can't get a crash id. how to get a stacktrace with windbg sometimes you need to get a stacktrace (call stack) for a crash or hang but breakpad fails because it's a special crasher or a hang. this article describes how to get a stacktrace in those cases with windbg on windows. (to get a stacktrace fo...
... the style system is the module of mozilla's code responsible for the loading and parsing of css style sheets, and the computation of computed values for all css properties. the handling of those computed values is the responsibility of other parts of the code. mozilla style system documentation see also the style techtalk for more complete
although less detailed documentation. mozilla svg project since you have come this far, you probably already know that svg stands for scalable vector graphics, and that it is an xml language for sophisticated 2-dimensional graphics. svg is to graphics what xhtml is to text, mathml is to mathematical equations and cml is to the description of chemical molecul...
Examine and edit HTML - Firefox Developer Tools
ches all <a> elements but not the letter "a" within the text content. furthermore it allows for some more advanced searches like finding elements that start with a specific text, for example. html tree the rest of the pane shows you the page's html as a tree (this ui is also called the markup view). just to the left of each node is an arrow: click the arrow to expand the node. if you hold the
alt key while clicking the arrow, it expands the node and all the nodes underneath it. moving the mouse over a node in the tree highlights that element in the page. nodes that are not visible are shown faded/desaturated. this can happen for different reasons such as using display: none or that the element doesn't have any dimensions. there is an ellipsis shown between the opening and closing tag o...
...devtools-examples/whitespace-only-demo/index.html. shadow roots any shadow roots present in the dom are exposed in the html page in the same manner as the regular dom. the shadow root is signified by a node named #shadow-root — you can click its expansion arrow to see the full contents of the shadow dom, and then manipulate the contained nodes in a similar way to other part of the page's dom (
although with a limited featureset — you can't, for example, drag and drop or delete shadow dom nodes). if a shadow dom contains a "slotted" element (an element with a slot attribute after it has been inserted inside a <slot> element — see adding flexibility with slots for an explanation of how these are used), the "slotted" element will be shown inside its corresponding <slot> element, with a...
...y selected element. use in console assigns the currently selected node to a variable named temp0 (or temp1 if temp0 is already taken, and so on), then opens the split console, enabling you to interact with that node using the console's command line. expand all in the tree view, expand the current element and all the elements underneath it. this is equivalent to holding the
alt key and clicking the disclosure triangle next to an element. collapse in the tree view, collapse the current element. this is equivalent to clicking the disclosure arrow next to an element that's expanded. (paste) inner html paste the clipboard contents into the node as its innerhtml. (paste) outer html paste the clipboard contents into the node as its outerhtm...
Using the CSS Painting API - Web APIs
s registerpaint() function. .fancy { background-image: paint(headerhighlight); } putting it together we can then add the fancy class to any element on the page to add a yellow box as a background: <h1 class="fancy">my cool header</h1> the following example will look like the image above in browsers supporting the css painting api. while you can't play with the worklet's script, you can
alter the background-size and background-position to change the size and location of the background image. paintsize in the example above, we created a 20x200 unit box, painted 15 units from the top of the element it is the same regardless of the size of the element. if the text is small, the yellow box looks like a huge underline. if the text is huge, the box might look like an bar above the firs...
...ding to it's size. css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/02parttwo/header-highlight.js'); .fancy { background-image: paint(headerhighlight); } .half { width: 50%; } <h1 class="fancy">largest header</h1> <h6 class="fancy">smallest header</h6> <h3 class="fancy half">50% width header</h3> while you can't play with the worklet's script, you can
alter the element's font-size and width to change the size of the background image. in browsers that support the css paint api, the example below should appear like the image above. custom properties in addition to accessing the size of the element, the worklet can also have access to css custom properties and regular css properties. registerpaint('csspaintfunctionname', class { static get...
...n element that has boxbg applied to it and then used those within our paint() function. the inputproperties() method can return all properties affecting the element, not just custom properties. in our <script> we register the worklet: css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/worklet/boxbg.js'); while you can't play with the worklet's script, you can
alter the custom property values to change the colors and width of the background image. adding complexity the above examples might not seem very exciting, as you could recreate them in a few different ways with existing css properties, e.g. by positioning some decorative generated content with ::before, or including background: linear-gradient(yellow, yellow) 0 15px / 200px 20px no-repeat; what ma...
Basic usage of canvas - Web APIs
s start this tutorial by looking at the <canvas> html element itself. at the end of this page, you will know how to set up a canvas 2d context and have drawn a first example in your browser. the <canvas> element <canvas id="tutorial" width="150" height="150"></canvas> at first sight a <canvas> looks like the <img> element, with the only clear difference being that it doesn't have the src and
alt attributes. indeed, the <canvas> element has only two attributes, width and height. these are both optional and can also be set using dom properties. when no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high. the element can be sized arbitrarily by css, but during rendering the image is scaled to fit its layout size: if the css sizing does...
...from an <img> tag in that, like for <video>, <audio>, or <picture> elements, it is easy to define some fallback content, to be displayed in older browsers not supporting it, like versions of internet explorer earlier than version 9 or textual browsers. you should always provide fallback content to be displayed by those browsers. providing fallback content is very straightforward: just insert the
alternate content inside the <canvas> element. browsers that don't support <canvas> will ignore the container and render the fallback content inside it. browsers that do support <canvas> will ignore the content inside the container, and just render the canvas normally. for example, we could provide a text description of the canvas content or provide a static image of the dynamically rendered content...
...ust render the canvas normally. for example, we could provide a text description of the canvas content or provide a static image of the dynamically rendered content. this can look something like this: <canvas id="stockgraph" width="150" height="150"> current stock price: $3.15 + 0.15 </canvas> <canvas id="clock" width="150" height="150"> <img src="images/clock.png" width="150" height="150"
alt=""/> </canvas> telling the user to use a different browser that supports canvas does not help users who can't read the canvas at all, for example. providing a useful fallback text or sub dom helps to make the canvas more accessible. required </canvas> tag as a consequence of the way fallback is provided, unlike the <img> element, the <canvas> element requires the closing tag (</canvas>). if t...
Document.linkColor - Web APIs
syntax color = document.linkcolor document.linkcolor = color parameters color is a string representing the color as a word (e.g., red) or hexadecimal value (e.g., #ff0000). ...
... syntax color = document.linkcolor document.linkcolor = color parameters color is a string representing the color as a word (e.g., red) or hexadecimal value (e.g., #ff0000). ...
... syntax color = document.linkcolor document.linkcolor = color parameters color is a string representing the color as a word (e.g., red) or hexadecimal value (e.g., #ff0000). ...
Examples of web and XML development using the DOM - Web APIs
output"> </div> </body> </html> example 2: image attributes <!doctype html> <html lang="en"> <head> <title>modifying an image border</title> <script> function setborderwidth(width) { document.getelementbyid("img1").style.borderwidth = width + "px"; } </script> </head> <body> <p> <img id="img1" src="image1.gif" style="border: 5px solid green;" width="100" height="100"
alt="border test"> </p> <form name="formname"> <input type="button" value="make border 20px-wide" onclick="setborderwidth(20);" /> <input type="button" value="make border 5px-wide" onclick="setborderwidth(5);" /> </form> </body> </html> example 3: manipulating styles in this simple example, some basic style properties of an html paragraph element are accessed using the style object on the e...
...ox is displayed to confirm this. <!doctype html> <html lang="en"> <head> <title>event propagation</title> <style> #t-daddy { border: 1px solid red } #c1 { background-color: pink; } </style> <script> function stopevent(ev) { c2 = document.getelementbyid("c2"); c2.innerhtml = "hello"; // this ought to keep t-daddy from getting the click. ...
... if dom core methods document.createelement and node.appendchild are used to create rows and cells, ie requires that they are appended to a tbody element, whereas other browsers will allow appending to a table element (the rows will be added to the last tbody element). there are a number of other convenience methods belonging...
FileSystem - Web APIs
ge is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
...ta, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetfilesystemchrome full support 7
alternate name full support 7
alternate name
alternate name uses the non-standard name: domfilesystemedge full support ≤18prefixed notes full support ≤18prefixed notes prefixed implemented with the vendor prefix: webkitnotes edge only supports this api in drag-and-drop scenarios using the the datatransferitem.webkitgetasentry() method. ...
... no support noopera full support 15prefixed full support 15prefixed prefixed implemented with the vendor prefix: webkitsafari full support 11.1webview android full support ≤37
alternate name full support ≤37
alternate name
alternate name uses the non-standard name: domfilesystemchrome android full support 18
alternate name full support 18
alternate name
alternate name uses the non-standard name: domfilesystemfirefox android ...
GeolocationCoordinates - Web APIs
the geolocationcoordinates interface represents the position and
altitude of the device on earth, as well as the accuracy with which these properties are calculated. properties the geolocationcoordinates interface doesn't inherit any properties. geolocationcoordinates.latitude read only secure context returns a double representing the position's latitude in decimal degrees. geolocationcoordinates.longitude read only secure context returns a double representing the position's longitude in decimal degrees. geolocationcoordinates.
altitude read only secure context returns a double representing the position's
altitude in meters, relative to sea level. this value can be null if the implementation cannot provide the data. geolocationcoordinates.accuracy read only secure con...
...this value can be null. geolocationcoordinates.heading read only secure context returns a double representing the direction towards which the device is facing. this value, specified in degrees, indicates how far off from heading true north the device is. ...
...this value can be null. geolocationcoordinates.heading read only secure context returns a double representing the direction towards which the device is facing. this value, specified in degrees, indicates how far off from heading true north the device is. ...
HTMLMarqueeElement - Web APIs
nt-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlmarqueeelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlmarqueeelement.behavior sets how the text is scrolled within the marquee. possible values are scroll, slide and
alternate. if no value is specified, the default value is scroll. htmlmarqueeelement.bgcolor sets the background color through color name or hexadecimal value. htmlmarqueeelement.direction sets the direction of the scrolling within the marquee. possible values are left, right, up and down. if no value is specified, the default value is left. htmlmarqueeelement.height sets the height in pixels o...
...crolldelay values lower than 60 are ignored. if truespeed is true, then those values are not ignored. htmlmarqueeelement.vspace sets the vertical margin. htmlmarqueeelement.width sets the width in pixels or percentage value. event handlers htmlmarqueeelement.onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to
alternate. htmlmarqueeelement.onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some number that is greater than 0. htmlmarqueeelement.onstart fires when the marquee starts scrolling. methods inherits methods from its parent, htmlelement. htmlmarqueeelement.start() starts scrolling of t...
...olling. methods inherits methods from its parent, htmlelement. htmlmarqueeelement.start() starts scrolling of the marquee. htmlmarqueeelement.stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="
alternate" style="border:solid"> <marquee behavior="
alternate"> this text will bounce </marquee> </marquee> specifications specification status comment html living standardthe definition of 'htmlmarqueeelement' in that specification. living standard made obsolete in favor of css but define its expected behavior for backward compatibility. html 5.2the...
Timing element visibility with the Intersection Observer API - Web APIs
of interest become more or less obscured by a shared ancestor node or element, including the document itself. in this article, we'll build a mock blog which has a number of ads interspersed among the contents of the page, then use the intersection observer api to track how much time each ad is visible to the user. when an ad exceeds one minute of visible time, it will be replaced with a new one.
although many aspects of this example will not match real world usage (in particular, the articles all have the same text and aren't loaded from a database, and there are just a handful of simple text-only ads that are selected from an array), this should provide enough understanding of the api to quickly learn how to apply the intersection observer api to your own site. there's a good reason why th...
...: aside { grid-column: 1; grid-row: 2; background-color: cornsilk; padding: 5px 10px; } aside ul { padding-left: 0; } aside ul li { list-style: none; } aside ul li a { text-decoration: none; } the most important thing to note here is that the grid-column is set to 1, to place the sidebar on the left-hand side of the screen. if you change this to -1, it will appear on the right (
although some other elements will need some adjustments made to their margins to get the spacing just right). the grid-row is set to 2, to place it alongside the site body. the content body speaking of the site's body: the main content of the site is kept in a <main> element. the following style is applied to that: main { grid-column: 2; grid-row: 2; margin: 0; margin-left: 16px; font-si...
...t visible as of the last time it was checked. totalviewtime the total number of milliseconds the ad has been visible. these are accessed through each ad's htmlelement.dataset attribute, which provides a domstringmap mapping each custom attribute's name to its value. the values are strings, but we can convert those to numbers easily enough—in fact, javascript generally does it automatically,
although we'll have one instance where we have to do it ourselves. we start by fetching the time at which the ad's previous visibility status check time (adbox.dataset.lastviewstarted) into a local variable named laststarted. we also get the current time-since-creation value using performance.now() into currenttime. if laststarted is non-zero—meaning the timer is currently running, we compute the...
KeyboardEvent.initKeyEvent() - Web APIs
vel 2 events specification and is implemented in gecko-based browsers; other browsers implemented keyboardevent.initkeyboardevent based on early drafts of document object model (dom) level 3 events specification. favor the modern constructor structure as the only cross-browser way of building events. syntax event.initkeyevent (type, bubbles, cancelable, viewarg, ctrlkeyarg,
altkeyarg, shiftkeyarg, metakeyarg, keycodearg, charcodearg) parameters type is a domstring representing the type of event. bubbles is a boolean indicating whether the event should bubble up through the event chain or not (see bubbles). cancelable is a boolean i indicating whether the event can be canceled (see cancelable). viewarg specifies the uievent.view; this valu...
...event. bubbles is a boolean indicating whether the event should bubble up through the event chain or not (see bubbles). cancelable is a boolean i indicating whether the event can be canceled (see cancelable). viewarg specifies the uievent.view; this value may be null. ctrlkeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the ctrl key.
altkeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the
alt key. shiftkeyarg a boolean that is true if the virtual key to be generated is a combination of keys containing the shift key. metakeyarg is a boolean that is true if the virtual key to be generated is a combination of keys containing the meta key. keycodearg is a unsigned long rep...
...devent'); // create a key event // define the event event.initkeyevent("keypress", // typearg, true, // canbubblearg, true, // cancelablearg, null, // viewarg, specifies uievent.view. this value may be null. ...
Sensor APIs - Web APIs
the sensor apis are a set of interfaces built to a common design that expose device sensors in a consistent way to the web platform. sensor apis concepts and usage
although the generic sensor api specification defines a sensor interface, as a web developer you will never use it. instead you'll use one of its subclasses to retrieve specific kinds of sensor data. for example, the accelerometer interface returns the acceleration of the device along all three axes at the time it is read. sensors may or may not correspond exactly to a physical device sensor. for example, the gyroscope interface corresponds exactly to a physical device interface.
alternatively, the absoluteorientationsensor interface provides information that is algorithmically agregated from two or more device sensors. these...
... feature detection sensor interfaces are only proxies for the underlying device sensors. consequently, feature detection is more complicated for sensors than it is for other apis. ...
...the user grants permission to a specific sensor type. do this using the permissions api. a brief example, shown below, requests permission before attempting to use the sensor. navigator.permissions.query({ name: 'accelerometer' }) .then(result => { if (result.state === 'denied') { console.log('permission to use accelerometer sensor is denied.'); return; } // use the sensor. }); an
alternative approach is to attempt to use the error and listen for the securityerror. const sensor = new absoluteorientationsensor(); sensor.start(); sensor.onerror = event => { if (event.error.name === 'securityerror') console.log("no permissions to use absoluteorientationsensor."); }; the following table describes for each sensor type, the name required for the permissions api, the <iframe>...
SpeechRecognitionEvent - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. ...
... // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionevent' in that specification. draft ...
SpeechRecognitionResult.isFinal - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. ...
... // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results[0].isfinal); } specifications specification status comment web speech apithe definition of 'isfinal' in that specification. draft ...
SpeechRecognitionResult.item() - Web APIs
the item getter of the speechrecognitionresult interface is a standard getter that allows speechrecognition
alternative objects within the result to be accessed via array syntax. syntax var my
alternative = speechrecognitionresultinstance[0]; returns a speechrecognition
alternative object. examples this code is excerpted from our speech color changer example. recognition.onresult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. ...
...esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification. draft ...
SpeechRecognitionResultList.length - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. ...
... // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; console.log(event.results.length); } specifications specification status comment web speech apithe definition of 'length' in that specification. draft ...
SpeechRecognitionResultList - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. ...
... // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'speechrecognitionresultlist' in that specification. draft ...
SubtleCrypto.deriveKey() - Web APIs
operation. it's not designed to derive keys from relatively low-entropy inputs such as passwords. for that, use pbkdf2. hkdf is specified in rfc 5869. pbkdf2 pbkdf2 is also a key derivation function. it's designed to derive key material from some relatively low-entropy input, such as a password. it derives key material by applying a function such as hmac to the input password along with some s
alt, and repeating this process many times. the more times the process is repeated, the more computationally expensive key derivation is: this makes it harder for an attacker to use brute-force to discover the key using a dictionary attack. pbkdf2 is specified in rfc 2898. examples note: you can try the working examples on github. ecdh in this example alice and bob each generate an ecdh key pa...
...y material to use as input to the derivekey method. the key material is a password supplied by the user. ...
...password = window.prompt("enter your password"); let enc = new textencoder(); return window.crypto.subtle.importkey( "raw", enc.encode(password), "pbkdf2", false, ["derivebits", "derivekey"] ); } async function encrypt(plaintext, s
alt, iv) { let keymaterial = await getkeymaterial(); let key = await window.crypto.subtle.derivekey( { "name": "pbkdf2", s
alt: s
alt, "iterations": 100000, "hash": "sha-256" }, keymaterial, { "name": "aes-gcm", "length": 256}, true, [ "encrypt", "decrypt" ] ); return window.crypto.subtle.encrypt( { name: "aes-gcm", iv: iv }, key, plaintext ); } specifications specification status comment web cryptography apithe definition of 'su...
USBInterface - Web APIs
interface.usbinterface creates a new usbinterface object which will be populated with information about the interface on the provided usbconfiguration with the given interface number. properties usbinterface.interfacenumberread only returns the interface number of this interface. this is equal to the binterfacenumber field of the interface descriptor defining this interface. ...
...bject which will be populated with information about the interface on the provided usbconfiguration with the given interface number. properties usbinterface.interfacenumberread only returns the interface number of this interface. this is equal to the binterfacenumber field of the interface descriptor defining this interface. usbinterface.
alternateread only returns the currently selected
alternative configuration of this interface. ...
...he provided usbconfiguration with the given interface number. properties usbinterface.interfacenumberread only returns the interface number of this interface. this is equal to the binterfacenumber field of the interface descriptor defining this interface. usbinterface.
alternateread only returns the currently selected
alternative configuration of this interface. by default this is the usb
alternateinterface from
alternates with
alternatesetting equal to 0. it can be changed by calling usbdevice.select
alternateinterface() with any other value found in
alternates. usbinterface.
alternatesread only returns an array containing instances of the usb
alternateinterface interface describing each of the
alternative configurations possible for this interface. usbinterface.claimedread only r...
Signaling and video calling - Web APIs
ling process actually work? first we need the signaling server itself. webrtc doesn't specify a transport mechanism for the signaling information. you can use anything you like, from websocket to xmlhttprequest to carrier pigeons to exchange the signaling information between the two peers. it's important to note that the server doesn't need to understand or interpret the signaling data content.
although it's sdp, even this doesn't matter so much: the content of the message going through the signaling server is, in effect, a black box. what does matter is when the ice subsystem instructs you to send signaling data to the other peer, you do so, and the other peer knows how to receive this information and deliver it to its own ice subsystem. all you have to do is channel the information back a...
...media, media begins to flow. each peer continues to send candidates until it runs out of options, even after the media has already begun to flow. this is done in hopes of identifying even better options than the one initially selected. if conditions change—for example the network connection deteriorates—one or both peers might suggest switching to a lower-bandwidth media resolution, or to an
alternative codec. this triggers a new exchange of candidates, after which a another media format and/or codec change may take place. you can learn more about the codecs which webrtc requires browsers to support, which additional codecs are supported by which browsers, and how to choose the best codecs to use in the guide codecs used by webrtc. optionally, see rfc 8445: interactive connectivity esta...
...atch these events for debugging purposes, as well as to detect when candidate collection has finished. function handleicegatheringstatechangeevent(event) { // our sample just logs information to console here, // but you can do whatever you need. } next steps you can now try out this example on glitch to see it in action. open the web console on both devices and look at the logged output—
although you don't see it in the code as shown above, the code on the server (and on github) has a lot of console output so you can see the signaling and connection processes at work. another obvious improvement would be to add a "ringing" feature, so that instead of just asking the user for permission to use the camera and microphone, a "user x is calling. would you like to answer?" prompt appears ...
Writing WebSocket servers - Web APIs
led for you automatically. for example, let's assume that your server is listening on example.com, port 8000, and your socket server responds to get requests at example.com/chat. warning: the server may listen on any port it chooses, but if it chooses any port other than 80 or 443, it may have problems with firewalls and/or proxies. browsers generally require a secure connection for websockets,
although they may offer an exception for local devices. the handshake is the "web" in websockets. it's the bridge from http to websockets. in the handshake, details of the connection are negotiated, and either party can back out before completion if the terms are unfavorable. the server must be careful to understand everything the client asks for, otherwise security issues can occur. tip: the req...
...sbub25jzq== sec-websocket-version: 13 the client can solicit extensions and/or subprotocols here; see miscellaneous for details. also, common headers like user-agent, referer, cookie, or authentication headers might be there as well. do whatever you want with those; they don't directly pertain to the websocket. it's also safe to ignore them. in many common setups, a reverse proxy has already de
alt with them. tip: all browsers send an origin header. 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. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understood or has an incorrect value,...
...r example, you might keep a table of usernames or id numbers along with the corresponding websocket and other data that you need to associate with that connection. exchanging data frames either the client or the server can choose to send a message at any time — that's the magic of websockets. however, extracting information from these so-called "frames" of data is a not-so-magical experience.
although all frames follow the same specific format, data going from the client to the server is masked using xor encryption (with a 32-bit key). section 5 of the specification describes this in detail. format each data frame (from the client to the server or vice-versa) follows this same format: frame format: 0 1 2 3 0 1 2 3...
Fundamentals of WebXR - Web APIs
eld of view? the field of view is, at its essence, the extent of the environment you are able to see at any one time. the width of the field of view is measured as the angle defining the arc from the far left edge of your field of view to the far right edge, and is specified in either degrees or radians. a human eye is typically able to take in a fov of around 135°. assuming a person has two he
althy eyes, their total field of view is about 200° to 220° wide. why is the fov wider with two eyes, but not double the single-eye fov? it's because the two eyes fovs overlap a lot. that overlap is what gives us depth perception; within the overlap area — which is around 115° across — we have depth perception. outside that overlap area, our vision is monocular and lacks good depth perception.
...e with 3 degree of freedom hardware: yaw, roll, and pitch. freedom of rotational movement the first three degrees of freedom are rotational. the rotational degrees of freedom are: pitch: looking up and down yaw: looking left and right roll: tilting left and right in all of these cases, the viewer remains in the same location in space while pivoting on one or more of the three axes to
alter the direction in which they're looking. a system with two degrees of freedom can sense when the user looks left and right or up and down, but can't report any other kind of movement. a typical baseline headset offers three degrees of freedom, recognizing rotation around all three axes. this is often referred to by the shorthand 3dof. freedom of translational movement the other three degrees ...
...the user, or, increasingly commonly, using infrared cameras that detect the user's movements. speakers placed around the chamber provide immersive sound as well. these are not common among everyday users; they're mostly either experimental, used for demonstration purposes, or used by larger organizations. one drawback is that the cave can't simulate anything closer than the wall. important he
alth and safety reminders because the entire act of creating a virtual 3d world is, in essence, a trick which takes advantage of our understanding of how eyes collect light and how the brain interprets the collected data, it is important to keep in mind that as such, software designers and developers have a responsibility to be even more careful than usual to ensure that the results are correct. vi...
Inputs and input sources - Web APIs
in order to make an experience that's fulfilling and engaging, the user needs to be able to interact with it. to that end, webxr provides support for a variety of kinds of input devices. in this guide, we'll look at how to use webxr's input device management features to determine what input sources are available and how to then monitor those sources for inputs in order to handle user interactivity with your virtual or augmented environment. ...
...directionality of the axes, the coordinates of the grip space can be expressed in world coordinates as (x, y, -z); z is negative since the grip space is farther away along the z axis, and is thus in the negative direction. if the controller were instead positioned to the left of and closer to the user than the world space origin (or possibly behind the user, if the user is located at the origin,
although that's an uncomfortable way to hold a controller), the coordinates would have a negative value for x, but a positive value for z. 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 clos...
...naged by the gamepad api, so you must not attempt to use any gamepad api methods with it. the object type is reused as a convenience. if the value of gamepad is null, the input source doesn't define any controls using the gamepad record, either because it doesn't support it or because it simply doesn't have any added controls on it. this gamepad object is not only used to obtain access to speci
alty buttons, trackpads, and so forth, but also provides a way to more directly access and monitor the controls that serve as the primary select and squeeze inputs, since these are included in its buttons list. because this use of the gamepad interface is a convenience rather than a true application of the gamepad api, there are several differences between how it's used with webxr and how it's used ...
Using XMLHttpRequest - Web APIs
a document fragment via fragment.body.innerhtml and traverse the dom of the fragment. regexp can be used if you always know the content of the html responsetext beforehand. you might want to remove line breaks, if you use regexp to scan with regard to linebreaks. however, this method is a "last resort" since if the html code changes slightly, the method will likely fail. handling binary data
although xmlhttprequest is most commonly used to send and receive textual data, it can be used to send and receive binary content. there are several well tested methods for coercing the response of an xmlhttprequest into sending binary data. these involve utilizing the overridemimetype() method on the xmlhttprequest object and is a workable solution. var oreq = new xmlhttprequest(); oreq.open("get",...
...ching the "progress" event. note: as of gecko 12.0, if your progress event is called with a responsetype of "moz-blob", the value of response is a blob containing the data received so far. one can also detect all three load-ending conditions (abort, load, or error) using the loadend event: req.addeventlistener("loadend", loadend); function loadend(e) { console.log("the transfer finished (
although we don't know if it succeeded or not)."); } note there is no way to be certain, from the information received by the loadend event, as to which condition caused the operation to terminate; however, you can use this to handle tasks that need to be performed in all end-of-transfer scenarios. submitting forms and uploading files instances of xmlhttprequest can be used to submit forms in two...
...a car</label> </p> <p> describe yourself:<br /> <textarea name="description" cols="50" rows="8"></textarea> </p> <p> <input type="submit" value="submit" /> </p> </fieldset> </form> </body> </html> note: as we said, formdata objects are not stringifiable objects. if you want to stringify a submitted data, use the previous pure-ajax example. note also that,
although in this example there are some file <input> fields, when you submit a form through the formdata api you do not need to use the filereader api also: files are automatically loaded and uploaded. get last modified date function getheadertime () { console.log(this.getresponseheader("last-modified")); /* a valid gmtstring date or null */ } var oreq = new xmlhttprequest(); oreq.open("head" /...
ARIA: banner role - Accessibility
a banner role represents general and informative content frequently placed at the beginning of the page. this usually includes a logo, company name, search icon, photo related to the page, or slogan. <div role="banner"> <img src="companylogo.svg"
alt="my company name" /> <h1>title</h1> <h2>subtitle</h2> </div> by default, the html5 <header> element has an identical meaning to the banner landmark, unless it is a descendant of <aside>, <article>, <main>, <nav>, or <section>. description a banner landmark role converts the container element upon which it is applied into a header. it should be reserved for the site header content that is common across the site generally at the top of every page. the banner is typically includes things a logo or corporate identity, possibly a site-s...
...d interactions none required javascript features none examples here's a fake simple banner with a skip to navigation link, a logo, a title and a subtitle. as this is the main header for the site, we've added the banner landmark role to the container element. ...
..." id="skiptomenu" class="skiptocontent">skip to keyboard navigation</a> <img src="images/w3c.png"
alt="w3c logo"> <h1>aria landmarks</h1> <p>identifying page subsections for easy navigation</p> </div> we could also have written the above with the html header element: <header> <a href="#nav" id="skiptomenu" class="skiptocontent">skip to keyboard navigation</a> <img src="images/w3c.png"
alt="w3c logo"> <h1>aria landmarks</h1> <p>identifying page subsections for easy navigation</p> </header> best practices while it is best to use the header element and ensure it is not a descendant of any subsection of the page, sometimes you don't have access to the underlying html. if this is the case, you can add the role of banner to the main header of the page with javascript. identifying ...
ARIA: figure role - Accessibility
the aria figure role can be used to identify a figure inside page content where appropriate semantics do not already exist. 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. <div role="figure" aria-labelledby="caption"> <img src="image.png"
alt="full
alternative image description"> <p id="caption">figure 1: the caption</p> </div> in the above example, we have a figure that consists of two separate content items — an image and a caption. this is wrapped by a <div> element that identifies the content as a figure using role="figure". instead of using aria to create a figure, consider using the native, semantic html <figure> element. along with the <figcaption> elem...
... don't have control over the html semantics, you can improve the accessibility of html by adding these roles and properties with javascript. ...
...f you have to — for example if you don't have control over your html but are able to improve accessibility dynamically after the fact with javascript. if at all possible, you should use the appropriate semantic html elements to mark up a figure and its caption — <figure> and <figcaption>. ...
Accessibility documentation index - Accessibility
utton or progressbar. if the current value is not known, the author should not set the aria-valuenow attribute. if the aria-valuenow has a known minimum and maximum value, authors should set the aria-valuemin and aria-valuemax attributes. 29 using the aria-valuetext attribute aria, accessibility, attribute the aria-valuetext attribute is used to define the human readable text
alternative of aria-valuenow for a range widget such as progressbar, spinbutton or slider. 30 using the article role aria, accessible, needscontent the article role is used to identify a section of a page that forms an independent part of a document, page or site. examples of an article include web log posts, newspaper or magazine articles and use-submitted comments. it is indepe...
...ribes the effect it has on browsers and assistive technology. 39 using the toolbar role needscontent this technique demonstrates how to use the toolbar role and describes the effect it has on browsers and assistive technology. 40 x-ms-aria-flowfrom aria, microsoft, non-standard 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. 41 wai-aria roles aria, aria roles, accessibility, reference, rôles this page lists reference pages covering all the wai-aria roles di...
...ce on how to write your web content so that it conforms to the success criteria outlined in the operable principle of the web content accessibility guidelines (wcag) 2.0 and 2.1. operable states that user interface components and navigation must be operable. 98 perceivable accessibility, principle 1, wcag, web content accessibility guidelines, contrast, different presentation, text
alternatives, time-based media this article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the perceivable principle of the web content accessibility guidelines (wcag) 2.0 and 2.1. perceivable states that users must be able to perceive it in some way, using one or more of their senses. 99 color contrast accessibi...
Understandable - Accessibility
ronym expansion and explanation, or at the very least include them in the surrounding text in context. see abbreviations. ...
...w3c specs). 3.1.6 pronunciation (aaa) a mechanism should be provided to give users access to pronounciation of words where they are is needed to understand the content fully. ...
...anation is required, you can always include explanatory paragraphs too, or maybe you need to try to make your forms more intuitive. meaningful text labels how to structure an html form text labels and names 3.3.3 error suggestion (aa) when an error is detected and suggestions for correction are known, provide these to the user (e.g. suggesting
alternatives when the user is choosing a user name and has selected one that is already taken), unless doing so would cause a security issue (e.g. when entering a password) or context problem (e.g. they are trying to answer a question in a quiz app). in such cases, when this is appropriate, you'll probably use a combination of javascript and server-side functionality to check if the entry is cor...
-moz-force-broken-image-icon - CSS: Cascading Style Sheets
the -moz-force-broken-image-icon extended css property can be used to force the broken image icon to be shown even when a broken image has an
alt attribute. syntax values <integer> a value of 1 means that the broken image icon is shown even if the image has an
alt attribute. when the value 0 is used the image will act as usual and only display the
alt attribute. note: even if the value is set to 1 the
alt attribute will still be displayed, alongside the broken image icon. ...
...ttribute. when the value 0 is used the image will act as usual and only display the
alt attribute. note: even if the value is set to 1 the
alt attribute will still be displayed, alongside the broken image icon. formal definition initial value0applies toimagesinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples html <img src='/broken/image/link.png'
alt='broken image link'> css img { -moz-force-broken-image-icon: 1; height: 100px; width: 100px; } result screenshotlive sample note: unless the image has a specified height and width the broken image icon will not be displayed but the
alt attribute will also be hidden if -moz-force-broken-image-icon is set to 1. notes this property will only work in gecko-based browsers. the use of t...
...orce-broken-image-icon: 1; height: 100px; width: 100px; } result screenshotlive sample note: unless the image has a specified height and width the broken image icon will not be displayed but the
alt attribute will also be hidden if -moz-force-broken-image-icon is set to 1. notes this property will only work in gecko-based browsers. the use of this property is not recommended. a proper
alt attribute should be used instead. specifications not part of any standard. ...
Consistent list indentation - CSS: Cascading Style Sheets
t works in one browser often doesn't have the same effect in another. for example, if you declare that lists have no left margin, they move over in internet explorer, but sit stubbornly in place in gecko-based browsers.this article will help you understand the problems that can occur and how to avoid them. in order to understand why this is the case, and more importantly how to avoid the problem
altogether, it's necessary to examine the details of list construction. making a list first, we consider a single, pure list item. this list item has no marker (otherwise known as a "bullet") and is not yet part of a list itself. it hangs alone in the void, simple and unadorned, as shown in figure 1. that dotted red border represents outer edges of the content-area of the list item. remember tha...
...he difference is entirely in how the <ul> is styled. we can only see the difference if we try to set a background or border on the <ul> element. finding consistency boil it all down, and what we're left with is this: if you want consistent rendering of lists between gecko, internet explorer, and opera, you need to set both the left margin and left padding of the <ul> element. we can ignore <li>
altogether for these purposes. 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. set both to 1.25em, if you like -- there's no reason why you have to stick with...
... be visible. conclusion in the end, we can see that none of the browsers mentioned in this article is right or wrong about how they lay out lists. they use different default styles, and that's where the problems creep in. by making sure you style both the left padding and left margin of lists, you can find much greater cross-browser consistency in your list indentation. recommendations when
altering the indentation of lists, make sure to set both the padding and margin. original document information author(s): eric a. meyer, netscape communications last updated date: published 30 aug 2002 copyright information: copyright © 2001-2003 netscape. all rights reserved. note: this reprinted article was originally part of the devedge site. ...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
his work, the cascade algorithm defines how they interact. user-agent stylesheets the browser has a basic style sheet that gives a default style to any document. these style sheets are named user-agent stylesheets. some browsers use actual style sheets for this purpose, while others simulate them in code, but the end result is the same. some browsers let users modify the user-agent stylesheet. ...
... author stylesheets author stylesheets are the most common type of style sheet. these are style sheets that define styles as part of the design of a given web page or site. the author of the page defines the styles for the document using one or more stylesheets, which define the look and feel of the website — its theme. ...
... 3 author normal 4 animations 5 author !important 6 user !important 7 user agent !important 8 transitions in case of equality, the specificity of a value is considered to choose one or the other. resetting styles after your content has finished
altering styles, it may find itself in a situation where it needs to restore them to a known state. this may happen in cases of animations, theme changes, and so forth. the css property all lets you quickly set (almost) everything in css back to a known state. all lets you opt to immediately restore all properties to any of their initial (default) state, the state inherited from the previous level o...
animation - CSS: Cascading Style Sheets
tion> = <time> | <timing-function> | <time> | <single-animation-iteration-count> | <single-animation-direction> | <single-animation-fill-mode> | <single-animation-play-state> | [ none | <keyframes-name> ]where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function><single-animation-iteration-count> = infinite | <number><single-animation-direction> = normal | reverse |
alternate |
alternate-reverse<single-animation-fill-mode> = none | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and mu...
... specifications specification status comment css animationst...
... specifications specification status comment css animationsthe definition of 'animation' in that specification. working ...
contain - CSS: Cascading Style Sheets
omputed valueas specifiedanimation typediscrete formal syntax none | strict | content | [ size | layout | style | paint ] examples simple layout the markup below consists of a number of articles, each with content: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg"
alt="photo"> <p>more content here.</p> </article> each <article> and <img> is given a border, and the images are floated: img { float: left; border: 3px solid black; } article { border: 1px solid black; } float interference if we were to insert another image at the bottom of the first article, a large portion of the dom tree may be re-laid out or repainted, and this would also interfer...
... black; } article { border: 1px solid black; } float interference if we were to insert another image at the bottom of the first article, a large portion of the dom tree may be re-laid out or repainted, and this would also interfere with the layout of the second article: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg"
alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg"
alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; } as you can see, because of the way floats work, the first image ends up inside the area of the second article: fixing with contain if we give each ...
...ide the area of the second article: fixing with contain if we give each article the contain property with a value of content, when new elements are inserted the browser understands it only needs to recalculate the containing element's subtree, and not anything outside it: <h1>my blog</h1> <article> <h2>heading of a nice article</h2> <p>content here.</p> <img src="i-just-showed-up.jpg"
alt="social"> </article> <article> <h2>another heading of another article</h2> <img src="graphic.jpg"
alt="photo"> <p>more content here.</p> </article> img { float: left; border: 3px solid black; } article { border: 1px solid black; contain: content; } this also means that the first image no longer floats down to the second article, and instead stays inside it's containing element's...
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. in particular, font-feature-settings shouldn't be used to enable small caps. values normal text is laid out us...
...sable font features. the tag is always a <string> of 4 ascii characters. if it has more or less characters, or if it contains characters outside the u+20 – u+7e codepoint range, the whole property is invalid. the value is a positive integer. the two keywords on and off are synonyms for 1 and 0 respectively. if no value is set, the default is 1. for non-boolean opentype features (e.g. stylistic
alternates), the value implies a particular glyph to be selected; for boolean values, it is a switch. formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | <feature-tag-value>#where <feature-tag-value> = <string> [ <integer> | on | off ]? examples enabli...
...yph to be selected; for boolean values, it is a switch. formal definition initial valuenormalapplies toall elements. ...
font-variant-position - CSS: Cascading Style Sheets
the font-variant-position css property controls the use of
alternate, smaller glyphs that are positioned as superscript or subscript. the glyphs are positioned relative to the baseline of the font, which remains unchanged. these glyphs are typically used in <sub> and <sup> elements. ...
...e glyphs are positioned relative to the baseline of the font, which remains unchanged. these glyphs are typically used in <sub> and <sup> elements. /* keyword values */ font-variant-position: normal; font-variant-position: sub; font-variant-position: super; /* global values */ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; when the usage of these
alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. these
alternate glyphs share the same em-box and the same baseline as the rest of the font. they are merely graphically enhanced, and have no effect on the line-height and other box charac...
...run is rendered using a fallback method, synthesizing these glyphs. these
alternate glyphs share the same em-box and the same baseline as the rest of the font. they are merely graphically enhanced, and have no effect on the line-height and other box characteristics. syntax the font-variant-position property is specified as one of the keyword values listed below. values normal deactivates
alternate superscript and subscript glyphs. sub activates subscript
alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. super activates superscript
alternate glyphs. if, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized...
image-rendering - CSS: Cascading Style Sheets
ax auto | crisp-edges | pixelated examples setting image scaling algorithms in practical use, the pixelated and crisp-edges rules can be combined to provide some fallback for each other. (just prepend the actual rules with the fallback.) the canvas api can provide a fallback solution for pixelated through manual image data manipulation or with imagesmoothingenabled. ...
...pixelated and crisp-edges rules can be combined to provide some fallback for each other. (just prepend the actual rules with the fallback.) the canvas api can provide a fallback solution for pixelated through manual image data manipulation or with imagesmoothingenabled. ...
...ctual rules with the fallback.) the canvas api can provide a fallback solution for pixelated through manual image data manipulation or with imagesmoothingenabled. ...
Live streaming web audio and video - Developer guides
dia stream delivery. using rtp with rtcp allows for adaptive streaming. this is not yet supported natively in most browsers, but be aware that firefox os 1.3 supports rtsp. note: some vendors implement propriety transport protocols, such as realnetworks and their real data transport (rdt). rtsp 2.0 rtsp 2.0 is currently in development and is not backward compatible with rtsp 1.0. important:
although the <audio> and <video> tags are protocol agnostic, no browser currently supports anything other than http without requiring plugins,
although this looks set to change. protocols other than http may also be subject to blocking from firewalls or proxy servers. using streaming protocols the process of using the various protocols is reassuringly familiar if you are used to working with media...
...hls we can cover a significant portion of modern browsers but we still need a fallback if we want to support the rest. one popular approach is to use a flash fallback that supports rtmp. of course, we then have the issue that we need to encode in three different formats. audio streaming file formats there are also some audio formats beginning to see support across browsers. opus opus is a roy
alty-free and open format that manages to optimize quality at various bit-rates for different types of audio. music and speech can be optimized in different ways and opus uses the silk and celt codecs to achieve this. currently, opus is supported by firefox desktop and mobile as well as the latest versions of desktop chrome and opera. note: opus is a mandatory format for webrtc browser implementat...
...olon to be appended to them. icecast the icecast server is an open source technology for streaming media. maintained by the xiph.org foundation, it streams ogg vorbis/theora as well as mp3 and aac format via the shoutcast protocol. note: shoutcast and icecast are among the most established and popular technologies, but there are many more streaming media systems available. streaming services
although you can install software like gstreamer, shoutcast and icecast you will also find a lot of third-party streaming services that will do much of the work for you. see also http live streaming hls browser support http live streaming javascript player the basics of http live streaming dash adaptive streaming for html 5 video dynamic adaptive streaming over http (mpeg-dash) mpeg-dash me...
Overview of events and handlers - Developer guides
this code relies on the agreement that there is a kind of event called 'click' which will call any listener (or 'handler') function with an event object argument (actually, in this case a derivative mouseevent object) and which will be fired by html button elements after user interaction. the code has no visible effect un...
... html alert dialog. note that the handler has access to the ev object since it is passed as an argument; the object has information about the event, notably the time at which the event occurred. as a second example, much modern javascript integrated into web pages is wrapped into an event function call to ensure that the code is only executed when the html has been processed and is available for
alteration or decoration. for example, code might be attached as: var funcinit = function(){ // user code goes here and can safely address all the html elements from the page // since the document has successfully been 'loaded' } document.addeventlistener('domcontentloaded', funcinit); so that this code will only be executed after the document object emits the 'domcontentloaded' event beca...
..., such as due to changes in device orientation, the document object, including the loading, modification, user interaction, and unloading of the page, the objects in the dom (document object model) tree including user interactions or modifications, the xmlhttprequest objects used for network requests, and the media objects such as audio and video, when the media stream players change state.
although this list is currently incomplete. some notable events are: note: this list of events will need work to make relevant; that work is awaiting some global reorganization work on the documents. this will also need finding a good explanation of the events involved during page loading, such as discussed partially in this web page or in this stack overflow question. the global object windo...
Using HTML sections and outlines - Developer guides
<footer> <p>author info</p> <p>publication date</p> </footer> </article> </section> section element the section element is used for a thematic grouping of content. based on the w3c spec, a section should typically contain a heading. the heading does not require the use of the <header> element <section> <h1>amazing mdn contributors</h1> <ul> <li><img src="link"
alt="descriptive text"></li> <li><img src="link"
alt="descriptive text"></li> <li><img src="link"
alt="descriptive text"></li> </ul> </section> aside element the <aside> element defines related content that has a different placement than the main content. it is often used for call-outs, blockquotes, and definitions. the <aside> element is often used for sidebars containing extra, bu...
...you do not nest an <aside> inside an <aside>. ...
...e element the <aside> element defines related content that has a different placement than the main content. it is often used for call-outs, blockquotes, and definitions. the <aside> element is often used for sidebars containing extra, but relevant, information. <section> <h1>amazing mdn contributors</h1> <ul> <li><img src="link"
alt="descriptive text"></li> <li><img src="link"
alt="descriptive text"></li> <li><img src="link"
alt="descriptive text"></li> </ul> <aside> <p>to get involved contact</p> </aside> </section> nesting aside elements the <aside> element can be nested inside of other sectional html elements. you do not nest an <aside> inside an <aside>. meaning a call out box would not have a call-out box inside. using html5 elements in non-h...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
operties exist that let you apply color to elements and the formats you can use to describe colors, you can put this together to begin to make use of color. as you may have seen from the list under things that can have color, there are plenty of things you can color with css. let's look at this from two sides: using color within a stylesheet, and adding and changing color using javascript code to
alter the styles of elements. specifying colors in stylesheets the easiest way to apply color to elements—and the way you'll usually do it—is to simply specify colors in the css that's used when rendering elements. while we won't use every single property mentioned previously, we'll look at a couple of examples. the concept is the same anywhere you use color. let's take a look at an example, s...
...-shadow. its color parameter is set to black. letting the user pick a color there are many situations in which your website may need to let the user select a color. perhaps you have a customizable user interface, or you're implementing a drawing app. maybe you have editable text and need to let the user choose the text color. or perhaps your app lets the user assign colors to folders or items.
although historically it's been necessary to implement your own color picker, html now provides support for browsers to provide one for your use through the <input> element, by using "color" as the value of its type attribute. the <input> element represents a color only in the hexadecimal string notation covered above. example: picking a color let's look at a simple example, in which the user can ...
... the color of a shape from white to green for success and red for failure, users with red-green color-blindness won't be able to use your site properly. instead, perhaps use both text and color together, so that everyone can understand what's happening. for more information about color blindness, see the following articles: medline plus: color blindness (united states national institute of he
alth) american academy of ophthamology: what is color blindness? color blindness & web design (usability.gov: united states department of he
alth and human services) palette design example let's consider a quick example of selecting an appropriate color palette for a site. imagine that you're building a website for a new game that takes place on the planet mars. so let's do a google search for ph...
HTML attribute reference - HTML: Hypertext Markup Language
d focus to the element. action <form> the uri of a program that processes the information submitted via the form. align <applet>, <caption>, <col>, <colgroup>, <hr>, <iframe>, <img>, <table>, <tbody>, <td>, <tfoot> , <th>, <thead>, <tr> specifies the horizontal alignment of the element. allow <iframe> specifies a feature-policy for the iframe.
alt <applet>, <area>, <img>, <input>
alternative text in case an image can't be displayed. async <script> executes the script asynchronously. autocapitalize global attribute sets whether input is automatically capitalized when entered by user autocomplete <form>, <input>, <select>, <textarea> indicates whether controls in this form can by default hav...
...efault have their values automatically completed by the browser. autofocus <button>, <input>, <keygen>, <select>, <textarea> the element should be automatically focused after the page loaded. autoplay <audio>, <video> the audio or video should play as soon as possible. background <body>, <table>, <td>, <th> specifies the url of an image file. note:
although browsers and email clients may still support this attribute, it is obsolete. use css background-image instead. bgcolor <body>, <col>, <colgroup>, <marquee>, <table>, <tbody>, <tfoot>, <td>, <th>, <tr> background color of the element. note: this is a legacy attribute. please use the css background-color property instead. border <img>, <ob...
...ut invalid xml. </div> <div itemscope=itemscope> this is also valid html but invalid xml. </div> <div itemscope=""> this is valid html and also valid xml. </div> <div itemscope="itemscope"> this is also valid html and xml, but perhaps a bit verbose. </div> to be clear, the values "true" and "false" are not allowed on boolean attributes. to represent a false value, the attribute has to be omitted
altogether. this restriction clears up some common misunderstandings: with checked="false" for example, the element’s checked attribute would be interpreted as true because the attribute is present. ...
<canvas>: The Graphics Canvas element - HTML: Hypertext Markup Language
ls. defaults to 150. moz-opaque lets the canvas know whether or not translucency will be a factor. if the canvas knows there's no translucency, painting performance can be optimized. this is only supported by mozilla-based browsers; use the standardized canvas.getcontext('2d', { alpha: false }) instead. width the width of the coordinate space in css pixels. defaults to 300. usage notes
alternative content you may (and should) provide
alternate content inside the <canvas> block. that content will be rendered both on older browsers that don't support canvas and in browsers with javascript disabled. providing a useful fallback text or sub dom helps to make the the canvas more accessible. required </canvas> tag unlike the <img> element, the <canvas> element requires the closing tag ...
... x 16,384) ie 8,192 pixels 8,192 pixels ? note: exceeding the maximum dimensions or area renders the canvas unusable — drawing commands will not work. examples html this code snippet adds a canvas element to your html document. a fallback text is provided if a browser is unable to render the canvas, or if can't read a canvas. ...
...canvas content is not exposed to accessibility tools as semantic html is. in general, you should avoid using canvas in an accessible website or app. the following guides can help to make it more accessible. ...
<marquee>: The Marquee element (Obsolete) - HTML: Hypertext Markup Language
if no value is specified, the default value is scroll. ...
...ed. truespeed by default, scrolldelay values lower than 60 are ignored. if truespeed is present, those values are not ignored. vspace sets the vertical margin in pixels or percentage value. width sets the width in pixels or percentage value. event handlers onbounce fires when the marquee has reached the end of its scroll position. it can only fire when the behavior attribute is set to
alternate. onfinish fires when the marquee has finished the amount of scrolling that is set by the loop attribute. it can only fire when the loop attribute is set to some number that is greater than 0. onstart fires when the marquee starts scrolling. methods start() starts scrolling of the marquee. stop() stops scrolling of the marquee. examples <marquee>this text will scroll from righ...
...set to some number that is greater than 0. onstart fires when the marquee starts scrolling. methods start() starts scrolling of the marquee. stop() stops scrolling of the marquee. examples <marquee>this text will scroll from right to left</marquee> <marquee direction="up">this text will scroll from bottom to top</marquee> <marquee direction="down" width="250" height="200" behavior="
alternate" style="border:solid"> <marquee behavior="
alternate"> this text will bounce </marquee> </marquee> specifications specification status comment html living standardthe definition of '<marquee>' in that specification. living standard make it obsolete in favor of css but define its expected behavior, for backward compatibility. however, the developm...
<noembed>: The Embed Fallback element (Obsolete) - HTML: Hypertext Markup Language
the <noembed> element is an obsolete, non-standard way to provide
alternative, or "fallback", content for browsers that do not support the <embed> element or do not support the type of embedded content an author wishes to use. this element was deprecated in html 4.01 and above in favor of placing fallback content between the opening and closing tags of an <object> element. while this element currently still works in many browsers, it is obsolete and should not be used. use <object> instead, with fallback content between the opening and closing tags of the element. examples the message inside <noembed> tag will appear only when your browser does not support <embed> tag. ...
...acing fallback content between the opening and closing tags of an <object> element. ...
...ks in many browsers, it is obsolete and should not be used. use <object> instead, with fallback content between the opening and closing tags of the element. ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
ffect, use css width instead. wrap is a hint indicating how the overflow must happen. in modern browser this hint is ignored and no visual effect results in its present; to achieve such an effect, use css white-space instead. example html <p>using css to change the font color is easy.</p> <pre> body { color: red; } </pre> result accessibility concerns it is important to provide an
alternate description for any images or diagrams created using preformatted text. the
alternate description should clearly and concisely describe the image or diagram's content. people experiencing low vision conditions and browsing with the aid of assistive technology such as a screen reader may not understand what the preformatted text characters are representing when they are read out in sequence...
...ssistive technology such as a screen reader may not understand what the preformatted text characters are representing when they are read out in sequence. a combination of the <figure> and <figcaption> elements, supplemented by a combination of an id and the aria role and aria-labelledby attributes allow the preformatted text to be announced as an image, with the figcaption serving as the image's
alternate description. example <figure role="img" aria-labelledby="cow-caption"> <pre> ___________________________ < i'm an expert in my field. > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || </pre> <figcaption id="cow-caption"> a cow saying, "i'm an expert in my field." the c...
...---------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || </pre> <figcaption id="cow-caption"> a cow saying, "i'm an expert in my field." the cow is illustrated using preformatted text characters. </figcaption> </figure> mdn understanding wcag, guideline 1.1 explanations h86: providing text
alternatives for ascii art, emoticons, and leetspeak | w3c techniques for wcag 2.0 specifications specification status comment html living standardthe definition of '<pre>' in that specification. living standard no significant change from html5 html5the definition of '<pre>' in that specification. recommendation no significant change from html 4.01 ...
HTML elements reference - HTML: Hypertext Markup Language
e. <object> the html <object> element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin. <param> the html <param> element defines parameters for an <object> element. <picture> the html <picture> element contains zero or more <source> elements and one <img> element to offer
alternative versions of an image for different display/device scenarios. <source> the html <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. scripting in order to create dynamic content and web applications, html supports the use of scripting languages, most prominently javascript. certain elements support this c...
...es a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser. <script> the html <script> element is used to embed executable code or data; this is typically used to embed or refer to javascript code. demarcating edits these elements let you provide indications that specific parts of the text have been
altered. element description <del> the html <del> element represents a range of text that has been deleted from a document. <ins> the html <ins> element represents a range of text that has been added to a document. table content the elements here are used to create and handle tabular data. element description <caption...
...ing tool to generate automatic name labels for its anchors. <nobr> the non-standard, obsolete html <nobr> element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. <noembed> the <noembed> element is an obsolete, non-standard way to provide
alternative, or "fallback", content for browsers that do not support the <embed> element or do not support the type of embedded content an author wishes to use. <noframes> the obsolete html no frames or frame fallback element, <noframes>, provides content to be presented in browsers that don't support (or have disabled support for) the <frame> element. <plaintext> the html...
Identifying resources on the Web - HTTP
a document, a photo, or anything else. each resource is identified by a uniform resource identifier (uri) used throughout http for identifying resources. the identity and the location of resources on the web are mostly given by a single url (uniform resource locator, a kind of uri). there are sometimes reasons identity and location are not given by the same uri: http uses a specific http header,
alt-svc when the resource requested wants the client to access it at another location. urls and urns urls the most common form of uri is the uniform resource locator (url), which is known as the web address. https://developer.mozilla.org https://developer.mozilla.org/docs/learn/ https://developer.mozilla.org/search?q=url any of those urls can be typed into your browser's address bar to tell it t...
...ript code mailto electronic mail address ssh secure shell tel telephone urn uniform resource names view-source source code of the resource ws/wss (encrypted) websocket connections authority www.example.com is the domain name or authority that governs the namespace. it indicates which web server is being requested.
alternatively, it is possible to directly use an ip address, but because it is less convenient, it is not often used on the web. port :80 is the port in this instance. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resour...
...ew of these url schemes. when referring to subresources — that is, files that are being loaded as part of a larger document — you should only use the http and https schemes. increasingly, browsers are removing support for using ftp to load subresources, for security reasons. ftp is still acceptable at the top level (such as typed directly into the browser's url bar, or the target of a link),
although some browsers may delegate loading ftp content to another application. examples https://developer.mozilla.org/docs/learn tel:+1-816-555-1212 git@github.com:mdn/browser-compat-data.git ftp://example.org/resource.txt urn:isbn:9780141036144 mailto:help@supercyberhelpdesk.info specifications specification title rfc 7230, section 2.7: uniform resource identifiers hype...
Content negotiation - HTTP
n http, content negotiation is the mechanism that is used for serving different representations of a resource at the same uri, so that the user agent can specify which is best suited for the user (for example, which language of a document, which image format, or which content encoding). note: some disadvantages of http content negotiation are explained in a wiki page from whatwg. html5 provides
alternatives to content negotiation via, for example, the <source> element. principles of content negotiation a specific document is called a resource. when a client wants to obtain a resource, the client requests it using its url. the server uses this url to choose one of the variants it provides – each variant being called a representation – and returns a specific representation to the clien...
...(server-driven negotiation or proactive negotiation), which is the standard way of negotiating a specific kind of resource. the 300 (multiple choices) or 406 (not acceptable) http response codes by the server (agent-driven negotiation or reactive negotiation), that are used as fallback mechanisms. over the years, other content negotiation proposals, like transparent content negotiation and the
alternates header, have been proposed. they failed to get traction and got abandoned. server-driven content negotiation in server-driven content negotiation, or proactive content negotiation, the browser (or any other kind of user-agent) sends several http headers along with the url. these headers describe the preferred choice of the user. the server uses them as hints and an internal algorithm cho...
...ease in performance. the more precise headers are sent, the more entropy is sent, allowing for more http fingerprinting and corresponding privacy concern. from the beginnings of http, the protocol allowed another negotiation type: agent-driven negotiation or reactive negotiation. in this negotiation, when facing an ambiguous request, the server sends back a page containing links to the available
alternative resources. the user is presented the resources and choose the one to use. unfortunately, the http standard does not specify the format of the page allowing to choose between the available resource, which prevents to easily automatize the process. besides falling back to the server-driven negotiation, this method is almost always used in conjunction with scripting, especially with javas...
X-Frame-Options - HTTP
long as the site including it in a frame is the same as the one serving the page. deny the page cannot be displayed in a frame, regardless of the site attempting to do so. sameorigin the page can only be displayed in a frame on the same origin as the page itself. the spec leaves it up to browser vendors to decide whether this option applies to the top level, the parent, or the whole chain,
although it is argued that the option is not very useful unless all ancestors are also in the same origin (see bug 725490). also see browser compatibility for support details. allow-from uri this is an obsolete directive that no longer works in modern browsers. don't use it. in supporting legacy browsers, a page can be displayed in a frame only on the specified origin uri. note that in the legacy...
... name="x-frame-options" value="sameorigin" /> </customheaders> </httpprotocol> ... </system.webserver> or see this microsoft support article on setting this configuration using the iis manager user interface. ...
...ions:\ sameorigin
alternatively, in newer versions: http-response set-header x-frame-options sameorigin configuring express to configure express to send the x-frame-options header, you can use helmet which uses frameguard to set the header. ...
Grammar and types - JavaScript
a top-level property whose value is not defined. number. an integer or floating point number. for example: 42 or 3.14159. bigint. an integer with arbitrary precision. for example: 9007199254740992n. string. a sequence of characters that represent a text value. for example: "howdy" symbol (new in ecmascript 2015). a data type whose instances are unique and immutable. and object
although these data types are relatively few, they enable you to perform useful functions with your applications. objects and functions are the other fundamental elements in the language. you can think of objects as named containers for values, and functions as procedures that your script can perform. data type conversion javascript is a dynamically typed language. this means you don't have to spec...
...case that a value representing a number is in memory as a string, there are methods for conversion. parseint() parsefloat() parseint only returns whole numbers, so its use is diminished for decimals. additionally, a best practice for parseint is to always include the radix parameter. the radix parameter is used to specify which numerical system is to be used. parseint('101', 2) // 5 an
alternative method of retrieving a number from a string is with the + (unary plus) operator: '1.1' + '1.1' // '1.11.1' (+'1.1') + (+'1.1') // 2.2 // note: the parentheses are added for clarity, not required. literals literals represent values in javascript. these are fixed values—not variables—that you literally provide in your script. this section describes the following types of literals: ...
...backslash character. for example, to assign the file path c:\temp to a string, use the following: var home = 'c:\\temp'; you can also escape line breaks by preceding them with backslash. the backslash and line break are both removed from the value of the string. var str = 'this string \ is broken \ across multiple \ lines.' console.log(str); // this string is broken across multiple lines.
although javascript does not have "heredoc" syntax, you can get close by adding a line break escape and an escaped line break at the end of each line: var poem = 'roses are red,\n\ violets are blue.\n\ sugar is sweet,\n\ and so is foo.' ecmascript 2015 introduces a new type of literal, namely template literals. this allows for many new features, including multiline strings! var poem = `roses are ...
Introduction - JavaScript
l objects and statements. what is javascript? javascript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). there are also more advanced server side versions of javascript such as node.js, which allow you to add more functionality to a website than simply downloading files (such as re
altime collaboration between multiple computers). inside a host environment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them. javascript contains a standard library of objects, such as array, date, and math, and a core set of language elements such as operators, control structures, and statements. core javascript ca...
...ant to implement standards-compliant language features in your ecmascript implementation or engine (such as spidermonkey in firefox, or v8 in chrome). the ecmascript document is not intended to help script programmers. use the javascript documentation for information when writing scripts. the ecmascript specification uses terminology and syntax that may be unfamiliar to a javascript programmer.
although the description of the language may differ in ecmascript, the language itself remains the same. javascript supports all functionality outlined in the ecmascript specification. the javascript documentation describes aspects of the language that are appropriate for a javascript programmer. getting started with javascript getting started with javascript is easy: all you need is a modern web ...
...ed. for the sake of simplicity, it can be imagined that every time something is entered into the console, it is actually surrounded by console.log around eval, like so: function greetme(yourname) { alert("hello " + yourname) } console.log(eval('3 + 5')) multi-line input in the web console the single-line input mode of the web console is great for quick testing of javascript expressions, but
although you can execute multiple lines, it's not very convenient for that. for more complex javascript, you can use the multi-line line input mode. hello world to get started with writing javascript, open the web console in multi-line mode, and write your first "hello world" javascript code: (function(){ "use strict"; /* start of your code */ function greetme(yourname) { alert('hello ' ...
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
the javascript warning "date.prototype.tolocaleformat is deprecated; consider using intl.datetimeformat instead" occurs when the non-standard date.prototype.tolocaleformat method is used. message warning: date.prototype.tolocaleformat is deprecated; consider using intl.datetimeformat instead error type warning. javascript execution won't be h
alted. what went wrong? the non-standard date.prototype.tolocaleformat method is deprecated and shouldn't be used anymore. it uses a format string in the same format expected by the strftime() function in c. the function is no longer available in firefox 58+. examples deprecated syntax the date.prototype.tolocaleformat method is deprecated and will be removed (no cross-browser support, available in firefox only). var today = new date(); var da...
... expected by the strftime() function in c. the function is no longer available in firefox 58+. examples deprecated syntax the date.prototype.tolocaleformat method is deprecated and will be removed (no cross-browser support, available in firefox only). var today = new date(); var date = today.tolocaleformat('%a, %e. %b %y'); console.log(date); // in german locale // "freitag, 10. märz 2017"
alternative standard syntax using the ecmascript intl api the ecma-402 (ecmascript intl api) standard specifies standard objects and methods that enable language sensitive date and time formatting (available in chrome 24+, firefox 29+, ie11+, safari10+). you can now either use the date.prototype.tolocaledatestring method if you just want to format one date. var today = new date(); var options = { ...
...tes to format. var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; var dateformatter = new intl.datetimeformat('de-de', options) var dates = [date.utc(2012, 11, 20, 3, 0, 0), date.utc(2014, 04, 12, 8, 0, 0)]; dates.foreach(date => console.log(dateformatter.format(date))); // "donnerstag, 20. dezember 2012" // "montag, 12. mai 2014"
alternative standard syntax using date methods the date object offers several methods to build a custom date string. (new date()).tolocaleformat("%y%m%d"); // "20170310" can be converted to: let now = new date(); let date = now.getfullyear() * 10000 + (now.getmonth() + 1) * 100 + now.getdate(); console.log(date); // "20170310" ...
TypeError: invalid assignment to const "x" - JavaScript
it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. ...
...it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. examples invalid redeclaration assigning a value to the same constant name in the same block-scope will throw. const columns = 80; // ... ...
... in a function, for example? const columns = 80; function setupbigscreenenvironment() { const columns = 120; } const and immutability the const declaration creates a read-only reference to a value. it does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned. for instance, in case the content is an object, this means the object itself can still be
altered. this means that you can't mutate the value stored in a variable: const obj = {foo: 'bar'}; obj = {foo: 'baz'}; // typeerror: invalid assignment to const `obj' but you can mutate the properties in a variable: obj.foo = 'baz'; obj; // object { foo: "baz" } ...
Array.prototype.reduce() - JavaScript
e; } }); } caution: if you need to support truly obsolete javascript engines that do not support object.defineproperty(), it is best not to polyfill array.prototype methods at all, as you cannot make them non-enumerable. examples sum all the values of an array let sum = [0, 1, 2, 3].reduce(function (accumulator, currentvalue) { return accumulator + currentvalue }, 0) // sum is 6
alternatively written with an arrow function: let total = [ 0, 1, 2, 3 ].reduce( ( accumulator, currentvalue ) => accumulator + currentvalue, 0 ) sum of values in an object array to sum up, the values contained in an array of objects, you must supply an initialvalue, so that each item passes through your function. let initialvalue = 0 let sum = [{x: 1}, {x: 2}, {x: 3}].reduce(function (accumu...
... => accumulator + currentvalue, 0 ) sum of values in an object array to sum up, the values contained in an array of objects, you must supply an initialvalue, so that each item passes through your function. ...
... function: let initialvalue = 0 let sum = [{x: 1}, {x: 2}, {x: 3}].reduce( (accumulator, currentvalue) => accumulator + currentvalue.x , initialvalue ) console.log(sum) // logs 6 flatten an array of arrays let flattened = [[0, 1], [2, 3], [4, 5]].reduce( function(accumulator, currentvalue) { return accumulator.concat(currentvalue) }, [] ) // flattened is [0, 1, 2, 3, 4, 5]
alternatively written with an arrow function: let flattened = [[0, 1], [2, 3], [4, 5]].reduce( ( accumulator, currentvalue ) => accumulator.concat(currentvalue), [] ) counting instances of values in an object let names = ['alice', 'bob', 'tiff', 'bruce', 'alice'] let countednames = names.reduce(function (allnames, name) { if (name in allnames) { allnames[name]++ } else { allnam...
Object.prototype.__proto__ - JavaScript
if you care about performance you should avoid setting the [[prototype]] of an object. ...
...if you care about performance you should avoid setting the [[prototype]] of an object. instead, create a new object with the desired [[prototype]] using object.create(). ...
...upported into the future. 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). the __proto__ property can also be used in an object literal definition to set the object [[prototype]] on creation, as an
alternative to object.create(). see: object initializer / literal syntax. description the __proto__ getter function exposes the value of the internal [[prototype]] of an object. for objects created using an object literal, this value is object.prototype. for objects created using array literals, this value is array.prototype. for functions, this value is function.prototype. for objects created usin...
Object - JavaScript
the object class represents one of javascript's data types. it is used to store various keyed collections and more complex entities. objects can be created using the object() constructor or the object initializer / literal syntax. description nearly all objects in javascript are instances of object; a typical object inherits properties (including methods) from object.prototype,
although these properties may be shadowed (a.k.a. overridden). however, an object may be deliberately created for which this is not true (e.g. by object.create(null)), or it may be
altered so that this is no longer true (e.g. with object.setprototypeof). changes to the object prototype object are seen by all objects through prototype chaining, unless the properties and methods subject to those changes are overridde...
... the object constructor creates an object wrapper for the given value. if the value is null or undefined, it will create and return an empty object. ...
...for example, this (untested) code will pre-conditionally execute custom logic before the built-in logic or someone else's extension is executed. when a function is called, the arguments to the call are held in the array-like "variable" arguments. for exam...
eval() - JavaScript
er. if you run eval() with a string that could be affected by a malicious party, you may end up running malicious code on the user's machine with the permissions of your webpage / extension. more importantly, a third-party code can see the scope in which eval() was invoked, which can lead to possible attacks in ways to which the similar function is not susceptible. eval() is also slower than the
alternatives, since it has to invoke the javascript interpreter, while many other constructs are optimized by modern js engines. additionally, modern javascript interpreters convert javascript to machine code. this means that any concept of variable naming gets obliterated. thus, any use of eval() will force the browser to do long expensive variable name lookups to figure out where the variable exis...
... any use of eval() will force the browser to do long expensive variable name lookups to figure out where the variable exists in the machine code and set its value. additonally, new things can be introduced to that variable through eval() such as changing the type of that variable, forcing the browser to re-evaluate all of the generated machine code to compensate. fortunately, there's a very good
alternative to eval(): simply using window.function(). see this example of how to convert code using a dangerous eval() to using function(), see below. bad code with eval(): function loosejsonparse(obj){ return eval("(" + obj + ")"); } console.log(loosejsonparse( "{a:(4-1), b:function(){}, c:new date()}" )) better code without eval(): function loosejsonparse(obj){ return function('"us...
...u can minify the code string passed to runcodewithdatefunction() far more efficiently because the function arguments names can be minified too as seen in the minified code below. console.log(function('"use strict";return(function(a){return a(5)})')()(function(a){ return"monday tuesday wednesday thursday friday saturday sunday".split(" ")[a%7||0]})); there are also additional safer (and faster!)
alternatives to eval() or function() for common use-cases. accessing member properties you should not use eval() to convert property names into properties. consider the following example where the property of the object to be accessed is not known until the code is executed. this can be done with eval(): var obj = { a: 20, b: 30 }; var propname = getpropname(); // returns "a" or "b" eval( 'var r...
undefined - JavaScript
ined) { // these statements execute } else { // these statements do not execute } note: the strict equality operator (as opposed to the standard equality operator) must be used here, because x == undefined also checks whether x is null, while strict equality doesn't. this is because null is not equivalent to undefined. see comparison operators for details. typeof operator and undefined
alternatively, typeof can be used: var x; if (typeof x === 'undefined') { // these statements execute } one reason to use typeof is that it does not throw an error if the variable has not been declared. // x has not been declared before if (typeof x === 'undefined') { // evaluates to true without errors // these statements execute } if (x === undefined) { // throws a referenceerror } ...
...ed: var x; if (typeof x === 'undefined') { // these statements execute } one reason to use typeof is that it does not throw an error if the variable has not been declared. // x has not been declared before if (typeof x === 'undefined') { // evaluates to true without errors // these statements execute } if (x === undefined) { // throws a referenceerror } however, there is another
alternative. javascript is a statically scoped language, so knowing if a variable is declared can be read by seeing whether it is declared in an enclosing context. the global scope is bound to the global object, so checking the existence of a variable in the global context can be done by checking the existence of a property on the global object, using the in operator, for instance: if ('x' in windo...
...declared in an enclosing context. the global scope is bound to the global object, so checking the existence of a variable in the global context can be done by checking the existence of a property on the global object, using the in operator, for instance: if ('x' in window) { // these statements execute only if x is defined globally } void operator and undefined the void operator is a third
alternative. var x; if (x === void 0) { // these statements execute } // y has not been declared before if (y === void 0) { // throws uncaught referenceerror: y is not defined } specifications specification ecmascript (ecma-262)the definition of 'undefined' in that specification. ...
var - JavaScript
rties on the global object. the property created on the global object for global variables, is set to be non-configurable because the identifier is to be treated as a variable, rather than a straightforward property of the global object. javascript has automatic memory management, and it would make no sense to be able to use the delete operator on a global variable. 'use strict'; var x = 1; glob
althis.hasownproperty('x'); // true delete glob
althis.x; // typeerror in strict mode. fails silently otherwise. delete x; // syntaxerror in strict mode. fails silently otherwise. note that in both nodejs commonjs modules and native ecmascript modules, top-level variable declarations are scoped to the module, and are not, therefore added as properties to the global object. unqualified identifier a...
...ations are scoped to the module, and are not, therefore added as properties to the global object. unqualified identifier assignments the global object sits at the top of the scope chain. when attempting to resolve a name to a value, the scope chain is searched. this means that properties on the global object are conveniently visible from every scope, without having to qualify the names with glob
althis. or window. or global.. so you can just type: function foo() { string('s') // note the function `string` is implicitly visible } ...because glob
althis.hasownproperty('string') // true so the global object will ultimately be searched for unqualified identifiers. you don't have to type glob
althis.string, you can just type the unqualified string. the corollary, in non-strict mode, is that ...
...assignment to an unqualified identifier in strict mode will result in a referenceerror, to avoid the accidental creation of properties on the global object. ...
Strict mode - JavaScript
ometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. strict mode treats these mistakes as errors so that they're discovered and promptly fixed. first, strict mode makes it impossible to accidentally create global variables. in normal javascript mistyping a variable in an assignment creates a new property on the global object and continues to "work" (
although future failure is possible: likely, in modern javascript). assignments, which would accidentally create global variables, instead throw an error in strict mode: 'use strict'; // assuming no global variable mistypedvariable exists mistypevariable = 17; // this line throws a referenceerror due to the // misspelling of variable second, strict mo...
.... strict mode makes with a syntax error, so there's no chance for a name in a with to refer to an unknown location at runtime: 'use strict'; var x = 17; with (obj) { // !!! syntax error // if this weren't strict mode, would this be var x, or // would it instead be obj.x? it's impossible in general // to say without running the code, so the name can't be // optimized. x; } the simple
alternative of assigning the object to a short name variable, then accessing the corresponding property on that variable, stands ready to replace with. second, eval of strict mode code does not introduce new variables into the surrounding scope. in normal code eval("var x;") introduces a variable x into the surrounding function or the global scope. this means that, in general, in a function containi...
...;'); // !!! syntax error making eval and arguments simpler strict mode makes arguments and eval less bizarrely magical. both involve a considerable amount of magical behavior in normal code: eval to add or remove bindings and to change binding values, and arguments by its indexed properties aliasing named arguments. strict mode makes great strides toward treating eval and arguments as keywords,
although full fixes will not come until a future edition of ecmascript. first, the names eval and arguments can't be bound or assigned in language syntax. all these attempts to do so are syntax errors: 'use strict'; eval = 17; arguments++; ++eval; var obj = { set p(arguments) { } }; var eval; try { } catch (arguments) { } function x(eval) { } function arguments() { } var y = function eval() { }; va...
Media container formats (file types) - Web media technologies
e as of early 2016, and should not be used, as there are known security concerns. however, windows media player now has integrated support for quicktime version 2.0 and earlier files; support for later versions of quicktime requires third-party additions. on mac os, the quicktime framework not only supported quicktime format movie files and codecs, but supported a vast array of popular and speci
alty audio and video codecs, as well as still image formats. through quicktime, mac applications (including web browsers, through the quicktime plugin or direct quicktime integration) were able to read and write audio formats including aac, aiff, mp3, pcm, and qualcomm purevoice; and video formats including avi, dv, pixlet, prores, flac, cinepak, 3gp, h.261 through h.265, mjpeg, mpeg-1 and mpeg-4 par...
... lpcm (linear pulse code modulation) yes mpeg-1 audio layer iii (mp3) no µ-law (u-law) no webm webm (web media) is a format based on matroska which is designed specifically for use in modern web environments. it's based entirely on free and open technologies and primarily uses codecs that are in turn free and open,
although some products support other codecs in webm containers as well. webm was first introduced in 2010 and is now widely supported. compliant implementations of webm are required to support the vp8 and vp8 video codecs and the theora and opus audio codecs. the webm container format and its required codecs are all available under open licenses. any other codecs may require a license to use. web...
...ormat compressed files for general-purpose playback mp3 (mpeg-1 audio layer iii) losslessly compressed files flac with alac fallback uncompressed files wav now that mp3's patents have all expired, the choice of audio file format has become much easier to make. it's no longer necessary to choose between mp3's broad compatibility and the need to pay roy
alties when using it. video files if you need... consider using this container format general purpose video, preferably in an open format webm (ideally with mp4 fallback) general purpose video mp4 (ideally with webm or ogg fallback) high compression optimized for slow connections 3gp (ideally with mp4 fallback) compatibility with older device...
Paths - SVG: Scalable Vector Graphics
red"/> <circle cx="90" cy="90" r="2" fill="red"/> <circle cx="90" cy="10" r="2" fill="red"/> <circle cx="10" cy="90" r="2" fill="red"/> </svg> we can shorten the above path declaration a little bit by using the "close path" command, called with z. this command draws a straight line from the current position back to the first point of the path. it is often placed at the end of a path node,
although not always. there is no difference between the uppercase and lowercase command. z (or) z so our path above could be shortened to: <path d="m 10 10 h 90 v 90 h 10 z" fill="transparent" stroke="black"/> the relative forms of these commands can also be used to draw the same picture. relative commands are called by using lowercase letters, and rather than moving the cursor to an exact ...
... the path will move to point (10,10) and then move horizontally 80 points to the right, then 80 points down, then 80 points to the left, and then back to the start. in these examples, it would probably be simpler to use the <polygon> or <polyline> elements. however, paths are used so often in drawing svg that developers may be more comfortable using them instead. there is no real performance pen
alty or bonus for using one or the other. curve commands there are three different commands that can be used to create smooth curves. two of those curves are bézier curves, and the third is an "arc" or part of a circle. you might have already gained practical experience with bézier curves using path tools in inkscape, illustrator or photoshop. for a complete description of the math behind bézier...
... specifying only end points. this only works if the previous command was a q or a t command. if not, then the control point is assumed to be the same as the previous point, and only lines will be drawn. <svg width="190" height="160" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 80 q 52.5 10, 95 80 t 180 80" stroke="black" fill="transparent"/> </svg> both curves produce similar results,
although the cubic one allows greater freedom in exactly what the curve looks like. deciding which curve to use is situational and depends on the amount of symmetry the line has. arcs the other type of curved line that can be created using svg is the arc, called with the a command. arcs are sections of circles or ellipses. for a given x-radius and y-radius, there are two ellipses that can connect ...
Index - XSLT: Extensible Stylesheet Language Transformations
those usually tell the mime type. 3 index index, reference, xslt found 54 pages: 4 pi parameters xslt no summary! 5 the xslt/javascript interface in gecko xslt no summary! 6 advanced example xslt this advanced example sorts several divs based on their content. the example allows sorting the content multiple times,
alternating between ascending and descending order. the javascript loads the .xsl file only on the first sort and sets the xslloaded variable to true once it has finished loading the file. using the xsltprocessor.getparameter() method, the code can figure whether to sort in ascending or descending order. it defaults to ascending if the parameter is empty (the first time the sorting happens, as there ...
...ia xmlhttprequest or xmldocument.load(). 11 resources xslt no summary! 12 setting parameters xslt while running transformations using precoded .xsl and .xml files is quite useful, configuring the .xsl file from javascript may be even more useful. for example, javascript and xslt could be used to sort xml data and then display it. the sorting would have to
alternate between ascending and descending sorting. 13 transforming xml with xslt needsmigration, transforming_xml_with_xslt, xml, xslt the separation of content and presentation is a key design feature of xml. the structure of an xml document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to pro...
...ues. but it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.). 24 <xsl:call-template> element, reference, xslt, call-template the <xsl:call-template> element invokes a named template. 25 <xsl:choose> element, reference, xslt, choose the <xsl:choose> element defines a choice among a number of
alternatives. it behaves like a switch statement in procedural languages. 26 <xsl:comment> comment, element, reference, xslt the <xsl:comment> element writes a comment to the output document. it must include only text. 27 <xsl:copy-of> element, reference, xslt, copy-of the <xsl:copy-of> element makes a deep copy (including descendant nodes) of whatever the se...
Communicating using "postMessage" - Archive of obsolete content
in most cases port is preferable to message events. however, the context-menu module does not support port, so to send messages from a content script to the add-on via a context menu object, you must use message events. handling message events in the content script to send a message from a content script, you use the postmessage function of the global self object: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value. ...
...} }); to receive messages from a content script, use the worker's on function. ...
hotkeys - Archive of obsolete content
nction to be called when the user presses that combination. for example, this add-on defines two hotkey combinations, to show and hide a panel: // define keyboard shortcuts for showing and hiding a custom panel. var { hotkey } = require("sdk/hotkeys"); var showhotkey = hotkey({ combo: "accel-shift-o", onpress: function() { showmypanel(); } }); var hidehotkey = hotkey({ combo: "accel-
alt-shift-o", onpress: function() { hidemypanel(); } }); choosing hotkeys hotkeys should be chosen with care. it's very easy to use combinations that clash with hotkeys defined for firefox or for other add-ons. the following commonly 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 defi...
...nation defined by hotkey is pressed. if more than one hotkey is created for the same key combination, the listener is executed only on the last one created. parameters options : object required options: name type combo string any function key: "f1, f2, ..., f24" or key combination in the format of 'modifier-key': "accel-s" "meta-shift-i" "control-
alt-d" all hotkeys require at least one modifier as well as the key. these are the possible modifiers you can supply: shift: the shift key.
alt: the
alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since
alt-letter combinations are reserved for entering special characters in text. meta: the meta key. ...
core/promise - Archive of obsolete content
ject that contains a promise and two resolve, reject functions that can be used to resolve / reject that promise. note: a promise can be rejected or resolved only once. all subsequent attempts to either reject it or resolve it will be ignored. ...
...in fact some other promise frameworks do that. such use cases are also supported. earlier described defer may be passed optional prototype argument, in order to make the returned promise and all the subsequent promises decendents of that prototype: let { promise, resolve } = defer...
ui/button/toggle - Archive of obsolete content
ked by direct assignment to the button, this will be overridden by the user clicking the button. if you want to change this default behavior, you can delete the window-specific state in your button's onchange handler. ...
...pecific label" console.log(button.state(tabs[0]).label); // access the second tab's label -> "tab-specific label" console.log(button.state(tabs[1]).label); // reset the tab-specific state button.state(tab, null); // access the second tab's label -> "window-specific label" console.log(button.state(tabs[1]).label); } finally, you can pass the button itself into state(). this is an
alternative way to set or get the global state. the reason for using this, rather than setting state properties individually, is that you can define an object with the properties to set in one place, then apply it to the global state with a single line: const defaultstate = { "label": "default label", "icon": "./default.png", } const differentstate = { "label": "different label", "icon": ".
Localization - Archive of obsolete content
t html using a statement like: # does not work. html tags are inserted as text. ...
... plural forms in the sdk in the code, you supply an extra parameter alongside the identifier, describing how many items there are: var _ = require("sdk/l10n").get; console.log(_("tomato_id")); console.log(_("tomato_id", 1)); console.log(_("tomato_id", 2)); console.log(_("tomato_id", 5)); console.log(_("tomato_id", .5)); in the .p...
Finding window handles - Archive of obsolete content
when working on windows platforms, many apis and frameworks require a window handle (hwnd type). since mozilla tries to be as cross-platform as possible, it can be difficult to get the handle you need. note: starting in gecko 2.0, only the top level browser window has an hwnd. web content windows (in tabs) do not have their own hwnds. typically the top level browser window hwnd has no children,
although if there are windowed plugins (such as flash) visible in the window, they will have hwnds whose parent is the top level browser window hwnd. here is some simple code that can get access to mozilla window handles. this code can be used from external application or from an xpcom component within an extension. finding the content window handle hwnd hcontent = 0; // first we need to find ...
...notice that by using only the c++ part of this code will get the the parent window handle of the nsibasewindow you give as a param. that means if you use the top level nsibasewindow as a param, null will be returned in the chain and cause crash of firefox, that's a bug of firefox.(https://bugzilla.mozilla.org/show_bug.cgi?id=4...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
all of these documents currently assume, however, that you are developing your extension using xul and javascript only. for complex extensions, it may be necessary to create components in c++ that provide additional functionality. reasons why you might want to include c++ components in your extension include: need for high-performance beyond what can be delivered by javascript code. use of third-party libraries written in c or c++. use of mozilla interfaces that are not exposed via xpcom (e.g. nspr). note: with the modern jit javascript engine in gecko and js-ctypes more extension code can be written only in javascript than ever before. ...
...er c++ components or from javascript. the process of creating a component is actually relatively straightforward when the mozilla build system is used. in the simplest case, a component will consist of a single main directory with two subdirectories, public/ and src/. the main directory and each subdirectory must contain a makefile.in (from now on i'll just refer to this file as a makefile
although we know that it is actually used to generate the real makefile). this makefile says two things. first of all, it lists the subdirectories that make up the extension, so the build system knows where to look for additional makefiles. secondly, it instructs the build system to create a new extension, rather than copying the components directly into firefox's binary directory. the main advantage...
Extension Versioning, Update and Compatibility - Archive of obsolete content
udes an updatekey in its install.rdf. ...
...trieved must currently be totally valid xhtml, including being delivered with the mime type application/xhtml+xml (important: see problems section) you may include %app_locale% in your updateinfourl if you want to have locale information included in the url -- this allows you to customize the text based on the user's locale. you may also use the other substitution strings supported by updateurl,
although those may be less useful. formatting prior to firefox 4 prior to firefox 4 you could only use the following tags, any other tags have themselves and their contents completely stripped: h1, h2 and h3 for general headings p for paragraphs ul and ol for lists. within lists use the usual li tag for each list item. within h1, h2, h3, p and li tags you may use: b or strong for bolder ...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
copying a piece of software distribution: passing a piece of software to another person modification: modifying the software a typical software license will grant these permissions in return for a fee, and will still restrict some normally unrestricted uses. the software that microsoft sells, such as windows, comes with a license that permits only limited duplication in exchange for a fee, so,
although customers can install it on their computers, they cannot modify it. and essential freedoms, such as reverse-engineering, are also restricted. this use permit is displayed when you install the software. when the user clicks “i agree,” the installation process finishes. software range of uses restricted to author unrestricted software license >> ...
...g on which license you choose english version is the official text nearly all oss licenses take english as their official texts. japanese versions, for example, are mentioned only as reference translations. thanks to the internet, published source code can be used all over the world, so the language that the most people will be able to understand is chosen as the language for the license (
although this may reflect a western bias). applying an oss license in this section, i will explain practical details of applying a license when you are using oss source code, and participating in open-source projects. circumstances of application first i’ll explain what kind of license to use depending on whether you are modifying existing oss source code or writing original software. check th...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
to open it in source-code view (figure 2). fixme: figure 2: selecting source code inserting breakpoints now you’ll want to set some breakpoints. try inserting one within the quicknote_savenote function, around line 345 (figure 3). fixme: figure 3: inserting a breakpoint start debugger type in some text into the quicknote screen, and then select save current tab from the menu. this should h
alt the program at the spot where you inserted the breakpoint with venkman, and start the debugger. the local variables screen should always display variables and objects during step-by-step execution. with functions that include a lot of variables, this will be hard to read, so you can point out specific variables that you want to watch (figure 4). watched variables appear under the watches tab, a...
...hat include a lot of variables, this will be hard to read, so you can point out specific variables that you want to watch (figure 4). watched variables appear under the watches tab, and are updated every time they are evaluated. you can then continue with stepwise execution and watch the changes in the program and variables. once you’ve finished your inspection, you can continue and let the h
alted program resume execution. the author has done almost no work developing extensions, but has used this to investigate how extensions were implemented. in the quicknote example, we first set one breakpoint and then stepped through it. use step over to avoid a function, and step into to always call it; once you are done investigating a function, use step out, and then you can step into the next ...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
toolbar. this is done in the overlay as well. <window id="main-window"> <toolbox id="navigator-toolbox"> <toolbar id="xulschoolhello-toolbar" toolbarname="&xulschoolhello.toolbarname.label;" accesskey="&xulschoolhello.toolbar.accesskey;" customizable="true" mode="icons" context="toolbar-context-menu" defaultset="xulschoolhello-hello-world-button" insertbefore="person
altoolbar" /> </toolbox> </window> (note for mac os x: <window id="main-window"> and </window> are not required) our toolbar is added as a child of the toolbox element in the main browser window. the toolbox is the collection of toolbars in firefox, including the main menu bar. let's look at the attributes we used: the toolbarname is the name that will appear on the view > toolbars menulist.
...ase where you just want to add one button to the main toolbar. in this case you still need to add the button to the palette using an overlay. in order to add your button to the main toolbar on first run, you'll have to use javascript code. keep in mind that you shouldn't assume anything about the location (or presence!) of any specific buttons; remember users could have moved them or removed them
altogether. the toolbar code snippets page has a code sample you can use to do this. remember to validate if your button is already present, to prevent duplicates. it's also a good idea to set a preference that indicates that you added your button already, so that it can be removed permanently if the user chooses to. another option is to use fuel's firstrun property, which also relies on a preferenc...
Adding sidebars - Archive of obsolete content
ation and clean up . another, more important difference to take into account is that users can resize the sidebar to their liking, and in most cases, the sidebar is going to be fairly narrow. you should design the content of your sidebar carefully, so that it is usable and appealing regardless of width. there are ways to limit the size boundaries of your sidebar with css or even disable resizing
altogether, but none of those are good practices. forcing sidebars to have a fixed size can cause accessibility and usability problems. you can still have plenty of content available in your sidebar, you just need to organize it in a way that doesn't take too much space. for this purpose we'll also look at some handy xul elements in this section. they allow you to stack content on top of other conte...
...t circumstances. for instance, you could have a window that is used for two different purposes, and the only difference between the two cases is a label that has a value in one case and something else in another. using a .properties file and a string bundle is a viable option, but it involves a lot of code for something so simple, specially if that's the only case where you need dynamic text. the
alternative is to use a deck with the two labels, and change the selected index depending on the purpose of the window. this way you can still use dtd, and the code remains simple. a stack is like a deck, except that all of its children are always on display, one of top of the other. it allows you to decompose complex ui into individual layers, broadening the layout possibilities. one common use for...
Appendix D: Loading Scripts - Archive of obsolete content
this method: there is currently no way to load code into sandboxes from a cache. this means that code must be compiled and executed anew each time it is loaded, which has a significant overhead for large code bases. in addition to compile time, reading files synchronously from disk has its own overhead, and xmlhttprequests have significantly more overhead than native loading methods.
although wary authors can choose to cache instances of their modules so that modules are loaded only once globally, this method can be easily misused to re-load scripts for each new window where they would be better loaded only once globally per session. because sandbox objects are evaluated in their own javascript compartment, they are separated by a membrane from other javascript code. this mean...
...still suffer performance and memory disadvantages over that method. when loading into a sandbox object, the same advantages apply as above. disadvantages performance: prior to gecko 8.0, scripts loaded via mozijssubscriptloader.loadsubscript() are not loaded from a cache, and therefore must be read and compiled each time they are loaded which has a significant overhead for large code bases.
although wary authors can choose to cache instances of their modules so that modules are loaded only once globally, this method can be easily misused to re-load scripts for each new window where they would be better loaded only once globally per session. non-chrome files loaded in this manner will have the current filename prefixed to the filename in their debugging information. for instance, the fi...
Handling Preferences - Archive of obsolete content
the preferences window should be as easy to use as possible. to access all other preferences, enter "about:config" into the location bar. this xul page lists all the preferences defined in the firefox installation, allowing you to change them as you please. as the warning message states, you should be very careful when changing preferences. incorrect values can make firefox behave oddly or break
altogether. you can type on the "filter" textbox to search for specific preferences. if you type the word "homepage", it will filter all the preferences and display only the ones which include the word "homepage" in its name or value. right-clicking on the list reveals several options that allow you to modify preference values and add new ones. preferences with non-default values are highlighted in ...
...eate and manage their own. the preferences system provides a simple, unified storage facility for name / value mappings. when your storage needs are more complicated than this, you'll need more advanced apis that will be discussed in a section further ahead. to add preferences to your extension you should first create a js preferences file that describes the preferences and their default values,
although setting defaults is not required. as mentioned earlier, a preference with no default value can be set later on. note: we recommend that you include all of your extension preferences in the js defaults file. it makes it easier to compile a list of the preferences your extensions handle, and to document what they do. the preferences file you need to create should be defaults/preferences/...
Setting Up a Development Environment - Archive of obsolete content
. just like in the provided project, you need the add-on id and profile location set in the file makefile. we use this information to locate the installation path of the extension and overwrite the installed files. if firefox is open at the time you run "make install", you'll have to restart it in order to see the changes. it's still better than installing the xpi all over again. you may need to
alter the profile location in your makefile. in order to set the profile location to the right value, you should read the support article on profiles, at the mozilla support site. we'll also delve deeper in this topic later on in this section. to make "make install" work on non-windows systems, you need an extra step. the install process requires using an environment variable called ostype, which is...
... introduction to dom inspector is a good guide on how to get started using it. the dom inspector is particularly useful in finding out how to overlay a window, and how to replace default css style rules. you can see the names of the files involved, which gives you a good starting point when looking into the mozilla source. you can even change styles, attributes and execute javascript code in it,
although that's not completely reliable. javascript debugger the name says it all. the venkman javascript debugger is a great way to trace execution of your javascript code. to debug extension and browser code, right-click on the loaded scripts panel and uncheck exclude browser files. the list of loaded scripts will grow long to include all of the scripts in firefox. having our file naming convent...
The Essentials of an Extension - Archive of obsolete content
. we then call the window.alert function with the message, just like we would do in an html document. locale there are two types of locale files: dtd and properties, and in this example we use them both. dtd is the most efficient way of showing text in xul, so you should use it whenever possible. it is somewhat inflexible so it can't be used for dynamically generated text, hence the need for an
alternate way of getting localized strings. looking back at the menu code, you probably noticed some attributes such as this: label="&xulschoolhello.hello.label;" accesskey="&xulschoolhello.helloitem.accesskey;" these attributes define the text that you see on the menus, and they are string keys that are defined in our dtd file, browseroverlay.dtd. the dtd file was included in the xul file wit...
... the string key. ...
User Notifications and Alerts - Archive of obsolete content
tant events, often requiring some response. using modal dialogs and alerts is usually a bad idea. they interrupt the user's workflow, demanding immediate action before anything else can be done. users will find them annoying and probably will learn to dismiss them as quickly as possible without even reading what they have to say. or they will just get rid of your add-on. this section lists a few
alternatives that give you the possibility of notifying the user and requesting action without being too annoying. the notificationbox element you have probably seen these before. the "remember password" prompt is the one that shows up the most often. they are thin boxes that appear from beneath the tab list and above the page content, with some text and maybe a few buttons. this kind of notificati...
...support and temporary nature of these alerts, we don't recommend using this service to show information the user needs to know and can't get in any other way. custom alerts creating custom solutions for alerting the user is not complicated, given the advantages of xul overlays and css positioning. however, these solutions are prone to be buggy and have accessibility issues. you should use the 2
alternatives mentioned above whenever possible. if none of those fit your needs then this is an acceptable solution. an easy way to display alerts is to include a hidden box in your overlay, which you can fill with any content you need before removing the hidden attribute so that it is displayed to the user. the best locations for this kind of box are above and below the tab browser. below is prefer...
XPCOM Objects - Archive of obsolete content
directly from the interface: // these are equivalent. max = ci.xsihellocounter.max_count; max = counterreference.max_count; the implementation file, xshellocounter.js, is much longer. we'll analyze it piece by piece. const cc = components.classes; const ci = components.interfaces; const cr = components.results; const ce = components.exception; you should be familiar with this already,
although there are a couple of additions, components.results and components.exception. they'll be used further ahead. const class_id = components.id("{37ed5d2a-e223-4386-9854-b64fd38932bf}"); const class_name = "hello world counter"; const contract_id = "@xulschool.com/counter;1"; these constants are used at the bottom, in the component registration code. they specify the details of the compone...
...nent registration code. they specify the details of the component, such as a unique uuid (you have to generate it too and it must be different from the idl uuid), a descriptive name (this isn't used anywhere that we know of), and the contract id, which is the string you use to get a reference to the component. the ";1" at the end of the string is supposed to indicate the version of the component,
although it shouldn't change much. it can be useful if there are multiple incompatible versions of the component installed at the same time. the implementation object itself should be easy to understand. the only aspects to take into account are that methods and attributes must have the same names as their idl counterparts, and that the queryinterface method is implemented: queryinterface : funct...
Session store API - Archive of obsolete content
ting when the tab is restored. the session store api is implemented using the nsisessionstore interface. knowing when to restore each time firefox is about to restore a tab, an event of type sstabrestoring is sent. ...
...lly, the sstabrestored event is sent. if you want to set permissions or otherwise manipulate a restored tab before the page is loaded into it, you should watch sstabrestoring. if you want to do something after the page is loaded, you should watch sstabrestored. both events are always sent for each tab being restored. you can determine which tab is being restored by looking at the event's origin
altarget field. there's not really a way to determine when the last tab has been restored unless you determine how many tabs need to be restored then count the sstabrestored events. this section provides a few simple examples of how to make use of the session store api. 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 pai...
Signing an XPI - Archive of obsolete content
file for signing create a new folder just for signing, copy your existing xpi into it, unzip* it (maintaining paths), delete the xpi and return to the certificate-database folder. *assumes you have a zip utility available on your system path. this example is using the cygwin bin/zip.exe tool. you can use a graphical zip tool provided it manages the internal sub-directory structure properly. an
alternative is to use winrar. the 7-zip tool doesn't work when creating mozilla xpi signed archives because it sorts the directory entries alphabetically, and mozilla requires the first entry to be meta-inf/zigbert.rsa. c:\projects\codesigning\> md signed c:\projects\codesigning\> copy c:\projects\fsb\fsb.xpi signed 1 file(s) copied. c:\projects\codesigning\> cd signed c:\projects\codesi...
... -k "code signing (certum)" -p "password" build/ >> %x%\build.log cd build zip "%x%.xpi" meta-inf/zigbert.rsa >> %x%\build.log zip -r -d "%x%.xpi" * -x meta-inf/zigbert.rsa >> %x%\build.log rem copy "%x%.xpi" ..\..\..\http\fsb.xpi >> %x%\build.log move "%x%.xpi" ..\ >> %x%\build.log cd .. rd build /s/q echo done. make sure to replace password with your nss certificate database password.
alternatives to nss/signtool there are several
alternatives to using signtool that might suit your needs better, however please note that these
alternatives are unofficial third party products. key manager xul extension wladimir palant's python script (blog post) xpisign.py python script xpisigner java tool references the nss tools documentation ...
Adding preferences to an extension - Archive of obsolete content
ng the preference branch for our extension, we call the nsisupports.queryinterface() method on it to be able to use the methods of the nsiprefbranch2 interface. the next step is to register a preference observer by calling the addobserver() method to establish that whenever any events occur on the preferences, our object (this) receives notification. when events occur, such as a preference being
altered, our observe() method will be called automatically. now that we're monitoring the preferences, we can set up to watch the stock information and display it in the status bar panel. the first thing we need to do is get the currently configured stock symbol to watch from the preferences. to do so, we call the nsiprefbranch.getcharpref() method, specifying that we want the preference named "sym...
...window. our dialog has two widgets in it. the first is a label describing the textbox. the second is the textbox itself, in which the user enters the symbol. the preference property ties the textbox to the "pref_symbol" <preference> element and to the "extensions.stockwatcher2.symbol" preference. this lets the preference value automatically be updated to reflect the content of the textbox.
alternative method: inline options requires gecko 7(firefox 7 / thunderbird 7 / seamonkey 2.4) you could use inline options for this preference. you must set em:optionstype to 2 in your install.rdf. your options.xul file would look like this: <?xml version="1.0" ?> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting pref="extensions.stockwatcher2.symbol" ty...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
table rows instead of the images. thus you might have: tr.decoration img {display: block;} ...along with the following change in the markup: <tr class="decoration"><td style="background: red;"> <img src="smallred.gif" height="1" width="1"> </td></tr> the result is that of only making the spacer gif block-level, thus leaving the other images alone. this leads to the result seen in figure 9.
alternatively, you could class table cells instead of rows, if that's a better choice for you. in any of these cases, though, making images block-level could have unintended side effects if your table cells have more than just a single image in them, as in figure 8. of course, while we have a single-pixel spacer cell in figure 9, there is still unwanted space underneath the navigation buttons across...
...ingle-pixel spacer cell in figure 9, there is still unwanted space underneath the navigation buttons across the top. getting rid of this space could be as easy as putting each image in its own cell and making them all block-level, but let's leave them all together in a single cell so we can illustrate another approach. using vertical alignment the other main choice is leave the image inline and
alter the vertical alignment of the image with respect to the line box. for example, you could try the following: td img {vertical-align: bottom;} this will cause the bottom edges of the images to be aligned with the bottom of the line box, instead of the baseline. as we can see in figure 10, this has the intended effect: the space underneath our navbar images is gone. however, the decorative cell ...
Source code directories overview - Archive of obsolete content
tion: common subdirectories a common naming scheme is used throughout the mozilla source trees. at the top level is the name of the product (e.g. seamonkey). at the second level is the name of the module (e.g. the editor directory in seamonkey). the third level is where the common naming scheme usually takes over. many third level directories contain the base, the public and the idl directories.
although not required, these common names are typically used for a common purpose. if files can be grouped into submodules, they are usually put in their own third level directory and given a unique name (e.g. txmgr in the editor directory in seamonkey). beneath this third level directory, there may be fourth level base, public and idl directories. thus, the scheme is recursive; it can apply to submo...
...ents (which stands for "cross platform component object model"). xpcom is the mechanism that allows mozilla to export interfaces and have them automatically available to javascript scripts, to microsoft com and to regular mozilla c code. some low-level xpcom classes and interfaces are also defined here (e.g. the event loop for all platforms). xpcom is compatible and very similar to microsoft com (
although xpcom is cross-platform). xpfe contains the c interfaces, c code and xul for implementing the "cross platform front end." essentially, this is where the mozilla program starts and manages other components to accomplish tasks. this code contains very little platform dependent code; it relies on other components to provide platform independent interfaces to platform specific functionality. x...
Making a Mozilla installation modifiable - Archive of obsolete content
files are all in text format and can be edited in a standard text editor, while image files are in binary gif, jpg, or png format and must be edited with an image editing program. the files are then collected into a series of jar archives, which are just zip files that contain a specially formatted "manifest" file which describes the contents of the archive so mozilla knows what to do with them. ...
...with them.
although jar archives are binary files, mozilla's ui is not compiled into machine code; mozilla instead builds its ui from the non-compiled files in the archive each time it starts up. because of this, we can modify the files in the archive and see our changes to the ui merely by restarting the application. this makes modifying mozilla's ui much easier than for many other applications.
although mozilla stores the ui files in jar archives, it can also access them in their original, unarchived form, which is useful for the extensions developer because it makes it unnecessary to extract the files from the archive before changing the code and then re-add them to the archive afterwards. instead, you only have to extract them once and can then make as many modifications as you like. to m...
Installing Dehydra - Archive of obsolete content
dehydra is not supported on mac os x. building spidermonkey it is recommended that you use spidermonkey revision aurora_base_20110705 when building dehydra. ...
...13 is really needed: it does not work with e.g. v2.68. there is no need for some installation after make. you can skip the next section "building gcc 4.5" if you are using gcc 4.6 or above. building gcc 4.5 for treehydra's process_tree_decl to work, when compiling with g++, you must use a patched gcc 4.5 before building dehydra. cd $home # obtain gcc 4.5.3 (see http://gcc.gnu.org/mirrors.html for
alternate mirrors) wget http://www.netgull.com/gcc/releases/gcc-4.5.3/gcc-4.5.3.tar.bz2 tar -jxvf gcc-4.5.3.tar.bz2 # apply plugin_finish_decl patch wget https://bug559964.bugzilla.mozilla.o....cgi?id=457606 -o finish_decl.diff cd gcc-4.5.3 patch -p0 < ../finish_decl.diff # build gcc cd .. mkdir gcc-objdir mkdir gcc-dist cd gcc-objdir ../gcc-4.5.3/configure --disable-bootstrap --enable-languages=c...
Microsummary XML grammar reference - Archive of obsolete content
ment the <template> element contains the xslt stylesheet which transforms web pages into their microsummaries. attributes: none. child elements: <stylesheet> or <transform> (required) the xslt stylesheet which performs the transformation. per xslt, you may specify the stylesheet child element using either the <stylesheet> or the <transform> tag, which are interchangeable. note:
although the <template> element must be in the microsummaries namespace (http://www.mozilla.org/microsummaries/0.1), its <stylesheet>/<transform> child element must be in the xslt namespace (http://www.w3.org/1999/xsl/transform). the <pages> element the <pages> element identifies the set of pages that the generator is able to summarize. attributes: none. child elements: <include> (optional) ...
...se between updates. child elements: <condition> (optional) an xpath boolean expression along with a conditional interval of time, in minutes, that must elapse between updates if the expression evaluates to true. the interval attribute defines an absolute interval in minutes. its value must be a number greater than or equal to 1. fractional values (e.g. 5.5 minutes) are permitted,
although they probably aren't useful. the <update> element may contain any number of <condition> child elements. 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. for each one, firefox evaluates the element's xpath boolean expression against the page being summa...
Modularization techniques - Archive of obsolete content
ounting logs. use them wherever possible. /* * the nsisupports interface */ class nsisupports { public: ns_imethod queryinterface(const nsiid &aiid, void **aresult) = 0; ns_imethod_(nsrefcnt) addref(void) = 0; ns_imethod_(nsrefcnt) release(void) = 0; }; the ns_imethod and ns_imethod_(type) macros are basically shorthand for virtual nsresult and virtu
altype. on windows they expand to virtual nsresult __stdcall and virtual type __stdcall for com compatibility reasons. you don't have to use them in your interfaces unless you're concerned with com compatibility. all mozilla interfaces inherit from nsisupports. inheriting from nsisupports allows any interface to be interrogated about other interfaces that its instance may support, and insures that r...
...objects, maintaining these behaviors is easy. aggregation, as we will see later, can complicate things. on the other hand, objects are allowed a certain degree of flexibility in their implementations of addref() and release(). they can maintain a single reference count for the entire object, or individual reference counts for each interface. a static object would chose to ignore reference counts
altogether. however, a poor implementation of these functions can have negative results, such as memory leaks or inadvertent access of freed objects. factories factories are special classes dedicated to creating instances of classes. a foo class will typically have a foofactory associated with it. the nsifactory interface is the equivalent of com's iclassfactory. /* * the nsifactory interface */...
Monitoring downloads - Archive of obsolete content
firefox 3 introduces new api that allows any number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. as a nice bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. ...
...firefox 3 introduces new api that allows any number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. as a nice bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. ...
New Security Model for Web Services - Archive of obsolete content
this should especially be implemented for soap calls by untrusted scripts. when an attempt is made to access a resource at a previously-unknown uri, the sandbox reads a file at that domain with declarations to determine whether access is permitted to the script. if the file is not there, access is denied. the problem external untrusted scripts loaded behind a firewall are executed in a sandbox. ...
...nto the root directory of the web server to allow access. delegation with mixed ownership independent owners of subdirectories cannot grant web script access to these subdirectories without getting the owner of the root directory to post a delegating access file. normally a server will be either inside or outside of a firewall, so this is not a problem. where a server spans multiple owners, the
alternative would be to scan all directories in the path looking for a web scripts access file, which seems undesirable. on the other hand, perhaps it is not so bad, since it permits independent management in domains where the top level owner may not care about providing access to web services. adjustments as this new model is applied to soap, and potentially document.load or xml-request, it may be...
New Skin Notes - Archive of obsolete content
t's just sloppy coding. i cannot think of any reason for writers or editors to add "clear:both" brs to their document. under what situations does this seem like something that should be embedded directly into the wiki content? --dria when using floated divs - images and such. if you don't use it they overlap with headings, which is something we seldom want. see for example the venkman tutorials (
although the clears are down the page) or mdc:frequently asked questions. i'm not saying this can't be worked around, just that it would be better if the skin coped with that fine. --nickolay 05:46, 25 aug 2005 (pdt) ok, i'll see what i can do. thanks for pointing it out. --dria external link icons missing on ie version of skin. --dria edit/preferences/diff pages end up being too wide at ti...
... webwatch are not currently being localised so shall remain as they are, with link to english wiki. --dria further notes and ideas (future) skin designed more for the editorial crowd, with the editor tools more prominently placed in the skin. the core format would be the same as "default", however. skin designed with simplicity in mind -- minimal header, nav, footer -- plausibly good for
alternate or small screen display, or people who prefer more straight-up formatting for on-screen docs. skin designed specifically with accessibility in mind. might want to consult with aaronlev to see what would be best. also see about improving accessibility of default skin. we definitly need to add some ui to multipage stuff like tutorials. things like toc and back/forward and "page x of y" ar...
RDF Datasource How-To - Archive of obsolete content
ble to selectively implement methods of the nsirdfdatasource interface; instead, all of the methods will be "forwarded" to the in-memory datasource. this can be useful if your datasource is "read-only", and you aren't worried about modification using assert(), etc. implement the interface yourself. if you choose this route, you'll need to implement each of the nsirdfdatastore methods "by hand". ...
...you may also need to choose this implementation if the data set which your datasource is modeling is too large to fit in to memory (e.g., the entire file system structure). ...
Frequently Asked Questions - Archive of obsolete content
ox 1.5. what can i do to help the svg project? okay so maybe this isn't such a frequently asked question, but if it was, just think how much further on with our svg implementation we could be! we're always looking for help from anyone willing to lend a hand. if you're a c++ programmer interested in working on the svg implementation, please contact us and we'll be happy to help you get involved.
alternatively, if you're an svg user you can help by testing the svg enabled nightlies and filing bugs with minimal testcases whenever you encounter a problem. if you can't do either of these things you should still feel free to ask us friendly questions and give us constructive feedback. who's currently working on what? other than reviewing patches and fixing the occassional bug, alex is currently...
...rver. this is where most of us hang out to discuss issues relating to the svg implementation. if you don't have an irc client then install chatzilla into mozilla/mozilla firefox (note it may already be built in). clicking on the link above should then take you straight there. if you'd prefer to contact us by email you can send an email to our newsgroup mozilla.dev.tech.svg which is archived here.
alternatively you can email any of us directly of course (see the preceeding question for our email addresses). original document information author(s): jonathan watt last updated date: november 6, 2006 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a creative commons license | details. ...
Using cross commit - Archive of obsolete content
it on all the branches at once # make sure to use -m "commit message" when doing so tools/cross-commit --moz18 --branch mozilla_1_8_0_branch -m "fix some sort of security bug" layout/base/nscaret.h notes note that you must use a -m option with a cvs checkin message. otherwise cross-commit will end up waiting forever for you to type a cvs checkin message in an editor that it never shows you! (
although it works without specifying -m on the command line if you are using x-enabled emacs on linux.) also note that if you don't specify any branches to commit on, cross-commit will commit to the trunk and the mozilla_1_8_branch by default. details cross-commit accepts the following options: all cvs options (those to the left of the specific cvs command) and cvs commit options (those to the ...
...fying -m on the command line if you are using x-enabled emacs on linux.) also note that if you don't specify any branches to commit on, cross-commit will commit to the trunk and the mozilla_1_8_branch by default. details cross-commit accepts the following options: all cvs options (those to the left of the specific cvs command) and cvs commit options (those to the right of a commit command),
although the -r and -f cvs options need to be specified as --cvs-r and --cvs-f to avoid conflict with the similarly named (but different in meaning) cvs commit options. you can list the files/directories you want it to commit on the command line or leave them out and let it recursively troll the current directory. --verbose=[0|1] makes the script output more text as it runs. this defaults to 1. --t...
Venkman Introduction - Archive of obsolete content
or-0.03 121 in the debugger. the console command /break is used to set and list breakpoints. the first parameter is the file name that contains the javascript you want to break at. the second parameter is the line number. you don't need to specify the entire file name. in this example, we are setting a breakpoint in the pause function called when the browser starts the dhtml fishcam window.
alternately, you can select animator-0.03.js from the loaded scripts view, locate the pause function at line 119, and click in the left margin. setting breakpoints in this manner is equivalent to using the /break command in the console. in either case, a red breakpoint icon appears in the source code view. type /break in the debugger. if you don't provide arguments to the /break command, all...
... in the articles that follow this one. the best way to get to know venkman, of course, is to play around with it — to set it up in the way that makes the most sense to you, to try loading scripts and setting breakpoints, evaluating expressions in the interactive session view, watching the values of variables as they change when scripts are executed, getting profile data. debugging extensions
although at first glance it might seem that venkman cannot debug extensions, doing so is in fact fully supported; it's just disabled by default. to debug your extension with venkman (xul files and their attached js files), you'll have to load browser and extension files into venkman by unchecking debug > exclude browser files. resources using breakpoints in venkman — next article about venkman...
Writing textual data - Archive of obsolete content
.org/intl/converter-output-stream;1"] .createinstance(components.interfaces.nsiconverteroutputstream); // this assumes that fos is the nsioutputstream you want to write to os.init(fos, charset, 0, 0x0000); os.writestring("umlaute: \u00fc \u00e4\n"); os.writestring("hebrew: \u05d0 \u05d1\n"); // etc. os.close(); you can also write character arrays using the write function,
although using writestring is simpler from javascript code. the example above passes 0 as the third argument, which disables buffering (note: the implementation of the converter stream might not support buffering). passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you should pass a value like 4096 instead. unsupported characters you ca...
... any other character. you can also specify any unicode character u+abcd directly as 0xabcd. note: if the replacement character is not a supported character in the chosen character encoding, attempts to write unsupported characters will fail with ns_error_loss_of_significant_data. versions before gecko 1.8 firefox 1.0.x, mozilla 1.7.x and older versions do not support nsiconverteroutputstream.
alternative ways usable from javascript do not support character encodings that use embedded nulls (such as utf-16 and utf-32). they work by manually converting the string you want to write to a byte sequence using nsiscriptableunicodeconverter, and writing that to the stream. here's an example: // first, get and initialize the converter var converter = components.classes["@mozilla.org/intl/scripta...
Anonymous Content - Archive of obsolete content
the bound element itself, one of two actions occurs. either the event is retargeted so that the bound element becomes the target, or the event is stopped and flow proceeds to the next phase. whenever an event is retargeted, the target field of the event is set to the bound element. the original anonymous content responsible for the event can be obtained from a new field of the event object: origin
altarget. the action taken (retarget vs. stop) is specific to the event type. in general, ui events are retargeted and mutation events are stopped. exceptions to the rule are noted below. focus and blur events when a focus or blur event crosses a scope boundary, the bound element is checked to see if it is focusable (i.e., if the user agent would normally fire a focus or blur event on the element)...
..., descendant, and sibling selectors will match on any path of anonymous and explicit elements. as far as css is concerned, anonymous content nodes are children (or descendants) of the bound element, they are ancestors of explicit content, and they are siblings of the explicit content. style rules using the child, descendant, or sibling selectors transparently cross bind scopes and operate on the
altered and original content models. the final modified content tree determines how css properties (e.g., fonts and colors) are inherited. an element either ends up underneath its explicit parent (just as in the content model), or it ends up being nested through a series of insertion points. when nested, it inherits from the innermost anonymous parent. binding stylesheets a binding file can load s...
Binding Attachment and Detachment - Archive of obsolete content
e document) bindings attached through the dom are detached when the following conditions are met: mozbinding style rule is removed the element is destroyed (e.g., by closing the document) when a binding is detached, the following events occur: anonymous content generated by the binding is destroyed. methods and properties with getters/setters are no longer accessible from the binding,
although properties with raw values remain. any specified event handlers are unhooked from their respective targets. a binding can specify a <destructor> block within <implementation> section that executes prior to the binding detachment. using a <destructor> block, a binding can perform any necessary cleanup before it is torn down. bindings in an inheritance chain are always detached from the mo...
...y of the binding document that is unique to the bound document. the bindings in the binding document can be modified using standard dom apis. any subsequent binding attachments that occur on elements in the bound document for bindings in the binding document use the modified copy. therefore new binding definitions can be generated dynamically or the anonymous content templates for bindings can be
altered and used by the bound document. ...
Binding Implementations - Archive of obsolete content
ked when the property is either retrieved or set. these functions are called getters and setters in xbl. for properties with raw values, an initial value can be specified as a child of the property tag. the script is evaluated at the time of binding attachment and the resulting value is stored on the element. it can be assumed that the anonymous content of the binding has been fully constructed,
although the bindingattached event will not have fired. property initialization always takes place after content generation but before the firing of a binding attachment event, since the bindingattached handler needs to be able to assume that all properties will be accessible on the binding. properties with getters and setters can define them using onget and onset attributes, or using the more verbo...
...er, then the element form is ignored. a getter contains script whose return value is handed back when the property is requested. a setter contains a script that is invoked when a new value is assigned to the property. in script, the word val is used to represent the new value. properties can be designated as constant using the readonly attribute. when set to true, the property's value cannot be
altered. if a property is readonly and a setter is defined, then the setter is ignored. properties also support a shorthand syntax for defining getters and setters that forward requests or assignments to an anonymous content element. the element attribute specifies the id of anonymous content underneath the bound element that should be used when obtained the property or setting the property. on the...
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. multiple keys may be separated by spaces or commas. keys will map to other keys on platforms that do not have them. shift: the shift key.
alt: the
alt key. on the macintosh, this is the option key. on macintosh this can only be used in conjunction with another modifier, since
alt+letter combinations are reserved for entering special characters in text. meta: the meta key. on the macintosh, this is the command key. control: the control key. os: windows logo key on windows, super or hyper key on linux. this shouldn't be specified directly because it may conflict with system wide shortcut key. accel: the key used for...
...y on windows, super or hyper key on linux. this shouldn't be specified directly because it may conflict with system wide shortcut key. accel: the key used for keyboard shortcuts on the user's platform, which is control on windows and linux, and command on mac. usually, this would be the value you would use. access: the access key for activating menus and other elements. on windows, this is the
alt key, used in conjuction with an element's accesskey. any: indicates that all modifiers preceding it are optional. ...
XUL Events - Archive of obsolete content
can also check for triple-clicks in a similar manner. you should not use this event in xul to respond to user actions; the command event should be used instead. attribute: onclick dblclick this event is like the click event except it is only sent when the user double clicks with the mouse. this is an
alternative to checking the detail property in the click event. attribute: ondblclick dommousescroll this event is sent when the mouse wheel is moved, whether it results in content being scrolled or not. the target of this event is the element that was under the mouse pointer when the mouse w...
...d of document changes warning: it should be noted that the addition of any mutation event listeners to a document degrades the performance of subsequent dom operations in that document, and that removing the listeners later does not mitigate or reverse the effect. see mutation events for more details and mutation observers for a more efficient
alternative. common xul events event description broadcast the event handler should be placed on an observer. the broadcast event is sent when the attributes of the element (such as a broadcaster) being listened to are changed. attribute: onbroadcast ...
Reading from Files - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. reading data from a file involves getting a reference to a file and then cre...
... readstring method may be used to read a certain number of bytes into a string. this example will keep reading 20 byte blocks from a file and append them to a string. 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. while(stream.available()) output += stream.readstring(20);
although this can be a suitable means of reading binary data, usually you will want to retrieve the data with some additional methods that are more useful. 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. read8 will read a single byte and return it. the 8 in the method name indicates...
Introduction to XUL - Archive of obsolete content
ndividual attributes. rare exceptions to this rule are bugs. xul file preamble xul is xml, and a good xul file begins with the standard xml version and doctype statements. since xml has no implicit display semantics, there must always be associated stylesheets. mozilla includes a standard stylesheet, "xul.css". you can load as many style sheets as you wish using repeated processing directives,
although you should always make sure to load the xul.css file initially. and finally, any namespaces used in the document must be declared. so a xul file will begin <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?> <!doctype window> <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> t...
...pe window> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> ... </window> we would like to head more toward the "package" implementation in the future. internationalization for practical reasons, the locale-specific attributes of a ui description would be most happily developed (and possibly distributed) in separate files, where localization can be performed by
altering only a subset of the ui description devoted expressly to localization issues. that is, a separate file of localized strings. internationalization is discussed more completely in the xul coding style guidelines document. in brief, mozilla has settled on xml entities as the mechanism. entities are a feature of the language and therefore outside the scope of this paper. a xul file can be made ...
ContextMenus - Archive of obsolete content
e opened by pressing the menu key on the keyboard (the key on many keyboards next to control with a menu image) or by pressing shift+f10. you should not assume that a user has used the mouse to open a context menu. when using the mouse to open a context menu, the context is the element that was clicked. when using the keyboard, the context is the element in the window that is currently focused.
although there are several ways to open a context menu, a single event may be used to listen for any of these situations; the 'contextmenu' event is fired in any case. <hbox id="container" align="center" oncontextmenu="..."> <label value="name:"/> <textbox id="name"/> </hbox> in this example, an attempt to open a context menu anywhere inside the hbox will call the event listener attached using...
...n this example, the showhidedeleteitem function is called when the popupshowing event is fired. this function checks if the element with the id 'rows' has no children and, if so, hides the 'delete' menu item by adjusting the item's hidden property. when the user attempts to open the context menu, the delete menu item will either be shown or hidden depending on the the number of children. another
alternative is to disable the menuitem instead of hiding it, by setting the item's disabled property. deleteitem.disabled = (rows.childnodes.length == 0); for this example, using the disabled property is more suitable. items should be disabled when they don't apply in certain circumstances, but should be hidden when they would never apply to the element that was clicked on. determining what was c...
MenuItems - Archive of obsolete content
in the same document. the result is that the items will display the shortcut key next to their labels. for the "open" item in this example, this command can be invoked by using the "accel" modifier key and pressing 'o'. the "accel" modifier key varies on each platform, but is the key typically used for shortcut keys. for instance, if the "accel" key is control, the menu might display "ctrl + o".
although there isn't usually a need to do so, you can also set a custom label for the keyboard shortcut on the menu using the acceltext attribute. you might do this if the key associated with the item changes, for instance a list of open windows displayed on a window menu. <menuitem label="first window" acceltext="1"/> here the keyboard shortcut label will be '1', however you will need to write co...
...ng the image attribute. the icon will appear to the left of the menuitem label. in addition to the image, a special class "menuitem-iconic" must be used on the menuitem to indicate that an icon is expected. <menuitem id="add-bookmark" class="menuitem-iconic" label="add bookmark" image="addbookmark.png"/> as the image appears on a menu item, you will want to ensure you use a fairly small image.
although the exact size will vary depending on the theme being used, the size of menu item images should generally be around 16 by 16 pixels. instead of specifying the icon with the image attribute, you can also reference the image in a style sheet with the 'list-style-image' property. #add-bookmark { list-style-image: url('addbookmark.png'); } this technique can also be used to apply an image f...
Menus - Archive of obsolete content
ess key will underline a letter in the menu label indicating the key to press. for this reason, the access key should always correspond to a character that appears in the menu label. to set an access key for a menu, use the accesskey attribute, as in the example below. ...
...for instance, an access key of 'w' will match the first letter in a menu label of 'window', but the access key of 'w' will match the last letter. it is good practise to always use the same case when setting access keys. ...
Introduction - Archive of obsolete content
generated. if not, nothing gets generated again. an interesting thing to note is that due to the nature of the rdf parsing process, the builder generates results and builds content incrementally while the data arrives. of course, since the data arrives so quickly from the network, you really don't notice this. if the datasource is already loaded, the builder can construct content all in one step,
although even this isn't completely true as we'll see later. for xml datasources, use a querytype of xml. the datasources attribute should be the url of an xml file, which can be either the location of a web site or a file on the local file system, using its file or chrome url. this file will be loaded and the resulting xml document will be used as the datasource when the template builder generates r...
...ng its file or chrome url. this file will be loaded and the resulting xml document will be used as the datasource when the template builder generates results and creates content. for example: <listbox datasources="http://www.xulplanet.com/ds/sample.xml" querytype="xml"> <template> <listitem label="?name"/> </template> </listbox> this template uses an xml datasource to generate a listbox.
although we'll look at the details of this later, the simple result here is that a listitem will be generated for each child node in the xml data, setting the label to the name attribute for each xml node. for sqlite datasources, the datasources attribute specifies the uri of a database file. only local files are supported, so a file url should be used. if the datasource type supports it, the templat...
Simple Query Syntax - Archive of obsolete content
« previousnext » when iterating over the children of an rdf container, there is a simpler query syntax which may used. it may also be used when iterating over only one predicate. simple rdf graph navigation such as this is common, so the simpler syntax is usually used in this situation since it avoids extra tags,
although the simple syntax is not more or less efficient, at least when a single query is involved. a simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of triples from the child node. at its simplest, the simple query syntax is equivalent to the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> </query> the template builder uses the simple query syntax whenever a t...
...simplest, the simple query syntax is equivalent to the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> </query> the template builder uses the simple query syntax whenever a template does not have a <query> element. if a <query> element is present, the full syntax is used instead. in the simple syntax, the builder will use the default query shown above,
although the variable names are randomly generated. since the photos list iterates over the children of a container, we can use the simple syntax. here is what it might look like: <template> <vbox class="box-padded" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </template> there is no <query> or <action> element used. instead, the b...
Template Builder Interface - Archive of obsolete content
s attribute has been placed on an html element. this is also allowed. however, one thing to watch out for is that non-xul elements do not have their content generated lazily so all of the content will be generated at once. be careful that your templates do not recurse to deep levels. the builder property is a property of the nsidomxulelement interface, so all xul elements will have this property,
although, as mentioned earlier, is will be set to null for most elements. for non-xul elements, the template builder will be assigned to a builder property on the element using a custom javascript property instead. rebuilding and refreshing a template the main purpose of accessing the builder for an element is to call its 'rebuild' method. this method removes any existing generated content and delete...
...template without reloading existing data. if you do want to reload the data, you can call the builder's refresh method: tree.builder.refresh(); this will reload the datasource attached to the template. if there is more than one datasource, as above, all of them will be reloaded. due to the nature of the way templates are updated, you don't usually need to rebuild a template after a refresh call,
although there may situtations where this will be necessary. if you do plan on determining the datasources dynamically, it is common to start with an empty datasource using the special uri 'rdf:null'. <tree datasources="rdf:null" ref="http://www.xulplanet.com/rdf/myphotos"> this will create a composite datasource with no datasources in it. this syntax is necessary as otherwise you wouldn't be able t...
Tree Widget Changes - Archive of obsolete content
instead of identifying columns by id, a new column object is used. this object implements the nsitreecolumn interface and holds information about a single column in the tree. a tree will have one of these objects for each column (each treecol element) in the tree. ...
... work. this is shown in the example above. sometimes, you might have a particular row or cell which you do not want to be editable. 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. currently, only checkbox columns support editing,
although the content-based tree handles the nsitreeview.setcellvalue() and nsitreeview.setcelltext() functions to change the tree content with a script for other types of cells. for instance: var col = tree.columns.getprimarycolumn(); treecell.setcelltext(5, col, "banana"); this will change the label of the cell in row 5 and the primary column to banana. however, this paves the way in the future f...
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
ck box is changed when the space bar is pressed. <handlers> <handler event="keypress" key=" " action="this.checked=!checked"/> </handlers> you can also use the keycode attribute to check for non-printable keys. the section on keyboard shortcuts provides more information. the modifier keys can be checked by adding a modifiers attribute. this should be set to one of the values set below:
alt the user must press the
alt key. control the user must press the control key. meta the user must press the meta key. shift the user must press the shift key. accel the user must press the special modifier key that is usually used for keyboard shortcuts on their platform. if set, the handler is only called when the modifier is...
...l key. meta the user must press the meta key. shift the user must press the shift key. accel the user must press the special modifier key that is usually used for keyboard shortcuts on their platform. if set, the handler is only called when the modifier is pressed. you can require multiple modifier keys by separating them with spaces. ...
Advanced Rules - Archive of obsolete content
ule syntax the rule syntax described so far is useful for some datasources but sometimes you will need to display data in more complicated ways. the simple rule syntax is really just a shortcut for the full rule syntax which is described below. like the simple rules, full rules are placed within the rule tag. full rules contain three child tags, a conditions tag, a bindings tag and an action tag,
although the bindings tag is not always needed. the conditions element is used to specify the criteria for matching a given resource. you can specify a number of conditions, all of which must match. in the simple rule syntax, the conditions are placed directly on the rule element itself. if the conditions match for a resource, the content placed within the actions tag is generated. in the simple synt...
...ows: <content uri="?var"/> the question mark indicates that the text following it is a variable. you can then use the variable 'var' within the remainder of the conditions. of course, you can name the variable whatever you want. member element the next element is the member element, which is used to iterate through a set of child resources. in rdf terms, that means a container such a seq, bag or
alt. 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.xu...
Anonymous Content - Archive of obsolete content
ng element. the id attribute should be set to the identifier of the binding. this way it can be referred to through the css -moz-binding property. the content tag is used to declare anonymous content that will be added to the scroll bar. all of the elements inside the content tag will be added inside the element that the binding is bound to. presumably this binding would be bound to a scroll bar,
although it doesn't have to be. any element that has its css -moz-binding property set to the uri of the binding will use it. the result of using the above binding is that the line of xul below will be expanded as 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/>...
... binding is that the line of xul below will be expanded as follows, assuming that the scrollbar is bound to the xbl above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> the elements within the content tag are added to the scroll bar anonymously.
although anonymous content is displayed on screen, you cannot get to it through a script in the normal way. to the xul, it's as if there was only one single element, even though it is really made up of a number of elements. if you look at a scroll bar in a mozilla window, you will see that it is made up of an arrow button, a slider, a thumb inside it and a second arrow button at the end, which are th...
Content Panels - Archive of obsolete content
of the window. a good example is a step-by-step wizard that guides you through a number of screens, asking a set of questions. each time the user clicks the next button, the next screen of the wizard is displayed. you could create a wizard interface by opening a different window for each screen. there are three problems with this approach. first, each window could appear in a different location (
although there are ways around this). second, the elements such the back and next buttons are the same throughout the interface. it would be much better if just the content area of the wizard changed. third, it would be difficult to co-ordinate scripts when running in different windows. note that xul does have a wizard element which may be used to create wizard interfaces. this will be described in a...
...is will be described in a later section. another approach is to use the iframe element, which works much like the html element of the same name. it creates a separate document within the window. it has the advantage that it can be placed anywhere and the contents can be loaded from a different file. set the url to appear in the frame with the src attribute. this url may point to any kind of file,
although it will usually point to an html file or another xul file. you can use a script to change the contents of the iframe without affecting the main window. in the mozilla browser window, the area where the web page is displayed is created by using an iframe. when the user enters a url or clicks on a link in a document, the source of the frame is changed. iframe example example 1 : source vi...
Document Object Model - Archive of obsolete content
xul file is loaded, the tags are parsed and converted into a hierarchical document structure of nodes, one for each tag and block of text. the dom structure may be examined and modified using various methods provided for this purpose. specific xul elements also provide additional functions which may be used. each xul file that is loaded will have its own document displayed in a window or frame.
although there is only ever one document associated with a window at a time, you may load additional documents using various methods. in mozilla, the dom may be accessed and manipulated using javascript. the various dom objects have functions which may be accessed in script, however, it is important to note that the dom is an api that is accessible by javascript. javascript itself is just a scriptin...
... global object has a 'name' property, you can change the name with the code 'name = 7', without having to specify any object to use. in a browser context, the window is the global object, and the same is also true for xul. naturally, this global object will be different for each window. each frame will also have a separate window object. the window is often referred to using the window property,
although this is optional. sometimes, this is done just to clarify the scope of the method you are referring to. for example, the following two lines which open a new window are functionally equivalent: window.open("test.xul","_new"); open("test.xul","_new"); when you declare a function or a variable at the top level of a script, that is outside another function, you are actually declaring a prope...
Groupboxes - Archive of obsolete content
much like the html fieldset element is used to group html elements. the groupbox is a type of box, and the elements it contains are aligned according to the xul box rules. however, there are several differences between groupboxes and regular boxes: the groupbox can be labeled using the caption element. the groupbox is displayed in a special way—usually with a beveled border and a caption,
although you can change the appearance using css. you can create a caption for your groupbox by inserting a caption element as the first child. groupboxes are box elements, so you can use the box attributes, such as orient and flex. a simple groupbox example the example below shows a simple groupbox: example 1 : source view <groupbox> <caption label="answer"/> <description value="banana"/> ...
...ces of text to be displayed surrounded by a box with the label answer. note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. more complex captions you can also add child elements inside the caption element to create a more complex caption. for example, mozilla's font preferences panel uses a drop-down menu as a caption.
although any content can be used, usually you would use a checkbox or dropdown menu. example 2 : source view <groupbox flex="1"> <caption> <checkbox label="enable backups"/> </caption> <hbox> <label control="dir" value="directory:"/> <textbox id="dir" flex="1"/> </hbox> <checkbox label="compress archived files"/> </groupbox> in this example, a checkbox has been used as a...
Introduction to RDF - Archive of obsolete content
set of data, such as bookmarks or mail messages. however, it would be inconvenient to do so by entering the data directly into the xul file. it would make it very difficult to modify the bookmarks if they were directly in the xul file. the way to solve this is by using rdf datasources. rdf (resource description framework) is a format that can be used to store resources such as bookmarks or mail.
alternatively, data in other formats can be used and code written that will read the file and create rdf data from it. this is how mozilla works when it reads data such as bookmarks, the history or mail messages. mozilla provides datasources for this common data so that you can easily use them. you can use any of the provided rdf datasources to populate trees with data or you can point to an rdf file...
...omething else. the namespace feature is useful because the class field might conflict with that used for styles. the seq and li elements are used to specify that the records are in a list. this is much like how html lists are declared. the seq element is used to indicate that the elements are ordered, or in sequence. instead of the seq element, you can also use bag to indicate unordered data, and
alt to indicate data where each record specifies
alternative values (such as mirror urls). the resources can be referred to in a xul file by combining the namespace url followed by the field name. in the example above, the following uris are generated which can be used to refer to the specific fields: name http://www.some-fictitious-zoo.com/rdf#name species ...
RDF Datasources - Archive of obsolete content
the history list the history datasource provides access to the user's history list which is the list of urls the user has visited recently. ...
...e.com/nc-rdf#shortcuturl custom keywords field url http://home.netscape.com/nc-rdf#url the url to link to possible bookmarks roots nc:bookmarksroot the top level of the bookmarks hierarchy nc:iefavoritesroot the bookmark folder that corresponds to the user's ie favorites. nc:person
altoolbarfolder the bookmark folder that corresponds to the personal toolbar folder. files (rdf:files) a view of the user's files. resources name http://home.netscape.com/nc-rdf#name name of the file url http://home.netscape.com/nc-rdf#url url of the file content-length http://h...
Styling a Tree - Archive of obsolete content
r name you want. you can set multiple properties by separating them with spaces. 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. you can think of the properties as functioning much like style classes,
although they require a somewhat more complex syntax to use in a style sheet. this is because you can specify the style for a number of parts of the cell individually. you can style not only the cell and its text, but the twisty and indentation. the following is the syntax that needs to be used: treechildren::-moz-tree-row(makeitblue) { background-color: blue; } this style which has a complex se...
...which are expanded. closed this property is set for rows or cells which are collapsed. primary this property is set for cells in the primary column. sorted this property is set for cells in the current sorted column. even this property is set for even numbered rows. odd this property is set for odd numbered rows. this property, along with the even property allow you to set, for example,
alternating colors for each row. dragsession this property is set if something is currently being dragged. dropon if a drag is occuring over the tree, this property is set for the row currently being dragged over, as long as the mouse pointer is hovering over the row. dropbefore this property is set if the mouse pointer is hovering before the row currently being dragged over. dropafter this p...
Tabboxes - Archive of obsolete content
ks on the mail tab, the contents of the first tab page will be displayed below the tabs. in this case, the page with the check box labeled 'automatically check for mail' will appear. when the second tab is clicked, the page containing the button labeled 'clear news buffer' will appear instead. the currently selected tab element is given an additional selected attribute which is set to true. this
alters the appearance of the currently selected tab to make it look selected. only one tab will have a true value for this attribute at a time. position of the tabs finally, you can change the position of the tabs so that they appear on any side of the tab pages. there is no special syntax to do this. you simply set the orient and dir attributes as necessary. remember that the tab elements are much...
...acked. next, adjust the tabbox so it has horizontal orientation. this will make the tabs appear to the left of, not above, the tab pages. note that changing the orientation of the tabpanels element will have no effect, since the tabbed pages are layered on top of each other. you can place the tabs on the right or bottom side by moving the tabs element to after the tabpanels element in your code.
alternatively, you could set the dir attribute to reverse on the tabbox. however, you should probably leave the tabs on top, otherwise they might not look very good under particular themes. adding tabs to our find files dialog let's add a second panel to the find files dialog. we'll create an options tab (and select it by default) that will contain some options for searching. this may not be the b...
Trees and Templates - Archive of obsolete content
the treeitem elements. effectively, the elements outside (or above) the element with the uri attribute are not duplicated whereas the element with the uri attribute and the elements inside it are duplicated for each resource. as the tree builder is used and not the content builder, the structure of the elements in the above example must be as shown, with the treechildren element inside the rule.
although the tree builder doesn't build these elements, it does require this structure in order to determine what to generate correctly. note in the image that additional child elements below the top-level elements have been added automatically. xul knows how to add child elements when the templates or rules contain tree elements or menu elements. it will generate tree elements as nested as neces...
...columns if you try the previous example, you might note that the list of files is not sorted. trees which generate their data from a datasource have the optional ability to sort their data. you can sort either ascending or descending on any column. the user may change the sort column and direction by clicking the column headers. this sorting feature is not available for trees with static content,
although you can write a script to sort the data. sorting involves three attributes, which should be placed on the columns. the first attribute, sort, should be set to an rdf property that is used as the sort key. usually, this would be the same as that used in the label of the cell in that column. if you set this on a column, the data will be sorted in that column. the user can change the sort direc...
XUL Questions and Answers - Archive of obsolete content
in toolbar there may be a few ways to implement this: by building your menupopup from an rdf datasource, which could be generated on the server. by getting data (e.g. json string) from the server, parsing it on client, and building the menupopup using dom methods (such as document.createelementns). by getting data as xml from the server. (server can just send the xul code to use for popup -
alternatively it can send generic xml describing the attributes of the items in the menu and you generate the xul on client by applying an xslt transform.) can i change a xul tree cell/row/item background color with javascript? to set the background color you need to set the property for the cell/row and not for the item. an example of this is: var tree = document.getelementbyid('treeid'); sele...
... control, just like a regular window. some of them can be tied to a preference so that the preference is automatically updated as the control is manipulated. others, like <listbox>, cannot be so tied, but one can always write a script that updates preferences explicitly, via nsiprefbranch interface. can a xul template be used for rss? you should be able to use a xul template to display feeds,
although you may have to write the feed data to an rdf datasource first. specifying window.onload function to specify a function to run when the window is loaded,add the following code between the script tags in the xul file: window.addeventlistener("load", function(e) { startup(); }, false); similarly, for onunload use the code: window.addeventlistener("unload", function(e) { shutdown(); }, f...
Accessibility/XUL Accessibility Reference - Archive of obsolete content
how to expose text properly for various xul element types. sections in bold are to draw attention to pieces that are often overlooked for visual layouts. underlined text may be read by the screen reader. element enabled usage comments description <description value="<!-- text -->" /> <description><!--label text--></description> use for non-label text.
although tutorials claim label and description have the same underlying implementation, description elements appear to not associate correctly with controls whereas labels do. label <label control="controlid" value="<!--label text-->" /> <label control="controlid"><!--label text--></label> either syntax is fine. button <button label="<!--button text-->" /> ...
..."standard" /> colorpicker appears to read color values out if the colorpicker can get focus in the first place. column see grid columns see grid command see keyboard shortcut tutorial commandset see keyboard shortcut tutorial deck only the currently selected deck layer can be focused. grid
although text in the grid can be read, jaws does not recognize grids as tables for table reading mode. groupbox <groupbox> <caption label="<!--group label-->" /> <hbox> <button label="<!--button text-->" /> </hbox> </groupbox> iframe jaws 7.10 issues testing with jaws 7.10, use of an iframe element causes many, unpredictable issues with xul inside o...
XUL accessibility tool - Archive of obsolete content
sion will be available from addons.mozilla.org. the version currently on xulplanet is compatible with the following xul applications: firefox 1.5+ thunderbird 3.0a+ recent sunbird builds recent songbird builds. it probably also works on seamonkey, but i haven't verified this. use to launch the tool after installation, look for an entry in the tools menu of the host application, or hit ctrl+
alt+shift+f12. once the tool window has loaded, select either a local file, web url, or currently open window from the file menu to generate a xul report for that document. be aware that the report might take a little while to be ready depending on the complexity of the application being analyzed and the speed of your machine. future work the following things have been suggested or are planned for ...
... new features: (aaronlev) automatically test any new windows as they are opened. (aaronandy) highlight or blink source element in original xul app upon click of referencing line in report. (aaronlev) compatibility with more xul applications. (aaronandy) maybe an online tool to automatically generate a xul a11y tool compatible with a user-specified xul app. (aaronandy) link report...
The Implementation of the Application Object Model - Archive of obsolete content
this is what would be used by default to hold the tree for a remote xul file. this nsxmlelement implements a whole slew of interfaces, since raptor has multiple apis for referring to these objects. examples of these interfaces include nsidomelement, nsidomnode, nsixmlcontent, and nsicontent. what is rdf? rdf (pronounced r-d-f) has never been a ravening demon intent upon taking over the earth,
although that does depend on who you ask. rdf stands for resource description framework, a rather intimidating name that doesn't do much to help the layman understand exactly what it does. rdf provides a very general mechanism for representing relationships between different disparate types of data. the relationships between data are represented as a directed labeled graph structure. the data itself ...
...ds, the traditional relationship of "containment" is not the only kind of relationship expressible in rdf. in html or xul, when you put one tag inside another tag, a relationship of containment can safely be assumed. not so with rdf. for rdf, an extra tag has to be inserted between two other tags to indicate exactly what kind of relationship should exist between the two nodes. the resultant file,
although still relatively easy to manipulate, is bloated needlessly with extra syntax that is not strictly necessary. rdf is not a markup language. rdf can be serialized as an xml file, but it isn't a parallel to html. it's something different. it makes more sense to describe a content tree structure according to the accepted standards (that is accessible and manipulable via standard dom apis) using...
tabpanels - Archive of obsolete content
by clicking the first tab, the first panel will be displayed. by clicking the second tab, the second panel will be displayed and so on. ...
...by clicking the first tab, the first panel will be displayed. by clicking the second tab, the second panel will be displayed and so on. ...
tree - Archive of obsolete content
of rows. custom tree view nsitreeview no for this tree you implement the nsitreeview interface yourself. the tree's data is retrieved from this custom view. the custom view should be attached to the tree by setting its view property. more information is available in the xul tutorial. also tree widget changes. relevant accessbility guidelines provide
alternative access (for example, via menus) to column picker and for header behaviors like sorting (these have no default keyboard access). attributes disablekeynavigation, disabled, editable, enablecolumndrag, flags, hidecolumnpicker, onselect, rows, seltype, statedatasource, tabindex, treelines properties accessibletype, builderview, columns, contentview, currentindex, dis...
...ited value (the tree view's nsitreeview.setcelltext() method is called to change the cell contents). otherwise the cell label is reverted to the value it had prior to editing. related elements treecols, treecol, treechildren, treeitem, treerow, treecell and treeseparator.. ...
treecol - Archive of obsolete content
be able to use the max-width css property (or the maxwidth attribute) to override this size. for example, for a menuitem in a menu you can add the following css rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } cycler type: boolean if true, then the column is a cycler column. in the case, clicking on a cell in the column will
alternate its state between on and off. this is used, for example, in a mail window, for a column that indicates that the message is read or unread with a small mark in the cell. if the cycler attribute is not set, the cell is a regular text cell. dragging type: boolean this attribute will be set to true if the column is being dragged. this attribute is set automatically; you shouldn't adjust...
...ars. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. primary type: boolean if set to true, the treecol will have indentation and twisties drawn to the left of it to indicate the hierarchy level of the rows. if no column has the primary attribute set to true, the tree may still contain nested rows,
although no indication will be given to the user. the attribute also controls whether the column picker allows the user to deselect this column. sort type: uri or xml attribute set this to a rdf property or xml attribute to have the data in the column sorted based on that property. the property will usually be the same as that of the cell label. sortactive type: boolean this should b...
Building XULRunner with Python - Archive of obsolete content
n also be created in python. currently (mar 07) python is not enabled by default so a custom build of mozilla is needed. this page provides instructions in the hope of eliminating much trial and error. you should also read the the developer documentation on source code and building as wells as pyxpcom xulrunner with python promises to be a good platform for accessibility projects and both jambu
alternative input and the iaccessible2 test tool are using it. of particular interested is access to msaa and iaccessible2 via the python comtypes package. development machine setup first a word of warning that zonealarm has exhibited memory leaks that cause build machines to crash with rather spurious errors. you may want to uninstall it if you suspect this to be a problem. you will also want to...
...uired and whilst the current free version is visual studio 8 express (msvc8) you will almost certainly want to use visual studio .net 2003 (msvc71) which is not longer officially available. the issue is that xulrunner must be built with the same version of c as python and with python 2.5 that is msvc71. both must use the same version of the c runtime library msvcrt?.dll or crashes will ensue. the
alternative is to build python with msvc8 as well asmozilla, but that may be problematic. it might also be possible to use the open source mingw compiler with the correct msvc run time but that is apparently not recommended. apply any service packs and for msvc71 sp 1 is available. the matching platform sdk is also needed and for msvc71 that is .net framework sdk 1.1. the latest mozilla build syste...
Mozilla release FAQ - Archive of obsolete content
e best, at least until the problems with 2.8.1 are ironed out) where can i get the sources to netscape 4.x or lower? these sources are not available. much of the old code cannot be released due to legal concerns, and at the time of mozilla's initial release, that code was removed from the tree. the 'classic' branch of the current cvs tree is as close to the 4.x source as the public will ever see,
although that branch has been abandoned in the move to the modern codebase. how do i tweak the interface (replace the logo, etc)? the xptoolkit docs might help in writing the needed xul. you can find replacement themes in preferences, under appearance->themes, using the 'get new themes' link there. where can i get patches? there is not currently a central repository of patches. however, via cvs, you ...
... web version. some of these have more (or less) information than this faq includes. does the author mind if i make my own version, htmlify it, or whatever? nope. go for it. i would suggest you try to keep looking at mine occasionally, so you can add new things that i do, but you can do whatever you want to with it. the faq is wrong on section x.x! what can i do about it? drop a note to pat gunn .
alternatively, post a bug on the faq to bugzilla. help! i'm getting spam from mozilla you probably arn't really getting spam from mozilla. if you think you're getting it from mozilla because the x-mailer field mentions mozilla, then you're misinterpreting the meaning of the x-mailer field -- it indicates that the sender is *using* netscape communicator to deliver the mail. if you're getting mail cont...
NPN_SetValue - Archive of obsolete content
no_error. if unsuccessful, the function should return the most relevant npapi error code. for possible values, see error codes. description a good place to set plugin operation mode such as windowless mode is npp_new, so the browser knows right away what mode the plugin is designed to operate in. nppvpluginwindowbool (windows and unix) specifies that the plugin operates in windowed mode. the
alternative is windowless where no window messages are sent to the plugin as there is no window associated with it. in windowless mode all the browser to plugin communications related to drawing, mouse, and keyboard input are accomplished via npp_handleevent. to set windowless operation, call npn_setvalue with nppvpluginwindowbool as the variable parameter and false as the value parameter. by default...
...uct the browser not to unload the dll and not to call np_shutdown when the page is left. in such a case all this will be done on the browser shutdown. the plugin calls npn_setvalue any time with nppvpluginkeeplibraryinmemory as variable parameter and value set to true. by default, the dll will be unloaded from memory preceded by an np_shutdown call. remarks all four variable values are boolean.
although the function prototype has type of value void *, the actual boolean should be placed there, not a pointer to a boolean. the browser code reads this parameter as follows (nppvpluginwindowbool as an example): nperror np_export _setvalue(npp npp, nppvariable variable, void *value) { ... bool bwindowless = (value == null); ... } so the proper way to call this function from a plug-in would ...
Confidentiality, Integrity, and Availability - Archive of obsolete content
t be erased from their minds, papers, computers, and other places. nearly all the major security incidents reported in the media today involve major losses of confidentiality. so, in summary, a breach of confidentiality means that someone gains access to information who shouldn't have access to it. integrity integrity refers to ensuring the authenticity of information—that information is not
altered, and that the source of the information is genuine. imagine that you have a website and you sell products on that site. now imagine that an attacker can shop on your web site and maliciously
alter the prices of your products, so that they can buy anything for whatever price they choose. that would be a failure of integrity, because your information—in this case, the price of a product—has...
...and that the source of the information is genuine. imagine that you have a website and you sell products on that site. now imagine that an attacker can shop on your web site and maliciously
alter the prices of your products, so that they can buy anything for whatever price they choose. that would be a failure of integrity, because your information—in this case, the price of a product—has been
altered and you didn't authorize this
alteration. another example of a failure of integrity is when you try to connect to a website and a malicious attacker between you and the website redirects your traffic to a different website. in this case, the site you are directed to is not genuine. availability availability means that information is accessible by authorized users. if an attacker is not able...
Digital Signatures - Archive of obsolete content
section describes how public-key cryptography addresses the problem of tampering. tamper detection and related authentication techniques rely on a mathematical function called a one-way hash (also called a message digest). 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. any change in the data, even deleting or
altering a single character, results in a different value. the content of the hashed data cannot, for all practical purposes, be deduced from the hash-which is why it is called "one-way." similarly, in public key encryption, a key pair is generated for digital signing. the key pair consists of a private signing key and a public verification key. the public key is widely distributed, while the priv...
...(of the original data) that has been encrypted with the signer's private key. to validate the integrity of the data, the receiving software first uses the signer's public key to decrypt the hash. it then uses the same hashing algorithm that generated the original hash to generate a new one-way hash of the same data. (information about the hashing algorithm used is sent with the digital signature,
although this isn't shown in the figure.) finally, the receiving software compares the new hash against the original hash. if the two hashes match, the data has not changed since it was signed. if they don't match, the data may have been tampered with since it was signed, or the signature may have been created with a private key that doesn't correspond to the public key presented by the signer. if t...
Vulnerabilities - Archive of obsolete content
tware. an example is an input validation error, such as user-provided input not being properly evaluated for malicious character strings and overly long values associated with known attacks. another example is a race condition error that allows the attacker to perform a specific action with elevated privileges. a security configuration setting is an element of a software’s security that can be
altered through the software itself. examples of settings are an operating system offering access to control lists that set the privileges that users have for files, and an application offering a setting to enable or disable the encryption of sensitive data stored by the application. a security configuration issue vulnerability involves the use of security configuration settings that negatively affe...
... feature misuse vulnerabilities occur as a result of providing additional features. there may also be confusion regarding misuse vulnerabilities for features that can be enabled or disabled—in a way, configured—versus security configuration issues. the key difference is that for a misuse vulnerability, the configuration setting enables or disables the entire feature and does not specifically
alter just its security; for a security configuration issue vulnerability, the configuration setting
alters only the software’s security. for example, a setting that disables all use of html in emails has a significant impact on both security and functionality, so a vulnerability related to this setting would be a misuse vulnerability. a setting that disables the use of an antiphishing feature in ...
Theme changes in Firefox 4 - Archive of obsolete content
palette. default values of the iconsize attribute on browser toolbars if the theme doesn't override the value of the iconsize attribute, the following defaults are used: toolbar element id default iconsize value menu bar #toolbar-menubar small navigation bar #nav-bar small or large depending on user preference. bookmarks toolbar #person
altoolbar small tab bar #tabstoolbar small add-on bar #addon-bar small custom toolbars some other value small or large depending on user preference. overriding the default values themes can override the value of the iconsize attribute on each toolbar by specifying a special value for the counter-reset css property on the toolbar itself. ...
...ar regardless of the user preference. examples the default windows theme wants to force small icons on the navigation bar regardless of the user preference. thus, it includes this rule in browser.css: #nav-bar { counter-reset: smallicons; } to use large icons for add-on buttons in the bookmarks toolbar when the related user preference is set: #navigator-toolbox[iconsize="large"] > #person
altoolbar { counter-reset: largeicons; } to use large icons everywhere, including the menu bar, regardless of the user preference: #navigator-toolbox > toolbar, #addon-bar { counter-reset: largeicons; } creating a theme that works for firefox 4 on mac os x create a new directory (for example, my_theme). inside that, create another new directory chrome. now copy all of the directories from o...
Scratchpad - Archive of obsolete content
scratchpad provides an environment for experimenting with javascript code. you can write, run, and examine the results of code that interacts with the web page. unlike the web console, which is designed for interpreting a single line of code at a time, scratchpad lets you edit larger chunks of javascript code, then execute it in various ways depending on how you want to use the output. ...
...md + x ctrl + x copy ctrl + c cmd + c ctrl + c paste ctrl + v cmd + v ctrl + v undo ctrl + z cmd + z ctrl + z redo ctrl + shift + z / ctrl + y cmd + shift + z / cmd + y ctrl + shift + z / ctrl + y indent tab tab tab unindent shift + tab shift + tab shift + tab move line(s) up
alt + up
alt + up
alt + up move line(s) down
alt + down
alt + down
alt + down comment/uncomment line(s) ctrl + / cmd + / ctrl + / ...
-ms-accelerator - Archive of obsolete content
keyboard shortcut */ -ms-accelerator: true values false the object is not a keyboard shortcut. true the object is a keyboard shortcut. formal syntax false | true examples this example uses the -ms-accelerator attribute in a <u> element to specify that the "n" in the <label> element is a keyboard shortcut. when the option to "hide keyboard navigation indicators until i use the
alt key" is enabled in the user's display properties, the "n" is not underlined until the user presses the
alt key. when
alt + n is pressed, the <input> element that defines an accesskey attribute value of "n" receives the focus. <!doctype html> <html> <head> <title>accelerator</title> </head> <body> <label for="oname"><u style="-ms-accelerator: true; accelerator: true">n</u>ame: </la...
...ame"><u style="-ms-accelerator: true; accelerator: true">n</u>ame: </label> <input type="text" id="oname" size="25" accesskey="n" value="your name here" /> </body> </html> specifications not part of any specification. remarks this property is supported by windows 2000 and later. it enables users to hide navigation indicators for menu items and controls until the
alt key is pressed. an access key is a single character used as a keyboard shortcut for selecting an object. the user presses the
alt key and holds it while pressing the character to move input focus to the object, and to invoke the default event associated with the object. in internet explorer 8 (ie8) the -ms-accelerator attribute is an extension to css, and can be used as a synonym for accelerato...
CSS - Archive of obsolete content
ider control is one possible representation of <input type="range">.::-ms-fill-upperthe ::-ms-fill-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. a slider control is one possible representation of <input type="range">.::-ms-reve
althe ::-ms-reveal css pseudo-element is a microsoft extension that is used to display a password reveal button for use with a password field created by <input type="password">. the user presses the button to reveal the actual field value rather than asterisks.::-ms-thumbthe ::-ms-thumb css pseudo-element is a microsoft extension that represents the thumb that the user moves within the track of a sli...
... css pseudo-element is a microsoft extension that is used to display a password reveal button for use with a password field created by <input type="password">. the user presses the button to reveal the actual field value rather than asterisks.::-ms-thumbthe ::-ms-thumb css pseudo-element is a microsoft extension that represents the thumb that the user moves within the track of a slider control to
alter its numerical value. a slider control is one possible representation of <input type="range">.::-ms-ticks-afterthe ::-ms-ticks-after css pseudo-element is a microsoft extension that applies one or more styles to the tick marks that appear after the track of a slider control. a slider control is one possible representation of <input type="range">.::-ms-ticks-beforethe ::-ms-ticks-before css pseud...
E4X - Archive of obsolete content
obsoletethis feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. warning: e4x is obsolete. it has been disabled by default for webpages (content) in firefox 17, disabled by default for chrome in firefox 20, and has been removed in firefox 21. use domparser/domserializer or a non-native jxon algorithm instead. ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript. it does this by providing access to the xml document in a form that feels natural for ecmascript programmers. the goal is to provide an
alternative, simpler syntax for accessing xml documents than via dom interfaces. ...
...use domparser/domserializer or a non-native jxon algorithm instead. ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript. it does this by providing access to the xml document in a form that feels natural for ecmascript programmers. the goal is to provide an
alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid
alternative to e4x is a non-native jxon algorithm. e4x is standardized by ecma international in ecma-357 standard (currently in its second edition, december 2005). e4x is implemented (at least partially) in spidermonkey (gecko's javascript engine) and in rhino (javascript engine written in java). note: in gecko 1.8 based browsers such as firefox 1.5, e4x is already partially enabled for web page a...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
he fish cam page as agile as the fish themselves, it was necessary to strip out all of the tables, font tags, and other non-validating stuff. at the end of it, there were a series of div elements that contained a picture of the fish, the name of the fish, and one or more paragraphs of text about the fish. here's a typical (and short) example. ...
... giving the fish some style with the markup all set, it was time to style. the idea was to have the fish listed in a side-by-side arrangement, sort of like a two-column table, only without the table. this was most easily accomplished by floating the div elements themselves. ...
Writing JavaScript for XHTML - Archive of obsolete content
ections: <script type="text/javascript"> <![cdata[ // is the variable a non-negative integer less than 10? if (variable < 10 && variable >= 0) action(); ]]> </script> note that the cdata section is only necessary because of the < in the code; otherwise you could have ignored it. a third solution is to use only external scripts, neatly sidestepping the special-character problem.
alternatively, the cdata section can be couched within comments so as to be able to work in either application/xhtml+xml or text/html: <script type="text/javascript"> //<![cdata[ ... //]]> </script> <!-- (for styles, it is different) --> <style type="text/css"> /*<![cdata[*/ ... /*]]>*/ </style> and if you really need compatibility with very old browsers that do not recognize the ...
... different from the ones in html files. now we take a look at one widly used property that is missing in xml files. in xml documents there is no document.cookie. that is, you can write something like document.cookie = "key=value"; in xml as well, but nothing is saved in cookie storage. solution: use the storage object with firefox 2 there was a new feature enabled, the html 5 storage object.
although this feature is not free of critics, you can use it to bypass the non-existing cookie, if your document is of type xml. again, you will have to write your own wrapper to respect any given combination of mime type and browser. problem: i can't use document.write() this problem has the same cause as the one above. this method does not exist in xmldocuments anymore. there are reasons why this...
XForms Repeat Element - Archive of obsolete content
the repeat element's appearance attribute has a value of compact. behaviour focusing a generated control may change the current index of the containing repeat element. the index is equal to the index of the control set that the focused control belongs to. actions you can use xforms action module elements to modify the nodeset that the repeat element is bound to. the most useful actions for
altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. example <model> <instance> <my:lines> <my:line name="a"> <my:price>3.00</my:price> </my:line> <my:line name="b"> <my:price>32.25</my:price> </my:line> </my:lines> </instance> </model> <repeat id="lineset" nodeset="/my:line...
...reate repeating structures within constructs such as html:table. thus, one might wish to use element repeat within a table to create the rows of a table, where each row of the table binds to a distinct member of a homogeneous collection. since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. to accommodate this, xforms 1.0 defines an
alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-number additionally, when using xforms action setindex, its repeat attribute (which contains an idref) can point to any element carrying these repeat attributes. similarly, the index function can be used with the repeating structu...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
elements section 5.11.3 of css2 defines the three dynamic pseudo-classes (:hover, :active, and :focus) and then goes on to say: css doesn't define which elements may be in the above states, or how the states are entered and left. scripting may change whether elements react to user events or not, and different devices and uas may have different ways of pointing to, or activating elements. thus,
although authors are used to thinking of these states as applying exclusively to hyperlinks, they are not so restricted by css2. any element can, in theory, be in any of the three states, and thus can be styled based on those states. this has not traditionally been the case. bare pseudo-classes the second piece of the problem comes when we consider the effects of a "bare" pseudo-class in a selector...
...the document. this generally means that the rest of the document will take hover styles. 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). this brings up the second common problem, which is that named anchors can accept hover styles.
although authors may intend the selector a:hover to apply only to hyperlinks, it will also apply to named anchors, since the selector merely states that any a element which is in a hover state will be styled. in order to avoid this problem, authors should use the combined pseudo-class syntax described by css2: a:link:hover {color: red;} a:visited:hover {color: maroon;} note that, with this syntax, ...
The Business Benefits of Web Standards - Archive of obsolete content
may be a journalist, a music producer, or may come from any one of a number of disciplines; need not become involved in the actual process of publishing that content at all. and the person applying the markup need not necessarily, know (or care) how it is going to be styled. that has been the real impact of the zen garden, in helping to demonstrate the stunning results which are possible without
altering the markup, and indeed keeping the amount of presentational markup to an acceptable minimum. the content - markup - style; model also lends itself very neatly to linear methods of production. no web development activity need or indeed - should take place until the content has been produced. conversely once the content is to hand the development/publishing process should be lighteningly fast...
... such an increasingly heterogeneous environment, testing each web page in every configuration is impossible. coding to standards is then the only practical solution. in a ground breaking development microsoft have announced a new meta tag that can be used in sites to trigger ie 8 into web standards mode. at the same time in non standards mode existing legacy sites will still be seen as intended.
although in some ways a controversial move - the announcement has attracted widespread support from leading developers and standards advocates, led by jeffrey zeldman. legacy user agents: netscape 4 and ie4 the only drawback in using css is that older browsers (specifically ie4 and ns4) will not be able to render as intended. in some cases, where a significant portion of the audience is running net...
Windows Media in Netscape - Archive of obsolete content
windows xp, netscape 7.1's user agent string may be: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.4) gecko/20030624 netscape/7.1 (ax) if the client was customized by a third party, additional information may be present in the "vendor comment" area of the user agent string. for example: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.4) gecko/20030624 netscape/7.1 (ax; promostring)
although geckoactivexobject is currently available only in netscape 7.1 on windows, it may be the case in the future that it will be available in other gecko-based browsers on other operating systems. detecting the presence of the strings gecko/ and (ax should provide for the ability to detect any gecko-based browsers which supports geckoactivexobject which may be introduced in the future. for exampl...
... name="autostart" value="true" /> <param name="url" value="preludesteel.wma" /> your browser does not support the activex windows media player </object> the classid attribute references the clsid of windows media player 7 and above -- windows media player versions before 7 used a different clsid. examples in this article all assume that the user is running windows media player 7 and later,
although netscape 7.1 supports the clsids of windows media player 6x and later. it is important to note that in netscape 7.1, only the classid for windows media player is supported, and no other control can be created. the various param elements that can be used and the functionalities behind them is best described by the windows media 9 series sdk. in netscape 7.1, the codebase attribute of the obje...
Bounding volume collision detection with THREE.js - Game development
1), new meshnormalmaterial({})); knot.geometry.computeboundingbox(); var knotbbox = new box3( knot.geometry.boundingbox.min, knot.geometry.boundingbox.max); note: the boundingbox property takes the geometry itself as reference, and not the mesh. so any transformations such as scale, position, etc. applied to the mesh will be ignored while computing the calculating box. a more simple
alternative that fixes the previous issue is to set those boundaries later on with box3.setfromobject, which will compute the dimensions taking into account a 3d entity's transformations and any child meshes as well. var knot = new three.mesh( new three.torusknotgeometry(0.5, 0.1), new meshnormalmaterial({})); var knotbbox = new box3(new three.vector3(), new three.vector3()); knotbbox.setfromob...
...nter.z); three.sphere.__closest.clamp(box.min, box.max); var distance = this.center.distancetosquared(three.sphere.__closest); return distance < (this.radius * this.radius); }; demos we have prepared some live demos to demonstrate these techniques, with source code to examine. point vs. box and sphere box vs. box and sphere sphere vs. box and sphere using boxhelper as an
alternative to using raw box3 and sphere objects, three.js has a useful object to make handling bounding boxes easier: boxhelper (previously boundingboxhelper, which has been deprecated). this helper takes a mesh and calculates a bounding box volume for it (including its child meshes). this results in a new box mesh representing the bounding box, which shows the bounding box's shape, and can passed t...
Desktop gamepad controls - Game development
api gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the javascript code thanks to the browsers implementing such feature. an api exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. api status, browser and hardware support the gamepad api is still in working draft status,
although browser support is already quite good — around 63% global coverage, according to caniuse.com. the list of supported devices is also quite extensive — most popular gamepads (e.g. xbox 360 or ps3) should be suitable for web implementations. pure javascript approach let's think about implementing pure javascript gamepad controls in our little controls demo first to see how it would work. ...
...'; shoottext = 'x or space\nto shoot'; } } else { movetext = 'tap and hold to move'; shoottext = 'tap to shoot'; } } when on desktop, we can check if the controller is active and show the gamepad controls — if not, then the keyboard controls will be shown. ...
Tiles and tilemaps overview - Game development
game development, consisting of building the game world or level map out of small, regular-shaped images called tiles. this results in performance and memory usage gains — big image files containing entire level maps are not needed, as they are constructed by small images or image fragments multiple times. this set of articles covers the basics of creating tile maps using javascript and canvas (
although the same high level techniques could be used in any programming language.) besides the performance gains, tilemaps can also be mapped to a logical grid, which can be used in other ways inside the game logic (for example creating a path-finding graph, or handling collisions) or to create a level editor. some popular games that use this technique are super mario bros, pacman, zelda: link's a...
...is a scrolling, that technique is not very efficient. a better way would be to create a canvas that is 2x2 tiles bigger than the visible area, so there is one tile of "bleeding" around the edges. that means that the map only needs to be redrawn on canvas when the scrolling has advanced one full tile — instead of every frame — while scrolling. in fast games that might still not be enough. an
alternative method would be to split the tilemap into big sections (like a full map split into 10 x 10 chunks of tiles), pre-render each one off-canvas and then treat each rendered section as a "big tile" in combination with one of the algorithms discussed above. ...
Plug-in Development Overview - Gecko Plugin API Reference
mimedescription entry point, and will use the information returned by this function. note: the resource method described below is deprecated. plugins should use the info.plist approach, and only use the following method as a supplement to support older browsers. if neither is present, gecko will check the plugins resources. 'str#' 128 should contain a list of mime types and file extensions in
alternating strings. for example: str 128 mime type string 1 video/quicktime string 2 mov, moov string 3 audio/aiff string 4 aiff string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support an...
...ee() when you're done with it. getting version and ui information the netscape group of plug-in api methods provides some basic services to the plug-in. you can use these netscape methods: to identify the browser in which your plug-in is displayed: use the npn_useragent method to read this information. to determine whether plug-in and the browser versions are compatible and possibly provide
alternative processing for different versions: use the npn_version method to check for changes in major and minor version numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. to make the use...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. json can represent numbers, booleans, strings, null, arrays (ordered sequences of values), and objects (string-value mappings) made up of these values (or of other arrays and objects). json does not natively represent more complex data types like functions, regular expressions, dates, and so on. ...
... learn more general knowledge json on wikipedia technical reference json on mdn ...
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
data types: string, number, bigint, boolean, undefined, and symbol. there also is null, which is seemingly primitive, but indeed is a special case for every object: and any structured type is derived from null by the prototype chain. most of the time, a primitive value is represented directly at the lowest level of the language implementation. all primitives are immutable, i.e., they cannot be
altered. it is important not to confuse a primitive itself with a variable assigned a primitive value. the variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be
altered. example this example will help you understand that primitive values are immutable. javascript // using a string method doesn't mutate the string v...
... another example [ step-by-step ] the following example will help you go through how javascript deals with primitives. javascript // the primitive let foo = 5; // defining a function that should change the primitive value function addtwo(num) { num += 2; } // another function trying to do the same thing function addtwo_v2(foo) { foo += 2; } // calling our first function while pass...
Assessment: Accessibility troubleshooting - Learn web development
basic understanding of html, css, and javascript, an understanding of the previous articles in the course. objective: to test basic knowledge of accessibility fundamentals. starting point to get this assessment started, you should go and grab the zip containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascript into one of these online editors. if the online editor you are using doesn't have a separate css/js panel, feel free to put them in appropriate <style> / <script> elements. the finished assessment site should look like so: you will see some differences/issues with the disp...
... the css rule selectors that style the tags to their proper equivalents for the semantic headings. once you add paragraph elements, you'll notice the styling looking better. the images the images are currently inaccessible to screenreader users. can you fix this? the audio player the <audio> player isn't accessible to hearing impaired (deaf) people — can you add some kind of accessible
alternative for these users? the <audio> player isn't accessible to those using older browsers that don't support html5 audio. how can you allow them to still access the audio? the forms the <input> element in the search form at the top could do with a label, but we don't want to add a visible text label that would potentially spoil the design and isn't really needed by sighted users. how can y...
Mobile accessibility - Learn web development
accessibility on mobile devices, and how to overcome them. accessibility on mobile devices the state of accessibility — and support for web standards in general — is good in modern mobile devices. long gone are the days when mobile devices ran completely different web technologies to desktop browsers, forcing developers to use browser sniffing and serve them completely separate sites (
although quite a few companies still detect usage of mobile devices and serve them a separate mobile domain). these days, mobile devices can usually handle fully-featured websites, and the main platforms even have screenreaders built in to enable visually impaired users to use them successfully. modern mobile browsers tend to have good support for wai-aria, too. to make a website accessible and usa...
...se other control mechanisms can't activate the associated functionality. as an example, the click event is good in terms of accessibility — an associated event handler can be invoked by clicking the element the handler is set on, tabbing to it and pressing enter/return, or tapping it on a touchscreen device. try our simple-button-example.html example (see it running live) to see what we mean.
alternatively, mouse-specific events such as mousedown and mouseup create problems — their event handlers cannot be invoked using non-mouse controls. if you try to control our simple-box-drag.html (see example live) example with a keyboard or touch, you'll see the problem. this occurs because we are using code such as the following: div.onmousedown = function() { initialboxx = div.offsetleft; ...
Cascade and inheritance - Learn web development
s applied. this is because that earlier rule has a higher specificity — it is more specific, and therefore is being chosen by the browser as the one that should style the element. as we saw earlier in this lesson, a class selector has more weight than an element selector, so the properties defined on the class will override those applied directly to the element. something to note here is that
although we are thinking about selectors, and the rules that are applied to the thing they select, it isn't the entire rule which is overwritten, only the properties which are the same. this behavior helps avoid repetition in your css. a common practice is to define generic styles for the basic elements, and then create classes for those which are different. for example, in the stylesheet below we h...
...omment before each one. the first two selectors are competing over the styling of the link's background color — the second one wins and makes the background color blue because it has an extra id selector in the chain: its specificity is 201 vs. 101. the third and fourth selectors are competing over the styling of the link's text color — the second one wins and makes the text white because
although it has one less element selector, the missing selector is swapped out for a class selector, which is worth ten rather than one. so the winning specificity is 113 vs. 104. selectors 5–7 are competing over the styling of the link's border when hovered. selector six clearly loses to five with a specificity of 23 vs. 24 — it has one fewer element selectors in the chain. selector seven, howe...
Fundamental CSS comprehension - Learn web development
file for the exercise, and the associated image file, and save them in a new directory on your local computer. if you want to use your own image file and fill your own name in, you are welcome to — just make sure the image is square. grab the css resources text file — this contains a set of raw selectors and rulesets that you'll need to study and combine to answer part of this assessment.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors, and use this url to point the <img> element to the image file. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for...
...t the second ruleset sets font-size: 10px; on the <html> element — this means that for any descendants of <html>, an em will be equal to 10px rather than 16px as it is by default. (this is of course, provided the descendants in question don't have any ancestors sitting in between them and <html> in the hierarchy that have a different font-size set on them. this could affect the values you need,
although in this simple example this is not an issue.) other things to think about: you'll get bonus marks if you write your css for maximum readability, with a separate declaration on each line. you should include .card at the start of the selector chain in all your rules, so that these rules wouldn't interfere with the styling of any other elements if the business card were to be put on a pag...
Floats - Learn web development
elp with this box clearing problem, where you want the bottom of the box to wrap the floated item and wrapping content even if the content is shorter. there are three potential ways to deal with this, two of which work in all browsers — yet are slightly hacky — and a third new way that deals with this situation properly. the clearfix hack the way that this situation has traditionally been de
alt with is to use something known as a "clearfix hack". this involves inserting some generated content after the box which contains the float and wrapping content, and setting that to clear both. add the following css to our example: .wrapper::after { content: ""; clear: both; display: block; } now reload the page and the box should clear. this is essentially the same as if you had added an...
... remove the clearfix css you added in the last section, and instead add overflow: auto to the rules for wrapper. once again, the box should clear. .wrapper { background-color: rgb(79,185,227); padding: 10px; color: #fff; overflow: auto; } float example 6 <h1>simple float example</h1> <div cla...
Introduction to CSS layout - Learn web development
such as english, which has a horizontal writing mode. it would run horizontally in any language with a vertical writing mode, such as japanese. the corresponding inline direction is the direction in which inline contents (such as a sentence) would run. for many of the elements on your page the normal flow will create exactly the layout you need, however for more complex layouts you will need to
alter this default behavior using some of the tools available to you in css. starting with a well-structured html document is very important, as you can then work with the way things are laid out by default rather than fighting against it. the methods that can change how elements are laid out in css are as follows: the display property — standard values such as block, inline or inline-block can...
... out in css are as follows: the display property — standard values such as block, inline or inline-block can change how elements behave in normal flow, for example making a block-level element behave like an inline element (see types of css boxes for more information). we also have entire layout methods that are switched on via specific display values, for example css grid and flexbox, which
alter how elements inside the element they are set on are laid out. floats — applying a float value such as left can cause block level elements to wrap alongside one side of an element, like the way images sometimes have text floating around them in magazine layouts. the position property — allows you to precisely control the placement of boxes inside other boxes. static positioning is the defa...
Learn to style HTML using CSS - Learn web development
looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
...tely necessary as much of what is covered in the css basics article is also covered in our css first steps module, albeit in a lot more detail. modules this topic contains the following modules, in a suggested order for working through them. you should definitely start with the first one. css first steps css (cascading style sheets) is used to style and lay out web pages — for example, to
alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css building blocks this module carries on where css first steps left o...
What is a Domain Name? - Learn web development
ce to be provided in a given language or hosted in a certain country — they are supposed to indicate a resource in a particular language or country. tlds containing .gov are only allowed to be used by government departments. the .edu tld is only for use by educational and academic institutions. tlds can contain special as well as latin characters. a tld's maximum length is 63 characters,
although most are around 2–3. the full list of tlds is maintained by icann. label (or component) the labels are what follow the tld. a label is a case-insensitive character sequence anywhere from one to sixty-three characters in length, containing only the letters a through z, digits 0 through 9, and the - character (which may not be the first or last character in the label). a, 97, and hello-...
...in name. note : for some domain name, it might not be a registrar which is in charge of keeping track. for instance, every domain name under .fire is managed by amazon. finding an available domain name to find out whether a given domain name is available, go to a domain name registrar's website. most of them provide a “whois” service that tells you whether a domain name is available.
alternatively, if you use a system with a built-in shell, type a whois command into it, as shown here for mozilla.org: $ whois mozilla.org domain name:mozilla.org domain id: d1409563-lror creation date: 1998-01-24t05:00:00z updated date: 2013-12-08t01:16:57z registry expiry date: 2015-01-23t05:00:00z sponsoring registrar:markmonitor inc. (r37-lror) sponsoring registrar iana id: 292 whois server: re...
How do you set up a local testing server? - Learn web development
fault, this will run the contents of the directory on a local web server, on port 8000. you can go to this server by going to the url localhost:8000 in your web browser. here you'll see the contents of the directory listed — click the html file you want to run. 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. python3 -m http.server 7800 (python 3.x) or python -m simplehttpserver 7800 (python 2.x). you can then access your content at localhost:7800. running server-side languages locally python's simplehttpserver (python 2.0) http.server (python 3.0) module is useful, but it doesn't know how to run code written in languages such as python, php or javascript. to handle that y...
...on 3.0) module is useful, but it doesn't know how to run code written in languages such as python, php or javascript. to handle that you'll need something more — exactly what you'll need depends on the server-side language you are trying to run. here are a few examples: to run python server-side code, you'll need to use a python web framework. flask is also a good (slightly less heavyweight)
alternative to django. to run this you'll need to install python/pip, then install flask using pip3 install flask. at this point you should be able to run the python flask examples using for example python3 python-example.py, then navigating to localhost:5000 in your browser. to run node.js (javascript) server-side code, you'll need to use raw node or a framework built on top of it. express is a goo...
Advanced form styling - Learn web development
rowser rendering firefox 71 (macos) firefox 57 (windows 10) chrome 77 (macos), safari 13, opera chrome 63 (windows 10) internet explorer 11 (windows 10) edge 16 (windows 10) using appearence: none on radios/checkboxes as we showed before, you can remove the default appearance of a checkbox or radio button
altogether with appearance:none; let's take this example html: <form> <fieldset> <legend>fruit preferences</legend> <p> <label> <input type="checkbox" name="fruit-1" value="cherry"> i like cherry </label> </p> <p> <label> <input type="checkbox" name="fruit-2" value="banana" disabled> i can't like banana </label> </p> ...
...input type="text"> anyway, so we knew this wouldn't be a problem. two things are slightly more problematic. first of all, the select's "arrow" icon that indicates it is a dropdown differs across browsers. it also tends to change if you increase the size of the select box, or resize in an ugly fashion. to fix this in our example we first used our old friend appearance: none to get rid of the icon
altogether: select { -webkit-appearance: none; appearance: none; } we then created our own icon using generated content. we put an extra wrapper around the control, because ::before/::after don't work on <select> elements (this is because generated content is placed relative to an element's formatting box, but form inputs work more like replaced elements — their display is generated by the br...
Basic native form controls - Learn web development
ng on its type attribute value. it is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input like checkboxes, radio buttons, and color pickers, and buttons. single line text fields a single line text field is created using an <input> element whose type attribute value is set to text, or by omitting the type attribute
altogether (text is the default value). the value text for this attribute is also the fallback value if the value you specify for the type attribute is unknown by the browser (for example if you specify type="color" and the browser doesn't support native color pickers). note: you can find examples of all the single line text field types on github at single-line-text-fields.html (see it live also). ...
... the image button control is rendered exactly like an <img> element, except that when the user clicks on it, it behaves like a submit button. an image button is created using an <input> element with its type attribute set to the value image. this element supports exactly the same set of attributes as the <img> element, plus all the attributes supported by other form buttons. <input type="image"
alt="click me!" src="my-img.png" width="80" height="30"> if the image button is used to submit the form, this control doesn't submit its value — instead, the x and y coordinates of the click on the image are submitted (the coordinates are relative to the image, meaning that the upper-left corner of the image represents the coordinate (0, 0)). the coordinates are sent as two key/value pairs: the...
Client-side form validation - Learn web development
ives the user an error message explaining what needs to be corrected, and lets them try again. we want to make filling out web forms as easy as possible. so why do we insist on validating our forms? there are three main reasons: we want to get the right data, in the right format. our applications won't work properly if our users' data is stored in the wrong format, is incorrect, or is omitted
altogether. we want to protect our users' data. forcing our users to enter secure passwords makes it easier to protect their account information. we want to protect ourselves. there are many ways that malicious users can misuse unprotected forms to damage the application (see website security). warning: never trust data passed to your server from the client. even if your form is validating c...
...ds makes it easier to protect their account information. we want to protect ourselves. there are many ways that malicious users can misuse unprotected forms to damage the application (see website security). warning: never trust data passed to your server from the client. even if your form is validating correctly and preventing malformed input on the client-side, a malicious user can still
alter the network request. different types of client-side validation there are two different types of client-side validation that you'll encounter on the web: built-in form validation uses html5 form validation features, which we've discussed in many places throughout this module. this validation generally doesn't require much javascript. built-in form validation has better performance than ja...
UI pseudo-classes - Learn web development
know when a radio button or checkbox they encounter is checked/selected, so you don't want them to read out another dom element that indicates selection — that could be confusing. having a purely visual indicator solves this problem. note: this also shows how you can combine a pseudo-class and pseudo-element if required. back to our required/optional example from before, this time we'll not
alter the appearance of the input itself — we'll use generated content to add an indicating label (see it live here, and see the source code here). first of all, we'll add a paragraph to the top of the form to say what you are looking for: <p>required fields are labelled with "required".</p> screenreader users will get "required" read out as an extra bit of information when they get to each requ...
...on github at radios-checked-default.html (also see the source code.) for the :indeterminate example, we've got no default selected radio button — this is important — if there was, then there would be no indeterminate state to style. ...
The web and web standards - Learn web development
avascript html, css, and javascript are the main three technologies you'll use to build a website: hypertext markup language, or html, is a markup language consisting of different elements you can wrap (mark up) content in to give it meaning (semantics) and structure. simple html looks like this: <h1>this is a top-level heading</h1> <p>this is a paragraph of text.</p> <img src="cat.jpg"
alt="a picture of my cat"> if we adopted a house-building analogy, html would be like the foundations and walls of the house, which give it structure and hold it together. cascading style sheets (css) is a rule-based language used to apply styles to your html, for example setting text and background colors, adding borders, animating things, or laying out a page in a certain way. as a simple ex...
...or physical disabilities. it also goes beyond people with disabilities — how about young or old people, people from different cultures, people using mobile devices, or people with unreliable or slow network connections? internationalization means making websites usable by people from different cultures, who speak different languages to your own. there are technical considerations here (such as
altering your layout so that it still works ok for right-to-left, or even vertical languages), and human ones (such as using simple, non-slang language so that people who have your language as their second or third language are more likely to understand your text). privacy & security. these two concepts are related but different. privacy refers to allowing people to go about their business privately...
Mozilla splash page - Learn web development
index.html on your local drive, in a new directory. then save pattern.png in the same directory (right click on the image to get an option to save it.) access the different images in the originals directory and save them in the same way; you'll want to save them in a different directory for now, as you'll need to manipulate (some of) them using a graphics editor before they're ready to be used.
alternatively, you could use an online tool such as glitch to create your example. this would also be useful if you want to get it assessed, or ask for help — see the assessment or further help section at the bottom of this page. note: the example html file contains quite a lot of css, to style the page. you don't need to touch the css, just the html inside the <body> element — as long as you i...
...vb1olg, using the appropriate youtube tools to generate the code. the video should be 400px wide. adding responsive images to the further info links inside the <div> with the class of further-info you will find four <a> elements — each one linking to an interesting mozilla-related page. to complete this section you'll need to insert an <img> element inside each one containing appropriate src,
alt, srcset and sizes attributes. in each case (except one — which one is inherently responsive?) we want the browser to serve the 120px wide version when the viewport width is 500px wide or less, or the 400px wide version otherwise. make sure you match the correct images with the correct links! note: to properly test the srcset/sizes examples, you'll need to upload your site to a server (using...
Build your own function - Learn web development
here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to provide some practice in building a custom function, and explain a few more useful associated details. ...
...cement for a browser's built-in alert() function. we've seen this before, but let's just refresh our memories. 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. try varying the string to change the message. the alert function is limited: you can
alter the message, but you can't easily vary anything else, such as the color, icon, or anything else. we'll build one that will prove to be more fun. note: this example should work in all modern browsers fine, but the styling might look a bit funny in slightly older browsers. we'd recommend you doing this exercise in a modern browser like firefox, opera, or chrome. the basic function to begin w...
Image gallery - Learn web development
before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript loops, functions, conditionals, and events. starting point to get this assessment started, you should go and grab the zip file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. note: if you get stuck, then ask us for help — see the assessment or further help s...
... the image is inside the images directory and its name is pic1.jpg, pic2.jpg, etc. adding an onclick handler to each thumbnail image in each loop iteration, you need to add an onclick handler to the current newimage — this handler should find the value of the src attribute of the current image. set the src attribute value of the displayed-img <img> to the src value passed in as a parameter.
alternatively, you can add one event listener to the thumb bar. writing a handler that runs the darken/lighten button that just leaves our darken/lighten <button> — we've already provided a line that stores a reference to the <button> in a constant called btn. you need to add an onclick handler that: checks the current class name set on the <button> — you can again achieve this by using geta...
Function return values - Learn web development
er literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like — the values that a function returns when it has completed. you've already met return values a number of times,
although you may not have thought about them explicitly. let's return to a familiar example (from a previous article in this series): let mytext = 'the weather is cold'; let newstring = mytext.replace('cold', 'warm'); console.log(newstring); // should print "the weather is warm" // the replace() string function takes a string, // replaces one substring with another, and returns // a new string with...
... over to new code, or even just apply it to html pages wherever you need it. test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: functions. conclusion so there we have it — functions are fun, very useful, and
although there's a lot to talk about in regards to their syntax and functionality, they are fairly understandable. if there is anything you didn't understand, feel free to read through the article again, or contact us to ask for help. ...
Introduction to web APIs - Learn web development
ding you with extra superpowers to use in your javascript code. they generally fall into two categories: browser apis are built into your web browser and are able to expose data from the browser and surrounding computer environment and do useful complex things with it. for example, the web audio api provides javascript constructs for manipulating audio in the browser — taking an audio track,
altering its volume, applying effects to it, etc. in the background, the browser is actually using some complex lower-level code (e.g. c++ or rust) to do the actual audio processing. but again, this complexity is abstracted away from you by the api. third-party apis are not built into the browser by default, and you generally have to retrieve their code and information from somewhere on the web. for...
...its context object is created by getting a reference to the <canvas> element you want to draw on, and then calling its htmlcanvaselement.getcontext() method: const canvas = document.queryselector('canvas'); const ctx = canvas.getcontext('2d'); anything that we want to do to the canvas is then achieved by calling propertie...
Third-party APIs - Learn web development
ample to show how to use it, but in the end we went with mapquest for a couple of reasons: it is much easier to get started with. for google apis in general, you need to create a google account and log into the google cloud platform console to create api keys, etc., and the process is fairly complex. for the google maps api in particular, you need to provide a credit card for billing purposes (
although basic usage is free), which we didn't think was acceptable for a basic tutorial. we wanted to show that there are other
alternatives available. a restful api — nytimes now let's look at another api example — the new york times api. this api allows you to retrieve new york times news story information and display it on your site. this type of api is known as a restful api — instead ...
... = current.snippet; para2.textcontent = 'keywords: '; for(let j = 0; j < current.keywords.length; j++) { const span = document.createelement('span'); span.textcontent += current.keywords[j].value + ' '; para2.appendchild(span); } if(current.multimedia.length > 0) { img.src = 'http://www.nytimes.com/' + current.multimedia[0].url; img.
alt = current.headline.main; } clearfix.setattribute('class','clearfix'); article.appendchild(heading); heading.appendchild(link); article.appendchild(img); article.appendchild(para1); article.appendchild(para2); article.appendchild(clearfix); section.appendchild(article); } } } there's a lot of code here; let's explain it step by step: ...
Inheritance in JavaScript - Learn web development
previous overview: objects next with most of the gory details of oojs now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes. in addition, we present some advice on when and where you might use oojs, and look at how classes are de
alt with in modern ecmascript syntax. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how it is possible to implement inheritance in javascript. prototypal inheritance so far we have seen some inheritance in action — we have seen how prototype chains work, and how member...
... all together and package them neatly, an object is a good idea. objects are also very useful when you want to pass a collection of data from one place to another. both of these things can be achieved without use of constructors or inheritance. if you only need a single instance of an object, then you are probably better off just using an object literal, and you certainly don't need inheritance.
alternatives for extending the prototype chain in javascript, there are several different ways to extend the prototype of an object aside from what we've shown above. to find out more about the other ways, visit our inheritance and the prototype chain article. test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further te...
React resources - Learn web development
ide javascript frameworks next our final article provides you with a list of react resources that you can use to go further in your learning. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to provide further resources for learning more about react. component-level styles
although this tutorial doesn't use this approach, many react applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. create-react-app makes it possible to import css files into javascript modules, so that css is only sent to your user when the corresponding component is rendered. for this app, we could have for example written a dedicated form.css f...
... for complex, deeply nested applications, however, they're not always best. react provides the context api as a way to provide data to components that need it without passing props down the component tree. there's also a usecontext hook that facilitates this. if you'd like to try this api for yourself, smashing magazine has written an introductory article about react context. class components
although this tutorial doesn’t mention them, it is possible to build react components using es6 classes – these are called class components. until the arrival of hooks, es6 classes were the only way to bring state into components or manage rendering side effects. they're still the only way to handle certain other, more edge-case features, and they’re very common in legacy react projects. the of...
Starting our Svelte Todo list app - Learn web development
ccessible code "by default". being a compiler, svelte can statically analyze our html templates to provide accessibility warnings when components are being compiled. accessibility (shortened to a11y) isn't always easy to get right, but svelte will help by warning you if you write inaccessible markup. ...
...ut svelte will help by warning you if you write inaccessible markup. for example, if we add an <img> element to our todos.svelte component without its corresponding
alt prop: <h1>svelte to-do list</h1> <img height="32" width="88" src="https://udn.realityripple.com/samples/b0/98dase3c7d.png"> the compiler will issue the following warning: (!) plugin svelte: a11y: <img> element should have an
alt attribute src/components/todos.svelte 1: <h1>svelte to-do list</h1> 2: 3: <img height="32" width="88" src="https://udn.realityripple.com/samples/b0/98dase3c7d.png"> ^ created public/build/bundle.js in 220ms [2020-07-15 04:07:43] waiting for changes... moreover, our editor can display this warning even before calling the compiler: you can tell svelte to ignore this warning for the next blo...
Implementing feature detection - Learn web development
nd javascript. css you can write tests for css features by testing for the existence of element.style.property (e.g. paragraph.style.transform) in javascript. a classic example might be to test for flexbox support in a browser; for browsers that support the newest flexbox spec, we could use a flexible and robust flex layout. for browsers that don't, we could use a floated layout that works ok,
although it is slightly more brittle and hacky, and not as cool-looking. let's implement something that demonstrates this,
although we'll keep it simple for now. start by making local copies of our css-feature-detect.html, flex-layout.css, float-layout.css, and basic-styling.css files. save them in a new directory. we will add the html5 shiv to our example too so that the html5 semantic elements...
... do all of our feature detection in css, no javascript required, and we can handle all the logic in a single css file, cutting down on http requests. the problem here is browser support — @supports is not supported at all in ie, and only supported in very recent versions of safari/ios webkit (9+/9.2+), whereas the javascript version should work in much older browsers (probably back to ie8 or 9,
although older versions of ie will have additional problems, such as not supporting document.queryselector, and having a messed up box model). javascript we already saw an example of a javascript feature detection test earlier on. generally, such tests are done via one of the following common patterns: summary of javascript feature detection techniques feature detection type explanati...
Client-side tooling overview - Learn web development
of web app development, and how to find help with individual tools. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand what types of client-side tooling there are, and how to find tools and get help with them. overview of modern tooling writing software for the web has become more sophisticated through the ages.
although it is still entirely reasonable to write html, css, and javascript "by hand" there is now a we
alth of tools that developers can use to speed up the process of building a web site, or app. there are some extremely well-established tools that have become common "household names" amongst the development community, and new tools are being written and released every day to solve specific problem...
...t that will guarantee success with tools, but as your experience increases you'll find workflows that work for you or for your team and their projects. once all the kinks in the process are flattened out, your tool chain should be something you can forget about and it should just work. how to choose and get help with a particular tool most tools tend to get written and released in isolation, so
although there’s almost certainly help available it’s never in the same place or format. it can therefore be hard to find help with using a tool, or even to choose what tool to use. the knowledge about which are the best tools to use is a bit tribal, meaning that if you aren’t already in the web community, it is hard to find out exactly which ones to go for! this is one reason we wrote this ser...
Chrome Worker Modules
is to use the chrome worker module loader. this module loader should not surprise developers familiar with commonjs, as it implements a minimal commonjs require(). loading modules loading a module is simple. start by importing the module loader. you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js"); note:
although you only need to do this once for each worker, it doesn't hurt if you do it more than once. this defines a global value require(), that you may now use as follows: // import the module // (here, we import the core of os.file) let core = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm"); // we may now use module core. core.declareffi(...) note that, for the moment, requi...
... or “.jsm”, and designed to be opened through require(). any value you define in that file is private by default. ...
Mozilla accessibility architecture
important to 3rd party assistive technology. accessibility apis on each operating system have built-in assumptions about what is the most important information, and how an accessibility server like mozilla should use the api's programmatic interfaces to expose this information to an accessibility client (the assistive technology). each platform's accessibility api has made different assumptions,
although there are a number of common characteristics. for example, they all expose an accessible name, or text representation, of each object, and they all use an enumerated integer value from a finite list, to expose the role of an object. examples of accessible role constants are role_button, role_checkbox and role_list,
although they can have slightly different names and values in each api. in ge...
... we call these objects "accessible nodes". each of these accessible nodes supports at minimum the generic cross-platform accessibility interface nsiaccessible (which provides a text name, enumerated role identifier and a set of state flags) and sometimes additional interfaces. for example, tables support nsiaccessibletable, text supports nsiaccessibletext and edit boxes support nsieditabletext.,
although this code has been moved into the atk specific directories because it is not currently used in windows. we will not rule out the possibility of supporting some of the rich atk interfaces on windows. the toolkit-specific classes then use these xpcom interfaces to gather information about the objects they want to expose, make any necessary changes, and then expose the information using microso...
Embedding API for Accessibility
fonts setcharpref("font.name.monospace.x-western", newfontname); setcharpref("font.name.serif.x-western", newfontname); setcharpref("font.name.sans-serif.x-western", newfontname); /* for other i18n charsets, change x-western to x-central-euro, x-cyrillic, x-unicode, x-user-def, x-b
altic, el, tr, he, ar, th, ja, zh-cn or zh-tw */ setintpref("font.size.fixed.x-western", newfontsize); setintpref("font.size.variable.x-western", newfontsize); /* for other i18n charsets, change the name as explained above for font face*/ setcharpref("font.defa...
... caret will be visible in the text of the browser, allowing the user to cursor around the html content as if in a read-only editor */ moz 0.9 special content notifications the w3c uaag specifies types of content that must be optional. the intention is for a user to be notified of its existence, and at some point they can choose to load the content. this is a much better
alternative than having the user go through a long series of confirm boxes for each new page, for each type of content. for each preference named "browser.accept.*", there is also an "alert.audio.*" preference, to allow configuration of sound files to go with each type of content. the audio file could be a clip of a human voice saying "you've got video" or even a simple beep. how we expose this thr...
Mozilla's Section 508 Compliance
requirement windows linux/unix mac os (a) when software is designed to run on a system that has a keyboard, product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually. mostly complete. ...
...& security - images contain options for making animated images still. (i) color coding shall not be used as the only means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. complete. caveat: normally mozilla uses a color change to indicate when a link has been visited. however, the visited link appearance can be
altered via a user style sheet. (j) when a product permits a user to adjust color and contrast settings, a variety of color selections capable of producing a range of contrast levels shall be provided. complete. mozilla's appearance preferences panel contains a large number of color possibilities. (k) software shall not use flashing or blinking text...
Creating a Firefox sidebar
xtension to add a web panel is available as a starter.obsolete since gecko 57 if you'd like to have a deeper integration with the browser to offer more complex features, a traditional overlay extension can be an option. the document might be obsolete, though.obsolete since gecko 57 the social api obsolete since gecko 57 (firefox 57 / thunderbird 57 / seamonkey 2.54)this feature is obsolete. ...
...try to avoid using it. as of firefox 23, the addpanel and addpersistentpanel functions have been removed from the deprecated, netscape-derived window.sidebar object. ...
Debugging on Windows
"debug > other debugging targets > child process debugging settings", and ticking the box. if you have followed the steps in building firefox for windows and have a local debug build, you can execute ./mach run --debug from the same command line. it would open visual studio with firefox's run options configured. you can click "start" button to run firefox then, already attached in the debugger.
alternatively, if you have generated the visual studio solution, via ./mach build-backend -b visualstudio, opening this solution allows you to run firefox.exe directly in the debugger. making it the startup project, by right clicking on it (it appears bold when it's the case) can be useful. breakpoints are kept across runs, this can be a good way to debug startup issues. run the program until you hi...
...} >debug.evaluatestatement ((nsgenericelement*)0x03f0e710)->list((file*)0x10311dc0, 1) <void> >debug.evaluatestatement {,,msvcr80d}fclose((file*)0x10311dc0) 0x00000000 note t...
Configuring Build Options
builds aren't really appropriate for local builds. firefox, debugging build (mac os x 64bits) thunderbird, debugging build (linux 64 bits) building multiple applications from the same source tree it is possible to build multiple applications from the same source tree, as long as you use a different objdir for each application. you can either create multiple mozconfig files, or
alternatively, use the moz_build_projects make option. using moz_build_projects in a single mozconfig to use moz_build_projects, you must specify a moz_objdir and a moz_build_projects make option, containing space separated names. each name can be an arbitrary directory name. for each name, a subdirectory is created under the toplevel objdir. you then need to use the ac_add_app_options with the spe...
.../mozilla/src/obj-@config_guess@ mk_add_options moz_build_projects="browser mail" ac_add_app_options browser --enable-application=browser ac_add_app_options mail --enable-application=comm/mail if you want to build only one project using this mozconfig, use the following command line: moz_current_project=browser ./mach build this will build only the browser. using multiple mozconfig files
alternatively, you may want to create separate mozconfig files. as an example, the following steps can be used to build firefox and thunderbird. you should first create three mozconfig files. mozconfig-common: # add common options here, such as making an optimized release build mk_add_options moz_make_flags="-j4" ac_add_options --enable-optimize --disable-debug mozconfig-firefox: # include the ...
Multiple Firefox profiles
the browser url search bar. the page presents a list of all of your profiles, each beginning with "profile: " followed by its name. the one being run by this firefox instance will include the bold text "this is the profile in use" for example, if you find that text beneath the entry for "profile: suzie", then you are running in a profile named suzie. launching firefox into a desired profile
although it is possible in some cases to have multiple instances of firefox running in different profiles, to avoid confusion, you might want to first exit/quit/terminate all running instances of firefox, firefox developer edition or nightly. then follow the instructions below, applicable to your operating system. from profile manager inside firefox if you already have firefox instance running, you...
...bar at the bottom. type firefox --new-instance --profilemanager. windows 8/8.1/10 press "windows + r" on your keyboard. type firefox --new-instance --profilemanager. linux if firefox is already included in your linux distribution, or if you have installed firefox with the package manager of your linux distribution: open a terminal emulator or your shell’s command prompt:
alt-f2 if you use gnome shell or kde plasma, consult your desktop environment documentation for other environments. run firefox --new-instance --profilemanager. macos run the terminal application, which is found in applications/utilities. type or paste in the path to firefox, followed by .app/contents/macos/firefox. for example, if firefox is installed in the recommended location, you...
Performance
key points to keep in mind scripts registered during addon startup get executed during session restore. the more expensive they are to execute the longer it will take for the browser to become responsive after startup. frame scripts also get executed on non-restored tabs. all their overhead is thus not just incurred by active tabs but by the total number of tabs in a session. ...
...d", {something: result}) } function addframe(frameglobal) { frameglobal.addmessagelistener("my-addon:request-from-parent", dosomething) } javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks. but care must be taken to not leak references to the frame script global when it is passed into a jsm.
alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed. store heavyweight state once per process bad: // addon.js var main = new myaddonservice(); main.onchange(statechange); function statechange() { services.mm.broadcastasyncmessage("my-addon:update-configuration", {newconfig: main.serialize()}) } // frames...
IME handling guide
ed editor handles a dispatched ecompositionchange event, this modifies the stored composition string and its clause information. the editor refers the stored information for creating or modifying a text node representing a composition string. and before dispatching ecomposition* events, this class removes ascii control characters from dispatching composition event's data in the default settings.
although, this can be disabled with "dom.compositionevent.allow_control_characters" pref. finally, this class guarantees that requesting to commit or cancel current composition to ime is perefored synchronously. see forcibly committing composition section for the detail. editor/libeditor mozilla::editoreventlistener listens for trusted dom compositionstart, text and compositionend events and notif...
...ion synchronously. additionally, textcomposition ignores comming events which are dispatched by widget when the widget receives native ime events. in this case, using the last composition string as commit string. however, if the last composition string is only an ideographic space (fullwidth space), the composition string may be a placeholder of some old chinese ime on windows. in this case,
although, we should not commit the placeholder character because it's not a character which the user wanted to input but we commit it as is. the reason is, inputting an ideographic space causes a composition. therefore, we cannot distinguish if committing composition is unexpected. if the user uses such old chinese ime, "intl.ime.remove_placeholder_character_at_commit" pref may be useful but we don't...
Implementing QueryInterface
ors when you can't really get to the desired interface. it avoids repeated uses of and assignments to *ainstanceptr, which compilers have trouble optimizing. it clears the result, *ainstanceptr, when returning an error. it generates less code than the typical implementation of queryinterface. it tests for bad input with an ns_assertion, to find logic errors immediately in debug builds. some
alternatives the ns_impl_query_interface[012] macros the sample above implements two xpcom interfaces in addition to nsisupports. the ns_impl_query_interface2 macro can write this function for you (though it pains me to recommend macros), e.g., ns_impl_query_interface2(nsmyimplementation, nsix, nsiy) // implements |nsmyimplementation::queryinterface| as ...
...the macro must expand to different text in different situations, e.g., different platforms, debugging vs. non-debugging, et al. in such cases macros are indispensible. in other cases macros may help some people but often cloud the issues for others. they always make the program source more fragile. in this case the macro is for convenience only, so i don't recommend it, but i do offer it up as an
alternative. // ... if ( aiid.equals(ns_get_iid(nsix)) ) foundinterface = ns_static_cast(nsix*, this); else if ( aiid.equals(ns_get_iid(nsiy)) ) foundinterface = ns_static_cast(nsiy*, this); // ...as many cases as needed... else if ( aiid.equals(ns_get_iid(nsisupports)) ) // ... thanks special thanks to heikki toivonen, chris waterson, and john bandhauer fo...
Localizing with Mozilla Translator
is not a component, but a platform. for these few files, you will have to export them individually and reimport them. if you are a ''not so good'' mt user, however, you can just create a new product (or several ones; see next recipe to know why), run file -> update on them (you'll get a list of all the strings) and then run edit -> autotranslate. most of the strings will be automatically filled,
although if you do this you should review them, because for en-us strings with several possible translations, mt will choose one of them, which could not be the one you want. from cvs to mercurial in mt so, you have a firefox product in mt with a platform neutral and, inside it, several directories (''components'' in mt terminology) more or less like the second sample above, checked out from cvs.
...d you do? the first thing to do, once you have your mercurial local repository up and working, is create a new product... or more. with good oldie cvs, you could checkout just the locale content and, even more, you could checkout just ''the locale directories'' you were interested in. with mercurial, partial checkouts are not possible, so you have your own mozilla repository full copy (there are
alternate solutions; read on). a bit of history on mt mt has been evolving from long ago, when l10n were done always on shipped en-us jars and when mozilla suite had five l10n jars: ab-cd.jar, ab-win.jar, ab-mac.jar, ab-unix.jar, and cd.jar. mt thus referred to ab-cd.jar contents as ''platform neutral'' platform, cd.jar as '''region''' platform (or regional files), and the other three as ''window...
Localization sign-off reviews
elease-to-release. only evaluates new l10n work. this is done by generating a diff between the new release revision being considered and the previously approved release revision. focuses on technical accuracy and completion of l10n work, not translation quality. evaluates new release revisions, not entire l10n repos. does not need to be approved before revision merge between release channels,
although it is recommended. sign-off review criteria since the scope of each qa review process varies, the criteria used to evaluate a localizer's work also varies. in principle, they share basic elements, but sign-off reviews are only for evaluating the changes between your latest approved revision and the new revision you've submitted for release approval. hence, unless a localizer makes a change ...
...significantly less comprehensive than a technical review. here is some of the criteria we use to perform sign-off reviews: increased amount of untranslated strings we look for previously translated strings changing to untranslated strings in the new revision. this is a common problem with some tools. encoding some tools add bom to utf-8 encoded files, and some change the encoding
altogether. mistakenly localized code we look for changes in localized code that should not have been localized or wasn't localized in the previous revision. search plugin changes this greatly impacts productization. we look for these changes and file bugs when they're found in a new revision. further indications of tool-originated corruption this is common. most bugs filed fr...
Creating localizable web content
text content check that the text is factually correct for an international audience (e.g., mentions of en-us specific product pieces like specific search engines or dictionary should be adapted) look for strings that are likely hard to translate because they are unclear, use play on words or colloquialisms. depending on context, find
alternate strings or document an explanation of the string for localizers check that we don't link in new pages to sub-pages with anchors. e.g.: a new page is announced with only 100 words but it is actually content added to an existing page in english. happens for things like faq, or video pages for example. for video, use the code to display the video in an overlayed video player on the page instead of linking to a video section in english. per-loc...
...ink in new pages to sub-pages with anchors. e.g.: a new page is announced with only 100 words but it is actually content added to an existing page in english. happens for things like faq, or video pages for example. for video, use the code to display the video in an overlayed video player on the page instead of linking to a video section in english. per-locale customizations check if there are
alternative links for localized pages (e.g., links to mdn, addons.mozilla.org, or other external resources, are there translated equivalents we can use). if there are
alternatives, use them by adding the $lang; parameter in the urls evaluate the impact of new pages on all our web properties, especially links to community sites and redirects. sometimes you can leave some freedom of modification for ...
Fonts for Mozilla's MathML engine
xits or amiri fonts. installation without administrator privilege if you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the mathml-fonts add-on. note that using the add-on is not optimal since it forces your gecko browser to load a css stylesheet on each page you visit as well as web math fonts on all pages with mathml content. a better
alternative on unix systems is to install the otf files for latin modern math and stix into some local font folder and (if necessary) to run fc-cache on it. on os x and linux, the standard paths are ~/library/fonts/ and ~/.fonts. fonts with a math table you can actually render mathml using any font with a math table and related open font format features. a list of such math fonts is provided below.
...local font folder and (if necessary) to run fc-cache on it. on os x and linux, the standard paths are ~/library/fonts/ and ~/.fonts. fonts with a math table you can actually render mathml using any font with a math table and related open font format features. a list of such math fonts is provided below. you can use the advanced font preference menu to configure the default font for mathematics.
alternatively, you can try the mathml-fontsettings add-on. asana math cambria math dejavu math tex gyre garamond math (under development) latin modern math libertinus math lucida bright math minion math stix math tex gyre bonum math tex gyre pagella math tex gyre schola math tex gyre termes math xits math fira math (sans-serif typeface, under development) gfs neohellenic math (sans-...
Fonts for Mozilla 2.0's MathML engine
use of various symbols represented by specific unicode characters. mozilla can display any of these symbols provided suitable unicode fonts are installed. furthermore, in accordance with the w3c css2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of css), with the assurance that mozilla's font engine will hunt for
alternate fonts whenever their specified fonts are not found on a particular user's system. if no appropriate font is ultimately found for a given character, mozilla will instead display a box containing the hexadecimal representation of the unicode code point for the character. some mathematical operators are also drawn by using glyphs for larger variants of the character (e.g. summation symbol) or ...
...installed via your software manager. for convenience we provide a zip archive of mathml fonts. 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". these fonts are opentype postscript fonts, which are supported by most modern operating systems. however some operating systems may not support these fonts. on such systems, it will be necessary to convert the fonts to a supported format. for example asana math is available in truetype format and there is an unofficial truetype conversion for st...
Mozilla Development Strategies
her trees, work on smaller, easier bugs. pick bugs that won't cause conflicts with the work you're doing in your primary tree. pick bugs that should only take you a few hours or a day to fix. in theory, fixes for these bugs will be quick to review. if you have problems finding smaller, easier bugs to work on, start by looking for crashers. maybe the problem can be turned into an assert, or fixed
altogether. you can use talkback queries or bugzilla queries to find crashers. look for problems in existing code. find and fix string usage problems. find and fix bad xpcom macro usage. switch some code over to nscomptrs. look for xxx or todo in the code, verify the code still needs fixing, and fix it. smaller patches get reviewed faster if you find that you spend a lot of time waiting for review...
...s to what to work on, talk to a lead sooner rather than later. most likely they will have a bug they can hand off to you, or they can help get you unblocked. since they are going to be reviewing your code later, run your plan of attack by them first. it's better to have an idea rejected, than a big patch. if you are blocked, but have something worth checking in, check in using #ifdef, prefs, or "
alternative" files sometimes you'll work on something, but you can't land it because something else is blocking you. you can still land (assuming you get reviews) if the code isn't on by default. this also makes it easier to get help on the problem. it's easier to tell someone set a pref, or apply a small patch, or set a #define than to apply a monster patch. for c++, use #define, #ifdef, #else and...
mozilla::CondVar
mozilla::condvar is a bare wrapper around prcondvar. please see introduction_to_nspr for a high-level summary of its semantics. #include "condvar.h" methods constructor condvar(mutex& amutex, const char* aname) initialize the condvar with its associated mutex and a name to reference it by. wait() nsresult wait( in printerv
altime interval = pr_interval_no_timeout ); wait on this condvar until it is notifyed. notify() nsresult notify(void); notify one thread waiting on this condvar. notifyall() nsresult notifyall(void); notify all threads waiting on this condvar. assertcurrentthreadownsmutex() assert that the current thread has successfully locked the mutex undergirding this condvar. does not incur a runtime pen
alty in optimized builds. assertnotcurrentthreadown...
...tifyall(void); notify all threads waiting on this condvar. assertcurrentthreadownsmutex() assert that the current thread has successfully locked the mutex undergirding this condvar. does not incur a runtime pen
alty in optimized builds. assertnotcurrentthreadownsmutex() assert that the current thread has not successfully locked the mutex undergirding this condvar. does not incur a runtime pen
alty in optimized builds. see also prcondvar ...
Leak-hunting strategies and tips
the base class using delete, its destructor better be virtual. (but we have many virtual destructors in the codebase that don't need to be -- don't do that.) debugging leaks that go through xpconnect many large object graphs that leak go through xpconnect. this can mean there will be xpconnect wrapper objects showing up as owning the leaked objects, but it doesn't mean it's xpconnect's fault (
although that has been known to happen, it's rare). debugging leaks that go through xpconnect requires a basic understanding of what xpconnect does. 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. when a c++ object is exposed to javascript (the more common of the two), an xpcwrappednative object...
...t variable _nt_symbol_path to something like symsrv*symsrv.dll*f:\localsymbols*http://msdl.microsoft.com/download/symbols as described in microsoft's article. this needs to be done when running, since we do the address to symbol mapping at runtime. linux many linux distros provide packages containing external debugging symbols for system libraries. fix_stacks.py uses this debugging information (
although it does not verify that they match the library versions on the system). for example, on fedora, these are in *-debuginfo rpms (which are available in yum repositories that are disabled by default, but easily enabled by editing the system configuration). tips disabling arena allocation with many lower-level leak tools (particularly trace-malloc based ones, like leaksoup) it can be helpful...
Power profiling overview
phasis on intel processors used in desktop and laptop machines. it serves as a starting point for anybody doing power profiling for the first time. basic physics concepts in physics, power is the rate of doing work. it is equivalent to an amount of energy consumed per unit time. in si units, energy is measured in joules, and power is measured in watts, which is equivalent to joules per second.
although power is an instantaneous concept, in practice measurements of it are determined in a non-instantaneous fashion, i.e. by dividing an energy amount by a non-infinitesimal time period. strictly speaking, such a computation gives the average power but this is often referred to as just the power when context makes it clear. in the context of computing, a fully-charged mobile device battery (as ...
...if the high-performance gpu is being used, which uses more power than the integrated gpu. if neither cpu usage nor wakeup frequency identifies the problem, more ingenuity may be needed. looking at other measurements (c-state residency, gpu usage, etc.) may be helpful. animations are sometimes the cause of high power consumption. the animation inspector in the firefox devtools can identify them.
alternatively, here is an explanation of how one developer diagnosed two animation-related problems the hard way (which required genuine platform expertise). the approximate cause of power problems often isn't that hard to find. fixing them is often the hard part. good luck. if you do fix a problem by improving a proxy measurement, you should verify that it also improves a power measurement or esti...
Profiling with the Firefox Profiler
nificant portion of time can be spent in idle, blocking calls like waiting for events. this is ideal for a responsive application to be ready to service incoming events. there are os-specific waiting functions like ntwaitformultipleobjects seen in the example above taken on windows or mach_msg_trap on macos. tip: you can quickly go deeper into the call tree by holding down your right arrow key.
alternatively, expand an entire tree segment by holding
alt and clicking on the arrow to the left of the collapsed tree segment. as we progress into a more specific part of the tree, you'll notice that the 'running time' decreases. this happens when a function has 2 or more non-trivial calls: the running time will be split between its children. tip: focus on one section of the tree by clicking on...
...g or through the moz_profiler_startup_features environement variable. here are the main ones: native stacks - "stackwalk" when taking a sample the profiler will attempt to unwind the stack using platform specific code appropriate for the abi. this will provide an accurate callstack for most samples. on abis where framepointers are not available this will cause a significant performance impact.
alternatively, native leaf stack ("leaf") only records the top-most frame. javascript - "js" javascript callstacks will be generated and interleaved with the c++ callstacks. this will introduce an overhead when running js. main thread file io, profiled thread file io, all file io - "mainthreadio", "fileio", "allfileio" this will interpose file i/o from a selection of threads, and report them in t...
NSPR build instructions
building nspr consists of three steps: run the configure script. ...
...uild the test programs for example, # check out the source tree from mercurial hg clone https://hg.mozilla.org/projects/nspr # create a build directory mkdir target.debug cd target.debug # run the configure script ../nspr/configure [optional configure options] # build the libraries gmake # build the test programs cd pr/tests gmake on mac os x, use make, which is gnu make. configure options
although nspr uses autoconf, its configure script has two default values that are different from most open source projects. if the os vendor provides a compiler (for example, sun and hp), nspr uses that compiler instead of gcc by default. nspr build generates a debug build by default. --disable-debug --enable-optimize specify these two options to generate an optimized (release) build. these t...
PR_CWait
if you specify pr_interval_no_timeout, the function returns if and only if the object is notified. ...
...if you specify pr_interval_no_timeout, the function returns if and only if the object is notified. ...
PR_Connect
returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. ...
... returns the function returns one of the following values: upon successful completion of connection setup, pr_success. if unsuccessful, pr_failure. ...
PR_QueueJob_Timer
fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. ...
... fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. ...
Certificate functions
cert_createname mxr 3.2.1 and later cert_createocspcertid mxr 3.6 and later cert_createocsprequest mxr 3.6 and later cert_createrdn mxr 3.2.1 and later cert_createsubjectcertlist mxr 3.4 and later cert_createvalidity mxr 3.5 and later cert_crlcacherefreshissuer mxr 3.7 and later cert_decode
altnameextension mxr 3.10 and later cert_decodeauthinfoaccessextension mxr 3.10 and later cert_decodeauthkeyid mxr 3.10 and later cert_decodeavavalue mxr 3.4 and later cert_decodebasicconstraintvalue mxr 3.2 and later cert_decodecertfrompackage mxr 3.4 and later cert_decodecertificatepoliciesextension mxr ...
... cert_destroyocspresponse mxr 3.7 and later cert_destroyoidsequence mxr 3.9 and later cert_destroyusernotice mxr 3.10 and later cert_destroyvalidity mxr 3.5 and later cert_dupcertificate mxr 3.2 and later cert_dupcertlist mxr 3.2 and later cert_enableocspchecking mxr 3.2 and later cert_encode
altnameextension mxr 3.7 and later cert_encodeandaddbitstrextension mxr 3.5 and later cert_encodeauthkeyid mxr 3.5 and later cert_encodebasicconstraintvalue mxr 3.5 and later cert_encodecertpoliciesextension mxr 3.12 and later cert_encodecrldistributionpoints mxr 3.5 and later cert_encodegeneralname mxr 3.
NSS FAQ
rity manager ships with netscape 6 and the gateway connected touch pad with instant aol, and is also available for use with communicator 4.7x. where can i get the source? for instructions on how to check out and build the nss source code, see build instructions for nss. how much does it cost? nss source code and binaries (when they become available) are completely free. no license fees, no roy
alty fees, no subscription fees. developer questions what hardware accelerators are supported? nss supports the pkcs #11 interface for hardware acceleration. since leading accelerator vendors such as chrysalis-it, ncipher, and rainbow technologies also support this interface, nss-enabled applications can support a wide variety of hardware accelerators. how do i integrate smart cards into my appli...
...vides consistent cross-platform semantics for network i/o and threading models. you can use nspr throughout your application or only in the portion that calls into nss. mozilla strongly recommends that multithreaded applications use the nspr or native os threading model. (in recent nspr releases, the nspr threading model is compatible with the native threading model if the os has native threads.)
alternatively, you can adapt the open-source nspr implementation to be compatible with your existing application's threading models. more information about nspr may be found at netscape portable runtime. can i use nss even if my application protocol isn't http? yes, tls is independent of application protocols. it works with common internet standard application protocols (http, pop3, ftp, smtp, etc.
NSS 3.37 release notes
added hacl* poly1305 32-bit the code to support the npn protocol, which had already been disabled in a previous release, has been fully removed. nss allows servers now to register alpn handling callbacks to select a protocol. nss supports opening sql databases in read-only mode. nss now requires the sqlite apis of version 3.5.0 or newer. starting with nss version 3.31, an
alternative implementation for rng seeding on the linux/unix platform was available (bug 1346735), which performed seeding exclusively based on /dev/urandom. this
alternative implementation is selected at build time by defining the seed_only_dev_urandom symbol. (the classic implementation for rng seeding on the linux/unix platform, which may use additional sources for the default seeding, is still...
...35), which performed seeding exclusively based on /dev/urandom. this
alternative implementation is selected at build time by defining the seed_only_dev_urandom symbol. (the classic implementation for rng seeding on the linux/unix platform, which may use additional sources for the default seeding, is still available and will be used if seed_only_dev_urandom is undefined.) with nss 3.37, this
alternative implementation for linux/unix can be selected in "make" builds by defining the environment variable nss_seed_only_dev_urandom. with nss 3.37, this
alternative implementation for linux has been enhanced to use the glibc function getentropy(), instead of reading from /dev/urandom directly, if the build and runtime linux platform supports it. the ca certificates list was updated to ver...
NSS Developer Tutorial
action1(); } else { action2(); } the former style is more common. when modifying existing code, try to stay consistent. in new code, prefer the former style, as it conserves vertical space. when a block of code consists of a single statement, nss doesn’t require curly braces, so both of these examples are fine: if (condition) { action(); } or: if (condition) action();
although the use of curly braces is more common. multiple-line comments should be formatted as follows: /* * line1 * line2 */ or /* ** line 1 ** line 2 */ the following styles are also common, because they conserve vertical space: /* line1 * line2 */ or /* line1 ** line2 */ or /* line1 * line2 */ naming public functions are named foo_dooneaction. global, but unexported functions,...
...ine 2 */ the following styles are also common, because they conserve vertical space: /* line1 * line2 */ or /* line1 ** line2 */ or /* line1 * line2 */ naming public functions are named foo_dooneaction. global, but unexported functions, are usually named foo_dooneaction. variable, and function parameter names, always start with a lowercase letter. the most common style is foobarbaz,
although foobarbaz and foo_bar_baz are also used. miscellaneous goto can be used, to simplify resource deallocation, before returning from a function. a data buffer is usually represented as: unsigned char *data; unsigned int len; the buffer pointer is unsigned char *, as opposed to void *, so we can perform pointer arithmetic without casting. use char * only if the data is interpreted a...
NSS Sample Code Sample1
s how to do key generation and transport between cooperating servers. this program shows the following: rsa key pair generation naming rsa key pairs looking up a previously generated key pair by name creating aes and mac keys (or encryption and mac keys in general) wrapping symmetric keys using your own rsa key pair so that they can be stored on disk or in a database. as an
alternative to token symmetric keys as a way to store large numbers of symmetric keys wrapping symmetric keys using an rsa key from another server unwrapping keys using your own rsa key pair the main part of the program shows a typical sequence of events for two servers that are trying to extablish a shared key pair. we will add message protection (encryption and mac...
...ent for keys share among multiple hosts // // this example shows how to use nss functions to create and // distribute keys that need to be shared among multiple servers // or hosts. // // the management scheme assumes that one host is primary. it // generates the secret keys that will be used by all participating // hosts. the other hosts (secondary) request keys from the // primary host. as an
alternative, new keys may be sent to the // current set of secondary hosts when they are generated by the // primary. in this case, the primary maintains a list of the // secondary hosts. // // the sequence of events is: // 1. the primary host generates a new symmetric key. this key // may be used for an encryption mechanism (des or aes) or for // integrity (md5_hmac or sha1_hmac). this key n...
nss tech note8
r sessions. that is, the client session lifetime was not separately settable from the server session lifetime. these two variables were private, declared in a private header file. there was no api function by which client programs could set these values. however since nss was delivered as archive libraries, client programs merely declared these two variables for themselves, and then were able to
alter those variables directly. for server programs, the function for initializing the server session cache would set these two variables according to two of the arguments to that function. so, ssl protocol code that wanted to cache a sid would do these steps, whether for client or for server: for ssl2: sid->lastaccesstime = sid->creationtime = ssl_time(); sid->expirationtime = sid->creati...
...server session cache may have its own lifetimes. so, in nss 3.4, the global variables ssl3_sid_timeout and ssl_sid_timeout were intended to become the definitions for the client cache only, and each server cache had its own new pair of variables for ssl2 and ssl3 session lifetimes, i.e., cache->ssl2timeout and cache->ssl3timeout. the server cache initialization function was intended to no longer
alter the variables ssl3_sid_timeout and ssl_sid_timeout, but rather to set the server cache's variables. since all the callers of the socket's cache function always initialized both their creationtime and expirationtime using the client's session lifetime variables, i changed the server's caching function to ignore the expirationtime computed by the caller, and compute its own expiration time, usin...
Python binding for NSS
nss is fips-140 certified. nss is built upon nspr because nspr provides an abstraction of common operating system services, particularly in the areas of networking and process management. ...
..._general_name_type_from_name() nss.nss.cert_general_name_type_name() nss.nss.cert_usage_flags() nss.nss.decode_der_crl() nss.nss.der_universal_secitem_fmt_lines() nss.nss.import_crl() nss.nss.make_line_pairs() nss.nss.oid_dotted_decimal() nss.nss.oid_str() nss.nss.oid_tag() nss.nss.oid_tag_name() nss.nss.read_der_from_file() nss.nss.x509_
alt_name() nss.nss.x509_ext_key_usage() nss.nss.x509_key_usage() the following class methods and properties were added: note: it's a method if the name is suffixed with (), a propety otherwise socket.next() socket.readlines() socket.sendall() sslsocket.next() sslsocket.readlines() sslsocket.sendall() authkeyid.key_id authkeyid.seri...
NSS functions
cert_createname mxr 3.2.1 and later cert_createocspcertid mxr 3.6 and later cert_createocsprequest mxr 3.6 and later cert_createrdn mxr 3.2.1 and later cert_createsubjectcertlist mxr 3.4 and later cert_createvalidity mxr 3.5 and later cert_crlcacherefreshissuer mxr 3.7 and later cert_decode
altnameextension mxr 3.10 and later cert_decodeauthinfoaccessextension mxr 3.10 and later cert_decodeauthkeyid mxr 3.10 and later cert_decodeavavalue mxr 3.4 and later cert_decodebasicconstraintvalue mxr 3.2 and later cert_decodecertfrompackage mxr 3.4 and later cert_decodecertificatepoliciesextension mxr ...
... cert_destroyocspresponse mxr 3.7 and later cert_destroyoidsequence mxr 3.9 and later cert_destroyusernotice mxr 3.10 and later cert_destroyvalidity mxr 3.5 and later cert_dupcertificate mxr 3.2 and later cert_dupcertlist mxr 3.2 and later cert_enableocspchecking mxr 3.2 and later cert_encode
altnameextension mxr 3.7 and later cert_encodeandaddbitstrextension mxr 3.5 and later cert_encodeauthkeyid mxr 3.5 and later cert_encodebasicconstraintvalue mxr 3.5 and later cert_encodecertpoliciesextension mxr 3.12 and later cert_encodecrldistributionpoints mxr 3.5 and later cert_encodegeneralname mxr 3.
sslintro.html
ant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. this chapter introduces some of the basic ssl functions. chapter 2, "getting started with ssl" illustrates their use in sample client and server applications. an ssl application typically includes five parts: initialization configuration communication functions used by callbacks cleanup
although the details differ somewhat for client and server applications, the concepts and many of the functions are the same for both. warning: some of the ssl header files provided as part of nss 2.0 include both public apis documented in the nss 2.0 documentation set and private apis intended for internal use by the nss implementation of ssl. you should use only the ssl apis (and related certif...
...igures this out when the application calls pr_connect or pr_accept. if the socket is already connected before ssl gets involved, you must provide this extra hint. 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_interv
altomilliseconds 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. the application's protocol (for example, http) determines which end has responsibility to talk first. the end that has to talk first should call pr_send or pr_wri...
ssltyp.html
l makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate, the function decrements the reference count and, if the reference count reaches zero as a result, frees the memory. the use of the word "destroy" in function names or in the description of a function often implies reference counting. never
alter the contents of a certificate structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. pk11slotinfo an opaque structure representing a physical or logical pkcs #11 slot. syntax #include <pk11expt.h> typedef struct pk11slotinfostr pk11slotinfo; secitem a structure that points to other structures. syntax #inclu...
...e <keyt.h> typedef struct seckeyprivatekeystr seckeyprivatekey; description key structures are not shared objects. when an application makes a copy of a particular key structure that already exists in memory, ssl makes a deep copy--that is, it makes a whole new copy of that object. when you call seckey_destroyprivatekey, the function both frees the memory and sets all the bits to zero. never
alter the contents of a key structure. treat the structure as read only. secstatus the return value for many ssl functions. 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.
Rhino scopes and contexts
brary objects and in many cases it is also possible to change or delete their properties as well. such behavior may not be suitable with shared scopes since if a script by mistake adds a property to a library object from the shared scope, that object would not be garbage collected until there are no active references to the shared scope potentially leading to memory leaks. in addition if a script
alters some of the standard objects, the library may not work properly for other scripts. such bugs are hard to debug and to remove a possibility for them to occur one can seal the shared scope and all its objects. a notion of a sealed object is a javascript extension supported by rhino and it means that properties can not be added/deleted to the object and the existing object properties can not be ...
...lf thus after callinginitstandardobjects, sealedsharedscope can be farther populated with application-specific objects and functions. then after a custom initialization is done, one can seal the shared scope by callingscriptableobject.sealobject(): sealedsharedscope.sealobject(); note that currently one needs to explicitly seal any additional properties he adds to the sealed shared scope since
although after calling sealedsharedscope.sealobject(); it would no be possible to set the additional properties to different values, one still would be able to
alter the objects themselves. note that currently in order to use java classes (liveconnect) from a sealed shared scope you need to pre-load a number of objects needed for liveconnect into the scope before it gets sealed. these objects would ...
Scripting Java
e package instead of importing using the importpackage() method. this is also acceptable, it just takes more typing. 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. the above examples could be expressed as follows: $ java org.mozilla.javascript.tools.shell.main js> importclass(packages.org.mozilla.javascript.context); js> context.currentcontext; org.mozilla.javascript.context@bb6ab6 working with java now that we can access java classes, the next l...
...ew packages.overload(); var a = [ 3, "hi", packages.overload ]; for (var i = 0; i != a.length; ++i) print(o.f(a[i])); and execute it, we get the output f(int) f(string) f(object) because rhino selects an overloaded method at runtime, it calls the more specific type that matches the argument. meanwhile java selects the overloaded method purely on the type of the argument at compile time.
although this has the benefit of selecting a method that may be a better match for each call, it does have an impact on performance since more work is done at each call. in practice this performance cost hasn't been noticeable in real applications. because overload resolution occurs at runtime, it can fail at runtime. for example, if we call overload's method g with two integers we get an error beca...
Index
jsapi reference, reference, référence(2), spidermonkey js_addfinalizecallback add a callback function which the garbage collector calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a pointer to the callback function to add. ...
... in which you specify the callback. cb is a pointer to the callback function to add. 188 js_aliaselement jsapi reference, obsolete, spidermonkey js_aliaselement assigns an
alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the
alternate index to assign to the element. 189 js_aliasproperty jsapi reference, obsolete, spidermonkey js_aliasproperty assigns an
alternate name for a property associated with a native object. obj is the object to which the property belongs. name is the property's current name in the object, and alias is the
alternate name to assign to the property. 190 js_alreadyhaso...
Bytecode Descriptions
-. surprisingly, it's not possible to get the right behavior using jsop::add and jsop::sub alone. for one thing, jsop::add sometimes does string concatenation, while ++ always does numeric addition. more fundamentally, the result of evaluating x-- is tonumeric(old value of x), a value that the sequence getlocal "x"; one; sub; setlocal "x" does not give us. format: jof_ic other expressions glob
althis stack: ⇒ this push the global this value. not to be confused with the glob
althis property on the global. this must be used only in scopes where this refers to the global this. newtarget stack: ⇒ new.target push the value of new.target. the result is a constructor or undefined. this must be used only in scripts where new.target is allowed: non-arrow function scripts and other scripts th...
...on ("x[symbol.iterator] is not a function"). the argc operand must be 0 for this variation. jsop::funapply hints to the vm that this is likely a call to the builtin method function.prototype.apply, an easy optimization target. jsop::funcall similarly hints to the vm that the callee is likely function.prototype.call. jsop::callignoresrv hints to the vm that the return value is ignored. this allows
alternate faster implementations to be used that avoid unnecesary allocations. implements: evaluatecall steps 4, 5, and 7. format: jof_argc, jof_invoke, jof_typeset, jof_ic spreadcall stack: callee, this, args ⇒ rval like jsop::call, but the arguments are provided in an array rather than a span of stack slots. used to implement spread-call syntax: f(...args). args must be an array object contain...
SpiderMonkey Internals
iler, a garbage collector, code implementing the basic behavior of javascript values, a standard library implementing ecma 262-5.1 §15 with various extensions, and a few public apis. interpreter like many portable interpreters, spidermonkey's interpreter is mainly a single, tremendously long function that steps through the bytecode one instruction at a time, using a switch statement (or faster
alternative, depending on the compiler) to jump to the appropriate chunk of code for the current instruction. a js-to-js function call pushes a javascript stack frame without growing the c stack. but since js-to-c-to-js call stacks are common, the interpreter is reentrant. some spidermonkey bytecode operations have many special cases, depending on the type of their arguments. common cases are inline...
...equest is made. js api users should call js_gc or js_maybegc between script executions or from the operation callback, as often as necessary. because the gc is exact, c/c++ applications must ensure that all live objects, strings, and numbers are gc-reachable. javascript values the type js::value represents a javascript value. the representation is 64 bits and uses nan-boxing on all platforms,
although the exact nan-boxing format depends on the platform. nan-boxing is a technique based on the fact that in ieee-754 there are 2**53-2 different bit patterns that all represent nan. hence, we can encode any floating-point value as a c++ double (noting that javascript nan must be represented as one canonical nan format). other values are encoded as a value and a type tag: on x86, arm, and sim...
JIT Optimization Strategies
ess optimizes a polymorphic property access where there are only a few different types of objects seen, and the property on all of the different types is determinable through a shape-check. if a property access is monomorphic and the property's location is determinable from the object's shape, but the property is not definite (see: getprop_definiteproperty), then this optimization may be used.
alternatively, if the property access is polymorphic, but only has a few different shapes observed at the access site, this optimization may be used. this optimization compiles down to one or more shape-guarded direct loads from the object. the following pseudocode describes the kind of machine code generated by this optimization: if obj.shape == shape1 then obj.slots[0] elif obj.shape == shape2 ...
...ccess optimizes a polymorphic property write where there are only a few different types of objects seen, and the property on all of the different types is determinable through a shape-check. if a property write is monomorphic and the property's location is determinable from the object's shape, but the property is not definite (see: getprop_definiteproperty), then this optimization may be used.
alternatively, if the property write is polymorphic, but only has a few different shapes observed at the access site, this optimization may be used. this optimization compiles down to one or more shape-guarded direct stores to the object. the following pseudocode describes the kind of machine code generated by this optimization: if obj.shape == shape1 then obj.slots[0] = val elif obj.shape == sha...
JSAPI User Guide
bal functions and variables of its own. all of these functions, classes, and variables are stored as properties of the global object. a minimal example each of the three key elements described in the previous section requires a few jsapi calls: the runtime: use js_newruntime to create it and js_destroyruntime to clean it up when you're done. when your application is done with spidermonkey
altogether, use js_shutdown to free any remaining cached resources. (this is a mere nicety if the process is about to exit anyway. but as that is not always the case, calling js_shutdown is a good habit to get into.) the context: use js_newcontext and js_destroycontext. for maximum ecmascript standard compliance, applications should also use js_setoptions to enable jsoption_varobjfix. to get th...
...and finally blocks are ignored. the most recent jsapi call returns false or nullptr to the application. an uncatchable error leaves the jscontext in a good state. it can be used again right away. the application does not have to do anything to “recover” from the error, as far as the jsapi is concerned. (of course, if the error is that the system is out of memory, that problem remains to be de
alt with.) here is some example code that throws an uncatchable error. /* call the error reporter, if any. this part is optional. */ js_reporterror(cx, "the server room is on fire!"); js_reportpendingexception(cx); /* make sure the error is uncatchable. */ js_clearpendingexception(cx); return false; more sample code the following examples illustrate how to achieve a few ...
JSVAL_TO_GCTHING
obsolete since jsapi 32this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. cast a jsval to a raw pointer of type void *. syntax jsval_to_gcthing(v) description jsval_to_gcthing casts a jsval, v, to a raw pointer. the type of the result is void *. v must be either jsval_null or a reference to a gc thing. otherwise the resulting pointer is undefined. jsval_is_gcthing may be used to check this. this macro is exposed in jsapi.h because other jsapi macros make use of it. applications should not call it directly in most cases. when possible, it is better to use a more specific macro, such as jsval_to_object or jsval_to_string. ...
... v must be either jsval_null or a reference to a gc thing. otherwise the resulting pointer is undefined. jsval_is_gcthing may be used to check this. this macro is exposed in jsapi.h because other jsapi macros make use of it. applications should not call it directly in most cases. when possible, it is better to use a more specific macro, such as jsval_to_object or jsval_to_string. another possible
alternative is to avoid casting
altogether by using an api that operates on jsvals rather than raw pointers (for example, js_call_value_tracer rather than js_call_tracer). see also bug 952650 ...
JSVAL_TO_INT
the jsval encoding of the integer 4, for instance, is not ((jsval) 4) but some other pattern of bits. ...
... still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. converts an integer jsval to a c integer without any type checking or error handling. syntax jsval_to_int(v) description jsval_to_int converts a specified integer jsval, v, to the corresponding c integer value. if v is any other type of value, the result is unspecified. note that
although jsval is an integer type, it must be treated as opaque. the jsval encoding of the integer 4, for instance, is not ((jsval) 4) but some other pattern of bits. to convert an integer to jsval, use int_fits_in_jsval and int_to_jsval. see also bug 952650 ...
JS_Add*Root
try to avoid using it. register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
...value or pointer to gc-thing, that value/gc-thing is protected from garbage collection. if the variable points to an object, then any memory reachable from its properties is automatically protected from garbage collection, too. js_addgcthingroot allows the caller to have a single root that may hold either strings or objects. a jsval is not a gc-thing (it has tag bits and may be a different size
altogether) and thus the address of a jsval variable must not be passed to js_addgcthingroot. do not pass a pointer to a js string or object to any of these functions—rp must point to a variable, the location of the pointer itself, and not an object or string. an entry for rp is added to the garbage collector's root set for the jsruntime associated with cx (or, in js_addnamedrootrt, the runtime r...
JS_AliasElement
try to avoid using it. create an aliased index entry for an existing numeric property of a native object. syntax jsbool js_aliaselement(jscontext *cx, jsobject *obj, const char *name, jsint alias); name type description cx jscontext * the context in which to create the alias. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * the object for which to create the alias. name const char * name of the element for which to create an alias. ...
...aller must be in a request on this jscontext. obj jsobject * the object for which to create the alias. name const char * name of the element for which to create an alias. this name corresponds to a string representation of the element's current index number. alias jsint alias number to assign to the element. description js_aliaselement assigns an
alternate index number for an element or numeric property associated with a native object. obj is the object to which the element belongs. name is the element's current index in the object, and alias is the
alternate index to assign to the element. this feature is deprecated, meaning that it is currently supported only for backward compatibility with existing applications. future versions of the engi...
JS_AliasProperty
try to avoid using it. create an alias for a native property. syntax jsbool js_aliasproperty(jscontext *cx, jsobject *obj, const char *name, const char *alias); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create the alias. name const char * name of the property for which to create an alias. ...
...ich to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create the alias. name const char * name of the property for which to create an alias. alias const char * alias name to assign to the property. description js_aliasproperty assigns an
alternate name for a property associated with a native object. obj is the object to which the property belongs. name is the property's current name in the object, and alias is the
alternate name to assign to the property. notes this feature has been removed. an alias does not replace a property's name; it supplements it, providing a second way to reference a property. if the alias is successfully cre...
JS_ConstructObject
a less-preferred short-term solution might be to use this reimplementation of the method, but note that this reimplementation is not guaranteed to continue working across spidermonkey releases. ...
... a less-preferred short-term solution might be to use this reimplementation of the method, but note that this reimplementation is not guaranteed to continue working across spidermonkey releases. ...
Secure Development Guidelines
ter being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory saved return addr or function pointer get
altered introduction: gaining control (3) common issues used to gain control buffer overflows format string bugs integer overflows/underflows writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation could save you without knowing it examples: if it doesn’t have to be negative, ...
... bbv: stack overflow example: void foo(char *bar) { char c[12]; strcpy(c, bar); } int main(int argc, char **argv) { foo(argv[1]); } bbv: stack overflow before the stack overflow bbv: stack overflow after the ...
Handling Mozilla Security Bugs
s how the new security organizational structure will work, and how security-related mozilla bug reports will be handled. note that the focus of this new structure is restricted solely to addressing actual security vulnerabilities arising from problems in mozilla code. this work is separate from the work of developers adding new security features (cryptographically-based or otherwise) to mozilla,
although obviously many of the same people will be involved in both sets of activities. background security vulnerabilities are different from other bugs, because their consequences are potentially so severe: users' private information (including financial information) could be exposed, users' data could be destroyed, and users' systems could be used as platforms for attacks on other systems. thus ...
...ticular person happens to be frequently added to the cc list for security-sensitive bugs, then they would be a good candidate to be invited to join the security bug group. (as described previously, once added to the security bug group, that person would then have automatic access to all bugs marked security-sensitive, without having to be explicitly added to the cc list for each one.) note that,
although we intend to make it relatively simple for a new person to join the security bug group, and we are not limiting the size of the group to any arbitrary number, we do not want the group to expand without any limits whatsoever. we reserve the right to cap the membership at some reasonable level, either by refusing new applications or, if necessary and appropriate, by removing existing members o...
An Overview of XPCOM
it also provides much of the functionality that a development platform provides, such as: component management file abstraction object message passing memory management we will discuss the above items in detail in the coming chapters, but for now, it can be useful to think of xpcom as a platform for component development, in which features such as those listed above are provided. gecko
although it is in some ways structurally similar to microsoft com, xpcom is designed to be used principally at the application level. the most important use of xpcom is within gecko, an open source, standards compliant, embeddable web browser and toolkit for creating web browsers and other applications. xpcom is the means of accessing gecko library functionality and embedding or extending gecko. thi...
...ndings), and there are efforts underway to build xpcom bindings for ruby and perl as well. writing components in other languages though you do not have access to some of the tools that xpcom provides for c++ developers (such as macros, templates, smart pointers, and others) when you create components in other languages, you may be so comfortable with the language itself that you can eschew c++
altogether and build, for example, python-based xpcom components that can be used from javascript or vice versa. see resources for more information about python and other languages for which support has been added in xpcom. all of the public interfaces in xpcom are defined using the xpidl syntax. type libraries and c++ header files are generated from these idl files, and the tool that generates th...
Preface
ian, though... creating xpcom components is meant for c++ developers. though you can create xpcom components in javascript and other languages, and though you might be able to follow along as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component starts from c++. you don't need to be a c++ expert, however.
although basic ideas such as inheritance and encapsulation should be familar to you, wherever possible they are explained in the book as they are used. also many of the examples are in javascript, which is used in mozilla to access xpcom components as scriptable objects, and so familiarity with that language is useful as well. xpcom stands for the cross platform component object model. as this name ...
...s for the cross platform component object model. as this name implies, xpcom is similar to microsoft com. if you have any experience with this technology, much of it can be applied to xpcom. however, this book does not assume any prior knowledge of com - all of the basic com ideas will be introduced. this book provides a tutorial about building an xpcom component that controls browsing behavior.
although, xpcom can be used in many environments which are unrelated to web browsing, xpcom's main client is gecko, an open source, standards compliant, embeddable web browser, where it's easiest and most practical to illustrate xpcom's functionality. a full description of the component in this tutorial can be found in the what we'll be working on section of the tutorial. despite what old documenta...
Components.utils.importGlobalProperties
g1, string2, ...]); parameters [string1, string2, ...] an array of strings. each string is the name of an object to import. example components.utils.import("resource://gre/modules/devtools/console.jsm"); components.utils.importglobalproperties(["atob", "btoa"]); var encoded = btoa("hello"); console.log(encoded); // "sgvsbg8=" console.log(atob(encoded)); // "hello"
alternative methods if importglobalproperties does not support the targeted firefox version, here are some
alternative methods to import these objects. import from jsm this method worked until blob and file were no longer apart of jsm modules. it is suspected this works up till firefox 35. this imports blob, file, along with the regular services. the reason this works is because js code modules a...
..., the hiddendomwindow objects cannot be accessed until it is fully loaded. therefore readystate must be checked, if it is not complete, then a load listener must be attached. once readystate is complete then the objects can be used. for example this is how to ues the file object. ...
Observer Notifications
indicate notifications you can monitor related to dom documents. topic subject data description chrome-document-global-created nsidomwindow null sent immediately after a chrome document window has been set up, but before any script code has been executed. this lets extensions inject api into chrome windows as needed (see nsidomglobalpropertyinitializer for an
alternative method of doing this, which uses significantly less memory). data is intentionally left blank. content-document-global-created nsidomwindow origin sent immediately after a web content document window has been set up, but before any script code has been executed. this lets extensions inject api into content windows as needed (see nsidomglobalpropertyinitializer for an...
...rnative method of doing this, which uses significantly less memory). data is intentionally left blank. content-document-global-created nsidomwindow origin sent immediately after a web content document window has been set up, but before any script code has been executed. this lets extensions inject api into content windows as needed (see nsidomglobalpropertyinitializer for an
alternative method of doing this). data is a string form of the origin (for use in security checks), eg "http://developer.mozilla.org". document-element-inserted document null sent immediately after the root element of a document has been created, but before executing any script on it. user-interaction-active nsidomwindow null sent once every 5000ms while ...
mozIRegistry
r-level services (tbd) to figure out the clsids they should use. the intent is that such services themselves be built on top of the new moziregistry interface. we are proposing a new "moziregistry" xpcom interface that provides the same level of function as is currently provided by the "netscape registry" implemented in libreg. nsrepository will be modified to use this interface, thereby enabling
alternative registry implementations to be substituted at run/link time. there will be two registry interface implementations: one based solely on libreg (for "compatibility") and a fancier rdf-based one. open issues we have identified two open issues, neither of which appear to be so hard that it we won't be able to solve them in a timely fashion: if and when we remove what is currently a stati...
...implementations to be accessible. our current build/install process doesn't quite step up to these problems as of yet. there are some bootstrapping issues related to using the service manager to access the moziregistry interface. currently, nsiservicemanager requires a clsid to access a service which hardcodes the implementation of that service. this issue needs to be resolved in order to enable
alternative moziregistry implementations or to permit other service implementations to be bound at runtime. i think a simple clsid "alias" mechanism (equivalent to com's "component categories" in some respects), along with the ability to "set" services (versus the service manager insisting on creating the services itself) would suffice. worst case, clients would obtain the moziregistry singleton via ...
mozIStorageService
ry as the original file. return value an nsifile object representing the newly-created backup file. opendatabase() opens a database connection to the specified file. the specified file is created if it does not already exist. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (
although we have no way of recovering this data yet). consumers should check mozistorageconnection.connectionready to ensure that they can use the database. if this value is false, it is strongly recommended that the database be backed up with mozistorageconnection.backupdb() so user data is not lost. and then the database can be opened again with the mozistorageservice.opendatabase() method. wa...
...oviding access to the requested database. exceptions thrown ns_error_invalid_arg if astoragekey is invalid. openunshareddatabase() opens a database connection to the specified file without using a shared cache. if this method throws ns_error_file_corrupted, it's recommended that you call mozistorageservice.backupdatabasefile() to back up the database so that user data is not lost (
although we have no way of recovering this data yet). each connection uses its own sqlite cache, which is inefficient, so you should use opendatabase() instead of this method unless you need a feature of sqlite that is incompatible with a shared cache, like virtual table and full text indexing support. if cache contention is expected, for instance when operating on a database from multiple threads, u...
nsIClipboardDragDropHooks
indicates to the operating system that drop is not allowed. on win32, this will change the cursor to "reject". allowstartdrag() prevents the drag from starting. boolean allowstartdrag( in nsidomevent event ); parameters event the dom event (drag gesture). return value true if the drag can proceed. otherwise, false to show the drag is canceled (does not go to operating system). oncopyordrag()
alters the flavors or data presented to the os. used for drag and copy actions. because this can be called many times, it is highly recommended that the implementation be very efficient so user feedback is not negatively impacted. boolean oncopyordrag( in nsidomevent aevent, in nsitransferable trans ); parameters aevent the dom event (drag drop). null if triggered by copy. trans the transferabl...
...pyordrag( in nsidomevent aevent, in nsitransferable trans ); parameters aevent the dom event (drag drop). null if triggered by copy. trans the transferable holding the list of flavors and the data for each flavor. return value true to indicate that copy/drag can proceed. otherwise, false to indicate that the copy/drag is canceled, does not go to operating system. onpasteordrop() provide an
alternative action to the built-in behavior when something is dropped on the browser or in an editor. boolean onpasteordrop( in nsidomevent event, in nsitransferable trans ); parameters event the dom event (drag drop); null if triggered by paste. trans the transferable holding the list of flavors and the data for each flavor. return value true to indicate the action was handled, do not perform...
nsIConsoleService
essage message); void logstringmessage(in wstring message); void registerlistener(in nsiconsolelistener listener); void reset(); void unregisterlistener(in nsiconsolelistener listener); methods getmessagearray() to obtain an array of all logged messages. obsolete since gecko 19 (firefox 19 / thunderbird 19 / seamonkey 2.16)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getmessagearray( [array, size_is(count)] out nsiconsolemessage messages, out pruint32 count ); parameters messages an array of logged messages. count the number of messages in the array. if no messages are logged, this function will return a count of 0, b...
... logging a message with additional information to include other information an nsiconsolemessage object must be used. in this example nsiscripterror, which implements nsiconsolemessage, is used to include information about the source file and line number of the error. function mylogtoconsole(amessage, asourcename, asourcel...
nsIDOMMozTouchEvent
g, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in unsigned long streamidarg); attributes attribute type description streamid unsigned long a unique identifier for each finger, so that each finger's ...
...e corresponding moztouchdown and moztouchup events. methods initmoztouchevent() initializes the touch event. void initsimplegestureevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in unsigned long streamidarg ); parameters streamidarg the value to assign to the streamid attribute; this uniquely identifies the finger generating the touch events. see also mouse gesture events touch events event ...
nsIDownloadManager
ed in the past and is stored in the database. nsidownload getdownload( in unsigned long aid ); parameters aid the unique id of the download. return value the download with the specified id. exceptions thrown ns_error_not_available the download is not in the database. onclose() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. called when the download manager front end is closed. useful for third party managers to let us know when they've closed. void onclose(); parameters none. open() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) ope...
...nt end. void open( in nsidomwindow aparent, in nsidownload adownload ); parameters aparent the parent, or opener, of the front end. adownload a download to pass to the manager window. useful if, for example, you want the window to select a certain download. openprogressdialogfor() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. opens an individual progress dialog displaying progress for the download. void openprogressdialogfor( in nsidownload adownload, in nsidomwindow aparent, in boolean acanceldownloadonclose ); parameters adownload the download object to display progress for, as ...
nsIFaviconService
ill return a uri that will result in the image. in most cases, this is an annotation uri. for chrome, this will do nothing and return the input uri. no validity checking is done. if you pass an icon uri that we've never seen, you'll get back a uri that references an invalid icon. the moz-anno protocol handler's special case for "favicon" annotations will resolve invalid icons to the default icon,
although without caching. for invalid chrome uris, you'll get a broken image. nsiuri getfaviconlinkforicon( in nsiuri afaviconuri ); parameters afaviconuri the uri of an icon in the favicon service. return value returns a uri that will load the desired icon. this is not the uri of the icon as set on the page, but a uri that will give you the data out of the favicon service. for a normal ...
... for a web page. for chrome, the output will be the same as the input. for chrome, the output will be the same as the input. no validity checking is done. if you pass an icon uri that we've never seen, you'll get back a uri that references an invalid icon. the moz-anno protocol handler's special case for "favicon" annotations will detect most invalid icons and it will resolve to the default icon,
although without caching. for invalid chrome uris, you'll get a broken image. isfailedfavicon() this method checks to see if this favicon is in the failed favicon cache. boolean isfailedfavicon( in nsiuri afaviconuri ); parameters afaviconuri the uri of an icon in the favicon service. can be null. return value returns true if the favicon is in the failed cache, meaning you probably shoul...
nsIFile
ory at the position represented by the nsifile and create, move or copy items in the filesystem. an nsifile can be retrieved by either instantiating an nsilocalfile using a platform specific path string or by using cross-platform locations retrieved from the directory service. all methods with string parameters have two forms. the preferred form operates on utf-16 encoded characters strings. an
alternate form operates on characters strings encoded in the "native" charset. a string containing characters encoded in the native charset cannot be safely passed to javascript via xpconnect. therefore, the utf-16 forms are scriptable, but the "native methods" are not. in addition, the native form cannot deal with files whose name contains characters outside the default system code page on windows. ...
...hat an attempt was made to remove a directory that is not empty. ns_error_file_access_denied indicates that an attempt was made to remove a file in a way that exceeded your permissions. details depend on your file system and how its permissions work. remarks all string-valued methods and attributes have two forms. the preferred form operates on utf-16 (unicode) encoded character strings. the
alternate form operates on character strings encoded in the "native" multibyte character set. the native character encoding is defined as the single-byte character encoding used with the standard fopen function on the host system. the native character encoding is determined using platform specific methods. as of gecko 1.7, it is utf-8 on mac os x. on linux and other unix platforms, it is the value r...
nsILocalFileMac
f 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. fsspec getfsspec(); parameters none. return value the fsspec of the file object. native code only!inittoappwithcreatorcode obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. init this object to point to an application having the given creator code. if this app is missing, this will fail. it will first look for running application with the given creator. void inittoappwithcreatorcode( in ostype aappcreator ); parameters aappcreator the sign...
...ithcfurl( in cfurlref acfurl ); parameters acfurl the corefoundation url. native code only!initwithfsref init this object with an fsref. note: supported only for xp_macosx. void initwithfsref( [const] in fsrefptr afsref ); parameters afsref the native fsref. native code only!initwithfsspec obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. init this object with an fsspec legacy method - leaving in place for now. void initwithfsspec( [const] in fsspecptr afilespec ); parameters afilespec the native file spec. ispackage() boolean ispackage(); parameters none. return value true if a directory is determine...
nsIProtocolProxyService
pass pr_uint32_max to specify the default timeout value, causing nsiproxyinfo::failovertimeout to be assigned the default value. afailoverproxy specifies the next proxy to try if this proxy fails. this parameter may be null. return value an nsiproxyinfo object. getfailoverforproxy() if the proxy identified by aproxyinfo is unavailable for some reason, this method may be called to access an
alternate proxy that may be used instead. as a side-effect, this method may affect future result values from resolve/asyncresolve as well as from getfailoverforproxy. nsiproxyinfo getfailoverforproxy( in nsiproxyinfo aproxyinfo, in nsiuri auri, in nsresult areason ); parameters aproxyinfo the proxy that was unavailable. auri the uri that was originally passed to resolve/asyncresolve. ...
... the proxy that was unavailable. auri the uri that was originally passed to resolve/asyncresolve. areason the error code corresponding to the proxy failure. this value may be used to tune the delay before this proxy is used again. the proxy that was unavailable. return value an nsiproxyinfo object or null for a direct connection. exceptions thrown ns_error_not_available if there is no
alternate proxy available. registerfilter() this method may be used to register a proxy filter instance. each proxy filter is registered with an associated position that determines the order in which the filters are applied (starting from position 0). when resolve/asyncresolve is called, it generates a list of proxies for the given uri, and then it applies the proxy filters. the filters have the o...
nsIRequest
the request when opened. this means that things like authorization tokens or cookie headers should not be added. note: this will prevent proxy authentications from working, so use this flag with caution. methods cancel() cancels the current request. this will close any open input or output streams and terminate any async requests. users should normally pass ns_binding_aborted,
although other errors may also be passed. the error passed in will become the value of the status attribute. implementations must not send any notifications (for example via nsirequestobserver) synchronously from this function. similarly, removal from the load group (if any) must also happen asynchronously. requests that use nsistreamlistener must not call ondataavailable anymore after cancel has b...
.... return value true if the request has yet to reach completion. resume() resumes the current request. this may have the effect of re-opening any underlying transport and will resume the delivery of data to any open streams. void resume(); parameters none. suspend() suspends the current request. this may have the effect of closing any underlying transport (in order to free up resources),
although any open streams remain logically opened and will continue delivering data when the transport is resumed. calling cancel() on a suspended request must not send any notifications (such as onstoprequest) until the request is resumed. note: some implementations are unable to immediately suspend, and may continue to deliver events already posted to an event queue. in general, callers should be...
nsISelection
collapsetoend(); void collapsetostart(); boolean containsnode(in nsidomnode node, in boolean partlycontained); void deletefromdocument(); void extend(in nsidomnode parentnode, in long offset); void extendnative(in nsidomnode parentnode, in long offset); native code only! ...
...e only!extendnative void extendnative( in nsinode parentnode, in long offset ); parameters parentnode offset getrangeat() returns the nsidomrange at the specified index. nsidomrange getrangeat( in long index ); parameters index return value the nsidomrange requested modify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring
alter, in domstring direction, in domstring granularity ); parameters
alter can be one of { "move", "extend()" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed() selection. "extend()" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. ...
nsISelection3
content/base/public/nsiselection3.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 2.0 obsolete gecko 8.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko 8.0 this interface was merged into the nsiselection interface. ...
...om: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) in gecko 8.0 this interface was merged into the nsiselection interface. method overview void modify(in domstring
alter, in domstring direction, in domstring granularity); methods modify() modifies the selection. note that the parameters are case-insensitive. void modify( in domstring
alter, in domstring direction, in domstring granularity ); parameters
alter can be one of { "move", "extend" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed selection. "extend" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction ...
nsITreeView
a string of space-separated property names. example your function will not be provided with a properties array. (this is one way of detecting the version at run-time). simply return a string of space-separated property names. for example: getrowproperties: function(index) { return "dummy"; } obsolete since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature is obsolete. ...
...ex) { return "dummy"; } obsolete since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
nsIWebBrowserChrome3
embedding/browser/webbrowser/nsiwebbrowserchrome3.idlscriptable an extension to nsiwebbrowserchrome2. 1.0 66 introduced gecko 2.0 inherits from: nsiwebbrowserchrome2 last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview astring onbeforelinktraversal(in astring origin
altarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab); methods onbeforelinktraversal() determines the appropriate target for a link. astring onbeforelinktraversal( in astring origin
altarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters origin
altarget the original link target. linkuri link destination uri. linknode link dom node. isapptab whether or not the li...
...ring onbeforelinktraversal( in astring origin
altarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters origin
altarget the original link target. linkuri link destination uri. linknode link dom node. isapptab whether or not the link is in an application tab. return value a new link target, if appropriate. otherwise returns origin
altarget. see also nsiwebbrowserchrome2 ...
nsIXPCScriptable
here are no properties left to enumerate. jsenumerate_destroy this function should destroy the opaque iterator state previously allocated in statep by this function when enum_op was jsenumerate_init. statep an in/out pointer to a jsval whose meaning depends on the value of enum_op. idp an in/out pointer to a jsid whose meaning depends on the value of enum_op. return value this should (
although does not need to) return pr_true to indicate success or must return pr_false to indicate failure. newresolve() this method is called when the want_newresolve flag is set. when this method is called, xpconnect is attempting to resolve a lazy property named by id on obj. the js engine will check if the property named by id is defined after this method has been called. this is very similar to...
...e or index of the property being accessed as a jsval. flags the flags that describe the access to the property named by id. see js_lookupproperty for the flags and their meaning. objp an out parameter that, on success, points to the jsobject that the property named by id has been defined on. if the property named by id was not defined, this should be set to null. return value this should (
although does not need to) return pr_true to indicate success or must return pr_false to indicate failure. convert() prbool convert( in nsixpconnectwrappednative wrapper, in jscontextptr cx, in jsobjectptr obj, in pruint32 type, in jsvalptr vp ); parameters wrapper cx obj type vp return value finalize() void finalize( in nsixpconnectwrappednative wrapper, in j...
Reference Manual
c/c++ casts by-pass |nscomptr|s machinery and cause leaks... nsresult rv; nscomptr<nsifoo> foo = ...; // ... rv = getfoo( (nsifoo**)&foo ); rv = getfoo( &(nsifoo*)foo ); // sure, they compile; but now you leak. to help prevent this, we are trying to make the first form, above, illegal by making operator& private. see bug 59414. implementation details and debugging machinery
although it is a class, nscomptr has no virtual methods, and therefore, no vtable or vptr. because a few key routines are factored out into a common non-template base class, the actual underlying pointer is stored as an nsisupports* (except in debug builds where nscap_feature_debug_ptr_types is turned on). it is because of these factored routines that nscomptr users must link with the xpcom library. ...
...mporary so we // don't stomp on |p| nsidomnode* temp = p; temp->getnext(&p); ns_release(temp); } // safe iterating with |nscomptr|... nscomptr<nsidomnode> p = ...; while ( p ) { // ... // introduce a temporary so we // don't stomp on |p| nscomptr<nsidomnode> temp = p; temp->getnext(getter_addrefs(p)); }
although the nscomptr parallel is easy to understand, it suffers from doing one extra addref and one extra release compared to the raw pointer scheme. a slight transformation makes the code uglier, but (possibly negligibly) more efficient. // safe, efficient, iterating with |nscomptr|... nscomptr<nsidomnode> p = ...; while ( p ) { // ... nsidomnode* next; p->ge...
Using nsIDirectoryService
ion, of course, doesn't need to know who the providers are. as a caller of the service, you never deal with the providers, only the service. defined locations the nsiproperties keywords that you will use to get locations are defined in two places. os and xpcom level nsdirectoryservicedefs.h these locations are provided by xpcom, are constant with the system, and and should not need customization.
although you will not customize these locations, you may need to tell xpcom where its /bin directory is. this is done by passing a directory to ns_initxpcom or, for embedding, as the first parameter to ns_initembedding. the location of the components folder and the components registry, among other things, are relative to the /bin directory. if mozilla's components directory is not in the same directo...
...serviceprovider and it provides these locations. there are some cases in embedding in which distinct user profiles are not needed; however, prefs and history and such are needed. in this case, the nsidirectoryserviceprovider implementation at mozilla/profile/dirserviceprovider/ can be used. if it is used, it is used instead of the profile service, thus saving some footprint. customizing locations
although you can change locations one at a time by using the nsiproperties interface of nsdirectoryservice, you can also install your own nsidirectoryserviceprovider to control them en masse. to do this for application-level locations, create a provider based on appfilelocprovider. this object has to implement the nsisupports and nsidirectoryserviceprovider interfaces. it does not need to be a compon...
Mozilla technologies
mozilla has several technologies used as components of its projects. these are documented here. accessibility api implementation detailsthese pages contain documentation on mozilla specific implementation details of assistive technology apis.animated png graphicsapng is an extension of the portable network graphics (png) format, adding support for animated images. apng is a simpler
alternative to mng, providing a spec suitable for the most common usage of animated images on the internet.docshelldocshell is the second iteration of what originally started out as webshell. at the moment, the transition from webshell to docshell is not fully completed, but the long-term goal is to remove webshell and switch over entirely to docshell.embedded dialog apifeed content access apifirefox ...
...omponent object model, similar to microsoft com. it has multiple language bindings, allowing xpcom components to be used and implemented in javascript, java, and python in addition to c++.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.0
although 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++). for example, the mozilla xforms project uses xtf to add support for the xforms namespace. ...
Index
bird this page provides some examples for using gloda. see creating a gloda message query for more examples. 31 gloda indexing this page provides a big-picture summary of what the indexer does; please see the source for nitty-gritty details or if this page seems to be wrong. glodaindexer provides the core indexing logic. glodamsgindexer has the message-specific stuff,
although the actual attribute-providers are found in glodaexplicitattr and glodafundattr. glodaabindexer has the limited address book support. 32 index index found 72 pages: 33 ldap support administration, enterprise, thunderbird this document is intended to "fill in the gaps" about how enterprise customers can leverage and customize ldap support in mozilla t...
...iew of the related interfaces. 92 /common_thunderbird_extension_techniques">common thunderbird extension techniques thunderbird no summary! 93 access stringbundle from overlay thunderbird no summary! 94 access thunderbird window areas thunderbird to access particular parts of the thunderbird window you can use these helper methods. an
alternative to these methods is to directly access the element by it's id as in the detect when a folder opens example. 95 access window missing, thunderbird the window object represents the window of the thunderbird application as well as the currently opened tabs. you can do many things with the window object, such as accessing the height or width of the window/tab or setting i...
The libmime module
uperclass) is to simply extract them from the superclass's object. but note that you cannot get at methods by indirecting through object->class->superclass: that will only work to one level, and will go into a loop if some subclass tries to continue on this method. 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. the
alternative to that involves typing the literal name of the direct superclass of the class defined in this file, which will be a maintenance headache if the class hierarchy changes. if you use the mime_superclass idiom, then a textual change is required in only one place if this class's superclass changes. static void foobar_finalize (mimeobject *object) { ((mimeobjectclass*)&m...
...wrong!! ...
Working with windows in chrome code
ing opened or pass a callback function, as described below. you can get a window object from a document using document.defaultview. content windows when a xul window contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself. there also is a window object for each sub-document,
although there's no window in a common sense for the sub-document. the same holds for chrome windows opened inside a tab of <tabbrowser>. the elements above the chrome document opened in the tab are separate from your chrome document. the following two subsections describe how to cross chrome-content boundaries in either way, i.e. accessing elements which are ancestors of your chrome document, or a...
...ress dialog. using window.opener. the opener property returns its window's opener; that is, the window object that opened it. if we're sure the window that opened the progress dialog declares the canceloperation function, we can use window.opener.canceloperation() to notify it, like this: <button label="cancel" oncommand="opener.canceloperation(); close();" /> using a callback function.
alternatively, the opener window can pass a callback function to the progress dialog in the same way we passed the status string in the previous example: function oncancel() { alert("operation canceled!"); } ... window.opendialog( "chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10}, oncancel ); the p...
Standard OS Libraries
the dll/so/etc file you make must be shipped with your add-on. standard libraries offer the advantage of not having to ship anything. they are already available on the operating system for you. you just need to supply the path to appropriate files and set up the proper types of values/arguments in the js-ctypes code. ...
...objc - objective-c js-ctypes snippets that can be copied and pasted to scratchpad android android runs on java and can be used by js-ctypes through the jni libraries. thankfully all the js-ctypes was abstracted away into jni.jsm. undrestanding js-ctypes is important as arrays and other features used in jni.jsm will require us to create arrays from the types available to the ctypes.jsm module.
although jni is done completely through js-ctypes, a jsm was created to abstract away the js-ctypes so developers can focus on the jni aspect. therefore elaboration on this technique is not done in the js-ctypes section but it is done in the jni.jsm article. this article links to a fully funcitonal demo that can be copied and pasted into scratchpad, as a quick reference here is the link to that demo:...
CData
ins invalid encoded character, no exception is thrown. string readstringreplacemalformed(); parameters none. return value a new string object that is a copy of the original string contents. invalid encoded characters will be replaced by �(u+fffd). ...
... return char16_val; } if (!jschar) { try { var char8_val = stringptr.readstring(); console.info('stringptr.readstring():', char8_val); return char8_val; } catch (ex if ex.message.indexof('malformed utf-8 character sequence at offset ') == 0) { console.warn('ex of offset utf8 read error when trying to do readstring so using
alternative method, ex:', ex); return readjscharstring(); } } else { return readjscharstring(); } } ...
Plug-in Basics - Plugins
n of all api functions is the same on all platforms. where this varies, the reference entry for the function in the reference section describes the difference. plug-ins and platform independence a plug-in is a dynamic code module that is native to the specific platform on which the browser is running. it is a code library, rather than an application or an applet, and runs only from the browser.
although plug-ins are platform-specific, the plug-in api is designed to provide the maximum degree of flexibility and to be functionally consistent across all platforms. this guide notes platform-specific differences in coding for the ms windows, mac os x, and unix platforms. you can use the plug-in api to write plug-ins that are media type driven and provide high performance by taking advantage of ...
...and enhance the gecko core functionality by providing support for new data types. the plug-in file type depends on the platform: ms windows: .dll (dynamic link library) files unix: .so or .dso (shared objects) files mac os x: ppc/x86/universal loadable mach-o bundle windowed and windowless plug-ins you can write plug-ins that are drawn in their own native windows or frames on a web page.
alternatively, you can write plug-ins that do not require a window to draw into. using windowless plug-ins extends the possibilities for web page design and functionality. note, however, that plug-ins are windowed by default, because windowed plug-ins are in general easier to develop and more stable to use. a windowed plug-in is drawn into its own native window on a web page. windowed plug-ins are...
Plug-in Development Overview - Plugins
mimedescription entry point, and will use the information returned by this function. note: the resource method described below is deprecated. plugins should use the info.plist approach, and only use the following method as a supplement to support older browsers. if neither is present, gecko will check the plugins resources. 'str#' 128 should contain a list of mime types and file extensions in
alternating strings. for example: str 128 mime type string 1 video/quicktime string 2 mov, moov string 3 audio/aiff string 4 aiff string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support an...
...ee() when you're done with it. getting version and ui information the netscape group of plug-in api methods provides some basic services to the plug-in. you can use these netscape methods: to identify the browser in which your plug-in is displayed: use the npn_useragent method to read this information. to determine whether plug-in and the browser versions are compatible and possibly provide
alternative processing for different versions: use the npn_version method to check for changes in major and minor version numbers. for information about using these methods, see version, ui, and status information. displaying messages on the status line functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. to make the use...
Streams - Plugins
streams can be produced by the browser and consumed by a plug-in instance, or produced by an instance and consumed by the browser. ...
...estread. the browser does not create a new stream for each byte range it requests. instead, additional npp_writeready and npp_write calls occur on the same stream. an individual call to npn_requestread can request discontiguous ranges, and you can have many outstanding npn_requestread calls. there is no guarantee that npp_write will receive requests for ranges in the same order as you requested (
although this typically is the case; the server controls the order). so, you'll need to pay attention to the offsets as data is being written. the stream processes all byte-range requests, and then is placed in seek mode (either explicitly in npp_newstream, or implicitly by a call to npn_requestread). it remains open until the plug-in closes it by calling npn_destroystream, or until the instance is ...
Version, UI, and Status Information - Plugins
articular feature by using version or npvers constants (see version feature constants). each npvers constant represents a feature. the plug-in can compare the npvers constant to the version number. if the version supports the feature, the plug-in can operate according to plan. if not, the plug-in cannot use some functionality. if an essential feature is unavailable, the developer must arrange for
alternative behavior, shut down the plug-in, or give the user a chance to decide what to do. detecting windowless support on ms windows and mac os x in this example, the has_windowless method finds out whether the current version of the api supports windowless plug-ins. this method for detecting support is only useful on ms windows and mac os x. it starts by using npn_version to get the version nu...
...n ms windows and mac os x. it starts by using npn_version to get the version numbers. it then uses the netscape_minor version number to find out if the windowless feature, represented by the npvers_has_windowless constant, is supported. if the method returns true, a windowless plug-in can confidently proceed. if false is returned, windowless plug-ins will not work, and the developer must provide
alternatives. bool has_windowless() { int plugin_major, plugin_minor; int netscape_major, netscape_minor; /* find the version numbers. */ npn_version(&plugin_major, &plugin_minor, &netscape_major, &netscape_minor); /* use the netscape_minor version number: */ /* does this version support the windowless feature? */ if (netscape_minor < npvers_has_windowless) { /* pl...
Accessibility Inspector - Firefox Developer Tools
the ui items they relate to, if appropriate. the role and name of the item will be shown in a small information bar along with color contrast information if appropriate. this is useful for determining how the items in the accessibility tree relate to the ui items on the actual page. in the following example, you can see that the image has been highlighted and its role, graphic, name, "road, asph
alt, sky, clouds, fall", and the color contrast ratio, 3.46, appears in the information bar above it. color contrast contrast ratio information is particularly useful when you are designing the color palette for your website because if the contrast is not sufficient, readers with visual impairments such as low vision or color blindness will be unable to read the text. see color contrast for detai...
...ker does not get cancelled) until you release the shift key. when the picker is activated, you can also deactivate it by pressing the picker button a second time, or pressing the esc key. typical use cases the accessibility inspector is very useful for spotting accessibility problems at a glance. for a start, you can investigate items that don't have a proper text equivalent — images without
alt text and form elements without proper labels have a name property of null, for example. it is also very handy for verifying semantics — you can use the inspect accessibility properties context menu option to quickly see whether an item has the correct role set on it (e.g., whether a button is really a button, or a link is really a link). ...
Browser Console - Firefox Developer Tools
fox and install it, you'll see a widget labeled "error!" in the add-on bar: click the icon. you'll see output like this in the browser console: for add-on sdk-based add-ons only, the message is prefixed with the name of the add-on ("log-error"), making it easy to find all messages from this add-on using the "filter output" search box. by default, only error messages are logged to the console,
although you can change this in the browser's preferences. browser console command line the browser console command line is disabled by default. to enable it set the devtools.chrome.enabled preference to true in about:config, or set the "enable chrome debugging" option in the developer tool settings. like the web console, the command line interpreter enables you to evaluate javascript expression...
...edtab); newtabbrowser.addeventlistener("load", function() { newtabbrowser.contentdocument.body.innerhtml = "<h1>this page has been eaten</h1>"; }, true); newtabbrowser.contentdocument.location.href = "https://mozilla.org/"; it adds a listener to the currently selected tab's load event that will eat the new page, then loads a new page. note: you can restart the browser with the command ctrl +
alt + r (windows, linux) or cmd +
alt + r (mac) this command restarts the browser with the same tabs open as before the restart. modifying the browser ui since the global window object is the browser's chrome window, you can also modify the browser's user interface. on windows, the following code will add a new item to the browser's main menu: var parent = window.document.getelementbyid("appmenup...
Browser Toolbox - Firefox Developer Tools
"enable remote debugging". to do this, open the developer tools settings, go to the section "advanced settings", and check the settings "enable browser chrome and add-on debugging toolboxes" and "enable remote debugging". opening the browser toolbox open the browser toolbox through the menu button and the menu items "developer" then "browser toolbox". you can also open it with the ctrl +
alt +shift + i key combination ( cmd + opt +shift + i on a mac). you will be presented with a dialog like this (it can be removed by setting the devtools.debugger.prompt-connection property to false): click ok, and the browser toolbox will open in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser it...
...shift + i on a mac). you will be presented with a dialog like this (it can be removed by setting the devtools.debugger.prompt-connection property to false): click ok, and the browser toolbox will open in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser itself and by any add-ons that are running.
altogether you will have access to the following developer tools: debugger (note: if you want to debug a specific add-on that is restartless or sdk-based then try the add-on debugger.) console style editor performance network monitor page inspector accessibility inspector you can debug chrome: and about: pages using the normal debugger, just as if they were ordinary content pages. targe...
DevTools API - Firefox Developer Tools
x object or undefined if there's no toolbox for the given target.. closetoolbox(target) closes the toolbox for given target. parameters: target {target} - the target of the toolbox that should be closed. return value: a promise that is fulfilled once the toolbox has been destroyed. getdefaulttools() returns an array of tooldefinition objects for the built-in tools. getaddition
altools() returns an array of tooldefinition objects for tools added by addons. gettooldefinition(toolid) fetch the tooldefinition object for a tool if it exists and is enabled. parameters: toolid {string} - the id of the tool. return value: a tooldefinition if a tool with the given id exists and is enabled, null otherwise. gettooldefinitionmap() returns a toolid → tooldefiniti...
...eturn this.dosomethingasynchronous() .then(() => this); }, destroy: function() { // synchronous destruction. this.window.document.body.removeeventlistener("click", this.handleclick); // async destruction. return this.destroysomethingasynchronosly() .then(() => console.log("destroyed")); }, handleclick: function(event) { console.log("clicked", event.origin
altarget); }, }; eventemitter eventemitter is an interface many developer tool classes and objects implement and use to notify others about changes in their internal state. when an event is emitted on the eventemitter, the listeners will be called with the event name as the first argument and the extra arguments are spread as the remaining parameters. note: some components use add-on sdk even...
Edit fonts - Firefox Developer Tools
able, provided it includes the desired values for the different characteristics you want to vary. variable fonts make it easy to vary font characteristics in a much more granular fashion because their allowable ranges are defined by axes of variation (see introducing the 'variation axis' for more information). for example, font-weight can be set to any value between 1 and 1000 in variable fonts (
although it is not guaranteed that a variable font will support this entire range). there are several registered axes.
although it isn't required that these axes be defined for every font, if the font designer does implement a registered axis, its behavior must follow the defined behavior. all variable font axes have a four-character axis tag. the css font-variation-settings property uses the tag a...
... version, and macos prior to 10.13 does not support variable fonts. if your operating system is not up to date, you will not be able to use variable fonts in web pages or the firefox developer tools. working with variable fonts in the font editor if the inspected element uses a variable font, the fonts tab shows the axes that have been implemented for that particular font, providing control to
alter the value of each one. this is very useful for quickly finding out what axes are available in a particular font — they can vary quite dramatically as font designers can implement basically anything they like. you can adjust the axes individually or, if the font designer has included defined instances, you can select one from the "instance" drop-down list and view the updates live on your p...
Tips - Firefox Developer Tools
light and a dark theme for the developer tools. change the keyboard bindings to vim, emacs or sublime text if you're used to different shortcuts. check or uncheck the different tools to enable or disable them. (there are more than the default tools!) page inspector in the markup view: press h with a node selected to hide/show it. press backspace or del with a node selected to delete it.
alt + click on a node to expand or collapse it and all its descendants. click on the last breadcrumb button to scroll the selection into view in the inspector. click the "ev" icon besides a node to see all event listeners attached to it. press s with a node selected to see it in the page (same as right-click a node and click "scroll into view"). right-click a node and click "use in console" to co...
... click on the inspector icon () next to an element in the output to select it within the inspector. check "enable persistent logs" in the settings to keep logged messages from before even after navigation. check "enable timestamps" in the settings to show timestamps besides the logged messages. debugger skip javascript libraries in debugging sessions via the black box icon (). press ctrl+
alt+f to search in all scripts. press ctrl+d to search for a function definition. press ctrl+l to go to a specific line. style editor the black box icon () in the style sheet pane toggles the visibility of a style sheet. click an @media rule to apply it in responsive design mode. click the import button () to import a style sheet or the create button () to create a new one. click the option...
Web Console remoting - Firefox Developer Tools
4, "discardrequestbody": false }, { "from": "conn0.netevent14", "type": "networkeventupdate", "updatetype": "responsestart", "response": { "httpversion": "http/1.1", "status": "304", "statustext": "not modified", "headerssize": 194, "discardresponsebody": true } }, { "from": "conn0.netevent14", "type": "networkeventupdate", "updatetype": "eventtimings", "tot
altime": 1 }, { "from": "conn0.netevent14", "type": "networkeventupdate", "updatetype": "responseheaders", "headers": 6, "headerssize": 194 }, { "from": "conn0.netevent14", "type": "networkeventupdate", "updatetype": "responsecookies", "cookies": 0 }, { "from": "conn0.netevent14", "type": "networkeventupdate", "updatetype": "responsecontent", "mimetype": "text/css", "conte...
... the content in base64 encoding (again, most likely a longstringactor grip). to tell the difference just check if response.content.encoding == "base64". the geteventtimings packet: { "to": "conn0.netevent15", "type": "geteventtimings" } { "from": "conn0.netevent15", "timings": { "blocked": 0, "dns": 0, "connect": 0, "send": 0, "wait": 16, "receive": 0 }, "tot
altime": 16 } the fileactivity packet when a file load is observed the following fileactivity packet is sent to the client: { "from": "conn0.console9", "type": "fileactivity", "uri": "file:///home/mihai/public_html/mozilla/test2.css" } history protocol changes by firefox version: firefox 18: initial version. firefox 19: bug 787981 - added longstringactor usage in several places. fir...
AbstractRange - Web APIs
ethods. usage notes range types all ranges of content within a document are described using instances of interfaces based on abstractrange. there are two such interfaces: range the range interface has been around for a long time and has only recently been redefined to be based upon abstractrange as the need arose to define other forms of range data. 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. staticrange a staticrange is a basic range which cannot be changed once it's been created. specifically, as the node tree mutates and changes, the range does not. this is useful when you need to specify a range that will only be used once, since it avoids the performance and resource...
...bal positions within the entire document. by defining points within the document as offsets within a given node, those positions remain consistent with the content even as nodes are added to, removed from, or moved around within the dom tree—within reason. there are fairly obvious limitations (such as if a node is moved to be after the endpoint of a range, or if the content of a node is heavily
altered), but it's far better than nothing. third, using node-relative positions to define the start and end positions will generally be easier to make perform well. rather than having to negotiate the dom figuring out what your global offset refers to, the user agent (browser) can instead go directly to the node indicated by the starting position and start from there, working its way forward until ...
AnimationEffect.getComputedTiming() - Web APIs
if effecttiming.duration is the string auto, this attribute will return 0. fill the auto value is replaced with the appropriate effecttiming.fill value. ...
...ns the following properties: endtime the end time of the animation in milliseconds from the animation's start (if the keyframeeffect is associated with an animation). (also includes effecttiming.enddelay in that calculation.) activeduration the length of time in milliseconds that the animation's effects will run. this is equal to the iteration duration multiplied by the iteration count. loc
altime the current time of the animation in milliseconds. if the keyframeeffect is not associated with an animation, its value is null. progress indicates how far along the animation is through its current iteration with values between 0 and 1. returns null if the animation is not running or its keyframeeffect isn't associated with an animation. currentiteration the number of times this animatio...
Using dynamic styling information - Web APIs
operty in the head section, or external style sheets. however, this will not affect any other property declarations for that element's styles, such as padding or margin or font, for example. to change a particular element's style, you can adapt the following example for the element(s) you want to style. ...
...</p> <!-- passes the 'p1' id of another element's style to modify. --> <button onclick="resetstyle('p1');">reset background color</button> </body> </html> the getcomputedstyle() method on the document.defaultview object returns all styles that have actually been computed for an element. ...
CanvasRenderingContext2D.setLineDash() - Web APIs
if the number of elements in the array is odd, the elements of the array get copied and concatenated. ...
...if the number of elements in the array is odd, the elements of the array get copied and concatenated. for example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. ...
Using the W3C DOM Level 1 Core - Web APIs
or scripting on the web. what is a dom tree? a dom tree is a kind of tree whose nodes represent an html or xml document's contents. each html or xml document has a unique dom tree representation. 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 display the document. what does the dom level 1 core let me do? the w3c dom level 1 core allows you to change a dom tree in any way you want. this implies the ability to create any...
...ppending it to // the body (which is the parent of para) para.parentnode.appendchild(newelement); } you can see this script as a complete example. how can i learn more? now that you are familiar with the basic concepts of the dom, you may want to learn about the dom level 1 fundamental methods. see also the dom level 1 core specification from the w3c. it's a reasonably clear spec,
although it is formal. the main thing that's useful to authors is the description of the different dom objects and all their properties and methods. also see our other dom documentation. original document information author(s): l. david baron <dbaron at dbaron dot org> copyright information: © 1998-2005 by individual mozilla.org contributors; content available under a creative commons license ...
EffectTiming - Web APIs
the effecttiming dictionary, part of the web animations api, is used by element.animate(), keyframeeffectreadonly(), and keyframeeffect() to describe timing properties for animation effects. these properties are all optional,
although without setting a duration the animation will not play. simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. ...
...se properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. properties delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (
alternate), or runs backwards and switches direction after each iteration (
alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0.
although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. acce...
Using Fetch - Web APIs
the fetch api provides a javascript interface for accessing and manipulating parts of the http pipeline, such as requests and responses. it also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network. this kind of functionality was previously achieved using xmlhttprequest. fetch provides a better
alternative that can be easily used by other technologies such as service workers. fetch also provides a single logical place to define other http-related concepts such as cors and extensions to http. the fetch specification differs from jquery.ajax() in three main ways: the promise returned from fetch() won’t reject on http error status even if the response is an http 404 or 500. instead, it will resolve normally (with ok st...
...an accurate check for a successful fetch() would include checking that the promise resolved, then checking that the response.ok property has a value of true. the code would look something like this: fetch('flowers.jpg') .then(response => { if (!response.ok) { throw new err...
Introduction to the File and Directory Entries API - Web APIs
t lets users of your web app directly edit a binary file that's in their local file directory. it provides a storage api that is already familiar to your users, who are used to working with file systems. for examples of features you can create with this app, see the sample use cases section. the file and directory entries api and other storage apis the file and directory entries api is an
alternative to other storage apis like indexeddb, websql (which has been deprecated since november18, 2010), and appcache. the api is a better choice for apps that deal with blobs for the following reasons: the file and directory entries api offers client-side storage for use cases that are not addressed by databases. if you want to have large mutable chunks of data, the file and directory entries...
...l scope only, not the window object. the synchronous api can be simpler for some tasks. its direct, in-order programming model can make code easier to read. the drawback of synchronous api has to do with its interactions with web workers, which has some limitations. when using the asynchronous api, always use the error callbacks when using the asynchronous api, always use the error callbacks.
although the error callbacks for the methods are optional parameters, they are not optional for your sanity. you want to know why your calls failed. at minimum, handle the errors to provide error messages, so you'll have an idea of what's going on. the file and directory entries api interacts with other apis the file and directory entries api is designed to be used with other apis and elements on t...
GlobalEventHandlers.onanimationcancel - Web APIs
nd describe the animation in-place here because the animation is intended to begin as soon as the page loads, rather than based on an event. ...
... javascript before we get to the animation code, we define a function which logs information to a box on the user's screen. we'll use this to show information about the events we receive. ...
HTMLCollection - Web APIs
have html elements as their items). an htmlcollection in the html dom is live; it is automatically updated when the underlying document is changed. properties htmlcollection.length read only returns the number of items in the collection. methods htmlcollection.item() returns the specific node at the given zero-based index into the list. returns null if the index is out of range. an
alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. htmlcollection.nameditem() returns the specific node whose id or, as a fallback, name matches the string specified by name. matching by name is only done as a last resort, only in html, and only if the referenced element supports the name a...
...fined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. htmlcollection.nameditem() returns the specific node whose id or, as a fallback, name matches the string specified by name. matching by name is only done as a last resort, only in html, and only if the referenced element supports the name attribute. returns null if no node exists by the given name. an
alternative to accessing collection[name] (which instead returns undefined when name does not exist). this is mostly useful for non-javascript dom implementations. usage in javascript htmlcollection also exposes its members directly as properties by both name and index. html ids may contain : and . as valid characters, which would necessitate using bracket notation for property access. currently h...
HTMLImageElement.srcset - Web APIs
rticular width in pixels, provide a width descriptor comprised the number giving that width in pixels followed by the lower case letter "w". for example, to provide an image resource to be used when the renderer needs a 450 pixel wide image, use the width descriptor string 450w. the specified width must be a positive, non-zero, integer, and must match the intrinsic width of the referenced image.
alternatively, you can use a pixel density descriptor, which specifies the condition in which the corresponding image resource should be used as the display's pixel density. this is written by stating the pixel density as a positive, non-zero floating-point value followed by the lower-case letter "x". as an example, to state that the corresponding image should be used when the pixel density is doubl...
...example html the html below indicates that the default image is the 200 pixel wide version of the clock image we use in several places throughout our documentation. also specified by the srcset attribute is that the 200-pixel version should be used for 1x displays while the 400-pixel version should be used for 2x displays. <div class="box"> <img src="/files/16797/clock-demo-200px.png"
alt="clock" srcset="/files/16864/clock-demo-200px.png 1x, /files/16797/clock-demo-400px.png 2x"> </div> css the css simply specifies that the image and its surrounding box should be 200 pixels square and should have a simple border around it. also provided is the word-break attribute, using the break-all value to tell the browser to wrap the string within the width available regardless of w...
HTMLImageElement.useMap - Web APIs
rning article add a hitmap on top of an image. usage notes the string value of usemap must be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. ...
...be a valid anchor for a <map> element. in other words, this string should be the value of the appropriate <map>'s name attribute with a pound or hash symbol prepended to it. consider a <map> that looks like this: <map name="mainmenu-map"> <area shape="circle" coords="25, 25, 75, 75" href="/index.html"
alt="return to 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. example the source for this interactive example is stored in a github rep...
Dragging and Dropping Multiple Items - Web APIs
comes new second item, and its index decreases. // [item1] data=url1, index=0 // [item2] data=url3, index=1 fortunately, you don't normally need to clear items often; it's more common to just add the items only when you know they are needed. common cases where dragging multiple items is used is when dragging multiple files or bookmarks. in this case, add the appropriate formats for each item.
although not required, you should always add the same formats for each item. the ensures that receiving drop targets can expect consistent data. to check if multiple files are being dragged, check the mozitemcount property. it will be set to the number of items being dragged. if a particular drop target only supports dropping a single item, it could either reject the dragged items or it could just u...
...tring data; you can specify any type of data. for example, files are dragged using the application/x-moz-file type stored as nsifile objects. as the setdata() method only supports strings, it cannot be used to specify files for dragging in this manner. instead the mozsetdataat() method must be used. dt.mozsetdataat("application/x-moz-file", file, 0); by using this method, you can file objects,
although you do not necessarily need to support multiple items. thus, you should pass 0 as the index. similarly, you will need to retrieve the file object or objects using the mozgetdataat() method. if you use getdata(), you will receive an empty string as the data is not a string. note that some simple types like numbers can be converted to strings, so it is safe to use getdata() in this case. mul...
Recommended Drag Types - Web APIs
d string. for example: event.datatransfer.setdata("text/plain", "this is text to drag"); dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself. it is recommended to always add data of the text/plain type as a fallback for applications or drop targets that do not support other types, unless there is no logical text
alternative. always add this text/plain type last, as it is the least specific and shouldn’t be preferred. note: in older code, you may find text/unicode or the text types. these are equivalent to text/plain, and will store and retrieve plain text data. dragging links dragged hyperlinks should include data of two types: text/uri-list, and text/plain. both types should use the link’s url for th...
...ropped images. dragging nodes nodes and elements in a document may be dragged using the application/x-moz-node type. the data for the type should be a dom node. this allows the drop target to receive the actual node where the drag was started from. note that callers from a different domain will not be able to access the node even when it has been dropped. you should always include a text/plain
alternative for the node. dragging custom data you can also use other types that you invent for custom purposes. strive to always include a text/plain
alternative, unless the dragged object is specific to a particular site or application. in this case, the custom type ensures that the data cannot be dropped elsewhere. dragging files to an operating system folder you may want to add a file to an e...
Working with the History API - Web APIs
ain the stateobj. the popstate event won't be fired because the page has been reloaded. the page itself will look like bar.html. if the user clicks back once again, the url will change to http://mozilla.org/foo.html, and the document will get a popstate event, this time with a null state object. here too, going back doesn't change the document's contents from what they were in the previous step,
although the document might update its contents manually upon receiving the popstate event. note: calling history.back() normally behaves the same way as clicking the back button. but there is one important exception: after using history.pushstate(), calling history.back() does not raise a popstate event. clicking the browser's back button (still) does. the pushstate() method pushstate() takes ...
...he browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate(), the method will throw an exception. if you need more space than this, you're encouraged to use sessionstorage and/or localstorage. title all browsers but safari currently ignore this parameter,
although they may use it in the future. passing the empty string here should be safe against future changes to the method.
alternatively, you could pass a short title for the state to which you're moving. url the new history entry's url is given by this parameter. note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, for ins...
Basic concepts - Web APIs
enced object store. the records in an index are automatically populated whenever records in the referenced object store are inserted, updated, or deleted. each record in an index can point to only one record in its referenced object store, but several indexes can reference the same object store. when the object store changes, all indexes that refer to the object store are automatically updated.
alternatively, you can also look up records in an object store using the key. to learn more on using indexes, see using indexeddb. for the reference documentation on index, see idbkeyrange. key and value key a data value by which stored values are organized and retrieved in the object store. the object store can derive the key from one of three sources: a key generator, a key path, or an...
...is greater than the one before it. each record in an object store must have a key that is unique within the same store, so you cannot have multiple records with the same key in a given object store. a key can be one of the following types: string, date, float, a binary blob, and array. for arrays, the key can range from an empty value to infinity. and you can include an array within an array.
alternatively, you can also look up records in an object store using the index. key generator a mechanism for producing new keys in an ordered sequence. if an object store does not have a key generator, then the application must provide keys for records being stored. generators are not shared between stores. this is more a browser implementation detail, because in web development, you don't reall...
Using IndexedDB - Web APIs
data into it. objectstore.transaction.oncomplete = function(event) { // store values in the newly created objectstore. var customerobjectstore = db.transaction("customers", "readwrite").objectstore("customers"); customerdata.foreach(function(customer) { customerobjectstore.add(customer); }); }; }; as indicated previously, onupgradeneeded is the only place where you can
alter the structure of the database. in it, you can create and delete object stores and build and remove indices. object stores are created with a single call to createobjectstore(). the method takes a name of the store, and a parameter object. even though the parameter object is optional, it is very important, because it lets you define important optional properties and refine the type of object st...
...rty is undefined. one common pattern with cursors is to retrieve all objects in an object store and add them to an array, like this: var customers = []; objectstore.opencursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { customers.push(cursor.value); cursor.continue(); } else { console.log("got all customers: " + customers); } }; note:
alternatively, you can use getall() to handle this case (and getallkeys()) . the following code does precisely the same thing as above: objectstore.getall().onsuccess = function(event) { console.log("got all customers: " + event.target.result); }; there is a performance cost associated with looking at the value property of a cursor, because the object is created lazily. when you use getall() for ...
KeyframeEffectOptions - Web APIs
simply put, these properties describe how the user agent should go about making the transition from keyframe to keyframe, and how to behave when the animation begins and ends. ...
...an be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (
alternate), or runs backwards and switches direction after each iteration (
alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0.
although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. acce...
MediaDevices.getUserMedia() - Web APIs
fic camera, you would use: { video: { deviceid: { exact: myexactcameraorbustdeviceid } } } return value a promise whose fulfillment handler receives a mediastream object when the requested media has successfully been obtained. exceptions rejections of the returned promise are made by passing a domexception error object to the promise's failure handler. possible errors are: aborterror
although the user and operating system both granted access to the hardware device, and no hardware issues occurred that would cause a notreadableerror, some problem occurred which prevented the device from being used. notallowederror one or more of the requested source devices cannot be used at this time. this will happen if the browsing context is insecure (that is, the page was loaded using http ...
...s that support managing media permissions with feature policy, this error is returned if feature policy is not configured to allow access to the input source(s). older versions of the specification used securityerror for this instead; securityerror has taken on a new meaning. notfounderror no media tracks of the type specified were found that satisfy the given constraints. notreadableerror
although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or web page level which prevented access to the device. overconstrainederror the specified constraints resulted in no candidate devices which met the criteria requested. the error is an object of type overconstrainederror, and has a constraint property whose string value is ...
Recording a media element - Web APIs
you can also use an html media element (namely <audio> or <video>) as the source of the mediastream to be recorded. in this article, we'll look at an example that does just that. html content <p>click the "start" button to begin video recording for a few seconds. you can stop the video by clicking the creatively-named "stop" button. the "download" button will download the received data (
although it's in a raw, unwrapped form that isn't very useful). </p> <br> let's start by looking at the key bits of the html. there's a little more than this, but it's just informational rather than being part of the core operation of the app. <div class="left"> <div id="startbutton" class="button"> start </div> <h2>preview</h2> <video id="preview" width="160" height="120" autoplay...
... }); let recorded = wait(lengthinms).then( () => recorder.state == "recording" && recorder.stop() ); return promise.all([ stopped, recorded ]) .then(() => data); } startrecording() takes two input parameters: a mediastream to record from and the length in milliseconds of the recording to make. we always record no more than the specified number of milliseconds of media,
although if the media stops before that time is reached, mediarecorder automatically stops recording as well. line 2 creates the mediarecorder that will handle recording the input stream. line 3 creates an empty array, data, which will be used to hold the blobs of media data provided to our ondataavailable event handler. line 5 sets up the handler for the dataavailable event. the received eve...
MouseEvent.initMouseEvent() - Web APIs
doesn't do anything anymore. do not use this method anymore as it is deprecated. instead use specific event constructors, like mouseevent(). the page on creating and triggering events gives more information about the way to use these. syntax event.initmouseevent(type, canbubble, cancelable, view, detail, screenx, screeny, clientx, clienty, ctrlkey,
altkey, shiftkey, metakey, button, relatedtarget); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be prevented. sets the value o...
...oordinate. sets the value of mouseevent.screenx. screeny the event's screen y coordinate. sets the value of mouseevent.screeny. clientx the event's client x coordinate. sets the value of mouseevent.clientx. clienty the event's client y coordinate. sets the value of mouseevent.clienty. ctrlkey whether or not control key was depressed during the event. sets the value of mouseevent.ctrlkey.
altkey whether or not
alt key was depressed during the event. sets the value of mouseevent.
altkey. shiftkey whether or not shift key was depressed during the event. sets the value of mouseevent.shiftkey. metakey whether or not meta key was depressed during the event. sets the value of mouseevent.metakey. button the event's mouse button. relatedtarget the event's related eventtarget. only use...
NamedNodeMap - Web APIs
properties this interface doesn't inherit any property. namednodemap.length read only returns the amount of objects in the map. ...
... properties this interface doesn't inherit any property. namednodemap.length read only returns the amount of objects in the map. ...
Navigator.vibrate() - Web APIs
the navigator.vibrate() method pulses the vibration hardware on the device, if such hardware exists. if the device doesn't support vibration, this method has no effect. if a vibration pattern is already in progress when this method is called, the previous pattern is h
alted and the new one begins instead. if the method was unable to vibrate because of invalid parameters, it will return false, else it returns true. if the pattern leads to a too long vibration, it is truncated: the max length depends on the implementation. syntax var successbool = window.navigator.vibrate(pattern); pattern provides a pattern of vibration and pause intervals. each value indicates a number of milliseconds to vibrate or pause, in
alternation. you may provide either a single value (to vibrate once for that ...
...see vibration api for details. ...
Node.textContent - Web APIs
of the textcontent of every child node, excluding comments and processing instructions. (this is an empty string if the node has no children.) setting textcontent on a node removes all of the node's children and replaces them with a single text node with the given string value. differences from innertext don't get confused by the differences between node.textcontent and htmlelement.innertext.
although the names seem similar, there are important differences: textcontent gets the content of all elements, including <script> and <style> elements. in contrast, innertext only shows “human-readable” elements. textcontent returns every element in the node. in contrast, innertext is aware of styling and won’t return the text of “hidden” elements. moreover, since innertext takes...
...ntent returns every element in the node. in contrast, innertext is aware of styling and won’t return the text of “hidden” elements. 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. it is impossible to insert the nodes again into any other element or into the same element after doing so. differences from innerhtml element.innerhtml returns html, as its name indicates. sometimes people use innerhtml to retrieve or write text in...
NodeList - Web APIs
nodelist objects are collections of nodes, usually returned by properties such as node.childnodes and methods such as document.queryselectorall().
although nodelist is not an array, it is possible to iterate over it with foreach(). it can also be converted to a real array using array.from(). however, some older browsers have not implemented nodelist.foreach() nor array.from(). this can be circumvented by using array.prototype.foreach() — see this document's example. live vs. static nodelists
although they are both considered nodelists, there are 2 varieties of nodelist: live and static. live nodelists in some cases, the nodelist is live, which means that changes in the dom automatically update the collection. for example, node.childnodes is live: const parent = document.getelemen...
...ocument.queryselectorall() method returns a static nodelist. it's good to keep this distinction in mind when you choose how to iterate over the items in the nodelist, and whether you should cache the list's length. properties nodelist.length the number of nodes in the nodelist. methods nodelist.item() returns an item in the list by its index, or null if the index is out-of-bounds. an
alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. nodelist.entries() returns an iterator, allowing code to go through all key/value pairs contained in the collection. (in this case, the keys are numbers starting from 0 and the values are nodes.) nodelist.foreach() executes a provided funct...
RTCPeerConnection.addTrack() - Web APIs
peer to another, not streams. since streams are specific to each peer, specifying one or more streams means the other peer will create a corresponding stream (or streams) automatically on the other end of the connection, and will then automatically add the received track to those streams. streamless tracks if no streams are specified, then the track is streamless. this is perfectly acceptable,
although it will be up to the remote peer to decide what stream to insert the track into, if any. this is a very common way to use addtrack() when building many types of simple applications, where only one stream is needed. for example, if all you're sharing with the remote peer is a single stream with an audio track and a video track, you don't need to deal with managing what track is in what stream...
... 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. this includes things like changes to the transceiver's direction and tracks being h
alted using removetrack(). for example, consider this function that an application might use to begin streaming a device's camera and microphone input over an rtcpeerconnection to a remote peer: async opencall(pc) { const gumstream = await navigator.mediadevices.getusermedia( {video: true, audio: true}); for (const track of gumstream.gettracks()) { pc.addtrack(trac...
RTCPeerConnection.createDataChannel() - Web APIs
he name of the sub-protocol being used on the rtcdatachannel, if any; otherwise, the empty string (""). default: empty string, "". this string may not be longer than 65,535 bytes. negotiated optional by default (false), data channels are negotiated in-band, where one side calls createdatachannel, and the other side listens to the rtcdatachannelevent event using the ondatachannel eventhandler .
alternatively (true), they can be negotiated out of-band, where both sides call createdatachannel with an agreed-upon id. default: false. id optional an 16-bit numeric id for the channel; permitted values are 0-65534. if you don't include this option, the user agent will select an id for you. the options which can be configured using the rtcdatachannelinit dictionary represent the script-settabl...
...nopen = function(event) { channel.send('hi you!'); } channel.onmessage = function(event) { console.log(event.data); } // answerer side var pc = new rtcpeerconnection(options); pc.ondatachannel = function(event) { var channel = event.channel; channel.onopen = function(event) { channel.send('hi back!'); } channel.onmessage = function(event) { console.log(event.data); } }
alternatively, more symmetrical out-of-band negotiation can be used, using an agreed-upon id (0 here): // both sides var pc = new rtcpeerconnection(options); var channel = pc.createdatachannel("chat", {negotiated: true, id: 0}); channel.onopen = function(event) { channel.send('hi!'); } channel.onmessage = function(event) { console.log(event.data); } for a more thorough example showing how the ...
RTCRtpSender.setParameters() - Web APIs
ters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to
alter changes made by a specific previous call to getparameters(). return value a promise that resolves when the rtcrtpsender.track property is updated with the given parameters. 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...
...ne 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. you cannot change the number of encoding options once the sender has been created. the order of the specified encodings has changed from the current list's order. an attempt has been made to
alter a property that cannot be changed after the sender is first created. invalidstateerror the transceiver of which the rtcrtpsender is a part is not running, or has no parameters to set. operationerror any error condition which occurs that isn't covered by one of the other error codes results in an operationerror. rangeerror the value specified for scaleresolutiondownby is less than 1.0,...
SpeechRecognition.onresult - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'onresult' in that specification. dra...
SpeechRecognition - Web APIs
speechrecognition.continuous controls whether continuous results are returned for each recognition, or only a single result. defaults to single (false.) speechrecognition.interimresults controls whether interim results should be returned (true) or not (false.) interim results are results that are not yet final (e.g. the speechrecognitionresult.isfinal property is false.) speechrecognition.max
alternatives sets the maximum number of speechrecognition
alternatives provided per result. the default value is 1. speechrecognition.serviceuri specifies the location of the speech recognition service used by the current speechrecognition to handle the actual recognition. the default is the user agent's default speech service. methods speechrecognition also inherits methods from its parent i...
...| 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.max
alternatives = 1; var diagnostic = document.queryselector('.output'); var bg = document.queryselector('html'); document.body.onclick = function() { recognition.start(); console.log('ready to receive a color command.'); } recognition.onresult = function(event) { var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color; bg.style.backgroundcolor = col...
SpeechRecognitionEvent.results - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'results' in that specification. draft...
SpeechRecognitionResultList.item() - Web APIs
esult = function(event) { // the speechrecognitionevent results property returns a speechrecognitionresultlist object // the speechrecognitionresultlist object contains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. ...
...ains speechrecognitionresult objects. // it has a getter so it can be accessed like an array // the first [0] returns the speechrecognitionresult at position 0. // each speechrecognitionresult object contains speechrecognition
alternative objects that contain individual results. // these also have getters so they can be accessed like arrays. // the second [0] returns the speechrecognition
alternative at position 0. // we then return the transcript property of the speechrecognition
alternative object var color = event.results[0][0].transcript; diagnostic.textcontent = 'result received: ' + color + '.'; bg.style.backgroundcolor = color; } specifications specification status comment web speech apithe definition of 'item()' in that specification. draft ...
Using readable streams - Web APIs
ains are only supported in chrome at the moment, and that functionality is subject to change. finding some examples we will look at various examples in this article, taken from our dom-examples/streams repo. you can find the full source code there, as well as links to the examples. consuming a fetch as a stream the fetch api allows you to fetch resources across the network, providing a modern
alternative to xhr. it has a number of advantages, and what is really nice about it is that browsers have recently added the ability to consume a fetch response as a readable stream. the body mixin now includes the body property, which is a simple getter exposing the body contents as a readable stream. this mixin is implemented by both the request and response interfaces, so it is available on both,...
...rnative to xhr. it has a number of advantages, and what is really nice about it is that browsers have recently added the ability to consume a fetch response as a readable stream. the body mixin now includes the body property, which is a simple getter exposing the body contents as a readable stream. this mixin is implemented by both the request and response interfaces, so it is available on both,
although consuming the stream of a response body is perhaps a bit more obvious. as our simple stream pump example shows (see it live also), exposing it is a matter of just accessing the body property of the response: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) this provides us with a readablestream object. attaching a...
SubtleCrypto.importKey() - Web APIs
ys. json web key format is defined in rfc 7517. it describes a way to represent public, private, and secret keys as json objects. a json web key looks something like this (this is an ec private key): { "crv": "p-384", "d": "wouctu7nw4e8_7n5c1-xbjb4xqsb_lizhymsy8mggxuny6q8ncoh9xsiviwlffk_", "ext": true, "key_ops": ["sign"], "kty": "ec", "x": "szrrxmyi8vwfjg1dpunbfcc9jzvjzefh7ulki1ukx
altd7rgwrcffxqygpcwu6aq", "y": "hhuag3ovdzer0uuqnd4pxhqtxp5idgdyhjhl-wlkjngjqaw0rngy5v29-av-ysew" }; examples note: you can try the working examples on github. raw import this example imports an aes key from an arraybuffer containing the bytes to use. see the complete code on github. const rawkey = window.crypto.getrandomvalues(new uint8array(16)); /* import an aes secret key from an arrayb...
...rue, ["encrypt"] ); } json web key import this code imports an ecdsa private signing key, given a json web key object that represents it. see the complete code on github. const jwkeckey = { "crv": "p-384", "d": "wouctu7nw4e8_7n5c1-xbjb4xqsb_lizhymsy8mggxuny6q8ncoh9xsiviwlffk_", "ext": true, "key_ops": ["sign"], "kty": "ec", "x": "szrrxmyi8vwfjg1dpunbfcc9jzvjzefh7ulki1ukx
altd7rgwrcffxqygpcwu6aq", "y": "hhuag3ovdzer0uuqnd4pxhqtxp5idgdyhjhl-wlkjngjqaw0rngy5v29-av-ysew" }; /* import a pem encoded rsa private key, to use for rsa-pss signing. takes a string containing the pem encoded key, and returns a promise that will resolve to a cryptokey representing the private key. */ function importprivatekey(jwk) { return window.crypto.subtle.importkey( "jwk", jwk, ...
SubtleCrypto.sign() - Web APIs
y must be kept secret, which in turn means that this algorithm is not suitable for many signature use cases. it can be a good choice however when the signer and verifier are the same entity. rsassa-pkcs1-v1_5 the rsassa-pkcs1-v1_5 algorithm is specified in rfc 3447. rsa-pss the rsa-pss algorithm is specified in rfc 3447. it's different from rsassa-pkcs1-v1_5 in that it incorporates a random s
alt in the signature operation, so the same message signed with the same key will not result in the same signature each time. an extra property, defining the s
alt length, is passed into the sign() and verify() functions when they are invoked. ecdsa ecdsa (elliptic curve digital signature algorithm) is a variant of the digital signature algorithm, specified in fips-186, that uses elliptic curve cryp...
... of the "message" textbox, and encode it in a form we can use for the sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".rsa-pss #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } let encoded = getmessageencoding(); let signature = await window.crypto.subtle.sign( { name: "rsa-pss", s
altlength: 32, }, privatekey, encoded ); ecdsa this code fetches the contents of a text box, encodes it for signing, and signs it with a private key. see the complete source code on github. /* fetch the contents of the "message" textbox, and encode it in a form we can use for the sign operation. */ function getmessageencoding() { const messagebox = document.queryselector(".ecdsa #message"...
USBDevice - Web APIs
one of three properties that declare the usb protocol version supported by the device. the other two properties are usbdevice.usbversionmajor and usbdevice.usbversionminor. usbdevice.vendorid read only the official usg.org-assigned vendor id. methods usbdevice.claiminterface() returns a promise that resolves when the requested interface is claimed for exclusive access. usbdevice.clearh
alt() returns a promise that resolves when a h
alt condition is cleared. usbdevice.controltransferin() returns a promise that resolves with a usbtransferinresult when a command or status operation has been transmitted to the usb device. usbdevice.controltransferout() returns a promise that resolves with a usbtransferoutresult when a command or status operation has been transmitted from the usb de...
...en transmitted from the usb device. usbdevice.open() returns a promise that resolves when a device session has started. usbdevice.releaseinterface() returns a promise that resolves when a cliamed interface is released from exclusive access. usbdevice.reset() returns a promise that resolves when the device is reset and all app operations canceled and their promises rejected. usbdevice.select
alternateinterface() returns a promise that resolves when the specified
alternative endpoint is selected. usbdevice.selectconfiguration() returns a promise that resolves when the specified configuration is selected. usbdevice.transferin() returns a promise that resolves with a usbtransferinresult when bulk or interrupt data is received from the usb device. usbdevice.transferout() returns a pro...
USBEndpoint - Web APIs
the usbendpoint interface of the webusb api provides information about an endpoint provided by the usb device. an endpoint represents a unidirectional data stream into or out of a device. constructor usbendpoint.usbendpoint creates a new usbendpoint object which will be populated with information about the endpoint on the provided usb
altenateinterface with the given endpoint number and transfer direction. properties usbendpoint.endpointnumber returns this endpoint's "endpoint number" which is a value from 1 to 15 extracted from the bendpointaddress field of the endpoint descriptor defining this endpoint. this value is used to identify the endpoint when calling methods on usbdevice. usbendpoint.direction returns the direction in which this endpoint transfers data, one of: "i...
...hat other interfaces the device provides. this code identifies the correct endpoints by searching for the interface implementing the usb cdc interface class and then identifying the candidate endpoints based on their type and direction. let inendpoint = undefined; let outendpoint = undefined; for (const interface of device.configuration.interfaces) { // only support devices with out multiple
alternate interfaces. const
alternate = interface.
alternates[0]; // identify the interface implementing the usb cdc class. const usb_cdc_class = 10; if (
alternate.interfaceclass != usb_cdc_class) { continue; } for (const endpoint of
alternate.endpoints) { // identify the bulk transfer endpoints. if (endpoint.type != "bulk") { continue; } if (endpoint.direction...
UserDataHandler - Web APIs
properties none. ...
...t could be removed at any time. try to avoid using it. summary when associating user data with a key on a node, node.setuserdata() can also accept, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted. per the specification, exceptions should not be thrown in a userdatahandler. in both document.importnode() and node.clonenode(),
although user data is not copied over, the handler will be called. properties none. methods handle (operation, key, data, src, dst) (no return value) this method is a callback which will be called if a node is being cloned, imported, renamed and as well, if deleted or adopted. operation (unsigned short) is an operation type integer (see below). key (domstring) is the user key. data (domuser...
Basic scissoring - Web APIs
« previousnext » in this example, we see how to draw simple rectangles and squares using webgl scissoring operations. scissoring establishes a clipping region outside which drawing will not occur. clearing the drawing buffer when scissoring applies this is a simple demonstration of a rendering with scissor().
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. this is a good opportunity to talk about the difference between pixels and fragments. a pixel is a picture element (in practice, a point) on the screen, or a single element of the drawing buffer, that area in memory that holds your pixel data (such a...
...ing handled by the webgl pipeline. the reason for this distinction is that fragment color (and other fragment values, such as depth) may be manipulated and changed several times during graphics operations before finally being written to the screen. we have already seen how fragment color changes during graphics operations, by applying color masking. in other cases, the fragments may be discarded
altogether (so the pixel value is not updated), or it may interact with the already existing pixel value (such as when doing color blending for non-opaque elements in the scene). here we see another example of the distinction between fragments and pixels. scissoring is a distinct stage in the webgl/opengl graphics pipeline (it occurs after color clearing, but before color masking). before the actual...
WebGL model view projection - Web APIs
. the projection matrix is used to convert world space coordinates into clip space coordinates. a commonly used projection matrix, the perspective projection matrix, is used to mimic the effects of a typical camera serving as the stand-in for the viewer in the 3d virtual world. the view matrix is responsible for moving the objects in the scene to simulate the position of the camera being changed,
altering what the viewer is currently able to see. the sections below offer an in-depth look into the ideas behind and implementation of the model, view, and projection matrices. these matrices are core to moving data around on the screen, and are concepts that transcend individual frameworks and engines. clip space in a webgl program, data is typically uploaded to the gpu with its own coordinate ...
... in the box demo, an additional computesimpleprojectionmatrix() method is added. this is called in the draw() method and has the scale factor passed to it. the result should be identical to the last example: cubedemo.prototype.computesimpleprojectionmatrix = function(scalefactor) { this.transforms.projection = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, scalefactor, 0, 0, 0, scalefactor ]; };
although the result is identical, the important step here is in the vertex shader. rather than modifying the vertex directly, it gets multiplied by an additional projection matrix, which (as the name suggests) projects 3d points onto a 2d drawing surface: // make sure to read the transformations in reverse order gl_position = projection * model * vec4(position, 1.0); the results view on jsfiddle ...
Using DTMF with WebRTC - Web APIs
connection. this article offers a brief high-level overview of how dtmf works over webrtc, then provides a guide for everyday developers about how to send dtmf over an rtcpeerconnection. the dtmf system is often referred to as "touch tone," after an old trade name for the system. webrtc doesn't send dtmf codes as audio data. instead, they're sent out-of-band, as rtp payloads. note, however, that
although it's possible to send dtmf using webrtc, there is currently no way to detect or receive incoming dtmf. webrtc currently ignores these payloads; this is because webrtc's dtmf support is primarily intended for use with legacy telephone services that rely on dtmf tones to perform tasks such as: teleconferencing systems menu systems voicemail systems entry of credit card or other payment i...
...tcrtpsender responsible for transmitting data for the first audio track on the call (which is the track we'll send dtmf over). we then obtain the rtcrtpsender's dtmf property, which is an rtcdtmfsender object that can send dtmf on the connection, from the caller to the receiver. if getsenders() isn't available, we instead call rtcpeerconnection.createdtmfsender() to get the rtcdtmfsender object.
although this method is obsolete, this example supports it as a fallback to let older browsers (and those not yet updated to support the current webrtc dtmf api) run the example. finally, we set the dtmf sender's ontonechange event handler so we get notified each time a dtmf tone finishes playing. you can find the log function at the bottom of the documentation. when a tone finishes playing each ...
Geometry and reference spaces in WebXR - Web APIs
e primary transforms that need to be performed when rendering 3d scenes: translation is the use of a matrix to shift the position of a point through the virtual space. this motion can be along any of the object's axes, or any combination of them. rotation is the application of a matrix that rotates a point around the origin of the object's coordinate system. scaling is the use of a matrix to
alter the size of an object. note that when we say that a transform applies to a point, it also, by extension, can be applied to a collection of points. since an object is represented by some number of polygons made up of a number of points in space, applying the same transform to every point that makes up the object will apply that same transform to the entire object overall. transforms can also b...
... allowing the user to walk around the environment by tracking their real-world movements. to support progressive enhancement—and thus broaden the availability of your app or site—you should choose a reference space that offers the lowest amount of functionality needed, or provide a fallback mechanism that detects failed attempts to obtain reference spaces and tries again with a less powerful
alternative. the compatibility issues that arise may be as fundamental as being unable to support immersive-ar mode (augmented reality sessions) on a vr-only headset, or may involve a request for one or more required options which cannot be met when attempting to create the xr session. xr sessions are created using the navigator.xr.requestsession() method. one of its optional parameters is an objec...
Rendering and the WebXR frame animation callback - Web APIs
fore rendering the same set of objects on the other view. as a result, there's a good bit of replicated effort, since much of the data needed to draw an object winds up getting sent to the gpu twice per frame. however, it simplifies porting existing webgl code and is frequently good enough to do the job, so we'll look at this method first. see optimizing by rendering in object-first order for an
alternative approach that renders each object twice back-to-back, once for each eye, before moving on to the next object that makes up the scene for that frame; that is, rendering in object-first order. sample renderer callback let's take a look at some real code that follows this basic pattern. since in the example above we gave this function the name mydrawframe(), we'll continue to use that here...
...more time you spend handling state changes, the less time you have to actually draw things. this technique works very well for a small number of objects, but because it has to re-bind all the data for each object twice (once for the left eye, and once for the right), you're spending a lot of time adjusting the state, uploading buffers and textures, and so forth. in the next section, we look at an
altered approach that reduces these state changes substantially, providing a potentially much faster rendering approach, especially as your object count goes up. optimizing by rendering in object-first order an advantage of webxr's approach of using a single webgl framebuffer to contain both the left and right eye's views in a single framebuffer makes it possible to substantially improve rendering ...
Using IIR filters - Web APIs
of filter can be used to implement tone control devices and graphic equalizers, and the filter response parameters can be specified, so that it can be tuned as needed. this article looks at how to implement one, and use it in a simple example. demo our simple example for this guide provides a play/pause button that starts and pauses audio play, and a toggle that turns an iir filter on and off,
altering the tone of the sound. it also provides a canvas on which is drawn the frequency response of the audio, so you can see what effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value betwee...
... effect the iir filter has. you can check out the full demo here on codepen. also see the source code on github. it includes some different coefficient values for different lowpass frequencies — you can change the value of the filternumber constant to a value between 0 and 3 to check out the different available effects. browser support iir filters are supported well across modern browsers,
although they have been implemented more recently than some of the more longstanding web audio api features, like biquad filters. the iirfilternode the web audio api now comes with an iirfilternode interface. but what is this and how does it differ from the biquadfilternode we have already? an iir filter is a infinite impulse response filter. it's one of two primary types of filters used in audio ...
Using the Web Audio API - Web APIs
owerful feature of the web audio api is that it does not have a strict "sound call limitation". for example, there is no ceiling of 32 or 64 sound calls at one time. some processors may be capable of playing more than 1,000 simultaneous sounds without stuttering. 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. we could make this a lot more complex, but this is ideal for simple learning at this stage. check out the final demo here on codepen, or see the source code on github. browser support modern browsers have good support for most features of the web audio api. there are a lot of features of the api, so for more exact information, you'll have to check the browser c...
...y an object of type htmlmediaelement, which comes with its own set of functionality. all of this has stayed intact; we are merely allowing the sound to be available to the web audio api. controlling sound when playing sound on the web, it's important to allow the user to control it. depending on the use case, there's a myriad of options, but we'll provide functionality to play/pause the sound,
alter the track's volume, and pan it from left to right. controlling sound programmatically from javascript code is covered by browsers' autoplay support policies, as such is likely to be blocked without permission being granted by the user (or a whitelist). autoplay policies typically require either explicit permission or a user engagement with the page before scripts can trigger audio to play. th...
Web Speech API - Web APIs
thesisutterance objects. you can get these spoken by passing them to the speechsynthesis.speak() method. for more details on using these features, see using the web speech api. web speech api interfaces speech recognition speechrecognition the controller interface for the recognition service; this also handles the speechrecognitionevent sent from the recognition service. speechrecognition
alternative represents a single word that has been recognised by the speech recognition service. speechrecognitionerror represents error messages from the recognition service. speechrecognitionevent the event object for the result and nomatch events, and contains all the data associated with an interim or final speech recognition result. speechgrammar the words or patterns of words that we wan...
...ject for the result and nomatch events, and contains all the data associated with an interim or final speech recognition result. speechgrammar the words or patterns of words that we want the recognition service to recognize. speechgrammarlist represents a list of speechgrammar objects. speechrecognitionresult represents a single recognition match, which may contain multiple speechrecognition
alternative objects. speechrecognitionresultlist represents a list of speechrecognitionresult objects, or a single one if results are being captured in continuous mode. speech synthesis speechsynthesis the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides.
Window.crypto - Web APIs
in general, you should use this api only in secure contexts. ...
...in general, you should use this api only in secure contexts. ...
Window.screenLeft - Web APIs
o the left edge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using screenleft/screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...the same physical position on the screen, even if the window position is moved. ...
Window.screenTop - Web APIs
to the top edge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using screenleft/screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...the same physical position on the screen, even if the window position is moved. ...
Window.screenX - Web APIs
en. examples in our screenleft-screentop (source code) example, you'll see a canvas onto which has been drawn a circle. in this example we are using window.screenleft/window.screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...the same physical position on the screen, even if the window position is moved. ...
Window.screenY - Web APIs
ge of the screen. examples in our screenleft-screentop example, you'll see a canvas onto which has been drawn a circle. in this example we are using window.screenleft/window.screentop plus window.requestanimationframe() to constantly redraw the circle in the same physical position on the screen, even if the window position is moved. ...
...the same physical position on the screen, even if the window position is moved. ...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
in (and successor to window.settimeout()) sets a timer which executes a function or specified piece of code once the timer expires. syntax var timeoutid = scope.settimeout(function[, delay, arg1, arg2, ...]); var timeoutid = scope.settimeout(function[, delay]); var timeoutid = scope.settimeout(code[, delay]); parameters function a function to be executed after the timer expires. code an
alternative syntax that allows you to include a string instead of a function, which is compiled and executed when the timer expires. this syntax is not recommended for the same reasons that make using eval() a security risk. delay optional the time, in milliseconds (thousandths of a second), the timer should wait before the specified function or code is executed. if this parameter is omitted, a val...
...ll(myarray, myarray.mymethod, 2.5*1000, 2); // same error possible solutions a common way to solve the problem is to use a wrapper function that sets this to the required value: settimeout(function(){myarray.mymethod()}, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout(function(){myarray.mymethod('1')}, 2.5*1000); // prints "one" after 2.5 seconds arrow functions are a possible
alternative, too: settimeout(() => {myarray.mymethod()}, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout(() => {myarray.mymethod('1')}, 2.5*1000); // prints "one" after 2.5 seconds another possible way to solve the "this" problem is to replace the host settimeout() and setinterval() global functions with ones that allow passing a this object and set it in the callback using function.
ARIA: listbox role - Accessibility
typed character. type multiple characters in rapid succession: focus moves to the next item with a name that starts with the string of characters typed. multiple selection: authors may implement either of two interaction models to support multiple selection: a recommended model that does not require the user to hold a modifier key, such as shift or control, while navigating the list or an
alternative model that does require modifier keys to be held while navigating in order to avoid losing selection states. recommended selection model -- holding modifier keys is not necessary: space: changes the selection state of the focused option . shift + down arrow (optional): moves focus to and toggles the selected state of the next option. shift + up arrow (optional): moves focu...
...t option. control + a (optional): selects all options in the list. optionally, if all options are selected, it may also unselect all options. 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. select the newly selected option, setting aria-selected="true" on the option and changing the appearance of the newly selected option to appear 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 op...
An overview of accessible web applications and widgets - Accessibility
visibility changes when content visibility is changed (i.e., an element is hidden or shown), developers should change the aria-hidden property value. the techniques described above should be used to declare css to visually hide an element using display:none. here is an example o...
...he text can be edited. a developer might be tempted to implement the "view" mode using a read-only text <input> element and setting its aria role to button, then switching to "edit" mode by making the element writable and removing the role attribute in "edit" mode (since <input> elements have their own role semantics). do not do this. instead, implement the "view" mode using a different element
altogether, such as a <div> or <span> with a role of button, and the « edit » mode using a text <input> element. asynchronous content changes under construction. see also live regions keyboard navigation often times developers overlook support for the keyboard when they create custom widgets. to be accessible to a variety of users, all features of a web application or widget should also be con...
Accessibility Information for Web Authors - Accessibility
make it more accessible. automated checking & repair cynthia says™ from hisoftware® company "cynthia says™" is a free online webpage accessibility validation service that is designed to identify errors in webpage related to section 508 standards and/or the wcag guidelines. it can perform a "complete webpage quality check" for accessibility, privacy, searchability, metadata and even
alt text attribute quality. the web author chooses the guidelines (as a basis for errors and warnings) to be used by "cynthia says™": section 508, wcag priorities 1, 2 and 3. the output data report is displayed in a clear and well structured table where each and all checkpoints are identified and described (along with an helpful clickable link to the related reference guideline) into logical groups...
...ermore, assistive technologies do not understand what these widgets are supposed to be, or what state they are in or what they are capable of. this document tackles such difficulties and shows several interactive desktop-style widgets such as tree views, menu bars and spreadsheets which are accessible both with the keyboard and assistive technologies such as screen readers, screen magnifiers and
alternative input devices. join the mozilla accessibility community live chat both end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this is a worldwide effort, there is always a good chance to find someone to chat with there, day or night. newsgroup and mailing list we have two discussion lists, which can be read via a newsgroup...
Operable - Accessibility
sers navigate, find content, and determine where they are. guideline 2.5 input modalities: make it easier for users to operate functionality through various inputs beyond keyboard. the conformance criteria under this guideline ensures that users are able to interact with digital technology using different input methods beyond a keyboard or mouse (including touchscreen, voice, device motion, or
alternative input devices. success criteria how to conform to the criteria practical resource 2.5.1 pointer gestures (a) added in 2.1 all functionality that can be operated with a pointer can be operated with single-point actions. path-based or multi-point gestures are not required to operate any functionality. exceptions exist. understanding pointer gestures ...
...) added in 2.1 the size of an actionable item's touch target must be at least 44 css pixels in both width and height. exceptions exist. understanding target size 2.5.6 concurrent input mechanisms (aaa) added in 2.1 make sure people can use and switch between different modes of input when interacting with digital content including touchscreen, keyboard, mouse, voice commands, or
alternative input devices. an essential exception exists. understanding concurrent input mechanism note: also see the wcag description for guideline 2.5: input modalities: make it easier for users to operate functionality through various inputs beyond keyboard. see also wcag perceivable operable understandable robust ...
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
i am using floats for older browsers and grid for new ones.</div> </div> the image below shows the media object in a non-supporting browser on the left, and a supporting one on the right: using feature queries the above example is very simple, and we can get away without needing to write code that would be a probl...
...methods.</p> </li> <li class="card"><h2>six</h2> <p>we can use css grid to overwrite older methods.</p> </li> </ul> </div> overwriting other values of display due to the problems of creating grids of items using floats, many of us would use a different method to the floated method shown above to layout a set of cards. using display: inline-block is an
alternate method. once again i can use feature queries to overwrite a layout that uses display: inline-block, and again i don’t need to overwrite everything. an item that is set to inline-block becomes a grid item, and so the behaviour of inline-block no longer applies. i have used the vertical-align property on my item when in the inline-block display mode, but this property does not apply to gri...
Card - CSS: Cascading Style Sheets
onal space. if the track does have a footer it will be auto-sized, as rows created in the implicit grid are auto-sized by default. therefore this will fit the content added to it. note: the various elements in separate cards do not align with each other, as each card is an independent grid. the proposed subgrid feature of grid level 2 would give a solution to this issue. useful fallbacks or
alternative methods flexbox could be used to lay out the card, in which case you should make the content area grow, and other items not grow. this would be a reasonable way to lay out the card,
although i have a slight preference for being able to control the tracks from the container rather than needing to add rules to the items. for the overall layout you could use flexbox, however this will resu...
... see the columns recipe for demonstrations of each of these layout methods. ...
Grid wrapper - CSS: Cascading Style Sheets
will grow to. using a numeric unit (pixels, ems, rems) will create a fixed maximum size for the central wrapper, whereas using percentage values or viewport units will mean this wrapper grows or shrinks in response to its context. the outer two columns have a maximum size of 1fr, meaning that they will each expand to fill the remaining available space in the grid container. ...
... ...
Specificity - CSS: Cascading Style Sheets
icity" in "cascade and inheritance", you can also visit: https://specifishity.com inline styles added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity. the !important exception when an important rule is used on a style declaration, this declaration overrides any other declarations.
although technically !important has nothing to do with specificity, it interacts directly with it. using !important, however, is bad practice and should be avoided because it makes debugging more difficult by breaking the natural cascading in your stylesheets. when two conflicting declarations with the !important rule are applied to the same element, the declaration with a greater specificity will be...
... this works because in a specificity tie, the last rule defined wins. some examples with a higher specificity: table td { height: 50px !important; } .mytable td { height: 50px !important; } #mytable td { height: 50px !important; } b) or add the same selector after the existing one: td { height: 50px !important; } c) or, preferably, rewrite the original rule to avoid the use of !important
altogether. [id="someelement"] p { color: blue; } p.awesome { color: red; } including an id as part of an attribute selector instead of as an id selector gives it the same specificity as a class. both selectors above now have the same weight. in a specificity tie, the last rule defined wins. for more information, visit: https://stackoverflow.com/questions/3706819/what-are-the-implications-...
animation-fill-mode - CSS: Cascading Style Sheets
target will retain the computed values set by the last keyframe encountered during execution. the last keyframe depends on the value of animation-direction and animation-iteration-count: animation-direction animation-iteration-count last keyframe encountered normal even or odd 100% or to reverse even or odd 0% or from
alternate even 0% or from
alternate odd 100% or to
alternate-reverse even 100% or to
alternate-reverse odd 0% or from backwards the animation will apply the values defined in the first relevant keyframe as soon as it is applied to the target, and retain this during the animation-delay period. the first relevant keyframe ...
...
alternate-reverse odd 0% or from backwards the animation will apply the values defined in the first relevant keyframe as soon as it is applied to the target, and retain this during the animation-delay period. 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. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified in the animation-name property in diffe...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
design custom widgets with platform-appropriate styling. it was also used in the xbl implementations of the widgets that ship with the mozilla platform. starting with gecko/firefox 80, these uses were changed to -moz-default-appearance, which should never be used outside of internal stylesheets. compatibility note: if you wish to use this property on websites, you should test it very carefully.
although it is supported in most modern browsers, its implementation varies widely. in older browsers, even the keyword none does not have the same effect on all form elements across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. syntax /* css basic user interface module level 4 values */ appearance: none; appearance: auto; appearance: me...
.../div> chrome safari edge media-play-button div{ color: black; -webkit-appearance: media-play-button; } <div>lorem</div> chrome safari edge media-overlay-play-button div{ color: black; -webkit-appearance: media-overlay-play-button; } <div>lorem</div> chrome safari media-return-to-re
altime-button div{ color: black; -moz-appearance: media-return-to-re
altime-button; -webkit-appearance: media-return-to-re
altime-button; } <div>lorem</div> safari media-rewind-button div{ color: black; -moz-appearance: media-rewind-button; -webkit-appearance: media-rewind-button; } <div>lorem</div> safari media...
border - CSS: Cascading Style Sheets
importantly, border cannot be used to specify a custom value for border-image, but instead sets it to its initial value, i.e., none. the border shorthand is especially useful when you want all four borders to be the same. to make them different from each other, however, you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side.
alternatively, you can target one border at a time with the physical (e.g., border-top ) and logical (e.g., border-block-start) border properties. borders vs. outlines borders and outlines are very similar. however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be...
...u can target one border at a time with the physical (e.g., border-top ) and logical (e.g., border-block-start) border properties. borders vs. outlines borders and outlines are very similar. however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular,
although they usually are. formal definition initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-...
conic-gradient() - CSS: Cascading Style Sheets
r 2-value background-position. the gradient arc is the circumference of the gradient. the starting point of the gradient or arc is north, or 12:00pm. the gradient is then rotated by the from angle. the colors of the gradient are determined by the angled color stops, their starting points, ending points, and, in between, and optional angled color-stop points. the transitions between colors can be
altered with color hints between adjacent colors' color stops. customizing gradients by adding more angled color-stop points on the gradient arc, you can create a highly customized transition between multiple colors. a color-stop's position can be explicitly defined by using an <angle>. if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the ...
...accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign
alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 examples ...
display - CSS: Cascading Style Sheets
essibility css grid layout and progressive enhancement realizing common layouts using grids accessibility concerns display: none using a display value of none on an element will remove it from the accessibility tree. this will cause the element and all its descendant elements to no longer be announced by screen reading technology. if you want to visually hide the element, a more accessible
alternative is to use a combination of properties to remove it visually from the screen but keep it parseable by assistive technology such as screen readers. display: contents current implementations in most browsers will remove from the accessibility tree any element with a display value of contents (but descendants will remain). this will cause the element itself to no longer be announced by scre...
...ntents (but descendants will remain). this will cause the element itself to no longer be announced by screen reading technology. this is incorrect behavior according to the css specification. more accessible markup with display: contents | hidde de vries display: contents is not a css reset | adrian roselli tables changing the display value of a <table> element to block, grid, or flex will
alter its representation in the accessibility tree. this will cause the table to no longer be announced properly by screen reading technology. short note on what css display properties do to table semantics — the paciello group hidden content for better a11y | go make things mdn understanding wcag, guideline 1.3 explanations understanding success criterion 1.3.1 | w3c understanding wcag 2.0 ...
font-variant-caps - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. when a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones. if petite capital glyphs are not available, they are rendered using small capital glyphs. if these are not present, the browser synthesizes them from the uppercase glyphs. ...
... 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. in each case, if the font doesn't support the opentype value, then it synthesizes the glyphs. values normal deactivates of the use of
alternate glyphs. small-caps enables display of small capitals (opentype feature: smcp). 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). petite-caps enables display of petite capitals (opentype feature: pcap). all...
font-variant-east-asian - CSS: Cascading Style Sheets
the font-variant-east-asian css property controls the use of
alternate glyphs for east asian scripts, like japanese and chinese. font-variant-east-asian: normal; font-variant-east-asian: ruby; font-variant-east-asian: jis78; /* <east-asian-variant-values> */ font-variant-east-asian: jis83; /* <east-asian-variant-values> */ font-variant-east-asian: jis90; /* <east-asian-variant-values> */ font-variant-east-asian: jis04; /* <east-asian-variant-values> */ font-variant-east-asian: simplified; /* <east-asian-variant-values> */ font-variant-east-asian: traditional; /* <east-asian-variant-values> */ font-variant-east-asian: full-width; /* <east-asian-width-values> */ font-variant-east-asian: proportional-width; /* <east-asi...
... ruby this keyword forces the use of special glyphs for ruby characters. as these are usually smaller, font creators often designs specific forms, usually slightly bolder to improve the contrast. this keyword corresponds to the opentype values ruby. <east-asian-variant-values> these values specify a set of logographic glyph variants which should be used for display. possible valu...
font-variant-numeric - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...-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. values normal this keyword leads to the deactivation of the use of such
alternate glyphs. ordinal this keyword forces the use of special glyphs for the ordinal markers, like 1st, 2nd, 3rd, 4th in english or a 1a in italian. it corresponds to the opentype values ordn. slashed-zero this keyword forces the use of a 0 with a slash; this is useful when a clear distinction between o and 0 is needed. it corresponds to the opentype values zero. <numeric-figure-values> thes...
<frequency> - CSS: Cascading Style Sheets
. it is not currently used in any css properties. syntax the <frequency> data type consists of a <number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the number. units hz represents a frequency in hertz. examples: 0hz, 1500hz, 10000hz. khz represents a frequency in kilohertz. examples: 0khz, 1.5khz, 10khz. note:
although the number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0hz or 0khz. though the units are case-insensitive, it is good practice to use a capital "h" for hz and khz, as specified in the si. examples valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though...
... 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 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>. specifications specification status comment css values and units module level 3the definition of '<frequency>' in that specification. candidate recommendation initial definition. note: this data type was initially introduced in css level 2 for the now-obsolete aural media type, wh...
repeating-conic-gradient() - CSS: Cascading Style Sheets
ide, the image. the values for the position are similar to the syntax for 2-value background-position. the gradient arc is part of the circumference of the gradient. 0 degress is north, or 12:00pm. the colors of the gradient are determined by the angled color stops, their starting points, ending points, and, in between, and optional angled color-stop points. the transitions between colors can be
altered with color hints between adjacent colors' color stops. customizing gradients by adding more angled color-stop points on the gradient arc, you can create a highly customized transition between multiple colors. a color-stop's position can be explicitly defined by using an <angle>. if you don't specify the location of a color stop, it is placed halfway between the one that precedes it and the ...
...accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. while it is possible to create pie charts, checkerboards, and other effects with conic gradients, css images provide no native way to assign
alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. if the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. mdn understanding wcag, guideline 1.1 explanations understanding success criterion 1.1.1 | w3c understanding wcag 2.0 examples ...
scrollbar-width - CSS: Cascading Style Sheets
m scrollbar width. none no scrollbar shown, however the element will still be scrollable. note: user agents must apply any scrollbar-width value set on the root element to the viewport. accessibility concerns use this property with caution — setting scrollbar-width to thin or none can make content hard or impossible to scroll if the author does not provide an
alternative scrolling mechanism. while swiping gestures or mouse wheels can enable scrolling on such content, some devices have no scroll
alternative. wcag criterion 2.1.1 (keyboard) has been in place for a long time to advise on basic keyboard accessibility, and this should include scrolling of content areas. and introduced in wcag 2.1, criterion 2.5.5 (target size) advises that touch targets shoul...
...ing gestures or mouse wheels can enable scrolling on such content, some devices have no scroll
alternative. wcag criterion 2.1.1 (keyboard) has been in place for a long time to advise on basic keyboard accessibility, and this should include scrolling of content areas. and introduced in wcag 2.1, criterion 2.5.5 (target size) advises that touch targets should be at least 44px in width and height (
although the problem is compounded on high-resolution screens; thorough testing is advised). mdn understanding wcag, 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 boxesinher...
<time> - CSS: Cascading Style Sheets
ss data type represents a time value expressed in seconds or milliseconds. it is used in animation, transition, and related properties. syntax the <time> data type consists of a <number> followed by one of the units listed below. optionally, it may be preceded by a single + or - sign. as with all dimensions, there is no space between the unit literal and the number. note:
although the number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0s or 0ms. units s represents a time in seconds. examples: 0s, 1.5s, -60s. ms represents a time in milliseconds. examples: 0ms, 150.25ms, -60000ms. note: conversion between s and ms follows the logical 1s = 1000ms. examples valid times 12s ...
...d and does not represent 0s or 0ms. units s represents a time in seconds. examples: 0s, 1.5s, -60s. ms represents a time in milliseconds. examples: 0ms, 150.25ms, -60000ms. note: conversion between s and ms follows the logical 1s = 1000ms. examples valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive,
although capital letters are not recommended. +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. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications ...
<transform-function> - CSS: Cascading Style Sheets
anslate3d() translates an element in 3d space. translatex() translates an element horizontally. translatey() translates an element vertically. translatez() translates an element along the z-axis. description various coordinate models can be used to describe an html element's size and shape, as well as any transformations applied to it. the most common is the cartesian coordinate system,
although homogeneous coordinates are also sometimes used. cartesian coordinates in the cartesian coordinate system, a two-dimensional point is described using two values: an x coordinate (abscissa) and a y coordinate (ordinate). this is represented by the vector notation (x, y). in css (and most computer graphics), the origin (0, 0) represents the top-left corner of any element. positive coordin...
... (and most computer graphics), the origin (0, 0) represents the top-left corner of any element. positive coordinates are down and to the right of the origin, while negative ones are up and to the left. thus, a point that's 2 units to the right and 5 units down would be (2, 5), while a point 3 units to the left and 12 units up would be (-3, -12). transformation functions transformation functions
alter the appearance of an element by manipulating the values of its coordinates. a linear transformation function is described using a 2×2 matrix, like this: ac bd the function is applied to an element by using matrix multiplication. thus, each coordinate changes based on the values in the matrix: ac bd xy = ax+cy bx+dy it is even possible to apply several transformation...
vertical-align - CSS: Cascading Style Sheets
entagesrefer to the line-height of the element itselfcomputed valuefor percentage and length values, the absolute length, otherwise the keyword as specifiedanimation typea length formal syntax baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length> examples basic example html <div>an <img src="https://udn.realityripple.com/samples/b4/e1f0faff5b.svg"
alt="link" width="32" height="32" /> image with a default alignment.</div> <div>an <img class="top" src="https://udn.realityripple.com/samples/b4/e1f0faff5b.svg"
alt="link" width="32" height="32" /> image with a text-top alignment.</div> <div>an <img class="bottom" src="https://udn.realityripple.com/samples/b4/e1f0faff5b.svg"
alt="link" width="32" height="32" /> image with a text-bottom alignment.</d...
... recommendation adds the <len...
CSS: Cascading Style Sheets
effective to develop and release recommendations separately per module. instead of versioning the css specification, w3c now periodically takes a snapshot of the latest stable state of the css specification. css introduction if you're new to web development, be sure to read our css basics article to learn what css is and how to use it. css tutorials our css learning area contains a we
alth of tutorials to take you from beginner level to proficiency, covering all the fundamentals. css reference our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutoria...
...o become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials our css learning area features multiple modules that teach css from the ground up — no previous knowledge required. css first steps css (cascading style sheets) is used to style and layout web pages — for example, to
alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css building blocks this module carries on where css first steps left o...
Audio and video manipulation - Developer guides
and repeat. for example, let's process a video to display it in greyscale. in this case, we'll show both the source video and the output greyscale frames. ordinarily, if you were implementing a "play video in greyscale" feature, you'd probably add display: none to the style for the <video> element, to keep the source video from being drawn to the screen while showing only the canvas showing the
altered frames. html we can set up our video player and <canvas> element like this: <video id="my-video" controls="true" width="480" height="270" crossorigin="anonymous"> <source src="https://udn.realityripple.com/samples/5b/8cd6da9c65.webm" type="video/webm"> <source src="https://udn.realityripple.com/samples/6f/08625b424a.m4v" type="video/mp4"> </video> <canvas id="my-canvas" width="480" he...
... var processor = { timercallback: function() { if (this.video.paused || this.video.ended) { return; } this.computeframe(); var self = this; settimeout(function () { self.timercallback(); }, 16); // roughly 60 frames per second }, doload: function() { this.video = document.getelementbyid("my-video"); this.c1 = document.getelementb...
DOM onevent handlers - Developer guides
a given object, you can call its addeventlistener() method, which manages a list of handlers for the given event on the object. a handler can then be removed from the object by calling its removeeventlistener() function. when an event occurs that applies to an element, each of its event handlers is called to allow them to handle the event, one after another. you don't need to call them yourself,
although you can do so in many cases to easily simulate an event taking place. for example, given a button object mybutton, you can do mybutton.onclick(myeventobject) to call the event handler directly. if the event handler doesn't access any data from the event object, you can leave out the event when calling onclick(). this continues until every handler has been called, unless one of the event han...
...o in many cases to easily simulate an event taking place. for example, given a button object mybutton, you can do mybutton.onclick(myeventobject) to call the event handler directly. if the event handler doesn't access any data from the event object, you can leave out the event when calling onclick(). this continues until every handler has been called, unless one of the event handlers explicitly h
alts the processing of the event by calling stoppropagation() on the event object itself. non-element objects event handlers can also be set with properties on non-element objects that generate events, like window, document, xmlhttprequest, and others. for example, for the progress event on instances of xmlhttprequest: const xhr = new xmlhttprequest(); xhr.onprogress = function() { … }; html on...
Index - Developer guides
he mozilla engine exposes live changes in a document. 6 audio and video delivery audio, guide, html, html5, media, video whether we are dealing with pre-recorded audio files or live streams, the mechanism for making them available through the browser's <audio> and <video> elements remains pretty much the same. currently, to support all browsers we need to specify two formats,
although with the adoption of mp3 and mp4 formats in firefox and opera, this is changing fast. you can find compatibility information in the guide to media types and formats on the web. 7 adding captions and subtitles to html5 video html5, media, webvtt, captions, subtitles, track in other articles we looked at how to build a cross browser video player using the htmlmediaelement ...
... a hybrid approach mobile, responsive design, web development no approach is a one-size-fits-all solution. web applications that want to heavily modify the content or user flow for mobile users should probably go for a separate mobile site. content-oriented pages that don’t need to modify their content for mobile users will be satisfied with responsive design. if you need to slightly
alter the site’s message for mobile users, but want to reap the benefits of a responsive design, a hybrid approach may be your best bet. decisions like these are at the heart of mobile web development: be specific about what you would like to accomplish, and pick a practical approach while being aware of the tradeoffs. good luck! 34 mobile-friendliness mobile, web development m...
A hybrid approach - Developer guides
nt-side techniques can be combined to fit your situation. the good responsive web design is great — right now it is the best technique available for making layouts look as good as possible in a variety of circumstances. if your mobile and desktop use cases are similar enough, this is definitely the preferred option for layout changes. however, it can be a pain to use client-side techniques to
alter site content to fit the user’s context. luckily, we aren’t technically constrained to using client-side techniques here: another option is to use server-side user-agent detection to show the user the proper content. 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...
...ibe to the mozilla webdev blog for updates about our progress. summary no approach is a one-size-fits-all solution. web applications that want to heavily modify the content or user flow for mobile users should probably go for a separate mobile site. content-oriented pages that don’t need to modify their content for mobile users will be satisfied with responsive design. if you need to slightly
alter the site’s message for mobile users, but want to reap the benefits of a responsive design, a hybrid approach may be your best bet. decisions like these are at the heart of mobile web development: be specific about what you would like to accomplish, and pick a practical approach while being aware of the tradeoffs. good luck! approaches to mobile web development see the following articles for...
Parsing and serializing XML - Developer guides
hr.open("get", "example.xml"); xhr.responsetype = "document"; xhr.send(); the value returned in the xhr object's responsexml field is a document constructed by parsing the xml. if the document is html, the code shown above will return a document. if the document is xml, the resulting object is actually a xmldocument. the two types are essentially the same; the difference is largely historical,
although differentiating has some practical benefits as well. note: there is in fact an htmldocument interface as well, but it is not necessarily an independent type. in some browsers it is, while in others it is simply an alias for the document interface. serializing an xml document given a document, you can serialize the document's dom tree back into xml using the xmlserializer.serializetostri...
...for the document interface. serializing an xml document given a document, you can serialize the document's dom tree back into xml using the xmlserializer.serializetostring() method. use the following approaches to serialize the contents of the xml document you created in the previous section. serializing dom trees to strings first, create a dom tree as described in how to create a dom tree.
alternatively, use a dom tree obtained from xmlhttprequest. to serialize the dom tree doc into xml text, call xmlserializer.serializetostring(): var oserializer = new xmlserializer(); var sxml = oserializer.serializetostring(doc); serializing html documents if the dom you have is an html document, you can serialize using serializetostring(), but there is a simpler option: just use the element.inn...
<area> - HTML: Hypertext Markup Language
any element that accepts phrasing content. the <area> element must have an ancestor <map>, but it need not be a direct parent. implicit aria role link when href attribute is present, otherwise no corresponding role permitted aria roles no role permitted dom interface htmlareaelement attributes this element's attributes include the global attributes.
alt a text string
alternative to display on browsers that do not display images. the text should be phrased so that it presents the user with the same kind of choice as the image would offer when displayed without the
alternative text. this attribute is required only if the href attribute is used. coords a set of values specifying the coordinates of the hot-spot region. the number and meaning o...
...alue specifying the position of the defined area in the browser tabbing order. this attribute is global in html5. type no effect. browsers ignore it. (the w3c 5.3 fork of the html specification defines it as valid, but the canonical html specification doesn’t, and it has no effect in any user agents.) examples <map name="primary"> <area shape="circle" coords="75,75,75" href="left.html"
alt="click to go left"> <area shape="circle" coords="275,75,75" href="right.html"
alt="click to go right"> </map> <img usemap="#primary" src="https://udn.realityripple.com/samples/6a/7e559101b3.png"
alt="350 x 150 pic"> result specifications specification status comment referrer policythe definition of 'referrerpolicy attribute' in that specification. candidate r...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
the details — that is, the contents of the <details> element — are currently visible. the default, false, means the details are not visible. events in addition to the usual events supported by html elements, the <details> element supports the toggle event, which is dispatched to the <details> element whenever its state changes between open and closed. it is sent after the state is changed,
although if the state changes multiple times before the browser can dispatch the event, the events are coalesced so that only one is sent. you can use an event listener for the toggle event to detect when the widget changes state: details.addeventlistener("toggle", event => { if (details.open) { /* the element was toggled open */ } else { /* the element was toggled closed */ } }); ex...
... reveal its contents. html <details> <summary>system requirements</summary> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term storage. an input device as well as some form of output device is recommended.</p> </details> result customizing the disclosure widget the disclosure triangle itself can be customized,
although this is not as broadly supported. there are variations in how browsers support this customization due to experimental implementations as the element was standardized, so we'll have to use multiple approaches for a while. the <summary> element supports the list-style shorthand property and its longhand properties, such as list-style-type, to change the disclosure triangle to whatever you cho...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
element is excluded from the main outline of the document. a caption can be associated with the <figure> element by inserting a <figcaption> inside it (as the first or the last child). the first <figcaption> element found in the figure is presented as the figure's caption. ...
...s the first or the last child). the first <figcaption> element found in the figure is presented as the figure's caption. ...
<header> - HTML: Hypertext Markup Language
r region permitted aria roles group, presentation or none dom interface htmlelement usage notes the <header> element is not sectioning content and therefore does not introduce a new section in the outline. that said, a <header> element is intended to usually contain the surrounding section's heading (an h1–h6 element), but this is not required. historical usage
although the <header> element didn't make its way into specifications until html5, it actually existed at the very beginning of html. as seen in the very first website, it was originally used as the <head> element. at some point, it was decided to use a different name. this allowed <header> to be free to fill a different role later on. attributes this element only includes the global attributes. e...
...ally existed at the very beginning of html. as seen in the very first website, it was originally used as the <head> element. at some point, it was decided to use a different name. this allowed <header> to be free to fill a different role later on. attributes this element only includes the global attributes. ...
<input type="radio"> - HTML: Hypertext Markup Language
color: #999; } button:active { background-color: white; color: black; outline: 1px solid black; } most notable here is the use of the -moz-appearance property (with prefixes needed to support some browsers). by default, radio buttons (and checkboxes) are styled with the operating system's native styles for those controls. ...
...in older browsers, even the keyword none does not have the same effect across different browsers, and some do not support it at all. the differences are smaller in the newest browsers. ...
<input type="range"> - HTML: Hypertext Markup Language
fox only. orient similar to the -moz-orient non-standard css property impacting the <progress> and <meter> elements, the orient attribute defines the orientation of the range slider. values include horizontal, meaing the range is rendered horizontally, and vertical, where the range is rendered vertically. note: the following input attributes do not apply to the input range: accept,
alt, checked, dirname, formaction, formenctype, formmethod, formnovalidate, formtarget, height, maxlength, minlength, multiple, pattern, placeholder, readonly, required, size, src, and width. any of these attributes, if included, will be ignored. examples while the number type lets users enter a number with optional constraints forcing their value to be between a minimum and a maximum value, it do...
...put[type="range"] { -webkit-appearance: slider-vertical; } orient attribute in firefox only, there is a non-standard orient property. html use similar html as in the previous examples, we add the attribute with a value of vertical: <input type="range" min="0" max="11" value="7" step="1" orient="vertical"> writing-mode: bt-lr; the writing-mode property should generally not be used to
alter text direction for internationalization or localization purposes, but can be used for special effects. html we use the same html as in the previous examples: <input type="range" min="0" max="11" value="7" step="1"> css we target just the inputs with a type of range, changing the writing mode from the default to bt-lr, or bottom-to-top and left-to-right: input[type="range"] { writing-m...
<input type="search"> - HTML: Hypertext Markup Language
g search terms. they are basically equivalent in behavior, but user agents may choose to style them differently by default (and, of course, sites may use stylesheets to apply custom styles to them). basic example <form> <div> <input type="search" id="mysearch" name="q"> <button>search</button> </div> </form> this renders like so: q is the most common name given to search inputs,
although it's not mandatory. when submitted, the data name/value pair sent to the server will be q=searchterm. you must remember to set a name for your input, otherwise nothing will be submitted. differences between search and text types the main basic differences come in the way browsers handle them. the first thing to note is that some browsers show a cross icon that can be clicked on to remov...
... this could, however, cause confusion for screenreader users, since they will not have any verbal indication of what the search input is. one way around this that won't impact on your visual design is to use ...
<input type="submit"> - HTML: Hypertext Markup Language
ther details. here's the previous example with the s access key added: <form> <div> <label for="example">let's submit some text</label> <input id="example" type="text" name="text"> </div> <div> <input type="submit" value="send" accesskey="s"> </div> </form> for example, in firefox for mac, pressing control-option-s triggers the send button, while chrome on windows uses
alt+s. the problem with the above example is that the user will not know what the access key is! this is especially true since the modifiers are typically non-standard to avoid conflicts. when building a site, be sure to provide this information in a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site acces...
...s key is! this is especially true since the modifiers are typically non-standard to avoid conflicts. when building a site, be sure to provide this information in a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are). adding a tooltip to the button (using the title attribute) can also help,
although it's not a complete solution for accessibility purposes. disabling and enabling a submit button to disable a submit button, simply specify the disabled global attribute on it, like so: <input type="submit" value="disabled" disabled> you can enable and disable buttons at run time by simply setting disabled to true or false; in javascript this looks like btn.disabled = true or btn.disabl...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. ...
...le. nesting a <samp> element inside a <kbd> element, on the other hand, represents input which is based on text presented by the system, such as the names of menus and menu items, or the names of buttons displayed on the screen. see the example under representing onscreen input options below. you can define a custom style to override the browser's default font selection for the <kbd> element,
although the user's preferences may potentially override your css. examples basic example <p>use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> representing keystrokes within an input to describe an input comprised of multiple keystrokes, you can nest multiple <kbd> elements, with an outer <kbd> element representing the overall input and each ind...
<noframes>: The Frame Fallback element - HTML: Hypertext Markup Language
the obsolete html no frames or frame fallback element, <noframes>, provides content to be presented in browsers that don't support (or have disabled support for) the <frame> element.
although most commonly-used browsers support frames, there are exceptions, including certain special-use browsers including some mobile browsers, as well as text-mode browsers. 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. ...
... as text-mode browsers. 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. <noframes> can be used to present a message explaining that the user's browser doesn't support frames, but ideally should be used to present an
alternate form of the site that doesn't use frames but still offers the same or similar functionality. in html 5 and later, <noframes> is obsolete and shouldn't be used, since the <frame> and <frameset> elements are also obsolete. when frames are needed at all, they should be presented using the <iframe> element. attributes like all other html elements, this element supports the global attribute...
<small>: the side comment element - HTML: Hypertext Markup Language
ment that accepts phrasing content, or any element that accepts flow content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. examples basic usage <p>this is the first sentence. <small>this whole sentence is in small letters.</small> </p> css
alternative <p>this is the first sentence. <span style="font-size:0.8em">this whole sentence is in small letters.</span> </p> specifications specification status comments html living standardthe definition of '<small>' in that specification. living standard html5the definition of '<small>' in that specification. recommendation html...
... letters.</span> </p> specifications specification status comments html living standardthe definition of '<small>' in that specification. living standard html5the definition of '<small>' in that specification. recommendation html 4.01 specificationthe definition of '<small>' in that specification. recommendation notes
although the <small> element, like the <b> and <i> elements, may be perceived to violate the principle of separation between structure and presentation, all three are valid in html5. authors are encouraged to use their best judgement when determining whether to use <small> or css. ...
<sub>: The Subscript element - HTML: Hypertext Markup Language
nterface htmlelement attributes this element only includes the global attributes. usage notes the <sub> element should be used only for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. for example, using <sub> to style the name of a company which uses
altered baselines in their wordmark would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote numbers. see footnote numbers for an example. marking up the subscript in ...
...k would not be appropriate; instead, css should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. appropriate use cases for <sub> include (but aren't necessarily limited to): marking up footnote numbers. see footnote numbers for an example. marking up the subscript in mathematical variable numbers (
although you may also consider using a mathml formula for this). see variable subscripts. denoting the number of atoms of a given element within a chemical formula (such as every developer's best friend, c8h10n4o2, otherwise known as "caffeine"). see chemical formulas. examples footnote numbers traditional footnotes are denoted using numbers which are rendered in subscript. this is a common use ...
<table>: The Table element - HTML: Hypertext Markup Language
ents) only; rows, which will cause the rules to be displayed between rows; columns, which will cause the rules to be displayed between columns; all, which will cause the rules to be displayed between rows and columns. to achieve a similar effect, apply the border property to the appropriate <thead>, <tbody>, <tfoot>, <col>, or <colgroup> elements. summary this attribute defines an
alternative text that summarizes the content of the table. use the <caption> element instead. width this attribute defines the width of the table. use the css width property instead. examples simple table <table> <tr> <td>john</td> <td>doe</td> </tr> <tr> <td>jane</td> <td>doe</td> </tr> </table> more examples <p>simple table with header</p> <table> <tr> ...
...ttribute to associate header cells and data cells in data tables | w3c techniques for wcag 2.0 complicated tables assistive technology such as screen readers may have difficulty parsing tables that are so complex that header cells can’t be associated in a strictly horizontal or vertical way. this is typically indicated by the presence of the colspan and rowspan attributes. ideally, consider
alternate ways to present the table's content, including breaking it apart into a collection of smaller, related tables that don't have to rely on using the colspan and rowspan attributes. in addition to helping people who use assistive technology understand the table's content, this may also benefit people with cognitive concerns who may have difficulty understanding the associations the table layou...
<tr>: The Table Row element - HTML: Hypertext Markup Language
within the <thead> so they have a light blue background color. this is a way to quickly apply a background color to all of the cells in the heading area at once. this does not affect the style of the <th> elements in the first column, though, where we treat the member names as a row heading. advanced styling now we'll go all-out, with styles on rows in the header and body areas both, including
alternating row colors, cells with different colors depending on position within a row, and so forth. result here's what the final table will look like: there is no change to the html again. see what proper preparation of your html can do for you? <table> <thead> <tr> <th rowspan="2">name</th> <th rowspan="2">id</th> <th colspan="2">membership dates</th> <th rowsp...
...); } thead > tr:last-of-type > th:nth-of-type(2) { background-color: rgb(255, 225, 225); } here we dig into the last row of the table's header block and give the first header cell in it (the "joined" header) a greenish color, and the second header cell in it (the "canceled" header) a reddish hue. color every body other row differently it's common to help improve readability of table data by
alternating row colors. let's add a bit of color to every even row: tbody > tr:nth-of-type(even) { background-color: rgb(237, 238, 242); } give the left-side header some style since we want the first column to stand out as well, we'll add some custom styling here, too. tbody > tr > th:first-of-type { text-align: left; background-color: rgb(225, 229, 244); } this styles the first header cel...
itemprop - HTML: Hypertext Markup Language
mbed external resources. three properties with values that are strings <div itemscope> <p>my name is <span itemprop="name">neil</span>.</p> <p>my band is called <span itemprop="band">four parts water</span>.</p> <p>i am <span itemprop="nationality">british</span>.</p> </div> one property, "image", whose value is a url <div itemscope> <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). an item with a property whose value is a product id ...
...sed the human-visible text instead of the id. <h1 itemscope> <data itemprop="product-id" value="9678aou879">the instigator 2000</data> </h1> for numeric data, the meter element and its value attribute can be used. a meter element <div itemscope itemtype="http://schema.org/product"> <span itemprop="name">panasonic white 60l refrigerator</span> <img src="panasonic-fridge-60l-white.jpg"
alt=""> <div itemprop="aggregaterating" itemscope itemtype="http://schema.org/aggregaterating"> <meter itemprop="ratingvalue" min=0 value=3.5 max=5>rated 3.5/5</meter> (based on <span itemprop="reviewcount">11</span> customer reviews) </div> </div> similarly, for date- and time-related data, the time element and its datetime attribute can be used. an item with...
itemscope - HTML: Hypertext Markup Language
rop="aggregaterating" itemscope itemtype="http://schema.org/aggregaterating"> <span itemprop="ratingvalue">4.0</span> stars based on <span itemprop="reviewcount">35</span> reviews </span> <br> prep time: <time datetime="pt30m" itemprop="preptime">30 min</time><br> cook time: <time datetime="pt1h" itemprop="cooktime">1 hou</time>r<br> total time: <time datetime="pt1h30m" itemprop="tot
altime">1 hour 30 min</time><br> yield: <span itemprop="recipeyield">1 9" pie (8 servings)</span><br> <span itemprop="nutrition" itemscope itemtype="http://schema.org/nutritioninformation"> serving size: <span itemprop="servingsize">1 medium slice</span><br> calories per serving: <span itemprop="calories">250 cal</span><br> fat per serving: <span itemprop="fatcontent">12 g</span><br> ...
... itemprop name grandma's holiday apple pie itemprop image https://c1.staticflickr.com/1/30/42759561_8631e2f905_n.jpg itemprop datepublished 2009-11-05 itemprop description this is my grandmother's apple pie recipe. i like to add a dash of nutmeg. itemprop preptime pt30m itemprop cooktime pt1h itemprop tot
altime pt1h30m itemprop recipeyield 1 9" pie (8 servings) itemprop recipeingredient thinly-sliced apples: 6 cups itemprop recipeingredient white sugar: 3/4 cup itemprop recipeinstructions 1. cut and peel apples 2. mix sugar and cinnamon. use additional sugar for tart apples . itemprop author [person] itemprop name ...
HTML documentation index - HTML: Hypertext Markup Language
the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. 165 <noembed>: the embed fallback element (obsolete) element, embedded content, embedding, html, non-standard, obsolete, reference, noembed the <noembed> element is an obsolete, non-standard way to provide
alternative, or "fallback", content for browsers that do not support the <embed> element or do not support the type of embedded content an author wishes to use. 166 <noframes>: the frame fallback element element, frames, html, html frames, obsolete, reference, web, noframes the obsolete html no frames or frame fallback element, <noframes>, provides content to be presented in brow...
...he object parameter element element, html, html embedded content, reference, web the html <param> element defines parameters for an <object> element. 175 <picture>: the picture element element, graphics, html, html embedded content, images, reference, web, webp, picture the html <picture> element contains zero or more <source> elements and one <img> element to offer
alternative versions of an image for different display/device scenarios. 176 <plaintext>: the plain text element (deprecated) element, html, obsolete, plain text, reference, web, plaintext the html plaintext element (<plaintext>) renders everything following the start tag as raw text, ignoring any following html. 177 <pre>: the preformatted text element element, ht...
Inline elements - HTML: Hypertext Markup Language
here are the basic conceptual differences between inline and block-level elements: content model generally, inline elements may contain only data and other inline elements. you can't put block elements inside inline elements. formatting by default, inline elements do not force a new line to begin in the document flow. ...
... may contain only data and other inline elements. you can't put block elements inside inline elements. formatting by default, inline elements do not force a new line to begin in the document flow. block elements, on the other hand, typically cause a line break to occur (
although, as usual, this can be changed using css). ...
Using the application cache - HTML: Hypertext Markup Language
t file has changed, all the files listed in the manifest—as well as those added to the cache by calling applicationcache.add()—are fetched into a temporary cache, following the appropriate http caching rules. for each file fetched into this temporary cache, the browser sends a progress event to the applicationcache object. if any errors occur, the browser sends an error event, and the update h
alts. once all the files have been successfully retrieved, they are moved into the real offline cache automatically, and a cached event is sent to the applicationcache object. since the document has already been loaded into the browser from the cache, the updated document will not be rendered until the document is reloaded (either manually or programatically). storage location and clearing the off...
...lecting "clear browsing data..." in the preferences or by visiting chrome://appcache-internals/. safari has a similar "empty cache" setting in its preferences but a browser restart may also be required. in firefox, the offline cache data is stored separately from the firefox profile—next to the regular disk cache: windows vista/7: c:\users\<username>\appdata\local\mozilla\firefox\profiles\<s
alt>.<profile name>\offlinecache mac/linux: /users/<username>/library/caches/firefox/profiles/<s
alt>.<profile name>/offlinecache in firefox the current status of the offline cache can be inspected on the about:cache page (under the "offline cache device" heading). the offline cache can be cleared for each site separately using the "remove..." button in tools -> options -> advanced -> network -> of...
Microformats - HTML: Hypertext Markup Language
person or organization h-entry describes episodic or date stamped online content like a blog post h-feed describes a stream or feed of posts you can find many more vocabularies on the microformats2 wiki. "p-*" for plain (text) properties, e.g. "p-name", "p-summary" generic plain text parsing, element text in general. on certain html elements, use special attributes first, e.g. img/
alt, abbr/title. "u-*" for url properties, e.g. "u-url", "u-photo", "u-logo" special parsing: element attributes a/href, img/src, object/data etc. attributes over element contents. "dt-*" for datetime properties, e.g. "dt-start", "dt-end", "dt-bday" special parsing: time element datetime attribute, value-class-pattern and separate date time value parsing for readability. "e-*" ...
...e-" prefix can also be mnemonically remembered as "element tree", "embedded markup", or "encapsulated markup". some microformats examples h-card the h-card microformat represents a a person or organization. ...
Data URLs - HTTP
ing only in ascii characters, base64 strings are generally url-safe, and that's why they can be used to encode data in data urls. encoding in javascript the web apis have native methods to encode or decode to base64: base64 encoding and decoding. encoding on a unix system base64 encoding of a file or string on linux and mac os x systems can be achieved using the command-line base64 (or, as an
alternative, the uuencode utility with -m argument). echo -n hello|base64 # outputs to console: agvsbg8= echo -n hello>a.txt base64 a.txt # outputs to console: agvsbg8= base64 a.txt>b.txt # outputs to file b.txt: agvsbg8= encoding on microsoft windows encoding on windows can be done through powershell or some dedicated tool. it can even be done via bash base64 utility (see section encoding on a...
...ore the "data" segment, or to incorrectly encode the data into base64 format. formatting in html a data url provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. as a url, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. length limitations
although firefox supports data urls of essentially unlimited length, browsers are not required to support any particular maximum length of data. for example, the opera 11 browser limited urls to 65535 characters long which limits data urls to 65529 characters (65529 characters being the length of the encoded data, not the source, if you use the plain data:, without specifying a mime type). lack of e...
MIME types (IANA media types) - HTTP
ext/plain. the css mime type text/css must be used. text/css css files used to style a web page must be sent with text/css. if a server doesn't recognize the .css suffix for css files, it may send them with text/plain or application/octet-stream mime types. if so, they won't be recognized as css by most browsers and will be ignored. text/html all html content should be served with this type.
alternative mime types for xhtml (like application/xhtml+xml) are mostly useless nowadays. note: use application/xml or application/xhtml+xml if you want xml’s strict parsing rules, <![cdata[…]]> sections, or elements that aren't from html/svg/mathml namespaces. text/javascript per the html specification, javascript files should always be served using the mime type text/javascript. no other ...
...eo codecs; vorbis and opus the most common audio codecs. audio/ogg an audio file in the ogg container format. vorbis is the most common audio codec used in such a container; however, opus is now supported by ogg as well. video/ogg a video file, possibly with audio, in the ogg container format. theora is the usual video codec used within it; vorbis is the usual audio codec,
although opus is becoming more common. application/ogg an audio or video file using the ogg container format. theora is the usual video codec used within it; vorbis is the usual audio codec. multipart/form-data the multipart/form-data type can be used when sending the values of a completed html form from browser to server. as a multipart document format, it consists of different ...
Configuring servers for Ogg media - HTTP
int value. for example, if the video is 1 minute and 32.6 seconds long, this header would be: x-content-duration: 92.6 if your server provides the x-content-duration header when serving ogg media, gecko doesn't have to do any extra http requests to seek to the end of the file to calculate its duration. this makes the entire process much more efficient as well as more accurate. ...
...your server should be configured to not do so. ...
Connection management in HTTP/1.x - HTTP
son to use this model. persistent connections short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underlying tcp connection gets better only when this connection has been in use for some time (warm connection). to ease these problems, the concept of a persistent connection has been designed, even prior to http/1.1.
alternatively this may be called a keep-alive connection. a persistent connection is one which remains open for a period of time, and can be reused for several requests, saving the need for a new tcp handshake, and utilizing tcp's performance enhancing capabilities. this connection will not stay open forever: idle connections are closed after some time (a server may use the keep-alive header to spec...
...equest is seen by the server. pipelining is the process to send successive requests, over the same persistent connection, without waiting for the answer. this avoids latency of the connection. theoretically, performance could also be improved if two http requests were to be packed into the same tcp message. the typical mss (maximum segment size), is big enough to contain several simple requests,
although the demand in size of http requests continues to grow. not all types of http requests can be pipelined: only idempotent methods, that is get, head, put and delete, can be replayed safely: should a failure happen, the pipeline content can simply be repeated. today, every http/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant re...
Forwarded - HTTP
the forwarded header contains information from the reverse proxy servers that is
altered or lost when a proxy is involved in the path of the request. the
alternative and de-facto standard versions of this header are the x-forwarded-for, x-forwarded-host and x-forwarded-proto headers. this header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the ip address of the client. therefore the user's privacy must be kept in mind when deploying this header. ...
...xposes privacy sensitive information, such as the ip address of the client. therefore the user's privacy must be kept in mind when deploying this header. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is
altered or lost when using a proxy. this can be either: an ip address (v4 or v6, optionally with a port, and ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made). by=<identifier> the interface where the request c...
HTTP headers - HTTP
rmation content-length the size of the resource, in decimal number of bytes. content-type indicates the media type of the resource. content-encoding used to specify the compression algorithm. content-language describes the human language(s) intended for the audience, so that it allows a user to differentiate according to the users' own preferred language. content-location indicates an
alternate location for the returned data. proxies forwarded contains information from the client-facing side of proxy servers that is
altered or lost when a proxy is involved in the path of the request. x-forwarded-for identifies the originating ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host req...
...bsocket-protocol ... sec-websocket-version ... other accept-push-policy a client can express the desired push policy for a request by sending an accept-push-policy header field in the request. accept-signature a client can send the accept-signature header field to indicate intention to take advantage of any available signatures and to indicate what kinds of signatures it supports.
alt-svc used to list
alternate ways to reach this service. date contains the date and time at which the message was originated. large-allocation tells the browser that the page being loaded is going to want to perform a large allocation. link the link entity-header field provides a means for serialising one or more links in http headers. it is semantically equivalent to the html <link> element...
An overview of HTTP - HTTP
are numerous entities, collectively called proxies, which perform different operations and act as gateways or caches, for example. in reality, there are more computers between a browser and the server handling the request: there are routers, modems, and more. thanks to the layered design of the web, these are hidden in the network and transport layers. http is on top, at the application layer.
although important to diagnose network problems, the underlying layers are mostly irrelevant to the description of http. client: the user-agent the user-agent is any tool that acts on the behalf of the user. this role is primarily performed by the web browser; other possibilities are programs used by engineers and web developers to debug their applications. the browser is always the entity initiat...
...s and machines relay the http messages. due to the layered structure of the web stack, most of these operate at the transport, network or physical levels, becoming transparent at the http layer and potentially making a significant impact on performance. those operating at the application layers are generally called proxies. these can be transparent, forwarding on the requests they receive without
altering them in any way, or non-transparent, in which case they will change the request in some way before passing it along to the server. 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 (t...
Redirections in HTTP - HTTP
ale), and 300 (multiple choice) is a manual redirection: the body, presented by the browser as a web page, lists the possible redirections and the user clicks on one to select it. code text typical use case 300 multiple choice not many: the choices are listed in an html page in the body. machine-readable choices are encouraged to be sent as link headers with rel=
alternate. 304 not modified sent for revalidated conditional requests. indicates that the cached response is still fresh and can be used.
alternative way of specifying redirections http redirects aren't the only way to define redirections. there are two others: html redirections with the <meta> element javascript redirections via the dom html redirections http redirects ...
...rgets to change the html redirects, the redirects will no longer be identical, which could cause an infinite loop or other nightmares. use cases there are numerous use cases for redirects, but as performance is impacted with every redirect, their use should be kept to a minimum. domain aliasing ideally, there is one location, and therefore one url, for each resource. but there are reasons for
alternative names for a resource: expanding the reach of your site a common case is when a site resides at www.example.com, but accessing it from example.com should also work. redirections for example.com to www.example.com are thus set up. you might also redirect from common synonyms or frequent typos of your domains. moving to a new domain for example, your company was renamed, but you want e...
A typical HTTP session - HTTP
ine feed), divided into three blocks: the first line contains a request method followed by its parameters: the path of the document, i.e. an absolute url without the protocol or domain name the http protocol version subsequent lines represent an http header, giving the server information about what type of data is appropriate (e.g., what language, what mime types), or other data
altering its behavior (e.g., not sending an answer if it is already cached). these http headers form a block which ends with an empty line. the final block is an optional data block, which may contain further data mainly used by the post method. example requests fetching the root page of developer.mozilla.org, i.e. http://developer.mozilla.org/, and telling the server that the user-agent would pr...
...st the moment it receives this empty line. for example, sending the result of a form: post /contact_form.php http/1.1 host: developer.mozilla.org content-length: 64 content-type: application/x-www-form-urlencoded name=joe%20user&request=send%20me%20one%20of%20your%20catalogue request methods http defines a set of request methods indicating the desired action to be performed upon a resource.
although they can also be nouns, these requests methods are sometimes referred as http verbs. the most common requests are get and post: the get method requests a data representation of the specified resource. requests using get should only retrieve data. the post method sends data to a server so it may change its state. this is the method often used for html forms. structure of a server respon...
Functions - JavaScript
ue was fixed by assigning the value in this to a variable that could be closed over. function person() { var self = this; // some choose `that` instead of `self`. // choose one and be consistent. self.age = 0; setinterval(function growup() { // the callback refers to the `self` variable of which // the value is the expected object. self.age++; }, 1000); }
alternatively, a bound function could be created so that the proper this value would be passed to the growup() function. an arrow function does not have its own this; the this value of the enclosing execution context is used. thus, in the following code, the this within the function that is passed to setinterval has the same value as this in the enclosing function: function person() { this.age = ...
...) the uneval() method creates a string representation of the source code of an object. isfinite() the global isfinite() function determines whether the passed value is a finite number. if needed, the parameter is first converted to a number. isnan() the isnan() function determines whether a value is nan or not. note: coercion inside the isnan function has interesting rules; you may
alternatively want to use number.isnan(), as defined in ecmascript 2015, or you can use typeof to determine if the value is not-a-number. parsefloat() the parsefloat() function parses a string argument and returns a floating point number. parseint() the parseint() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems). ...
Indexed collections - JavaScript
// this is equivalent to: let arr = [] arr.length = 42 calling array(n) results in a rangeerror, if n is a non-whole number whose fractional portion is non-zero. the following example illustrates this behavior. let arr = array(9.3) // rangeerror: invalid array length if your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals.
alternatively, create an empty array first before adding the single element to it. in es2015, you can use the array.of static method to create arrays with single element. let wisenarray = array.of(9.3) // wisenarray contains only one element 9.3 referring to array elements because elements are also properties, you can access the using property accessors. suppose you define the following array: ...
...cess div in some way */ } this avoids the overhead of checking the length of the array, and ensures that the div variable is reassigned to the current item each time around the loop for added convenience. the foreach() method provides another way of iterating over an array: let colors = ['red', 'green', 'blue'] colors.foreach(function(color) { console.log(color) }) // red // green // blue
alternatively, you can shorten the code for the foreach parameter with es2015 arrow functions: let colors = ['red', 'green', 'blue'] colors.foreach(color => console.log(color)) // red // green // blue the function passed to foreach is executed once for every item in the array, with the array item passed as the argument to the function. unassigned values are not iterated in a foreach loop. note th...
Regular expressions - JavaScript
ociated regular expression object and also of the predefined regular expression object, regexp. if the match fails, the exec() method returns null (which coerces to false). in the following example, the script uses the exec() method to find a match in a string. var myre = /d(b+)d/g; var myarray = myre.exec('cdbbdbsbz'); if you do not need to access the properties of the regular expression, an
alternative way of creating myarray is with this script: var myarray = /d(b+)d/g.exec('cdbbdbsbz'); // similar to "cdbbdbsbz".match(/d(b+)d/g); however, // "cdbbdbsbz".match(/d(b+)d/g) outputs array [ "dbbd" ], while // /d(b+)d/g.exec('cdbbdbsbz') outputs array [ 'dbbd', 'bb', index: 1, input: 'cdbbdbsbz' ]. (see different behaviors for further info about the different behaviors.) if ...
...b+)d/g.exec('cdbbdbsbz'); // similar to "cdbbdbsbz".match(/d(b+)d/g); however, // "cdbbdbsbz".match(/d(b+)d/g) outputs array [ "dbbd" ], while // /d(b+)d/g.exec('cdbbdbsbz') outputs array [ 'dbbd', 'bb', index: 1, input: 'cdbbdbsbz' ]. (see different behaviors for further info about the different behaviors.) if you want to construct the regular expression from a string, yet another
alternative is this script: var myre = new regexp('d(b+)d', 'g'); var myarray = myre.exec('cdbbdbsbz'); with these scripts, the match succeeds and returns the array and updates the properties shown in the following table. results of regular expression execution. object property or index description in this example myarray the matched string and all remembere...
Working with objects - JavaScript
e prototype chain which are not accessible through the object, because another property has the same name earlier in the prototype chain). listing accessible properties only can easily be done by removing duplicates in the array. creating new objects javascript has a number of predefined objects. in addition, you can create your own objects. you can create an object using an object initializer.
alternatively, you can first create a constructor function and then instantiate an object invoking that function in conjunction with the new operator. using object initializers in addition to creating objects using a constructor function, you can create objects using an object initializer. using object initializers is sometimes referred to as creating objects with literal notation. "object initiali...
...nly if the expression cond is true: if (cond) var x = {greeting: 'hi there'}; the following example creates myhonda with three properties. note that the engine property is also an object with its own properties. var myhonda = {color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}}; you can also use object initializers to create arrays. see array literals. using a constructor function
alternatively, you can create an object with these two steps: define the object type by writing a constructor function. there is a strong convention, with good reason, to use a capital initial letter. create an instance of the object with new. to define an object type, create a function for the object type that specifies its name, properties, and methods. for example, suppose you want to create...
Warning: expression closures are deprecated - JavaScript
what went wrong? the non-standard expression closure syntax (shorthand function syntax) is deprecated and shouldn't be used anymore. this syntax will be removed entirely in bug 1083458 and scripts using it will throw a syntaxerror then. ...
...function declarations or from method definitions in objects. var x = function() 1; var obj = { count: function() 1 }; standard syntax to convert the non-standard expression closures syntax to standard ecmascript syntax, you can add curly braces and return statements. ...
SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead - JavaScript
mas is deprecated. use //# instead" occurs when there is a deprecated source map syntax in a javascript source. message warning: syntaxerror: using //@ to indicate sourceurl pragmas is deprecated. use //# instead warning: syntaxerror: using //@ to indicate sourcemappingurl pragmas is deprecated. use //# instead error type a warning that a syntaxerror occurred. javascript execution won't be h
alted. what went wrong? there is a deprecated source map syntax in a javascript source. javascript sources are often combined and minified to make delivering them from the server more efficient. with source maps, the debugger can map the code being executed to the original source files. the source map specification changed the syntax due to a conflict with ie whenever it was found in the page aft...
... jscript engine. ...
arguments.callee - JavaScript
urns a factorial function. this example isn't very practical, and there are nearly no cases where the same result cannot be achieved with named function expressions. ...
...there are nearly no cases where the same result cannot be achieved with named function expressions. ...
Array.prototype.map() - JavaScript
ment, the index of the element, and the array object being mapped. if a thisarg parameter is provided, it will be used as callback's this value. otherwise, the value undefined will be used as its this value. the this value ultimately observable by callback is determined according to the usual rules for determining the this seen by a function. map does not mutate the array on which it is called (
although callback, if invoked, may do so). the range of elements processed by map is set before the first invocation of callback. elements which are appended to the array after the call to map begins will not be visited by callback. if existing elements of the array are changed, their value as passed to callback will be the value at the time map visits them. elements that are deleted after the call ...
... mapped array contains undefined when undefined or nothing is returned: let numbers = [1, 2, 3, 4] let filterednumbers = numbers.map(function(num, index) { ...
Array.prototype.push() - JavaScript
n array. push is intentionally generic. this method can be used with call() or apply() on objects resembling arrays. the push method relies on a length property to determine where to start inserting the given values. if the length property cannot be converted into a number, the index used is 0. this includes the possibility of length being nonexistent, in which case length will also be created.
although strings are native, array-like objects, they are not suitable in applications of this method, as strings are immutable. similarly for the native, array-like object arguments. examples adding elements to an array the following code creates the sports array containing two elements, then appends two elements to it. the total variable contains the new length of the array. let sports = ['soc...
...pt allows us to establish the execution context in any way we want. let obj = { length: 0, addelem: function addelem(elem) { // obj.length is automatically incremented // every time an element is added. [].push.call(this, elem) } } // let's add some empty objects just to illustrate. obj.addelem({}) obj.addelem({}) console.log(obj.length) // → 2 note that
although obj is not an array, the method push successfully incremented obj's length property just like if we were dealing with an actual array. specifications specification ecmascript (ecma-262)the definition of 'array.prototype.push' in that specification. ...
JSON.stringify() - JavaScript
cer array is specified. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.stringify(value[, replacer[, space]]) parameters value the value to convert to a json string. 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. if this value is null or not provided, all properties of the object are included in the resulting json string. space optional a string or number object that's used to insert white space into the ...
... return this; } }; json.stringify(obj); // '{"data":"data"}' json.stringify({ obj }); // shorthand property names (es2015). // '{"obj":"now i am a nested object under key 'obj'"}' json.stringify([ obj ]); // '["now i am a nested object under key '0'"]' issue with json.stringify() when serializing circular references note that since the json format doesn't support object references (
although an ietf draft exists), a typeerror will be thrown if one attempts to encode an object with circular references. const circularreference = {}; circularreference.myself = circularreference; // serializing circular references throws "typeerror: cyclic object value" json.stringify(circularreference); to serialize circular references you can use a library that supports them (e.g. cycle.js by ...
Promise.prototype.catch() - JavaScript
of error. this is considered good practice in contrast to throwing strings; otherwise, the part doing the catching would have to perform checks to see if the argument was a string or an error, and you might lose valuable information like stack traces. ...
...ke stack traces. ...
String - JavaScript
bjects are, by returning the object. for example: let s1 = '2 + 2' // creates a string primitive let s2 = new string('2 + 2') // creates a string object console.log(eval(s1)) // returns the number 4 console.log(eval(s2)) // returns the string "2 + 2" for these reasons, the code may break when it encounters string objects when it expects a primitive string instead,
although generally, authors need not worry about the distinction. a string object can always be converted to its primitive counterpart with the valueof() method. console.log(eval(s2.valueof())) // returns the number 4 escape notation special characters can be encoded using escape notation: code output \xxx (where xxx is 1–3 octal digits; range of 0–377) iso-...
...for example: let outputstrings = [] for (let i = 0, n = inputvalues.length; i < n; ++i) { outputstrings.push(string(inputvalues[i])); } specifications specification ecmascript (ecma-262)the definition of 'string' in that specification. ...
encodeURIComponent() - JavaScript
onse header parameters (e.g., utf-8 filenames): var filename = 'my file(2).txt'; var header = "content-disposition: attachment; filename*=utf-8''" + encoderfc5987valuechars(filename); console.log(header); // logs "content-disposition: attachment; filename*=utf-8''my%20file%282%29.txt" function encoderfc5987valuechars(str) { return encodeuricomponent(str). // note that
although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(?:7c|60|5e)/g, unescape); } // here is ...
...gh rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2a'). // the following are not required for percent-encoding per rfc5987, // so we can allow for a little better readability over the wire: |`^ replace(/%(?:7c|60|5e)/g, unescape); } // here is an
alternative to the above function function encoderfc5987valuechars2(str) { return encodeuricomponent(str). // note that
although rfc3986 reserves "!", rfc5987 does not, // so we do not need to escape it replace(/['()*]/g, c => "%" + c.charcodeat(0).tostring(16)). // i.e., %27 %28 %29 %2a (note that valid encoding of "*" is %2a ...
isNaN() - JavaScript
syntax isnan(value) parameters value the value to be tested. return value true if the given value is nan; otherwise, false. description the necessity of an isnan function unlike all other possible values in javascript, it is not possible to rely on the equality operators (== and ===) to determine whether a value is nan or not, because both nan == nan and nan === nan evaluate to false. hence, the necessity of an isnan function. ...
...int values. the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' value?" ecmascript 2015 contains the number.isnan() function. number.isnan(x) is a reliable way to test whether x is nan or not. even with number.isnan, however, the meaning of nan remains the precise numeric meaning and not simply, "not a number".
alternatively, in the absence of number.isnan, the expression (x != x) is a more reliable way to test whether variable x is nan or not, as the result is not subject to the false positives that make isnan unreliable. a polyfill for isnan would be (the polyfill leverages the unique never-equal-to-itself characteristic of nan): var isnan = function(value) { var n = number(value); return n !== ...
Lexical grammar - JavaScript
unction comment() { /* this is a one line javascript comment */ console.log('hello world!'); } comment(); you can also make multiple-line comments, like this: function comment() { /* this comment spans multiple lines. notice that we don't need to end the comment until we're done. ...
...he characters after #! up to the end of the first line; only one such comment is permitted. the hashbang comment specifies the path to a specific javascript interpreter that you want to use to execute the script. an example is as follows: #!/usr/bin/env node console.log("hello world"); note: hashbang comments in javascript mimic shebangs in unix used to run files with proper interpreter.
although bom before hashbang comment will work in a browser it is not advised to use bom in a script with hasbang. bom will not work when you try to run the script in unix/linux. so use utf-8 without bom if you want to run scripts directly from shell. you must only use the #! comment style to specify a javascript interpreter. in all other cases just use a // comment (or mulitiline comment). keywor...
delete operator - JavaScript
rict mode, this would have raised an exception. strict vs. non-strict mode when in strict mode, if delete is used on a direct reference to a variable, a function argument or a function name, it will throw a syntaxerror. therefore, to avoid syntax errors in strict mode, you must use the delete operator in the form of delete object.property or delete object['property']. object.defineproperty(glob
althis, 'variable1', { value: 10, configurable: true, }); object.defineproperty(glob
althis, 'variable2', { value: 10, configurable: false, }); // syntaxerror in strict mode. console.log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in ...
...perty(glob
althis, 'variable2', { value: 10, configurable: false, }); // syntaxerror in strict mode. console.log(delete variable1); // true // syntaxerror in strict mode. console.log(delete variable2); // false function func(param) { // syntaxerror in strict mode. console.log(delete param); // false } // syntaxerror in strict mode. console.log(delete func); // false cross-browser notes
although ecmascript makes iteration order of objects implementation-dependent, it may appear that all major browsers support an iteration order based on the earliest added property coming first (at least for properties not on the prototype). however, in the case of internet explorer, when one uses delete on a property, some confusing behavior results, preventing other browsers from using simple objec...
this - JavaScript
ion context (outside of any function), this refers to the global object whether in strict mode or not. // in web browsers, the window object is also the global object: console.log(this === window); // true a = 37; console.log(window.a); // 37 this.b = "mdn"; console.log(window.b) // "mdn" console.log(b) // "mdn" note: you can always easily get the global object using the global glob
althis property, regardless of the current context in which your code is running. function context inside a function, the value of this depends on how the function is called. 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: ...
...which your code is running. function context inside a function, the value of this depends on how the function is called. 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() === glob
althis; // 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. wi...
export - JavaScript
exported modules are in strict mode whether you declare them as such or not. ...
... you can't run js modules via a file:// url — you'll get cors errors. you need to run it via an http server. using the default export if 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 straightfor...
for...in - JavaScript
tter to use a for loop with a numeric index (or array.prototype.foreach() or the for...of loop) when iterating over arrays where the order of access is important. iterating over own properties only if you only want to consider properties attached to the object itself, and not its prototypes, use getownpropertynames() or perform a hasownproperty() check (propertyisenumerable() can also be used).
alternatively, if you know there won't be any outside code interference, you can extend built-in prototypes with a check method. why use for...in? given that for...in is built for iterating object properties, not recommended for use with arrays, and options like array.prototype.foreach() and for...of exist, what might be the use of for...in at all? it may be most practically used for debugging pur...
...th a check method. why use for...in? given that for...in is built for iterating object properties, not recommended for use with arrays, and options like array.prototype.foreach() and for...of exist, what might be the use of for...in at all? it may be most practically used for debugging purposes, being an easy way to check the properties of an object (by outputting to the console or otherwise).
although arrays are often more practical for storing data, in situations where a key-value pair is preferred for working with data (with properties acting as the "key"), there may be instances where you want to check if any of those keys hold a particular value. 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 ...
<mglyph> - MathML
users will see this displayed if the image url is wrong, the image is not in one of the supported formats, or until the image is downloaded. class, id, style provided for use with stylesheets. height the height of the image. href used to set a hyperlink to a specified uri. mathbackground the background color (if the image has transparency). ...
...ylesheets. height the height of the image. href used to set a hyperlink to a specified uri. mathbackground the background color (if the image has transparency). you can use #rgb, #rrggbb and html color names. src the image url. valign specifies the vertical alignment with respect to the current baseline. width the width of the image. examples <math> <mi><mglyph src="my-glyph.png"
alt="my glyph"/></mi> </math> specifications specification status comment mathml 3.0the definition of 'mglyph' in that specification. recommendation current specification mathml 2.0the definition of 'mglyph' in that specification. recommendation initial specification ...
Handling media support issues in web content - Web media technologies
the reader a useful idea of the video's contents. in the case of an action movie, for example, the poster frame might be an iconic exemplar image from one of the film's best-known scenes. 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. we'll look at both of these scenarios and how to implement them. poster frames for video progressive images images—whether embedded using <img> or <picture>—don't support a concept similar to poster frames. however, there are ways to present an image in low quality while it's still loading. t...
...picture>—don't support a concept similar to poster frames. however, there are ways to present an image in low quality while it's still loading. this requires creating your images using progressive formats, such as progressive jpeg or interlaced png. once your image has been converted to progressive form, you can simply use it as usual. <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. note: progressive (or interlaced) images are inherently slightly larger than the non-progres...
Codecs used by WebRTC - Web media technologies
spaces (srgb is the preferred, but not required, default color space), recommendations for webcam processing features (automatic focus, automatic white balance, automatic light level), and so on. note: these requirements are for web browsers and other fully-webrtc compliant products. non-webrtc products that are able to communicate with webrtc to some extent may or may not support these codecs,
although they're encouraged to by the specification documents. in addition to the mandatory codecs, some browsers support additional codecs as well. those are listed in the following table. other video codecs codec name profile(s) browser compatibility vp9 — chrome (48+), firefox vp8 vp8, which we describe in general in the main guide to video codecs us...
...onfiguration. of special importance in these objects: the payloadtype property, which is a one-byte value which uniquely identifies the described configuration. note: the two methods for obtaining lists of codecs shown here use different output types in their codec lists. be aware of this when using the results. customizing the codec list once you have a list of the available codecs, you can
alter it and then send the revised list to rtcrtptransceiver.setcodecpreferences() to rearrange the codec list. this changes the order of preference of the codecs, letting you tell webrtc to prefer a different codec over all others. function changevideocodec(mimetype) { const transceivers = peerconnection.gettransceivers(); transceivers.foreach(transceiver => { const kind = transceiver.send...
Populating the page: how browsers work - Web Performance
ll reply with relevant response headers and the contents of the html. <!doctype html> <html> <head> <meta charset="utf-8"/> <title>my simple page</title> <link rel="stylesheet" src="styles.css"/> <script src="myscript.js"></script> </head> <body> <h1 class="heading">my page</h1> <p>a paragraph with a <a href="https://example.com/about">link</a></p> <div> <img src="myimage.jpg"
alt="image description"/> </div> <script src="anotherscript.js"></script> </body> </html> this response for this initial request contains the first byte of data received. time to first byte (ttfb) is the time between when the user made the request—say by clicking on a link—and the receipt of this first packet of html. the first chunk of content is usually 14kb of data. in our example above,...
... reference to an external resource to request it. it will retrieve resources in the background so that by the time the main html parser reaches requested assets, they may possibly already be in flight, or have been downloaded. the optimizations the preload scanner provides reduce blockages. <link rel="stylesheet" src="styles.css"/> <script src="myscript.js" async></script> <img src="myimage.jpg"
alt="image description"/> <script src="anotherscript.js" async></script> in this example, while the main thread is parsing the html and css, the preload scanner will find the scripts and image, and start downloading them as well. to ensure the script doesn't block the process, add the async attribute, or the defer attribute if javascript parsing and execution order is not important. waiting to obt...
Web Performance
, and the potential role of resource hints in masking tls latency for third parties. reading performance charts developer tools provide information on performance, memory, and network requests. knowing how to read waterfall charts, call trees, traces, flame charts , and allocations in your browser developer tools will help you understand waterfall and flame charts in other performance tools. ...
... analyzing javascript bundles no doubt, javascript is a big part of modern web development. ...
Progressive web app structure - Progressive web apps (PWAs)
you can <a href="https://github.com/mdn/pwa-examples/blob/master/js13kpwa">fork js13kpwa on github</a> to check its source code.</p...
... simple styling of the html elements. the overall approach is to have the design look good on both mobile (with a responsive web design approach) and desktop devices. the main app javascript the app.js file does a few things we will look into closely in the next articles. first of all it generates the content based on this template: var template = "<article>\n\ <img src='data/img/slug.jpg'
alt='name'>\n\ <h3>#pos. name</h3>\n\ <ul>\n\ <li><span>author:</span> <strong>author</strong></li>\n\ <li><span>twitter:</span> <a href='https://twitter.com/twitter'>@twitter</a></li>\n\ <li><span>website:</span> <a href='http://website/'>website</a></li>\n\ <li><span>github:</span> <a href='https://github'>github</a></li>\n\ <li><span>more:</span> <a href='http://js13kga...
Progressive loading - Progressive web apps (PWAs)
not unusual to have megabytes of image data to download before announcing the site is ready, but this again creates a bad perception of performance. we don't need all of the images in the best possible quality at the very beginning of viewing the site. this can be optimized. first of all, you should use tools or services similar to tinypng, which will reduce the file size of your images without
altering the quality too much. if you're past that point, then you can start thinking about optimizing the image loading using javascript. we'll expain this below. placeholder image instead of having all the screenshots of games referenced in <img> element src attributes, which will force the browser to download them automatically, we can do it selectively via javascript. the js13kpwa app uses a pl...
...g all the screenshots of games referenced in <img> element src attributes, which will force the browser to download them automatically, we can do it selectively via javascript. the js13kpwa app uses a placeholder image instead, which is small and lightweight, while the final paths to target images are stored in data-src attributes: <img src='data/img/placeholder.png' data-src='data/img/slug.jpg'
alt='name'> those images will be loaded via javascript after the site finishes building the html structure. the placeholder image is scaled the same way the original images are, so it will take up the same space and not cause the layout to repaint as the images load. loading via javascript the app.js file processes the data-src attributes like so: let imagestoload = document.queryselectorall('im...
Graphic design for responsive sites - Progressive web apps (PWAs)
as much as possible, as they theoretically scale infinitely so will still look crisp at high resolutions. you could use css3 properties for generating effects like drop shadows, gradients and rounded corners, and you could also consider using svg for other ui elements, instead of raster graphics formats. the downsides here are that css3 properties and svg don't work on old browsers such as ie6-8 (
although polyfills are available, and you could build in fallbacks), and svg isn't suitable for high detail images, such as photographs. using fonts for icons another technique to consider is using web fonts for icons. text is infinitely scalable on the web, and you can also use css text properties to style your web font icons, such as text-shadow and color. making your own font file can be a bit f...
...ay not be supported in older browsers like ie6-8, but they generally degrade gracefully, are fairly easy to write, and become much more flexible and powerful when combined with javascript and other technologies. javascript javascript has functions that enable developers to create animations, and any other type of interactivity you want. it is very powerful when combined with other technologies,
although its complexity is a barrier for non-developers. svg svg, just like html/css, can be manipulated via javascript. so adding interactivity is not difficult. you can also add links direcly into svg and can create animations using smil (synchronized multimedia intergration language). webgl/canvas you can create a canvas to draw interactive graphics on using the html <canvas> element, then use...
Mobile first - Progressive web apps (PWAs)
l need first, then progressively enhance browsers higher up the food chain. note: starting with very little and working up as the need arises usually makes more sense than starting with everything and then covering up things if they aren't needed! mobile constraints we have already mentioned the fact that mobiles generally have less memory, processing power and bandwidth than other devices (
although bear in mind that smart tvs are also generally pretty low powered.) they also have less viewport size available. therefore, as well as splitting content into different views, and simplifying the interface and content on each view of your application for mobile as much as possible, it is also a good idea to not include visual effects such as shadows, animations, and gradients. you should at l...
...provides a mechanism to selectively serve both css and javascript. modernizr stores the results of all its feature tests as classes on the html element. for example, the modernizr in our example app is testing for multiple background image and rgba support. when they are not supported, the <html> tag looks like this: <html class=" js no-rgba no-multiplebgs"> when these are present, we can serve
alternative styling rules to provide sensible fallbacks using descendant selectors — see the following in my code. .no-multiplebgs body { background: white; } .no-rgba .main > p { background: white; } this is not hugely pretty, but it does make the main content area more readable on browsers that don't support either or both of these features. modernizr also puts its feature detect results ...
Structural overview of progressive web apps - Progressive web apps (PWAs)
you can <a href="https://github.com/mdn/pwa-examples/blob/master/js13kpwa"> fork js13kpwa on github</a> to ch...
...in app javascript the file app.js is run when the app is first loaded; its job is primarily to initialize the app, though it c can do other things as well. we'll look at how the app functions more closely in later articles in this guide. the first thing it does is to generate the app's displayed content using the following template: var template = "<article>\n\ <img src='data/img/slug.jpg'
alt='name'>\n\ <h3>#pos. name</h3>\n\ <ul>\n\ <li><span>author:</span> <strong>author</strong></li>\n\ <li><span>twitter:</span> <a href='https://twitter.com/twitter'> @twitter</a></li>\n\ <li><span>website:</span> <a href='http://website/'>website</a></li>\n\ <li><span>github:</span> <a href='https://github'>github</a></li>\n\ <li><span>more:</span> <a href='http:...
dominant-baseline - SVG: Scalable Vector Graphics
e table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline. note: as a presentation attribute, dominant-baseline can be used as a css property. see css dominant-baseline for further information. ...
...yes auto if this property occurs on a <text> element, then the computed value depends on the value of the writing-mode attribute. if the writing-mode is horizontal, then the value of the dominant-baseline component is alphabetic. otherwise, if the writing-mode is vertical, then the value of the dominant-baseline component is central. if this property occurs on a <tspan>, <tref>, <
altglyph>, or <textpath> element, then the dominant-baseline and the baseline-table components remain the same as those of the parent text content element. if the computed baseline-shift value actually shifts the baseline, then the baseline-table font-size component is set to the value of the font-size attribute on the element on which the dominant-baseline attribute occurs, otherwise the baseline-...
fill - SVG: Scalable Vector Graphics
the fill attribute has two different meanings. for shapes and text it's a presentation attribute that defines the color (or any svg paint servers like gradients or patterns) used to paint the element; for animation it defines the final state of the animation. as a presentation attribute, it can be applied to any element but it only has an effect on the following eleven elements: <
altglyph>, <circle>, <ellipse>, <path>, <polygon>, <polyline>, <rect>, <text>, <textpath>, <tref>, and <tspan>. for animation five elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, <animatetransform>, and <set>. html,body,svg { height:100% } <svg viewbox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <!-- simple color fill --> <circle cx="50" cy="50" r="40" fill="pink" /> ...
...black" /> </radialgradient> </defs> <circle cx="150" cy="50" r="40" fill="url(#mygradient)" /> <!-- keeping the final state of an animated circle which is a circle with a radius of 40. --> <circle cx="250" cy="50" r="20"> <animate attributetype="xml" attributename="r" from="0" to="40" dur="5s" fill="freeze" /> </circle> </svg>
altglyph warning: as of svg2 <
altglyph> is deprecated and shouldn't be used. for <
altglyph>, fill is a presentation attribute that defines the color of the glyph. value <paint> default value black animatable yes note: as a presentation attribute fill can be used as a css property. animate for <animate>, fill defines the final state of the animation. ...
font-variant - SVG: Scalable Vector Graphics
the font-variant attribute indicates whether the text is to be rendered using variations of the fontʼs glyphs. note: as a presentation attribute, font-variant can be used as a css property. see the css font-variant property for more information. ...
...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> || <contextual-
alt-values> || stylistic( <feature-value-name> ) || historical-forms || styleset( <feature-value-name># ) || character-variant( <feature-value-name># ) || swash( <feature-value-name> ) || ornaments( <feature-value-name> ) || annotation( <feature-value-name> ) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-valu...
format - SVG: Scalable Vector Graphics
the format attribute indicates the format of the given font. two elements are using this attribute: <
altglyph> and <glyphref> context notes value <string> default value none animatable no <string> this value specifies the format of the given font. here is a list of font formats and their strings that can be used as values for this attribute: format string format truedoc-pfr truedoc™ portable font resource embedded-opentype embedded opentype type-1 postscript™ type 1 truetype truetype opentype opentype, including truetype open truetype-gx truetype with gx extensions speedo speedo intellifont ...
... speedo intellifont intellifont specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'format for <glyphref>' in that specification. recommendation initial definition for <glyphref> scalable vector graphics (svg) 1.1 (second edition)the definition of 'format for <
altglyph>' in that specification. recommendation initial definition for <
altglyph> ...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
f 180 degrees, then the current text position is incremented according to the horizontal metrics of the glyph. this attribute is applied only to text written in a vertical writing-mode. note: as a presentation attribute, glyph-orientation-vertical can be used as a css property. ...
...text which is not fullwidth will be set with a glyph orientation of 90 degrees. this reorientation rule applies only to the first-level non-ideographic text. ...
glyphRef - SVG: Scalable Vector Graphics
the glyphref attribute represents the glyph identifier, the format of which is dependent on the format of the given font. two elements are using this attribute: <
altglyph> and <glyphref> usage notes value <string> default value none animatable yes <string> this value represents the glyph identifier. its format depends on the format of the given font. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyphref for <glyphref>' in that specification. recommendation initial definition for <glyphref> scalable vector graphics (svg) 1.1 (second edition)the definition of '
altglyph for <
altglyph>' in that specification. recommendation ini...
... specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyphref for <glyphref>' in that specification. recommendation initial definition for <glyphref> scalable vector graphics (svg) 1.1 (second edition)the definition of '
altglyph for <
altglyph>' in that specification. recommendation initial definition for <
altglyph> ...
requiredFeatures - SVG: Scalable Vector Graphics
to false. requiredfeatures is often used in conjunction with the <switch> element. if requiredfeatures is used in other situations, it represents a simple switch on the given element whether to render the element or not. to detect availability of an svg feature from script, there is the (also deprecated) domimplementation.hasfeature() method. ...
...rts the <style> element. http://www.w3.org/tr/svg11/feature#viewportattribute the browser supports the clip and overflow attributes. http://www.w3.org/tr/svg11/feature#shape the browser supports the <rect>, <circle>, <line>, <polyline>, <polygon>, <ellipse> and <path> elements. http://www.w3.org/tr/svg11/feature#text the browser supports the <text>, <tspan>, <tref>, <textpath>, <
altglyph>, <
altglyphdef>, <
altglyphitem> and <glyphref> elements. http://www.w3.org/tr/svg11/feature#basictext the browser supports the <text> element http://www.w3.org/tr/svg11/feature#paintattribute the browser supports the color, fill, fill-rule, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-width, color-interpolation and color-...
stroke-dasharray - SVG: Scalable Vector Graphics
the stroke-dasharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape; note: as a presentation attribute, stroke-dasharray can be used as a css property. ...
... if an odd number of values is provided, then the list of values is repeated to yield an even number of values. thus, 5,3,2 is equivalent to 5,3,2,5,3,2. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull ...
systemLanguage - SVG: Scalable Vector Graphics
the systemlanguage attribute represents a list of supported language tags. this list is matched against the language defined in the user preferences. 35 elements are using this attribute: <a>, <
altglyph>, <animate>, <animatecolor>, <animatemotion>, <animatetransform>, <audio>, <canvas>, <circle>, <clippath>, <cursor>, <defs>, <discard>, <ellipse>, <foreignobject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textpath>, <tref>, <tspan>, <unknown>, <use>, and <video> usage notes value <language-tags> default value none animatable no <language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47. systemla...
...none animatable no <language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47. systemlanguage is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several
alternative language objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. the attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by...
text-anchor - SVG: Scalable Vector Graphics
alignment takes place for each line. the text-anchor attribute is applied to each individual text chunk within a given <text> element. ...
...te values on a <tspan>, <tref> or <
altglyph> element assigned explicitly to the first rendered character in a text chunk, or determination of the initial current text position for a <textpath> element. note: as a presentation attribute, text-anchor can be used as a css property. ...
writing-mode - SVG: Scalable Vector Graphics
the writing-mode attribute specifies whether the initial inline-progression-direction for a <text> element shall be left-to-right, right-to-left, or top-to-bottom. the writing-mode attribute applies only to <text> elements; the attribute is ignored for <tspan>, <tref>, <
altglyph> and <textpath> sub-elements. ...
...-progression-direction can change within a <text> element due to the unicode bidirectional algorithm and properties direction and unicode-bidi.) note: as a presentation attribute, writing-mode can be used as a css property. see the css writing-mode property for more information. as a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <
altglyph>, <text>, <textpath>, <tref>, and <tspan> 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. both the writing mode and the typographic mode are horizontal. vertical-rl this value defines a right-to-left block flow directi...
Content type - SVG: Scalable Vector Graphics
"ms" hours ::= digit+; any positive number minutes ::= 2digit; range from 00 to 59 seconds ::= 2digit; range from 00 to 59 fraction ::= digit+ timecount ::= digit+ 2digit ::= digit digit digit ::= [0-9] for timecount values, the default metric suffix is "s" (for seconds). no embedded white space is allowed in clock values,
although leading and trailing white space characters will be ignored. the following are examples of legal clock values: full clock values: 02:30:03 = 2 hours, 30 minutes and 3 seconds 50:00:10.25 = 50 hours, 10 seconds and 250 milliseconds partial clock value: 02:33 = 2 minutes and 33 seconds 00:10.5 = 10.5 seconds = 10 seconds and 500 milliseconds timecount values: 3.2h = 3.2...
...00:00.005 = 5 milliseconds color <color> the basic type <color> is a css2 compatible specification for a color in the srgb color space. <color> applies to svg's use of the color attribute and is a component of the definitions of attributes fill, stroke, stop-color, flood-color, and lighting-color, which also offer optional icc-based color specifications. svg supports all of the syntax
alternatives for <color> defined in css2 syntax and basic data types, and (depend on the implementation) in the future css color module level 3. a <color> is either a keyword or a numerical rgb specification. in addition to these color keywords, users may specify keywords that correspond to the colors used by objects in the user's environment. the normative definition of these keywords is found i...
Mixed content - Web security
he case of passive content, the threat is lower (the page may contain misleading content, or the user's cookies may be stolen). in the case of active content, the threat can lead to phishing, sensitive data disclosure, redirection to malicious sites, etc. mixed passive/display content mixed passive/display content is content served over http that is included in an https webpage, but that cannot
alter other portions of the webpage. for example, an attacker could replace an image served over http with an inappropriate image or message to the user. the attacker could also infer information about the user's activities by watching which images are served to the user; often images are only served on a specific page within a website. if the attacker observes http requests to certain images, they c...
...nt list this section lists all types of http requests which are considered passive content: <img> (src attribute) <audio> (src attribute) <video> (src attribute) <object> subresources (when an <object> performs http requests) mixed active content mixed active content is content that has access to all or parts of the document object model of the https page. this type of mixed content can
alter the behavior of the https page and potentially steal sensitive data from the user. hence, in addition to the risks described for mixed display content above, mixed active content is vulnerable to a few other attack vectors. in the mixed active content case, a man-in-the-middle attacker can intercept the request for the http content. the attacker can also rewrite the response to include malicio...
Transport Layer Security - Web security
t became clear that a common, standard encryption technology needed to be specified to ensure interoperability among all web browsers and servers. the internet engineering task force (ietf) specified tls 1.0 in rfc 2246 in january, 1999. the current version of tls is 1.3 (rfc 8446). despite the fact that the web now uses tls for encryption, many people still refer to it as "ssl" out of habit.
although tls can be used on top of any low-level transport protocol, the original goal of the protocol was to encrypt http traffic. http encrypted using tls is commonly referred to as https. tls-encrypted web traffic is by convention exchanged on port 443 by default, while unencrypted http uses port 80 by default. https remains an important use case for tls. http over tls tls provides three primary...
...re that client certificates are encrypted, or to request client certificates only when certain resources are requested. for the privacy of client certificates, the encryption of the tls 1.3 handshake ensures that client certificates are encrypted; however this might require some software changes. reactive client authentication using certificates is supported by tls 1.3 but not widely implemented.
alternative mechanisms are in the process of being developed, which will also support http/2. retiring old tls versions to help with working towards a more modern, more secure web, tls 1.0 and 1.1 support will be removed from all major browsers in q1 2020. you'll need to make sure your web server supports tls 1.2 or 1.3 going forward. from version 74 onwards, firefox will return a secure connectio...
Types of attacks - Web security
not help (such as attacks originating from a separate subdomain). for more prevention tips, see the owasp csrf prevention cheat sheet. man-in-the-middle (mitm) a third party intercepts traffic between a web server and a client (browser), and impersonates the web server in order to capture data (such as login credentials or credit card information). the traffic is passed through, possibly with
alterations. open wifi networks are a typically means of executing this attack. session hijacking session hijacking consists of gaining access to and misusing a user's authenticated session. this may happen by stealing a cookie for an existing session, or by fooling the user (or their browser) into setting a cookie with a predetermined session id. exfiltration avenues can be limited by deploying a...
...f=e8b667; secure; domain=example.com if a vulnerable application is available on a sub-domain, this mechanism can be abused in a session fixation attack. when the user visits a page on the parent domain (or another subdomain), the application may trust the existing value sent in the user's cookie. this could allow an attacker to bypass csrf protection or hijack a session after the user logs in.
alternatively, if the parent domain does not use http strict-transport-security with includesubdomains set, a user subject to an active mitm (perhaps connected to an open wifi network) could be served a response with a set-cookie header from a non-existent sub-domain. the end result would be much the same, with the browser storing the illegitimate cookie and sending it to all other pages under exampl...
HTML Imports - Web Components
html imports is intended to be the packaging mechanism for web components, but you can also use html imports by itself. you import an html file by using a <link> tag in an html document like this: <link rel="import" href="myfile.html"> the import link type is new. ...
... html imports is intended to be the packaging mechanism for web components, but you can also use html imports by itself. you import an html file by using a <link> tag in an html document like this: <link rel="import" href="myfile.html"> the import link type is new. ...
Using shadow DOM - Web Components
-like structure of connected nodes that represents the different elements and strings of text appearing in a markup document (usually an html document in the case of web documents). ...
...ements to the shadow dom shadow.appendchild(style); shadow.appendchild(wrapper); wrapper.appendchild(icon); wrapper.appendchild(info); using our custom element once the class is defined, using the element is as simple as defining it, and putting it on the page, as explained in using custom elements: // define the new element customelements.define('popup-info', popupinfo); <popup-info img="img/
alt.png" data-text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4 numbers on the back of your card."> internal versus external styles in the above example we apply style to the shadow dom using a <style> element, but it is perfectly possible to do it by referencing an external styleshee...
Introduction to using XPath in JavaScript - XPath
sult object of the type specified in the resulttype parameter. the xpathresult interface is defined here. implementing a default namespace resolver we create a namespace resolver using the creatensresolver method of the document object. var nsresolver = document.creatensresolver( contextnode.ownerdocument == null ? contextnode.documentelement : contextnode.ownerdocument.documentelement ); or
alternatively by using the <code>creatensresolver</code> method of a <code>xpathevaluator</code> object. <pre> var xpevaluator = new xpathevaluator(); var nsresolver = xpevaluator.creatensresolver( contextnode.ownerdocument == null ? contextnode.documentelement : contextnode.ownerdocument.documentelement ); </pre> and then pass document.evaluate, the nsresolver variable as the namespaceresolver param...
...ties respectively of the xpathresult object. ...
XPath
nt.getelementbyid() or parentnode.queryselectorall() methods, the node.childnodes properties, and other dom core features. xpath uses a path notation (as in urls) for navigating through the hierarchical structure of an xml document. it uses a non-xml syntax so that it can be used in uris and xml attribute values. note: support for xpath varies widely; it's supported reasonably well in firefox (
although there are no plans to improve support further), while other browsers implement it to a lesser extent, if at all. if you need a polyfill, you may consider js-xpath or wicked-good-xpath. documentation introduction to using xpath in javascript describes a non-xslt use of xpath. xpath:axes list and definition of the axes defined in the xpath specification. axes are used to describe the...
...ogy. jxon jxon (lossless javascript xml object notation) is a generic name by which is defined the representation of javascript objects using xml. there are some cases in which the whole content of an xml document must be read from the javascript interpreter (like for web-apps languages or settings xml documents, for example). in these cases jxon could represent the most practical way and valid
alternative to xpath. view all... tools chropath xpath panel that integrates tightly into firebug, providing an editor and inspector (firefox add-on). xmlquire (formerly known as sketchpath) a graphical xpath builder/debugger(.net). xpath tester an online xpath builder/debugger. related topics xslt, xquery, xml, dom, jxon, jsonpath comparison of css selectors and xpath ...
An Overview - XSLT: Extensible Stylesheet Language Transformations
cialized syntax, an xslt stylesheet is an xml document, which must conform to all xml rules, including well-formedness. so the model for transformation is that one xml document is used to transform another xml document. an xslt stylesheet is marked as such by the inclusion of a standard xslt heading. the outermost element in an xslt stylesheet must be the <xsl:stylesheet> element (an acceptable
alternate is the <xsl:transform> element). this element will include at least one namespace declaration and the mandatory version attribute. other namespaces and three optional attributes may also be included. the mandatory namespace for xslt is "http://www.w3.org/1999/xsl/transform". namespaces are the subject of a fair amount of confusion in xml. despite the fact that very often namespaces appe...
...horthand name to the namespace in the stylesheet heading. thus a full example of the opening stylesheet element might look like this. <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. thus the stylesheet element above is prefixed with xsl:.
although xsl is the conventionally used shorthand name (called the prefix), it is not mandatory and it is quite possible to choose a different one. the examples in this article all assume the use of the xsl prefix. all xslt transformations are performed on trees, not documents. the xslt transformation engine, called the processor, does not work directly on documents. before transformation can tak...
Understanding WebAssembly text format - WebAssembly
tion. thus you could rewrite our previous signature like so: (func (param $p1 i32) (param $p2 f32) (local $loc f64) …) and then could write local.get $p1 instead of local.get 0, etc. (note that when this text gets converted to binary, though, the binary will contain only the integer.) stack machines before we can write a function body, we have to talk about one more thing: stack machines.
although the browser compiles it to something more efficient, wasm execution is defined in terms of a stack machine where the basic idea is that every type of instruction pushes and/or pops a certain number of i32/i64/f32/f64 values to/from a stack. for example, local.get is defined to push the value of the local it read onto the stack, and i32.add pops two i32 values (it implicitly grabs the previo...
...according to webassembly, memory is just a large array of bytes that can grow over time. webassembly contains instructions like i32.load and i32.store for reading and writing from linear memory. from javascript’s point of view, it’s as though memory is all inside one big (resizable) arraybuffer. that’s literally all...
Communicating With Other Scripts - Archive of obsolete content
messaging from content script to page script from firefox 30 onwards, the execution environment for content scripts has changed, so content scripts can't directly share objects with page scripts. this affects the use of custom events to send messages from content scripts to page...
Interacting with page scripts - Archive of obsolete content
instead. so the content scripts in the above examples need to be rewritten like this: // talk.js document.defaultview.postmessage("message from content script", "http://my-domain.org/"); // listen.js document.defaultview.addeventlistener('message', function(event) { console.log(event.data); // message from page script console.log(event.origin); }, false); using custom dom events as an
alternative to using postmessage() you can use custom dom events to communicate between page scripts and content scripts. content script to page script from firefox 30 onwards, the execution environment for content scripts has changed, so content scripts can't directly share objects with page scripts. this affects the use of custom events to send messages from content scripts to page scripts. bef...
Content Processes - Archive of obsolete content
security. content scripts when the sdk was first designed, firefox was being refactored towards a multiprocess model. in this model, the ui would be rendered in one process (called the chrome process), whereas each tab and each add-on would run in their own dedicated process (called content and add-on processes, respectively). the project behind this refactor was known as electrolysis, or e10s.
although e10s has now been suspended, the sdk was designed with this multiprocess model in mind. afterwards, it was decided to keep the design the way it is: even though it's no longer necessary, it turns out that from a security point of view there are several important advantages to thinking about content and add-on code as living in different processes. many add-ons have to interact with content.
Private Properties - Archive of obsolete content
e class. unlike other languages, javascript does not have native support for private properties. people have come up with several ways to emulate private properties using existing language features. this article discusses two common techniques: one using prefixes, the other closures. both approaches have drawbacks, they are either not restrictive enough or too restrictive, respectively. a better
alternative is to use weakmap objects, which solve both these problems. however, note that weakmaps might not be supported by all implementations yet. also shown here is how to generalize the idea of using weakmaps, from associating one or more private properties with an object, to associating one or more namespaces with each object. a namespace is simply an object on which one or more private proper...
Module structure of the SDK - Archive of obsolete content
/<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).
although the sdk repository in github includes copies of these modules, they are built into firefox and by default, when you run or build an add-on using jpm run or jpm xpi, it is the versions of the modules in firefox that are used. if you need to use a different version of the modules, you can do this by checking out the version of the sdk that you need and passing the -o or --overload option to jp...
SDK API Lifecycle - Archive of obsolete content
precation in the chosen release, the sdk team will communicate the module's deprecation: update the module's stability index to be "deprecated" include a deprecation notice in the release notes, the add-ons blog, and the jetpack google group. the deprecation notice should point developers at a migration guide. migration the deprecation period defaults to 18 weeks (that is, three releases)
although in some cases, generally those out of our control, it might be shorter than this. during this time, the module will be in the deprecated state. the sdk team will track usage of deprecated modules on addons.mozilla.org and support developers migrating their code. the sdk will continue to provide warnings: api documentation will inform users that the module is deprecated. attempts to use ...
Working with Events - Archive of obsolete content
s may be modules, as is the case for the ready event above, or they may be objects returned by constructors. in the latter case the options object passed to the constructor typically defines properties whose names are the names of supported event types prefixed with "on": for example, "onopen", "onready" and so on. then in the constructor you can assign a listener function to this property as an
alternative to calling the object's on() method. for example: the actionbutton object emits an event when the button is clicked. 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. the listener loads https://developer.mozilla.org/: require("sdk/ui/button/action").actionbutton({ id: "visit-mozilla", lab...
XUL Migration Guide - Archive of obsolete content
model. apis like ui and panel are very generic and with the right content can be used to replace many specific xul elements. but there are some notable limitations in the sdk apis and even a fairly simple ui may need some degree of redesign to work with them. some limitations are the result of intentional design choices. for example, action buttons appear by default in the main firefox toolbar (
although users may relocate them by toolbar customization) because it makes for a better user experience for add-ons to expose their interfaces in a consistent way. in such cases it's worth considering changing your user interface to align with the sdk apis. some limitations only exist because we haven't yet implemented the relevant apis: for example, there's currently no way to add items to the bro...
page-mod - Archive of obsolete content
this property defaults to "end". name: contentscriptoptions type: object you can use this option to define some read-only values for your content scripts. the option consists of an object literal listing name:value pairs for the values you want to provide to the content script. for example: var data = require(...
panel - Archive of obsolete content
anel = require("sdk/panel").panel({ contenturl: "https://en.wikipedia.org/w/index.php?title=jetpack&useformat=mobile", contentstylefile: self.data.url("panel-style.css") }); mypanel.show(); private browsing if your add-on has not opted into private browsing, and it calls panel.show() when the currently active window is a private window, then the panel will not be shown. panel limitations
although panels can host html documents, they are not implemented as browser tabs, so many things that work in normal web pages do not work inside panels: prior to firefox 33, you don't get a context menu. from firefox 33 you can enable a context menu by passing contextmenu: true to the panel's constructor. the html <select> element doesn't work. the html <datalist> element doesn't give you auto...
simple-prefs - Archive of obsolete content
his appears below the preference title in the add-ons manager ui. value a default value for the preference. depending on the preference type, this may be an integer, string, or boolean value. hidden a boolean value which, if present and set to true, means that the preference won't appear in the add-ons manager interface, so users of your add-on won't be able to see or
alter it. { "name": "myhiddeninteger", "type": "integer", "title": "how many?", "hidden": true } your add-on's code will still be able to access and modify it, just like any other preference you define. type-specific attributes these are settings that are only applicable to certain preference types. they are documented along with the preference types themselves. ...
/loader - Archive of obsolete content
et requirer = module(requirerid, requireruri); let require = require(loader, requirer); let boostrap = require(bootstrapid); built-in modules each loader instance exposes the following built-in pseudo modules in addition to those passed via modules: chrome this pseudo module exposes everything that is typically available for js contexts with system principals under the components global. this
alternative approach of providing capabilities via modules makes it possible to build module capability graphs by analyzing require statements. these graphs can be used to reason about modules without diving into implementation details. @loader/options this pseudo module exposes all the options that were used to configure this loader. it enables you to create new loader instances identical to the c...
places/bookmarks - Archive of obsolete content
this will be saved implicitly. save(bookmarks).on("data", function (saved, input) { // a data event is called once for each item saved, as well // as implicit items, like `group` console.log(input === group || ~bookmarks.indexof(input)); // true }).on("end", function (saves, inputs) { // like the previous example, ...
test/assert - Archive of obsolete content
ate object, the actual value is equivalent if it is also a date object that refers to the same time. other pairs that do not both pass typeof value == "object", equivalence is determined by ==. for all other object pairs, including array objects, equivalence is determined by having the same number of owned properties (as verified with object.prototype.hasownproperty.call), the same set of keys (
although not necessarily the same order), equivalent values for every corresponding key, and an identical "prototype" property. note: this accounts for both named and indexed properties on arrays. assert.deepequal({ a: "foo" }, { a: "foo" }, "equivalent objects"); parameters actual : object the actual result. expected : object the expected result. message : string optional message to log, p...
ui/button/action - Archive of obsolete content
pecific label" console.log(button.state(tabs[0]).label); // access the second tab's label -> "tab-specific label" console.log(button.state(tabs[1]).label); // reset the tab-specific state button.state(tab, null); // access the second tab's label -> "window-specific label" console.log(button.state(tabs[1]).label); } finally, you can pass the button itself into state(). this is an
alternative way to set or get the global state. the reason for using this, rather than setting properties individually, is that you can define an object with the properties to set in one place, then apply it to the global state with a single line: const defaultstate = { "label": "default label", "icon": "./default.png", } const differentstate = { "label": "different label", "icon": "./diffe...
ui/frame - Archive of obsolete content
detach this event is emitted when a frame instance is unloaded: for example, when the user closes a browser window, if that window has a toolbar containing this frame. after receiving this message, you ahould not attempt to communicate with the frame scripts. ready this event is emitted while a frame instance is being loaded, at the point where it becomes possible to interact with the frame
although sub-resources may still be in the process of loading. it's the equivalent of the point where the frame's document.readystate becomes "interactive": var { frame } = require("sdk/ui/frame"); var frame = new frame({ url: "./frame.html" }); frame.on("ready", ping); function ping(e) { // message only this frame instance e.source.postmessage("pong", e.origin); } arguments event : this ...
ui/sidebar - Archive of obsolete content
idebar's show() method. if a new window is opened from a window that has a sidebar visible, the new window gets a sidebar, too. you can hide the sidebar by calling its hide() method. called with no arguments, show() and hide() will operate on the currently active window. from firefox 33 onwards you can pass a browserwindow into these methods, and they will then operate on the specified window.
alternatively, the view->sidebar submenu in firefox will contain a new item which the user can use to show or hide the sidebar: the sidebar generates a show event when it is shown and a hide event when it is hidden. once you've finished using the sidebar you can destroy it by calling its dispose() method. to show what a sidebar looks like, here's a sidebar that displays the results of running the ...
ui/toolbar - Archive of obsolete content
onbutton({ id: "play", label: "play", icon: "./icons/play.png" }); var frame = new frame({ url: "./frame-player.html" }); var toolbar = toolbar({ title: "player", items: [previous, next, play, frame] }); the toolbar appears just above the content window: to destroy a toolbar call its destroy() method. showing and hiding toolbars by default, a toolbar is shown when it is created,
although you can specify that a toolbar should be hidden initially by passing hidden:true as an option in its constructor. after that, though, you can't show or hide the toolbar programmatically. toolbars get a close button at the right-hand side, and users can show or hide the toolbar using the firefox "view/toolbars" menu, alongside built-in toolbars like the bookmarks toolbar. hidden state persi...
util/array - Archive of obsolete content
a); // ['alice', 'bob', 'carol', 'dave'] parameters array : array the array to add the element to. element : * the element to add returns boolean : a boolean indicating whether or not the element was added to the array. remove(array, element) if the given array contains the given element, this function removes the element from the array and returns true. otherwise, this function does not
alter the array and returns false. let { remove } = require('sdk/util/array'); let a = ['alice', 'bob', 'carol']; remove(a, 'dave'); // false remove(a, 'bob'); // true remove(a, 'bob'); // false console.log(a); // ['alice', 'carol'] parameters array : array the array to remove the element from. element : * the element to remove from the array if it contains it. returns boolean : a boolean ...
cfx - Archive of obsolete content
ge api. to make cfx use a specific profile, pass the --profiledir option, specifying the path to the profile you wish to use. if you give --profiledir a path to a nonexistent profile, cfx will create a profile there for you. so you just have to make up a path and name the first time, and keep using it: cfx run --profiledir=~/addon-dev/profiles/boogaloo the path must contain at least one "/" (
although you may specify just "./dir"). using configurations the --use-config option enables you to specify a set of options as a named configuration in a file, then pass them to cfx by referencing the named set. you define configurations in a file called local.json which should live in the root directory of your sdk. configurations are listed under a key called "configs". suppose your the follow...
cfx to jpm - Archive of obsolete content
contain "@", then you must append "@jetpack" to it when switching to jpm. if you do this, the add-on's id will be the same as it was when you were using cfx. entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox starts, or when the add-on's installed, enabled, or upgraded. with cfx, this defaults to "lib/main.js",
although it can be set to a different file using the main field in package.json. in jpm, the entry point defaults to "index.js". so when switching over to jpm: either rename your "main.js" to "index.js" and move it from "lib" to the top level or add a main field to package.json with the value "lib/main.js". loading modules the jpm tool uses the same logic as node.js to determine how to resolv...
package.json - Archive of obsolete content
add-ons manager unless the preferencesurl field is specified. see the documentation for the simple-prefs module. preferencesurl the url where the "preferences" button of your add-on in the add-ons manager will point to. use this to specify a custom preferences page instead of the built-in ui provided by the add-on manager. preferences-branch use this to specify an
alternative branch for your add-on's simple-prefs. see "simple-prefs in the preferences system" for more details. title the human-readable title of the package; this can contain spaces. if this key is present, its value will be used as the add-on's em:name element in its install.rdf. translators an array of strings listing the people who contributed to the l...
Storing annotations - Archive of obsolete content
d prevent the user from adding any more data until the add-on is back under quota.) respecting private browsing since annotations record the user's browsing history we should avoid recording annotations in private windows. there's a very simple way to do this: do nothing. by omitting the "private-browsing" key from the annotator's "package.json" file, the annotator opts out of private browsing
altogether. this means that its widget will not appear on any private windows and its selector and matcher content scripts won't run, so the user won't be able to enter any annotations in private windows. try it: execute cfx run and open a new private window: you should no longer see the annotator's widget. now we can create and store annotations, the last piece is to display them when the user lo...
Creating Reusable Modules - Archive of obsolete content
r add-on developers and effectively extending the sdk itself. in this tutorial we'll do exactly that with a module that calculates file hashes. a hashing add-on a hash function takes a string of bytes of any length, and produces a short, fixed length string of bytes as output. it's a useful way to create a "fingerprint" that can be used to identify a file. md5 is a commonly used hash function:
although it's no longer considered secure, it works fine outside a security context. here we'll write an add-on that lets the user select a file on disk and calculates its hash. for both these operations we'll use xpcom interfaces. file picker to let the user select a file we'll use nsifilepicker. the documentation for that interface includes an example which we can adapt like this: var {cc, ci} ...
Getting Started (jpm) - Archive of obsolete content
y called "data" in your add-on's root, mkdir data and save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png back at the command prompt, type: jpm run this is the jpm command to run a new instance of firefox with your add-on installed. if firefox can not be located, or you have installed firefox developer as an
alternate browser, you may need to provide the path to it. for example, in ubuntu: jpm run -b /usr/bin/firefox when firefox launches, in the top-right corner of the browser you'll see an icon with the firefox logo. click the icon, and a new tab will open with http://www.mozilla.org/ loaded into it. that's all this add-on does. it uses two sdk modules: the action button module, which enables you to...
Getting started (cfx) - Archive of obsolete content
the bin/activate script from the root of your checkout. then when you invoke cfx run or cfx xpi, you pass the "-o" option: cfx run -o this instructs cfx to use the local copies of the sdk modules, not the ones in firefox. developing without cfx run because cfx run restarts the browser each time you invoke it, it can be a little cumbersome if you are making frequent changes to an add-on. an
alternative development model is to use the extension auto-installer add-on: this listens for new xpi files on a specified port and installs them automatically. that way you can test new changes without needing to restart the browser: make a change to your add-on run cfx xpi post the add-on to the port specified you could even automate this workflow with a simple script. for example: while tr...
Dialogs and Prompts - Archive of obsolete content
t to add "headers" to windows. to get an idea of what it looks like, open options (or preferences) dialog in firefox or thunderbird (v1.0 and earlier only). the header to the right of the sections buttons is made with <dialogheader>: <dialogheader title="general" description="whatever"/> note, that you should only use this element in a <dialog>, because otherwise it may be not styled properly. (
although it seems to work in <window> as well). programmatic button access if you want to access the accept ("ok") and cancel buttons from script, use this: // disable the ok and cancel btns document.documentelement.getbutton("accept").disabled = true; document.documentelement.getbutton("cancel").disabled = true; links dialog.xml — xbl bindings for <dialog> and <dialogheader> elements. pa...
HTML in XUL for rich tooltips - Archive of obsolete content
the dom object to the html div element div.appendchild(injecthtml); } } window.addeventlistener('load', htmltip.onload, false); in the xul overlay, xmlns:html is used to enable html tags to be used inside the xul. 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. this is recommended for security reasons, especially if remote html is to be inserted. a number of menuitems have a tooltip attribute pointing to the same tooltip. that tooltip is empty now, but we will use the mouseover event to dynamically populate the tooltip (which is about to be shown) with a different message for each menuitem. this is done by calling the o...
JavaScript Debugger Service - Archive of obsolete content
try to avoid using it. 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. however, jsd has been removed in favor of the debugger api. see the tracking bug bug 800200 for more details. snippets acquiring the service we acquire the service by calling the xpcom object. ...
Preferences - Archive of obsolete content
ay properties in xul components). this technique will work no matter how or where the preferences are changed: in another browser window, directly in the about:config interface, or even by another extension. note: during gecko 13 development, nsiprefbranch2 was deprecated, and its methods moved to nsiprefbranch. calling .queryinterface(components.interfaces.nsiprefbranch2) is no longer required,
although it still works. here is a straightforward example: var myprefobserver = { register: function() { // first we'll need the preference services to look for preferences. var prefservice = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); // for this.branch we ask for the preferences for ext...
JavaScript Daemons Management - Archive of obsolete content
othing but a clone of minidaemon with an added support for init and onstart functions declarable during the instantiation of the daemon. so the minidaemon framework will remain the recommended way for simple animations, because daemon without its collection of methods is essentially a clone of it. the architecture of the daemon constructor explicitly avoids the use of closures. it also offers an
alternative way to pass the this object to the callback functions (see the "this" problem for details). advantages of this approch: abstraction passage of this object to javascript timers (both setinterval and settimeout) optimisation (avoiding closures) modularity the code the code of this framework is split into three files: daemon.js (the core) daemon-safe.js (an extension of the cor...
Communication between HTML and your extension - Archive of obsolete content
eceipt of the ajax request. after the html component was update with the result of the ajax request, i created and dispatched the event like this: var event = document.createevent("events"); event.initevent("my-custom-event", true, true); document.body.dispatchevent(event); in the code of the extension that catches the loading of a new page i added this code: var doc = aevent.origin
altarget; // doc is document that triggered "onload" event // do something with the loaded page. // doc.location is a location object (see below for a link). // you can use it to make your code executed on certain pages only. if (doc && doc.addeventlistener) doc.addeventlistener("my-custom-event", myextension.customreceived, false); since the event is dispatched after the element in...
Chapter 1: Introduction to Extensions - Archive of obsolete content
ension table 1 shows the various customization options available to a user in firefox. users have flexible customization options, using css in user style sheets and javascript/dom in user scripts (these depend on stylish, greasemonkey, and userchrome.js). in addition to css and javascript, extensions can take advantage of xul and xpcom technologies for more sophisticated features. themes, which
alter firefox's appearance, are a kind of add-on. in order to create an extension, you need an idea and just a little programming ability. the following chapters explain in detail the extension-writing techniques of some of japan's leading extension authors. we encourage you to try your hand at it as well. 1 one of the authors of this special edition, piro, is world-famous as one of the original d...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
try to avoid using it. draft this page is not complete. « previousnext » this document was authored by taiga (gomita) gomibuchi and was originally published in japanese for the firefox developers conference summer 2007. gomita-san won "most useful upgraded extension" award in mozilla's 2006 "extend firefox" competition for scrapbook, and was runner-up in the "extend firefox 2" contest for firegestures. the chapters so far have each focused on technologies in isolation—xul, javascript, css, and xpcom. in this chapter, we’ll discuss how to put them together to actually build an extension. ...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
nd svg can be interspersed in one another as a means to extend the language. all elements can carry a "namespace uri" identifier, which is unique for each language. for example, even though xhtml and svg have elements with the same name, these can be distinguished. the namespace uri for xhtml is "http://www.w3.org/1999/xhtml" ; for svg is it "http://www.w3.org/2000/svg". css: a style language to
alter the display of xml documents like xml, cascading style sheets (css) is a technical specification established by the w3c; it is a style-description language defining the display of data marked up in xml and html. as shown in listing 1, it has an extremely simple syntax. by separating the structure of the data, expressed through html or xml, and the display style, indicated by css, data can be r...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
s of a folder. listing 9: listing the contents of a specific directory file.initwithpath('c:\\'); var children = file.directoryentries; var child; var list = []; while (children.hasmoreelements()) { child = children.getnext().queryinterface(components.interfaces.nsilocalfile); list.push(child.leafname + (child.isdirectory() ? ' [dir]' : '')); } alert(list.join('\n')); get parent directory
although the nsilocalfile object does not contain a function for moving to higher directories, listing 10 does show how you can use the parent property to get the parent directory of the current file. listing 10: creating a backup of a specific file in a separate folder file.initwithpath('c:\\temp\\temp.txt'); backupfolder = file.parent.parent; // c:\ backupfolder.append('backup'); // c:\backup bac...
Adding Events and Commands - Archive of obsolete content
ted thing to manage, there are some high level wrappers that facilitate working with it. also keep in mind that there are 2 drag and drop apis, the newest (and preferred) one introduced in firefox 3.5. event handlers can take an event argument, which is an event object that holds information on the event. you can get information on key modifiers (in case the user was holding a modifier key like
alt while performing the event), screen coordinates for mouse events, and most importantly, the target element for the event. for example: <button label="&xulschoolhello.defaultgreeting.label;" oncommand="xulschoolchrome.browseroverlay.changegreeting(event);" /> then on the javascript code you would have something like this: changegreeting : function(aevent) { // more stuff aevent.target.se...
Appendix F: Monitoring DOM changes - Archive of obsolete content
web applications to monitor changes to the dom by other scripts. unfortunately, adding listeners for any of these events to a document has a highly deleterious effect on performance, an effect which is not mitigated in the slightest by later removing those listeners. for this reason, it is best to avoid using mutation listeners at all costs, especially from extensions. this document lays out some
alternatives which do not have such severe performance impacts. mutation observers mutation observers are the more efficient, w3c speced replacement for the highly inefficient mutation events. their major advantage is in their performance and their ease of use, especially when combined with simple libraries. their main disadvantage is that, due to their recent advent, support is currently limited t...
Connecting to Remote Content - Archive of obsolete content
entation used in javascript. unlike javascript, the json format doesn't allow any kind of code that can be run, only data. json used to be risky in terms of security because the favored way of parsing it was to use the javascript eval function. since eval executes any code contained in the string, workarounds had to be devised in order to close security holes. luckily, firefox now provides a few
alternatives for extension developers. the json page explains in detail how to parse json data in different versions of firefox and other applications. assume we need to parse the following data: {"shops": [{"name": "apple", "code": "a001"}, {"name": "orange"}], "total": 100} when the onload callback function is called, the response text is converted into a js object using the parse method. you c...
Intercepting Page Loads - Archive of obsolete content
browser exists in every browser window. we store the handler function in a private variable because later we want to remove it when we do not need it anymore. gbrowser.removeeventlistener("load", this._loadhandler, true); finally, the actual code for the handler, which is very simple: _onpageload : function(event) { // this is the content document of the loaded page. let doc = event.origin
altarget; if (doc instanceof htmldocument) { // is this an inner frame? if (doc.defaultview.frameelement) { // frame within a tab was loaded. // find the root document: while (doc.defaultview.frameelement) { doc = doc.defaultview.frameelement.ownerdocument; } } } } the second if validation is necessary if you need to make a distinction for html docum...
Mozilla Documentation Roadmap - Archive of obsolete content
available through it will only grow with time. 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. the about:mozilla newsletter is a weekly publication that includes the highlights of what is posted at planet mozilla. it is a good
alternative if you feel planet mozilla is too much. you can also subscribe to receive it by email if you prefer that. posts on about:mozilla also make it to planet mozilla. the mozilla add-ons blog. this blog is maintained by the add-ons team at mozilla, and it's a great way to stay up to date with amo development and add-on review policies. this blog is also part of planet mozilla. irc and newsgr...
The Box Model - Archive of obsolete content
pine" /> </hbox> this is how it looks on mac os (the black border was added for illustrative purposes, boxes don't have borders by default): if you use a vbox instead, it looks like this: the orientation of boxes (and most xul elements) can be controlled using the orient attribute or the -moz-box-orient css property. with these you can make an hbox have vertical orientation and viceversa,
although that isn't very useful. the css property may be useful on some occasions, but using the orient attribute is not recommended because it mixes content and presentation. flexibility an html div is as big as its contents unless you override its dimensions using css. this is similarly the case for xul, except there are two flexibility directions to consider. an hbox is as big as its contents h...
Performance best practices in extensions - Archive of obsolete content
ynamic update processing. this is especially bad for the latter if the selector can dynamically start or stop matching. avoid unqualified ":hover" like the plague. avoid dom mutation event listeners dom mutation event listeners are extremely expensive and, once added to a document even briefly, significantly harm its performance. as mutation events are officially deprecated, and there are many
alternatives, they should be avoided at all costs. lazily load services the xpcomutils javascript module provides two methods for lazily loading things: definelazygetter() defines a function on a specified object that acts as a getter which will be created the first time it's used. see examples. definelazyservicegetter() defines a function on a specified object which acts as a getter for a serv...
Extensions support in SeaMonkey 2 - Archive of obsolete content
el="menuitem"/> </menupopup> </button> </hbox> technical note: the code that opens the url history popup just looks for any menupopup, so it goes wrong if you add your own. ordinary popups are fine of course. the statusbar in firefox 3 a new vbox has been added, called "browser-bottombox", which encloses the find bar and status bar at the bottom of the browser window.
although this doesn't affect the appearance of the display, it may affect your extension if it overlays chrome relative to these elements. for example, if you overlay some chrome before 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...
Security best practices in extensions - Archive of obsolete content
iframe or browser element in the sidebar, and loading your content there. give the element a type="content" attribute, which essentially sandboxes the code there and blocks callback rights into chrome. using eval() in an extension using the built-in javascript eval function is frowned upon in the context of extensions. while there are some legitimate use-cases, most of the time there are safer
alternatives. this blog post offers some excellent reasons not to use eval(). sandboxed http connections the main purpose of sandboxed http connections is to interact with a web service, without interfering with the cookies set in the browser by that service/site. for example, if you are loading pictures or other data from a photo sharing site, you can sandbox your connections to that site so that ...
Firefox addons developer guide - Archive of obsolete content
t ? gen's opinion: yes, because it is important for developers to make informed decisions regarding oss licenses and it was a part of the original guide. opinions: i think we should be careful about adding new contents to this guide. the original version of this guide was written as a first step guide for beginners. if we add too much topics, they possibly make learners weary. an
alternative idea: writing a "next step" guide for interested people such as adding statusbar buttons, sidebar panels, and so on. (by piro) i do think this guide should cover more advanced topics as well. there already is a tutorial for beginners: building an extension. slosd 09 april 2009 ...
Promises - Archive of obsolete content
ut powerful, interface for reading, writing, and manipulating both text and binary files. it is also available for use off-main-thread in workers as a synchronous api. this interface replaces the previous, complicated xpcom nsifile and streams apis, and their related javascript helper modules. these older interfaces should be avoided, even in their asynchronous forms, due to their performance pen
alties and needless complexity. representative example usage components.utils.import("resource://gre/modules/osfile.jsm"); task.spawn(function* () { // retrieve file metadata to check modification time. let info = yield os.file.stat(configpath); if (info.lastmodificationdate <= timestamp) return; timestamp = info.lastmodificationdate; // read the file as a utf-8 strin...
Using Dependent Libraries In Extension Components - Archive of obsolete content
re the necessary modifications you will need in order to write a stub loader for an os x extension. you will also need to make sure you are properly linking the xpcom glue libraries. see xpcom glue for the proper flags on how to link to the glue libraries. /* * os x stubloader * original stubloader code by benjamin smedberg <benjamin@smedbergs.us> copyright (c) 2005 * adapted for os x by w
alter johnson <zinkyu@gmail.com>, sept. 2008 */ //include the stuff from mozilla glue that we need #include "nsilocalfile.h" #include "nsstringapi.h" #include "nscomptr.h" //include things from the mach-o libraries that we need for loading the libraries. #include <mach-o/loader.h> #include <mach-o/dyld.h> static char const *const kdependentlibraries[] = { // dependent1.dll on windows, libdepende...
Add-ons - Archive of obsolete content
te add-ons and tools for creating, running, testing, and packaging add-ons. bookmarks.export() exports bookmarks to an html bookmark file. bookmarks.import() imports bookmarks from an html bookmark file. bootstrapped extensions browser.bookmarks.export( function() {...} // optional function ) code snippets … creating custom firefox extensions with the mozilla build system there is a we
alth of material on creating extensions for firefox. all of these documents currently assume, however, that you are developing your extension using xul and javascript only. for complex extensions, it may be necessary to create components in c++ that provide additional functionality. extension etiquette this article describes best practices when making extensions, including how to be kind to your us...
Underscores in class and ID Names - Archive of obsolete content
"space" in variable and function names. for example, a function whose job is to "get the length of a string" might be called get_string_length, and a variable representing the number of people who voted republican might be voted_republican. given this fact, authors who write css often attempt to employ the underscore in a similar fashion when creating class and id names. this should not be done.
although underscores are, as of this writing, technically permitted in class and id names, there are many historical and practical reasons why they should be avoided. 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: maroo...
XUL user interfaces - Archive of obsolete content
mozilla overcomes this limitation by providing a specialized language for creating user interfaces: xul (xml user-interface language, usually pronounced like "zool"). in xul, many common user interface features are built in. ...
Case Sensitivity in class and id Names - Archive of obsolete content
find out how this wrinkle can affect your site design and best practices to avoid any problems. in the authoring of both css and javascript/dom (otherwise known as dhtml) routines, it is a near-certainty that class and id names will be used to identify elements. we have discovered, however, that many authors are running into trouble with class and id names because they're used to the bugs of browsers that don't fully support open standards. the most common case is where the name uses different case in the document source than is found in the css or javascript. ...
Creating a status bar extension - Archive of obsolete content
reator the author's name. homepageurl the url of a web site the user can visit to get information about the extension, or to look for updates. this is not a required field, but including it is a nice thing to do. target application information it's also necessary to include information that identifies the application or applications in which your extension is designed to run.
although this sample extension only works in firefox, it's entirely possible to create extensions that work in multiple xul-based applications. it's also necessary to indicate what versions of the target application or applications your extension supports. if it won't work in older versions of firefox, or hasn't been tested on newer versions, you can restrict the extension so that only supported vers...
JXON - Archive of obsolete content
ng() method. nothing prohibits the use of any other conversion method. in addition, all properties of the tree with a true value will be converted into empty elements with no text nodes (see the code considerations). this is a good solution if you want to automate the creation of an xml document. it is a bad choice, however, if you want to re-build an xml document previously converted into json.
although the bidirectional conversion is very faithful (except for cdatasection nodes, which will be converted into text nodes), the process is unnecessarily costly. in fact, if your goal is to edit an xml document, it is strongly recommended to work on it rather than create new ones. the parker convention the functions listed above for the conversion of an xml document to json (often called "jxon ...
List of Mozilla-Based Applications - Archive of obsolete content
efox sogo groupware front-end uses thunderbird code songbird music xulrunner application spicebird collaboration suite spiderape embedding tool uses mozilla spidermonkey splashtop web browser browser part of instant-on operating system sqlite-manager database manager standalone version of add-on ste
althsurfer secure internet tools on usb key uses firefox and thunderbird streambase complex event processing platform seems to use xulrunner stylizer css editor css editor css editor with built-in firebug-like diagnostics and gecko 1.8 preview sun java enterprise system server products uses nss sundial browser with advanced domain name te...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
hunderbird-1.0.2/components/libautoconfig.so /usr/lib/thunderbird-1.0.2/defaults/autoconfig /usr/lib/thunderbird-1.0.2/defaults/autoconfig/platform.js /usr/lib/thunderbird-1.0.2/defaults/autoconfig/prefcalls.js bugs reports related for the record, for old 1.0.x releases... unwanted white space reappeared unfortunately the 'blank space bug' has reappeared in thunderbird 1.0.2. see bug 229271.
although it was corrected in mozilla mainstream: mozilla/extensions/pref/autoconfig/src/nsldapsyncquery.cpp 1.7.2.1 by late 2004, it is still present in thunderbird 1.0.2 at least :-(, so i applied the workaround i proposed in that bug report (start_pos += 1;). thunderbird 2.x beta 2 recently (2007/03/21) i've tested with thunderbird 2 beta 2 (2007/01/16) to check if autoconfig + ldap is still supp...
Autodial for Windows NT - Archive of obsolete content
not. to some users, it means connected to a network or not. some people expect an option to toggle online/offline should trigger dialup or disconnect. this is a misunderstanding of this mode. hanging up a dialup connection should not cause mozilla to go into offline mode. making a dialup connection should not cause mozilla to go into online mode. a pref to disable users can bypass the feature
altogether by setting the pref network.autodial-helper.enabled to false. since the feature was implemented close to the release of netscape 7, the pref was added so that we could include the feature in the 7.0 release with the feature turned off and enable it in specific cases. the feature was turned on in mozilla 1.1 to get more exposure. mozilla 1.1 also includes a fix to bug 157733, which allows o...
How Mozilla finds its configuration files - Archive of obsolete content
ointing to h:\mozilla a registry.xml file pointing to h:\mozilla an example of a prefs.js file (to put into the user's h:\mozilla directory). if you use the userd system from the lll project, you can generate this automatically with the user's personal values by using this template file prefs.js.tmpl n.b. mozilla includes a profile manager, but unfortunately this always include a random part (s
alt) into the profile's filename, and thus cannot be used to point mozilla to a profile of the our chosing. n.b. the above scripts have been tested with perl-5.8.0, xml-parser-2.34, xml-sax-0.13 and xml-simple-2.14. different versions of perl, or of these modules may lead to bugs. if you have trouble gettings these scripts to work on your system, there is also an online version available. ...
Bookmark Keywords - Archive of obsolete content
k into a folder by using the "file bookmark..." menu option. to open the bookmark manager go to "bookmarks" menu and select the "manage bookmarks" option. this will open up the bookmark manager. in figure 2, we can see the bookmark has been filed into a folder called "widgets." you can create a folder with another name, or not put your keymarks into a folder at all. changing the properties to
alter the properties of the bookmark, highlight the bookmark and select the "properties..." button at the top of the bookmark manager. this will open up a dialog box that will let you edit the properties of the bookmark. the original title of the bookmark won't apply. you can name the bookmark whatever you want, but it's often handy to make the title very similar to the keyword you plan to use. that ...
Creating a Firefox sidebar extension - Archive of obsolete content
e building an extension for more detailed information about structuring, packaging, and deploying extensions. packages extensions to firefox are installed with packages ("bundles"). an extension package usually contains a "content" provider, which contains the xul code and application logic. optionally locales and skins can be included. most additions are provided with a default tree structure,
although not required it is recommended to use this structure. here the package for the sidebar is created, the files included are listed below. example 1. package structure emptysidebar \- chrome |- content |- locale | \- en-us \- skin create all folders, except for skin. it is not used for this tutorial. the locale holds the locale, only the en-us locale is created. it is listed ...
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
s the tinderbox server and retrieves the current status. var gxmlhttprequest; function loadtinderboxstatus() { gxmlhttprequest = new xmlhttprequest(); gxmlhttprequest.onload = updatetinderboxstatus; gxmlhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxmlhttprequest.send(null); } xmlhttprequest is an interface in mozilla for retrieving documents via http.
although it is designed to retrieve xml content and parse it into a dom, it can retrieve (but not parse) other kinds of content as well. in this case we use it to retrieve an html page containing a brief summary of the current tinderbox state. that document gets updated by the tinderbox server every time a build finishes. it displays a list of active tinderbox clients along with the result of their l...
Tinderbox - Archive of obsolete content
codebase is broken. the mozilla sheriff, a rotating position responsible for watching the code and getting engineers to fix breakage, checks tinderbox even more regularly. while it isn't difficult to load the tinderbox web page or sidebar, it would be useful to have an even quicker way to check tinderbox that doesn't require going to a web page, changing sidebars, or even having the sidebar open.
although there are multiple tinderbox clients machines doing different kinds of builds (f.e. different platforms), most people only care about the overall situation, i.e. whether or not any clients have failed. by checking for build failures first and test failures second, we make sure to show users the worst possible situation, i.e. if any clients have failed to build, we will display a red icon tha...
Creating a hybrid CD - Archive of obsolete content
and rock ridge (unix). many mozilla files have long file names which makes creating the cd on a macintosh difficult because the hfs filesystem limits the length of file names to 32 characters. the utility mkhybrid lets you create hybrid cds that work with all three filesystems. mkhybrid was written by james pearson and is is a component of the latest versions of cdrecord. i used version 1.8.1a03
although you'll probably want to get a newer one. here's what i did to create the cd for the second anniversary party. mkhybrid -o ~/party.iso -r -j -hfs -v mozilla.party -map ~/hfsmapping ~/party/ cdrecord -v speed=2 dev=0,6,0 ~/party.iso its also handy to be able to mount an image file to test it. mount ~/party.iso /mnt/cdrom -t iso9660 -o loop=/dev/loop3,blocksize=1024 umount /mnt/cdrom here i...
Creating regular expressions for a microsummary generator - Archive of obsolete content
ntain the string "qqitemz" followed by the item number, and they all end with the string "qqcmdzviewitem". so we might construct the following regular expression to match these urls: ^http://cgi\.ebay\.com/.*qqitemz.*qqcmdzviewitem in this expression, we use .* twice, since there are two places where there may be some characters that vary between auction item urls. handling https urls note:
although ebay doesn't do this, occasionally a site will make pages available at both insecure and secure urls. for example, both of the following urls might point to the same page: http://www.example.com/index.html https://www.example.com/index.html to make a regular expression that matches both pages, we just need to start the expression with "https" and then add a question mark (?) after that ...
Dehydra - Archive of obsolete content
e "d" comes from "dehydra"), which is based on clang instead of gcc. try dxr instead, or else try the gcc python plugin: https://fedorahosted.org/gcc-python-plugin/. dehydra was a lightweight, scriptable, general purpose static analysis tool capable of application-specific analyses of c++ code. in the simplest sense, dehydra could be thought of as a semantic grep tool. it presented a we
alth of semantic information that can be queried with concise javascripts. 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. dehydra was built as a gcc plugin, thus it is easy to use for projects that already support gcc. dehydra is also useful for generating language bindings and is used to bootstrap treehydra, a heavy-duty st...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
ur which holds the flavour of the data. once you have the data, you can add it to the element is some way. for example, you might set the value of a textbox. var textobserver = { ondrop : function (event, transferdata, session) { event.target.setattribute("value",transferdata.data); } } the flavour system used allows multiple objects of various types to be dragged at once and also allows
alternative forms of the data to be dragged. the following table describes some of the flavours you might use. you can also make up your own flavours if necessary. text/unicode text data text/html html data text/x-moz-url a url application/x-moz-file a local file see here for an overview of more data flavours. « previousnext » original document information author(s): neil deaki...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
try to avoid using it. warning: this technology is obsolete. no active maintainer has stepped forward, and the code broke in firefox 4. the code has been removed from the mozilla source tree. xulrunner ships with the javaxpcom component, which allows java code to interact with xpcom objects. as you will see in this article, working with xpcom objects in java is not that much different than doing so in c++. ...
Error Console - Archive of obsolete content
console information displayed in error console can be accessed and manipulated through the console service. extensions can write to the error console from javascript using components.utils.reporterror, or if you're fine with logging to the os-provided console, dump(). to bring up error console from within a browser or mail window, use the function tojavascriptconsole().
alternatives console2 this extension provides a replacement for error console, fixing many of its bugs and implementing long-wanted enhancement requests. firebug the extension for firefox also integrates the error console with various improvements. related topics javascript, css web development ...
Exception logging in JavaScript - Archive of obsolete content
when an exception is unhandled in frame 4). note that the following will have no effect on the ns_nointerface exceptions outlined in rules 3 and 4 above - those exceptions will not be reported in any case. there are two ways you can accomplish this. first, you can set the boolean preference dom.report_all_js_exceptions. if this preference is true, all exceptions from inner frames will be logged.
alternatively, you can set the environment variable moz_report_all_js_exceptions. it doesn't matter what value you set this to (it can even be 0). if the variable exists, all exceptions from inner frames will be reported. see also error console bug 415498 ...
JSS build instructions for OSX 10.6 - Archive of obsolete content
cvs login cvs co -r nspr_4_8_7_rtm nspr cvs co -r nss_3_12_9_with_ckbi_1_82_rtm nss cvs co -r jss_4_3_2_rtm jss build nss for 32 and 64: cd mozilla/security/nss make nss_build_all cc="gcc -arch i386" ccc="g++ -arch i386" make nss_build_all use_64=1 build jss for 3...
Style System Overview - Archive of obsolete content
each declaration block is represented by an nscssdeclaration an cssstyleruleimpl contains each selector associated with that declaration, and the declaration, and is the most important implementation of nsistylerule. the declarations (properties & values) are stored in data structs (nscss*). the data format of the structs and selectors is mostly clear from the code and not worth going into (
although the implementation of :not() is confusing). css style rule representation h1, h2 { color: green; text-align: right; text-indent: 0; } cssstyleruleimpl cssstyleruleimpl ↓ ↓ ↓ ↓ h1 nscssdeclaration h2 ↙ ↘ nscsscolor — color: green nscsstex...
GRE Registration - Archive of obsolete content
:\path\to\second-installation when installing a gre via the mozilla suite gre installer, the installer will blindly overwrite any previous gre information in hklm/software/mozilla.org/gre/<version>. when installing a gre via the command line <tt>xulrunner.exe -register-global</tt>, xulrunner will detect that there is already an installation at hklm/software/mozilla.org/gre/<version> and will try
alternate keys <version>_1 _2 until an available key is found. mac on mac, the only gre is the libxul framework xul.framework. this framework is installed either in /library/frameworks/xul.framework/versions/<version> or in ~/library/frameworks/xul.framework/versions/<version>. linux on linux, registration information is kept in ini-style files of the following form: [1.7.10] gre_path=/usr/lib...
Helper Apps (and a bit of Save As) - Archive of obsolete content
sets up temporary file and instantiate the nsihelperapplauncherdialog in onstartrequest. puts the data in the file as ondataavailable notifications come in. knows how to launch a helper application on the data based on the nsimimeinfo. knows how to save the data to disk at a given location if the user decides to do so. nsexternalapphandler::onstartrequest creates a temporary file with a s
alted name to hold the data. decides on a suggested filename for the data in case it will be saved. decides whether the data should be content-decoded (based on some not-so-great heuristics). decides whether the user should be prompted (based on a preference). calls show() on the nsihelperapplauncherdialog, which asynchronously puts up the helper app dialog. nsexternalapphandler::ondataavailabl...
Introducing the Audio API extension - Archive of obsolete content
the audio data api extension extends the html5 specification of the <audio> and <video> media elements by exposing audio metadata and raw audio data. this enables users to visualize audio data, to process this audio data and to create new audio data. obsolete since gecko 28 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. deprecated since gecko 22 (firefox 22 / thunderbird 22 / seamonkey 2.19)this feature has been removed from the web standards. though some browsers may still support it, it is in the process of being dropped. avoid using it and update existing code if possible; see the compatibility table at...
Java in Firefox Extensions - Archive of obsolete content
functionality, see liveconnect for the pointers. note bug 834918 about click-to-play effect on java plugins in chrome and bug 775301. if you are in need of calling java code from within a firefox extension, you can make use of liveconnect. liveconnect gives your extension's javascript code (linked from or contained in xul code) access to 2 objects: java and packages (note that per this thread,
although the new documentation for the liveconnect reimplementation states that these globals will be deprecated (in the context of applets), "firefox and the java plug-in will continue to support the global java/packages keywords, in particular in the context of firefox extensions."). these 2 objects let you make use of the standard jdk classes, e.g., var ajavalist = new java.util.linkedlist(); if ...
Simple Storage - Archive of obsolete content
ore need only use the various standard javascript functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is an implementation detail. jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). the object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(),
although the data comes loaded automatically. don't abuse these methods, since they cause firefox -- all of firefox -- to drop what it's doing to make a trip to the disk. if you call them too often, firefox may become unresponsive for some of your users. unless you are doing something strange, let jetpack flush your data for you. the namespace currently lives in the future and must be imported before...
Simple Storage - Archive of obsolete content
ore need only use the various standard javascript functions and operators. the jetpack.simple.storage object is automatically and periodically flushed to disk. how and when it is flushed is an implementation detail. jetpacks can flush it manually, however, by calling jetpack.storage.simple.sync(). the object can also be forced to reload its data from disk by calling jetpack.storage.simple.open(),
although the data comes loaded automatically. don't abuse these methods, since they cause firefox -- all of firefox -- to drop what it's doing to make a trip to the disk. if you call them too often, firefox may become unresponsive for some of your users. unless you are doing something strange, let jetpack flush your data for you. the namespace currently lives in the future and must be imported before...
jspage - Archive of obsolete content
h(/over|out/)){switch(j){case"mouseover":l=a.relatedtarget||a.fromelement; break;case"mouseout":l=a.relatedtarget||a.toelement;}if(!(function(){while(l&&l.nodetype==3){l=l.parentnode;}return true;}).create({attempt:browser.engine.gecko})()){l=false; }}}}return $extend(this,{event:a,type:j,page:i,client:c,rightclick:e,wheel:h,relatedtarget:l,target:g,code:b,key:m,shift:a.shiftkey,control:a.ctrlkey,
alt:a.
altkey,meta:a.metakey}); }});event.keys=new hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});event.implement({stop:function(){return this.stoppropagation().preventdefault(); },stoppropagation:function(){if(this.event.stoppropagation){this.event.stoppropagation();}else{this.event.cancelbubble=true;}return this;},preventdefault:function(){if(this.event...
Mac OS X Build Prerequisites/fink - Archive of obsolete content
it doesn't seem to be as well maintained (in terms of available packages) as macports, so it is strongly suggested that you use macports instead of fink. you may download the most recent version of fink that is compatible with your operating system release. fink installs in /sw by default. the installer should configure the fink environment for you, making it available in any new terminal window. 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. libidl, glib using fink. libidl is included in the orbit installation. ...
Mozilla Application Framework in Detail - Archive of obsolete content
t or replace your current ui elements. xul provides an excellent answer for organizations with heterogeneous computing environments. customized xul applications with significant business logic can be written once, and used on the range of platforms that exist within the organization. in addition, if the organization maintains sophisticated, interactive websites, it will already possess a we
alth of technical expertise that will be relevant for creating xul applications. in addition to the technologies already mentioned, we go even further by allowing you to even create your own custom interface widgets. don't feel limited by the widgets that the framework already contains! xbl (extensible binding language) allows you to expand your library of interface elements, and even construct your ...
Mozilla Crypto FAQ - Archive of obsolete content
etscape psm binaries see the netscape personal security manager for mozilla page. what is the open source license used for the mozilla crypto code? the released source code is dual-licensed under the mpl and the gpl. the mozilla ssl, s/mime, and pki source code is licensed under the mozilla public license (version 1.1), with the gnu general public license (version 2.0 or later) available as an
alternate license. you may choose to use the code either under the terms of the mpl or under the terms of the gpl. 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 project...
How to Write and Land Nanojit Patches - Archive of obsolete content
try to avoid using it. nanojit was removed during the development of (firefox 11 / thunderbird 11 / seamonkey 2.8), so this information is relevant to earlier versions of the codebase. adobe and mozilla share a copy of nanojit. this means that landing nanojit patches is a bit complicated, but experience has taught us that this is much better than having separate versions of nanojit. ...
Configuration - Archive of obsolete content
il.google.com name the display name of the application: gmail icon the icon you want to use for the prism window when running this web app. the actual icon file should be stored in the webapp bundle. status turns the status messages on or off for this web app: yes or no location turns the readonly location bar on or off for this web app: yes or no navigation turns the hotkey history navigation (
alt+left,
alt+right and
alt+home) on or off for this web app: yes or no splashscreen filename of an html page to be displayed while the app is loading. the file must be located in the web app home directory: splashscreen.html include uris that should be opened in the web app, rather than in the default browser. an asterisk is used to match any string. separate multiple uris with commas: *google.com, ...
Prism - Archive of obsolete content
prism is a simple xulrunner-based browser that hosts web applications without the normal web browser user interface. prism is based on a concept called site-specific browsers (ssb). an ssb is designed to work exclusively with a single web application. it doesn’t have the menus, toolbars and other accoutrements of a traditional web browser. an ssb also offers tighter integration with the operating system and desktop than a typical web application running through a web browser. applications running in an ssb are therefore able to benefit from many of the advantages of the desktop and of the web at the same time. ...
Getting File Information - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. the nsifile object has a number of useful attributes which may be used to r...
Uploading and Downloading Files - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. the io object and stream objects can be used to upload files to servers in ...
Writing to Files - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. to write to a file, an output stream is used. an output stream is an object...
IO - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. files and streams this section describes how to access and get information a...
Moving, Copying and Deleting Files - Archive of obsolete content
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. there are several methods of the nsifile object which may be used to move a...
International characters in XUL JavaScript - Archive of obsolete content
tf-8 if no charset parameter is specified, the same rules as above apply. cross-version compatibility if you want the same code to work in both gecko 1.8 and earlier versions, you must limit yourself to ascii. 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. this can not be done in xul files loaded from the web, only in privileged code, e.g. in extensions. ...
getFormattedString - Archive of obsolete content
%1$s, %2$s, etc.) can be used to specify the position of the corresponding parameter explicitly. if you need to handle substitutions involving plurals, take a look at localization and plurals. ...
OpenClose - Archive of obsolete content
rwise the menu is closed. var open = somemenu.open; opening a popup for opening menupopups that use the menu tag, the button tag and the toolbarbutton tag, see opening menus above. popups attached using the popup attribute will be opened when the user clicks the mouse with the left mouse button. there isn't a means of replicating this action with the keyboard, so you should always provide an
alternate means of accessing the functionality of the menu. this can be done by either placing
alternate commands elsewhere in the user interface, or by providing a keyboard shortcut to open the menu. once the menu is open, the keyboard can be used to navigate and select items as usual. popups attached using the context attribute are opened when the user performs an action that attempts to open a co...
Panels - Archive of obsolete content
lf. in this example a cancel button has been added. for more information about these types of panels, see floating panels. focus in panels elements within panels may be focused with the mouse, and the currently focused element may be adjusted by pressing the tab key. when a popup is opened, if an element in the main window is focused, that element is unfocused, and a blur event is fired at it.
although no element within the popup panel is focused by default, the user may focus the first element within the panel by pressing the tab key. if you want to set the focus to an element by default when a panel is opened, adjust the focus within a popupshown event handler. for instance, to have the textbox initially focused in the example above: <panel id="search-panel" onpopupshown="document.getel...
Actions - Archive of obsolete content
bel="?relateditem"/> </hbox> </action> in this example, the hbox will be generated for each result, assigned an id of the value of the ?relateditem, and the label and button will be added inside it. the button's label will be the value of the ?relateditem variable. you would only use the uri attribute on a single element since only one of the generated elements should be given a particular id.
although the uri attribute should only be on one element, it does not have to be the outermost element in the action body. you can place other elements outside this to serve as containers for all the results. one difference is that this content is only generated once, not for every result. only the content at the element with the uri attribute and below is copied for each result. for example, if the ...
Attribute Substitution - Archive of obsolete content
parate a variable with normal text: <label value="?name" class="?gender^german"/> these last two examples have been setting the class attribute on a label. the effect will be that a label will have either the 'malegerman' or 'femalegerman' class. in a stylesheet, you could set properties for each of these classes such that different values appear differently without having to use multiple rules.
although not common, you may also wish to insert a question mark or caret into an attribute value. to do this, just use two question marks or two carets in a row. for instance: <label value="what is my name?? my name is ?name"/> in this example, the label might be 'what is my name? my name is jake'. note that a caret only has a special meaning at the end of a variable, thus two in a row are only nee...
Building Menus With Templates - Archive of obsolete content
applies only to the menu itself. generating a recursive menu menus are often generated from a template recursively. when creating recursive menus, you will need to use multiple rules, since leaf items will need to be created differently than non-leaf items. leaf items will need to use a menuitem element whereas non-leaf items will need to use a menu element. this will involve at least two rules,
although you might use other rules if you had other differences to handle. here is an rdf example: <button label="houses in my neighbourhood" type="menu" datasources="template-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <template> <rule rdf:type="http://www.xulplanet.com/rdf/house"> ...
Building Trees - Archive of obsolete content
0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4). using tree properties since we need to use special css for trees, the properties attribute on a cell becomes extremely useful. it can be used to define extra properties for reference later in a stylesheet. for example, if the properties attribute was set to the value "?creator", you could style the photos created by different people differently.
alternatively, you could also use static values (in addition to variables) in the properties attribute. for instance, consider the following css: treechildren::-moz-tree-cell(dave) { background-color: lightgreen; } this would set the background color of a cell to green for any cell with the “dave” property. you can also use the properties attribute on the treerow to change the style for an ent...
Multiple Queries - Archive of obsolete content
xmlns:dc="http://purl.org/dc/elements/1.1/"> <template> <rule dc:title="canal"> <button uri="rdf:*" image="rdf:*" label="view" orient="vertical"/> </rule> <rule> <image uri="rdf:*" src="rdf:*"/> </rule> </template> </hbox> the result to the user in this example is the same as the previous example. you can also mix simple and extended queries in one template,
although you may prefer to use the same style in all queries for consistency. however, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. this is because all simple queries will iterate over the same data, usually the children of an rdf container. so the builder only performs this step once and filters th...
Multiple Rules - Archive of obsolete content
reversing the results that match. for example, these two conditions have the opposite effect. the first matches only results with a ?title of 'canal', and the second matches those that do not. <where subject="?title" rel="equals" value="canal"/> <where subject="?title" rel="equals" value="canal" negate="true"/> you can use the negate attribute with all of the relational operators. for example,
although there is no 'greater or equal' operator, you can acheive this effect with a negated 'less' operator. <where subject="?age" rel="less" value="10" negate="true"/> additional where clause attributes by default, the case of values must match in a condition. you can disable this for a where clause by setting the ignorecase attribute to true. the following example matches names that contain ei...
RDF Modifications - Archive of obsolete content
emplate builder, an nsirdfobserver, used to listen for modifications to the rdf datasource. naturally, this only applies to rdf queries. when the datasource is modified, the datasource will notify any observers of the change. the template builder uses these notifcations to update the template as necessary based on the new or removed information. you don't need to implement this observer yourself,
although you may add an observer to the datasource if you want to be notified when the data changes. note that this automatic updating of the template does not occur for xml and sqlite sources, only for rdf datasources. however, as it is possible to use and/or implement other query types with templates, these additional types may support automatic updating. there are two main situations when the noti...
Simple Example - Archive of obsolete content
lace from above"/> <rdf:description rdf:about="http://www.xulplanet.com/ndeakin/images/t/canal.jpg" dc:title="canal"/> <rdf:description rdf:about="http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg" dc:title="obelisk"/> </rdf:rdf> in this example, we have three images, which can be identified by urls. the resource uris correspond to their actual urls
although this isn't necessary. each image also has one property, the image's title. a template which displays this information is very simple to create. unlike previous examples where we iterated over a property to navigate the graph, here we want to iterate over the children of an rdf container. the container, an rdf seq, has the uri 'http://www.xulplanet.com/rdf/myphotos'. this will be the starting...
Sorting Results - Archive of obsolete content
are generated from a query, content is generated in the same order as the results. for an xml datasource, generated content will be output in the order corresponding to the results of the xpath query expression. for an sqlite datasource, the generated content corresponds to the order of results of the sql query. for an rdf datasource, again, the results are in the order the query generates them,
although except in the case of an rdf seq, this order is arbitrary as rdf triples don't occur in any particular order. when the reference node is an rdf seq container and the results are in that container, however, the template builder orders the results in the order the items appear in the seq. for instance, the photos are listed in the same order in this example as they appear in the seq in the dat...
Static Content - Archive of obsolete content
he datasource beforehand as mentioned for the last example isn't necessary, as the existence of the static content is another effective workaround. so, if you're using menulists with templates and the data isn't displaying properly when the data hasn't loaded, try using a static menupopup. it doesn't even need to have any items in it. the static content may be placed before or after the template,
although usually you would place it first. note that the static content is always placed before the generated content, so the 'all' item will always be the first item in the menu. static content example let's look at another example, involving radio buttons. actually, this example is similar, it just uses a radiogroup instead of a menulist to display the list of countries. <radiogroup datasources...
Using Multiple Queries to Generate More Results - Archive of obsolete content
" dc:title="nathan"/> <rdf:description rdf:about="http://www.xulplanet.com/rdf/person/2" dc:title="karen"/> we can then use two queries to generate results from different parts of the datasource. the first query will match the streets as before, but the second query will generate a result for each person. a header class is used to distinguish the content,
although you could use exactly the same content if you wish. <template> <queryset> <query> <content uri="?start"/> <member container="?start" child="?item"/> </query> <rule> <binding subject="?item" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <action> <label uri="?item" value="?title" class="header"/> </action> </rule> ...
XML Templates - Archive of obsolete content
expression which simply retrieves the person elements from within the datasource. as there are five in the xml document, five results will be generated. the action element defines the content to generate for each result. the content of the action element will be generated and repeated for each result, which in this case, is a listitem. the child of the action element has to have a uri attribute,
although it does not have to be a direct child. the element with the uri attribute and its children will be copied once for each result. any elements between the action element and this element are only copied once. this is useful when recursive generation or multiple rules are used, and we'll see examples of why this is useful later. for an rdf query, the uri attribute specifies the member variable;...
Textbox (XPFE autocomplete) - Archive of obsolete content
boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. searchsessions obsolete since gecko 26 type: space-separated list of session names set to a keyword indicating what type of data to look up for autocomplete. you may set multiple types by separating their names by spaces. the following values are possible,
although custom components may be installed which add others. history: the user's url history is searched. obsolete since gecko 3 addrbook: the user's address book is searched. obsolete since gecko 3 ldap: the user's ldap directories are searched. obsolete since gecko 25 showcommentcolumn obsolete since gecko 1.9.1 type: boolean if true, a comment column appears in the...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
addon-bar')) is that once in the toolbar palette, users can configure it through the customize menu. they can drag it to the addon bar or to the toolbar. styling the button most toolbar buttons have icons. to attach an image to the button we use standard mozilla skinning facilities. if you're unfamiliar with how that works, read the skinning section of jonah bishop's excellent toolbar tutorial.
although the article covers creating an entire toolbar, rather than just a button, it has a great explanation of the techniques we'll use here. icon size toolbar buttons can have two different sizes -- big and small. this means you'll need to provide two icons for each of your toolbar buttons. the dimensions of the icons in various applications for both modes are summarized in the following table (...
Complete - Archive of obsolete content
ces/allcustom.js makes the connection between the description and the properties file, specifying the url: chrome://allcustom/locale/install.properties again, the application's chrome registry converts this url to the correct file for the locale you are using. for example, if your locale is fr-fr, it gets the description from: locale/fr-fr/allcustom/install.properties testing a locale to test the
alternative locale, install the extension in the normal way. restart the application using the command line switch: -uilocale fr-fr (of course, if your application is already in french, specify en-us here to switch the extension to english.) notes: if you use a shortcut or launcher icon to start the application, then you can add the command line switch by editing the icon's properties. the appli...
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
en rename the file to change the extension.) ensure that the package does not contain your working directory itself, but only install.js, content and all the files in content. to install the packaged extension, open the xpi file in seamonkey. (for example, drag the file's icon and drop it in seamonkey, or choose file – open file... from the menu bar.) distribute the xpi file to other users.
alternate "quick and dirty" method for hooking up a single preexisting xul file to display in seamonkey: as described above, find the seamonkey\chrome folder. create a subfolder (eg. seamonkey\chrome\myapp) and open it, placing your xul file within. now open a new text document in the same folder, pasting the following text within: <?xml version="1.0" encoding="utf-8"?> <!doctype rdf:rdf> <...
Custom toolbar button - Archive of obsolete content
application's menu bar. drag your new button to where you want it on the toolbar. press done to close the toolbar palette window. click the button to test it. you should see the pop-up message. further development this section describes how you can develop your button further. uninstalling the button if you ever want to uninstall the button, delete the directory that you created in step 2.
alternatively, use the application's extensions window to uninstall the extension in the normal way. the application deletes the directory the next time it starts. restart the application. troubleshooting if the button does not appear in the toolbar customization palette, or if you find some other problem, check that you have followed all the steps exactly. if necessary, uninstall the button and ...
Adding Buttons - Archive of obsolete content
text in grey. if the button is disabled, the function of the button cannot be performed. if this attribute is left out entirely, the button is enabled. you can switch the disabled state of the button using javascript. accesskey this should be set to a letter that is used as a shortcut key. this letter should appear in the label text and will typically be drawn underlined. when the user presses
alt (or a similar key that varies on each platform) and the access key, the button will be focused from anywhere in the window. note: buttons support more attributes than those listed above. others will be discussed later. some examples of buttons example 1 : source view <button label="normal"/> <button label="disabled" disabled="true"/> the examples above will generate the buttons in the im...
Adding Event Handlers - Archive of obsolete content
you can use the script element to include scripts in xul files. you can embed the script code directly in the xul file in between the opening and closing script tags but it is much better to include code in a separate file as the xul window will load slightly faster. the src attribute is used to link in an external script file. our find files example let's add a script to the find file dialog.
although it does not matter what the script file is called, usually it would be the same as the xul file with a .js extension. in this case, findfile.js will be used. add the line below just after the opening window tag and before any elements. <script src="findfile.js"/> we'll create the script file later when we know what we want to put in it. we'll define some functions in the file and we can c...
Adding HTML Elements - Archive of obsolete content
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. the tags must be entered in lowercase. "quotes" must be placed around all attribute values. xml requires a trailing slash at the end of tags that have no content. this may be clearer from the examples below. using html elements you can use any html tag
although some such as head and body are not really useful. some examples of using html elements are shown below. <html:img src="banner.jpg"/> <html:input type="checkbox" value="true"/> <html:table> <html:tr> <html:td> a simple table </html:td> </html:tr> </html:table> these examples will create an image from the file banner.jpg, a checkbox and a single-cell table. you should alwa...
Adding Labels and Images - Archive of obsolete content
t is intended for other descriptive text such as informative text at the top of a dialog box. images xul has an element to display images within a window. this element is appropriately named image. note that the tag name is different than html (image instead of img). you can use the src attribute to specify the url of the image file. the example below shows this: <image src="images/banner.jpg"/>
although you can use this syntax, it would be better in order to support different themes to use a style sheet to set the image url. a later section will describe how to use style sheets, but an example will be shown here for completeness. you can use the list-style-image css property to set the url for the image. here are some examples: xul: <image id="image1"/> <image id="search"/> style sheet: ...
Adding Properties to XBL-defined Elements - Archive of obsolete content
whenever a script attempts to get the value of the property, it is grabbed instead from the attribute on the element with the same name. whenever a script attempts to set the value of a property, it is set as an attribute on the element. this is convenient because then you can modify the property or the attribute and both will have the same value. getter element and setter element you can use an
alternate syntax for the onget and onset attributes that is useful if the scripts are longer. you can replace the onget attribute with a child element called getter. similarly, you can replace the onset attribute with a setter element. the example below shows this: <property name="number"> <getter> return this.getattribute('number'); </getter> <setter> var v = parseint(val,10); if (...
Adding Style Sheets - Archive of obsolete content
ll work, however they will look fairly plain. the style sheet applies various fonts, colors and borders to make the elements look more suitable. changing the styles however, there will be times when the default look of elements will not give the look that is desired. for this, we will need to add a style sheet of our own. so far, we have been applying styles using the style attribute on elements.
although this works, it is not really the best thing to do. it is much better to create a separate style sheet. the reason is so that different looks, or skins, can be applied easily. there may be certain cases where the style attribute is acceptable. an example would be when a script changes the style, or where a difference in layout might change the meaning of the element. however you should avoid ...
Box Model Details - Archive of obsolete content
/> <button label="push me!"/> </hbox> this example contains a horizontal box with two buttons in it, contained inside a flexible box. the box has the pack attribute which is used to center the buttons horizontally. the align attribute aligns the buttons vertically. the result is that the buttons will be centered in the box in both directions. this example will work with a vertical box as well,
although the second button will be underneath the first one, instead of beside it. a find text dialog example 5 : source view <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findtext" title="find text" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox flex="3"> <label control="t1" value="s...
Box Objects - Archive of obsolete content
layout for more advanced xul development. box objects the layout objects are not accessible to the developer for manipulating. they are internal to the xul layout components. however, xul provides some helper objects, called box objects, which can provide some layout related information. as the name implies, they are available for all box-based elements. there are several subtypes of box object,
although only a couple of them are generally used. the others have functions which are more easily accessible by methods mapped directly onto the element, since those types are generally only used with one particular element. the base box object, or the interface nsiboxobject, however, has a number of properties which are quite useful for xul development. the base box object has two useful features. ...
Broadcasters and Observers - Archive of obsolete content
rdingly. we saw something like this in a previous section where the disabled attribute was adjusted once and propagated to other elements. this attribute forwarding is quite useful for a number of purposes. for instance, let's say that we want the back action in a browser to be disabled. we would need to disable the back command on the menu, the back button on the toolbar, the keyboard shortcut (
alt+left for example) and any back commands on popup menus.
although we could write a script to do this, it is quite tedious. it also has the disadvantage that we would need to know all of the places where a back action could be. if someone added a new back button using an extension, it wouldn't be handled. it is convenient to simply disable the back action and have all the elements that issue the ba...
Commands - Archive of obsolete content
a controllers property which you can modify if desired. if the focus is inside a frame, each frame leading to the top-level window is checked as as well. this means that commands will work even if the focus is inside a frame. this works well for a browser, since editing commands invoked from the main menu will work inside the content area. note that html also has a commands and controller system
although you can't use it on unprivileged web pages, but you may use it from, for example, a browser extension. if the window doesn't provide a controller capable of handling the command, nothing will happen. you can get the command dispatcher using the document's commanddispatcher property, or you can retrieve it from the controllers list on an element or a window. the command dispatcher contains m...
Creating a Window - Archive of obsolete content
d instead of a document. several attributes can be placed in the window tag -- in this case there are four. in the example, each attribute is placed on a separate line but they do not have to be. id="findfile-window" the id attribute is used as an identifier so that the window can be referred to by scripts. you will usually put an id attribute on all elements. the name can be anything you want
although it should be something relevant. title="find files" the title attribute describes the text that would appear on the title bar of the window when it is displayed. in this case the text 'find files' will appear. orient="horizontal" the orient attribute specifies the arrangement of the items in the window. the value horizontal indicates that items should be placed horizontally across the ...
Custom Tree Views - Archive of obsolete content
="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. the tree will call methods of the view to get the information that it needs to display. in general,
although the tree view has thirty or so functions that may be implemented, you only need to implement the ones that the tree will call. three methods that you should implement are listed below. rowcount this property should be set to the total number of rows in the tree. getcelltext( row , column ) this method should return the text contents at the specified row and column. this will be call...
Introduction - Archive of obsolete content
s. in addition, you may have extra files for images or for platform specific data. xul is supported in mozilla and browsers that are also based upon on the gecko engine, such as netscape 6 or later and mozilla firefox. due to various changes in xul syntax over time, you will want to get the latest version for the examples to work properly. xul is fairly similar in firefox and to other browsers,
although it has some specific differences such as support for customizable toolbars. this tutorial attempts to cover much of xul's functionality, however, not all features are discussed. once you are familiar with xul, you can use the xul reference to find out about other features supported by specific elements. next » ...
Introduction to XBL - Archive of obsolete content
ods added to the element. they can be called from a script. events: events, such as mouse clicks and keypresses that the element will respond to. the binding can add scripts to provide default handling. in addition new events can be defined. style: custom style properties that the xbl defined element has. binding example the box is generic enough that you can use it to create custom widgets (
although you can use any element, even one you make up yourself). by assigning a class to a box tag, you can associate a binding to only those boxes that belong to that class. the following example demonstrates this. xul (example.xul): <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://example/skin/example.css" type="text/css"?> <win...
List Controls - Archive of obsolete content
ipple" value="raspripple" /> <listitem label="squash swirl" value="squash" /> </listbox> the example has been changed to display only 3 rows at a time. values have also been added to each item in the list. list boxes have some additional features, which will be described later. multi-column list boxes the listbox also supports multiple columns. each cell may have arbitrary content within it,
although usually only text is used. when the user selects an item in the list, the entire row is selected. you cannot have a single cell selected. two tags are used to specify the columns in the listbox. the listcols element is used to hold the column information, each of which is specified using a listcol element. you will need one listcol element for each column in the listbox. the listcell element...
Modifying the Default Skin - Archive of obsolete content
tionality. firefox provides a skin by default, and you may download others. the xul for any skins is the same, however the style sheets and images used are different. for a simple personalized look to a firefox window, you can easily change the style sheets associated with it. larger changes can be done by creating an entirely new skin. firefox has a theme manager for changing the default skin. (
although the underlying code for mozilla calls them skins and the user interface calls them themes, they're both referring to the same thing). a skin is described using css, allowing you to define the colors, borders and images used to draw elements. the file classic.jar contains the skin definitions. the global directory within this archive contains the main style definitions for how to display the...
More Event Handlers - Archive of obsolete content
o display the popup. if the default action is prevented, the popup will not be displayed. the default action can be prevented with the event object's preventdefault method, as in the example below. example 3 : source view <button label="types" type="menu"> <menupopup onpopupshowing="event.preventdefault();"> <menuitem label="glass"/> <menuitem label="plastic"/> </menupopup> </button>
alternatively, for attribute event listeners, you can just return false from the code. note that preventing the default action is not the same as stopping event propagation with the stoppropagation method. even if the default action has been prevented, the event will still continue to propagate. similarly, calling the stoppropagation method won't prevent the default action. you must call both methods...
More Menu Features - Archive of obsolete content
x> if you try this example, you'll find that of the first three menu items, only one can be checked. they are grouped together because they all have the same name. the last menu item, earth, while a radio button, is not part of this group because it has a different name. of course, the grouped items all have to be within the same menu. they don't have to be placed next to each other in the menu,
although it doesn't make as much sense if they aren't. next, we'll find out how to create popup menus. « previousnext » ...
More Tree Features - Archive of obsolete content
true, the user may drag the column headers around to rearrange the order of the columns. a user will also likely want to change the column widths. you can do this by placing a splitter element in between each treecol element. a small notch will appear in between each column header which the user may drag to change the width of a column. you can use the style class tree-splitter to hide the notch,
although the column may still be resized. you can set a minimum or maximum width of a column using the minwidth or maxwidth attributes. you can set the hidden attribute on a column to true to have the column hidden by default. the user can choose to show the column by selecting it from the drop-down on the end of the header row. remembering state of columns as with all elements, the persist a...
Numeric Controls - Archive of obsolete content
tboxes to enter each of the components of the date or time. <datepicker value="2004-03-24"/> <timepicker value="15:30:00"/> the value attribute is used to set the default value; if this attribute is omitted, the field will be initially set to the current date or time. the format of the attribute is exactly as above, that is dates are of the form yyyy/mm/dd and times are of the form hh:mm:ss (
although the seconds and the accompanying colon may be omitted). these two elements ensure that the user enters a value date or time. this way, you do not have to check for valid dates, ensure that the day isn't greater than the number of days in the month, handle leap years, and so forth. while the timepicker only comes is one style, the datepicker has three different variations. the default style s...
Popup Menus - Archive of obsolete content
nt. this is how tooltips appear (after_pointer is not currently implemented with respect to the mouse pointer. it currently offsets 21 pixels vertically from the anchor, see bug 619887). by adding the position attribute to a popup element, you can specify precisely where the popup appears. you cannot specify an exact pixel position. the position attribute can be used with all three popup types,
although you probably would not change the value for tooltips. the example below demonstrates creating a back button with a popup menu: example 3 : source view <popupset> <menupopup id="backpopup" position="after_start"> <menuitem label="page 1"/> <menuitem label="page 2"/> </menupopup> </popupset> <button label="pop me up" popup="backpopup"/> our find files example let's add a simp...
Property Files - Archive of obsolete content
ngs"); var result = strbundle.getformattedstring("resultmessage", [ dir, count ]); alert(result); this example will display following message in an alert box. 10 files found in the /usr/local/document directory. you will notice the formatting codes %1$s and %2$s is used, and replaced different order in the array. formatting code %n$s is specify the position of corresponding parameter directly.
although the word order is not the same in all the languages, by using getformattedstring() the specification of the order can be put out the property files. in case you need to format a string that already contains the percentage character in it (to get something like "50% off" returned), escape the percentage character with another percentage character, like this: my.percentage.string = %s%% off n...
Skinning XUL Files by Hand - Archive of obsolete content
dynamically, you should not create style information in a custom css file that controverts the global skin unless you really mean to. if your xul file is to be a part of a larger application that can be skinned, like mozilla, you probably want your xul file to pick up the global changes when the application is dynamically reskinned. ...
The Box Model - Archive of obsolete content
in this section, we'll look at how xul handles layout. introduction to boxes the main form of layout in xul is called the 'box model'. this model allows you to divide a window into a series of boxes. elements inside of a box will orient themselves horizontally or vertically. by combining a series of boxes, spacers and elements with flex and pack attributes, you can control the layout of a window.
although a box is the fundamental part of xul element layout, it follows a few very simple rules. a box can lay out its children in one of two orientations, either horizontally or vertically. a horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. you can think of a box as one row or one column from an html table. various attributes placed on the child ...
Updating Commands - Archive of obsolete content
the 'cmd_paste' command from the command dispatcher. then, it checks to see whether the command is enabled, and then executes the command using the docommand method of the controller. note that we don't need to figure out which element to use or which controller to use. the command dispatcher handles that part. also, we could just call docommand without checking if the command was enabled or not,
although we probably shouldn't do that. the code above is generic enough that it can be a function that takes a command as an argument and executes that command. this function could then be reused for all commands. in fact, this is common enough that mozilla includes a library which does just that. if you include the script 'chrome://global/content/globaloverlay.js' in a xul file, you can call the go...
Using Remote XUL - Archive of obsolete content
eed a text editor and a web browser that can render xul, like mozilla, or firefox. if you build a xul file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of xul files as application/vnd.mozilla.xul+xml. for apache, you can do this by adding the following line to your mime.types file: application/vnd.mozilla.xul+xml .xul
alternately, add this line to your httpd.conf file or, if the apache server is configured to allow it, to the .htaccess file in the directory from which the xul file is served: addtype application/vnd.mozilla.xul+xml .xul then restart your web server. with php you can send the mime-type with the header() function. <?php header('content-type: application/vnd.mozilla.xul+xml'); ?> <!-- xul markup...
Using the standard theme - Archive of obsolete content
styling for some of your widgets (apart from the standard global skin) you can take two different routes. you can either add multiple <tt>xml-stylesheet</tt> processing instructions to your xul file, or create an <tt>@import</tt> chain. no matter which approach you choose, do not forget to register your custom skin in the <tt>chrome.manifest</tt>. note that you can also mix these two approaches,
although it makes your code more readable when sticking to only one way. multiple <tt>xml-stylesheet</tt> processing instructions simply add one <tt>xml-stylesheet</tt> processing instruction for every style sheet you want to associate with your xul file: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://myextension/skin/custom.css" type="text/css"?> <...
Writing Skinnable XUL and CSS - Archive of obsolete content
l. any chrome url that references an image in the skin is strictly forbidden in the xul. if you find yourself needing to display an image from the skin, then use <titledbutton> and style it rather than using <html:img>. the problem here is that you'll end up placing a restriction on the skin, which will force the skin designer to supply an image with the exact name you've specified. this is not he
althy. note that some particularly evil people put images chrome urls in dtds. this is even worse, and it also is strictly forbidden. original document information author(s): david hyatt last updated date: may 24, 2000 copyright information: copyright (c) 1999-2000 david hyatt ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
what is an accesskey? an accesskey is an underlined letter in a web page, menu or dialog that indicates to a user a quick, keyboard method of simulating a click on that element. for example, an apply button may have the letter a underlined. on windows and unix, pressing
alt+a is a convenient way to push that button. on macintosh, accesskeys are available only in html not in xul, and they are activated using ctrl+letter instead of
alt. how is an accesskey added to a form control? an accesskey can be added to an html or xul form control or label by using the accesskey attribute. for example, here's how we add an accesskey to a xul button: <button label="apply instantly" accesskey="a" /> apply instantly - or - <button label="apply instantly" accesskey="a" />...
grid - Archive of obsolete content
is a layout type that arranges elements in rows and columns. the grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. the size and attributes defined on columns and rows will affect the size and placement of elements in each cell. elements placed within both the columns and rows will be displayed,
although usually only elements will be placed inside one of these. it is most common to place elements within the rows and use the columns only to define their flexibility and width. whichever of the columns and rows is last in the grid is displayed on top; commonly the columns element appears in the grid first. more information is available in the xul tutorial. example <!-- groupbox containing ...
panel - Archive of obsolete content
will be hidden when the user clicks outside the panel or switches focus to another application. if true, the panel will only be closed when the hidepopup method is called. norestorefocus type: boolean if false, the default value, then when the panel is hidden, the keyboard focus will be restored to whatever had the focus before the panel was opened. if true, the focus will not be reset,
although it will be cleared if the focus is within the panel. onpopuphidden type: script code this event is sent to a popup after it has been hidden. this event may also be received while the popup is still open, but when sub-menus contained within this popup are hidden. example: <menupopup id="top" onpopuphidden="console.log('the onpopuphidden method of id=top was called.');"> <...
stringbundle - Archive of obsolete content
pleenumerator an enumeration of all of the strings in the string bundle. the enumeration contains nsipropertyelement objects. methods getformattedstring( key, strarray ) return type: string looks up the format string for the given key name in the string bundle and returns a formatted copy where each occurrence of %s (uppercase) is replaced by each successive element in the supplied array.
alternatively, numbered indices of the format %n$s (e.g. %1$s, %2$s, etc.) can be used to specify the position of the corresponding parameter explicitly. if you need to handle substitutions involving plurals, take a look at localization and plurals. getstring( key ) return type: string returns the string with the given key name from the string bundle. inherited methods addeventlistener(), ...
toolbar - Archive of obsolete content
when set to false, the default, the toolbar is visible. this only has an effect on windows and needs to be combined with type="menubar" and a menubar element. currentset not in seamonkey 1.x type: comma-separated string the current set of displayed items on the toolbar. this will be modified when the user customizes the toolbar. the value of this attribute sho...
toolbarbutton - Archive of obsolete content
related ] a button that appears on a toolbar. it is equivalent to a regular button except that it may be rendered differently. typically, it is expected to have an image. more information is available in the xul tutorial. relevant accessbility guidelines all toolbar functionality should be duplicated elsewhere in the application where possible, provide keyboard
alternatives. where possible, duplicate functionality in a menu item or context menu. where not possible, make all toolbarbuttons focusable by -moz-user-focus: normal. attributes accesskey, autocheck, checkstate, checked, command, crop, dir, disabled, dlgtype, group, image, label, oncommand, open, orient, tabindex, title, type, validate propert...
treechildren - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element is the body of the tree. for content trees, the content will be placed inside this element. this element is also used to define container rows in the tree. more information is available in the xul tutorial. attributes
alternatingbackground attributes
alternatingbackground obsolete since gecko 2.0 type: boolean if true, the background of the tree's rows will
alternate between two colors. you can use the :-moz-tree-row css style to do this instead. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags...
Components - Archive of obsolete content
(s) in there. unlike extensions, it must be directly in that directory, not a subdirectory. then you need to make sure that it gets registered. registration most initial problems with components are due to registration. for new components or interface changes of existing ones to be noticed at all, you need to change the buildid in application.ini to trigger a re-registration of the components.
alternatively, you can delete compreg.dat and xpti.dat in the user profile directory - that of your xulrunner app, not that of firefox/mozilla. it's named after your vendor and app name in application.ini, e.g. linux: ~/.yourcompany/yourapp/oihizuf.default/ windows: %appdata%\yourcompany\yourapp\profiles\jhfdfdi.default\ ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
ctories you're going to need. and did i mention you'll have to write your application as well? the app/ subdirectory the app/ subdirectory is where you put files that are necessary for packaging your application as a xulrunner app. makefile.in - didn't we already do this one? nope. mozilla has a separate makefile.in for each directory that is part of the build. in this case, you'll be a happy, he
althier and more well-balanced if you don't try to understand the file at all. just copy it from mccoy. you don't even have to substitute in your application name for mccoy since it uses the app_name variable. application.ini - used for application packaging. a complete description can be found in xul application packaging. in this case you can basically copy over the file as is, since once again var...
Getting started with XULRunner - Archive of obsolete content
ry simple shell script (i call mine "run.sh"): #!/bin/sh /library/frameworks/xul.framework/xulrunner-bin `pwd`/application.ini linux on ubuntu, you can run the application from a terminal. first change into the \myapp folder, then start the application by: xulrunner application.ini you should now see a window that looks something like this. this particular screenshot is from ubuntu 10.
alternative: run xul apps with firefox with firefox 3 and later, you can tell the firefox executable to run a xul application from the command line. the xul application will run instead of the firefox browser that normally starts. this is similar to starting a xul app using xulrunner. see using firefox to run xulrunner applications. this does not work if firefox itself was installed as a xul app - y...
XULRunner Hall of Fame - Archive of obsolete content
b bluegriffon the next-generation web editor based on the rendering engine of firefox. build instructions convertigo enterprise mashup server a web integrator and web clipper tool to build enterprise mashups nightingale nightingale is a communtiy fork of the songbird media player, bringing back linux support and much more. build instructions kirix strata a new speci
alty browser for accessing and manipulating data from the web telekast an open source teleprompter and script editor. source tomtom home 2 pc application to manage tomtom gps devices understanding faith (desktop version) a multimedia religious education resource for catholic secondary schools in australia. vivipos integrated point-of-sales software-hardware solution wi...
XULRunner tips - Archive of obsolete content
ome://inspector/content/popupoverlay.xul chrome://inspector/content/viewers/stylerules/popupoverlay.xul overlay chrome://inspector/content/commandoverlay.xul chrome://inspector/content/viewers/dom/commandoverlay.xul to launch dom inspector in your application, you need to open its main window, with a command like this: window.open("chrome://inspector/content/inspector.xul", "", "chrome");
alternatively, the dom inspector may also be added as an extension: (if you already have inspector installed for another application you can skip to the next step) follow the instructions above through "unzip the package." create a file in the extensions directory of your application with the same name as the dom inspector id (inspector@mozilla.org) containing one line of text -- the exact path...
Windows and menus in XULRunner - Archive of obsolete content
windows and dialogs menus and toolbars os common dialogs controls or widgets windows each window or dialog should be created in its own xul file. the xul file may also contain other top-level declarations for css and dtd, which i will discuss in a moment. <window> is the basic windowing element in xul. it has attributes to set the title/caption as well as to control its width and height.
although i have not seen it mentioned yet, i am assuming that you can only have one <window> element per xul file. here is an example: <?xml version="1.0"?> <?xml-stylesheet href="chrome://basicapp/skin/main.css" type="text/css"?> <!doctype window system "chrome://basicapp/locale/main.dtd"> <window id="main" title="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.x...
calICalendarView - Archive of obsolete content
ts and calitodos. methods showdate void showdate(in calidatetime adate); ensures that the passed in adate is visible in the view. the view is free to show other days as well. setdaterange void setdaterange(in calidatetime astartdate, in calidatetime aenddate); ensures that the entire range of dates from astartdate to aenddate is visible. the view is free to show other dates as well,
although this should be kept to a minimum. (for instance, calendar-month-view will show all dates from the start of the week of astartdate to the end of the week of aenddate.) setdatelist void setdatelist(in unsigned long acount, [array,size_is(acount)] in calidatetime adates); this function can only be called if supportsdisjointdates is true and will throw an error if it is not. if supported, ...
nsIContentPolicy - Archive of obsolete content
ntent, or the processing of certain types of inline content. 63 introduced gecko 1.0 inherits from: nsicontentpolicybase last changed in gecko 42 (firefox 42 / thunderbird 42 / seamonkey 2.39) you can observe content that is being loaded into your browser by implementing nsicontentpolicy. 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. warning: do not block the caller in your implementations of shouldload() or shouldprocess() (for example, by launching a dialog to prompt the user for something).") note: in reality, much of this interface is defined in the nsicontentpolicybase interface, but for now is documented here until someone ha...
2006-11-10 - Archive of obsolete content
ibility success story aaron leventhal of ibm recently published a new article praising firefox accessibility. the article goes into the history of accessibility in firefox, details ibm's involvement and addresses some ajax accessibility concerns. the article closes with a glimpse at the future of firefox accessibility. read more... access keys in firefox 2 previous versions of firefox used the <
alt> key as a modifier. this has been changed to
alt+shift for content accesskeys due to the "conflicts with ui mnemonics" according to aaron leventhal. this is reported to have broken accesskeys using numeric values. see bug 349716. currently there is a work-around extension available at bug 357101 to temporarily solve this problem. accessibility in chatzilla gijs kruitbosch and aaron leventhal ha...
2006-10-06 - Archive of obsolete content
uncements sunbird and lightning 0.3rc1 available gordon announced the candidate (rc) builds for sunbird and lightning 0.3 are released. sunbird release notes lightning release notes sunbird_0_3_release tag being created lilmatt announced the sunbird 0.3 realse tag being created. sun microsystems contributes to lightning to combine it with openoffice.org sun microsystems provide users with an
alternative open source choice by combining openoffice.org respectively staroffice and thunderbird/lightning. discussions dialogs on app startup discussion regarding improvement of dialog of app window what are tasks? what are events? discussion regarding tasks and events meetings none this week. authors mark paruzel yi (eric) shen [back to weekly summaries ] ...
2006-11-03 - Archive of obsolete content
or uninstall a user suggests an option to remove profiles during setup or uninstall. does firefox provide any classes/objects or events to windows wmi ? a user asks if firefox provides any classes/objects or events to windows wmi. no replies yet. source code for the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. picking an
alternate search engine for a particular search large discussion about how the search engine could be imporved. firing pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab. ff 1.5 hiding a user adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user su...
2006-11-04 - Archive of obsolete content
profiles during setup or uninstall a user suggests an option to remove profiles during setup or uninstall. firefox provide any classes/objects or events to windows wmi ? a user asks if firefox provides any classes/objects or events to windows wmi. no replies yet. code for the nsinstall contained in moztools a user asks for advice about building nsinstall on windows. no replies yet. an
alternate search engine for a particular search large discussion about how the search engine could be imporved. pageshow/pagehide when users change tabs discussion about using events that could be fired when the user changes a tab. 1.5 hiding a user adds their "two cents" about firefox 1.5 now being easily available for download. suggestion: a built-in firefox feature a user suggests a f...
2006-10-06 - Archive of obsolete content
an be issued. hence, they are looking for a mac user to test out the new features by building a mac.rdf file with all of the various .mac account properties mentioned in the document here. discussions is thunderbird using a valid w3c coding? peter lairo requested someone who are knowledgeable in w3c standards to confirm if the use of <blockquote type="cite"> is valid w3c code. q & a q: w
alt experienced an unusual behaviour in his build and wanted to perform an experiment to figure out the problem, but he couldn't find the mozilla.org's config file. a: robert helmer pointed out the mozilla.org's config file could be found here and to look for -->mozconfig<---------------------------------------- -->end mozconfig<---------------------------------------- updated: developer documen...
Extentsions FAQ - Archive of obsolete content
all servers support user flags, in which case you get reduced functionality as follows: all flags are stored in your local cache and are lost if your cache gets invalidated, and only "known" properties are copied when messages are copied. the list of "known" properties is: junkscore junkscoreorigin label priority keywords. keywords - in the gui they are called tags. they replace the old labels (
although the labels are still recognised). preserved properties source code - nsimapmailfolder::copymessages uaq friday, september 22 - 29, 2006 (↑ top) why extension preferences do not get changed until after it's upgrade? why extension preferences do not get changed until after it's upgrade? is there a way of changing the thunderbird displays headers when replying and forwarding? ...
2006-10-27 - Archive of obsolete content
gages available for review final ff release already announced a french site has already announced final ff 2.0 and gives download links on its own site. update check failing in firefox 2.0 if add-on type is 8 testing a custom update.rdf file for a langpack using the official version of firefox 2.0 rc 3. discussions developing a spelling dictionary developing a spelling dictionary.
alternative german locale while the
alternative locale is active, the auto update of firefox stops working. problem with belarusian firefox 2 rc3 the broken message is displayed after user tries to visit non-existing site. meetings none for this week. authors paul yanchun gu (gpaul) aditya nanda kuswanto(vipers101) ...
JS-Engine FAQ - Archive of obsolete content
spidermonkey how long are private pointers? 2-byte aligned. check the jsval macros at the top of js/src/jsapi.h can an embedded spidermonkey js engine use domparser extension of mozilla? domparser is not part of js but part of mozilla browser which makes it available to script in the browser using xpconnect. an
alternative would be to use built-in e4x. newly created threads in js from mozilla_1_8_branch causes to hang in windows patch from bug 351602 should fix the problem. after applying that patch, recompile js and define js_use_only_nspr_locks in the build. spidermonkey library loading mechanism? 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 ...
2006-09-29 - Archive of obsolete content
summary: mozilla.dev.tech.layout september 22-29, 2006 announcements no announcements for this week. discussions discussion on how the firefox 1.5.0.7 dom generates xhtml inline elements using wordpress. it was determined that the generated elements from wordpress do not follow the wc3 guidelines in appendix c of xhtml 1.0.
although the w3 validation accepted the generated xhtml as valid, a bug identified within the html working group ignored the invalid elements. 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 t...
NPP_URLNotify - Archive of obsolete content
cription the browser calls npp_urlnotify() after the completion of a npn_geturlnotify() or npn_posturlnotify() request to inform the plug-in that the request was completed and supply a reason code for the completion. the most common reason code is npres_done, indicating simply that the request completed normally. other possible reason codes are npres_user_break, indicating that the request was h
alted due to a user action (for example, clicking the stop button), and npres_network_err, indicating that the request could not be completed, perhaps because the url could not be found. the parameter notifydata is the plug-in-private value passed as an argument by a previous npn_geturlnotify() or npn_posturlnotify() call, and can be used as an identifier for the request. see also npn_geturlnoti...
Why RSS Content Module is Popular - Including HTML Contents - Archive of obsolete content
: <description><![cdata[this is <b>bold</b>.]]></description> this helps reduce the bloat. however, the <description> is not suppose to be used for any of this. it is only suppose to be used to includeplain text. but rss still leaves us without a way to include html contents. the rss content module fills this gap. note: do not put anything butplain text into the rss <description> element.
although it has become common practice to use the rss <description> element and put non-plain text data in it. 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). the wording of this note should be reconsidered. an example using the most popular el...
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
may 2005 08:14:11 -0500</lastbuilddate></pubdate> <link>http://www.example.com/blog/2005/05/15/112</link> <slash:comments>118</slash:comments> </item> </channel> </rss> the <slash:comments> element is it reason that the rss slash module is popular. this element gives the (current) total number of comments made for the item -- for the blog post.
although not necessary, people also often use other rss modules to get at (and read) the comments (since rss does not currently provide facilities for this either). some use the well-formed web rss module for this. and some are now using atomic rss for this. (using either of these 2 rss modules is out of the scope of this article.) in reality, an item's comments count could change at any given time. ...
Getting Started - Archive of obsolete content
processor is not a text editor. if a word processor is used, you must make sure to save your rss files in a (pure and plain) text format. it is not mandatory to create rss files in this tutorial (you can just read on), but this would be a less effective way for you to learn. you'll retain the information more and absorb it better if you create the rss files yourself. how to use this tutorial
although each page in this tutorial has been written so that it can act as a "standalone" tutorial, it does assume you already possess the knowledge of the information taught in previous pages of this tutorial.
although you may jump to any point in the tutorial that you wish, we suggest that rss beginners read this tutorial in order. tutorial what is rss why use rss how rss works syndicating ...
Version - Archive of obsolete content
rss versions rss has a sordid history. different people and groups have largely unilaterally created specifications that they called rss. some rss formats are xml-based formats. and some rss formats are rdf-based formats. the list below is of all known rss versions. they are listed in chronological order of when they were released. note: in the list below,
although rss 1.0 seems to be out of place, it is actually in the correct place chronologically. note: there are 3 different versions of rss 0.91. netscape's rss 0.91 (revision 1), netscape's rss 0.91 revision 3 and userland's rss 0.91. note: rss 0.93 and rss 0.94 were only ever released as "drafts" and never became "final" and thus were not meant to actually be used. name status release date based on ...
Introduction to Public-Key Cryptography - Archive of obsolete content
ccess the requested resource, and if so allows the client to access it. with this arrangement, the user must supply a new password for each server, and the administrator must keep track of the name and password for each user, typically on separate servers. proper implementation does not store passwords in plaintext. instead it concatenates the password with a random per-user value (so called "s
alt") and stores the hash value of the result along with the s
alt. this makes certain kinds of brute-force atacks more difficult. as shown in the next section, one of the advantages of certificate-based authentication is that it can be used to replace the first three steps in figure 4 with a mechanism that allows the user to supply just one password (which is not sent across the network) and allows ...
Threats - Archive of obsolete content
by a third party. threats against network traffic include the following: eavesdropping. information remains intact, but its privacy is compromised. for example, someone could learn your credit card number, record a sensitive conversation, or intercept classified information. tampering. information in transit is changed or replaced and then sent on to the recipient. for example, someone could
alter an order for goods or change a person's resume. impersonation. information passes to a person who poses as the intended recipient. impersonation can take two forms: spoofing. a person can pretend to be someone else. for example, a person can pretend to have the email address jdoe@example.net, or a computer can identify itself as a site called www.example.net when it is not. this type of ...
Sunbird Theme Tutorial - Archive of obsolete content
endar.jar</tt> there. go to the <tt>skin</tt> directory that has just been created, then to the <tt>classic</tt> directory there. copy the <tt>calendar</tt> directory that you find there. in your theme directory, create a new directory named <tt>chrome</tt>. paste the copied <tt>calendar</tt> directory, together with all its contents, into your new <tt>chrome</tt> directory. now you have a theme,
although it looks exactly the same as sunbird's classic theme. modifying your theme to modify your theme, change the css and image files in any way you like. for testing purposes, go to the <tt>calendar</tt> directory that you have just pasted. edit the file <tt>calendar.css</tt> there. add this line at the end: label {color: red;} save the file. fixing bug 320823 if you are using the sunbird...
Building a Theme - Archive of obsolete content
ator>your name here</em:creator> <em:homepageurl>http://www.example.com/</em:homepageurl> </description> </rdf> sample@example.net - the id of the extension. this is a value you come up with to identify your extension in email address format (note that it should not be your email). make it unique. you could also use a guid. note: this parameter must be in the format of an email address,
although it does not have to be a valid email address. (example.example.example) 4 - the type of the add-on. '4' declares that it is installing a theme. if you were to install an extension it would be 2 (see install manifests#type for other type codes). {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - firefox's application id. 29.0 - the exact version number of the earliest version of firefox you're sayin...
Using SSH to connect to CVS - Archive of obsolete content
three lines start a child environment that, when exited, will result in the agent's process being killed. the environment you will actually use to build is the child environment. there are a few things to note about the commands for the ms-dos command prompt. first of all they will only work in versions of windows based on nt (nt/2000/xp). if you're building on win9x/winme you'll need to find an
alternative solution. if you're typing the commands directly (as opposed to storing them in a batch file that you call), you'll need to replace the occurances of "%%" in the first line with "%". finally, note that ssh-add needs the environment variable home to be set with the cygwin path to your cygwin home directory. mozillabuild if you're using mozillabuild, ssh-agent should be started when you r...
Browser Feature Detection - Archive of obsolete content
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. it is clear from these test results that netscape 7.0x and mozilla firefox have the greatest dom support
although internet explorer, safari, and opera have sufficient dom css 1 and dom level 1 & 2 document property and method support to enable cross browser web development. test summary standard netscape 7.0x firefox 1.5 safari 2 opera 7 / 8.5-9.0 internet explorer 6 / 7 dom core 1 100% 100% 100% 75% / 91% 75% / 75% dom core 2 100% 100...
-ms-overflow-style - Archive of obsolete content
-ms-overflow-style css property is a microsoft extension controlling the behavior of scrollbars when the content of an element overflows. initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritedyescomputed valueas specifiedanimation typediscrete syntax values auto the initial value. same as inherit. none scrollbars are never displayed,
although the element can still be scrolled if the element's content overflows. scrollbar "traditional" scrollbars are displayed if the element's content overflows. "traditional" scrollbars don't auto-hide and never overlap the element's content. accordingly, the dimensions of the layout area for the content are reduced by the width (for vertical scrollbars) or height (for horizontal scrollbars) of ...
::-ms-thumb - Archive of obsolete content
a slider control is one possible representation of <input type="range">. allowable properties only the following css properties can be used in a rule with ::-ms-thumb in its selector. other properties are ignored. ...
::-ms-ticks-after - Archive of obsolete content
r control. a slider control is one possible representation of <input type="range">. these ticks are not shown by default. to show them, set the control's display property to block. it is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. to do so would create three sets of tick marks, but the best user experience is one set. to remove tick marks
altogether, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-ticks-after in its selector. other properties are ignored. background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-st...
::-ms-ticks-before - Archive of obsolete content
r control. a slider control is one possible representation of <input type="range">. these ticks are not shown by default. to show them, set the control's display property to block. it is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. to do so would create three sets of tick marks, but the best user experience is one set. to remove tick marks
altogether, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-ticks-before in its selector. other properties are ignored. background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-s...
::-ms-track - Archive of obsolete content
. a slider control is one possible representation of <input type="range">. applying the color property within the ::-ms-track selector affects the tick marks inside the track area. it is possible to use the ::-ms-ticks-after, ::-ms-ticks-before, and ::-ms-track pseudo-elements together. to do so would create three sets of tick marks, but the best user experience is one set. to remove tick marks
altogether, set the color property to transparent. allowable properties only the following css properties can be used in a rule with ::-ms-track in its selector. other properties are ignored. background-clip background-color background-image background-origin background-repeat background-size border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style b...
E4X for templating - Archive of obsolete content
rings, an array of dom objects, or an array of e4x objects (assuming the comparison function is changed or adapted accordingly). inline functions as explained in the tutorial, it is possible to use anonymous functions inline (returning the desired content, including potentially xmllist's) in order to execute more than a single related statement, keeping this logic together with the resulting xml. ...
Processing XML with E4X - Archive of obsolete content
ible to directly interpolate variables amidst other literal (or variable) attribute content, however (e.g., bar="a{var1}{var2}"). 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). while one can interpolate attribute names as well as attribute values: var a = 'att'; var b = <b {a}='value'/>; alert(b); // gives: <b att="value"/> ...one cannot interpolate a whole expression at once (e.g., <b {a}>.) after executing the above example, the variable languages references an xml object corresponding to the <languages> node in the xml document. this node has o...
Introduction - Archive of obsolete content
ment: <foo bar="2">"hi"</foo>. note, however, that xml elements can only have text as their value. what really happens with the {} notation is that the variables' tostring method is called, and the returned value is placed in the element. for instance var a = {foo: 1}; var b = <bar>{a}</bar>; actually produces a document that reads <bar>[object object]</bar>. use of inline functions in content
although the brackets are restricted to single statements for evaluation, one might provide an anonymous function to perform some extra processing inline: var a = 'foo'; var b = <bar>{function () {var c = a.touppercase(); var d = 5 * 5; return c + d;}()}</bar>; where the above produces: <bar>foo25</bar>. see e4x for templating for more discussion on this usage. serializing one of the most powerful t...
Array comprehensions - Archive of obsolete content
non-standard. do not use! the array comprehensions syntax is non-standard and removed starting with firefox 58. for future-facing usages, consider using array.prototype.map, array.prototype.filter, arrow functions, and spread syntax. obsolete since gecko 58 (firefox 58 / thunderbird 58 / seamonkey 2.55)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the array comprehension syntax was a javascript expression which allowed you to quickly assemble a new array based on an existing one. however, it has been removed from the standard and the firefox implementation. do not use it! syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of i...
Date.prototype.toLocaleFormat() - Archive of obsolete content
see also the newer version of date.prototype.tolocaledatestring(). this feature has been removed and will no longer work in firefox 58+. see warning: date.prototype.tolocaleformat is deprecated for more information and migration help. syntax dateobj.tolocaleformat(formatstring) parameters formatstring a format string in the same format expected by the strftime() function in c. ...
XForms - Archive of obsolete content
try to avoid using it. note: support for xforms was removed from firefox in firefox 19. see the html forms guide for approaches to creating forms in html5. xforms essentials an online book giving you a guided tour of xforms. xforms were envisioned as the future of online forms as envisioned by the w3c. drawing on other w3c standards like xml schema, xpath, and xml events, xforms tried to address some of the limitations of the current html forms model. ...
Archived open Web documentation - Archive of obsolete content
context of the web content, using the standard notification system provided by the operating system. e4x ecmascript for xml (e4x) is a programming language extension that adds native xml support to javascript. it does this by providing access to the xml document in a form that feels natural for ecmascript programmers. the goal is to provide an
alternative, simpler syntax for accessing xml documents than via dom interfaces. a valid
alternative to e4x is a non-native jxon algorithm. e4x tutorial this tutorial walks you through the basic syntax of e4x (ecmascript for xml). with e4x, programmers can manipulate an xml document with a syntax more familiar to javascript programming.
Mozilla's DOCTYPE sniffing - Archive of obsolete content
try to avoid using it. this page describes behavior of the old html parser in firefox 3.6 and older. it has been replaced by a new html 5 parser in firefox 4 and newer. this document describes how mozilla uses the doctype declaration to determine strict mode vs. quirks mode. the code that makes this determination is currently in determineparsemode() in nsparser.cpp. see bug 1312 and bug 55264 for some of the history of the mode determination. ...
Parsing microformats in JavaScript - Archive of obsolete content
the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. return value a string containing the normalized date. defaultgetter() uses the microformat patterns to decide what the correct text for a given microformat property is. this includes looking at thing such as abbr, img and
alt, area and
alt, and value excerpting. propertyvalue = microformats.parser.defaultgetter(propnode, parentnode, datatype); parameters propnode the dom node to check. parentnode the property's parent node. if it is a subproperty, this is the parent property node. otherwise this is the microformat node. datatype "html" if the search should be done using in...
Common causes of memory leaks in extensions - Extensions
eaned up when the document is unloaded, or stored as weak references. be careful with setinterval/settimeout using window.setinterval() or window.settimeout() can be problematic, too, when it comes to zombie compartments. consider the following example code that could be part of your browser.xul overlay: gbrowser.addeventlistener("domcontentloaded", function(evt) { var contentdoc = evt.origin
altarget; var i = 0; // refresh the title once each second setinterval(function() { contentdoc.title = ++i; }, 1000); }, false); one would normally expect that the interval (or timer) would be destroyed as soon as the document unloads, in the same way that event listeners are automatically destroyed. however, while this is still true, the window.setinterval() in the example originates ...
Game distribution - Game development
s framework for ios, built by the impactjs author. it provides seamless integration with impactjs, but it only supports only one framework and app store. nw.js — formerly known as node-webkit, this is the first choice when it comes to building a desktop game that works on windows, mac and linux. the distributions are packaged with the webkit engine to provide rendering on any platform. other
alternative tools are: intel xdk — an exciting
alternative, similar to cocoonio. electron — known as atom shell — is an open-sourced and cross-platform tool from github. manifold.js — this tool from the microsoft team can create native distributions of html5 games from ios, android, and windows. summary distribution is the way to give the world access to your game. there are many opti...
Building up a basic demo with Three.js - Game development
d y values, if not specified, will default to 0. you should experiment with these values and see how they change what you see in the scene. note: the distance values (e.g. for the camera z position) are unitless, and can be anything you deem suitable for your scene: milimeters, meters, feet, or miles. it's up to you. rendering the scene everything is ready, but we still can't see anything.
although we've set-up the renderer, we still need to render everything. our render() function will do this job, with a little help from requestanimationframe(), which causes the scene to be re-rendered constantly on every frame: function render() { requestanimationframe(render); renderer.render(scene, camera); } render(); on every new frame the render function is invoked, and the renderer render...
Mobile touch controls - Game development
ally, so you could leave the ondragstart() function empty, or place some debug output to see if it's working correctly. the pointer element contains the x and y variables storing the current position of the dragged element. dedicated plugins you could go even further and use dedicated plugins like virtual joystick — this is a paid, official phaser plugin, but you can find free and open source
alternatives. the initialization of virtual joystick looks like this: this.pad = this.game.plugins.add(phaser.virtualjoystick); this.stick = this.pad.addstick(30, 30, 80, 'generic'); in the create() function of the game state we're creating a virtual pad and a generic stick that has four directional virtual buttons by default. this is placed 30 pixels from the top and left edges of the screen and i...
Unconventional controls - Game development
it can be as simple as calculating the difference between two frequencies: doppler.init(function(bandwidth) { var diff = bandwidth.left - bandwidth.right; }); the diff would be the difference between the initial position of the hand and the final one. this approach won't give us the full flexibility of using a gamepad, or even leap motion, but it's definitely an interesting, unconventional
alternative. you can use it to scroll a page hands-free, or play theremin, but it should also be enough to move the ship up and down the screen if implemented correctly. proximity api another interesting idea is to use the built-in proximity sensors of your hardware to detect how far an object, for example a hand, is from the given sensor. it could work similar to the doppler effect in terms of man...
Implementing controls using the Gamepad API - Game development
was tested with a few gamepads, but the author's favorite configuration is a wireless xbox 360 controller and the firefox browser on mac os x. case study: hungry fridge the github game off ii competition ran in november 2013 and enclave games decided to take part in it. the theme for the competition was "change", so they submitted a game where you have to feed the hungry fridge by tapping the he
althy food (apples, carrots, lettuces) and avoid the "bad" food (beer, burgers, pizza.) a countdown changes the type of food the fridge wants to eat every few seconds, so you have to be careful and act quickly. the second, hidden "change" implementation is the ability to transform the static fridge into a full-blown moving, shooting and eating machine. when you connect the controller, the game signi...
Move the ball - Game development
ariable on every frame, so the ball will be painted in the new position on every update. add the following two new lines indicated below to your draw() function: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code again and try it in your browser. this works ok,
although it appears that the ball is leaving a trail behind it: clearing the canvas before each frame the ball is leaving a trail because we're painting a new circle on every frame without removing the previous one. don't worry, because there's a method to clear canvas content: clearrect(). this method takes four parameters: the x and y coordinates of the top left corner of a rectangle, and the x...
Build the brick field - Game development
« previousnext » this is the 9th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson09.html. building the brick field is a little bit more complicated than adding a single object to the screen,
although it's still easier with phaser than in pure javascript. let's explore how to create a group of bricks and print them on screen using a loop. 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 wi...
Visual typescript game engine - Game development
deo chat works with other hybrid frameworks or custom implementation throw the native mobile application web control (chrome implementation usually tested). npm run broadcaster documentation : beta version for documentation. api documentation if you wanna generate doc you will need manual remove the comment from plugin section in webpack.config.js. restart 'npm run dev' best way to fully he
althy build. html/css is not prior to this project. if you wanna insert some new html page just define it intro webpack.config.js : plugins : [ new htmlwebpackplugin({ filename: '/templates/mygamelobby.html', template: 'src/html-components/mygamelobby.html' }), ... see register and login example. code format : npm run fix npm run tslint or use : ...
Gecko FAQ - Gecko Redirect 1
ards 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 columns, label attribute of option,
alternate text of area elements, longdesc various metadata attributes: cite, datetime, lang, hreflang bidirectional text layout, which is only used in hebrew and arabic (ibm has begun work to add bidi support in a future release) style sheets css 1 - full support, except for: the application of styles to html column elements the ability to turn off author styles ...
Digest - MDN Web Docs Glossary: Definitions of Web-related terms
given message. a digest can be used to perform several tasks: in non-cryptographic applications (e.g., the index of hash tables, or a fingerprint used to detect duplicate data or to uniquely identify files) verify message integrity (a tampered message will have a different hash) store passwords so that they can't be retrieved, but can still be checked (to do this securely, you also need to s
alt the password.) generate pseudo-random numbers generate keys it is critical to choose the proper hash function for your use case to avoid collisions and predictability. learn more see hash function hash function on wikipedia ...
lossy compression - MDN Web Docs Glossary: Definitions of Web-related terms
causes data from the initial file to be lost, possibly causing degradation in quality. the process of such compression is irreversible; once lossy compression of the content has been performed, the content cannot be restored to its original state. therefore, content that has undergone lossy compression should generally not be further edited. lossy compression is widely used in image formats.
although there is no obvious difference quality between the two images above, the size of the second image has been significantly reduced, using lossy compression. see also lossless compression ...
Accessibility - Learn web development
help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. accessible multimedia another category of content that can create accessibility problems is multimedia — video, audio, and image content need to be given proper textual
alternatives, so they can be understood by assistive technologies and their users. this article shows how. mobile accessibility with web access on mobile devices being so popular, and popular platforms such as ios and android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. this article looks at mobile-specific accessibi...
A cool-looking box - Learn web development
this assessment, you should have already worked through all the articles in this module. objective: to test comprehension of the css box model and other box-related features such as borders and backgrounds. starting point to get this assessment started, you should: make local copies of the starting html and css — save them as index.html and style.css in a new directory.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or further help section at the bot...
Backgrounds and borders - Learn web development
gle star. if you specify a background color in addition to a background image then the image displays on top of the color. try adding a background-color property to the example above to see that in action. controlling background-repeat the background-repeat property is used to control the tiling behavior of images. the available values are: no-repeat — stop the background from repeating
altogether. repeat-x — repeat horizontally. repeat-y — repeat vertically. repeat — the default; repeat in both directions. try these values out in the example below. we have set the value to no-repeat so you will only see one star. try out the different values — repeat-x and repeat-y — to see what their effects are. sizing the background image in the example above, we have a large ...
Creating fancy letterheaded paper - Learn web development
le. objective: to test comprehension of css box model, and other box-related features such as implementing backgrounds. starting point to get this assessment started, you should: make local copies of the html and css — save them as index.html and style.css in a new directory. save local copies of the top, bottom and logo images in the same directory as your code files.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see the assessment or further help section at the bot...
Debugging CSS - Learn web development
you can also click the + button to add an additional rule with the same selector, and add your new rules there. note: there are other useful features in the rules view too, for example declarations with invalid values are crossed out. you can find out more at examine and edit css. understanding the box model in previous lessons we have discussed the box model, and the fact that we have an
alternate box model that changes how the size of elements are calculated based on the size you give them, plus the padding and borders. devtools can really help you to understand how the size of an element is being calculated. the layout view shows you a diagram of the box model on the selected element, along with a description of the properties and values that change how the element is laid out. th...
Overflowing content - Learn web development
of content in the container. remove some content from the box below. notice how the scrollbars remain, even if there is no need for scrolling. in the example above, we only need to scroll on the y axis, however we get scrollbars in both axes. to just scroll on the y axis, you could use the overflow-y property, setting overflow-y: scroll. you can also scroll on the x axis using overflow-x,
although this is not a recommended way to accommodate long words! if you have a long word in a small box, you might consider using the word-break or overflow-wrap properties. in addition, some of the methods discussed in sizing items in css may help you create boxes that scale better with varying amounts of content. as with scroll, you get a scrollbar in the scrolling dimension whether or not ther...
Test your skills: The Box Model - Learn web development
an try out solutions in the interactive editors below, however, it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. the box model one with the two boxes below, one is using the standard box model, the other the
alternate box model. change the width of the second box by adding rules to the .
alternate class, so that it matches the visual width of the first box. your final result will look like the image below. try updating the live code below to recreate the finished example: for assessment or further work purposes, download the starting point for this task to work in your own editor or in an online ed...
Pseudo-classes and pseudo-elements - Learn web development
matches an element representing an audio, video, or similar resource that is capable of being “played” or “paused”, when that element is “playing”. :paused matches an element representing an audio, video, or similar resource that is capable of being “played” or “paused”, when that element is “paused”. :read-only matches an element if it is not user-
alterable. :read-write matches an element if it is user-
alterable. :required matches form elements that are required. :right in paged media, matches right-hand pages. :root matches an element that is the root of the document. :scope matches any element that is a scope element. :valid matches an element such as an <input> element,...
Type, class, and ID selectors - Learn web development
this could be confused however with article:first-child, which will select any <article> element that is the first child of another element. to avoid this confusion we can add the universal selector to the :first-child selector, so it is obvious what the selector is doing. it is selecting any element which is the first-child of any descendant element of <article>: article *:first-child { }
although both do the same thing, the readability is significantly improved. class selectors the class selector starts with a full stop (.) character and will select everything in the document with that class applied to it. in the live example below we have created a class called .highlight, and have applied it to several places in my document. all of the elements that have the class applied are hig...
Grids - Learn web development
et dapibus ut, facilisis sed est.</p> </aside> <footer>contact me@mysite.com</footer> </div> note: you can also use the value -1 to target the end column or row line, and count inwards from the end using negative values. however this only works for the explicit grid. the value -1 will not target the end line of the implicit grid. positioning with grid-template-areas an
alternative way to place items on your grid is to use the grid-template-areas property and giving the various elements of your design a name. remove the line-based positioning from the last example (or re-download the file to have a fresh starting point), and add the following css. .container { display: grid; grid-template-areas: "header header" "sidebar content" "footer foote...
Legacy layout methods - Learn web development
9) + (2.08333333%*8)); } .col.span10 { width: calc((6.25%*10) + (2.08333333%*9)); } .col.span11 { width: calc((6.25%*11) + (2.08333333%*10)); } .col.span12 { width: calc((6.25%*12) + (2.08333333%*11)); } note: you can see our finished version in fluid-grid-calc.html (also see it live). note: if you can't get this to work, it might be because your browser does not support the calc() function,
although it is fairly well supported across browsers — as far back as ie9. semantic versus “unsemantic” grid systems adding classes to your markup to define layout means that your content and markup becomes tied to your visual presentation. you will sometimes hear this use of css classes described as being “unsemantic” — describing how the content looks — rather than a semantic use o...
Beginner's guide to media queries - Learn web development
f the viewport is narrower than 600 pixels, use max-width: @media screen and (max-width: 600px) { body { color: blue; } } open this example in the browser, or view the source. in practice, using minimum or maximum values is much more useful for responsive design so you will rarely see width or height used alone. there are a number of other media features that you can test for,
although some of the newer features introduced in level 4 and 5 of the media queries specification have limited browser support. each feature is documented on mdn along with browser support information, and you can find a full list at using media queries: media features. orientation one well-supported media feature is orientation, which allows us to test for portrait or landscape mode. to change th...
Normal Flow - Learn web development
explain how browsers layout web pages by default, before we begin to make changes. as detailed in the last lesson introducing layout, elements on a webpage lay out in the normal flow, if you have not applied any css to change the way they behave. and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it
altogether. starting with a solid, well-structured document that is readable in normal flow is the best way to begin any webpage. it ensures that your content is readable, even if the user is using a very limited browser or a device such as a screen reader that reads out the content of the page. in addition, as normal flow is designed to make a readable document, by starting in this way you are worki...
CSS layout - Learn web development
to use them. multiple-column layout the multiple-column layout specification gives you a method of laying content out in columns, as you might see in a newspaper. this article explains how to use this feature. responsive design as more diverse screen sizes have appeared on web-enabled devices, the concept of responsive web design (rwd) has appeared: a set of practices that allows web pages to
alter their layout and appearance to suit different screen widths, resolutions, etc. it is an idea that changed the way we design for a multi-device web, and in this article we'll help you understand the main techniques you need to know to master it. beginner's guide to media queries the css media query gives you a way to apply css only when the browser and device environment matches a rule that yo...
How CSS works - Learn web development
; } this behavior is very useful. it means that you can use new css as an enhancement, knowing that no error will occur if it is not understood — the browser will either get the new feature or not. coupled with the way that the cascade works, and the fact that browsers will use the last css they come across in a stylesheet when you have two rules with the same specificity you can also offer
alternatives for browsers that don't support new css. this works particularly well when you want to use a value that is quite new and not supported everywhere. for example, some older browsers do not support calc() as a value. i might give a fallback width for a box in pixels, then go on to give a width with a calc() value of 100% - 50px. old browsers will use the pixel version, ignoring the line ab...
Using your new knowledge - Learn web development
o have a play with some css and test your new-found knowledge. starting point you can work in the live editor below, or you can download the starting point to work with in your own editor. this is a single page with the html, plus the starting point css in the head of the document. if you prefer you could move this css to a separate file when you create the example on your local computer.
alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. working with css the following live example shows a biography, which has been styled using css. the css properties that i have used are as follows — each one links to its property page...
CSS first steps - Learn web development
this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. ...
Styling lists - Learn web development
d 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 generally made from chick peas blended with tahini, lemon juice, s
alt, garlic, and other ingredients.</dd> <dt>pita</dt> <dd>a soft, slightly leavened flatbread.</dd> <dt>halloumi</dt> <dd>a semi-hard, unripened, brined cheese with a higher-than-usual melting point, usually made from goat/sheep milk.</dd> <dt>green salad</dt> <dd>that green he
althy stuff that many of us just use to garnish kebabs.</dd> </dl> if you go to the live example now and invest...
Typesetting a community school homepage - Learn web development
sites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css text styling techniques. starting point to get this assessment started, you should: go and grab the html and css files for the exercise, and the provided external link icon. make a copy of them on your local computer.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html and fill in the css into one of these online editors, and use this url to point the background image. if the online editor you are using doesn't have a separate css panel, feel free to put it in a <style> element in the head of the document. note: if you get stuck, then ask us for help — see t...
Web fonts - Learn web development
e on the system it is running on: p { font-family: helvetica, "trebuchet ms", verdana, sans-serif; } this system works well, but traditionally web developers' font choices were limited. there are only a handful of fonts that you can guarantee to be available across all common systems — the so-called web-safe fonts. you can use the font stack to specify preferable fonts, followed by web-safe
alternatives, followed by the default system font, but this adds overhead in terms of testing to make sure that your designs look ok with each font, etc. web fonts but there is an
alternative, which works very well, right back to ie version 6. web fonts are a css feature that allows you to specify font files to be downloaded along with your website as it is accessed, meaning that any browser that s...
What do common web layouts contain? - Learn web development
webpages are built from these parts: header visible at the top of every page on the site. contains information relevant to all pages (like site name or logo) and an easy-to-use navigation system. main content the biggest region, containing content unique to the current page. stuff on the side 1) information complementing the main content; 2) information shared among a subset of pages; 3)
alternative navigation system. in fact, everything not absolutely required by the page's main content. footer visible at the bottom of every page on the site. like the header, contains less prominent global information like legal notices or contact info. these elements are quite common in all form factors, but they can be laid out different ways. here are some examples (1 represents header, 2 foo...
What HTML features promote accessibility? - Learn web development
n more detail, you can add information to a link using the title attribute. <p>i'm really bad at writing link text. <a href="inept.html" title="why i'm rubbish at writing link text: an explanation and an apology.">click here</a> to find out more.</p> access keys access keys provide easier navigation by assigning a keyboard shortcut to a link, which will usually gain focus when the user presses
alt or ctrl + the access key. the exact key combination varies by platform. <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 ...
How do I use GitHub Pages? - Learn web development
command line tool: windows: command prompt can be accessed by pressing the windows key, typing command prompt, and choosing it from the list that appears. note that windows has its own command conventions differing from linux and os x, so the commands below may vary on your machine. os x: terminal can be found in applications > utilities. linux: usually you can pull up a terminal with ctrl +
alt + t. if that doesn't work, look for terminal in an app bar or menu. this may seem a bit scary at first, but don't worry — you'll soon get the hang of the basics. you tell the computer to do something in the terminal by typing in a command and hitting enter, as seen above. creating a repo for your code next, you need to create a new repo for your files to go in. click plus (+) in the top r...
What is a URL? - Learn web development
ound a computer network. usually for websites it is the http protocol or its secured version, https. the web requires one of these two, but browsers also know how to handle other protocols such as mailto: (to open a mail client) or ftp: to handle file transfer, so don't be surprised if you see such protocols. www.example.com is the domain name. it indicates which web server is being requested.
alternatively, it is possible to directly use an ip address, but because it is less convenient, it is not often used on the web. :80 is the port. it indicates the technical "gate" used to access the resources on the web server. it is usually omitted if the web server uses the standard ports of the http protocol (80 for http and 443 for https) to grant access to its resources. otherwise it is manda...
What is accessibility? - Learn web development
may have trouble understanding someone in a video. let them pause the video to read the subtitles or process the information. keyboard capacity let the user tab into/out of a video, play it, and pause it without being trapped in it. 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. make sure all users can operate graphical interfaces (like unfolding menus) solely with a keyboard (e.g., with tab and the return key). provide an attribute explicitly specifying your content's language, so that screen readers read your text properly. make sure that a user can navigate to all widgets on a page solely with th...
What software do I need to build a website? - Learn web development
tain operating systems. apple safari runs on ios and mac os, while internet explorer runs only on windows. it's best to take advantage of services like browsershots or browserstack. browsershots furnishes screenshots of your website as it will look in various browsers. browserstack actually gives you full remote access to virtual machines so you can test your site in the most common environments.
alternatively, you can set up your own virtual machine, but that takes some expertise. (if you're going that route, microsoft has some tools for developers including a ready-to-use virtual machine at modern.ie.) by all means run some tests on a real device, especially on real mobile devices. mobile device simulation is a new, evolving technology and less reliable than desktop simulation. mobile devi...
Other form controls - Learn web development
all browsers support datalist, but if you are still supporting older browsers such as ie versions below 10, there is a trick to provide a fallback: <label for="myfruit">what is your favorite fruit? ...
Your first form - Learn web development
to a list, or show or hide a ui feature). a web form's html is made up of one or more form controls (sometimes called widgets), plus some additional elements to help structure the overall form — they are often referred to as html forms. the controls can be single or multi-line text fields, dropdown boxes, buttons, checkboxes, or radio buttons, and are mostly created using the <input> element,
although there are some other elements to learn about too. form controls can also be programmed to enforce specific formats or values to be entered (form validation), and paired with text labels that describe their purpose to both sighted and blind users. designing your form before starting to code, it's always better to step back and take the time to think about your form. designing a quick mocku...
Dealing with files - Learn web development
ke?" copy the image you chose earlier into your images folder. open up your index.html file, and insert the following code into the file exactly as shown. don't worry about what it all means for now — we'll look at the structures in more detail later in the series. <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src=""
alt="my test image"> </body> </html> the line <img src=""
alt="my test image"> is the html code that inserts an image into the page. we need to tell the html where the image is. the image is inside the images directory, which is in the same directory as index.html. to walk down the file structure from index.html to our image, the file path we'd need is images/your-image-filename. for example, o...
Installing basic software - Learn web development
sers to test our code in. choose your operating system below and click the relevant links to download installers for your favorite browsers: linux: firefox, chrome, opera, brave. windows: firefox, chrome, opera, internet explorer, microsoft edge, brave (windows 10 comes with edge by default; if you have windows 7 or above, you can install internet explorer 11; otherwise, you should install an
alternative browser). macos: firefox, chrome, opera, safari, brave (macos and ios come with safari by default). before going on, you should install at least two of these browsers and have them ready for testing. note: internet explorer is not compatible with some modern web features and it may not be able to run your project. you usually don't need to worry about making your web projects compati...
What will your website look like? - Learn web development
led a hex code (short for hexadecimal), and represents your color. copy the code down somewhere safe for now. images to choose an image, go to google images and search for something suitable. when you find the image you want, click on the image to get an enlarged view of it. right-click the image (ctrl + click on a mac), choose save image as..., and choose a safe place to save your image.
alternatively, copy the image's web address from your browser's address bar for later use. note that most images on the web, including in google images, are copyrighted. to reduce your likelihood of violating copyright, you can use google's license filter. click on the tools button, then on the resulting usage rights option that appears below. you should choose an option such as labeled for reuse...
HTML Cheatsheet - Learn web development
re> this text is in normal format. this text is in code format. this text is in predefined format. embedded audio <audio controls="controls" src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3">your browser does not support the html5 audio element.</audio> your browser does not support the html5 audio element. embedded audio with
alternative sources <audio controls="controls"><source src="https://udn.realityripple.com/samples/b7/193cb038d0.mp3" type="audio/mpeg"><source src="https://udn.realityripple.com/samples/f7/14a4179ee6.ogg" type="audio/ogg"> your browser does not support audio. </audio> your browser does not support audio. embedded video <video controls src="https://udn.realityripple.com/samp...
Creating hyperlinks - Learn web development
ent you already know about. change some of the content into links. include title attributes. block level links as mentioned before, almost any content can be made into a link, even block-level elements. if you have an image you want to make into a link, use the <a> element and reference the image file with the <img> element. <a href="https://www.mozilla.org/"> <img src="mozilla-image.png"
alt="mozilla logo that links to the mozilla homepage"> </a> note: you'll find out more about using images on the web in a future article. a quick primer on urls and paths to fully understand link targets, you need to understand urls and file paths. this section gives you the information you need to achieve this. a url, or uniform resource locator is simply a string of text that defines where so...
Debugging HTML - Learn web development
the last list item looks like this: <li> <strong>unclosed attributes: another common source of html problems. let's look at an example: </strong> </li> html validation so you can see from the above example that you really want to make sure your html is well-formed! but how? in a small example like the one seen above, it is easy to search through the lines and find the ...
Getting started with HTML - Learn web development
ould also be able to write a few elements and attributes. the subsequent articles of this module go further on some of the topics introduced here, as well as presenting other concepts of the language. note: as you start to learn more about html, consider learning the basics of cascading style sheets, or css. css is the language used to style web pages. (for example, changing fonts or colors, or
altering the page layout) html and css work well together, as you will soon discover. ...
Structuring a page of content - Learn web development
ge of web page structures, and how to represent a prospective layout design in markup. starting point to get this assessment started, you should go and grab the zip file containing all the starting assets. the zip file contains: the html you need to add structural markup to. css to style your markup. images that are used on the page. create the example on your local computer, or
alternatively use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. note: if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. project brief for this project, your task is to take the content for the homepage of a bird watching website and add structural elements to it so it can have a page layout applied to it.
What’s in the head? Metadata in HTML - Learn web development
seo.) active learning: the description's use in search engines the description is also used on search engine result pages. let's go through an exercise to explore this go to the front page of the mozilla developer network. view the page's source (right/ctrl + click on the page, choose view page source from the context menu.) find the description meta tag. ...
Test your skills: HTML images - Learn web development
en ask us for help — see the assessment or further help section at the bottom of this page. html images 1 in this task we want you to embed a simple image of some blueberries into the page. you need to: add the path to the image to an appropriate attribute to embed it on the page. the image is called blueberries.jpg, and it is in a folder inside the current folder called images. add some
alternative text to an appropriate attribute to describe the image, for people that cannot see it. give the <img> element an appropriate width and height so that it displays at the correct aspect ratio, and enough space is left on the page to display it. the image's intrinsic size is 615 x 419 pixels. try updating the live code below to recreate the finished example: download the starting poin...
Video and audio content - Learn web development
ents of a media file first, let's go through the terminology quickly. formats like mp3, mp4 and webm are called container formats. they define a structure in which the audio and/or video tracks that make up the media are stored, along with metadata describing the media, what codecs are used to encode its channels, and so forth. a webm file containing a movie which has a main video track and one
alternate angle track, plus audio for both english and spanish, in addition to audio for an english commentary track can be conceptualized as shown in the diagram below. also included are text tracks containing closed captions for the feature film, spanish subtitles for the film, and english captions for the commentary. the audio and video tracks within the container hold data in the appropriate f...
HTML table advanced features and accessibility - Learn web development
you'll see that the "clothes" cell sits above the "trousers", "skirts", and "dresses" cells. all of these cells should be marked up as headers (<th>), but "clothes" is a heading that sits over the top and defines the other three subheadings. "clothes" therefore should get an attribute of scope="colgroup", whereas the others would get an attribute of scope="col". the id and headers attributes an
alternative to using the scope attribute is to use id and headers attributes to create associations between headers and cells. the way they are used is as follows: you add a unique id to each <th> element. you add a headers attribute to each <td> element. each headers attribute has to contain a list of the ids of all the <th> elements that act as a header for that cell, separated by spaces. thi...
Assessment: Structuring planet data - Learn web development
es in this module. objective: to test comprehension of html tables and associated features. starting point to start the assessment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note:
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. project brief you are working at a school; currently your students are studying the ...
Structuring the web with HTML - Learn web development
ed that you work through getting started with the web before attempting this topic, however, it isn't absolutely necessary; much of what is covered in the html basics article is also covered in our introduction to html module, albeit in a lot more detail. ...
Making asynchronous programming easier with async and await - Learn web development
then return the resulting value. in the meantime, other code that may be waiting for a chance to execute gets to do so. you can use await when calling any function that returns a promise, including web api functions. here is a trivial example: async function hello() { return greeting = await promise.resolve("hello"); }; hello().then(alert); of course, the above example is not very useful,
although it does serve to illustrate the syntax. let's move on and look at a real example. rewriting promise code with async/await let's look back at a simple fetch example that we saw in the previous article: fetch('coffee.jpg') .then(response => { if (!response.ok) { throw new error(`http error! status: ${response.status}`); } else { return response.blob(); } }) .then(myblob => { ...
Choosing the right approach - Learn web development
ust use a single .catch() block to handle the errors for the entire chain. async callbacks just aren't very graceful. promise callbacks are always called in the strict order they are placed in the event queue; async callbacks aren't. async callbacks lose full control of how the function will be executed when passed to a third-party library. browser compatibility really good general support,
although the exact support for callbacks in apis depends on the particular api. refer to the reference documentation for the api you're using for more specific support info. 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. useful for... ...
General asynchronous programming concepts - Learn web development
ng. the first operation no longer blocks the second. asynchronous code web workers are pretty useful, but they do have their limitations. a major one is they are not able to access the dom — you can't get a worker to directly do anything to update the ui. we couldn't render our 1 million blue circles inside our worker; it can basically just do the number crunching. the second problem is that
although code run in a worker is not blocking, it is still basically synchronous. this becomes a problem when a function relies on the results of multiple previous processes to function. consider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b then does something to the image like apply...
Introducing asynchronous JavaScript - Learn web development
er, so multiple asynchronous operations can be made to run in order, one after another. the catch() block at the end runs if any of the .then() blocks fail — in a similar way to synchronous try...catch blocks, an error object is made available inside the catch(), which can be used to report the kind of error that has occurred. note however that synchronous try...catch won't work with promises,
although it will work with async/await, as you'll learn later on. note: you'll learn a lot more about promises later on in the module, so don't worry if you don't understand them fully yet. the event queue async operations like promises are put into an event queue, which runs after the main thread has finished processing so that they do not block subsequent javascript code from running. the que...
Graceful asynchronous programming with Promises - Learn web development
oing something else with the resolved message rather than just alerting it. note: you can find our version of this example on github as custom-promise2.html (see also the source code). a more real-world example the above example was kept deliberately simple to make the concepts easy to understand, but it is not really very async. the asynchronous nature is basically faked using settimeout(),
although it does still show that promises are useful for creating a custom function with a sensible flow of operations, good error handling, etc. one example we'd like to invite you to study, which does show a useful async application of the promise() constructor, is jake archibald's idb library. this takes the indexeddb api, which is an old-style callback-based api for storing and retrieving data o...
Introduction to events - Learn web development
to. each available event has an event handler, which is a block of code (usually a javascript function that you as a programmer create) that runs when the event fires. when such a block of code is defined to run in response to an event, we say we are registering an event handler. note: event handlers are sometimes called event listeners — they are pretty much interchangeable for our purposes,
although strictly speaking, they work together. the listener listens out for the event happening, and the handler is the code that is run in response to it happening. note: web events are not part of the core javascript language — they are defined as part of the apis built into the browser. a simple example let's look at a simple example of what we mean here. you've already seen events and eve...
Functions — reusable blocks of code - Learn web development
myvalue; subfunction1(); subfunction2(); subfunction3(); } function subfunction1() { console.log(myvalue); } function subfunction2() { console.log(myvalue); } function subfunction3() { console.log(myvalue); } just make sure that the values being used inside the function are properly in scope. the example above would throw an error referenceerror: myvalue is not defined, because
although the myvalue variable is defined in the same scope as the function calls, it is not defined inside the function definitions — the actual code that is run when the functions are called. to make this work, you'd have to pass the value into the function as a parameter, like this: function mybigfunction() { let myvalue = 1; subfunction1(myvalue); subfunction2(myvalue); subfunction3(my...
Looping code - Learn web development
imilar manner to break, but instead of breaking out of the loop entirely, it skips to the next iteration of the loop. let's look at another example that takes a number as an input, and returns only the numbers that are squares of integers (whole numbers). the html is basically the same as the last example — a simple text input, and a paragraph for output. ...
JavaScript building blocks - Learn web development
e 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. in this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define functions, scope, and parameters. build your own function with most of the essential theory de
alt with previously, this article provides a practical experience. here you'll get some practice with building up your own custom function. along the way, we'll also explain some further useful details of dealing with functions. function return values the last essential concept you must know about a function is return values. some functions don't return a significant value after completion, but oth...
Client-side storage - Learn web development
o files. you'll learn more about these apis below. the future: cache api some modern browsers support the new cache api. this api is designed for storing http responses to specific requests, and is very useful for doing things like storing website assets offline so the site can subsequently be used without a network connection. cache is usually used in combination with the service worker api,
although it doesn't have to be. use of cache and service workers is an advanced topic, and we won't be covering it in great detail in this article,
although we will show a simple example in the offline asset storage section below. storing simple data — web storage the web storage api is very easy to use — you store simple name/value pairs of data (limited to strings, numbers, etc.) and retriev...
Fetching data from the server - Learn web development
e is that we've had to include a return statement in front of response.text(), to get it to pass its result on to the next link in the chain. which mechanism should you use? this really depends on what project you are working on. xhr has been around for a long time now and has very good cross-browser support. fetch and promises, on the other hand, are a more recent addition to the web platform,
although they're supported well across the browser landscape, with the exception of internet explorer. if you need to support older browsers, then an xhr solution might be preferable. if however you are working on a more progressive project and aren't as worried about older browsers, then fetch could be a good choice. you should really learn both — fetch will become more popular as internet explo...
Video and Audio APIs - Learn web development
implemented in the stopmedia() function instead. note: you could also further improve the efficiency of the code by creating a separate function that runs these lines, then calling that anywhere it is needed, rather than repeating the lines multiple times in the code. but we'll leave that one up to you. summary i think we've taught you enough in this article. the htmlmediaelement api makes a we
alth of functionality available for creating simple video and audio players, and that's only the tip of the iceberg. see the "see also" section below for links to more complex and interesting functionality. here are some suggestions for ways you could enhance the existing example we've built up: the time display currently breaks if the video is an hour long or more (well, it won't display hour...
Client-side web APIs - Learn web development
when writing web pages and apps, one of the most common things you'll want to do is manipulate web documents in some way. this is usually done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article, we'll look at how to use the dom in detail, along with some other interesting apis that can
alter your environment in interesting ways. fetching data from the server another very common task in modern websites and applications is retrieving individual data items from the server to update sections of a webpage without having to load an entirely new page. this seemingly small detail has had a huge impact on the performance and behavior of sites. in this article, we'll explain the concept, ...
A first splash into JavaScript - Learn web development
ext field, ready for a new guess to be entered. removes the background color from the lastresult paragraph. generates a new random number so that you are not just guessing the same number again! at this point you should have a fully working (simple) game — congratulations! all we have left to do now in this article is talk about a few other important code features that you've already seen,
although you may have not realized it. loops one part of the above code that we need to take a more detailed look at is the for loop. loops are a very important concept in programming, which allow you to keep running a piece of code over and over again, until a certain condition is met. to start with, go to your browser developer tools javascript console again, and enter the following: for (let i...
Arrays - Learn web development
mputer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to understand what arrays are and how to manipulate them in javascript. what is an array? arrays are generally described as "list-like objects"; they are basically single objects that contain multiple values stored in a list. array objects can be stored in variables and de
alt with in much the same way as any other type of value, the difference being that we can access each value inside the list individually, and do super useful and efficient things with the list, like loop through it and do the same thing to every value. maybe we've got a series of product items and their prices stored in an array, and we want to loop through them all and print them out on an invoice,...
Basic math in JavaScript — numbers and operators - Learn web development
lt of a calculation (referred to as an expression, in programming). operator precedence in javascript is the same as is taught in math classes in school — multiply and divide are always done first, then add and subtract (the calculation is always evaluated from left to right). if you want to override operator precedence, you can put parentheses round the parts that you want to be explicitly de
alt with first. so to get a result of 6, we could do this: (num2 + num1) / (8 + 2); try it and see. note: a full list of all javascript operators and their precedence can be found in expressions and operators. increment and decrement operators sometimes you'll want to repeatedly add or subtract one to or from a numeric variable value. this can be conveniently done using the increment (++) and ...
Silly story generator - Learn web development
et this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. this also has the css to style the example contained within it. go to the page containing the raw text and keep this open in a separate browser tab somewhere. you'll need it later.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have a separate javascript panel, feel free to put it inline in a <script> element inside the html page. note: if you get stuck, then ask us for help — see the assessment or further help section at...
Handling text — strings in JavaScript - Learn web development
css allows us to precisely style it, and javascript contains a number of features for manipulating strings, creating custom welcome messages and prompts, showing the right text labels when needed, sorting terms into the desired order, and much more. pretty much all of the programs we've shown you so far in the course have involved some string manipulation. strings — the basics strings are de
alt with similarly to numbers at first glance, but when you dig deeper you'll start to see some notable differences. let's start by entering some basic lines into the browser developer console to familiarize ourselves. creating a string to start with, enter the following lines: let string = 'the revolution will not be televised.'; string; just like we did with numbers, we are declaring a vari...
Useful string methods - Learn web development
for example if you want to normalize all user-entered data before storing it in a database. let's try entering the following lines to see what happens: let raddata = 'my name is mud'; raddata.tolowercase(); raddata.touppercase(); updating parts of a string you can replace one substring inside a string with another substring using the replace() method. this works very simply at a basic level,
although there are some advanced things you can do with it that we won't go into yet. it takes two parameters — the string you want to replace, and the string you want to replace it with. try this example: browsertype.replace('moz','van'); this returns "vanilla" in the console. but if you check the value of browsertype, it is still "mozilla". to actually update the value of the browsertype varia...
Adding features to our bouncing balls demo - Learn web development
before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript objects and object-oriented constructs starting point to get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer.
alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements inside the html page. note: if you get stuck, then ask us for help — see the assessment or further help s...
Working with JSON - Learn web development
an array index, for example [0]["powers"][0]. other notes json is purely a data format — it contains only properties, no methods. json requires double quotes to be used around strings and property names. single quotes are not valid. even a single misplaced comma or colon can cause a json file to go wrong, and not work. you should be careful to validate any data you are attempting to use (
although computer-generated json is less likely to include errors, as long as the generator program is working correctly). you can validate json using an application like jsonlint. json can actually take the form of any data type that is valid for inclusion inside json, not just arrays or objects. so for example, a single string or number would be a valid json object. unlike in javascript code in w...
Object-oriented JavaScript for beginners - Learn web development
vides us with a handy shortcut, in the form of constructor functions — let's make one now! replace your previous function with the following: function person(name) { this.name = name; this.greeting = function() { alert('hi! i\'m ' + this.name + '.'); }; } the constructor function is javascript's version of a class. notice that it has all the features you'd expect in a function,
although it doesn't return anything or explicitly create an object — it basically just defines properties and methods. notice also the this keyword being used here as well — it is basically saying that whenever one of these object instances is created, the object's name property will be equal to the name value passed to the constructor call, and the greeting() method will use the name value passe...
Introducing JavaScript objects - Learn web development
te your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides object basics in the first article looking at javascript objects, we'll look at fundamental javascript object syntax, and revisit some javascript features we've already looked at earlier on in the course, reiterating the fact that many of the features you've already de
alt with are in fact objects. object-oriented javascript for beginners with the basics out of the way, we'll now focus on object-oriented javascript (oojs) — this article presents a basic view of object-oriented programming (oop) theory, then explores how javascript emulates object classes via constructor functions, and how to create object instances. object prototypes prototypes are the mechan...
The business case for web performance - Learn web development
w, it can prevent users from completing their intended task. this can lead to low conversion rates. time on site the average time that your users in aggregate spend on your site. when a site performance slowly, users are more likely to abandon the site prematurely which can lead to low time on site metrics. net promotion score the net promoter score (nps) is a metric for assessing customer loy
alty for a company’s brand, product, or service. poor user performance experiences can equation to poor brand reputation. setting converstion rate, time on site, and/or net promotion scores as kpis give financial and other business goal value to the web performance efforts, and get help boost buy in, with metrics to prove the efforts worth. expectation versus reality in performance business pe...
Introduction to the server side - Learn web development
on in a database and dynamically construct and return html and other types of files (e.g. pdfs, images, etc.). it is also possible to simply return data (json, xml, etc.) for rendering by appropriate client-side web frameworks (this reduces the processing burden on the server and the amount of data that needs to be sent). the server is not limited to sending information from databases, and might
alternatively return the result of software tools, or data from communications services. the content can even be targeted for the type of client device that is receiving it. because the information is in a database, it can also more easily be shared and updated with other business systems (for example, when products are sold either online or in a shop, the shop might update its database of inventory...
Server-side web frameworks - Learn web development
p compression support. json and html/xml parsers and generators with css selector support. very clean, portable and object-oriented pure-perl api with no hidden magic. fresh code based upon years of experience, free and open-source. spring boot (java) spring boot is one of a number of projects provided by spring. it is a good starting point for doing server-side web development using java.
although definitely not the only framework based on java it is easy to use to create stand-alone, production-grade spring-based applications that you can "just run". it is an opinionated view of the spring platform and third-party libraries but allows to start with minimum fuss and configuration. it can be used for small problems but its strength is building larger scale applications that use a clou...
Getting started with Ember - Learn web development
ds fixing one of the major accessibility disadvantages of the default todomvc app. starting the development server you may start the app in development mode by typing the following command in your terminal, while inside the todomvc directory: ember server this should give you an output similar to the following: build successful (190ms) – serving on http://localhost:4200/ slowest nodes (tot
altime >= 5%) | total (avg) -----------------------------------------+----------- broccolimergetrees (17) | 35ms (2 ms) package /assets/vendor.js (1) | 13ms concat: vendor styles/assets/vend... (1) | 12ms the development server launches at http://localhost:4200, which you can visit in your browser to check out what your work looks like so far. if everything...
Ember interactivity: Events, classes and state - Learn web development
decorator. add the following line just below the opening export... line: @service('todo-data') todos; now the placeholder alert(text); line can be replaced with a call to our new add() function. replace it with the following: this.todos.add(text); if we try this out in the todo app in our browser (npm start, go to localhost:4200), it will look like nothing happens after hitting the enter key (
although the fact that the app builds without any errors is a good sign). using the ember inspector however, we can see that our todo was added: displaying our todos now that we know that we can create todos, there needs to be a way to swap out our static "buy movie tickets" todos with the todos we're actually creating. in the todolist component, we'll want to get the todos out of the service, an...
Ember resources and troubleshooting - Learn web development
information on sourcemaps, why they're needed, and what the ember-cli does with them, see the advanced use: asset compilation guide. note that sourcemaps are enabled by default. ember-data comes pre-installed; do i need it? not at all. while ember-data solves the most common problems that any app dealing with data will run in to, it is possible to roll your own front-end data client. a common
alternative is to any fully-featured front-end data client is the fetch api. using the design patterns provided by the framework, a route using fetch() would look something like this: import route from '@ember/routing/route'; export default class myroute extends route { async model() { let response = await fetch('some/url/to/json/data'); let json = await response.json(); return { ...
Ember app structure and componentization - Learn web development
ing interactivity and state manipulation. by default, generate component generates template-only components, because in large applications, template-only components end up being the majority of the components. header-test.js is for writing automated tests to ensure that our app continues to work over time as we upgrade, add features, refactor, etc. testing is outside the scope of this tutorial,
although generally testing should be implemented as you develop, rather than after, otherwise it tends to be forgotten about. if you're curious about testing, or why you would want to have automated tests, check out the official ember tutorial on testing. before we start adding any component code, let’s create the scaffolding for the other components. enter the following lines into your terminal, ...
Getting started with Svelte - Learn web development
see package management basics for more information on npm and yarn. if you're using windows, you will need to install some software to give you parity with unix/macos terminal in order to use the terminal commands mentioned in this tutorial. gitbash (which comes as part of the git for windows toolset) or windows subsystem for linux (wsl) are both suitable. cmder is another very good and complete
alternative. see command line crash course for more information on these, and on terminal commands in general. also see the following for more information: "what is npm" on nodejs.org "introducing npx" on the npm blog "the easiest way to get started with svelte" on the svelte blog creating your first svelte app the easiest way to create a starter app template is to just download the starter ...
Working with Svelte stores - Learn web development
eration to save the value to web storage. the rest of the code is mostly initializing and converting stuff. now we will use our local store from stores.js to create our locally persisted todos store. update stores.js like so: import { writable } from 'svelte/store' import { localstore } from './localstore.js' export const alert = writable('welcome to the to-do list app!') const initi
altodos = [ { id: 1, name: 'visit mdn web docs', completed: true }, { id: 2, name: 'complete the svelte tutorial', completed: false }, ] export const todos = localstore('mdn-svelte-todo', initi
altodos) using localstore('mdn-svelte-todo', initi
altodos), we are configuring the store to save the data in web storage under the key mdn-svelte-todo. we also set a couple of todos as initial values. ...
Creating our first Vue component - Learn web development
— we can check the checkboxes in the ui, but nowhere in the app are we recording whether a todo item is actually done. to achieve this, we want to bind the component's done prop to the checked attribute on the <input> element, so that it can serve as a record of whether the checkbox is checked or not. however, it's important that props serve as one-way data binding — a component should never
alter the value of its own props. there are a lot of reasons for this. in part, components editing props can make debugging a challenge. if a value is passed to multiple children, it could be hard to track where the changes to that value were coming from. in addition, changing props can cause components to re-render. so mutating props in a component would trigger the component to rerender, which may ...
Getting started with Vue - Learn web development
w, it should contain a welcome message, a link to the vue documentation, links to the plugins you added when you initialized the app with your cli, and some other useful links to the vue community and ecosystem. making a couple of changes let's make our first change to the app — we’ll delete the vue logo. open the app.vue file, and delete the <img> element from the template section: <img
alt="vue logo" src="./assets/logo.png"> if your server is still running, you should see the logo removed from the rendered site almost instantly. let’s also remove the helloworld component from our template. first of all delete this line: <helloworld msg="welcome to your vue.js app"/> if you save your app.vue file now, the rendered app will throw an error because we’ve registered the componen...
Vue resources - Learn web development
to publish your site to the web, copy the contents of this folder to your hosting environment. note: the vue cli docs also include a specific guide on how to publish your app to many of the common hosting platforms. vue 3 vue 3 is a major release of the framework with a lot of major changes. it went into active beta in april, 2020. the biggest change is a new composition api that works as an
alternative to the current property-based api. in this new api, a single setup() function is used on the component. only what you return from this function is available in your <template>s. you are required to be explicit about "reactive" properties when using this api. vue handles this for you using the options api. this makes the new api typically considered a more advanced use case. there are als...
Styling Vue components with CSS - Learn web development
stack-large class to the <ul> tag in our app.vue file. this will help improve the spacing of our to-do items a bit. update it as follows: <ul aria-labelledby="list-summary" class="stack-large"> adding scoped styles the last component we want to style is our todoitem component. to keep the style definitions close to the component we can add a <style> element inside it. however, if these styles
alter things outside of this component, it could be challenging to track down the styles responsible, and fix the problem. this is where the scoped attribute can be useful — this attaches a unique html data attribute selector to all of your styles, preventing them from colliding globally. to use the scoped modifier, create a <style> element inside todoitem.vue, at the bottom of the file, and give ...
Understanding client-side JavaScript frameworks - Learn web development
that includes all the essential information you need to work towards your goal. get started introductory guides 1. introduction to client-side frameworks we begin our look at frameworks with a general overview of the area, looking at a brief history of javascript and frameworks, why frameworks exist and what they give us, how to start thinking about choosing a framework to learn, and what
alternatives there are to client-side frameworks. 2. framework main features each major javascript framework has a different approach to updating the dom, handling browser events, and providing an enjoyable developer experience. this article will explore the main features of “the big 4” frameworks, looking at how frameworks tend to work from a high level and the differences between them. reac...
Introduction to automated testing - Learn web development
) — switch orientation between portrait and landscape. fit to screen (looks like a full screen icon) — fill the testing areas as much as possible with the device. capture a bug (looks like a camera) — takes a screenshot, then allows you to annotate and save it. issue tracker (looks like a deck of cards) — view previously captured bugs/screenshots. settings (cog icon) — allows you to
alter general settings for the session. help (question mark) — accesses help/support functions. devtools — allows you to use your browser's devtools to directly debug or manipulate the page being shown in the test browser. this currently only works when testing the safari browser on ios devices. device info — displays information about the testing device. features — shows you what feature...
Handling common HTML and CSS problems - Learn web development
er way round. of course, doing this for lots of different css rules can get really tedious. it is better to use an automation tool to do it for you. and such tools exist: the prefix-free javascript library can be attached to a page, and will automatically detect what capabilities are possessed by browsers viewing the page and add prefixes as appropriate. it is really easy and convenient to use,
although it does have some downsides (see the link above for details), and it is arguable that parsing every stylesheet in your site and add prefixes at run time can be a drain on the computer's processing power for a large site. another solution is to add prefixes automatically during development, and this (and other things besides) can be done using tools like autoprefixer and postcss. these tools...
Setting up your own test automation environment - Learn web development
t reporting mechanism! now if you go back to the browserstack automation dashboard page, you'll see your test listed: if you click on the link for your test, you'll get to a new screen where you will be able to see a video recording of the test, and multiple detailed logs of information pertaining to it. note: the resources menu option on the browserstack automation dashboard contains a we
alth of useful information on using it to run automated tests. see node js documentation for writing automate test scripts in node js for the node-specific information. explore the docs to find out all the useful things browserstack can do. note: if you don't want to write out the capabilities objects for your tests by hand, you can generate them using the generators embedded in the docs. see run ...
Git and GitHub - Learn web development
this module. however, it is recommended that you know some coding so that you have reasonable computer literacy, and some code to store in your repositories! it is also preferrable that you have some basic terminal knowledge, so for example moving between directories, creating files, and modifying the system path. note: github is not the only site/toolset you can use with git. there are other
alternatives such as gitlab that you could try, and you could also try setting your own git server up and using it instead of github. we've only stuck with github in this course to provide a single way that works. guides note that the links below take you to resources on external sites. eventually we will are aiming to have our own dedicated git/github course, but for now, these will help you get ...
Links and Resources
be included for web authors. cynthia says™ from hisoftware® company "cynthia says™" is a free online webpage accessibility validation service that identifies accessibility errors in webpage related to section 508 standards and/or the wcag guidelines. just like webxact, it can also perform a "complete webpage quality check" for accessibility, privacy, searchability, metadata and even
alt text attribute quality. accessibility valet from webthing description and summary to be written. wave 3.0 (web accessibility versatile evaluator) from webaim and sponsored by temple university institute on disabilities wave 3.0 is another powerful, mature, free online webpage accessibility validation service that identifies accessibility errors and reports accessibility warnings...
Adding a new event
content. void assignfooeventdata(const internalfooevent* aevent, bool acopytargets) this method should copy members from aevent. first, this method should call its super class's this method. then, copy the additional members which are defined in the class. if acopytargets is false, don't copy its event target related members. all new member variables of event classes must be with "m" prefix.
although, a lot of existing members don't have "m" prefix, but you shouldn't use the legacy local rules. if you need to add methods, it's okay to implement them as inline methods. i.e., you can implement new methods in the header files directly. however, if implementing method isn't small and called from a lot of places, implementing it as inline causes to increase binary size. in this case, you sh...
Android-specific test suites
e https://developer.android.com/studio/write/lint.html and http://tools.android.com/tips/lint for more details. running android-lint to run android-lint, first build firefox for android with your changes; then run ./mach android lint this will lint the code and report the results to stdout, as well as produce an html report. while developing, lint warnings should appear within android studio,
although this is not infallible. disabling one failing test in general, it's not sensible to allow new java code to land that lint detects issues with. however, the existing configuration can be tweaked and some options can be modified. contact information android-lint is currently owned by :sebastian and :nalexander. file tickets in the firefox for android product in bugzilla. ...
A bird's-eye view of the Mozilla framework
interface nsisupports { void queryinterface(in nsiidref uuid, iid_is(uuid),retval] out nsqiresult result); [noscript, notxpcom] nsrefcnt addref(); [noscript, notxpcom] nsrefcnt release(); }; the uuid parameter to queryinterface() is the iid uniqely identifying the interface. if nsirdfnode doesn't support nsirdfliteral, it returns null and it's up to the client to choose an
alternate course of action. the xpcom component keeps track of all interface pointers currently held by its clients using an internal reference count it increments via client calls to addref(). it is up to the client to call release() when it no longer needs the interface. release() decrements the reference count and then the object becomes a candidate for destruction. javascript handles its own ga...
Chrome registration
since xul is designed for describing the contents of windows and dialogs. the javascript files that define the user interface are also contained within the content packages, as well as most xbl binding files. locale localizable applications keep all their localized information in locale providers. this allows translators to plug in a different chrome package to translate an application without
altering the rest of the source code. the two main types of localizable files are dtd files and java-style properties files. skin a skin provider is responsible for providing a complete set of files that describe the visual appearance of the chrome. typically a skin provider will provide css files and images. note: scripts (including those found in xbl) loaded from skin packages will not execute...
Creating a spell check dictionary add-on
e latest version. the em:version should follow the rules of mozilla add-on version numbers, and if you update an existing dictionary add-on, the new version number must be greater than the old one. don't change em:type or em:unpack, and don't add a em:bootstrap element. type = 64 indicates that the add-on is in the restartless format, and unpack is required for hunspell to read the dictionary.
although the restartless format for dictionary add-ons were introduced in gecko 10, dictionary updates only works starting from gecko 18. the em:minversion should therefore be the same as in the example above (or greater). if you set em:minversion to a lower value, gecko 10-17 will not be able to update your dictionary add-on once the restartless dictionary is installed (bug 782118), and gecko 10-16 ...
Creating reftest-based unit tests
the power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. ...
Debugging JavaScript
g command to have a native console : firefox.exe -console using normal javascript object inspection, you can write a function that dumps a whole object, similar to this ddumpobject(). log.jsm (formerly log4moz) this is a partial implementation of the log4* interfaces (for example, see log4j or log4net). components.utils.import("resource://gre/modules/log.jsm"); "debugger" keyword you can h
alt venkman or chromebug at a line using the keyword debugger. in debug builds this also dumps a stack trace to the console, even when the debugger is not running. in extensions you can print the callstack using components.stack like this: function getstackdump() { var lines = []; for (var frame = components.stack; frame; frame = frame.caller) { lines.push(frame.filename + " (" + frame.linen...
Makefiles - Best practices and suggestions
generate, deploy, install, etc. all subsequent make calls must become a nop unless sources or dependencies change or have been removed. incorrect dependencies will contribute to wasted cycles and can contribute to circular dependencies. directory dependencies do not use directories as a dependency for generated targets, ever. any activity within a directory will
alter inodes forcing targets to always be stale. for ex, individual unit tests would invalidate all prior test activity whenever a test touched a timestamp file in the directory to signal success. parallel make: add an explicit timestamp dependency (.done) that make can synchronize threaded calls on to avoid a race condition. # transient directory for...
Old Thunderbird build
d mozconfig to the root directory of the comm-central checkout that contains the following line: ac_add_options --enable-application=mail you can create a file with this line by doing this: cd comm-central echo 'ac_add_options --enable-application=mail' > mozconfig if you omit this line, the build system will build firefox instead. other build configuration options can be added to this file,
although it's strongly recommended that you only use options that you fully understand. for example, to create a debug build instead of a release build, that file would contain: ac_add_options --enable-debug for more on configuration options, see the page configuring build options. note that if you use an moz_objdir it cannot be a sibling folder to your source directory. use an absolute path to be...
Simple Instantbird build
after unbundling comm-central. then run python client.py checkout to ensure you are up-to-date. the source code requires 1.5gb of free space or more. build configuration by default, the build system creates a release build of instantbird roughly equivalent to the official instantbird release builds. if that's not exactly what you want, there are many build configuration options to choose from,
although it's strongly recommended that you only use options that you fully understand. the normal way to specify build options is to place them in a file called '.mozconfig' at the root of your mozilla source tree, i.e. your comm-central repo. for example, to create a debug build instead of a release build, that file would contain: ac_add_options --enable-debug for more on configuration options, ...
Simple Thunderbird build
t directory of the mozilla-central checkout that contains the following line: ac_add_options --enable-application=comm/mail you can create a file with this line by doing this in the source/ directory: echo 'ac_add_options --enable-application=comm/mail' > mozconfig if you omit this line, the build system will build firefox instead. other build configuration options can be added to this file,
although it's strongly recommended that you only use options that you fully understand. for example, to create a debug build instead of a release build, that file would also contain the line: ac_add_options --enable-debug each of these ac_add_options entries needs to be on its own line. for more on configuration options, see the page configuring build options. note that if you use an moz_objdir it...
pymake
gmake vs. pymake for more information. anywhere you would normally type make, instead type python /path/to/srcdir/build/pymake/make.py. for example: instead of make -f client.mk to start a build, you would type python build/pymake/make.py -f client.mk. to run tests instead of typing make mochitest-plain in the object directory, you would type python ../build/pymake/make.py mochitest-plain.
alternately, if you would like to simply type in pymake -f client.mk from within the mingw32 shell. while in the shell type cd ~ (without quotes). type touch .profile using any 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/mak...
The Firefox codebase: CSS Guidelines
r the following questions: is the variable value changed at runtime? (either from javascript or overriden by another css file) if the answer is no, consider using a preprocessor variable or simply inlining the value. is the variable value used multiple times? if the answer is no and the value isn't changed at runtime, then you likely don't need a css variable. is there an
alternative to using the variable like inheriting or using the currentcolor keyword? using inheriting or using currentcolor will prevent repetition of the value and it is usually good practice to do so. in general, it's good to first think of how some css could be written cleanly without the css variable(s) and then think of how the css variable could improve that css. using variables use the v...
Gecko Logging
some other mostly-useless information on logging can be found on the nspr logging page. logging framework declaring a log module lazylogmodule defers the creation the backing logmodule in a thread-safe manner and is the preferred method to declare a log module. multiple lazylogmodules with the same name can be declared, all will share the same backing logmodule. this makes it much simpler to share a log module across multiple translation units. ...
Reviewer Checklist
onal description, if needed, should be present, properly wrapped, in later lines. adequately document any potentially confusing pieces of code. flag a bug with dev-doc-needed if any addon or web apis are affected. use javadocs extensively, especially on any new non-private methods. when moving files, ensure blame/annotate is preserved. accessibility for html pages, images should have the
alt attribute set when appropriate. similarly, a button that is not a native html button should have role="button" and the aria-label attribute set. [fennec: make sure contentdescription is set for parts of the ui that should be accessible] ...
Displaying Places information using views
y with particular search terms and folders. void applyfilter( string filterstring, array folderrestrict ); parameters filterstring the new query's searchterms property will be set to this string. folderrestrict the setfolders function of the new query will be called on this array of folder ids. optional. load() sets the queries that the view displays. this method may be used as an
alternative to setting the tree's place property as described above. void load( array queries, nsinavhistoryqueryoptions options ); parameters queries an array of nsinavhistoryquery objects. options an nsinavhistoryqueryoptions object. selectitems() selects the first node in the tree that matches each given item id. it will open any parent nodes that it needs to in order to show the s...
Index
ace elements. 169 privacy privacy, security this document lists privacy-related documentation. 170 storage access policy: block cookies from trackers privacy, storage access policy, tracking protection firefox includes a new storage access policy that blocks cookies and other site data from third-party tracking resources. this new policy is designed as an
alternative to the current policies, which have been available in firefox for many years. the new policy protects against cross-site tracking while minimizing the site breakage associated with traditional cookie blocking. this article explains how the new policy works and how you can test it. 171 tracking protection privacy, private browsing, blocking, tracking starting in versio...
Limitations of chrome scripts
the nsiwebprogress object passed into onstatechange. however, the domwindow is passed asynchronously, so by the time the chrome process receives it, the dom might have changed (for example, because code running in the content process modified it or we navigated to a different page). we're working on fixing this issue in bug 1118880. also note that unlike other shims, this shim is always active.
alternatively, you can use nsiwebprogresslistener in the content process. observers in the chrome process depending on the topic, you need to register observers in either the chrome process or in a frame script. for most topics you need to register observers in the chrome process. however, you must listen to content-document-global-created and document-element-inserted in a frame script. observer...
Limitations of frame scripts
e file access rules placed on remote content. therefore frame scripts should not attempt to access the local file system directly, as these calls will fail. examples of apis add-on authors should avoid in frame scripts: nsifileinputstream nsifileoutputstream constructing a file from a string or nsifile (but file objects can be sent via message manager) htmlinputelement.mozsetfilenamearray (
alternative: mozsetfilearray) xul and browser ui anything that tries to touch the browser ui or anything to do with xul is likely to not work in the content process. for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts. services.search services.downloads chrome windows anything that needs to use chrome window...
Limitations of frame scripts
a frame script, in particular, the profile directory. even if this is possible, you should not do it and may expect that it could stop working at any time. file i/o should all be done in the chrome process. for example: nsifileinputstream nsifileoutputstream constructing a file from a string or nsifile (but file objects can be sent via message manager) htmlinputelement.mozsetfilenamearray (
alternative: mozsetfilearray) file: uris, see bug 1187099 <...> xul and browser ui anything that tries to touch the browser ui or anything to do with xul is likely not to work in the content process. for example: nsipromptservice nsifilepicker nsixul* <need more examples> services some services will not work in frame scripts. services.search services.downloads chrome windows anyt...
Using the Browser API
false; console.log("it's possible to navigate the history backward."); } else { back.disabled = true; console.log("it's not possible to navigate the history backward."); } }); } implementing the url bar the url bar for our simple browser is a <form> containing a single text <input>. when you tap the url bar, you can enter a url using the built-in firefox os keyboard (
although note that we haven't implemented anything sophisticated in this app, like autofilling the http://, etc.). when you press the keyboard's return button, the 'submit' event is fired, which we handle like this: urlform.addeventlistener('submit',function(e) { e.preventdefault(); browser.src = urlbar.value; urlbar.blur(); }); we first call preventdefault() to stop the form just submitting ...
HTMLIFrameElement.getStructuredData()
ded in the browser. parameters none. examples var browser = document.queryselector('iframe'); browser.addeventlistener('mozbrowserloadend',function() { var request = browser.getstructureddata(); request.onsuccess = function() { console.log(request.result); } }); running this code in a browser api app and then loading up a page that contains microdata (such as the website of british
alt-country band s
alter cane) will result in a json object being returned, along the lines of: { "items": [ { "type":["http://microformats.org/profile/hcard"], "properties":{"fn":["chris askew"], "n":[ { "properties": { "given-name":["chris"], "family-name":["askew"], ... specification not pa...
mozbrowserloadend
the mozbrowserloadend event is fired when the browser <iframe> has finished loading all its assets, or has failed to load. this can be used when the embedder wants to stop spinning a loading indicator, or update the ui in some other way to indicate loading is complete. ...
HTMLIFrameElement.sendMouseEvent()
epresenting the y position of the cursor relative to the browser <iframe>'s visible area in css pixels. button a number representing which button has been pressed on the mouse: 0 (left button), 1 (middle button), or 2 (right button). clickcount the number of clicks that should be performed. modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 :
alt 2 : ctrl 4 : shift 8 : meta 16 :
alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. examples var browser = document.queryselector('iframe'); browser.sendmouseevent("mousemove", x, y, 0, 0, 0); browser.sendmouseevent("mousedow...
HTMLIFrameElement.sendTouchEvent()
resenting the y radius of each touch point in css pixels. rotationangles an array of numbers representing the angle of each touch point in degrees. forces an array of numbers representing the intensity of each touch in the range 0–1. count the number of touches that should be performed. modifiers a number representing a key pressed at the same time the mouse button was clicked: 1 :
alt 2 : ctrl 4 : shift 8 : meta 16 :
alt gr 32 : caps lock 64 : fn 128 : num lock 256 : scroll 512 : symbol lock 1024 : win note: you can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014. examples var browser = document.queryselector('iframe'); browser.sendtouchevent("touchstart", [1], [x], [y], [2], [2], ...
Embedding the editor
iting session" - a single top-level document which is editable, and which may embody more than one editor. this interface will be called nsi????. high-level ui and emebedding code should deal with this editing session interface, without knowledge of the underlying editors. the editing session will forward commands to the individual editors depending on focus, and mediate undo/redo between them.
alternative solution: rather than having multiple editors in this scenario, we could have a single editor, which is capable of saving and restoring state such that it can be transferred between the various subdocuments being edited. that state would have to include the document, undo stack, and typing state. the implementation of the editing session would be responsible for swapping out the editor's ...
Script security
ubsumes b a has all of the privileges of b, and possibly more, and therefore a is allowed to see and do anything that b can see and do. a subsumes b && b subsumes a a and b are same-origin. a subsumes b && b !subsumes a a is more privileged than b. a gets access to all of b, by default with xray vision, which it may choose to waive. b gets no access to a,
although a may choose to export objects to b. a !subsumes b && b !subsumes a a and b are cross-origin. security principals there are four types of security principal: the system principal, content principals, expanded principals, and the null principal. system principal the system principal passes all security checks. it subsumes itself and all other principals. chrome cod...
Geckoview-Junit Tests
be conditionally skipped using junit's assume or assumethat methods. for example: import org.junit.assume.assumethat ... @test fun contentcrashignored() { // cannot test x86 debug builds due to gecko's "ah_crap_handler" // that waits for debugger to attach during a sigsegv. assumethat(sessionrule.env.isdebugbuild && sessionrule.env.cpuarch == "x86", equ
alto(false)) running tests on try to run these tests on try, use something like: mach try fuzzy -q geckoview-junit --artifact or mach try -b do -p android-x86_64 -u geckoview-junit --artifact currently, geckoview-junit is only run on android-x86_64. contact information geckoview-junit tests are maintained by :snorp and :gbrown. bugs should be filed in geckoview :: general. ...
How to implement a custom autocomplete search component
ions for what the user has started to type. there are actually two autocomplete mechanisms: an older mechanism that is part of the "xpfe" codebase and is used in older applications such as thunderbird and seamonkey. a newer and slightly simplified mechanism that is used in "toolkit" applications such as firefox and xulrunner. thunderbird 2.x and seamonkey 1.1.x support the toolkit interfaces,
although they do not use the same autocomplete widget. to use autocomplete with a xul textbox, all you need to do is set some attributes: <textbox type="autocomplete" autocompletesearch="history"/> the type="autocomplete" turns on the autocomplete mechanism and the autocompletesearch="history" sets the source for the autocomplete. there are more options and features, see xul:textbox_(firefox_autoco...
IPDL Tutorial
st nscstring& type, const nstarray<nscstring>& args, int* rv) = 0; /* deallocate the pplugininstanceparent after pplugininstancedestructor is done with it */ virtual bool deallocpplugininstance(pplugininstanceparent* actor) = 0; /* constructor message */ virtual callpplugininstanceconstructor(const nscstring& type, const nstarray<nscstring>& args, int* rv) { /* generated code */ } /*
alternate form of constructor message: supply your own pplugininstanceparent* to bypass allocpplugininstance */ virtual bool callpplugininstanceconstructor(pplugininstanceparent* actor, const nscstring& type, const nstarray<nscstring>& args, int* rv) { /* generated code */ } /* destructor message */ virtual bool call__delete__(pplugininstanceparent* actor) { /* generated code */ } /* noti...
JavaScript-DOM Prototypes in Mozilla
al, but they would be two different jsobject's. this sharing of prototypes lets users do cool things like modify how all instances of a given class works by modifying the prototype of one instance. as an example: function bar() { alert("hello world!"); } document.images[0].__proto__.foo = bar; this would make every image in this document have a callable foo property (i.e. a foo() method).
alternatively, one can access and modify the prototype of an htmlimageelement through the prototype property of the constructor: htmlimageelement.prototype.foo = bar; modifying the prototype of a host object is not guaranteed by ecmascript specification. moreover, no specification guarantees that there will be a globally available htmlimageelement, or that such object will be the constructor for a...
AddonManager
ist of add-ons that were detected as newly-installed during application startup. this doesn't include add-ons that were awaiting installation the last time the application was running. startup_change_changed a list of add-ons that were detected as having changed during startup. this includes an add-on being moved to a new location, changing version, or having been detected as possibly
altered. startup_change_uninstalled a list of add-ons that were detected as having been uninstalled during startup. this doesn't include add-ons for which uninstall was pending the last time the application was running. startup_change_disabled a list of add-ons that were detected as having become disabled during startup. this normally means the application determined that the ...
CustomizableUI.jsm
attribute type description area_navbar string "nav-bar", a constant reference to the id of the navigation toolbar. area_tabstrip string "tabstoolbar", a constant reference to the id of the tabstrip toolbar. area_menubar string "toolbar-menubar", a constant reference to the id of the menubar's toolbar. area_bookmarks string "person
altoolbar", a constant reference to the id of the bookmarks toolbar. area_addonbar deprecated string "addon-bar", a constant reference to the id of the add-on toolbar shim. do not use, this will be removed as soon as reasonably possible. area_panel string "panelui-contents", a constant reference to the id of the menu panel. type_toolbar string "toolbar", ...
Geometry.jsm
metry.jsm javascript code module provides routines for performing common geometry operations on points and rectangles. it exports two classes: point and rect. to use these routines, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/geometry.jsm"); once you've imported the module, you can then use the point and rect classes. note:
although this module is usable from mobile, and is present in firefox 4, it's currently not used in firefox 4 and attempting to use it may produce unreliable results there. ...
JavaScript OS.Constants
enu. macuserlibdir the path to the user's library directory. maclocalapplicationsdir the path to the local applications directory. os.constants.libc constants for interacting with libc. useful mostly for using js-ctypes to interact with the following platforms: macos x; android; linux; other variants of unix. os.constants.libc is available on all platforms,
although some constants are not defined everywhere. before using a constant, you should check that it is defined. error values eacces permission denied eagain resource temporarily unavailable ebadf bad file descriptor eexist file exists efault bad address efbig file too large einval invalid argument eio ...
Deferred
ed promise with the specified reason. if the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is bound to its associated promise when promise.defer() is called, and can be called with any value of this. void reject( areason ); parameters areason optional the rejection reason for the associated promise.
although the reason can be undefined, it is generally an error object, like in exception handling. note: this argument should not be a promise. specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason. backwards and forwards compatible helper this deferred function can be used for backwards and forwards compatibility, due ...
Promise
passed promise, and follow the state as the provided promise (including any future transitions). reject() rejects the associated promise with the specified reason. if the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. void reject( areason ); parameters areason optional the rejection reason for the associated promise.
although the reason can be undefined, it is generally an error object, like in exception handling. note: this argument should not be a promise. specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason. methods then() calls one of the provided functions as soon as this promise is either fulfilled or rejected. a new promis...
Promise.jsm
ue is a promise, then the returned promise will be resolved with the value, i.e. it will eventually assume the same state as the provided promise. return value a promise that can be pending, fulfilled, or rejected. reject() creates a new promise rejected with the specified reason. promise reject( areason ); parameters areason optional the rejection reason for the returned promise.
although the reason can be undefined, it is generally an error object, like in exception handling. note: this argument should not be a promise. specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason. return value a rejected promise. examples see the examples page. ...
Deferred
associated promise with the specified reason. if the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing. note: this function is exactly same as promise constructor's reject argument, and can be called with any value of this. void reject( areason ); parameters areason optional the rejection reason for the associated promise.
although the reason can be undefined, it is generally an error object, like in exception handling. note: this argument should not be a promise. specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason. ...
PromiseWorker.jsm
ferring is possible only when resolving the promise from the worker. unlike when sending/transferring from the main thread, transferring from worker does not require each piece of data that you want transferred to be wrapped in its own meta object. instead, the whole return should be wrapped. also unlike sending/transferring from the main thread, when sending/transferring from worker there are no
alternative syntaxes, it must be wrapped in a meta object. this example shows how to transfer a single value, which is an arraybuffer. return new promiseworker.meta(abuf, {transfers: [abuf]}); if you want to return an object or an array and transfer only certain parts of this data, it would all have to be return wrapped in this meta object like so: return new promiseworker.meta({ thebuf: abuf...
WebRequest.jsm
we're working on addressing them, though. filtering by windowid and tabid is not supported. the onauthrequired, onbeforeredirect, and onerroroccurred events are not supported. the "requestbody" instruction in opt_extrainfospec is not supported. redirection is not allowed in onbeforerequest or onheader...
Encodings for localization files
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 b
altic_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...
Localization content best practices
test localizability as a developer, you should always test your patches not just for code errors, but also for localizability issues in case they involve string or ui changes. gecko and mozilla-central first, make sure that there are no hard-coded strings, and all strings are available in localization files (.dtd, .properties). one possible way to test a patch for localizability issues is to
alter the en-us localization files, adding extraneous characters to the original strings: this can help to identify both hard-coded strings and "flexibility issues" in the ui. changing existing strings updating entity names if you are changing a string such that its meaning has changed, you must update the entity or property name for the string to match the new meaning. if your changes are relevan...
Localizing extension descriptions
"?> <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:name>tab sidebar</em:name> <em:description>zeigt in einer sidebar vorschaubilder der inh
alte aller offenen tabs an.</em:description> </description> </em:localized> <em:localized> <description> <em:locale>es-es</em:locale> <em:name>tab sidebar</em:name> <em:description>muestra una vista previa de sus pestañas en su panel lateral.</em:description> </description> </em:localized> <em:localized> <description> <em:locale...
Localizing with Mercurial
isehg doesn't need this step). use the add_path.exe utility found in c:\mozilla-build\hg to do this. ps c:\users\your_id> cd c:\mozilla-build\hg ps c:\mozilla-build\hg> .\add_path.exe /result . note the dot (".") at the end of the second command, which means the current directory. if the utility modified your %path% successfully, a dialog will open saying, "%path% has been updated correctly."
alternatively, you can edit the %path% variable manually. in order to do so, right-click on your computer icon, choose properties > advanced > environmental variables, select path and click edit. if you don't see path among the options, you'll have to click add and edit it within the add dialog. see the screenshot for an example. did it work? go to start > run... type cmd.exe and click ok. a new...
Patching a Localization
as a diff) using the diff command. hg diff this command creates a patch and lists your modifications through displaying the differences in a unified patch's files. these modifications are printed to stdout (standard output). visually inspect your modifications. a good patch only contains those changes that you intended to make. if it contains more, you'll likely regress something else.
alternatively, you can select specific files for diff to evaluate and print (see below). the command will only print the differences found in the selected files. hg diff browser/chrome/browser/browser.dtd attach the patch to an existing bug for reference or review or create a new one if one doesn't currently exist. hg diff > path/to/patchfile ...
Release phase
luated. this is done by generating a diff between the new release revision being considered and the previously approved release revision. focus is still on technical accuracy and completion of l10n work; not translation quality. release revisions are evaluated, not entire l10n repos. sign-offs do not need to be approved before revision merge between release channels,
although it is recommended. there is a specific process to follow in bugzilla for requesting these reviews: file a bug requesting the review. attach your files to the bug. once attached, open the attachment details. in the attachment details, select the ? from the dropdown menu next to the review flag or the appropriate approval flags (see image). this will display a t...
SVN for Localizers
side the command line tools (available on the apple developer website), or use tools like homebrew or fink. windows users can install the svn client directly from the cygwin setup file. if you already installed cygwin but it didn't include the svn package, run the cygwin installer again and be sure to check the box beside subversion package. this option is found in the devel category. a possible
alternative is to install tortoisesvn (graphical interface and command line client). note: if you do not already have access to svn, visit this wiki page on how to get set up with an svn account before proceeding. mozilla's svn repositories mozilla's svn server is publicly available at https://svn.mozilla.org. despite there being several directories at the root of the svn server, only the project...
Extras
="natural log">ln</mi> <mo>&applyfunction;</mo> <mi>a</mi> </mrow> </mfrac> </mrow> </math> </p> css content math.cue *[title] { color: blue; } mixing with other markups html content <math display="block"> <mrow> <mi>a</mi> <mo>=</mo> <mo>[</mo> <mtable> <mtr> <mtd><mn>1</mn></mtd> <mtd> <mtext> <img width="16" height="16" src="https://udn.realityripple.com/samples/3f/9341cbddc0.png"
alt="mozilla-16" /> </mtext> </mtd> </mtr> <mtr> <mtd> <mtext><input value="type" size="4"/></mtext> </mtd> <mtd><mn>4</mn></mtd> </mtr> </mtable> <mo>]</mo> </mrow> </math> <math display="block"> <msqrt> <mpadded width="30px" height="15px" depth="15px" voffset="-15px"> <mtext> <svg width="30px" height="30px"> <defs> <radialgradient id="radgrad1" cx="50%" cy="50%" r="50%" ...
Mozilla MathML Status
tent mathml or irrelevant features are left blank or not listed at all. 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. the top-level math element see § 2.2. attribute notes display implemented. maxwidth, overflow not implemented. see bug 534962.
altimg,
altimg-width,
altimg-height,
altimg-valign,
alttext accepted, but do not have any effect on the rendering. mathml is always enabled since bug 660762. cdgroup accepted, but does not have any effect on the rendering. attributes shared by all mathml elements see § 2.1.6 and § 3.1.10. attribute notes id, class, style implemented. xref acc...
MathML Demo: <mo> - operator, fence, separator, or accent
+ | 4 + | . | + 5 | + 6 | + 7 | + 8 | the size ratio is 3.0 : 2.4 : 1.8 : 1.2. fixed sized fences are useful with nested fences as in the following example [ [ a b ] + [ b a ] ] + [ a b ] latex fences that are built into fractions (\binom, etc.) are not stretchy, but they are taller in displays. emulating this behavior in mathml would require a context sensitive trans
altion. further, non-stretchy fences aren't usually desirable. hence we script binomial fences as stretchy in mathml. some examples of inline fractions ( 8 - 5 8 ) + [ 1 2 ] + ⌊ 1 2 2 ⌋ + ⌈ 1 x y x + 1 ⌉ + | e - 2 π t θ | with built in fences. same expression in a display. ( 8 - 5 8 ) + [ 1 2 ] + ⌊ 1 2 2 ⌋ + ⌈ 1 x y ...
Using the viewport meta tag to control layout on mobile browsers
using media queries — if the virtual viewport is 980px for example, media queries that kick in at 640px or 480px or less will never be used, limiting the effectiveness of such responsive design techniques. to mitigate this problem, apple introduced the "viewport meta tag" in safari ios to let web developers control the viewport's size and scale. many other mobile browsers now support this tag,
although it is not part of any web standard. apple's documentation does a good job explaining how web developers can use this tag, but we had to do some detective work to figure out exactly how to implement it in fennec. for example, safari's documentation says the content is a "comma-delimited list," but existing browsers and web pages use any mix of commas, semicolons, and spaces as separators. le...
Mozilla DOM Hacking Guide
section 1.5. interface flattening one of the nicest -- and most important -- features of the xpconnect'ed dom is the interface flattening. "interface flattening is the ability to call methods on an object regardless of the interface it was defined on." for example, when we have the document object in javascript, we can call indistinctly document.getelementbyid(), or document.addeventlistener(),
although they are defined on two different interfaces (domdocument and domeventtarget. needless to say this is critical for the use of the dom in real-world content. in mozilla interface flattening is obtained through the use of the nsiclassinfo interface. nsiclassinfo stores the interfaces available for an object and later on xpconnect uses those interfaces to lookup the right method to call. the ...
Mozilla Quirks Mode Behavior
mages, and form controls but the quirk has been adapted to match the behavior of other browser (bug 783213). prior to gecko 36, the quirk was also applied if another pseudo-class was used in the same selector, if a pseudo-element was used in the selector, or if it was part of a pseudo-class argument (bug 783213). quirks mode has document.all support (undetected). images (img elements) without
alt attributes sometimes display placeholder icons in quirks mode. obsolete since gecko 2.0 html colors were parsed differently up to gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) (bug 121738). in quirks mode, the url fragment #top scrolls to the top of the page when there is no such anchor. obsolete since gecko 10.0 however, html5 requires this behavior, and starting in gecko 10.0 (fi...
mozilla::Monitor
mozilla::monitor is a bare wrapper around prmonitor. please see introduction_to_nspr for a high-level summary of its semantics. methods enter() enter the monitor. exit() exit the monitor. wait() nsresult wait( in printerv
altime interval = pr_interval_no_timeout ); wait on this monitor until it is notifyed. notify() nsresult notify(void); notify one thread waiting on this monitor. notifyall() nsresult notifyall(void); notify all threads waiting on this monitor. assertcurrentthreadin() assert that the current thread is in this monitor. does not incur a runtime pen
alty in optimized builds. assertnotcurrentthreadin() assert that the current thread is not in this monitor. does not incur a runtime pen
alty in optimized builds. see also monitorautoenter prmonitor ...
mozilla::MonitorAutoEnter
nderlying mozilla::monitorautoenter. important: when a mozilla::monitorautoenter is live on the stack, your code is guaranteed to own the underlying mozilla::monitor. constructors monitorautoenter( in mozilla::monitor& monitor; ); this parameter is a reference so as to guarantee that your code has already properly constructed the mozilla::monitor. methods wait() nsresult wait( in printerv
altime interval = pr_interval_no_timeout ); wait on the underlying monitor until it is notifyed. notify() nsresult notify(void); notify one thread waiting on the underlying monitor. notifyall() nsresult notifyall(void); notify all threads waiting on the underlying monitor. see also mozilla::monitor ...
mozilla::Mutex
tex is a bare wrapper around prlock. please see introduction_to_nspr for a high-level summary of its semantics. #include <mozilla/mutex.h> methods constructor mutex(const char* aname) initialize the mutex with a name that can reference it. lock() lock the mutex. unlock() unlock the mutex. assertcurrentthreadowns() assert that the current thread has locked this mutex. does not incur a runtime pen
alty in optimized builds. assertnotcurrentthreadowns() assert that the current thread does not own this mutex. does not incur a runtime pen
alty in optimized builds. see also mutexautolock mutexautounlock prlock ...
Build Metrics
installer size size in bytes of the firefox installer. ...
BloatView
42984 0.67% 43488 0.67% this "delta report" shows the leak offenders, sorted from most leaks to fewest. the delta numbers show the percentage change between runs for the amount of leaks and amount of bloat (negative numbers are better!). the bloat number is a metric determined by multiplying the total number of objects allocated of a given class by the class size. note that
although this isn't necessarily the amount of memory consumed at any given time, it does give an indication of how much memory we're consuming. the more memory in general, the worse the performance and footprint. the percentage 99999.99% will show up indicating an "infinite" amount of leakage. this happens when something that didn't leak before is now leaking. bloatview and continuous integration b...
GC and CC logs
dow, so that's a good class to try if you don't have any better idea. to fix a leak, the next step is to figure out why the rooting object is alive. for a c++ object, you need to figure out where the missing references are from. for a js object, you need to figure out why the js object is reachable from a js root. for the latter, you can use the corresponding find_roots.py for js on the gc log.
alternatives there are two add-ons that can be used to create and analyze cc graphs. about:cc is simple, ugly, but rather powerful. about:ccdump is prettier but a bit slower. ...
Gecko Profiler FAQ
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. another approach to get more precision is also raising the sampling frequency to sub-millisecond ranges (it won’t work on windows.) high frequency sampling may also be an area where native profilers are a useful
alternative tool to try. how do we profile "leaks" that show up after running firefox for > 40 mins? the gecko profiler has been designed specifically for the use case of having it run always in the background, and it’s pretty good at that! it is quite reasonable to actually run the browser for 40 minutes and once the said leaks have happened capture the profiles and study...
Reporting a Performance Problem
cesses are shown. you might have a content process using up the cpu and not the main one. make sure you are doing whatever it is that slows down firefox while recording the profile. for example you might have one addon that slows down page load and another one that slows down tab switch. your first reflex once you find what addon is slowing down the profile might be to disable it and search for
alternatives. before you do this, please share the performance profile with the addon authors through a bug report. gecko profiler allows you to share a link with the profile. ...
tools/power/rapl
e other activity on the machine while measuring. note: the power profiling overview is worth reading at this point if you haven't already. it may make parts of this document easier to understand. invocation first, do a standard build of firefox. mac on mac, rapl can be run as follows. $objdir/dist/bin/rapl linux on linux, rapl can be run as root, as follows. sudo $objdir/dist/bin/rapl
alternatively, it can be run without root privileges by setting the contents of /proc/sys/kernel/perf_event_paranoid to 0. note that if you do change this file, its contents may reset when the machine is next rebooted. you must be running linux kernel version 3.14 or later for rapl to work. otherwise, it will fail with an error message explaining this requirement. windows unfortunately, rapl does ...
A brief guide to Mozilla preferences
le from js code, or the mozilla::preferences static class methods from c++ code. changing defaults a systems administrator can modify the default preferences in two ways: the administrator may add an all-companyname.js preference file (install_directory/browser/defaults/preferences/all-companyname.js). this will be parsed last during the preference loading process. the administrator may
alternatively put a user.js file in app_dir/defaults/profile/ ; this will put a copy of the user.js in all new profiles. this method has the advantage of resetting preferences back to administrator defaults at every start-up. note that, because a user typically has access privilege to his or her profile directory, he or she can change the default values if he or she knows how. another disadvantage is...
Preference reference
accessibility.tabfocusthe preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.browser.
altclicksavethe preference browser.
altclicksave controls whether clicking a link while holding the
alt key starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console. set it to true to enable it, or false to disable it.browser.dom.window.dump.filebrowser.dom.window.dump.file redirects the ouput of window.dump() calls to a file whose address is specified in this preference if browser.dom.window.dump.enabled is set to true. changes require an application restart.browser.download.lastdir.savepersitebrowser.download.lastdir.savepersite controls whether the directory...
Profile Manager
firefox and other xulrunner applications store user settings and data in special folders, called profiles. firefox provides a built-in applet to manage these profiles, but it will eventually be going away (see bug 214675), so a new standalone profile manager application has been created, which works with any xulrunner application, and has many features not found in firefox's built-in version. ...
A guide to searching crash reports
n be easily shared by copying and pasting the page's url. to become an expert at searching and grouping requires understanding the full range of the 100+ fields available for searching and grouping. one way to learn about them is to read lots of individual crash reports; note that all fields shown in the details tab of an individual crash report have a tool-tip that indicates its key for search.
alternatively, you can browse the complete list. there is also an api through which searches can be performed programmatically. see the api documentation for full details; note that it uses the term "aggregation" for grouping/faceting. ...
L20n HTML Bindings
using server-side language negotiation. in order to enable the monolingual mode, remove the manifest link from your html. with no information about the available and the default locales, l20n will switch to the monolingual mode. you can then embed localization resources right in your html. <script type="application/l20n"> <brandname "firefox"> <about "about {{ brandname }}"> </script> an
alternative is to include localization resources in script elements. note that this still only works for a single language. we plan to add support for a language pack service in the future that can tap into this scenario on the client side. <script type="application/l20n" src="../locales/strings.l20n"></script> note that you currently cannot use the manifest file and manually add resources via scr...
L20n Javascript API
var ctx = l20n.getcontext(); ctx.linkresource('./locales/strings.l20n'); ctx.requestlocales(); when you freeze the context by calling requestlocales, the resource files will be retrieved, parsed and compiled. you can listen to the ready event (emitted by the context instance when all the resources have been compiled) and use ctx.getsync and ctx.getentitysync to get translations synchronously.
alternatively, you can register callbacks to execute when the context is ready (or when globals change and translations need to be updated) with ctx.localize. ctx.localize(['hello', 'new'], function(l10n) { var node = document.queryselector('[data-l10n-id=hello]'); node.textcontent = l10n.entities.hello.value; node.classlist.remove('hidden'); }); ctx.registerlocales(defaultlocale: string?,...
AsyncTestUtils extended framework
get confused if you try and access headers via them again. slice(...) uses the js array.slice semantics to slice the set. same warnings as union apply. configuring message injection local injection let inboxfolder = configure_message_injection({mode: "local"}); set up message injection to happen locally. this is different from using a pop fake-server. we just cram them using addmessage,
although we try and approximate what would happen with pop in terms of still invoking filters and such. imap injection, do not bring messages offline let inboxfolder = configure_message_injection({mode: "imap", offline: false}); use an imap fake-server to inject messages. we do not mark the folders as offline and therefore do not attempt to download the messages so that they are immediately availa...
MailNews automated testing
manipulation: mark messages as read, tag them, untag them, move them to other folders, trash them, etc. enhanced logging: supports generating rich json streams to disk or over the network for consumption by logsploder or other tools. performance testing mail leak and bloat tests these tests start up thunderbird or seamonkey and record any leaks found, as well as the total memory requirement.
although currently based on simple tests, these are useful for determining if new leaks have been introduced. for more information, see leak and bloat tests. ...
NSPR's Position On Abrupt Thread Termination
bother? in unix, with its complex definition of a protection domain, it happens to work (one might even say it's more efficient) to exit from anywhere. but threads are not processes. if threads have to maintain the same type of resource knowledge as a process, they loose all of their benefit. threads are an implementation strategy to provide the illusion of concurrency within a process. they are
alternatives to large state machines with mostly non-blocking library functions. when the latter is used to provide concurrency, calling exit() will terminate the entire process. why would anyone expect a thread to behave differently? threads are not processes. original document information author: alan o. freier last updated date: december 1998 ...
Nonblocking IO In NSPR
an io function on a nonblocking file descriptor either succeeds immediately or fails immediately with <tt>pr_would_block_error</tt>. a single thread is sufficient to attend to multiple nonblocking file descriptors simultaneously. typically, this central thread invokes <tt>pr_poll()</tt> on a set of nonblocking file descriptors. (note: <tt>pr_poll()</tt> also works with blocking file descriptors,
although it is less useful in the blocking io model.) when <tt>pr_poll()</tt> reports that a file descriptor is ready for some io operation, the central thread invokes that io function on the file descriptor. creating a nonblocking socket only sockets can be made nonblocking. regular files always operate in blocking mode. this is not a serious constraint as one can assume that disk i/o never block...
Date and Time
aylight saving time (dst) and the rule for determining the dates on which dst starts and ends have changed a few times. therefore, a callback function is used to determine time zone information. ...
Dynamic Library Linking
onment variable is ld_library_path. these systems typically use dlopen to load a dynamic library. hp-ux uses shl_load to load dynamic libraries, and the environment variable specifying the dynamic library search path is shlib_path. moreover, the executable program must be linked with the +s option so that it will search for shared libraries in the directories specified by shlib_path at run time.
alternatively, you can enable the +s option as a postprocessing step using the chatr tool. 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. on win32, the environment variable is path. the same search path is used to search for executable programs and dlls. expor...
Introduction to NSPR
thread may modify or (in most cases) even observe the protected data from outside the monitor, the thread can safely make any modifications needed. when the changes have been completed, the thread notifies the condition associated with the data and exits the monitor using pr_notifycondvar. logically, each such notification promotes one thread that was waiting on the condition to a ready state. an
alternate form of notification (pr_notifyallcondvar) promotes all threads waiting on a condition to the ready state. if no threads were waiting, the notification is a no-op. waiting on a condition variable is an interruptible operation. another thread could target the waiting thread and issue a pr_interrupt, causing a waiting thread to resume. in such cases the return from the wait operation indicat...
PRJobIoDesc
syntax #include <prtpool.h> typedef struct prjobiodesc { prfiledesc *socket; prerrorcode error; printerv
altime timeout; } prjobiodesc; ...
PRLinger
structure used with the pr_sockopt_linger socket option to specify the time interval (in printerv
altime units) to linger on closing a socket if any data remain in the socket send buffer. syntax #include <prio.h> typedef struct prlinger { prbool polarity; printerv
altime 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. pr_true means the option is on, and the value of linger will be used to determine how long pr_close waits before returning. linger time (in printerv
altime units) to linger before closing if any data remain in the socket send buffer. description by default, pr_close returns immediately, but if there are any data remai...
PRNetAddr
pports only the internet address family. by default, nspr is built to support only ipv4, but it's possible to build the nspr library to support both ipv4 and ipv6. therefore, the family field can be pr_af_inet only for default nspr, and can also be pr_af_inet6 if the binary supports ipv6. prnetaddr is binary-compatible with the socket address structures in the familiar berkeley socket interface,
although this fact should not be relied upon. the raw member of the union is equivalent to struct sockaddr, the inet member is equivalent to struct sockaddr_in, and if the binary is built with ipv6 support, the ipv6 member is equivalent to struct sockaddr_in6. (note that prnetaddr does not have the length field that is present in struct sockaddr_in on some unix platforms.) the macros pr_af_inet, pr_...
PRTime
#include <prtime.h> typedef print64 prtime; description this type is a 64-bit integer representing the number of microseconds since the nspr epoch, midnight (00:00:00) 1 january 1970 coordinated universal time (utc). a time after the epoch has a positive value, and a time before the epoch has a negative value. in nspr, we use the more familiar term greenwich mean time (gmt) in place of utc.
although utc and gmt are not exactly the same in their precise definitions, they can generally be treated as if they were. note: keep in mind that while prtime stores times in microseconds since epoch, javascript date objects store times in milliseconds since epoch. ...
PR_Accept
accepts a connection on a specified socket. syntax #include <prio.h> prfiledesc* pr_accept( prfiledesc *fd, prnetaddr *addr, printerv
altime 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. addr a pointer to a structure of type prnetaddr. on output, this structure contains the address of the connecting entity. timeout a value of type printerv
altime specifying the time limit for completion of the accept operation. 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. if unsuccessful, null. furthe...
PR_AcceptRead
acceptedsock a pointer to a pointer to a prfiledesc object. ...
PR_GetErrorText
syntax #include <prerror.h> print32 pr_geterrortext(char *text); parameters the function has one parameter: text on output, the array pointed to contains the thread's current error text. returns the actual number of bytes copied. ...
PR ImportTCPSocket
values: upon successful completion, a pointer to the prfiledesc object created for the newly imported native tcp socket. if the import of the native tcp socket failed, null. description a native tcp socket osfd can be imported into nspr with pr_importtcpsocket. the caller gives up control of the native tcp socket osfd and should use the prfiledesc* returned by pr_importtcpsocket instead.
although pr_importtcpsocket is a supported function, it is declared in "private/pprio.h" to stress the fact that this function depends on the internals of the nspr implementation. the caller needs to understand what nspr will do to the native file descriptor and make sure that nspr can use the native file descriptor successfully. for example, on posix systems, nspr will put the native file descripto...
PR_Initialize
in addition to establishing the sequence of operations, pr_initialize implicitly calls pr_cleanup on exiting the primordial function. syntax #include <prinit.h> printn pr_initialize( prprimordialfn prmain, printn argc, char **argv, pruintn maxptds); parameters pr_initialize has the following parameters: prmain the function that becomes the primordial thread's root function. returning from prmain leads to termination of the process. argc the length of the argument vector, whether passed in from the host's program-launching facility or fabricated by the actual main program. this approach conforms to standard c programming practice. ...
PR_MicrosecondsToInterval
converts standard clock microseconds to platform-dependent intervals. syntax #include <prinrval.h> printerv
altime pr_microsecondstointerval(pruint32 milli); parameter the function has the following parameter: micro the number of microseconds to convert to interval form. returns platform-dependent equivalent of the value passed in the micro parameter. ...
PR_MillisecondsToInterval
converts standard clock milliseconds to platform-dependent intervals. syntax #include <prinrval.h> printerv
altime pr_millisecondstointerval(pruint32 milli); parameter the function has the following parameter: milli the number of milliseconds to convert to interval form. returns platform-dependent equivalent of the value passed in the milli parameter. ...
PR_NormalizeTime
the fields of a clock/calendar time to their proper ranges, using a callback function. syntax #include <prtime.h> void pr_normalizetime ( prexplodedtime *time, prtimeparamfn params); parameters the function has these parameters: time a pointer to a clock/calendar time in the prexplodedtime format. params a time parameter callback function. returns nothing; the time parameter is
altered by the callback function. description this function adjusts the fields of the specified time structure using the specified time parameter callback function, so that they are in the proper range. call this function in these situations: to normalize a time after performing arithmetic operations directly on the field values of the calendar time object. for example, if you have a ] object t...
PR_Poll
npds the number of elements in the pds array. if this parameter is zero, pr_poll is equivalent to pr_sleep with a timeout. timeout amount of time the call will block waiting for i/o to become ready. if this time expires without any i/o becoming ready, pr_poll returns zero. ...
PR_Realloc
mory block. returns an untyped pointer to the allocated memory, or if the allocation attempt fails, null. call pr_geterror() to retrieve the error returned by the libc function realloc(). description this function attempts to enlarge or shrink the memory block addressed by ptr to a new size. the contents of the specified memory remains the same up to the smaller of its old size and new size,
although the new memory block's address can be different from the original address. ...
PR_Recv
receives bytes from a connected socket. syntax #include <prio.h> print32 pr_recv( prfiledesc *fd, void *buf, print32 amount, printn flags, printerv
altime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer to hold the data received. amount the size of buf (in bytes). flags must be zero or pr_msg_peek. timeout a value of type printerv
altime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by cal...
PR_RecvFrom
receives bytes from a socket and stores the sending peer's address. syntax #include <prio.h> print32 pr_recvfrom( prfiledesc *fd, void *buf, print32 amount, printn flags, prnetaddr *addr, printerv
altime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data received. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the prnetaddr object that will be filled in with the address of the sending peer on return. timeout a value of type printerv
altime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indi...
PR_STATIC_ASSERT
prevents code from compiling when an expression has the value false at compile time. syntax #include <prlog.h> pr_static_assert ( expression ); parameters the macro has this parameter: expression any valid expression which evaluates at compile-time to true or false. an expression which cannot be evaluated at compile time will cause a compiler error; see pr_assert for a runtime
alternative. returns nothing description this macro evaluates the specified expression. when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully. the compiler error will include the number of the line for which the compile-time assertion failed. this macro may only be used in locations where an extern function declaration may be us...
PR_SecondsToInterval
converts standard clock seconds to platform-dependent intervals. syntax #include <prinrval.h> printerv
altime pr_secondstointerval(pruint32 seconds); parameter the function has the following parameter: seconds the number of seconds to convert to interval form. returns platform-dependent equivalent of the value passed in the seconds parameter. ...
PR_Send
sends bytes from a connected socket. syntax #include <prio.h> print32 pr_send( prfiledesc *fd, const void *buf, print32 amount, printn flags, printerv
altime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. timeout a value of type printerv
altime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. if the parameter fd is a blocking socket, this number must always equal amount. the value -1 indicates a failure...
PR_SendTo
sends bytes a socket to a specified destination. syntax #include <prio.h> print32 pr_sendto( prfiledesc *fd, const void *buf, print32 amount, printn flags, const prnetaddr *addr, printerv
altime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the address of the destination. timeout a value of type printerv
altime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. the value -1 indicate...
PR_Sleep
returns calling pr_sleep with a parameter equivalent to pr_interval_no_timeout is an error and results in a pr_failure error. description pr_sleep simply waits on a condition for the amount of time specified. if you set ticks to pr_interval_no_wait, the thread yields. if ticks is not pr_interval_no_wait, pr_sleep uses an existing lock, but has to create a new condition for this purpose. ...
PR_TransmitFile
sourcefile a pointer to a prfiledesc object representing the file to send. ...
PR_Wait
waits for an application-defined state of the monitored data to exist. syntax #include <prmon.h> prstatus pr_wait( prmonitor *mon, printerv
altime ticks); parameters the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. ticks the amount of time (in printerv
altime units) that the thread is willing to wait for an explicit notification before being rescheduled. 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. pr_failure means pr_wait encountered a sy...
PR_WaitCondVar
timeout the value pr_interval_no_timeout requires that a condition be notified (or the thread interrupted) before it will resume from the wait. the value pr_interval_no_wait causes the thread to release the lock, possibly causing a rescheduling within the runtime, then immediately attempt to reacquire the lock and resume. returns the function returns one of the following values: if successful, pr_success. ...
PR_Writev
writes data to a socket from multiple buffers. syntax #include <prio.h> print32 pr_writev( prfiledesc *fd, priovec *iov, print32 size, printerv
altime timeout); #define pr_max_iovector_size 16 parameters the function has the following parameters: fd a pointer to a prfiledesc object for a socket. iov an array of priovec structures that describe the buffers to write from. size number of priovec structures in the iov array. the value of this parameter must not be greater than pr_max_iovector_size. if it is, the function will fail and the error will be set to pr_buffer_overflow_error. timeout a value of type printerv
altime describing the time limit for completion of the entire write operation. returns one of the following values: a positive number indicates the numb...
Building NSS
ojects. 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. build build nss using our build script: nss/build.sh this builds both nspr and nss. build with make
alternatively, there is a make target called "nss_build_all", which produces a similar result. this supports some
alternative options, but can be a lot slower. make -c nss nss_build_all use_64=1 the make-based build system for nss uses a variety of variables to control the build. below are some of the variables, along with possible values they may be set to. build_opt 0 build a debug (...
JSS Provider Notes
irst, it tries to copy the key material directly using nss calls to pkcs #11. if that fails, it calls getencoded() on the source key, and then tries to create a new key on the target token from the encoded bits. both of these operations will fail if the source key is not extractable. the class java.security.spec.pbekeyspec in jdk versions earlier than 1.4 does not contain the s
alt and iteration fields, which are necessary for pbe key generation. these fields were added in jdk 1.4. if you are using a jdk (or jre) version earlier than 1.4, you cannot use class java.security.spec.pbekeyspec. instead, you can use org.mozilla.jss.crypto.pbekeygenparams. if you are using jdk (or jre) 1.4 or later, you can use java.security.spec.pbekeyspec or org.mozilla.jss.crypto.pbekeygenparam...
Mozilla-JSS JCA Provider notes
to copying keys. first, it tries to copy the key material directly using nss calls to pkcs #11. if that fails, it calls getencoded() on the source key, and then tries to create a new key on the target token from the encoded bits. both of these operations will fail if the source key is not extractable. the class java.security.spec.pbekeyspec in jdk versions earlier than 1.4 does not contain the s
alt and iteration fields, which are necessary for pbe key generation. these fields were added in jdk 1.4. if you are using a jdk (or jre) version earlier than 1.4, you cannot use class java.security.spec.pbekeyspec. instead, you can use org.mozilla.jss.crypto.pbekeygenparams. if you are using jdk (or jre) 1.4 or later, you can use java.security.spec.pbekeyspec or org.mozilla.jss.crypto.pbekeygenparam...
Using JSS
om source, you have these libraries in the mozilla/dist/<platform>/lib directory of your build tree. if you are downloading binaries, get them from the binary release locations in the above table. you need to select the right version of the components, based on the version of jss you are using. generally, it is safe to use a later version of a component than what jss was tested with. for example,
although jss 4.2 was tested with nss 3.11. component versions jss version component tested version jss 4.2 nspr 4.6.4 nss 3.11.4 jss 3.4 nspr 4.2.2 nss 3.7.3 jss 3.3 nspr 4.2.2 nss 3.6.1 or 3.7 jss 3.2 n...
NSS 3.12.6 release notes
bug 527759: add multiple roots to nss (single patch) bug 528741: pkix_hash throws a null-argument exception on empty ...
NSS_3.12_release_notes.html
commandline bug 161326: need api to convert dotted oid format to/from octet representation bug 376737: cert_importcerts routinely sets valid_peer or valid_ca override trust flags bug 390381: libpkix rejects cert chain when root ca cert has no basic constraints bug 391183: rename libpkix error string number type to pkix error number types bug 397122: nss 3.12 alpha treats a key3.db with no global s
alt as having no password bug 405966: unknown signature oid 1.3.14.3.2.29 causes sec_error_bad_signature, 3.11 ignores it bug 413010: cert_comparerdn may return a false match bug 417664: false positive crl revocation test on ppc/ppc64 nss_enable_pkix_verify=1 bug 404526: glibc detected free(): invalid pointer bug 300929: certificate policy extensions not supported bug 129303: nss needs to expose inte...
NSS 3.14.2 release notes
note: please apply the patch in https://bugzilla.mozilla.org/show_bug.cgi?id=837799 if you build nss with the system sqlite library and your system sqlite library is older than 3.7.15. bug 816853 - when using libpkix for certificate validation, applications may now supply additional application-defined trust anchors to be used in addition to those from loaded security tokens, rather than as an
alternative to. (https://bugzilla.mozilla.org/show_bug.cgi?id=816853) bug 772144 - basic support for running nss test suites on android devices.this is currently limited to running tests from a linux host machine using an ssh connection. only the sshdroid app has been tested. bug 373108 - fixed a bug where, under certain circumstances, when applications supplied invalid/out-of-bounds parameters f...
NSS 3.14 release notes
such changes may present interoperability concerns when enabling tls 1.1. when connecting to a server, the record layer version of the initial clienthello will be at most { 3, 1 } (tls 1.0), even when attempting to negotiate tls 1.1 (https://bugzilla.mozilla.org/show_bug.cgi?id=774547) the choice of client_version s...
NSS 3.15.1 release notes
ror_incorrect_signature_algorithm - new error codes for tls 1.2. in sslt.h ssl_hmac_sha256 - a new value in the sslmacalgorithm enum type. ssl_signature_algorithms_xtn - a new value in the sslextensiontype enum type. new pkcs #11 mechanisms none. notable changes in nss 3.15.1 bug 856060 - enforce name constraints on the common name in libpkix when no subject
altname is present. bug 875156 - add const to the function arguments of sec_certnicknameconflict. bug 877798 - fix ssltap to print the certificate_status handshake message correctly. bug 882829 - on windows, nss initialization fails if nss cannot call the rtlgenrandom function. bug 875601 - secmod_closeuserdb/secmod_openuserdb fails to reset the token delay, leading to spurious failures. bu...
NSS 3.16.1 release notes
functionality added the "ecc" flag for modutil to select the module used for elliptic curve cryptography (ecc) operations. new functions in pk11pub.h pk11_exportderprivatekeyinfo and pk11_exportprivkeyinfo - exports a private key in a der-encoded asn.1 privatekeyinfo type or a seckeyprivatekeyinfo structure. only rsa private keys are supported now. in secmod.h secmod_intern
altopubmechflags - converts from nss-internal to public representation of mechanism flags. new types in sslt.h ssl_padding_xtn - the value of this enum constant changed from the experimental value 35655 to the iana-assigned value 21. . new macros in secmod.h public_mech_ecc_flag - a public mechanism flag for elliptic curve cryptography (ecc) operations. in utilmodt.h...
NSS 3.16.2 release notes
an ssl error code that means the server supports no protocols that the client advertises in the alpn extension. notable changes in nss 3.16.2 the btoa command has a new command-line option -w suffix, which causes the output to be wrapped in begin/end lines with the given suffix. use "c" as a shorthand for the suffix certificate. the certutil commands supports additionals types of subject
alt name extensions: --extsan type:name[,type:name]... the certutil commands supports generic certificate extensions, by loading binary data from files, which have been prepared using external tools, or which have been extracted and dumped to file from other existing certificates: --dump-ext-val oid --extgeneric oid:critical-flag:filename[,oid:critical-flag:filename]... the...
NSS 3.24 release notes
entifies a key agreement type rather than a certificate). separate functions for configuring online certificate status protocol (ocsp) responses or signed certificate timestamps are not needed, since these can be added to the optional sslextraservercertdata struct provided to ssl_configservercert. also, partial support for rsa probabilistic signature scheme (rsa-pss) certificates has been added.
although these certificates can be configured, they will not be used by nss in this version. for functions that use temporary arenas, allocating a portcheaparena on the stack is more performant than allocating a plarenapool on the heap. rather than declaring a plarenapool pointer and calling port_newarena/port_freearena to allocate or free an instance on the heap, declare a portcheaparenapool on the...
NSS 3.27.1 release notes
bility issue which some applications experienced with nss 3.27. notable changes in nss 3.27.1 availability of the tls 1.3 (draft) implementation has been re-disabled in the default build. previous versions of nss made tls 1.3 (draft) available only when compiled with nss_enable_tls_1_3. 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. however, some applications query the list of protocol versions that are supported by the nss library, enabling all supported tls protocol versions. because nss 3.27 enabled compilation of tls 1.3 (draft) by default, it caused those applications to enable tls 1.3 (draft). this resulted in connectivity failures, as some tls servers are ver...
NSS 3.27 release notes
_27_rtm/src/ new in nss 3.27 new functionality allow custom named group priorities for tls key exchange handshake (ssl_namedgroupconfig). added support for rsa-pss signatures in tls 1.2 and tls 1.3 new functions in ssl.h ssl_namedgroupconfig notable changes in nss 3.27 update 2016-10-02: the maximum tls version supported has been increased to tls 1.3 (draft).
although the maximum tls version enabled by default is still tls 1.2, there are applications that query the list of tls protocol versions supported by nss, and enable all supported versions. for those applications, updating to nss 3.27 may result in tls 1.3 (draft) to be enabled. the tls 1.3 (draft) protocol can be disabled, by defining symbol nss_disable_tls_1_3 when building nss. npn can n...
NSS 3.28 release notes
get allows an application to learn the currently supported and enabled signature schemes for a socket. request to test and prepare for tls 1.3 this release contains improved support for tls 1.3, however, the code that supports tls 1.3 is still disabled by default (not built). for the future nss 3.29 release, it is planned that standard builds of nss will support the tls 1.3 protocol (
although the maximum tls protocol version enabled by default will remain at tls 1.2). we know that some applications which use nss, query nss for the supported range of ssl/tls protocols, and will enable the maximum enabled protocol version. in nss 3.29, those applications will therefore enable support for the tls 1.3 protocol. in order to prepare for this future change, we'd like to encourage all ...
NSS 3.35 release notes
n. experimental: ssl_setupantireplay - configure a tls server for 0-rtt anti-replay (tls 1.3 server only). experimental: ssl_sendsessionticket - send a session ticket (tls 1.3 server only). removed experimental apis note that experimental apis might get removed from nss without announcing removals in the release notes. this section might be incomplete. the experimental api ssl_use
altserverhellotype has been disabled. bugs fixed in nss 3.35 this bugzilla query returns all the bugs fixed in nss 3.35: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.35 compatibility nss 3.35 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss...
NSS 3.50 release notes
a bug 1604596 - update wycheproof vectors and add support for cbc, p256-ecdh, and cmac tests bug 1608493 - use aes-ni for non-gcm aes ciphers on platforms with no assembly-optimized implementation, such as macos. bug 1547639 - update zlib in nss to 1.2.11 bug 1609181 - detect arm (32-bit) cpu features on freebsd bug 1602386 - fix build on freebsd/powerpc* bug 1608151 - introduce nss_disable_
altivec bug 1612623 - depend on nspr 4.25 bug 1609673 - fix a crash when nss is compiled without libnssdbm support, but the nssdbm shared object is available anyway. this bugzilla query returns all the bugs fixed in nss 3.50: https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&product=nss&target_milestone=3.50 compatibility nss 3.50 shared ...
NSS 3.52 release notes
in nss releases. notable changes in nss 3.52 bug 1603628 - update nss to support pkcs #11 v3.0. note: this change modifies the ck_gcm_params struct to include the ulivbits field which, prior to pkcs #11 v3.0, was ambiguously defined and not included in the nss definition. if an application is recompiled with nss 3.52+, this field must be initialized to a value corresponding to ulivlen.
alternatively, defining nss_pkcs11_2_0_compat will yield the old definition. see the bug for more information. bug 1623374 - support new pkcs #11 v3.0 message interface for aes-gcm and chachapoly. bug 1612493 - integrate avx2 chacha20, poly1305, and chacha20poly1305 from hacl*. bugs fixed in nss 3.52 bug 1633498 - fix unused variable 'getauxval' error on ios compilation. bug 1630721 - ad...
NSS API Guidelines
shows that users of the security library expect arenas to be threadsafe, so we added locking, and other useful changes. there has always been confusion as to the difference between arenas and arenapools. we will simplify down to one logical 'memory bucket' type. consensus called this type nssarena. we have lots of code which takes an optional arena pointer, using the arena if there is one, or
alternatively the heap if there isn't. therefore, we wrap that logic into the allocators. knowing what to then free does takes discipline not to leak memory, but it simplifies things a lot. also, the implementation of free works (doesn't crash), no matter if from an arena, or the heap, as long as from our allocators. combined with purify, this also helps us catch cases where things being allocated by...
NSS Sample Code sample2
goto out; } /* choose mechanism: ckm_des_cbc_pad, ckm_des3_ecb, ckm_des3_cbc..... * note that some mechanisms (*_pad) imply the padding is handled for you * by nss. if you choose something else, then data padding is the * application's responsibility */ ciphermech = ckm_des_cbc_pad; slot = pk11_getbestslot(ciphermech, null); /* slot = pk11_getinternalkeyslot(); is a simpler
alternative but in * theory, it *may not* return the optimal slot for the operation. for * des ops, internal slot is typically the best slot */ if (slot == null) { fprintf(stderr, "unable to find security device (err %d)\n", pr_geterror()); goto out; } /* nss passes blobs around as secitems. these contain a pointer to * data and a length. turn the raw key into...
Notes on TLS - SSL 3.0 Intolerant Servers
s. netscape 6.x/7.x and mozilla browsers (0.9.1 and later versions) correctly implement the tls specification, and the users cannot utilize sites which have this problem. technical information the ssl 3.0 and tls (aka ssl 3.1) specs both contain a provision -- the same provision -- for detecting "version rollback attacks". 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. this feature was kind of meaningless until tls (ssl 3.1) came along because there was no version higher than 3.0 from which to be rolled back. tls is now available and used, and products that have implemented the roll-back det...
PKCS11 FAQ
associated with that card is still valid, or by waiting on the c_waitforslotevent call. what must an x.509 certificate include to allow it to be recognized as an email certificate for use with s/mime? an email address must be included in the attribute of the subject dn or the mail attribute of the subject dn. if the subject dn does not include an email address, the certificate extension subject
altname must include an email address. the subject
altname extension is part of the x.509 v3 and pkix specifications. if i have a multipurpose token that supports all required pkcs #11 functions and provides rsa_pkcs and dsa mechanisms but but not aes, des or rc4, will nss use the token for the rsa_pkcs mechanisms and the nss internal pkcs #11 module for aes, des or rc4 when making an ssl connection?
NSPR functions
eterror and pr_seterror. pr_geterror pr_seterror calendar time nss certificate verification functions take a prtime parameter that specifies the time instant at which the validity of the certificate should verified. the nspr function pr_now returns the current time in prtime. pr_now interval time the nspr socket i/o functions pr_recv and pr_send (used by the nss ssl functions) take a printerv
altime timeout parameter. printerv
altime has an abstract, platform-dependent time unit. call pr_secondstointerval or pr_millisecondstointerval to convert a time interval in seconds or milliseconds to printerv
altime. pr_secondstointerval pr_millisecondstointerval nspr i/o layering nspr file descriptors can be layered, corresponding to the layers in the network stack. the ssl library in nss implem...
NSS Key Functions
ence count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never
alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
NSS environment variables
ild_opt boolean (1 to enable) do an optimized (not debug) build. default is to do a debug build. before 3.0 moz_debug_symbols boolean (1 to enable) needed on windows to build with versions of msvc (such as vc8 and vc9) that do not understand /pdb:none 3.11 moz_debug_flags string when moz_debug_symbols is set, you may use moz_debug_flags to specify
alternative compiler flags to produce symbolic debugging information in a particular format. 3.12.8 nsdistmode string on operating systems other than windows, this controls whether copies, absolute symlinks, or relative symlinks of the output files should be published to mozilla/dist. the possible values are: copy: copies of files are published absolute_symlink:...
NSS tools : ssltab
pt connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. 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.
although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. 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 ...
NSS tools : ssltap
pt connections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. 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.
although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. 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 ...
troubleshoot.html
l in place of shmsdos, such as sh.exe, which should be distributed with the cygnus toolkit you installed to build nss. the change is unfortunately rather drastic: to trick gmake, you rename the shell program. cd c:/programs/cygnus/bin (or wherever your gnu tools are installed) cp shmsdos.exe shmsdos.bak (backup shmsdos) cp sh.exe shmsdos.exe (substitute
alternative shell) making this change will probably break other builds you are making on the same machine. you may need to switch the shell back and forthdepending on which product you are building. we will try to provide a moreconvenient solution in the future. if you have the mks toolkit installed, the <tt>sh.exe</tt> that comes with this toolkit can be used as well. ...
gtstd.html
the server db and certificate setting up the client db and certificate verifying the server and client certificates warning: the instructions below illustrate the use of nss command line tools to operate a simple root certificate authority for test purposes only. the ca, ssl server and ssl client certificates produced by these instructions work correctly for short term testing purposes.
although it is possible to use nss command line tools to operate a proper ca, these instructions do not provide nearly enough understanding of the many considerations required to competently operate a ca. the nss teams strongly recommends that users should not attempt to operate a ca for use in mission critical production business uses using nss's command line tools, nor with the simple command line ...
sslcrt.html
nce count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never
alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. getting certificate information cert_findcertbyname cert_getcertnicknames cert_freenicknames cert_getdefaultcertdb nss_findcertkeatype cert_findcertbyname finds the certificate in the certificate database with a spe...
sslkey.html
ce count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never
alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
TLS Cipher Suite Discovery
constant table enumerating all implemented ssl 2 and 3 cipher suites. */ ssl_import const pruint16 ssl_implementedciphers[]; /* number of entries in the above table. */ ssl_import const pruint16 ssl_numimplementedciphers; of course, the raw integer numbers of the cipher suites are not likely to be known to most users, so libssl provides a function by which the application can obtain a we
alth of information about any supported cipher suite, by its number. 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 informat...
NSS_3.12.3_release_notes.html
cbc_sha in sslt.h: ssl_calg_seed new structure for seed support: (see blapit.h) seedcontextstr seedcontext new functions in the nss shared library: cert_rfc1485_escapeandquote (see cert.h) cert_comparecerts (see cert.h) cert_register
alternateocspaiainfocallback (see ocsp.h) pk11_getsymkeyhandle (see pk11pqg.h) util_setforkstate (see secoid.h) nss_getalgorithmpolicy (see secoid.h) nss_setalgorithmpolicy (see secoid.h) for the 2 functions above see also (in secoidt.h): nss_use_alg_in_cert_signature nss_use_alg_in_cms_signature nss_use_alg_reserv...
NSS Tools ssltap
nections rather than stopping after the first connection is complete. -p port change the default rendezvous port (1924) to another port. 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.
although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: ssltap www.netscape.com:80 the program waits for an incomi...
NSS tools : ssltap
rt (1924) to another port. 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.
although you can run the tool at its most basic by issuing the ssltap command with no options other than hostname:port, the information you get in this way is not very useful. for example, assume your development machine is called intercept. the simplest way to use the debugging tool is to execute the following command from a command shell: $ ssltap www.netscape.com the program wait...
Necko Architecture
ng it to create the channel. the primary responsibility of protocol handlers is to create channel instances that know how to interpret the protocol that the handler registered for. however, a protocol handler implementation also might "cache" the underlying transports so channels it creates can reuse them later. the channel does the true work of protocol interpretation and data movement (if any).
although the protocol handler creates channels, protocol interpretation doesn't begin until the user initiates the transaction using the nsichannel api. receiving data & nsistreamlistener you can read or write, from or to a channel using either the synchronous api, or the asynchronous api. if you want to move data asynchronously you need to be able to receive callbacks using an implementation of n...
Proxies in Necko
iedprotocolhandler. otherwise, the proxy info is discarded. nsiprotocolproxyservice the most important function on nsiprotocolproxyservice is resolve. it checks whether the passed-in uri should use a proxy, and returns an nsiproxyinfo if so. this works by examining the protocolflags of the protocol handler for the given uri. if this protocol handler does not support proxies, resolve returns null.
alternatively, if proxies are disabled, or this host is in the list of hosts for which no proxy should be used, null is also returned. if pac (proxy autoconfiguration) is enabled, it is asked for the proxy string for the given uri, which determines whether to use a proxy. note that the proxy method is only used when the protocol handler supports http proxies, as indicated by its protocol flags. final...
Small Footprint
, but rhino will otherwise run correctly. class generation library if you do not include optimizer or javaadapter, nor do you use policysecuritycontroller then you do not need rhino library for class file generation and you can remove all the classes from in org.mozilla.classfile package. regular expressions the package org.mozilla.javascript.regexp can be removed. rhino will continue to run,
although it will not be able to execute any regular expression matches. this change saves 47,984 bytes of class files. debug information debug information in rhino classes consumes about 25% of code size and if you can live without that, you can recompile rhino to remove it. smalljs.jar ant build script in rhino supports smalljar target that will generate smalljs.jar that does not include tools, ...
Creating JavaScript tests
ser to (and more easily converted to) test262 tests. (in fact, the test262 test suite is run as part of jstests.) practical differences between the two test suites: jstest new jstest files should be put the code in the appropriate subdirectory of js/src/tests/non262/, or, under some scenarios, contributed directly to the test262 repository. jstests run in both the shell and the browser (
although you can specify that the test should be run in only one of the two locations). jstests automatically load js/src/tests/shell.js before they run, which creates a ton of functions. read more advice on jstests here. jit-test new jit-test files should be put in js/src/jit-test/tests/basic or one of the other appropriate subdirectories of jit-test/tests. jit-tests run only in the shell. ...
GCIntegration - SpiderMonkey Redirect 1
are not needed in common areas of firefox: if a pointer is never changed after it's initialized, then there's no need for a write barrier. initializing a pointer never requires a write barrier because there was nothing being destroyed that might have part of the initial snapshot. if a pointer is not traced via js_call_tracer or any similar mechanism, then there's no need for a write barrier (
although see below about read barriers). the initial snapshot only contains objects reachable via traced pointers, so there's no danger that overwriting an untraced pointer will disrupt the snapshot. some pointers are guaranteed to be marked in the first slice of the gc. therefore, it's not possible for code to modify them between when the initial snapshot is taken and when the pointer is marked, so...
Tracing JIT
been recorded under the opposite assumption as the guard was checking. for example, when recording any conditional branch in the spidermonkey bytecode, a guard will be incorported into the trace that checks the branch is taken the same way during execution as it was during recording. if this guard fails once, the trace will exit. if it fails enough times to become hot, the monitor will record an
alternative sub-trace beginning at the guard and patch the code into the existing guard. thereafter, when the guard fails it will jump to the specialized sub-trace. the term bail denotes "exiting a trace due to to a failed guard". when a guard bails, it means that there is no logic in the trace to handle the failed guard, and so the exit condition encodes the state of the interpreter before the guar...
Introduction to the JavaScript shell
first line of the file is "/usr/bin/env js -p", then the file content will be interpreted by the javascript engine. this enables you to make a javascript file executable on unix and os x machines. -s enables strict warning mode. -w, --warnings enables warning messages. -w, --nowarnings disables warning messages. environment options there are some environment variables that can be set to
alter js shell behavior. js_stdout=file redirect stdout to file. js_stderr=file redirect stderr to file. built-in functions to make the javascript shell more useful, there are a number of built-in functions provided that you can use either from javascript programs or in interactive mode. note: this list is incomplete and overlaps with shell global objects. see js/src/shell/js.cpp (around s...
JSAPI Cookbook
y is an object (that is, not a boolean, number, string, null, or undefined), this is fairly straightforward. use jsval_to_object to cast y to type jsobject *. /* jsapi */ js::rootedvalue x(cx); assert(y.isobject()); js::rootedobject yobj(cx, &y.toobject()); if (!js_getproperty(cx, yobj, "myprop", &x)) return false; that code will crash if y is not an object. that's often unacceptable. an
alternative would be to simulate the behavior of the javascript . notation exactly. it's a nice thought—javascript wouldn't crash, at least—but implementing its exact behavior turns out to be quite complicated, and most of the work is not particularly helpful. usually it is best to check for !y.isobject() and throw an error with a nice message. /* jsapi */ js::rootedvalue x(cx); if (!y.isobjec...
BOOLEAN_TO_JSVAL
try to avoid using it. cast a c integer to a boolean js::value without any type checking or error handling. please use js::booleanvalue/js::truevalue/js::falsevalue instead in spidermonkey 45 or later. syntax jsval boolean_to_jsval(bool b); name type description b bool c integer value to be converted to a boolean jsval. description boolean_to_jsval converts a bool argument, b, to a boolean jsval. if b is false, the result is jsval_false. if b is true, the result is jsval_true. ...
DOUBLE_TO_JSVAL
try to avoid using it. casts a pointer to a gc-allocated jsdouble to type jsval. please use js::doublevalue instead in spidermonkey 45 or later. syntax jsval double_to_jsval(double d); name type description d double c double to convert to a jsval. description double_to_jsval is the inverse of js::tonumber. to convert a c float, double to type js::value, use js_numbervalue instead. ...
INT_FITS_IN_JSVAL
try to avoid using it. determines if a specified c integer is safe to pass to int_to_jsval. syntax #define int_fits_in_jsval(i) /* ... */ name type description i jsint the c integer value to check. description determines if a specified c integer value, i, lies within the range allowed for integer jsvals. if so, int_fits_in_jsval returns true, and i can be cast to jsval by calling int_to_jsval(i). otherwise, int_fits_in_jsval returns false. in this case, the application can still convert i to a jsval using js_newnumbervalue. ...
INT_TO_JSVAL
try to avoid using it. converts a specified integer value to a js integer value. please use js::int32value instead in spidermonkey 45 or later. syntax jsval int_to_jsval(int32_t i); name type description i any integer type c integer to convert to a jsval. description int_to_jsval converts a c integer, i, to a jsval. before spidermonkey 1.8.5, not all integers can be stored in a jsval; use int_fits_in_jsval to test. ...
JS::Add*Root
try to avoid using it. this article covers features introduced in spidermonkey 31 register a variable as a member of the garbage collector's root set, to protect anything the root points at from garbage collection. these functions are obsoleted, use js::persistentrooted instead. ...
JS_ValueToString
try to avoid using it. convert a jsval to a jsstring. syntax jsstring * js_valuetostring(jscontext *cx, jsval v); name type description cx jscontext * the context in which to perform the conversion. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v jsval the value to convert. description js_valuetostring converts a specified javascript value, v, to a string. it implements the tostring operator specified in ecma 262-3 §9.8. the result is like the javascript expression ""+v. ...
JS_YieldRequest
try to avoid using it. momentarily suspend the current jsapi request, allowing garbage collection to run if another thread has requested it. syntax void js_yieldrequest(jscontext *cx); name type description cx jscontext * the jscontext that is currently in a request on the calling thread. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. description for more information about thread safety and requests, see js_threadsafe. js_yieldrequest momentarily suspends the current request. ...
OBJECT_TO_JSVAL
try to avoid using it. casts a specified js object to a js value. please use js::objectvalue/js::objectornullvalue instead in spidermonkey 45 or later. syntax jsval object_to_jsval(jsobject *obj); name type description obj jsobject * a pointer to a javascript object to convert to a jsval. description object_to_jsval casts obj from type jsobject * to jsval. if obj is null, the result is jsval_null. ...
PRIVATE_TO_JSVAL
try to avoid using it. cast raw void * pointers to type jsval and vice versa. please use js::privatevalue instead in spidermonkey 45 or later. syntax jsval private_to_jsval(void *ptr); void * jsval_to_private(jsval v); // obsoleted since jsapi 32 description with private_to_jsval(), an application can store a private data pointer, p, as a jsval. this can be useful with reserved slots. the private data pointer can point to application-defined memory of any type, but the pointer must be two-byte-aligned (that is, (int) p must be even). ...
STRING_TO_JSVAL
try to avoid using it. casts a specified js string to a js value. please use js::stringvalue instead in spidermonkey 45 or later. syntax jsval string_to_jsval(jsstring *str) name type description obj jsstring * a pointer to a js string to convert to a jsval. description string_to_jsval casts a given jsstring * to jsval. str must be a non-null pointer of type jsstring *. the conversion always succeeds. ...
jschar
try to avoid using it. jschar is the type of javascript "characters", the 16-bit elements that make up strings. jschar, a typedef for the standard c++ type char16_t, will be removed in jsapi 38. functions that use jschar will use char16_t directly. embedder code should use char16_t, too. (see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values. a string may contain unmatched surrogates, which are not valid utf-16. it may also contain zeroes ('\0'). ...
jsint
try to avoid using it. aliases for c/c++ integer types. syntax typedef ... jsint; typedef ... jsuint; typedef ... jsword; typedef ... jsuword; typedef ... intn; typedef ... uintn; // following types are still provides in js/public/legacyinttypes.h, // but should not use them. typedef ... int8; typedef ... uint8; typedef ... int16; typedef ... uint16; typedef ... int32; typedef ... uint32; typedef ... int64; typedef ... uint64; description jsint and jsuint are 32-bit integer types. jsword and jsuword are pointer-sized integer types. ...
SpiderMonkey 1.8.5
sues mac os x 10.5 (leopard) and xcode 3.2 spidermonkey will not build with certain builds of apple's gcc 4.2 c++ compiler. to check what version you are running, issue the command /usr/bin/g++-4.2 -v from a terminal window. the following builds are known to not work: i686-apple-darwin9-g++-4.2.1 (gcc) 4.2.1 (apple inc. build 5574) to work around this issue, either upgrade your xcode or use an
alternate version of gcc, such as the one that shipped with leopard. to select an
alternate c++ compiler, invoke configure thus: cxx=/usr/bin/g++-4.0 /path/configure --my-configuration-options js-config the new configure-based build system does not correctly generate the js-config script on many platforms, nor when js-ctypes are enabled. if you are building your project with a gnu-make based build sy...
SpiderMonkey 1.8.7
sues mac os x 10.5 (leopard) and xcode 3.2 spidermonkey will not build with certain builds of apple's gcc 4.2 c++ compiler. to check what version you are running, issue the command /usr/bin/g++-4.2 -v from a terminal window. the following builds are known to not work: i686-apple-darwin9-g++-4.2.1 (gcc) 4.2.1 (apple inc. build 5574) to work around this issue, either upgrade your xcode or use an
alternate version of gcc, such as the one that shipped with leopard. to select an
alternate c++ compiler, invoke configure thus: cxx=/usr/bin/g++-4.0 /path/configure --my-configuration-options js-config the new configure-based build system does not correctly generate the js-config script on many platforms, nor when js-ctypes are enabled. if you are building your project with a gnu-make based build s...
SpiderMonkey 1.8.8
a list of the most significant changes. a significant number of typedefs of built-in types, or of types which are now standardized, have been removed. these and other changes are explained in detail below. new javascript language features javascript 1.8.8 includes significant updates to language features, yo. typedef changes many types have been removed from the jsapi and replaced with simpler
alternatives. including jsapi.h provides all these types, but more-specific headers also provide these types if you wish to use them in other code. obsolete typedef replacement type provided by uint8, int8, uint16, int16, uint32, int32, uint64, int64 uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t mozilla/stdint.h uintn, in...
SpiderMonkey 1.8
of apis (js_getsecuritycallbacks and friends, bug 451729). js.mak, an old windows-specific nmake file, has been deleted. it hasn't worked for a long time. it is fairly easy to create a microsoft visual studio project file for spidermonkey 1.8 from scratch. (if you would like to contribute and maintain a project file, please feel free to contact the spidermonkey team via email, bugzilla, or irc.)
alternatively, you can install mozillabuild and run the command make -f makefile.ref in the js/src directory. spidermonkey 1.8 does not include the new tracemonkey jit or the configure-based build system, both of which are (a) pretty darn awesome and (b) coming in spidermonkey 1.8.1. on to the fun stuff. new javascript language features javascript 1.8 adds array.reduce() and reduceright(), expre...
SpiderMonkey 17
is a list of the most significant changes. a significant number of typedefs of built-in types, or of types which are now standardized, have been removed. these and other changes are explained in detail below. new javascript language features javascript 17 includes significant updates to language features, yo. typedef changes many types have been removed from the jsapi and replaced with simpler
alternatives. including jsapi.h provides all these types, but more-specific headers also provide these types if you wish to use them in other code. obsolete typedef replacement type provided by uint8, int8, uint16, int16, uint32, int32, uint64, int64 uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t mozilla/stdint.h uintn, in...
SpiderMonkey 24
. the following features in earlier versions of spidermonkey have been dropped. e4x, an extension to ecmascript adding xml support, has been removed. the extension eventually became an evolutionary dead end, as tc39 chose not to incorporate it into ecmascript proper. it is recommended that you embed a separate xml parser, or include an xml parsing implementation written in javascript, as an
alternative. jaegermonkey has been removed and replaced by ionmonkey spidermonkey 24 is not binary-compatible with previous releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c...
Shell global objects
r v is null, don't attribute the source to any dom element. elementattributename if present and not undefined, the name of property of element that holds this code. this is what debugger.source.prototype.elementattributename returns. sourcemapurl if present with value v, convert v to a string, and provide that as the code's source map url. if omitted, attach no source map url to the code (
although the code may provide one itself, via a //#sourcemappingurl comment). sourceislazy if present and true, indicates that, after compilation, script source should not be cached by the js engine and should be lazily loaded from the embedding as-needed. loadbytecode if true, and if the source is a cacheentryobject, the bytecode would be loaded and decoded from the cache entry instead of be...
TPS Tests
erwise authentication will fail (and the whole test will fail as well. you can sign up for an fxa account on stage or dev by creating an fxa account after adding the identity.fxaccounts.autoconfig.uri preference (with the appropriate value) to about:config. additionally, note that the config file must parse as valid json, and so you can't have comments in it (sorry, i know this is annoying). one
alternative is to put underscores before the "disabled" preferences, e.g. "_identity.fxaccounts.autoconfig.uri": "...". writing tps tests each tps test is run as a series of "phases". a phase runs in some firefox profile, and contains some set of actions to perform or check on that profile. phases have an n to m relationship with profiles, where n >= m (there can never be more phases than profiles)...
WebReplayRoadmap
stem and yet have different types in practice. a recording can be analyzed for the types that appear in practice. these can be compared with the types provided to the type system, and any mismatches can be flagged. the points in the recording where the mismatches occur can be identified, and the debugger can seek to those points to allow further investigation of the causes of the mismatch. an
alternate use of the types that appear in practice would be to provide seed information for automatically populating the types in an app that is being converted to use flow or typescript. type profiling (not yet implemented) the types that appear in practice have a large effect on how well the associated code can be optimized by jits. while different jits optimize code in different ways, for peak ...
Redis Tips
mmands. mutex locks in the case where you need a mutex, here's a recipe for using the atomic getset and setnx to orchestrate locking: https://redis.io/commands/setnx (scroll down). i have used this recipe in production. bit strings bit strings are just that: compact representations of ones and zeroes. i haven't yet used bitstrings in production myself. i recommend reading this article on re
altime metrics with bitstrings: https://blog.getspool.com/2011/11/29/fast-easy-re
altime-metrics-using-redis-bitmaps/. extra data in zsets the score for a zset value is a float. you can be clever and sneak extra data in by encoding something else after the decimal. this adds processing time and complexity for your application, but could save you space in redis for large data sets. so the score wo...
Animated PNG graphics
vlov@pavlov.net> vladimir vukicevic <vladimir@pobox.com> andrew smith <asmith15@littlesvr.ca> overview apng is an extension of the portable network graphics (png) format, adding support for animated images. it is intended to be a replacement for simple animated images that have traditionally used the gif format, while adding support for 24-bit images and 8-bit transparency. apng is a simpler
alternative to mng, providing a spec suitable for the most common usage of animated images on the internet. apng is backwards-compatible with png; any png decoder should be able to ignore the apng-specific chunks and display a single image. terminology the default image is the image described by the standard 'idat' chunks, and is the image that is displayed by decoders that do not support apng. t...
Gecko events
focus. is supported: yes event_state_change an object's state has changed. is supported: yes states: state_focused, state_busy, xxx: event_location_change an object has changed location, shape, or size. is supported: no event_name_change an object's name property has changed. is supported: yes targets: table_cell - the cell of <xul:tree/>, any accessible for html element when @title or @
alt attribute is changed. event_description_change an object's description property has changed. is supported: no event_value_change an object's value property has changed. is supported: yes event_help_change an object's help has changed. is supported: no event_defaction_change an object's default action has changed. is supported: no event_action_change an object's action has changed. is su...
XForms Accessibility
nk" build of firefox and install the xforms extension which lives in 'xpi' directory of the build. note, xforms accessibility is implemented only on trunk. trunk builds are not considered stable and should not be installed on top of the firefox used for daily browsing. currently we have verified that xforms accessibility is working on the windows platform, and linux testing has not yet been done,
although everything should work and is ready to be tested. you will find trunk builds of firefox at ftp.mozilla.org, trunk builds of xforms extension (windows) at ftp.mozilla.org or trunk builds of xforms extension (linux) ftp.mozilla.org. build it yourself if you would like to build firefox/seamonkey yourself then please ensure your .mozconfig file has the following option: ac_add_options --ena...
Feed content access API
} the handleresult() function receives as its argument an nsifeedresult that describes a feed; its doc property is an nsifeed that contains all the feed data. to get the title of the feed, you look at the feed.title property. the title is an nsifeedtextconstruct that can represent the text in various formats; we get its text property to fetch the feed's title as html-encoded text. we could,
alternatively, use its plaintext() method to get a copy of the title translated into plain text. we then scan the array of items in the feed by looking at the feed.items nsiarray. this array contains nsifeedentry objects that describe each feed item. we build the contents of the document by looking at the title, link, summary, and content properties for each item. the full url of the link is retrieve...
Mork
exists four: dictionaries, tables, rows, and groups (changesets). dictionaries, tables, and rows all have corresponding metastructures. meta-dictionaries are in practice only used to change the scope of alias definitions (the '(a=c)' that you can see in files). meta-tables are used to establish some facts about the table as well as the default row scope. meta-rows do not appear to be used at all,
although the parser seems to consider setting the charset, row scope, and atom scope. some notes on further terminology: when referring to cells or aliases, the first component is the key and the second component is the value. expanding refers to taking a '^' hex buffer and replacing it with the alias value for the hex key (explained below). a mid has two components: the id itself, to the left of t...
Places utilities for JavaScript
true to make query items expand as new containers. for managing,you want this to be false, for menus and such, you want this to be true. return type returns a nsinavhistoryresult containing the contents of the folder. the result.root is guaranteed to be open. bookmark dialog methods to show the bookmarkproperties dialog in its various modes. the showminimaladd methods open the dialog by its
alternative uri. thus they persist the dialog dimensions separately from the showadd methods. note these variants also do not return the dialog "performed" state since they may not open the dialog modally. showaddbookmarkui() shows the "add bookmark" dialog. showaddbookmarkui(auri, atitle, adescription, adefaultinsertionpoint, ...
FUEL
("steel") and in seamonkey ("smile"). objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage fueliapplication objects fueliannotations fueliapplication fuelibookmark fuelibookmarkfolder fuelibookmarkroots fuelibrowsertab fueliwindow xpcom
although the fuel application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); ...
SMILE
extiapplication. the library has also been implemented in firefox ("fuel") and in thunderbird ("steel"). objects extiapplication objects exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage smileiapplication objects smileibookmarkroots smileiwindow smileibrowsertab smileiapplication xpcom
although the extiapplication object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/smile/application;1"].getservice(components.interfaces.smileiapplication); ...
STEEL
that implements all the functions of extiapplication. the library has also been implemented in firefox ("fuel") and in seamonkey ("smile"). objects extiapplication objects extiapplication exticonsole extieventitem extieventlistener extievents extiextension extiextensions extipreference extipreferencebranch extisessionstorage steeliapplication objects steeliapplication xpcom
although the steel steeliapplication object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/steel/application;1"].getservice(components.interfaces.steeliapplication); other resources steel development plan. bug 408370 bug 1278067 ...
extIApplication
ting whether the shutdown was successful. restart() attempts to restart the application. it is possible for the restart to be canceled. boolean restart() return value boolean value indicating whether the restart was successful. getextensions(acallback) calls acallback with the list of installed extensions. void getextensions(extiextensionscallback acallback) return value none. xpcom
although the application object is preloaded into xul scripts, it is not preloaded into javascript xpcom code. the object needs to be accessed like any other xpcom service: var application = components.classes["@mozilla.org/fuel/application;1"].getservice(components.interfaces.fueliapplication); see also fuel (firefox), steel (thunderbird) and smile (seamonkey) ...
Aggregating the In-Memory Datasource
methods ns_imethod init(const char* auri) { return minner->init(auri); } ns_imethod geturi(char* *auri) { return minner->geturi(auri); } // etc., for each method in nsirdfdatasource! }; very painful, prone to errors, and fragile as the interfaces are still in flux (a wee bit). aggregation to the rescue! here are the gory details on how. when it won't work
although this magic is terribly convenient to use, it won't work in the case that you want to "override" some of the in-memory datasource's methods. for example, while writing the bookmarks datasource, i wanted to be able to trap assert() to enforce the bookmarks datasource would only accept "bookmarks related" assertions. if i'd just delegated to the in-memory datasource, assert() would've taken any...
Avoiding leaks in JavaScript XPCOM components
quite a lot has happened since this article was written. e. g. in firefox 3, a cycle collector was introduced and refined in later versions, and mozilla is currently working on a generational garbage collector for js. this article needs to be updated to reflect the changes and the cases where they help. take every information on this site with a grain of s
alt,
although most concepts and best practices still apply. using xpcom in javascript (also known as xpconnect) is an environment where memory management issues are not obvious. there are no calls to malloc and free and no reference counting. despite this, it's easy to write javascript code that leaks. it's easy to write leaky code in any garbage-collected language. but it's even easier in this environment because some of the objects ...
Component Internals
nd tools this is the glue library. it provides a bridge, or "glue" layer, between your component and xpcom. a version of the glue library is built into xpcom, and when your component uses it, it links a snapshot of this library: it includes a copy of these unfrozen classes directly, which allows the xpcom library version to change without affecting the software. there is a slight footprint pen
alty to linking directly, but this gives your component freedom to work in any recent environment. if footprint is a big issue in your component or application, you can trim out the pieces you don't need. xpcom string classes the base string types that xpcom uses are nsastring and nsacstring. these classes are described in the mozilla string guide (see gecko resources). the string classes that imp...
Creating the Component Code
ozilla or netscape client, you copy your component into the components directory in the client's installation folder. when it is copied there, run regxpcom from the command line to register that component and all the others in that directory. several new options have been added to regxpcom in versions 1.4 and later. you can run regxpcom with the -h option to see full usage options. registration
alternatives a gecko embedding application may provide other ways to register xpcom components. xpinstall, the cross-platform installation technology that mozilla uses to install the browser and other components, is one such
alternative. it is described further in packaging weblock. you should consult with the authors of the application you wish to extend to see if there are other supported ways. o...
Finishing the Component
th an earlier version and vice versa. similar problems occurred with gcc 4.0, which underwent similar abi changes. before attempting to use unfrozen interfaces, you should contact the developers who are responsible for the code you're trying to use (i.e., module owners) and ask them how best to do what you are trying to do. be as precise you possibly can. they may be able to suggest a supported
alternative, or they may be able to notify you about pending changes. the interface that we need for this project is something called nsicontentpolicy. at the time this book was written, this interface was under review. an interface reaches this state when a group of module owners and peers are actively engaged in discussion about how best to expose it. usually there are only minor changes to interf...
Using XPCOM Components
plemented by these components is still ongoing. the component viewer does not distinguish between components that are frozen and those that are not. in the source code you view in mxr, interfaces that have been frozen are marked at the top with @status frozen. the xpcom component viewer the xpcom component viewer is an add-on you can install in your browser (in sandbox, not available for now).
alternatively, you can try xpcomviewer, a similar add-on. xpcom component viewer the left column shows the components - in this case a subset returned from a search on "gfx" as part of the contract id and the right column a list of the interfaces. when you open a component on the left, you can see the interfaces it implements along with a list of the methods provided by each interface. the xpcom...
Using XPCOM Utilities to Make Things Easier
ult in a crash. instead, to explicitly release the object being held by a nscomptr, you can assign zero to that pointer. another nice feature of smart pointers - the part that makes them smart - is that you can queryinterface them quite easily. for example, there are two interfaces for representing a file on a file system, the nsifile and nsilocalfile, and they are both implemented by an object.
although we haven't formally introduced these two interfaces, the next code sample shows how simple it is to switch between these two interfaces: someclass::dosomething(nsifile* afile) { if (!afile) return ns_error_null_pointer; nsresult rv; nscomptr<nsilocalfile> localfile = do_queryinterface(afile, &rv); // ... } if the queryinterface is successful, localfile will be non-null, and r...
Creating XPCOM components
onent internals creating components in cpp xpcom initialization xpcom registry manifests registration methods in xpcom autoregistration the shutdown process three parts of a xpcom component library xpcom glue the glue library xpcom string classes creating the component code what we'll be working on component registration the regxpcom program registration
alternatives overview of the weblock module source digging in: required includes and constants identifiers in xpcom coding for the registration process the registration methods creating an instance of your component weblock1.cpp using xpcom utilities to make things easier xpcom macros generic xpcom module macros common implementation macros declaration macros w...
Mozilla internal string guide
ring classes are derivatives of the nsstring/nscstring classes. they own a 64-character buffer allocated in the same storage space as the string itself. if the nsautostring is allocated on the stack, then it has at its disposal a 64-character stack buffer. this allows the implementation to avoid allocating extra memory when dealing with small strings. nsautostringn/nsautocstringn are more general
alternatives that let you choose the number of characters in the inline buffer. ... nsautostring value; getvalue(value); // if the result is less than 64 code units, // then this just saved us an allocation ... member variables in general, you should use the concrete classes nsstring and nscstring for member variables. class foo { ... // these store utf-8 and utf-16 valu...
mozilla::services namespace
to use it, you first need to include the header into your c++ file: #include "mozilla/services.h" then you can obtain references to services by simply accessing them from the mozilla::services namespace. ...
XPCOM guide
mozilla platform to run tasks on another thread.mozilla internal string guidemost of the mozilla code uses a c++ class hierarchy to pass string data, rather than using raw pointers. this guide documents the string classes which are visible to code within the mozilla codebase (code which is linked into libxul). ...
Language bindings
uleprecisegcthis method lets scripts schedule a garbage collection cycle. the garbage collection cycle will occur sometime in the future, when no javascript code is executing. this is useful particularly when testing for memory leaks, because normal garbage collection is conservative when javascript code is running to ensure that in-use memory isn't inadvertently collected.components.utils.setgcze
althis method lets scripts set the zeal level for garbage collection. you can get details on what this method does in js_setgczeal. this method calls through to that thusly:components.utils.unloadcomponents.utils.unload was introduced in firefox 7 and is used to unload javascript code modules. this can be particularly handy with restartless (boostrapped) extensions, so that you can unload an old vers...
NS_InitXPCOM2
ary the ns_initxpcom2 function initiates use of xpcom in the calling process. #include "nsxpcom.h" nsresult ns_initxpcom2( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider ); parameters aresult [out] the resulting xpcom service manager. you may pass null if you are not interested in this return value. the service manager may
alternatively be accessed by calling ns_getservicemanager. the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom. abindirectory [in] the directory containing the component registry and runtime libraries. pass null to specify that the current working directory should be used. aappfi...
NS_InitXPCOM3
es. #include "nsxpcom.h" nsresult ns_initxpcom3( nsiservicemanager** aresult, nsifile* abindirectory, nsidirectoryserviceprovider* aappfilelocationprovider, nsstaticmoduleinfo const* astaticmodules, pruint32 astaticmodulecount ); parameters aresult [out] the resulting xpcom service manager. you may pass null if you are not interested in this return value. the service manager may
alternatively be accessed by calling ns_getservicemanager. the resulting interface pointer is addref'd upon return and must either be release'd explicitly or passed to ns_shutdownxpcom when the application is finished with xpcom. abindirectory [in] the directory containing the component registry and runtime libraries. pass null to specify that the current working directory should be used. aappfi...
IAccessibleAction
are to be used when the object has focus, they are like mnemonics (access keys), and not like shortcut (accelerator) keys. there is no need to implement this method for single action controls since that would be redundant with the standard msaa programming practice of getting the mnemonic from get_acckeyboardshortcut. an at such as an on screen keyboard might not expose these bindings but provide
alternative means of activation. [propget] hresult keybinding( [in] long actionindex, [in] long nmaxbindings, [out, size_is(,nmaxbindings), length_is(, nbindings)] bstr keybindings, [out] long nbindings ); parameters actionindex 0 based index specifying which action's key bindings should be returned. nmaxbindings this parameter is ignored. refer to @ref _arrayconsideration "special consider...
IAccessibleHyperlink
target( [in] long index, [out] variant anchortarget ); parameters index a 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. the valid maximal index is indicated by iaccessibleaction.nactions(). anchortarget this is an implementation dependent value. for example this method could return a bstr variant of the uri.
alternatively this method could return an iunknown variant of a com interface representing a target object to be activated when the link is activated. see the section about. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. endindex() [propget] hresult endindex( [out] long index ); parameters index the 0 based cha...
IAccessibleText
f one past the last selected character. return value e_invalidarg if bad [in] passed, [out] values are 0s. s_false if there is nothing to return, [out] values are 0s. s_ok. setcaretoffset() sets the position of the caret. 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. setting the caret position may or may not
alter the current selection(). a change of the selection() is notified to the accessibility event listeners with an ::ia2_event_text_selection_changed event. when the new caret position differs from the old one (which, of course, is the standard case) this is notified to the accessibility event listeners with an ::ia2_event_text_caret_moved event. hresult setcaretoffset( [in] long offset ); parame...
imgICache
any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter). method overview void clearcache(in boolean chro...
imgIEncoder
t height in pixels. inputformat one of input_format_* constants specifying the format of data. outputoptions semicolon-delimited list of name=value pairs that can give options to the output encoder. options are encoder-specific. just give an empty string for default behavior. remarks for encoding images which may contain multiple frames, the 1-shot initfromdata() interface is too simplistic. the
alternative is to use startimageencode(), call addimageframe() one or more times, and then finish initialization with endimageencode(). ...
jsdIStackFrame
d/idl/jsdidebuggerservice.idlscriptable please add a summary to this article. inherits from: jsdiephemeral last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) strict mode is on. warnings reported as errors. makes eval() use the last object on its 'obj' param's scope chain as the ecma 'variables object'. private data for this object is an nsisupports object. attempting to
alter this bit will result in an ns_error_illegal_value. opt_* values above, or'd together. last version set on this context. scripts typically select this with the "language" attribute. see the version_* consts on jsdidebuggerservice. unique tag among all valid jsdicontext objects, useful as a hash key. private data for this context, if it is an nsisupports, |null| otherwise. retrieve the underlying...
mozIAsyncFavicons
scriptable interface for accessing the favicon service asynchronously. 1.0 66 introduced gecko 6.0 inherits from: nsisupports last changed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) nsifaviconservice handles this interface, so you do not need to directly create a new service. simply queryinterface() the nsifaviconservice to this interface. as an
alternative, you can just use placesutils.favicons from javascript. method overview void getfaviconurlforpage(in nsiuri apageuri, in nsifavicondatacallback acallback); void getfavicondataforpage(in nsiuri apageuri, in nsifavicondatacallback acallback); void setandfetchfaviconforpage(in nsiuri apageuri, in nsiuri afaviconuri, in boolean aforcereload, in ...
GroupPosition
lectons of non-text objects. void groupposition( out long agrouplevel, out long asimilaritemsingroup, out long apositioningroup ); parameters agrouplevel 1-based, similar to aria aria-level property asimilaritemsingroup 1-based, similar to aria aria-setsize property, inclusive of the current item. apositioningroup 1-based, similar to aria aria-posinset property. remark
alternatively this information is exposed by nsiaccessible.attribute attribute, also see group attributes page. refer to accessible web specifications to get an idea what elements expose group information. ...
KeyboardShortcut
« nsiaccessible page summary provides localized string of accesskey name, such as
alt+d (
alt + d). the modifier may be affected by user and platform preferences. usually
alt+letter (
alt + letter), or just the letter alone for menu items. attribute astring keyboardshortcut; see also nsiaccessible.defaultkeybinding nsiaccessible.getkeybindings() ...
TakeFocus
« nsiaccessible page summary this method focuses this accessible node. void takefocus(); remarks the state state_focusable indicates whether this node is normally focusable. it is the callers responsibility to determine whether this node is focusable.acctakefocus on a node that is not normally focusable (such as a table), will still set focus on that node,
although normally that will not be visually indicated in most style sheets. see also nsiaccessible.focusedchild ...
nsIAccessible
me -- the main text equivalent for this node. value accessible value -- a number or a secondary text equivalent for this node. widgets that use role attribute can force a value using the valuenow attribute. description accessible description -- long text associated with this node. keyboardshortcut provides localized string of accesskey name, such as
alt+d. the modifier may be affected by user and platform preferences. usually
alt+letter, or just the letter alone for menu items. defaultkeybinding provides localized string of global keyboard accelerator for default action, such as ctrl+o for open file. role enumerated accessible role for the associated element. help help text associated with node. ...
nsIAccessibleDocument
e we need an accessible for. acancreate if true, this method can create a new accessible. otherwise, it will return the first cached accessible in the parent chain. return value the first nsiaccessible found by crawling up the dom node to the document root. native code only!getcachedaccessnode obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the access node cached by this document. nsiaccessnode getcachedaccessnode( in voidptr auniqueid ); parameters auniqueid the unique id used to cache the node. this matches up with the uniqueid attribute on nsiaccessnode. return value the nsiaccessnode ...
nsIAccessibleText
boundary constants constant value description boundary_char 0 boundary_word_start 1 boundary_word_end 2 boundary_sentence_start 3 do not use in new code. boundary_sentence_end 4 do not use in new code. boundary_line_start 5 boundary_line_end 6 boundary_attribute_range 7 coordinate type constants obsolete since gecko 1.9 (firefox 3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. constant value description coord_type_screen 0 coord_type_window 1 methods addselection() void addselection( in long startoffset, in long endoffset ); parameters startoffset endoffset getattributerange() obsolete since gecko 1.9.1 (f...
nsIAccessibleTreeCache
try to avoid using it. a private interface to operate with tree accessible. accessible/public/nsiaccessibletreecache.idlnot scriptable please add a summary to this article. ...
nsICacheService
r or not the data being cached can be represented as a stream. the storagepolicy must be consistent with the value of this field. for example, a non-stream-based cache entry can only have a storage policy of store_in_memory. return value returns a new cache session. createtemporaryclientid() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this method creates and returns a unique, temporary cache client id. this is used by the offline cache. the offline cache lets clients accumulate entries in a temporary client and merge them in as a group using nsiofflinecachesession.mergetemporaryclient(). acstring cre...
nsIContentPrefService
ring aname); void setpref(in nsivariant agroup, in astring aname, in nsivariant avalue); attributes attribute type description dbconnection mozistorageconnection the database connection to the content preferences database. useful for accessing and manipulating preferences in ways that are caller-specific or for which there is not yet a generic method,
although generic functionality useful to multiple callers should generally be added to this unfrozen interface. also useful for testing the database creation and migration code. read only. grouper nsicontenturigrouper the component that the service uses to determine the groups to which uris belong. by default, this is the "hostname grouper," which groups uris by full hostname (in other...
nsIControllers
ument/public/nsicontrollers.idlscriptable represents a list of nsicontroller elements. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is used to manage instances of the nsicontroller interface. windows and text inputs have default controllers that allow commands such as cmd_copy to act on the focused element or window. xul elements can also have controllers,
although they do not have any default controllers. implemented by: @mozilla.org/xul/xul-controllers;1. you should not normally need to create an instance, as you normally need to
alter the window or element's existing list of controllers. to create an instance, use: var controllers = components.classes["@mozilla.org/xul/xul-controllers;1"] .createinstance(components.interf...
nsICookieStorage
try to avoid using it. this interface represents the storage repository for cookies. modules/plugin/base/public/nsicookiestorage.idlnot scriptable please add a summary to this article. ...
nsIDBChangeListener
omponents.interfaces.nsisupports)) throw components.results.ns_error_no_interface; return this; } }; and to attach it in thunderbird, we must call addlistener on a nsidbchangeannouncer, typically through a nsimsgdatabase. ...
nsIDOMGeoPositionCoords
coords.idlscriptable please add a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports attributes attribute type description latitude double the user's current latitude, in degrees. read only. longitude double the user's current longitude, in degrees. read only.
altitude double the user's current
altitude, in meters. zero if the device doesn't support
altitude detection. read only. accuracy double the accuracy of position information, in meters. read only.
altitudeaccuracy double the accuracy of
altitude information, in meters. zero if the device doesn't support
altitude detection. read only. heading double ...
nsIDOMGlobalPropertyInitializer
es that lets them know about the window they're being attached to. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) an xpcom component implementing this interface can be exposed to web content as a property on the window. see custom window properties are a snap in firefox blog post for details. an
alternative way to expose an object to the web content is to add the property in response to the content-document-global-created notification. method overview jsval init(in nsidomwindow window); methods init() jsval init( in nsidomwindow window ); parameters window the window to which the global property is being attached. return value the initialized global property. ensu...
nsIDOMStorageEventObsolete
try to avoid using it. dom/interfaces/storage/nsidomstorageeventobsolete.idlscriptable this interface represents an event that occurs to notify interested parties about changes to the contents of a dom storage space; it is used for both session storage and local storage. ...
nsIDebug
xpcom/base/nsidebug.idlscriptable provides debugging support for scripted languages, such as javascript, java, python, perl, and so forth. inherits from: nsisupports last changed in gecko 1.7 note: c/c++ consumers who are planning to use the nsidebug interface with the @mozilla.org/xpcom;1 contract should use ns_debugbreak() from xpcom glue instead, or
alternatively the ns_abort, ns_assertion, ns_break, and ns_warning macros, which also call ns_debugbreak() if used in a debugging build. method overview void abort(in string afile, in long aline); void assertion(in string astr, in string aexpr, in string afile, in long aline); void break(in string afile, in long aline); void warning(in string astr, in string afile, in long aline); methods abort() requests the process...
getFile
he performance of directory lookups. if false, then the directory service will not cache the results of this method. symbolic names the list of symbolic names is subject to change, so be sure to take a look at the xpcom/io/nsdirectoryservicedefs.h file for the version of gecko you're working with for the latest list. available on all platforms these symbolic names are available on all platforms (
although, of course, they may refer to different physical paths on the storage device). c constant string value notes ns_os_home_dir "home" ns_os_temp_dir "tmpd" ns_os_current_working_dir "curworkd" ns_os_desktop_dir "desk" otherwise same as home ns_os_current_process_dir "curprocd" ns_xpcom...
nsIDocShell
shells that they are about to be hidden. if isunload is true, then the document is being unloaded as well. void firepagehidenotification( in boolean isunload ); parameters isunload if true, fire the unload event in addition to the pagehide event. native code only!fireunloadnotification obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. notify the associated content viewer and all child docshells that they are about to be unloaded. void fireunloadnotification(); parameters none. getdocshellenumerator() get an enumerator over this docshell and its children. nsisimpleenumerator getdocshellenumerator( in ...
nsIDocumentLoader
1.5 / seamonkey 1.0) void fireonstatuschange( in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring amessage ); parameters awebprogress arequest astatus amessage native code only!getcontentviewercontainer obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. void getcontentviewercontainer( in nsisupports adocumentid, out nsicontentviewercontainer aresult ); parameters adocumentid aresult getloadgroup() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) ...
nsIDragService
enddragsession() tells the drag service to end a drag session. this is called when an external drag occurs. void enddragsession( in prbool adonedrag ); parameters adonedrag if adonedrag is true, the drag has finished, otherwise the drag has just left the window. firedrageventatsource() obsolete since gecko 43 (firefox 43 / thunderbird 43 / seamonkey 2.40)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. fire a drag event at the source of the drag. this was changed in gecko 43, see the following section. void firedrageventatsource( in unsigned long amsg ); obsolete since gecko 43 parameters amsg one of the ns_dragdrop_* contants which was defined in widget/basice...
nsIEditor
void begintransaction(); void endtransaction(); void beginplaceholdertransaction(in nsiatom name); void endplaceholdertransaction(); boolean shouldtxnsetselection(); void setshouldtxnsetselection(in boolean should); inline spellchecking methods nsiinlinespellchecker getinlinespellchecker(in boolean autocreate); void syncre
altimespell(); void setspellcheckuseroverride(in boolean enable); clipboard methods void cut(); boolean cancut(); void copy(); boolean cancopy(); void paste(in long aselectiontype); boolean canpaste(in long aselectiontype); selection methods void selectall(); void beginningofdocument(); void en...
nsIEditorSpellCheck
parameters misspelledword the word to replace. replaceword the word with which to replace the misspelledword. alloccurrences if true, all occurrences of misspelledword are replaced with replaceword. if false, only the first occurrence is replaced. savedefaultdictionary() obsolete since gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. saves the currently selected dictionary as the default. the function uninitspellchecker() will also do this, but that function may not be called in some situations. this function allows the caller to force the default immediately. note: this method was removed in gecko 9...
nsIEventTarget
ciated with the current thread. boolean isoncurrentthread(); parameters none. return value returns true if events dispatched to this event target will run on the current thread (that is, the thread calling this method). if events dispatched to this target will be processed on another thread, returns false. native code only!postevent obsolete since gecko 1.9 (firefox 3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. method for posting an asynchronous event to the event target. if this method succeeds, then the event will be dispatched on the target thread. void postevent( in pleventptr aevent ); parameters aevent the event to dispatched. ...
nsIFocusManager
lement within awindow. if the current focusedwindow is a descendant of awindow, sets the current focusedwindow to awindow. void clearfocus( in nsidomwindow awindow ); parameters awindow exceptions thrown ns_error_invalid_arg if awindow is null. native code only!contentremoved obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. called when content has been removed. void contentremoved( in nsidocument adocument, in nsicontent aelement ); parameters adocument aelement native code only!firedelayedevents fire any events that have been delayed due to synchronized actions. vo...
nsIFrameMessageManager
bject implementing nsiframemessagelistener whose receivemessage method will be called when the message is received. listenwhenclosed default is false. set to oo if you want to receive messages during the short period after a frame has been removed from the dom and before its frame script has finished unloading. this parameter only has an effect for frame message managers in the main process. an
alternative method to listen for death of frame script is to use message-manager-disconnect observer: observer notifications :: message manager. removemessagelistener() removes a message listener previously added by calling addmessagelistener(). void removemessagelistener( in astring amessage, in nsiframemessagelistener alistener ); parameters amessage the name of the message for which...
nsIIOService
nt32_t asecurityflags, in uint32_t acontentpolicytype); nsiuri newfileuri(in nsifile afile); nsiuri newuri(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description offline boolean returns true if networking is in "offline" mode. when in offline mode, attempts to access the network will fail (
although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up). observers will be notified of changes to this attribute. methods allowport() checks if a port number is banned. this involves consulting a list of unsafe ports, corresponding to network services that may be easily exploitable. if the...
nsIMessageListenerManager
n nsimessagelistener to invoke when a message is received. see nsimessagelistener for details of the message syntax. listenwhenclosed specify true to receive messages during the short period after a frame has been removed from the dom and before its frame script has finished unloading; this is false by default. this parameter only has an effect for frame message managers in the main process. an
alternative method to listen for death of frame script is to use a message-manager-disconnect observer; see observer notifications :: message manager. removemessagelistener() undo an addmessagelistener() call; that is, calling this causes listener to stop being invoked when the specified message is received. void removemessagelistener(in astring messagename, in nsimess...
nsIMessageWakeupService
y value consists of a comma separate string that contains: the contract id for your component (e.g. "@mozilla.org/myservice;1"). the string name of interface to instantiate the component as (e.g. "nsimyinterface"). the method to call to instantiate the component (either "getservice" or "createinstance"). a comma-separated list of messages for which your component should be instantiated.
alternatively, it is possible to register a wakeup entry programmatically via the nsicategorymanager interface. currently, services must expose a wrappedjsobject in order to support this; however, once bug 593407 is fixed, the service to be woken up must implement nsiframemessagelistener. ...
nsIMsgCompFields
b28 priority char * receiptheadertype print32 references char * replyto astring securityinfo nsisupports subject astring templatename astring temporaryfiles char * obsolete temporaryfiles obsolete, do not use anymore to astring usemultipart
alternative prbool uuencodeattachments prbool methods utility methods prbool checkcharsetconversion ( out char * fallbackcharset ); nsimsgrecipientarray splitrecipients ( in prunichar * recipients, in prbool emailaddressonly ); void convertbodytoplaintext ( ); attachment handling methods void addattachment ( in n...
nsIMsgDBHdr
headers for mail messages. inherits from: nsisupports this interface is usually given to you in return to a query from the message database. there are utility functions that also return it though. for instance, msghdrforcurrentmessage() will return the currently selected message's header. headers are backed by the database: a call to these functions directly modifies the state of the database,
although it is not saved until the database is committed. in clear, if you want to do a persistent change to a message header, such as marking it as read, or replied to, or whatever, you must do it through its corresponding nsimsgfolder (msghdr.folder) or nsimsgdatabase (msghdr.folder.msgdatabase). it is also mandatory to set msghdr.folder.msgdatabase = null after performing this kind of operations t...
nsIMutableArray
inherits from: nsiarray last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) consumers of nsiarray should not queryinterface to nsimutablearray unless they own the array. as above, it is legal to add null elements to the array. note also that null elements can be created as a side effect of insertelementat(). ...
nsINavHistoryContainerResultNode
attributes attribute type description childcount unsigned long the number of child nodes; accessing this throws an ns_error_not_available exception of containeropen is false. read only. 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. read-only. this is false for bookmark folder nodes unless the setfolderreadonly() method has been called to specifically make the folder read-only. it's true for non-folder nodes. if this container is a remote container, this flag may be redefined by the remote container provider. read-only. containeropen boolean set this to true to allow descent into this container. when closed, attempti...
nsINavHistoryResultObserver
void nodetagschanged(in nsinavhistoryresultnode anode); void nodetitlechanged(in nsinavhistoryresultnode anode, in autf8string anewtitle); void nodeurichanged(in nsinavhistoryresultnode anode, in autf8string anewuri); void sortingchanged(in unsigned short sortingmode); attributes attribute type description result nsinavhistoryresult the nsinavhistoryresult this observer monitors.
although this attribute is read-write, you should not
alter it directly; instead, call nsinavhistoryresult.addobserver() to add an observer to a result. methods batching() lets the observer know when a batch operation in places is about to start or end. the observer can then pause updates or events until the batch is completed, so that it won't handle the large number of updates that are about to ...
nsIPlacesImportExportService
letofolder( in nsilocalfile afile, in print64 afolder, in boolean aisinitialimport ); parameters afile the file to import. afolder the id of the bookmarks folder into which to import the bookmarks. aisinitialimport whether or not this is an initial import. importhtmlfromuri() obsolete since gecko 14.0 (firefox 14.0 / thunderbird 14.0 / seamonkey 2.11)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: this method has been removed; use the bookmarkhtmlutils.jsm javascript code module instead. same thing as importhtmlfromfile(), but takes a uri instead. void importhtmlfromuri( in nsiuri auri, in boolean aisinitialimport ); parameters auri the uri from w...
nsIPushSubscription
methods getkey() returns a byte array containing the key material for this subscription. the remote server can use these keys to encrypt and authenticate message payloads. the following key names are supported: p256dh the ecdh public key, used as the input keying material in the hkdf invocation during encryption. auth the shared authentication secret, used as the s
alt in the hkdf invocation. void getkey( in domstring name, [optional] out uint32_t keylen, [array, size_is(keylen), retval] out uint8_t key ); parameters name the encryption key name. keylen the keying material length. key the byte array containing the keying material. keylen and key are out parameters. when called from javascript, nsipushsubscription.getkey() only takes na...
nsIScriptableIO
e: [ nsiscriptableio | accessing files | getting file information | reading from files | writing to files | moving, copying and deleting files | uploading and downloading files | working with directories ] important note: the pages from the file and stream guide use the io object (nsiscriptableio), which was not available in any released version of the platform (pending some fixes). there are
alternative xpcom apis you can use, your help in updating this pages to use the supported api is very much welcome! other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and save dialogs, reading textual data, writing textual data, list of file-related error codes. nsiscriptableio provides a convenient api for creating files and streams, as...
nsISelectionPrivate
r the returned ranges are allowed to touch the input range rather than merely overlapping it. resultcount returns the number of ranges that overlap (or touch) the input range. results returns the ranges that overlap (or touch) the input range. native code only!getrangesforintervalcomarray obsolete since gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. this method became obsolete in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9). use getrangesforintervalarray() instead. void getrangesforintervalcomarray( in nsidomnode beginnode, in print32 beginoffset, in nsidomnode endnode, in print32 endoffset, ...
nsISocketTransport
ocket is connected. read only. constants timeout type this constants are used by gettransport() and settransport() to specify socket timeouts constant value description timeout_connect 0 connecting timeout. timeout_read_write 1 read and write timeouts. nsitransporteventsink status codes note:
although these constants look like xpcom error codes and are passed in an nsresult variable, they are not error codes. they do overlap with existing error codes in necko, these status codes are confined within a very limited context where no error codes may appear, so there is no ambiguity. the values of these status codes must never change. the status codes appear in near-chronological order (not in...
nsIStringBundle
intl/strres/nsistringbundle.idlscriptable this interface provides functions for retrieving both formatted and unformatted strings from a properties file. inherits from: nsisupports last changed in gecko 1.7 this interface is used by xul:stringbundle to retrieve strings. it is recommended that you use the methods of xul:stringbundle to access these functions unless necessary.
alternatively, a string bundle can be created within a javascript context with nsistringbundleservice. method overview wstring formatstringfromid(in long aid, [array, size_is(length)] in wstring params, in unsigned long length); wstring formatstringfromname(in wstring aname, [array, size_is(length)] in wstring params, in unsigned long length); nsisimpleenumerator getsimpleenum...
nsISupports proxies
obsolete since gecko 12 (firefox 12 / thunderbird 12 / seamonkey 2.9)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. xpcom proxies were a technology which allowed code to make asynchronous or synchronous xpcom calls to a different thread on arbitrary xpcom interfaces. this technology has been removed in firefox 12 because it was very complex and often lead to strange deadlock conditions. it is no longer needed because javascript code can no longer run on arbitrary threads, and compiled code can use compiled runnable to achieve the same effect in a much simpler manner. for more information about
alternatives, see making cross-thread calls using runnables. the following inter...
nsITaskbarPreviewController
. thumbnailaspectratio float the thumbnail's aspect ratio. this doesn't need to match the preview's aspect ratio, and is allowed to be changed at any time. see drawthumbnail() for more information. read only. width unsigned long the width in pixels of the preview image. this value may change at any time. see drawpreview() for more information. read only. note:
although these attributes are read only, that indicates that the previews controlled by an nsitaskbarpreviewcontroller cannot
alter these values. the controller and its supporting code, however, may change this values at any time. methods drawpreview() invoked by nsitaskbarpreview when it needs to render the preview. the specified context is attached to a surface with the controller's width and he...
nsIThreadPool
releases it when the shutdown() method is called. threads created after the listener is set will also take ownership of the listener so that the listener will be kept alive long enough to receive the guaranteed nsithreadpoollistener.onthreadshuttingdown() notification. threadlimit unsigned long the maximum number of threads allowed at once in the pool; you may change this value by
altering this attribute. methods shutdown() shuts down the thread pool. you must not call this method from any thread within the thread pool. instead, you should call it from another thread (typically the one that created the thread pool). when this method returns, the thread pool and all its threads will have been shut down, and it is no longer be possible to dispatch events to the thread...
nsITransferable
adataflavor ); void settransferdata( in string aflavor, in nsisupports adata, in unsigned long adatalen ); attributes attribute type description converter nsiformatconverter an nsiformatconverter instance which implements the code needed to convert data into and out of the transferable given the supported flavors. isprivatedata boolean
although this is not a read-only attribute, you should generally avoid changing it, since doing so may cause it not to actually reflect the status of the context in which the transferable was created. native code only! requestingnode nsidomnode the source dom node this transferable was created from. native code only! note: currently, this can only be used on windows (i...
nsIURIFixup
d long afixupflags); constants constant value description fixup_flag_none 0 no fixup flags. fixup_flag_allow_keyword_lookup 1 allow the fixup to use a keyword lookup service to complete the uri. the fixup object implementer should honour this flag and only perform any lengthy keyword (or search) operation if it is set. fixup_flags_make_
alternate_uri 2 tell the fixup to make an
alternate uri from the input uri, for example to turn foo into www.foo.com. fixup_flag_use_utf8 4 use utf-8 to encode the uri instead of the platform character set. fixup_flag_fix_scheme_typos 8 fix common scheme typos. methods createexposableuri() converts an internal uri (for example a wysiwyg uri) into one whic...
nsIURIFixupInfo
er name expected to provide a keyword search; empty string if no keyword search is performed. read only. keywordassent astring the keyword used for the search (post trimming etc.); empty string if no keyword search is performed. read only. fixupchangedprotocol boolean if we changed the protocol; instead of using one raw from the input. read only. fixupcreated
alternateuri boolean if we created an
alternative uri. potentially adding a prefix and/or suffix; set by the browser.fixup.
alternate.prefix and .suffix prefs, their defaults "www." and ".com", respectively. read only. originalinput autf8string the original input. read only. ...
nsIXMLHttpRequest
try to avoid using it. nsixmlhttprequest along with nsijsxmlhttprequest and nsixmlhttprequesteventtarget are mozilla's implementation details of the dom xmlhttprequest object. note: if you're a web developer or a mozilla add-on developer, please refer to the xmlhttprequest documentation instead. this page contains documentation, specific to mozilla application and add-on developers. ...
nsIXSLTProcessorObsolete
obsolete since gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. use nsixsltprocessor instead. ...
nsIXULSortService
parent, in nsicontent container, in nsicontent node, in boolean anotify); native code only! obsolete since gecko 1.9 void sort(in nsidomnode anode, in astring asortkey, in astring asorthints); constants constant value description sort_comparecase 0x0001 sort_integer 0x0100 methods native code only!insertcontainernode obsolete since gecko 1.9 (firefox 3)this feature is obsolete.
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. used internally for insertion sorting. void insertcontainernode( in nsirdfcompositedatasource db, in nsrdfsortstate sortstateptr, in nsicontent root, in nsicontent trueparent, in nsicontent container, in nsicontent node, in boolean anotify ); parameters db ...
nsIXmlRpcFault
try to avoid using it. extensions/xml-rpc/idl/nsixmlrpcclient.idlscriptable an xml-rpc exception. xml-rpc server fault codes are returned wrapped in this; access it using nsixpconnect.getpendingexception->data. inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void init(in print32 faultcode, in string faultsring); string tostring(); attributes attribute type description faultcode print32 read only. ...
NS ENSURE TRUE
summary macro returns return-value if expr evaluates to false. syntax ns_ensure_true( expr, return-value ); usage nsresult mozmyclass::mozstringmucking() { char *foo = new char[123]; ns_ensure_true(foo, ns_error_out_of_memory); // this is equivalent to doing: if (!foo) return ns_error_out_of_memory; // thou sh
alt not return ns_error_failure.. int i = 3; ns_ensure_true(i == 3, ns_error_failure); return ns_ok; } char* mozmyclass::dostuff() { char* bar = new char[321]; ns_ensure_true(bar, nsnull); return bar; } ...
nsIAbCard/Thunderbird3
by this method. these functions convert values in the same manner as the default implementation of nsivariant. a value must be convertible to a string; if this convention is not followed, consumers of cards may fail unpredictably or return incorrect results. the non-variant functions are marked [noscript] since xpconnect uses magic with nsivariant such that the other functions are not needed,
although c++ does need them. void setproperty(in autf8string name, in nsivariant value); [noscript] void setpropertyasastring(in string name, in astring value); [noscript] void setpropertyasautf8string(in string name, in autf8string value); [noscript] void setpropertyasuint32(in string name, in pruint32 value); [noscript] void setpropertyasbool(in string name, in boolean value); parameters ...
Performance
implicit transaction is created around that statement. when transactions are committed, sqlite does journaling which requires syncing data to disk. this operation is extremely slow. therefore, if you are doing many transactions in a row, you will get significant performance improvements by surrounding them in a transaction. the asynchronous writes discussed below removes most of the immediate pen
alty of a commit, so you will not notice the problem as much. however, there is still overhead, and using a transaction will still be faster. one major problem is that the queue of file operations will get very long if there are many transactions. some operations require walking this queue to see what operations have been pending, and they will be slower. if the user shuts down the browser soon after...
Storage
r version of gecko. see mozistoragestatementwrapper for details. in c++, the code would look something like this: bool hasmoredata; while (ns_succeeded(statement->executestep(&hasmoredata)) && hasmoredata) { print32 value; rv = statement->getint32(0, &value); ns_ensure_success(rv, rv); } you can obtain other types of data by using the various methods available on mozistoragevaluearray.
alternatively, if you do not expect any results but still need to execute a bound statement, you can simply call mozistoragestatement.execute(). this is equivalent to calling mozistoragestatement.executestep() and then mozistoragestatement.reset(). resetting a statement when you execute a statement synchronously, it is important to make sure you reset your statement. you can accomplish this by call...
Frequently Asked Questions
ptr? release an nscomptr before it goes out of scope? assign 0 into it. whenever an nscomptr takes on a new value, it always releases its old value, if any. assigning in the value 0 is just like assigning in a raw pointer that happens to be null. the old referent will be released. [see initialization and assignment for more details] you should note, though, that there is a small performance pen
alty for this. the nscomptr will still exercize logic in its destructor to attempt to release the value it has at that time. the optimal solution is to arrange the lifetime of your nscomptr to correspond to exactly how long you want to hold the reference. e.g., using blocks as in this sample // the most efficient scheme is to scope your |nscomptr| to live exactly as long // as you ne...
Weak reference
one and add a term ns_impl_queryinterfacen+1( ...,nsisupportsweakreference) // ...if you implemented |queryinterface| by hand, add a clause ns_imethodimp nsfoo::queryinterface( refnsiid aiid, void** ainstanceptr ) { // ... else if ( aiid.equals(nscomtypeinfo<nsisupportsweakreference>::getiid()) ) *ainstancepr = ns_static_cast(nsisupportsweakreference*, this); // ... }
alternatives this technique is useful, but in situations where you need this, there are two
alternatives which you may want to consider: you might hold an owning reference, but arrange to release it out-of-band; this must be before the destructor, which would otherwise never be called. you might hold a raw pointer (without addrefing and releaseing it), and avoid using it in cases where it might ...
nsCOMPtr versus RefPtr
explanation and advice on how to choose between them. general rule of thumb for nscomptr versus refptr the general rule of thumb is to use nscomptr<t> when t is an interface type, and refptr<t> when t is a concrete type. this basic rule derives from the fact that some of the nscomptr<t> code is factored into the nscomptr_base base class, which stores the underlying mrawptr as an nsisupports*. (
although, confusingly, debug builds don't work this way). this design saves some space in the binary (or at least it used to). since nscomptr stores the pointer as an nsisupports*, it must be possible to unambiguously cast from t* to nsisupports*. many concrete classes inherit from nsisupports in more than one way, so they cannot be unambiguously cast to nsisupports*. thus, these concrete classes can...
Virtualenv
ript, when invoked, installs a list of packages, http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/packages.txt , into the virtualenv via one of various methods. the mozilla build system mostly uses .pth files instead of the more typically used python setup.py develop or python setup.py install to install python modules in to the virtualenv's python path due to performance concerns (
although such functionality is available via the setup.py keyword in a packages.txt file). when using this method, be aware that the parts of package installation invoked via setup.py, such as console-script creation and dependency resolution, will not be invoked. the virtualenv software, mirrored from a canonical version, lives in python/virtualenv. ...
WebIDL bindings
the above idl would also require the following c++: class myclass { static bool stuffenabled(jscontext* cx, jsobject* obj); }; if specified on an interface as a whole, then lookups for the interface object for this interface on a dom window will only find it if the specified function returns true. for objects that can only be created via a constructor, this allows disabling the functionality
altogether and making it look like the feature is not implemented at all. if specified on a dictionary member, the web-observable behavior when the function returns false will be as if the dictionary did not have a member of that name defined. that means that on the js side no observable get of the property will happen. on the c++ side, the behavior would be as if the passed-in object did not have...
Library
argtype1...argtypen zero or more parameter ctype may be specified for the parameters of the function being declared. these should not be provided if the api is an exported data symbol rather than a function. return value a functiontype cdata object representing the declared api. exceptions thrown ctypes ctype functiontype abi typeerror the return type was specified as an array.
alternative syntax another use for ctypes.declare is to get non-function/non-methods from libraries. the syntax for this is seen in firefox codebase here: //github.com/realityripple/uxp/blob/master/js/src/ctypes/library.cpp?offset=0#271 this shows that we can also supply only two arguments to the declare function. the first being the same as in the above example, name, which is the name of the sym...
PKCS #11 Netscape Trust Objects - Network Security Services
gned (like a certificate authority) or signed by another trusted certificate. certificates used as a root of trust are referred to by the complete hash of the der value of the certificate. certificates in a trust chain whose issuer is trusted are referred to by the der value of the issuer field, and the serial number. pkcs#11 representation trust objects are stored as objects on a pkcs#11 token.
although these are specific to a certificate, they do not need to be stored on the same token as the certificate. trust objects are of the class cko_netscape_trust and have the following attributes. trust object attributes. attribute type description cka_class ck_object_class cko_netscape_trust cka_issuer byte array der-encoding of the certif...
URLs - Plugins
pecific. mailto (electronic mail address) locates the internet mailing address of an individual or service. nethelp displays a nethelp topic in a nethelp window. browser-specific. news (usenet news) locates usenet news groups or individual usenet articles. nntp (usenet news using nntp access) locates usenet news groups or individual usenet articles;
alternate to news. prospero (prospero directory service) locates a resource on a prospero directory server. telnet (reference to interactive sessions) locates an interactive service. wais (wide area information servers) locates wais databases and their documents. wysiwyg placed before another url; displays a page that javascript has updated using docume...
DOM Inspector internals - Firefox Developer Tools
overlays, so that the xul defining dom inspector's ui can be organized into discrete units. inspector.xul itself is only a skeleton describing the basic structure and layout of the primary dom inspector window, leaving most of its contents to be added by the overlays. using modular overlays also allows for common xul to be shared across the various documents that make up the dom inspector's ui,
although not all overlays are shared by multiple consumers. single-consumer overlays exist solely for organization. in some cases overlays are overlaid by other overlays. if we imagine a tree structure obtained by connecting overlays as children to the files they overlay, while ignoring any overlays used for host integration, we can visualize the host-agnostic overlay tree for a given file. here's...
Introduction to DOM Inspector - Firefox Developer Tools
and text contents may also be edited. the box model viewer gives various metrics about xul and html elements, including placement and size. the xbl bindings viewer lists the xbl bindings attached to elements. if a binding extends another binding, the binding menulist will list them in descending order to to "root" binding. the css rules viewer shows the css rules that are applied to the node.
alternatively, when used in conjunction with the style sheets viewer, the css rules viewer lists all recognized rules from that style sheet in order. properties may be also be edited. rules applying to pseudo-elements do not appear. the javascript object viewer gives a hierarchical tree of the object pane's subject. the javascript object viewer also allows javascript to be evaluated by selecting the...
Inspecting web app manifests - Firefox Developer Tools
you also need to make sure the json inside the file is of the correct format. you can test this using the web manifest validator. inspecting your manifest if your manifest is deployed successfully, you should end up with a display like the following on the manifest view...
Debugging service workers - Firefox Developer Tools
of your service worker code, and you can use the full power of the debugger to debug it — stepping through code, etc. testing a service worker cache if you are using your service worker to store your site assets in cache storage (using the cache api), which is essential for creating offline apps, it can be annoying to test the cache. when you fill up the cache with assets, but then want to
alter the behavior slightly, you previously had to manually write code to empty the cache, and then fill it again. the firefox devtools’ storage tab has a cache storage section that lists all the different caches you have stored under each different origin. right/ctrl clicking on one of the caches gives you two options: delete all — delete all caches under this origin. delete "name of cac...
Debugger.Source - Firefox Developer Tools
t> element was dynamically inserted into a document, then these accessors refer to the call that actually caused the script to run—usually the call that made the element part of the document. thus, they donot refer to the call that created the element; stored the source as the element’s text child; made the element a child of some uninserted parent node that was later inserted; or the like.
although the main script of a worker thread is introduced by a call to worker or sharedworker, these accessors always return undefined on such script’s sources. a worker’s main script source and the call that created the worker are always in separate threads, but debugger is an inherently single-threaded facility: its debuggees must all run in the same thread. since the global that created the wo...
Dominators view - Firefox Developer Tools
this window dominates a css2properties object, whose retained size is 2% of the total snapshot size. again the shallow size is very small: almost all of its retained size is in the nodes that it dominates. by clicking on the disclosure arrow next to the function, we can see those nodes. in this way you can quickly get a sense of which objects retain the most memory in the snapshot. you can use
alt + click to expand the whole graph under a node. call stack in the toolbar at the top of the tool is a dropdown called "label by": by default, this is set to "type". however, you can set it instead to "call stack" to see exactly where in your code the objects are being allocated. this option is called "allocation stack" in firefox 46. to enable this, you must check the box labeled "record...
Migrating from Firebug - Firefox Developer Tools
side panel. in there the functions are listed together with their call parameters. in the devtools the function call stack is shown within the call stack side panel. to see the call parameters in the devtools, you need to have a look at the variables side panel. examine variables the watch side panel in firebug displays the window object (the global scope) by default. with the script execution h
alted it shows the different variable scopes available within the current call stack frame. furthermore, it allows you to add and manipulate watch expressions. the devtools have a variables side panel, which works basically the same. the main difference is that it is empty when the script execution is not stopped, i.e. it doesn't display the window object. though you can inspect that object either vi...
Performance Analysis - Firefox Developer Tools
the network monitor includes a performance analysis tool, to help show you how long the browser takes to download the different parts of your site. using the performance analysis tool to run the performance analysis tool click the stopwatch icon in the toolbar. (
alternatively, if you have only just opened the network monitor, so it's not yet populated with the list of requests, you'll get a stopwatch icon in the main window.) the network monitor then loads the site twice: once with an empty browser cache, and once with a primed browser cache. this simulates the first time a user visits your site, and subsequent visits. it displays the results for each run side by side, or vertically if the browser window is narrow: the results for each run are summarised in a table and a pie chart. th...
Examine and edit CSS - Firefox Developer Tools
a tooltip showing what color value is stored in that variable (bug 1431949). editing keyboard shortcuts you can use the arrow and page up/down keys (along with others) to increase/decrease numeric rules while editing: the up arrow increments values by 1 — for example, "1px" changes to "2px". shift + up/down increments or decrements values by 10. ctrl + up/down (on linux and windows) or
alt + up/down (on mac) increments or decrements values by 0.1. shift + page up/page down increments or decrements values by 100. track changes when you are editing the rules in the rules view, you can see the changes you have made in the changes pane. note: you can view changes made to the rules view only. if you edit the css using the style editor, the changes will not be shown in the change...
Frame rate - Firefox Developer Tools
e frame rate, and the lowest frame rate. using the frame rate graph the great value of the frame rate graph is that, like the web console, it gives you a quick indication of where your site might be having problems, enabling you to use the other tools for more in-depth analysis. for example, here's a screenshot of a performance profile: you can see that the average frame rate is reasonably he
althy, but there are three spots where frame rate collapses for tens of milliseconds. this would certainly cause a noticeable stutter for any animations that were playing in the page. the frame rate graph is correlated with the waterfall summary directly above it, and there we can see that the first two drops in the frame rate are correlated with orange bars, which denote time spent executing javasc...
Intensive JavaScript - Firefox Developer Tools
. the pink says that we are mostly performing css calculations and possibly reflow: this is the css animation that's running throughout the profile. then there are three solid blocks of orange, representing javascript execution, one for each time we pressed the button. the bottom half, which is correlated with the timeline summary in time, shows frame rate. we can see that frame rate is pretty he
althy for most of the recording, but collapses completely whenever we press the button. we can select one of these periods and have a closer look at it in the main waterfall view: here, when we pressed the button, the browser ran a javascript function, or series of functions, that blocked the main thread for 71.73ms, or more than four times our frame budget. which function, though? by switching ...
Waterfall - Firefox Developer Tools
nd is the rate at which animations will appear smooth. for a rate of 60 frames per second, that gives the browser 16.7 milliseconds to execute the complete flow. importantly for responsiveness, the browser doesn't always have to go through every step: css animations update the page without having to run any javascript. not all css property changes cause a reflow. changing properties that can
alter an object's geometry and position, such as width, display, font-size, or top, will cause a reflow. however, changing properties that don't
alter geometry or position, such as color or opacity, will not. not all css property changes cause a repaint. in particular, if you animate an element using the transform property, the browser will use a separate layer for the transformed element, and doesn...
Style Editor - Firefox Developer Tools
md + x ctrl + x copy ctrl + c cmd + c ctrl + c paste ctrl + v cmd + v ctrl + v undo ctrl + z cmd + z ctrl + z redo ctrl + shift + z / ctrl + y cmd + shift + z / cmd + y ctrl + shift + z / ctrl + y indent tab tab tab unindent shift + tab shift + tab shift + tab move line(s) up
alt + up
alt + up
alt + up move line(s) down
alt + down
alt + down
alt + down comment/uncomment line(s) ctrl + / cmd + / ctrl + / ...
View Source - Firefox Developer Tools
s to the width of the page. syntax highlighting (toggle) applies syntax highlighting to the code.when syntax highlighting is on, view source also highlights parsing errors in red. hovering your mouse over errors displays a tooltip explaining the error. this feature is useful when you're looking for html errors. to access go to line from the keyboard, press control + option + l on macos, or
alt + shift + l on windows or linux. link to a line number it is possible to link to a particular line, by adding the #linennn anchor to the url the browser will jump to the nnn line. for example view-source:https://www.mozilla.org/#line100 view selection source if you select part of a web page and conext-click, you'll see a context menu item labeled "view selection source", that behaves just li...
AesGcmParams - Web APIs
n. taglength optional a number. this determines the size in bits of the authentication tag generated in the encryption operation and used for authentication in the corresponding decryption. according to the web crypto specification this must have one of the following values: 32, 64, 96, 104, 112, 120, or 128. the aes-gcm specification recommends that it should be 96, 104, 112, 120 or 128,
although 32 or 64 bits may be acceptable in some applications: appendix c of the specification provides additional guidance here. taglength is optional and defaults to 128 if it is not specified. examples see the examples for subtlecrypto.encrypt() and subtlecrypto.decrypt(). specifications specification status comment web cryptography apithe definition of 'subtlecryp...
Animation() - Web APIs
the animation() constructor of the web animations api returns a new animation object instance. syntax var animation = new animation([effect][, timeline]); parameters effect optional the target effect, as an object based on the animationeffectreadonly interface, to assign to the animation.
although in the future other effects such as sequenceeffects or groupeffects might be possible, the only kind of effect currently available is keyframeeffect. this can be null (which is the default) to indicate that there should be no effect applied. timeline optional specifies the timeline with which to associate the animation, as an object of a type based on the animationtimeline interface. currently the only timeline type available is documenttimeline, but in the future there my be timelines ass...
AudioBufferSourceNode.loopEnd - Web APIs
example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackrate, loopstart and loopend properties on the fly. when the audio is played to the end, it loops, but you can control how long the loops last by
altering loopstart and loopend. for example, if you set their values to 20 and 25, respectively, then begin playback, the sound will play normally until it reaches the 25 second mark. then the current play position will loop back to the 20 second mark and continue playing until the 25 second mark, ad infinitum (or at least until stop() is called). for a full working example, see this code running l...
AudioBufferSourceNode.loopStart - Web APIs
xample in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and slider controls are used to change the playbackrate, loopstart, and loopend properties on the fly. when the audio is played to the end, it loops, but you can control how long the loops last by
altering loopstart and loopend. for example, if you set their values to 20 and 25, respectively, the audio will start to loop between 20 and 25 seconds in to the track. for a full working example, see this code running live, or view the source. function getdata() { source = audioctx.createbuffersource(); request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.resp...
AudioBufferSourceNode.playbackRate - Web APIs
the audio's playback rate to 88,200 hz. example in this example, the audiocontext.decodeaudiodata() function is used to decode an audio track, and put it into an audiobuffersourcenode. buttons are provided to play and stop the audio playback, and a slider control is used to change the playbackrate property value on the fly. you can run the example live (or view the source.) play the song and
alter the playback rate for some fun results. <input class="playback-rate-control" type="range" min="0.25" max="3" step="0.05" value="1"> <span class="playback-rate-value">1.0</span> function getdata() { source = audioctx.createbuffersource(); request = new xmlhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { ...
AudioContext.suspend() - Web APIs
this method will cause an invalid_state_err exception to be thrown if called on an offlineaudiocontext. syntax var audioctx = new audiocontext(); audioctx.suspend().then(function() { ... }); returns a promise that resolves with void. the promise is rejected if the context has already been closed. ...
AudioContext - Web APIs
am representing an media stream track. audiocontext.getoutputtimestamp() returns a new audiotimestamp object containing two audio timestamp values relating to the current audio context. audiocontext.resume() resumes the progression of time in an audio context that has previously been suspended/paused. audiocontext.suspend() suspends the progression of time in the audio context, temporarily h
alting audio hardware access and reducing cpu/battery usage in the process. examples basic audio context declaration: var audioctx = new audiocontext(); cross browser variant: var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillatornode = audioctx.createoscillator(); var gainnode = audioctx.creategain(); var finish = audioctx.destin...
AudioListener - Web APIs
and forth) position of the top of the listener's head in the same cartesian coordinate sytem as the position (positionx, positiony, and positionz) values. the forward and up values are linearly independent of each other. the default is 0. methods audiolistener.setorientation() sets the orientation of the listener. audiolistener.setposition() sets the position of the listener. note:
although these methods are deprecated they are currently the only way to set the orientation and position in firefox, internet explorer and safari. deprecated features audiolistener.dopplerfactor a double value representing the amount of pitch shift to use when rendering a doppler effect. audiolistener.speedofsound is a double value representing the speed of sound, in meters per second. ...
AudioNode.connect() - Web APIs
ks it to a gain node, so that the gain node controls the volume of the oscillator node. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); var oscillator = audioctx.createoscillator(); var gainnode = audioctx.creategain(); oscillator.connect(gainnode); gainnode.connect(audioctx.destination); audioparam example in this example, we will be
altering the gain value of a gainnode using an oscillatornode with a slow frequency value. this technique is know as an lfo-controlled parameter. var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audiocontext(); // create an normal oscillator to make sound var oscillator = audioctx.createoscillator(); // create a second oscillator that will be used as an lfo ...
AudioNode - Web APIs
rnode.mindecibels = -60; analysernode.smoothingtimeconstant = 0.5; you are free to use either constructors or factory methods, or mix both, however there are advantages to using the constructors: all parameters can be set during construction time and don't need to be set individually. you can sub-class an audio node. while the actual processing is done internally by the browser and cannot be
altered, you could write a wrapper around an audio node to provide custom properties and methods. slightly better performance: in both chrome and firefox, the factory methods call the constructors internally. keep in mind that microsoft edge does not yet appear to support the constructors; it will throw a "function expected" error when you use the constructors. brief history: the first version of...
CSSPositionValue - Web APIs
ect-position') ); we set the object-position property, then check the values returned. #image { width: 300px; height: 300px; border: 1px solid black; background-color: #dededf; object-fit: none; } <p>check the developer tools to see the log in the console and to inspect the style attribute on the image.</p> <img id="image" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg"
alt="mdn logo"/> ...
CSSStyleDeclaration.setProperty() - Web APIs
value "" return value undefined exceptions domexception (nomodificationallowederror): if the property or declaration block is read only. if priority can be omitted, javascript has a special simpler syntax for setting a css property on a style declaration object: style.csspropertyname = 'value'; examples in this example we have three buttons, which can be pressed to dynamically
alter our box paragraph's border, background color, and text color to random values (see the live example at the end of this section). we know that the rule we want to
alter to do this is contained inside the second stylesheet applied to the page, so we grab a reference to it using document.stylesheets[1]. we then loop through the different rules contained inside the stylesheet, which are contained ...
CSSStyleDeclaration - Web APIs
ed properties dashed and camel-cased attributes for all supported css properties. methods cssstyledeclaration.getpropertypriority() returns the optional priority, "important". cssstyledeclaration.getpropertyvalue() returns the property value given a property name. cssstyledeclaration.item() returns a css property name by its index, or the empty string if the index is out-of-bounds. an
alternative to accessing nodelist[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. cssstyledeclaration.removeproperty() removes a property from the css declaration block. cssstyledeclaration.setproperty() modifies an existing css property or creates a new css property in the declaration block. cssstyledeclaration.getprope...
CSSStyleSheet.insertRule() - Web APIs
syntax stylesheet.insertrule(rule [, index]) parameters rule a domstring containing the rule to be inserted. what the inserted rule must contain depends on its type: for rule-sets, both a selector and a style declaration. for at-rules, both an at-identifier and the rule content. ...
CSSStyleSheet - Web APIs
s property. a specific style sheet can also be accessed from its owner object (node or cssimportrule), if any. a cssstylesheet object is created and inserted into the document's document.stylesheets list automatically by the browser, when a stylesheet is loaded for a document. as the stylesheet list cannot be modified directly, there's no useful way to create a new cssstylesheet object manually (
although constructable stylesheet objects is coming to the web platform soon and is already supported in blink). to create a new stylesheet, insert a <style> or <link> element into the document. 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. stylesheets li...
Using the CSS Typed Object Model - Web APIs
urned. note the space before the 1.2rem. to get a unit and value, we need a cssunitvalue, which we can retrieve using the cssstylevalue.parse() method on the cssunparsedvalue. let parsedunit = cssnumericvalue.parse( unit ); console.log( parsedunit ); // cssunitvalue {value: 1.2, unit: "rem"} console.log( parsedunit.unit ); // "rem" console.log( parsedunit.value ); // 1.2 cssmathsum
although the <button> element is an inline element by default, we've added display: inline-block; to enable sizing. in our css we have width: calc(30% + 20px);, which is a calc() function to define the width. when we get() the width, we get a cssmathsum returned. cssmathsum.values is a cssnumericarray with 2 cssunitvalues. the value of cssmathvalue.operator is sum: let btnwidth = allcomputedstyles...
CSS Typed Object Model API - Web APIs
ject. cssstylevalue.parseall() the parseall() method of the cssstylevalue interface sets all occurences of a specific css property to the specified valueand returns an array of cssstylevalue objects, each containing one of the supplied values. stylepropertymap the stylepropertymap interface of the the css typed object model api provides a representation of a css declaration block that is an
alternative to cssstyledeclaration. stylepropertymap.set() method of stylepropertymap interface that changes the css declaration with the given property to the value given. stylepropertymap.append() method that adds a new css declaration to the stylepropertymap with the given property and value. stylepropertymap.delete() method that removes the css declaration with the given property from the...
CacheStorage - Web APIs
names to corresponding cache objects. use cachestorage.open() to obtain a cache instance. use cachestorage.match() to check if a given request is a key in any of the cache objects that the cachestorage object tracks. you can access cachestorage through the global caches property. note: cachestorage always rejects with a securityerror on untrusted origins (i.e. those that aren't using https,
although this definition will likely become more complex in the future.) when testing, you can get around this by checking the "enable service workers over http (when toolbox is open)" option in the firefox devtools options/gear menu. note: cachestorage.match() is a convenience method. equivalent functionality to match a cache entry can be implemented by returning an array of cache names from caches...
CanvasCaptureMediaStreamTrack.requestFrame() - Web APIs
f 0 for the capturestream() method when creating the stream. syntax stream.requestframe(); return value undefined usage notes there is currently an issue flagged in the specification pointing out that at this time, no exceptions are being thrown if the canvas isn't origin-clean. this may change in the future, so it would be wise to plan ahead and watch for exceptions such as securityerror (
although the specific error that might be thrown is not mentioned in the spec, this is a likely candidate). example // find the canvas element to capture var canvaselt = document.getelementsbytagname("canvas")[0]; // get the stream var stream = canvaselt.capturestream(25); // 25 fps // send the current state of the canvas as a frame to the stream stream.getvideotracks()[0].requestframe(); speci...
CanvasRenderingContext2D.clearHitRegions() - Web APIs
tx.clearhitregions(); examples using the clearhitregions method this example demonstrates the clearhitregions() method. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // set some hit regions ctx.addhitregion({id: 'eyes'}); ctx.addhitregion({id: 'nose'}); ctx.addhitregion({id: 'mouth'}); // remove them
altogether from the canvas ctx.clearhitregions(); specifications canvas hit regions have been removed from the whatwg living standard,
although discussions about future standardization are ongoing. see https://github.com/whatwg/html/issues/3407 for more information. ...
CanvasRenderingContext2D.closePath() - Web APIs
nst ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 140); // move pen to bottom-left corner ctx.lineto(120, 10); // line to top corner ctx.lineto(220, 140); // line to bottom-right corner ctx.closepath(); // line to bottom-left corner ctx.stroke(); result closing just one sub-path this example draws a smiley face consisting of three disconnected sub-paths. note:
although closepath() is called after all the arcs have been created, only the last arc (sub-path) gets closed. html <canvas id="canvas"></canvas> javascript the first two arcs create the face's eyes. the last arc creates the mouth. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.arc(240, 20, 40, 0, math.pi); ctx.moveto(100, 20); ctx.
CanvasRenderingContext2D.getLineDash() - Web APIs
if the number, when setting the elements, is odd, the elements of the array get copied and concatenated. for example, setting the line dash to [5, 15, 25] will result in getting back [5, 15, 25, 5, 15, 25]. examples getting the current line dash setting this example demonstrates the getlinedash() method. ...
CanvasRenderingContext2D.removeHitRegion() - Web APIs
thod this example demonstrates the removehitregion() method. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // set a hit region ctx.addhitregion({id: 'eyes'}); // remove it from the canvas ctx.removehitregion('eyes'); specifications canvas hit regions have been removed from the whatwg living standard,
although discussions about future standardization are ongoing. see https://github.com/whatwg/html/issues/3407 for more information. ...
CanvasRenderingContext2D.textAlign - Web APIs
n = 'left'; ctx.filltext('left-aligned', x, 40); ctx.textalign = 'center'; ctx.filltext('center-aligned', x, 85); ctx.textalign = 'right'; ctx.filltext('right-aligned', x, 130); result direction-dependent text alignment this example demonstrates the two direction-dependent values of the textalign property: "start" and "end". note that the direction property is manually specified as "ltr",
although this is also the default for english-language text. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.font = '30px serif'; ctx.direction = 'ltr'; ctx.textalign = 'start'; ctx.filltext('start-aligned', 0, 50); ctx.textalign = 'end'; ctx.filltext('end-aligned', canvas.width, 120); result specifi...
Applying styles and colors - Web APIs
pe="submit" value="redraw"/> </form> </td> </tr> </table> document.getelementbyid('miterlimit').value = document.getelementbyid('canvas').getcontext('2d').miterlimit; draw(); screenshotlive sample using line dashes the setlinedash method and the linedashoffset property specify the dash pattern for lines. the setlinedash method accepts a list of numbers that specifies distances to
alternately draw a line and a gap and the linedashoffset property sets an offset where to start the pattern. in this example we are creating a marching ants effect. it is an animation technique often found in selection tools of computer graphics programs. it helps the user to distinguish the selection border from the image background by animating the border. in a later part of this tutorial, you can...
Drawing shapes with canvas - Web APIs
, 60); ctx.strokerect(50, 50, 50, 50); } } this example's output is shown below. screenshotlive sample the fillrect() function draws a large black square 100 pixels on each side. the clearrect() function then erases a 60x60 pixel square from the center, and then strokerect() is called to create a rectangular outline 50x50 pixels within the cleared square. in upcoming pages we'll see two
alternative methods for clearrect(), and we'll also see how to change the color and stroke style of the rendered shapes. unlike the path functions we'll see in the next section, all three rectangle functions draw immediately to the canvas. drawing paths now let's look at paths. a path is a list of points, connected by segments of lines that can be of different shapes, curved or not, of different w...
Comment - Web APIs
comments are represented in html and xml as content between '<!--' and '-->'. in xml, the character sequence '--' cannot be used within a comment. ...
Console API - Web APIs
ages or the values of variables at set points in your code, or timing how long an operation takes to complete. concepts and usage the console api started as a largely proprietary api, with different browsers implementing it, albeit it in inconsistent ways. the console api spec was created to define consistent behavior, and all modern browsers eventually settled on implementing this behavior —
although some implementations still have their own additional proprietary functions. find out about these at: google chrome devtools implementation safari devtools implementation usage is very simple — the console object — available via window.console, or workerglobalscope.console in workers; accessible using just console — contains many methods that you can call to perform rudimentary de...
ConstantSourceNode.offset - Web APIs
rce.connect(gainnode3.gain); first, the gain nodes are created and configured, and a slider control's value is set to match the gain on the two nodes. then we create a new constantsourcenode and make it the source for the two gain nodes' gainnode.gain values. each of those values is also an audioparam. let's say we have an event handler (for click events, in this case) which needs to respond by
altering the value of the two gain nodes. with the linkage above in place, that can be done using this simple event handler: function handleclickevent(event) { volumeslidercontrol.value = constantsource.offset.value; } all this function has to do is fetch the current value of the slider control we're using to control the paired nodes' gains, then store that value into the constantsourcenode's off...
CredentialsContainer.get() - Web APIs
r returned webauthn credentials. mediation: a string indicating whether the user will be required to log on for every visit to the website. valid values are "silent", "optional", or "required". unmediated: a boolean indicating the returned credential instance should not require user mediation. signal: an instance of abortsignal that can indicate that an ongoing get() operation should be h
alted. an aborted operation may complete normally (generally if the abort was received after the operation finished) or reject with an "aborterror" domexception. returns a promise that resolves with a credential instance that matches the provided parameters. if a single credential cannot be unambigiously obtained, the promise will resolve to null. specifications specification sta...
CustomEvent - Web APIs
ntly slated to be sent. it's possible this has been changed along the way through retargeting. event.deeppath an array of dom nodes through which the event has bubbled. event.defaultprevented read only indicates whether or not the call to event.preventdefault() canceled the event. event.eventphase read only indicates which phase of the event flow is being processed. event.explicitorigin
altarget read only the explicit original target of the event (mozilla-specific.) event.origin
altarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to ...
DOMMatrix - Web APIs
and 3d operations including rotation and translation. it is a mutable version of the dommatrixreadonly interface. this interface should be available inside web workers, though some implementations don't allow it yet. constructor dommatrix() creates and returns a new dommatrix object. properties this interface inherits properties from dommatrixreadonly, though some of these properties are
altered to be mutable. is2d read only a boolean flag whose value is true if the matrix was initialized as a 2d matrix. if false, the matrix is 3d. isidentity read only a boolean whose value is true if the matrix is the identity matrix. the identity matrix is one in which every value is 0 except those on the main diagonal from top-left to bottom-right corner (in other words, where the offsets ...
DOMPoint.fromPoint() - Web APIs
the static dompoint method frompoint() creates and returns a new mutable dompoint object given a source point. the source point is specified as a dompointinit-compatible object, which includes both dompoint and dompointreadonly. you can also create a new dompoint object using the new dompoint() constructor.
although this interface is based on dompointreadonly, it is not read-only; the properties within may be changed at will. syntax var point = dompoint.frompoint(sourcepoint); properties sourcepoint a dompointinit-compliant object, which includes both dompoint and dompointreadonly, from which to take the values of the new point's properties. return value a new dompoint object whose coordinate and perspective values are identical to those in the source point. the point's propertie...
DOMPoint.x - Web APIs
syntax var xpos = dompoint.x; value a double-precision floating-point value indicating the x coordinate's value for the point. ...
DOMPoint.y - Web APIs
syntax var ypos = dompoint.y; value a double-precision floating-point value indicating the y coordinate's value for the point. 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
the dompointinit dictionary's x property is used to specify the x component of a point in 2d or 3d space when either creating or serializing a dompoint or dompointreadonly. in general, positive values x mean to the right, and negative values of x means to the left, assuming that transforms have not
altered the orientation of the axes. syntax var dompointinit = { x: xpos }; dompointinit.x = xpos; var xpos = dompointinit.x; value a double-precision floating-point value indicating the point's x coordinate. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). if this property is missing when the dompointinit object is passed into frompoint(), the value is assumed to be 0 by default. dompointinit is used as an i...
DOMPointInit - Web APIs
stricted floating-point number providing the point's y-coordinate. this is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward the top of the screen. the default is 0. dompointinit.z an unrestricted floating-point value which gives the point's z-coordinate, which is (assuming no transformations that
alter the situation) the depth coordinate; positive values are closer to the user and negative values retreat back into the screen. the default value is 0. dompointinit.w the point's w perspective value, given as an unrestricted floating-point number. the default is 1. example this example creates a new dompoint representing the top-left corner of the current window, with a z component added to ...
DOMPointReadOnly() - Web APIs
syntax point = new dompointreadonly(x, y, z, w); parameters x optional the value of the horizontal coordinate, x, as a floating point number. the default value is 0. y optional the value of the vertical coordinate, y, as a floating point number. the default value is 0. z optional the value of the depth coordinate, z, as a floating point number. the default value is 0. ...
DOMUserData - Web APIs
domuserdata refers to application data. in javascript, it maps directly to object. it is returned or used as an argument by node.setuserdata(), node.getuserdata(), used as the third argument to handle() on userdatahandler, and is used or returned by various domconfiguration methods. note that
although it can be an object, in mozilla, it may be returned as a string or other type, if it was set as such a type (e.g., node.setuserdata() and node.getuserdata()). domuserdata is not persisted nor serialized and will not be present after the application has restarted or after a crash. if you are interested in persisting data you might rather need to use nsisessionstore. specifications specification status comment document object model (dom) level 3 core specificatio...
DataTransfer.dropEffect - Web APIs
its current value. 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. for the dragenter and dragover events, dropeffect will be initialized based on what action the user is requesting. how this is determined is platform specific, but typically the user can press modifier keys such as the
alt key to adjust the desired action. within event handlers for dragenter and dragover events, dropeffect should be modified if a different action is desired than the action that the user is requesting. for the drop and dragend events, dropeffect will be set to the action that was desired, which will be the value dropeffect had after the last dragenter or dragover event. in a dragend event, for ins...
DataTransferItem.type - Web APIs
some example types are: text/plain and text/html. syntax dataitem.type; return value a domstring representing the drag data item's type. example this example shows the use of the type property. ...
DedicatedWorkerGlobalScope: message event - Web APIs
sage(): const worker = new worker("static/scripts/worker.js"); worker.addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) }); the worker can listen for this message using addeventlistener(): // inside static/scripts/worker.js self.addeventlistener('message', (event) => { console.log(`received message from parent: ${event.data}`); });
alternatively, it could listen using the onmessage event handler property: // static/scripts/worker.js self.onmessage = (event) => { console.log(`received message from parent: ${event.data}`); }; specifications specification status html living standard living standard ...
DelayNode - Web APIs
o have at least one delaynode in the cycle, or the nodes taking part in the cycle will be muted. number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor delaynode() creates a new instance of an delaynode object instance.
alternatively, you can use the baseaudiocontext.createdelay() factory method. properties inherits properties from its parent, audionode. delaynode.delaytime read only is an a-rate audioparam representing the amount of delay to apply, specified in seconds. methods no specific methods; inherits methods from its parent, audionode. example we have created a simple example that allows you to ...
Document.adoptNode() - Web APIs
for more on the node.ownerdocument issues, see the w3c dom faq. specifications specification status comment domthe definition of 'document.adoptnode' in that specification. living standard ...
Document.alinkColor - Web APIs
etween mousedown and mouseup events. syntax var color = document.alinkcolor; document.alinkcolor = color; color is a string containing the name of the color (e.g., blue, darkblue, etc.) or the hexadecimal value of the color (e.g., #0000ff) notes the default value for this property in mozilla firefox is red (#ee0000 in hexadecimal). document.alinkcolor is deprecated in dom level 2 html. one
alternative is the css selector :active. another
alternative is document.body.alink,
although this is deprecated in html 4.01 in favor of the css
alternative. gecko supports both alinkcolor/:active and :focus. internet explorer 6 and 7 support alinkcolor/:active only for html anchor (<a>) links and the behavior is the same as :focus under gecko. there is no support for :focus in ie. ...
Document.bgColor - Web APIs
current document. syntax color = document.bgcolor document.bgcolor =color parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). example document.bgcolor = "darkblue"; notes the default value for this property in firefox is white (#ffffff in hexadecimal). document.bgcolor is deprecated in dom level 2 html. the recommended
alternative is use of the css style background-color which can be accessed through the dom with document.body.style.backgroundcolor. another
alternative is document.body.bgcolor,
although this is also deprecated in html 4.01 in favor of the css
alternative. ...
Document.createElementNS() - Web APIs
some browsers. return value the new element. important namespace uris html http://www.w3.org/1999/xhtml svg http://www.w3.org/2000/svg mathml http://www.w3.org/1998/math/mathml xul http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul xbl http://www.mozilla.org/xbl example this creates a new <div> element in the xhtml namespace and appends it to the vbox element. ...
Document.createEntityReference() - Web APIs
try to avoid using it. prior to gecko 7.0 this method showed up as present, due to bug bug 9850, it always only returned null. the only workaround is to create a text node, cdata section, attribute node value, etc. ...
Document.enableStyleSheetsForSet() - Web APIs
sheet set, and disables all other style sheets (except those without a title, which are always enabled). syntax document.enablestylesheetsforset(name); parameters name the name of the style sheets to enable. all style sheets with a title that match this name will be enabled, while all others that have a title will be disabled. specify an empty string for the name parameter to disable all
alternate and preferred style sheets (but not the persistent style sheets; that is, those with no title attribute). notes title matches are case-sensitive. calling this method with a null name has no effect; if you want to disable all
alternate and preferred style sheets, you must pass "", the empty string. stylesheets that don't have a title are never affected by this method. this method nev...
Document.evaluate() - Web APIs
in the document that matches the expression. results of node_iterator types contain references to nodes in the document. modifying a node will invalidate the iterator. after modifying a node, attempting to iterate through the results will result in an error. results of node_snapshot types are snapshots, which are essentially lists of matched nodes. you can make changes to the document by
altering snapshot nodes. modifying the document doesn't invalidate the snapshot; however, if the document is changed, the snapshot may not correspond to the current state of the document, since nodes may have moved, been changed, added, or removed. specifications specification status comment document object model (dom) level 3 xpath specificationthe definition of 'docume...
Document.fgColor - Web APIs
ument.fgcolor; document.fgcolor = color; parameters color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000"). example document.fgcolor = "white"; document.bgcolor = "darkblue"; notes the default value for this property in mozilla firefox is black (#000000 in hexadecimal). document.fgcolor is deprecated in dom level 2 html. the recommended
alternative is the css property color (e.g., document.body.style.color = "red"). another
alternative is document.body.text,
although this is deprecated in html 4.01 in favor of the css
alternative above. ...
Document.fullscreen - Web APIs
note: since this property is deprecated, you can determine if full-screen mode is active on the document by checking to see if document.fullscreenelement is not null. ...
HTMLImageElement.src - Web APIs
rc along with both sizes (or the corresponding sizes content attribute) and srcset in order to choose an image based on the viewport size, the src attribute is only used as a fallback for browsers that don't support sizes and srcset; otherwise, it's not used at all. examples specifying a single image html <img src="https://udn.realityripple.com/samples/d6/7ab36d79bb.jpg" width="160"
alt="slices of grapefruit, looking yummy."> result using src with an image set when using a set of images with the srcset property, the src serves as either a fallback for older browsers, or as the 1x size of the image. html result specifying a fallback for viewport-based selection when using viewport-bases selection of an image from a srcset by also specifying the sizes property, the src p...
HTMLImageElement.width - Web APIs
and the other is 400px wide. further, the sizes attribute is provided to specify the width at which the image should be drawn given the viewport's width. html specifically, for viewports up to 400px wide, the image is drawn at a width of 200px; otherwise, it's drawn at 400px. <p>image width: <span class="size">?</span>px (resize to update)</p> <img src="/files/16864/clock-demo-200px.png"
alt="clock" srcset="/files/16864/clock-demo-200px.png 200w, /files/16797/clock-demo-400px.png 400w" sizes="(max-width: 400px) 200px, 400px"> javascript the javascript code looks at the width to determine the width of the image at the moment. this is done in the window's load and resize event handlers, in order to always provide this information. var clockimage = document.quer...
HTMLInputElement - Web APIs
heckbox or radio button is in indeterminate state. for checkboxes, the effect is that the appearance of the checkbox is obscured/greyed in some way as to indicate its state is indeterminate (not checked but not unchecked). does not affect the value of the checked attribute, and clicking the checkbox will set the value to false. properties that apply only to elements of type image
alt string: returns / sets the element's
alt attribute, containing
alternative text to use when type is image. height string: returns / sets the element's height attribute, which defines the height of the image displayed for the button, if the value of type is image. src string: returns / sets the element's src attribute, which specifies a uri for the location of an image t...
HTMLMediaElement.play() - Web APIs
if the browser requires the user to explicitly start media playback by clicking a "play" button. notsupportederror the media source (which may be specified as a mediastream, mediasource, blob, or file, for example) doesn't represent a supported media format. other exceptions may be reported, depending on browser implementation details, media player implementation, and so forth. usage notes
although the term "autoplay" is usually thought of as referring to pages that immediately begin playing media upon being loaded, web browsers' autoplay policies also apply to any script-initiated playback of media, including calls to play(). 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 r...
HTMLMediaElement - Web APIs
ilent) to 1.0 (loudest). event handlers htmlmediaelement.onencrypted sets the eventhandler called when the media is encrypted. htmlmediaelement.onwaitingforkey sets the eventhandler called when playback is blocked while waiting for an encryption key. obsolete attributes these attributes are obsolete and should not be used, even if a browser still supports them. htmlmediaelement.initi
altime read only returns a double that indicates the initial playback position in seconds. htmlmediaelement.mozchannels read only returns a double representing the number of channels in the audio resource (e.g., 2 for stereo). obsolete event handlers htmlmediaelement.onmozinterruptbegin sets the eventhandler called when the media element is interrupted because of the audio chan...
HTMLTableCellElement - Web APIs
ze="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmltablecellelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmltablecellelement.abbr a domstring which can be used on <th> elements (not on <td>), specifying an
alternative label for the header cell.. this
alternate label can be used in other contexts, such as when describing the headers that apply to a data cell. this is used to offer a shorter term for use by screen readers in particular, and is a valuable accessibility tool. usually the value of abbr is an abbreviation or acronym, but can be any text that's appropriate contextually. htmltablecellelement.
HTMLTableElement.rows - Web APIs
syntax htmlcollectionobject = table.rows; value an htmlcollection providing a live-updating list of the htmltablerowelement objects representing all of the <tr> elements contained in the table. ...
HTMLTableElement.tBodies - Web APIs
the collection returned includes implicit <tbody> elements. for example: <table> <tr> <td>cell one</td> </tr> </table> the html dom generated from the above html will have a <tbody> element even though the tags are not included in the source html. syntax htmlcollectionobject = table.tbodies example this snippet gets the number of bodies in a table. ...
Headers.getAll() - Web APIs
try to avoid using it. the getall() method of the headers interface used to return an array of all the values of a header within a headers object with a given name; in newer versions of the fetch spec, it has been deleted, and headers.get() has been updated to fetch all header values instead of only the first one. if the requested header doesn't exist in the headers object, it returns an empty array. for security reasons, some headers can only be controller by the user agent. ...
History.pushState() - Web APIs
er restarts the browser, we impose a size limit of 640k characters on the serialized representation of a state object. if you pass a state object whose serialized representation is larger than this to pushstate(), the method will throw an exception. if you need more space than this, you're encouraged to use sessionstorage and/or localstorage. title most browsers currently ignore this parameter,
although they may use it in the future. passing the empty string here should be safe against future changes to the method.
alternatively, you could pass a short title for the state to which you're moving. url optional the new history entry's url is given by this parameter. note that the browser won't attempt to load this url after a call to pushstate(), but it might attempt to load the url later, f...
History.replaceState() - Web APIs
useful when you want to update the state object or url of the current history entry in response to some user action. syntax history.replacestate(stateobj, title, [url]) parameters stateobj the state object is a javascript object which is associated with the history entry passed to the replacestate method. the state object can be null. title most browsers currently ignore this parameter,
although they may use it in the future. passing the empty string here should be safe against future changes to the method.
alternatively, you could pass a short title for the state. url optional the url of the history entry. the new url must be of the same origin as the current url; otherwise replacestate throws an exception. examples suppose https://www.mozilla.org/foo.html executes the followi...
HkdfParams - Web APIs
the hkdfparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.derivekey(), when using the hkdf algorithm. properties name a domstring. this should be set to hkdf. hash a domstring representing the digest algorithm to use. this may be one of: sha-1 sha-256 sha-384 sha-512 s
alt a buffersource. the hkdf specification states that adding s
alt "adds significantly to the strength of hkdf". ideally, the s
alt is a random or pseudo-random value with the same length as the output of the digest function. unlike the input key material passed into derivekey(), s
alt does not need to be kept secret. info a buffersource representing application-specific contextual information. this is used to bind the derive...
HmacImportParams - Web APIs
f the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.importkey() or subtlecrypto.unwrapkey(), when generating a key for the hmac algorithm. properties name a domstring. this should be set to hmac. hash a domstring representing the name of the digest function to use. the can take a value of sha-256, sha-384, or sha-512. warning:
although you can technically pass sha-1 here, this is strongly discouraged as it is considered vulnerable. length optional a number representing the length in bits of the key. if this is omitted the length of the key is equal to the length of the digest generated by the digest function you have chosen. unless you have a good reason to use a different length, omit this property and use the def...
IDBCursor.update() - Web APIs
iterate through all the records in the object store. if the albumtitle of the current cursor is "a farewell to kings", we update year the album was released using var request = cursor.update();. note that you cannot change primary keys using cursor.update(), hence us not changing the album title; this would ruin the integrity of the data. in such a situation, you would have to delete the record
altogether and then add a new one using idbobjectstore.add. note also that you can't directly put cursor.value into an update call, hence the below example using an intermediary updatedata variable. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cursor obje...
InstallEvent - Web APIs
ode calls extendableevent.waituntil() in serviceworkerglobalscope.oninstall and delays treating the serviceworkerregistration.installing worker as installed until the passed promise resolves successfully. the promise resolves when all resources have been fetched and cached, or when any exception occurs. the code snippet also shows a best practice for versioning caches used by the service worker.
although this example has only one cache, you can use this approach for multiple caches. the code maps a shorthand identifier for a cache to a specific, versioned cache name. note: logging statements are visible in google chrome via the "inspect" interface for the relevant service worker accessed via chrome://serviceworker-internals. var cache_version = 1; var current_caches = { prefetch: 'pref...
IntersectionObserver.rootMargin - Web APIs
rty's value, which contains offsets for one or more sides of the root's bounding box. these offsets are added to the corresponding values in the root's bounding box before the intersection between the resulting rectangle and the target element's bounds. the string returned by this property may not match the one specified when the intersectionobserver was instantiated. the browser is permitted to
alter the values if rootmargin isn't specified when the object was instantiated, it defaults to the string "0px 0px 0px 0px", meaning that the intersection will be computed between the root element's unmodified bounds rectangle and the target's bounds. the root element and root margin in intersection observer api describes how the rootmargin is used in more detail. specifications specifi...
IntersectionObserver.thresholds - Web APIs
if only one observer was specified, without being in an array, this value is a one-entry array containing that threshold. regardless of the order your original threshold array was in, this one is always sorted in numerically increasing order. if no threshold option was included when intersectionobserver() was used to instantiate the observer, the value of thresholds is simply [0]. be careful!
although the options object you can specify when creating an intersectionobserver has a field named threshold, this property is called thresholds. confusing? yes. if you accidentally use thresholds as the name of the field in your options, the thresholds array will wind up being simply [0.0], which is likely not what you expect. debugging chaos may ensue. examples <<<...>>> specifications ...
KeyboardEvent() - Web APIs
f type domstring, that sets the value of keyboardevent.code. "location", optional and defaulting to 0, of type unsigned long, that sets the value of keyboardevent.location. "ctrlkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.ctrlkey. "shiftkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.shiftkey. "
altkey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.
altkey. "metakey", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.metakey. "repeat", optional and defaulting to false, of type boolean, that sets the value of keyboardevent.repeat. "iscomposing", optional and defaulting to false, of type boolean, that sets th...
KeyboardEvent.code - Web APIs
if the input device isn't a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. ...
KeyboardEvent.key - Web APIs
full list of key values. if the pressed key has a printed representation, the returned value is a non-empty unicode character string containing the printable representation of the key. if the pressed key is a control or special character, the returned value is one of the pre-defined key values. if the keyboardevent represents the press of a dead key, the key value must be "dead". some speci
alty keyboard keys (such as the extended keys for controlling media on multimedia keyboards) don't generate key codes on windows; instead, they trigger wm_appcommand events. these events get mapped to dom keyboard events, and are listed among the "virtual key codes" for windows, even though they aren't actually key codes. if the key cannot be identified, the returned value is unidentified. keyboar...
KeyboardEvent.keyCode - Web APIs
mplemented. unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. web developers shouldn't use the keycode attribute for printable characters when handling keydown and keyup events. as described above, the keycode attribute is not useful for printable characters, especially those input with the shift or
alt key pressed. when implementing a shortcut key handler, the keypress event is usually better (at least when gecko is the runtime in use). see gecko keypress event for details. example window.addeventlistener("keydown", function (event) { if (event.defaultprevented) { return; // should do nothing if the default action has been cancelled } var handled = false; if (event.key !== undef...
Keyboard API - Web APIs
then(keyboardlayoutmap => { var upkey = keyboardlayoutmap.get('keyw'); window.alert('press ' + upkey + ' to move up.'); }); } else { // do something else. } keyboard locking richly interactive web pages, games, and remote-streaming experiences often require access to special keys and keyboard shortcuts while in full-screen mode. examples of such key/key combinations include escape,
alt+tab, and ctrl+n. those keys and key combinations are typically captured by the user agent or the underlying operating system, as illustrated in the following example. to capture the "w", "a", "s", and "d" keys, call lock() with a list that contains the key code attribute value for each of these keys: navigator.keyboard.lock(["keyw", "keya", "keys", "keyd"]); this captures these keys regardless...
KeyframeEffect.KeyframeEffect() - Web APIs
ject or null. keyframeoptions optional either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the following: delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (reverse), switches direction after each iteration (
alternate), or runs backwards and switches direction after each iteration (
alternate-reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0.
although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional the rate of the animation's change over time. acce...
LocalMediaStream - Web APIs
by calling mediastreamtrack.stop() on each track that needs to be stopped. the example for mediastreamtrack.stop() demonstrates how to stop a multi-track stream, which is what localmediastream.stop() used to be used for. methods localmediastream.stop() stops the stream. when the source of the stream is a connected device (such as a camera or microphone), capture of media from the device is h
alted. this method is no longer available with the deprecation of localmediastream. see stopping a video stream in mediastreamtrack to learn how to stop an entire stream. specifications not part of any specification. this interface was previously part of media capture and streams but was removed in 2013. ...
Location - Web APIs
e current page will not be saved in session history, meaning the user won't be able to use the back button to navigate to it. location.tostring() returns a usvstring containing the whole url. it is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. ...
MIDIOutputMap - Web APIs
the midioutputmap read-only interface of the web midi api provides a map-like interface to the currently available midi output ports.
although it works like a map, because it is read-only, it does not contain clear(), delete(), or set() functions. specifications specification status comment web midi api working draft initial definition. ...
MSCandidateWindowUpdate - Web APIs
idatewindowupdate = handler; addeventlistener method object.addeventlistener("mscandidatewindowupdate", handler, usecapture) parameters pevtobj [in] type: ihtmleventobj pointer to an ihtmleventobj interface for the current event. 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). see also microsoft api extensions ime handling guide for gecko ...
MSSiteModeEvent - Web APIs
istrusted gets a value that indicates whether a trusted event source created an event. srcelement gets the element that the event was originally dispatched to. compare to target. target gets the element that is the target of the event. timestamp gets the time, in milliseconds, when an event occurred. type gets the name of an event.
although this event inherits from the event object, it cannot be created by using createevent. example interface mssitemodeevent extends event { buttonid: number; actionurl: string; } declare var mssitemodeevent: { prototype: mssitemodeevent; new(): mssitemodeevent; } see also microsoft api extensions ...
MediaDeviceInfo.groupId - Web APIs
.mediadevices.enumeratedevices() is called to get the list of all media devices. once the promise resolves, we walk the list using foreach(). for each device, if its groupid matches the main device's groupid, we push the mediadeviceinfo object onto the list. finally, the list, which now contains a mediadeviceinfo object for each device in the same group, is returned to the caller. this could be
altered easily to either leave out the passed-in device from the returned list, or to place it at the top of the list, by comparing the two objects' deviceid values, only pushing the device onto the result list if it doesn't match. this version of the example puts the passed-in device at the top of the result list, then adds any other members of the group that are found: const getdevicegroup = main...
MediaSession.setActionHandler() - Web APIs
current position. seekforward seeks forward from the current position through the media. seekto moves the playback position to the specified time within the media. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop h
alts playback entirely. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting up the seekforward and seekbackward action handlers. let skiptime = 10; // time to skip in seconds navigator.mediasession.setactionhandler('seekforward', evt => { // user clicked "seek forward" media notification icon. audio.currenttime = math.min(au...
Media Session action types - Web APIs
y fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop h
alts playback entirely. description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting u...
MediaSessionActionDetails.action - Web APIs
current position. seekforward seeks forward from the current position through the media. seekto moves the playback position to the specified time within the media. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop h
alts playback entirely. specifications specification status comment media session standardthe definition of 'mediasessionactiondetails.action' in that specification. draft initial definition. ...
MediaSessionActionDetails - Web APIs
y fastseek property with a value of true. this lets the browser know it can take steps to optimize repeated operations, and is likely to result in improved performance. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the platform and user agent, or may be disabled due to subscription level or other circumstances. stop h
alts playback entirely. description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds. examples adding action handlers this example implements seek forward and backward actions for an audio player by setting u...
MediaTrackConstraints.autoGainControl - Web APIs
y. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.autogaincontrol as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. automatic gain control is typically a feature provided by microphones,
although it can be provided by other input sources as well. syntax var constraintsobject = { autogaincontrol: constraint }; constraintsobject.autogaincontrol = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with automatic gain control enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the v...
MediaTrackConstraints.cursor - Web APIs
ies, constraints, and settings for an explanation of how to define constraints. usage notes you can check the setting selected by the user agent after the display media has been created by getdisplaymedia() by calling getsettings() on the display media's video mediastreamtrack, then checking the value of the returned mediatracksettings object's cursor object. ...
MediaTrackConstraints.deviceId - Web APIs
ifying one or more acceptable, ideal, and/or exact (mandatory) device ids which are acceptable as the source of media content. device ids are unique for a given origin, and are guaranteed to be the same across browsing sessions on the same origin. however, the value of the deviceid is determined by the source of the track's content, and there's no particular format mandated by the specification (
although some kind of guid is recommended). that means that a given track will only return one value for the deviceid when you call getcapabilities(). because of this, there's no use for the device id when calling mediastreamtrack.applyconstraints(), since there is only one possible value; however, you can record a deviceid and use it to ensure that you get the same source for multiple calls to getu...
MediaTrackConstraints.groupId - Web APIs
eadset would share a group id. this makes it possible to use the group id to ensure that the audio and input devices are on the same headset by retrieving the group id of the input device and specifying it when asking for an output device, perhaps. however, the value of the groupid is determined by the source of the track's content, and there's no particular format mandated by the specification (
although some kind of guid is recommended). that means that a given track will only return one value for the groupid when you call getcapabilities(), and keep in mind that this value will change for each browsing session. because of this, there's no use for the group id when calling mediastreamtrack.applyconstraints(), since there is only one possible value, and you can't use it to ensure the same g...
MediaTrackConstraints.noiseSuppression - Web APIs
inable property. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.noisesuppression as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. noise suppression is typically provided by microphones,
although it can be provided by other input sources as well. syntax var constraintsobject = { noisesuppression: constraint }; constraintsobject.noisesuppression = constraint; value if this value is a simple true or false, the user agent will attempt to obtain media with noise suppression enabled or disabled as specified, if possible, but will not fail if this can't be done. if, instead, the valu...
MediaTrackSettings.autoGainControl - Web APIs
nts for this property's value as described in the mediatrackconstraints.autogaincontrol property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). automatic gain control is a feature in which a sound source automatically manages changes in the volume of its source media to maintain a steady overall volume level. this feature is typically used on microphones,
although it can be provided by other input sources as well. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.autogaincontrol as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var autog...
MediaTrackSettings.deviceId - Web APIs
unique identifier for the track's source. this id is valid across multiple browsing sessions for the same origin and is guaranteed to be different for all other origins, so you can safely use it to request the same source be used for multiple sessions, for example. the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take,
although the specification does recommend it be a guid. since there is a one-to-one pairing of id with each source, all tracks with the same source will share the same id for any given origin, so mediastreamtrack.getcapabilities() will always return exactly one value for deviceid. that makes the device id not useful for any changes to constraints when calling mediastreamtrack.applyconstraints(). a...
MediaTrackSettings.groupId - Web APIs
ross multiple browsing sessions. however, it can be used to ensure that audio input and output are both being performed on the same headset, for example, or to ensure that the built-in camera and microphone on a phone are being used for video conferencing purposes. the actual value of the string, however, is determined by the source of the track, and there is no guarantee what form it will take,
although the specification does recommend it be a guid. since this property isn't stable across browsing sessions, its usefulness when calling getusermedia() is generally limited to ensuring that tasks performed during the same browsing session use devices from the same group (or that they don't use devices from the same group). there is no situation in which the groupid is useful when calling apply...
MediaTrackSettings.noiseSuppression - Web APIs
nts for this property's value as described in the mediatrackconstraints.noisesuppression property you provided when calling either getusermedia() or mediastreamtrack.applyconstraints(). noise suppression automatically filters the audio to remove background noise, hum caused by equipment, and the like from the sound before delivering it to your code. this feature is typically used on microphones,
although it is technically possible it could be provided by other input sources as well. if needed, you can determine whether or not this constraint is supported by checking the value of mediatracksupportedconstraints.noisesuppression as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfam...
Media Capabilities API - Web APIs
and real-time feedback about the playback. to test support, smoothness and power efficiency of a video or audio file, you define the media configuration you want to test, and then pass the audio or video configuration as the parameter of the mediacapabilities interface's encodinginfo() and decodinginfo() methods. media capabilities information enables websites to enable adaptative streaming to
alter the quality of content based on actual user-perceived quality, and react to a pick of cpu/gpu usage in real time. media capabilities interfaces mediacapabilities provides information about the decoding abilities of the device, system and browser based on codecs, profile, resolution, and bitrates. the information can be used to serve optimal media streams to the user and determine if playb...
Capabilities, constraints, and settings - Web APIs
h(handleerror); } there are several steps here: it calls buildconstraints() to create the mediatrackconstraints objects for the two tracks from the code in the edit boxes. it calls navigator.mediadevices.getusermedia(), passing in the constraints objects for the video and audio tracks. this returns a mediastream with the audio and video from a source matching the inputs (typically a webcam,
although if you provide the right constraints you can get media from other sources). when the stream is obtained, it's attached to the <video> element so that it's visible on screen, and we grab the audio track and video track into the variables audiotrack and videotrack. then we set up a promise which resolves when the onloadedmetadata event occurs on the video element. when that happens, we know...
Microdata DOM API - Web APIs
g 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 micro...
Microsoft API extensions - Web APIs
element.msislayoutoptimalforplayback htmlvideoelement.msisstereo3d htmlvideoelement.mszoom htmlaudioelement.msaudiocategory htmlaudioelement.msaudiodevicetype htmlmediaelement.mscleareffects() htmlmediaelement.msinsertaudioeffect() mediaerror.msextendedcode msgraphicstrust msgraphicstruststatus msisboxed msplaytodisabled msplaytopreferredsourceuri msplaytoprimary msplaytosource msre
altime 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 ms...
MouseEvent() - Web APIs
long, that is the vertical position of the mouse event on the client window of the user's screen; setting this value doesn't move the mouse pointer. "ctrlkey", optional and defaulting to false, of type boolean, that indicates if the ctrl key was simultaneously pressed. "shiftkey", optional and defaulting to false, of type boolean, that indicates if the shift key was simultaneously pressed. "
altkey", optional and defaulting to false, of type boolean, that indicates if the
alt key was simultaneously pressed. "metakey", optional and defaulting to false, of type boolean, that indicates if the meta key was simultaneously pressed. "button", optional and defaulting to 0, of type short, that describes which button is pressed during events related to the press or release of a button: ...
MouseEvent.relatedTarget - Web APIs
efinition of 'mouseevent.relatedtarget' in that specification. working draft document object model (dom) level 3 events specificationthe definition of 'mouseevent.relatedtarget' in that specification. obsolete no change from document object model (dom) level 2 events specification. document object model (dom) level 2 events specificationthe definition of 'mouseevent.
altkey' in that specification. obsolete initial definition. ...
MouseEvent.which - Web APIs
the mouseevent.which read-only property indicates which button was pressed on the mouse to trigger the event. the standard
alternatives to this property are mouseevent.button and mouseevent.buttons. syntax var buttonpressed = instanceofmouseevent.which return value a number representing a given button: 0: no button 1: left button 2: middle button (if present) 3: right button for a mouse configured for left-handed use, the button actions are reversed. in this case, the values are read from right to left. specification this is not part of any specification. ...
MouseEvent - Web APIs
1" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">mouseevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} constructor mouseevent() creates a mouseevent object. properties this interface also inherits properties of its parents, uievent and event. mouseevent.
altkey read only returns true if the
alt key was down when the mouse event was fired. mouseevent.button read only the button number that was pressed (if applicable) when the mouse event was fired. mouseevent.buttons read only the buttons being depressed (if any) when the mouse event was fired. mouseevent.clientx read only the x coordinate of the mouse pointer in local (dom content) coordi...
MouseScrollEvent - Web APIs
non-standard and deprecated. it was used in gecko-based browsers only. instead use the standard wheelevent. method overview void initmousescrollevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean
altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in long axis); attributes attribute type description axis read only long indicates scroll direction. constants delta modes constant value description horizontal_axis 0x01 the event is caused by horiz...
MutationObserverInit.attributeOldValue - Web APIs
syntax var options = { attributeoldvalue: true | false } value a boolean value indicating whether or not the prior value of a changed attribute should be included in the mutationobserver.oldvalue property when reporting attribute value changes. if true, oldvalue is set accordingly. if false, it is not. when using attributeoldvalue, setting the attributes option to true is optional. ...
NameList - Web APIs
namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. items can be accessed by a 0-based index. the dom spec does not specify how the collection is to be implemented. ...
Node.baseURI - Web APIs
mg> element's src attribute or xml xlink:href attribute. in most cases the base url is simply the location of the document, but it can be affected by many factors, including the <base> element in html and the xml:base attribute in xml. syntax var nodebaseuri = node.baseuri; value a domstring representing the base url of the specified node. it may be null if unable to obtain an absolute uri.
although this property is read-only, its value may change in certain situations (see below). details the base url of a document the base url of a document defaults to the document's address (as displayed by the browser and available in window.location), but it can be changed: when an html <base> tag is found in the document when the document is new (created dynamically) see the base urls sec...
Node.cloneNode() - Web APIs
loned. any text that node contains is not cloned, either (since text is contained by one or more child text nodes). deep has no effect on empty elements (such as the <img> and <input> elements). *note: in the dom4 specification (since gecko 13.0 (firefox 13 / thunderbird 13 / seamonkey 2.10)), the optional deep argument defaults to true. this behavior has been changed in the latest spec!
although deep it still optional, it now defaults to false. you should always provide an explicit value for backward and forward compatibility. with gecko 28.0 (firefox 28 / thunderbird 28 / seamonkey 2.25 / firefox os 1.3)), the console warned developers not to omit the argument. starting with gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)), a shallow clone is defaulted instead of...
Node.nodePrincipal - Web APIs
try to avoid using it. the node.nodeprincipal read-only property returns the nsiprincipal object representing current security context of the node. note: this property exists on all nodes (html, svg, mathml, xul, etc.), but only if the script trying to use it has chrome privileges. syntax principalobj = node.nodeprincipal value an nsiprincipal object representing the node's security context. notes this property is read-only; attempting to write to it will throw an exception. ...
Node.setUserData() - Web APIs
ng to modify the dom. note that such data will not be preserved when imported via node.importnode, as with node.clonenode() and node.renamenode() operations (though node.adoptnode does preserve the information), and equality tests in node.isequalnode() do not consider user data in making the assessment. this method offers the convenience of associating data with specific nodes without needing to
alter the structure of a document and in a standard fashion, but it also means that extra steps may need to be taken if one wishes to serialize the information or include the information upon clone, import, or rename operations. the node.getuserdata and node.setuserdata methods are no longer available from web content. htmlelement.dataset or weakmap can be used instead. syntax var prevuserdata =...
Node - Web APIs
test whether the dom implementation implements a specific feature and this feature is supported by the specific node. node.setuserdata() allows a user to attach, or remove, domuserdata to the node. examples remove all children nested within a node function removeallchildren(element) { while (element.firstchild) { element.removechild(element.firstchild) } } sample usage /* ... an
alternative to document.body.innerhtml = "" ... */ removeallchildren(document.body) recurse through child nodes the following function recursively calls a callback function for each node contained by a root node (including the root itself): function eachnode(rootnode, callback) { if (!callback) { const nodes = [] eachnode(rootnode, function(node) { nodes.push(node) }) return nodes } ...
NodeList.item() - Web APIs
ull is returned if the index is out of range, and a typeerror is thrown if no argument is provided. syntax nodeitem = nodelist.item(index) nodelist is a nodelist. this is usually obtained from another dom property or method, such as childnodes. index is the index of the node to be fetched. the index is zero-based. nodeitem is the indexth node in the nodelist returned by the item method. ...
Notification.Notification() - Web APIs
ch is shown at the top of the notification window. options optional an options object containing any custom settings that you want to apply to the notification. the possible options are: dir: the direction in which to display the notification. it defaults to auto, which just adopts the browser's language setting behavior, but you can override that behaviour by setting values of ltr and rtl (
although most browsers seem to ignore these settings.) lang: the notification's language, as specified using a domstring representing a bcp 47 language tag. see the sitepoint iso 2 letter language codes page for a simple reference. badge: a usvstring containing the url of the image used to represent the notification when there isn't enough space to display the notification itself. body: a domst...
PannerNode.orientationX - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and coneoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationx = pannernode.orientation...
PannerNode.orientationY - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationy = pannernode.orientation...
PannerNode.orientationZ - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var orientationz = pannernode.orientation...
PannerNode.positionX - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionx = pannernode.positionx; pa...
PannerNode.positionY - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positiony = pannernode.positiony; pa...
PannerNode.positionZ - Web APIs
r is defined by the position of the audio source, given as (positionx, positiony, positionz), and the orientation of the audio source (that is, the direction in which it's facing), given as (orientationx, orientationy, orientationz). depending on the directionality of the sound (as specified using the attributes coneinnerangle, coneouterangle, and codeoutergain), the orientation of the sound may
alter the perceived volume of the sound as it's being played. if the sound is pointing toward the listener, it will be louder than if the sound is pointed away from the listener. the audioparam contained by this property is read only; however, you can still change the value of the parameter by assigning a new value to its audioparam.value property. syntax var positionz = pannernode.positionz; pa...
PaymentRequest: shippingaddresschange event - Web APIs
their shipping address. bubbles no cancelable no interface paymentrequestupdateevent event handler property onshippingaddresschange usage notes depending on the browser, the shipping address information may be redacted for privacy reasons. that is, the paymentaddress which contains the shipping address may have some portions of its content
altered, obscured, or left out entirely in order to prevent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). example in this example, a handler for the shippingaddresschange event is set up to validate that the address meets requirements set by the web application. const paymentrequest = new paymentrequest(methoddata, d...
PaymentRequest.show() - Web APIs
nse => validateresponse(response)) .catch(err => handleerror(err)); } this is functionally equivalent to the processpayment() method using the await syntax. function validateresponse(response) { checkallvalues(response) .then(response => response.complete("success")) .catch(response => response.complete("fail")); } you could even have checkallvalues() be a synchronous function,
although that may have performance implications you don't want to deal with: function validateresponse(response) { if (checkallvalues(response) { response.complete("success"); } else { response.complete("fail"); } } see the article using promises for more information if you need more information about working with promises. examples in the following example, a paymentrequest object...
Pbkdf2Params - Web APIs
2. hash a domstring representing the digest algorithm to use. this may be one of: sha-1 sha-256 sha-384 sha-512 warning: sha-1 is considered vulnerable in most cryptographic applications, but is still considered safe in pbkdf2. however, it's advisable to transition away from it everywhere, so unless you need to use sha-1, don't. use a different digest algorithm instead. s
alt a buffersource. this should be a random or pseudo-random value of at least 16 bytes. unlike the input key material passed into derivekey(), s
alt does not need to be kept secret. iterations a number representing the number of times the hash function will be executed in derivekey(). this determines how computationally expensive (that is, slow) the derivekey() operation will be. in this context, ...
Using the Permissions API - Web APIs
remarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts. accessing the permissions api the navigator.permissions property has been added to the browser to allow access to the global permissions object. this object will eventually include methods for querying, requesting, and revoking permissions,
although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using permissions.query(). depending on the value of the state property of the permissionstatus object returned when the promise resolves, it reacts differentl...
Point - Web APIs
properties x a floating-point value specifying the point's position with respect to the x (horizontal) axis. ...
Pointer events - Web APIs
<body> <div style="touch-action:none;">can't touch this ... </div> </body> </html> in the following example, default touch behavior is disabled for some button elements. button#tiny { touch-action: none; } in the following example, when the target element is touched, it will only pan in the horizontal direction. #target { touch-action: pan-x; } compatibility with mouse events
although the pointer event interfaces enable applications to create enhanced user experiences on pointer enabled devices, the reality is the vast majority of today's web content is designed to only work with mouse input. consequently, even if a browser supports pointer events, the browser must still process mouse events so content that assumes mouse-only input will work as is without direct modificat...
Web Push API Notifications best practices - Web APIs
h notifications, ranging from casual-and-disappearing to persistent-and-requiring-interaction. we caution you to use the interaction-requiring ones very sparingly, since they can be the most annoying. your notifications should be assistive, not disruptive. building trust some studies have shown that as many as 60% of push notifications are blocked. allowing your site to push notifications in re
altime requires trust. you can build trust by having a well-designed website that provides good content that shows respect for the user, and a clear value to accepting push notifications. browser mitigations because of abuses of push notifications in the past, web browser developers have begun to implement strategies to help mitigate this problem. for example, safari 12.1 now requires—and other b...
Push API - Web APIs
ecret, or other applications might be able to send push messages to your application. activating a service worker to deliver a push message can result in increased resource usage, particularly of the battery. different browsers have different schemes for handling this, there is currently no standard mechanism. 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. the limit is refreshed each time the site is visited. in comparison, chrome applies no limit, but requires that every push message causes a notification to be displayed. note: as of gecko 44, the allowed quota of push messages per application is not incremented when a new notification fires, when another is still visible...
RTCConfiguration.certificates - Web APIs
this property isn't specified, the browser will automatically generate and use a certificate to secure the connection. see using certificates below for more information on why you might want to—or not to—explicitly provide certificates. description if this property isn't included in the configuration, a set of certificates is automatically generated for each instance of rtcpeerconnection.
although a given dtls connection only uses a single certificate, providing multiple options in the certificates list may improve the odds of establishing a connection by increasing the chances a mutually-compatible encryption algorithm and key size may be found. the method by which a browser decides which certificate to use is implementation-dependent. some browsers may simply choose the first liste...
RTCConfiguration - Web APIs
h the sdp bundle standard. this must be one of the values from the enum rtcbundlepolicy. if this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance.
although only one certificate is used by a given connection, providing certificates for multiple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconne...
RTCDataChannel.id - Web APIs
-only rtcdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel. this id is set at the time the data channel is created, either by the user agent (if rtcdatachannel.negotiated is false) or by the site or app script (if negotiated is true). each rtcpeerconnection can therefore have up to a theoretical maximum of 65,534 data channels on it,
although the actual maximum may vary from browser to browser. in early versions of the webrtc specification, this property's name was stream. code that uses that property needs to be updated. syntax var id = adatachannel.id; value an unsigned short value (that is, an integer between 0 and 65,535) which uniquely identifies the data channel. while the label property doesn't have to be unique, ...
RTCIceCandidate.address - Web APIs
cted from the candidate a-line, if it's formatted properly. syntax var address = rtcicecandidate.address; value a domstring providing the ip address from which the candidate comes. note: if port is null — and port is supported by the user agent — passing the candidate to addicecandidate() will fail, throwing an operationerror exception. security notes it's important to note here that
although webrtc does not require the two peers on an rtcpeerconnection to know one another's true ip addresses, the address property on rtcicecandidate can expose more information about the source of the remote peer than the user expects. the ip address can be used to derive information about the remote device's location, network topology, and so forth. it can also be used for fingerprinting purposes...
RTCIceCandidate.usernameFragment - Web APIs
sstalk among multiple ongoing ice sessions, but, more importantly, helps secure ice transactions (and all of webrtc by extension) against attacks that might try to inject themselves into an ice exchange. note: there is no api to obtain the ice password, for what should be fairly obvious security reasons. the usernamefragment and password both change every time an ice restart occurs. example
although the webrtc infrastructure will filter out obsolete candidates for you after an ice restart, you can do it yourself if you're trying to absolutely minimize the number of messages going back and forth. to do so, you can compare the value of usernamefragment to the current usernamefragment being used for the connection after receiving the candidate from the signaling server and before caling a...
RTCIceCandidatePairStats.circuitBreakerTriggerCount - Web APIs
the rtcicecandidatepairstats property circuitbreakertriggercount indicates the number of times the circuit-breaker has been triggered to indicate a connection timeout or other unexpected connection abort on this specific connection configuration. a circuit breaker trigger is fired each time the connection times out or otherwise needs to be h
alted automatically. syntax cbtcount = rtcicecandidatepairstats.circuitbreakertriggercount; value an integer value indicating the number of times the circuit-breaker has been triggered for the 5-tuple used by this connection. a 5-tuple defining a tcp connection is made up of the following data: the source ip address. the source port number. the destination ip address. the destination port number. network protocol. specifications sp...
RTCIceServer - Web APIs
the rtciceserver dictionary defines how to connect to a single ice server (such as a stun or turn server). objects of this type are provided in the configuration of an rtcpeerconnection, in the iceservers array. properties credential optional the credential to use when logging into the server. this is only used if the rtciceserver represents a turn server. credenti
altype optional if the rtciceserver represents a turn server, this attribute specifies what kind of credential is to be used when connecting. this must be one of the values defined by the rtcicecredenti
altype enum. the default is password. urls this required property is either a single domstring or an array of domstrings, each specifying a url which can be used to connect to the server. username optional if the rtciceser...
RTCInboundRtpStreamStats.packetsDuplicated - Web APIs
when a packet has the same rtp sequence number as another packet that has previously been processed. each time a packet is repeated, the value of packetsduplicated is incremented, even if the same packet is received more than twice. you can get a more accurate tally of how many packets have been lost on the stream by adding packetsduplicated to packetslost. the resulting value will be positive,
although it will not match the count as computed in rfc 3660. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.packetsduplicated' in that specification. candidate recommendation initial definition. ...
RTCOutboundRtpStreamStats.pliCount - Web APIs
ve 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. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcoutboundrtpstreamstats.plicount' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection() - Web APIs
h the sdp bundle standard. this must be one of the values from the enum rtcbundlepolicy. if this value isn't included in the dictionary, "balanced" is assumed. certificates optional an array of objects of type rtccertificate which are used by the connection for authentication. if this property isn't specified, a set of certificates is generated automatically for each rtcpeerconnection instance.
although only one certificate is used by a given connection, providing certificates for multiple algorithms may improve the odds of successfully connecting in some circumstances. see using certificates below for additional information. this configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to rtcpeerconne...
RTCRtpSendParameters - Web APIs
ters objects, each specifying the parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to
alter changes made by a specific previous call to getparameters(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsendparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpStreamStats.ssrc - Web APIs
includes this rtcrtpstreamstats dictionary. syntax var ssrc = rtcrtpstreamstats.ssrc; value the synchronization source (ssrc) is a 32-bit integer uniquely identifying the source of the rtp packets whose statistics are covered by the rtcstatsreport object of which this rtcrtpstreamstats object is a component. the manner in which these values are generated is not mandated by the specification,
although it does make recommendations. you should not make any assumptions based on the value of ssrc other than that any two objects with the same ssrc value refer to the same source. see rfc 3550, section 8 for additional information about ssrc. note: the specification includes an example that generates values for ssrc using md5. while not part of the standard, exactly, it is a good mechanism tha...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
that means that either the associated rtcrtpsender or the rtcrtpreceiver needs to support every codec in the list. if any unsupported codecs are listed, the browser will throw an invalidaccesserror exception when you call this method. a good approach to setting codec preferences is to first get the list of codecs that are actually supported, then modify that list to match what you want. pass the
altered list into setcodecpreferences() to specify your preferences. to determine which codecs are supported by the transceiver, call the sender's getcapabilities() and the receiver's getcapabilities() methods and get the codecs list from the results of each. the following code snippet demonstrates how to get both the list of codecs supported by the transceiver's rtcrtpsender and rtcrtpreceiver. v...
Range.compareNode() - Web APIs
try to avoid using it. the range.comparenode() returns a constant indicating the position of the node. the possible values are: node_before (0) node starts before the range node_after (1) node ends after the range node_before_and_after (2) node starts before and ends after the range node_inside (3) node starts after and ends before the range, i.e. the node is completely selected by the range. ...
Range.surroundContents() - Web APIs
of the range into a new node, placing the new node at the start of the specified range. this method is nearly equivalent to newnode.appendchild(range.extractcontents()); range.insertnode(newnode). after surrounding, the boundary points of the range include newnode. an exception will be thrown, however, if the range splits a non-text node with only one of its boundary points. that is, unlike the
alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. syntax range.surroundcontents(newparent); parameters newparent a node with which to surround the contents. example html <span class="header-text">put this in a headline</span> javascript const range = document.createrange(); const newparent = document.createelement('h1'...
ReadableStream.ReadableStream() - Web APIs
is to be cancelled (e.g. if readablestream.cancel() is called). the contents should do whatever is necessary to release access to the stream source. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter contains a domstring describing why the stream was cancelled. type optional this property controls what type of readable stream is being de
alt with. if it is included with a value set to "bytes", the passed controller object will be a readablebytestreamcontroller capable of handling a byob (bring your own buffer)/byte stream. if it is not included, the passed controller will be a readablestreamdefaultcontroller. autoallocatechunksize optional for byte streams, the developer can set the autoallocatechunksize with a positive integer v...
ReportingObserver() - Web APIs
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. the available options are: types: an array of strings representing the types of report to be collected by this observer. available types include deprecation, intervention, and crash (
although this last type usually isn't retrievable via a reportingobserver). buffered: a boolean that defines whether the reports that were generated before the observer was able to be created should be observable (true) or not (false). examples let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick ...
Using the Resource Timing API - Web APIs
e" in list[i]) console.log("... encodedbodysize[" + i + "] = " + list[i].encodedbodysize); else console.log("... encodedbodysize[" + i + "] = not supported"); if ("transfersize" in list[i]) console.log("... transfersize[" + i + "] = " + list[i].transfersize); else console.log("... transfersize[" + i + "] = not supported"); } } managing the resource buffer
although the browser is required to support at least 150 resource timing performance entries in its resource timing buffer, some applications may use more resources than that limit. to help the developer manage the buffer size, resource timing defines two methods that extend the performance interface. the clearresourcetimings() method removes all "resource" type performance entries from the browser's...
RsaHashedImportParams - Web APIs
rting any rsa-based key pair: that is, when the algorithm is identified as any of rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep. properties name a domstring. this should be set to rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep, depending on the algorithm you want to use. hash a domstring representing the name of the digest function to use. this can be one of sha-256, sha-384, or sha-512. warning:
although you can technically pass sha-1 here, this is strongly discouraged as it is considered vulnerable. examples see the examples for subtlecrypto.importkey(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.rsahashedimportparams' in that specification. recommendation ...
RsaHashedKeyGenParams - Web APIs
ee for example see nist sp 800-131a rev. 1. some organizations are now recommending that it should be 4096. publicexponent a uint8array. the public exponent. unless you have a good reason to use something else, specify 65537 here ([0x01, 0x00, 0x01]). hash a domstring representing the name of the digest function to use. you can pass any of sha-256, sha-384, or sha-512 here. warning:
although you can technically pass sha-1 as a value here, this is strongly discouraged as sha-1 is considered vulnerable. examples see the examples for subtlecrypto.generatekey(). specifications specification status comment web cryptography apithe definition of 'subtlecrypto.rsahashedkeygenparams' in that specification. recommendation ...
RsaPssParams - Web APIs
the rsapssparams dictionary of the web crypto api represents the object that should be passed as the algorithm parameter into subtlecrypto.sign() or subtlecrypto.verify(), when using the rsa-pss algorithm. properties name a domstring. this should be set to rsa-pss. s
altlength a long integer representing the length of the random s
alt to use, in bytes. rfc 3447 says that "typical s
alt lengths" are either 0 or the length of the output of the digest algorithm that was selected when this key was generated. for example, if you use sha-256 as the digest algorithm, this could be 32. the maximum size of s
altlength is given by: math.ceil((keysizeinbits - 1)/8) - digestsizeinbytes - 2 so for a key length of 2048 bits and a digest output size of 32 bytes, the maximum size would be 222. ...
format - Web APIs
it has the same meaning as the 'format' property of svgglyphrefelement property. if the font is in one of the formats listed in css2([css2], section15.3.5), then its value is the corresponding <string> parameter of the font. syntax string = myglyph.format; myglyph.format = string; value the format values listed below are taken from css2([css2], section15.3.5). ...
SVGTextContentElement - Web APIs
the svgtextcontentelement interface is implemented by elements that support rendering child text content. it is inherited by various text-related interfaces, such as svgtextelement, svgtspanelement, svgtrefelement, svg
altglyphelement and svgtextpathelement. <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"...
SVGTextPositioningElement - Web APIs
the svgtextpositioningelement interface is implemented by elements that support attributes that position individual text glyphs. it is inherited by svgtextelement, svgtspanelement, svgtrefelement and svg
altglyphelement. <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...
Using the Screen Capture API - Web APIs
brief time before after moving. then the cursor is removed from the stream. never the cursor should never be visible in the generated stream. logicalsurface a boolean which if true indicates that the capture should include offscreen areas of the source, if there are any. none of the constraints are applied in any way until after the content to capture has been selected. the contraints
alter what you see in the resulting stream. for example, if you specify a width constraint for the video, it's applied by scaling the video after the user selects the area to share. it doesn't establish a restriction on the size of the source itself. note: constraints never cause changes to the list of sources available for capture by the screen sharing api. this ensures that web applications can'...
Selection.modify() - Web APIs
specify "move" to move the current cursor position or "extend" to extend the current selection. direction the direction in which to adjust the current selection. you can specify "forward" or "backward" to adjust in the appropriate direction based on the language at the selection point. if you want to adjust in a specific direction, you can specify "left" or "right". ...
ServiceWorkerContainer.register() - Web APIs
, 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. remember the scope, when included, uses the page's location as its base.
alternatively, if this code were included in a page at example.com/product/description.html, with the javascript file residing at example.com/product/sw.js, then the service worker would only apply to resources under example.com/product. if ('serviceworker' in navigator) { // declaring scope manually navigator.serviceworker.register('/sw.js', {scope: './'}).then(function(registration) { cons...
VideoTrack.kind - Web APIs
narios in which specific tracks should be enabled or disabled. see video track kind strings for a list of the kinds available for video tracks. syntax var trackkind = videotrack.kind; value a domstring specifying the type of content the media represents. the string is one of those found in video track kind strings below. video track kind strings the kinds available for video tracks are: "
alternative" a potential
alternative to the main track, such as a different video take or a version of the soundtrack with only the music and no dialogue. "captions" a version of the main video track with captions burnt in. "main" the primary video track. "sign" a sign-language interpretation of an audio track. "subtitles" a version of the main video track with subtitles burnt in. "commenta...
VideoTrack.label - Web APIs
track whose kind is "sign" might have a label such as "a sign-language interpretation.". example this example returns an array of track kinds and labels for potential use in a user interface to select video tracks for a specified media element. the list is filtered to only allow certain track kinds through. ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
ttributes can be sent in a different order than how they are stored in the array buffer. you have two options: either you specify the index yourself. in this case, you call gl.bindattriblocation() to connect a named attribute from the vertex shader to the index you want to use. this must be done before calling gl.linkprogram(). you can then provide this same index to gl.vertexattribpointer().
alternatively, you use the index that is assigned by the graphics card when compiling the vertex shader. depending on the graphics card, the index will vary, so you must call gl.getattriblocation() to find out the index, and then provide this index to gl.vertexattribpointer(). if you are using webgl 2, you can specify the index yourself in the vertex shader code and override the default used by the...
Color masking - Web APIs
his is an important aspect of the webgl state machine. it allows us to setup webgl in a single initialization phase, and then just execute drawing commands for each frame. color masking gives you fine control of updating pixel values on the screen. by limiting the color channels that are written by each drawing command, you can use each channel, for example, to store a different grayscale image.
alternatively, you may use the rgb components for color, but the alpha component for some custom pixel data of your invention. finally, color masking teaches us that webgl is not only a state machine, it is also a graphics pipeline. this means that graphics operations in webgl are done in a certain order, where the output of each operation serves as the input of the next. so, for example, clearing o...
Lighting in WebGL - Web APIs
you want lighting you have to calculate it yourself. fortunately, it's not all that hard to do, and this article will cover some of the basics. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. simulating lighting and shading in 3d
although going into detail about the theory behind simulated lighting in 3d graphics is far beyond the scope of this article, it's helpful to know a bit about how it works. instead of discussing it in depth here, take a look at the article on phong shading at wikipedia, which provides a good overview of the most commonly used lighting model or if you'd like to see a webgl based explanation see this a...
Using WebGL extensions - Web APIs
ve architecture review boards (khronos). ovr_: extensions that optimize for virtual reality. ext_: extensions that mirror other opengl es or opengl api extensions. webgl_: extensions that are webgl-specific and intended to be compatible with multiple web browsers. it should also be used for extensions which originated with the opengl es or opengl apis, but whose behavior has been significantly
altered. querying available extensions the webgl context supports querying what extensions are available. var available_extensions = gl.getsupportedextensions(); the webglrenderingcontext.getsupportedextensions() method returns an array of strings, one for each supported extension. extension list the current extensions are: angle_instanced_arrays ext_blend_minmax ext_color_buffer_float ...
WebGL best practices - Web APIs
tant method for batching is texture atlasing, where multiple images are placed into a single texture, often like a checkerboard. since you need to split draw call batches to change textures, texture atlasing lets you combine more draw calls into fewer, bigger batches. shaders, programs, and glsl avoid "#ifdef gl_es", which is always true you should never use #ifdef gl_es in your webgl shaders;
although some early examples used this, it's not necessary, since this condition is always true in webgl shaders. prefer doing more work in vertex (not fragment) shaders do as much as you can in the vertex shader, rather than in the fragment shader. this is because per draw call, fragment shaders generally run many more times than vertex shaders. any calculation that can be done on the vertices and...
WebRTC connectivity - Web APIs
tion with its peer. choosing a candidate pair the ice layer selects one of the two peers to serve as the controlling agent. this is the ice agent which will make the final decision as to which candidate pair to use for the connection. the other peer is called the controlled agent. you can identify which one your end of the connection is by examining the value of rtcicecandidate.transport.role,
although in general it doesn't matter which is which. the controlling agent not only takes responsibility for making the final decision as to which candidate pair to use, but also for signaling that selection to the controlled agent by using stun and an updated offer, if necessary. the controlled agent just waits to be told which candidate pair to use. it's important to keep in mind that a single i...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
oes not guarantee quality-of-service (qos). while rtp is intended for use in latency-critical scenarios, it doesn't inherently offer any features that ensure qos. instead, it only offers the information necessary to allow qos to be implemented elsewhere in the stack. rtp doesn't handle allocation or reservation of resources that may be needed. where it matters for webrtc purposes, these are de
alt with in a variety of places within the webrtc infrastructure. for example, rtcp handles qos monitoring. rtcpeerconnection and rtp each rtcpeerconnection has methods which provide access to the list of rtp transports that service the peer connection. these correspond to the following three types of transport supported by rtcpeerconnection: rtcrtpsender rtcrtpsenders handle the encoding and t...
Introduction to WebRTC protocols - Web APIs
traversal using relays around nat (turn) is meant to bypass the symmetric nat restriction by opening a connection with a turn server and relaying all information through that server. you would create a connection with a turn server and tell all peers to send packets to the server which will then be forwarded to you. this obviously comes with some overhead so it is only used if there are no other
alternatives. sdp session description protocol (sdp) is a standard for describing the multimedia content of the connection such as resolution, formats, codecs, encryption, etc. so that both peers can understand each other once the data is transferring. this is, in essence, the metadata describing the content and not the media content itself. technically, then, sdp is not truly a protocol, but a ...
Taking still photos with WebRTC - Web APIs
and then converted into an output image file. this canvas is kept hidden by styling the canvas with display:none, to avoid cluttering up the screen — the user does not need to see this intermediate stage. we also have an <img> element into which we will draw the image — this is the final display shown to the user. <canvas id="canvas"> </canvas> <div class="output"> <img id="photo"
alt="the screen capture will appear in this box."> </div> that's all of the relevant html. the rest is just some page layout fluff and a bit of text offering a link back to this page. the javascript code now let's take a look at the javascript code. we'll break it up into a few bite-sized pieces to make it easier to explain. initialization we start by wrapping the whole script in an anonymous ...
Writing WebSocket client applications - Web APIs
ng the websocket protocol, you need to create a websocket object; this will automatically attempt to open the connection to the server. the websocket constructor accepts one required and one optional parameter: websocket = new websocket(url, protocols); url the url to which to connect; this should be the url to which the websocket server will respond. this should use the url scheme wss://,
although some software may allow you to use the insecure ws:// for local connections. protocols optional either a single protocol string or an array of protocol strings. these strings are used to indicate sub-protocols, so that a single server can implement multiple websocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the ...
Writing a WebSocket server in C# - Web APIs
ble); byte[] bytes = new byte[client.available]; stream.read(bytes, 0, bytes.length); } handshaking when a client connects to a server, it sends a get request to upgrade the connection to a websocket from a simple http request. this is known as handshaking. this sample code can detect a get from the client. note that this will block until the first 3 bytes of a message are available.
alternative solutions should be investigated for production environments. using system.text; using system.text.regularexpressions; while(client.available < 3) { // wait for enough bytes to be available } byte[] bytes = new byte[client.available]; stream.read(bytes, 0, bytes.length); //translate bytes of request to string string data = encoding.utf8.getstring(bytes); if (regex.ismatch(data, "...
Writing a WebSocket server in Java - Web APIs
this server conforms to rfc 6455, so it only handles connections from chrome version 16, firefox 11, ie 10 and higher. first steps websockets communicate over a tcp (transmission control protocol) connection. java's serversocket class is located in the java.net package. serversocket constructor: serversocket(int port) when you instantiate the serversocket class, it is bound to the port number you specified by the port argument. ...
Window.mozPaintCount - Web APIs
try to avoid using it. returns the number of times the current document has been painted to the screen in this window. syntax var paintcount = window.mozpaintcount; paintcount stores the window.mozpaintcount property value. ...
Window.name - Web APIs
.name = "other-tab"; </script> <a href="url2" target="other-tab">this link will be opened in the other tab.</a> notes the name of the window is used primarily for setting targets for hyperlinks and forms. browsing contexts do not need to have names. it has also been used in some frameworks for providing cross-domain messaging (e.g., sessionvars and dojo's dojox.io.windowname) as a more secure
alternative to jsonp. modern web applications hosting sensitive data should, however, not rely on window.name for cross-domain messaging but instead utilize the postmessage api. window.name will convert all values to their string representations by using the tostring method. specifications specification status comment html living standardthe definition of 'window.name' in t...
Window.onmozbeforepaint - Web APIs
try to avoid using it. summary an event handler for the mozbeforepaint event. this is used in concert with the window.mozrequestanimationframe() method to perform smooth, synchronized animations from javascript code. syntax window.onmozbeforepaint = funcref; funcref is the handler function. example see window.mozrequestanimationframe() for an example. ...
Window.pkcs11 - Web APIs
try to avoid using it. summary returns the pkcs11 object, which is used to install drivers and other software associated with the pkcs11 protocol. if pkcs11 isn't supported, this property returns null. note: this property has been returned null since gecko 1.9.0.14 (firefox 3.0.14) and removed in gecko 29.0 (firefox 29 / thunderbird 29 / seamonkey 2.26)) for security reasons. for more information on installing pkcs11 modules, see installing pkcs11 modules. ...
Window: popstate event - Web APIs
tack if the history entry being activated was created by a call to history.pushstate() or was affected by a call to history.replacestate(), the popstate event's state property contains a copy of the history entry's state object. these methods and their corresponding events can be used to add data to the history stack which can be used to reconstruct a dynamically generated page, or to otherwise
alter the state of the content being presented while remaining on the same document. note that just calling history.pushstate() or history.replacestate() won't trigger a popstate event. the popstate event will be triggered by doing a browser action such as a click on the back or forward button (or calling history.back() or history.forward() in javascript). browsers tend to handle the popstate event...
Window.routeEvent() - Web APIs
try to avoid using it. the window method routeevent(), which is obsolete and no longer available, used to be called to forward an event to the next object that has asked to capture events. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Worker: message event - Web APIs
bubbles no cancelable no interface messageevent event handler property onmessage examples this code creates a new worker and listens to messages from it using addeventlistener(): const worker = new worker("static/scripts/worker.js"); worker.addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) });
alternatively, it could listen using the onmessage event handler property: const worker = new worker("static/scripts/worker.js"); worker.onmessage = (event) => { console.log(`received message from worker: ${event.data}`) }; the worker posts messages using self.postmessage(): // static/scripts/worker.js self.postmessage('i\'m alive!'); specifications specification status ...
Worker - Web APIs
esenting the code to be called when the messageerror event is raised. methods inherits methods from its parent, eventtarget, and implements methods from abstractworker. worker.postmessage() sends a message — consisting of any javascript object — to the worker's inner scope. worker.terminate() immediately terminates the worker. this does not let worker finish its operations; it is h
alted at once. serviceworker instances do not support this method. events message fires when the worker's parent receives a message from that worker. also available via the onmessage property. messageerror fires when a worker object receives a message that can't be deserialized. also available via the onmessageerror property. rejectionhandled fires every time a promise rejects, regardl...
XMLHttpRequestResponseType - Web APIs
tprequest to deliver arraybuffer objects containing chunks of the incoming data. accessing response during a progress event returns the data received so far. outside the progress event handler, the value of response is always null. you shouldn't use this non-standard (and, as of firefox 68, entirely removed) api; instead, consider using the fetch api with readable streams, which offers a standard
alternative to accessing the response in a streaming fashion. specifications specification status comment xmlhttprequest unknown live standard, latest version ...
XMLSerializer.serializeToString() - Web APIs
processinginstruction attr if any other type is encountered, a typeerror exception is thrown. notes on the resulting xml there are some things worth noting about the xml output by serializetostring(): for xml serializations, element and attr nodes are always serialized with their namespaceuri intact. this may mean that a previously-specified prefix or default namespace may be dropped or
altered. the resulting xml is compatible with the html parser. elements in the html namespace that have no child nodes (thereby representing empty tags) are serialized with both begin and end tags ("<someelement></someelement>") instead of using the empty-element tag ("<someelement/>"). specifications specification status comment dom parsing and serializationthe definitio...
XRBoundedReferenceSpace.boundsGeometry - Web APIs
loor levels using xrboundedreferencespace. the ground is always at y = 0. it's important that your content not be designed to require the user to exit the bounds specified by boundsgeometry. however, if the user's surroundings permit them to move in such a way as to exit the defined bounds, your content must be able to gracefully handle the situation, which is not considered an error condition.
although some samples render a mesh or other shape to display the bounds to the user, in a real-world application, you shouldn't do this. the browser, however, should provide appropriate warnings to the user about any risks (such as the risk that they might run into a physical wall if they keep moving). specifications specification status comment webxr device apithe definiti...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
tion creates an inverse orientation matrix—used to orient the viewer—from the current pitch and yaw values, then uses that matrix as the source of the orientation when calling new xrrigidtransform(). the new xrrigidtransform's reference space is then fetched and returned to the caller. this new reference space is one in which the viewer's position is unchanged, but their orientation has been
altered based on the pitch and yaw values generated from the accumulated mouse inputs. applymousemovement() should be called when drawing a frame, immediately before fetching the viewer's pose using getviewerpose(), and the rendering should be performed in this reference space. you can see code similar to this in use in our broader webxr tutorial article called movement, orientation, and motion. in ...
XRReferenceSpace.onreset - Web APIs
the xrreferencespace interface's onreset event handler property can be set to a function which is called when the xrreferencespace receives a reset event, signaling that the xr device has experienced a discontinuity large enough to require that the position and/or orientation of the origin be significantly
altered to compensate. syntax xrreferencespace.onreset = eventhandler; eventhandler = xrreferencespace.onreset; value an event handler function which will be called whenever the reset event is received by the xrreferencespace. usage notes see the reset event documentation for further details. specifications specification status comment webxr device apithe definition of 'onreset' in that specification. working draft initial definition. ...
XRReferenceSpace: reset event - Web APIs
and orientation. note: a reset event will not occur if the reference space is able to regain tracking of its previous origin, since that means the origin has not been forced to be relocated. this event is only fired when the origin has to be relocated to recover from the tracking loss. manual resets if you've spent any time using a vr headset, you've had times when you've started it up and
although you're facing straight ahead, the headset thinks you're looking at the sky or the floor; or times when you point the hand controller straight forward, but it thinks you're pointing it up and to the right somewhere. when that happens, you typically hold down a button somewhere and it causes the world to resynchronize to the device's current orientation. that works by sending a `reset` event t...
XRReferenceSpaceEvent.transform - Web APIs
em. syntax let refspace = xrreferencespaceevent.transform; value an xrrigidtransform object providing a transform that can be used to convert coordinates from the pre-event coordinate system to the post-event coordinate system. usage notes upon receiving a reset event, you can apply the transform to cached position or orientation information to shift them into the updated coordinate system.
alternatively, you can just discard any cached positional information and recompute from scratch. the approach you take will depend on your needs. for details on what causes a reset event and how to respond, see the reset event's documentation. examples this example handles the reset event by walking through all the objects in a scene, updating each object's position by multiplying it with the eve...
XRSession: end event - Web APIs
terminated the session. bubbles no cancelable no interface xrsessionevent event handler xrsession.onend example to be informed when a webxr session comes to an end, you can add a handler to your xrsession instance using addeventlistener(), like this: xrsession.addeventlistener("end", function(event) { /* the session has shut down */ });
alternatively, you can use the xrsession.onend event handler property to establish a handler for the end event: xrsession.onend = function(event) { /* the session has shut down */ } specifications specification status comment webxr device apithe definition of 'end event' in that specification. working draft initial definition. ...
XRView.eye - Web APIs
r 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. updateinjury() returns true if the eye is still injured or false if the eye has been restored to he
alth by the function,. if the result is false, indicating that the eye is now he
althy, we render the scene for that eye. otherwise, we don't. specifications specification status comment webxr device apithe definition of 'xrview.eye' in that specification. working draft initial definition. ...
XRView.transform - Web APIs
ds repeatedly allocating and deallocating the matrices, and generally reduces overhead by reusing the same matrix for each object rendered. then we iterate over each xrview found in the xrviewerpose's list of views. there will usually be two: one for the left eye and one for the right, but there may be only one if in monoscopic mode. currently, webxr doesn't support more than two views per pose,
although room has been left to extend the specification to support that in the future with some additions to the api. for each view, we obtain its viewport and pass that to webgl using gl.viewport(). for the left eye, this will be the left half of the canvas, while the right eye will use the right half. then we iterate over each object that makes up the scene. each object's model view matrix is com...
XRViewport.y - Web APIs
surface (typically a xrwebgllayer to the bottom edge of the viewport within the surface into which webxr content is to be rendered. the viewport's x property identifies the x component of the origin, and its is given by the width and height properties. syntax y = xrviewport.y; value the offset from the bottom edge of the rendering surface to the bottom edge of the viewport, in pixels. note:
although other web apis typically consider the y axis to begin at the top and grow larger progressing downward, webgl reverses this, with y growing larger as it goes upward on the screen. examples see the main xrviewport page for examples. specifications specification status comment webxr device apithe definition of 'xrviewport.y' in that specification. working dra...
XRWebGLLayer - Web APIs
the xrwebgllayer interface of the webxr device api provides a linkage between the webxr device (or simulated xr device, in the case of an inline session) and a webgl context used to render the scene for display on the device. in particular, it provides access to the webgl framebuffer and viewport to ease access to the context.
although xrwebgllayer is currently the only type of framebuffer layer supported by webgl, it's entirely possible that future updates to the webxr specification may allow for other layer types and corresponding image sources. constructor new xrwebgllayer() creates and returns a new xrwebgllayer object for use by the specified xrsession, using a particular webglrenderingcontext or webgl2renderingcontext as the destination context. properties antialia...
ARIA Screen Reader Implementors Guide - Accessibility
egions: any changes in a region marked with aria-busy="true" should not be added to the queue until that attribute is cleared. politeness (aria-live or from role) takes first precedence,: items should be added to the queue based on their politeness level from the aria-live property or inherited from the role (e.g. role="log" is polite by default). assertive items are first then politeness level.
alternatively, implementations may choose to have a policy of clearing more polite items, e.g. assertive items clear any polite items from the queue. time takes second precedence: prioritize items with the same politeness level according to when the event occurs (earlier events come first). present items of the same politeness level in the order of what occurred first. atomic (aria-atomic="true") r...
Using the aria-valuetext attribute - Accessibility
authors should only set the aria-valuetext attribute when the rendered value cannot be accurately represented as a number. for example, a slider may have rendered values of small, medium, and large. in this case, the values of aria-valuenow could range from 1 through 3, which indicate the position of each value in the value space, but thearia-valuetext would be one of the strings: small, medium, or large. ...
Using the progressbar role - Accessibility
k progresses, the aria-valuenow value has to be updated dynamically to indicate this progress to assistive technology products. if the progressbar is describing the loading progress of a particular region of a page, the author should use aria-describedby to point to the status, and set the aria-busy attribute to true on the region until it is finished loading. it is not possible for the user to
alter the value of a progressbar because it is always readonly. note: assistive technologies generally will render the value of aria-valuenow as a percent of the range between the value of aria-valuemin and aria-valuemax, unless aria-valuetext is specified. it is best to set the values for aria-valuemin, aria-valuemax, and aria-valuenow in a manner that is appropriate for this calculation. note: el...
x-ms-aria-flowfrom - Accessibility
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the 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. this proprietary property is specific to internet explorer and microsoft edge. syntax x-ms-aria-flowfrom="elementid"; value the x-ms-aria-flowfrom property value uses an i...
ARIA: tabpanel role - Accessibility
the aria tabpanel role indicates description an element with the tabpanel role associated roles and attributes aria- keyboard interaction key action tab → ← delete required javascript features include note about semantic
alternatives to using this role or attribute. the first rule of aria use is you can use a native feature with the semantics and behavior you require already built in, instead of re-purposing an element and adding an aria role, state or property to make it accessible, then do so. then post full details in best practices section below. examples fill in a simple example that nicely shows a typical usage of the property, then perhaps some more complex examples. <div role="tabl...
ARIA: cell role - Accessibility
18">rowgroup</td> <td role="cell" aria-rowindex="18">thead</td> </tr> <tr role="row"> <td role="cell" aria-rowindex="24">term</td> <td role="cell" aria-rowindex="24">dt</td> </tr> </tbody> </table> above is the semantic way of writing a table. the aria roles are not necessary if the native semantics of the table, and therefore the table rows, have not been
altered, such as through the display property. added benefits none specifications specification status accessible rich internet applications (wai-aria) 1.1the definition of 'aria cell role' in that specification. recommendation wai-aria authoring practicesthe definition of 'aria cell role' in that specification. working draft ...
ARIA: document role - Accessibility
rmational text goes here.</p> </div> ... <button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it. description by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page. this mode can be
altered through various roles, including the widget and application roles. the document role brings the at back into browse or read mode. generally placed within an application role or other interactive widget role, the document role is used to indicate a section of a complex composit widget that an assistive technology user should read using its browse or virtual reading mode, if available. becau...
ARIA: feed role - Accessibility
to next article. page up: move focus to previous article. control + end: move focus to the first focusable element after the feed. control + home: move focus to the first focusable element before the feed. if a feed is nested within a feed, such as a comments feed within a feed of blog posts, the convention is to tab into the nested feed with the tab key and to provide another key, such as
alt + page down, to navigate from an 'outer' article to the first item in that article's nested feed. navigate between the nested feed and main feed with control + end , moving focus from the inner feed to the next article in the outer feed. wai-aria roles, states, and properties aria-labelled if the feed has no visible title, the feed element has a label specified with aria-label. if it does,...
ARIA: form role - Accessibility
ct, and textarea associated wai-aria roles, states, and properties no role specific states or properties. keyboard interactions no role specific keyboard interactions required javascript features onsubmit the onsubmit event handler handles the event raised when the form is submitted. anything that is not a <form> cannot be submitted, therefore you would have to use javascript to build an
alternative data submission mechanism, for example with xmlhttprequest. examples <div role="form" id="send-comment" aria-label="add a comment"> <label for="username">username</label> <input id="username" name="username" autocomplete="nickname" autocorrect="off" type="text"> <label for="email">email</label> <input id="email" name="email" autocomplete="email" autocapitalize="off" autocorrec...
ARIA: List role - Accessibility
ection role="list"> <div role="listitem">list item 1</div> <div role="listitem">list item 2</div> <div role="listitem">list item 3</div> </section> description any content that consists of an outer container with a list of elements inside it can be identified to assistive technologies using the list and listitem containers respectively. a list must have one or more listitem children, or,
alternatively, have one or more groups as children, with each group having one or more listitems as children. there are no hard and fast rules about which elements you should use to markup the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions. warning: if at all possible in your work, you sh...
ARIA: Main role - Accessibility
be used by assistive technology to quickly identify and navigate to large sections of the document. by classifying and labeling sections of a page, structural information conveyed visually through layout can be represented programmatically. screen readers use landmark roles to provide keyboard navigation to important sections of a page. for those navigating via landmark roles, the main role is an
alternative for "skip to main content" links.there should only be one main landmark role per document. the <main> element has a role of main. developers should always prefer using the correct semantic html element over using aria. documents and applications can be nested in the dom, which may lead to having more than one main element as dom descendants. if this is the case, include aria-owns to ide...
ARIA: button role - Accessibility
es the button following button activation, focus is set depending on the type of action the button performs. for example, if clicking the button opens a dialog, the focus should move to the dialog. if the button closes a dialog, focus should returns to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. if the button
alters the current context, then focus typically remains on the button, such as muting and unmuting an audio file. required javascript features required event handlers buttons can be operated by mouse, touch, and keyboard users. for native html <button> elements, the button's onclick event fires for mouse clicks and when the user presses space or enter while the button has focus. but if another ta...
ARIA: heading role - Accessibility
<div id="container"> <h1>the main page heading</h1> <p>this article is about showing a page structure.</p> <h2>introduction</h2> <p>an introductory text.</p> <h2>chapter 1</h2> <p>text</p> <h3>chapter 1.1</h3> <p>more text in a sub section.</p> ...</div> accessibility concerns if you must use the heading role and aria-level attribute, do not go over level 6 so that you are consistent with html.
although theoretically you can go higher, and some screen readers may support it, the results can be unpredictable with other browser/screen reader combinations. best practices the best way to use this role is to not use it at all, and instead use the native heading tags <h1> through <h6> as shown in the example above. the heading role and aria-level attribute should only be used to retrofit access...
ARIA: textbox role - Accessibility
or a containing element with role combobox has a value for aria-haspopup that matches the role of the element that contains the list of suggested values. aria-multiline attribute if aria-multiline="true" is set, the at informs the user that the textbox supports multi-line input, with the expectation that enter or return will create a line break rather than submitting the form. aria does not
alter the behavior of the element; rather this feature must be controlled by the developer. if false is set, or the the attribute is omitted and defaults to false, the user expectation is that the control is a single line text box, and enter or return submits the form. aria-placeholder attribute represents a hint (word or phrase) to the user about what to enter into the text field. the hint should...
Web applications and ARIA FAQ - Accessibility
h as the w3c's markup validator. the first potential solution to this problem is to avoid placing aria roles and states in your markup directly. instead, use javascript to dynamically add aria to your page, as shown in the answer to can you show me an example of aria in action? above. your page will still be theoretically invalid, but it will correctly pass all static validation checks. another
alternative is to use the html5 doctype, which includes built-in support for aria. the w3c's html5 validator will even find invalid uses of aria in html5 pages for you. how does html5 relate to aria? html5 introduces a number of useful new semantic tags to html. a few of these tags overlap directly with roles available in aria, such as the new <progress> element. in cases where the browser supports...
Architecture - Accessibility
rks the start of a new line. navigating to the next word follows a similar pattern. navigating previous requires returning to the embed character in the parent accessible when the point of regard reaches the end of text in the corresponding child accessible for the embed. see http://svn.gnome.org/viewcvs/lsr/tru...py?view=markup for a bsd implementation. (e) to grab a subtree of content:
although under windows text content is still exposed in leaf nodes of role_text, it is no longer necessary to visit those nodes. therefore for parent nodes that support the hypertext interface, it is more performant to grab the text from the accessibletext interface and then only visit the link children. the hyperlink interface can be used to grab the children. using this technique is about twice as ...
HTML To MSAA - Accessibility
mit" n/a "press" n/a caption bstr role n/a n/a n/a description_for (0x100f), points to table element div bstr role n/a n/a n/a n/a n/a n/a fieldset role_system_ grouping text equivalent from child legend element n/a n/a labelled_by (1003), points to legend element n/a n/a hr role_system_ separator n/a n/a n/a n/a n/a n/a img, input @type=image role_system_ graphic from @
alt attribute, empty @
alt attribute means name can't be calculated at all n/a state_system_ animated if image has more than one frame n/a "showlongdesc" if @longdesc attribute is presented n/a if @usemap attribute is used then image accessible has children for each map item input @type=button, submit, reset role_system_ pushbutton from @value attribute, @
alt attribute, default label, @src attribute...
Mobile accessibility checklist - Accessibility
rd controls such as links, buttons, and form fields are focusable by default. non-standard controls must have an appropriate aria role assigned to them, such as button, link, or checkbox. focus should be handled in a logical order and consistent manner. text equivalents text equivalent must be provided for every non-strictly presentational non-text element within the app. use
alt and title where appropriate (see steve faulkner's post about using the html title attribute for a good guide.) if the above attributes are not applicable, use appropriate aria states and properties such as aria-label, aria-labelledby, or aria-describedby. images of text must be avoided. all user interface components with visible text (or image of text) as labels must have the same text ...
Accessibility
help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. accessible multimedia another category of content that can create accessibility problems is multimedia — video, audio, and image content need to be given proper textual
alternatives so they can be understood by assistive technologies and their users. this article shows how. mobile accessibility with web access on mobile devices being so popular, and popular platforms such as ios and android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. this article looks at mobile-specific accessibil...
:-moz-broken - CSS: Cascading Style Sheets
the :-moz-broken css pseudo-class is a mozilla extension that matches elements representing broken image links. note: this selector is mainly intended to be used by theme developers. syntax :-moz-broken examples html <img src="broken.jpg"
alt="this image is broken. :-("> css :-moz-broken { background: bisque; padding: 8px; } result specifications not part of any standard. ...
:-moz-window-inactive - CSS: Cascading Style Sheets
sion that matches any element while it's in an inactive window. :-moz-window-inactive works in content html documents, too. note: prior to the addition of this pseudo-class, giving different styles to background windows was achieved by setting an attribute (active="true") on the top-level xul chrome window. this attribute is no longer used. syntax :-moz-window-inactive examples this example
alters the appearance of a box's background depending on whether its window is active or not. html <div id="mybox"> <p>this is a box!</p> </div> css #mybox { background: linear-gradient(to bottom, yellow, cyan); width: 200px; height: 200px; } #mybox:-moz-window-inactive { background: cyan; } result the result of this code is shown below. you can view this as a separate page as well. ...
::backdrop - CSS: Cascading Style Sheets
le, the backdrop style used when a video is shifted to full-screen mode is configured to be a grey-blue color rather than the black it defaults to in most browsers. 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. normally that area is black, but its appearance has been
altered by the css above. you can see this example in action or view or remix the code on glitch. specifications specification status comment fullscreen apithe definition of '::backdrop' in that specification. living standard initial definition. ...
::placeholder - CSS: Cascading Style Sheets
1.4 explanations understanding success criterion 1.4.3 | w3c understanding wcag 2.0 usability placeholder text with sufficient color contrast may be interpreted as entered input. placeholder text will also disappear when a person enters content into an <input> element. both of these circumstances can interfere with successful form completion, especially for people with cognitive concerns. an
alternate approach to providing placeholder information is to include it outside of the input in close visual proximity, then use aria-describedby to programmatically associate the <input> with its hint. with this implementation, the hint content is available even if information is entered into the input field, and the input appears free of preexisting input when the page is loaded. most screen read...
:nth-child() - CSS: Cascading Style Sheets
(n+7) represents the seventh and all following elements: 7 [=0+7], 8 [=1+7], 9 [=2+7], etc. :nth-child(3n+4) represents elements 4 [=(3×0)+4], 7 [=(3×1)+4], 10 [=(3×2)+4], 13 [=(3×3)+4], etc. :nth-child(-n+3) represents the first three elements. [=-0+3, -1+3, -2+3] p:nth-child(n) represents every <p> element in a group of siblings. this selects the same elements as a simple p selector (
although with a higher specificity). p:nth-child(1) or p:nth-child(0n+1) represents every <p> that is the first element in a group of siblings. this is the same as the :first-child selector (and has the same specificity). p:nth-child(n+8):nth-child(-n+15) represents the eighth through the fifteenth <p> elements of a group of siblings. detailed example html <h3><code>span:nth-child(2n+1)</c...
:placeholder-shown - CSS: Cascading Style Sheets
der styles when the placeholder is shown. html <input placeholder="type something here!"> css input { border: 1px solid black; padding: 3px; } input:placeholder-shown { border-color: teal; color: purple; font-style: italic; } result overflowing text when form fields are too small, placeholder text can get cropped in an undesirable way. 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. html <form id="test"> <p> ...
:visited - CSS: Cascading Style Sheets
r-right-color, border-top-color, column-rule-color, outline-color, text-decoration-color, and text-emphasis-color. allowable svg attributes are fill and stroke. the alpha component of the allowed styles will be ignored. the alpha component of the element's non-:visited state will be used instead, except when that component is 0, in which case the style set in :visited will be ignored entirely.
although these styles can be change the appearance of colors to the end user, the window.getcomputedstyle method will lie and always return the value of the non-:visited color. note: for more information on these limitations and the reasons behind them, see privacy and the :visited selector. syntax :visited examples properties that would otherwise have no color or be transparent cannot be mod...
:where() - CSS: Cascading Style Sheets
a simple selector? footer a { color: blue; } this won't work for the red links, because the selectors inside :is() count towards the specificity of the overall selector, and class selectors have a higher specificity than element selectors. however, selectors inside :where() have specificity 0, so the orange footer link will be overidden by our 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+. in other versions of firefox it is behind a pref — layout.css.is-where-selectors.enabled). note: you can also find this example on github; see is-where. syntax :where( <complex-selector-list> )where <complex-selector-list> = <complex-selector>#where <complex-selector> ...
negative - CSS: Cascading Style Sheets
syntax /* <symbol> values */ negative: "-"; /* prepends '-' if value is negative */ negative: "(" ")"; /* surrounds value by '(' and ')' if it is negative */ values first <symbol> this symbol will be prepended to the representation when the counter is negative. second <symbol> if present, this symbol will be appended to the representation when the counter is negative. ...
system - CSS: Cascading Style Sheets
ne additive tuple, or else the counter style rule will not be valid. an additive tuple is similar to a composite counter symbol, which is made up of two parts: a normal counter symbol and a non-negative integer weight. the additive tuples must be specified in the descending order of their weights or the system is invalid. extends allows authors to use the algorithm of another counter style, but
alter its other aspects. if a counter style rule is using the extends system, any unspecified descriptors, and their values will be taken from the extended counter style specified. if the specified counter style name in extends, is not a currently defined counter style name, it will instead extend from the decimal counter style. it must not contain a symbols or additive-symbols descriptor, or else...
@counter-style - CSS: Cascading Style Sheets
the @counter-style css at-rule lets you define counter styles that are not part of the predefined set of styles. a @counter-style rule defines how to convert a counter value into a string representation. @counter-style thumbs { system: cyclic; symbols: "\1f44d"; suffix: " "; } ul { list-style: thumbs; } the initial version of css defined a set of useful counter styles. however,
although more styles were added to this set of predefined styles over the years, this system proved too restrictive to fulfill the needs of worldwide typography. the @counter-style at-rule addresses this shortcoming in an open-ended manner, by allowing authors to define their own counter styles when the pre-defined styles aren't fitting their needs. syntax descriptors each @counter-style is identified by...
font-weight - CSS: Cascading Style Sheets
der than (or as bold as) lower numbers. certain commonly used values correspond to common weight names, as described in the common weight name mapping section below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values,
although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts. css fonts level 4 extends the syntax to accept any number between 1 and 1000, inclusive, and introduces variable fonts, which can make use of this much finer-grained range of font weights. common weight name mapping the numerical values 100 to 900 roughly correspond to the following common wei...
-webkit-device-pixel-ratio - CSS: Cascading Style Sheets
the -webkit-device-pixel-ratio is a non-standard boolean css media feature which is an
alternative to the standard resolution media feature. note: this media feature is a webkit feature. if possible, use the resolution media feature query instead. syntax the -webkit-device-pixel-ratio feature is specified as a <number> value. it is a range feature, meaning that you can also use the prefixed -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio variants to query minimum and maximum values, respectively. values <number> the number of device pixels used to represent each css px.
although the value is a <number>, and thus doesn't syntactically allow units, its implicit unit is dppx. implementation /* a unit of "dppx" is implied: */ @media (-webkit-min-device-pi...
any-pointer - CSS: Cascading Style Sheets
nstead. syntax the any-pointer feature is specified as a keyword value chosen from the list below. none no pointing device is available. coarse at least one input mechanism includes a pointing device of limited accuracy. fine at least one input mechanism includes an accurate pointing device. note: more than one value can match if the available devices have different characteristics,
although none only matches when none of them are pointing devices. examples this example creates a small checkbox for users with at least one fine pointer and a large checkbox for users with at least one coarse pointer. the big checkbox takes precedence because it is declared after the small one. html <input id="test" type="checkbox" /> <label for="test">look at me!</label> css input[type="che...
forced-colors - CSS: Cascading Style Sheets
mphasis-color border-color outline-color column-rule-color scrollbar-color -webkit-tap-highlight-color box-shadow text-shadow you can use system color keywords with any property other than those listed above, to ensure that the rest of the page integrates with the restricted color palette available in forced colors mode. user preferences currently no user agent implements this feature,
although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system in use. examples note: no browser currently implements this feature so the following example will not work. this example has an annoying color palette by default. this example does not take advantage of the colors...
prefers-color-scheme - CSS: Cascading Style Sheets
(any other value causes firefox to return light.) the prefers-color-scheme css media feature is used to detect if the user has requested the system use a light or dark color theme. syntax light indicates that user has notified the system that they prefer an interface that has a light theme, or has not expressed an active preference. ...
prefers-reduced-data - CSS: Cascading Style Sheets
fics are subject to change. the prefers-reduced-data css media feature is used to detect if the user has requested the web content that consumes less internet traffic. syntax no-preference indicates that the user has made no preference known to the system. this keyword value evaluates as false in the boolean context. reduce indicates that user has expressed the preference for lightweight
alternate content. user preferences currently no user agent implements this feature,
although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating system. examples note: no browser currently implements this feature so the following example will not work. in this example the mont...
prefers-reduced-motion - CSS: Cascading Style Sheets
em. reduce indicates that user has notified the system that they prefer an interface that removes or replaces the types of motion-based animation that trigger discomfort for those with vestibular motion disorders. user preferences for firefox, the reduce request is honoured if: in gtk/gnome: gnome tweaks > general tab (or appearance, depending on version) > animations is turned off.
alternatively, add gtk-enable-animations = false to the [settings] block of the gtk 3 configuration file. in windows 10: settings > ease of access > display > show animations in windows. in windows 7: control panel > ease of access > make the computer easier to see > turn off all unnecessary animations (when possible). in macos: system preferences > accessibility > display > reduce motion. i...
prefers-reduced-transparency - CSS: Cascading Style Sheets
sed across elements. syntax no-preference indicates that the user has made no preference known to the system. this keyword value evaluates as false in the boolean context. reduce indicates that user has notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects. user preferences currently no user agent implements this feature,
although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems. examples note: no browser currently implements this feature so the following example will not work. this example has an annoying transparency effect by default. html <div class="transparency">transparent box</...
scan - CSS: Cascading Style Sheets
utilized by the output device. the word scanning used in this context does not refer to an image scanner, such as one used to digitize a photograph. rather, it means the process by which an image is painted onto a television screen (or other device). syntax the scan feature is specified as a single keyword value chosen from the list below. interlace the device draws odd lines and even lines
alternately. some televisions use interlaced scanning. progressive the device draws all lines in sequence. all computer screens use progressive scanning. examples html <p>if your screen uses interlaced rendering, this text should be in a sans-serif font. if your screen uses progressive scanning, you should see a serif font.</p> css p { font-family: cursive; } @media (scan: interlace...
update - CSS: Cascading Style Sheets
not unusually constrained in speed, so regularly-updating things like css animations can be used. example: computer screens. examples html <p>if this text animates for you, you are using a fast-updating device.</p> css @keyframes jiggle { from { transform: translatey(0); } to { transform: translatey(25px); } } @media (update: fast) { p { animation: 1s jiggle linear
alternate infinite; } } result specifications specification status comment media queries level 4the definition of 'update' in that specification. candidate recommendation initial definition. ...
@supports - CSS: Cascading Style Sheets
:is()) /* this rule won't be applied in browsers which don't support :is() */ :is(ul, ol) > li { … /* css applied when the :is(…) selector is supported */ } @supports not selector(:is(a,...
orientation - CSS: Cascading Style Sheets
tation: portrait; orientation: landscape; for a ua/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change. syntax values auto the user agent will set the document's orientation automatically, typically based on the device's orientation as determined by an accelerometer (if the device has such a hardware sensor),
although there is often a user-controlled, os-level "lock orientation" setting that will trump the accelerometer reading. portrait the document should be locked into portrait orientation. landscape the document should be locked into landscape orientation. formal definition related at-rule@viewportinitial valueautopercentagesrefer to the size of bounding boxcomputed valueas specified formal sy...
At-rules - CSS: Cascading Style Sheets
l screen devices. (currently at the working draft stage) @counter-style — defines specific counter styles that are not part of the predefined set of styles. (at the candidate recommendation stage, but only implemented in gecko as of writing) @font-feature-values (plus @swash, @ornaments, @annotation, @stylistic, @styleset and @character-variant) — define common names in font-variant-
alternates for feature activated differently in opentype. (at the candidate recommendation stage, but only implemented in gecko as of writing) conditional group rules much like the values of properties, each at-rule has a different syntax. nevertheless, several of them can be grouped into a special category named conditional group rules. these statements share a common syntax and each of them...
CSS Animations tips and tricks - CSS: Cascading Style Sheets
r("click", play, false); result stopping an animation simply removing the animation-name applied to an element will make it jump or cut to its next state. if instead you'd like the animation to complete and then come to a stop you have to try a different approach. the main tricks are: make your animation as self-contained as possible. this means you should not rely on animation-direction:
alternate. instead you should explicitly write a keyframe animation that goes through the full animation in one forward repetition. use javascript and clear the animation being used when the animationiteration event fires. the following demo shows how you'd achieve the aforementioned javascript technique: .slidein { animation-duration: 5s; animation-name: slidein; animation-iteration-count:...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
properties. if the box-sizing property is set to border-box, the border area's size can be explicitly defined with the width, min-width, max-width, height, min-height, and max-height properties. when there is a background (background-color or background-image) set on a box, it extends to the outer edge of the border (i.e. extends underneath the border in z-ordering). this default behavior can be
altered with the background-clip css property. the margin area, bounded by the margin edge, extends the border area to include an empty area used to separate the element from its neighbors. its dimensions are the margin-box width and the margin-box height. the size of the margin area is determined by the margin-top, margin-right, margin-bottom, margin-left, and shorthand margin properties. when mar...
Using feature queries - CSS: Cascading Style Sheets
float. what we need is a way to remove the width if display: grid is supported. this is exactly the situation feature queries solve. we can set the width back to auto if grid is supported. in the above scenario, it doesn't matter that ie11 doesn't support feature queries or css grid — it would get the floated version anyway, which is then overwritten by browsers that do support grid. an
alternate way to write the above code is to wrap all of the grid code in a feature query as follows. this may mean you have a little more code but comes with the benefit of being able to test the fallback by misspelling the property or value name. you can try this in the live example above by changing display: grid in the @supports rule to display: grip or similar. summary feature queries can he...
CSS Containment - CSS: Cascading Style Sheets
case. the browser can then use this information to make decisions about how to render the content. for example, it might not render articles that are outside the viewable area. if we give each <article> the contain property with a value of content, when new elements are inserted the browser understands it does not need to relayout or repaint any area outside of the containing element's subtree,
although if the <article> is styled such that its size depends on its contents (e.g. with height: auto), then the browser may need to account for its size changing). we have told it by way of the contain property that each article is independent. the content value is shorthand for contain: layout paint. it tells the browser that the internal layout of the element is totally separate from the rest o...
Flow Layout and Overflow - CSS: Cascading Style Sheets
verflowing in the inline direction. it takes one of two values clip, in which case content is clipped when it overflows, this is the initial value and therefore the default behaviour. we also have ellipsis which renders an ellipsis, which may be replaced with a better character for the language or writing mode in use. block-axis overflow there is also a proposal for a block-overflow property,
although at the time of writing the name is still up for discussion. this proposal would enable the adding of an ellipsis when text overflows in the block dimension. this is useful in the situation where you have a listing of articles, for example, and you display the listings in fixed height boxes which only take a limited amount of text. it may not be obvious to the reader that there is more conte...
Using media queries - CSS: Cascading Style Sheets
media type. , (comma) commas are used to combine multiple media queries into a single rule. each query in a comma-separated list is treated separately from the others. thus, if any of the queries in a list is true, the entire media statement returns true. in other words, lists behave like a logical or operator. targeting media types media types describe the general category of a given device.
although websites are commonly designed with screens in mind, you may want to create styles that target special devices such as printers or audio-based screenreaders. for example, this css targets printers: @media print { ... } you can also target multiple devices. for instance, this @media rule uses two media queries to target both screen and print devices: @media screen, print { ... } see media...
Mozilla CSS extensions - CSS: Cascading Style Sheets
aemo-classic -moz-device-pixel-ratio -moz-os-version -moz-scrollbar-end-backward -moz-scrollbar-end-forward -moz-scrollbar-start-backward -moz-scrollbar-start-forward -moz-scrollbar-thumb-proportional -moz-touch-enabled -moz-windows-accent-color-in-titlebar -moz-windows-classic -moz-windows-compositor -moz-windows-default-theme -moz-windows-glass -moz-windows-theme other -moz-
alt-content (see bug 11011) ...
CSS reference - CSS: Cascading Style Sheets
sflex-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-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont-weight (@font-face)format()fr<frequency><frequency-percentage>:fullscreenggapgrad<gradient>grayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid...
Scaling of SVG backgrounds - CSS: Cascading Style Sheets
background-size: contain; the rendered output looks like this: notice that the image is sized to fit the smallest dimension while preserving the 1:1 aspect ratio. cover case background: url(no-dimensions-1x1-ratio.svg); background-size: cover; the rendered output looks like this: here, the image is sized so that it fills the largest dimension. the 1:1 aspect ratio has been preserved,
although with this source image, that can be difficult to see. automatic sizing using "auto" for both dimensions if background-size is set to auto or auto auto, rule 2 says that rendering must preserve any intrinsic ratio that's provided. source: no dimensions or intrinsic ratio when no intrinsic ratio or dimensions are specified by the source image, rule 4 takes effect, and the image is rendered...
WebKit CSS extensions - CSS: Cascading Style Sheets
ther than -ms- for interopability reasons as well. ** these values are supported even though they are not standard and are not on track to becoming standard. *** use flex-box properties instead. deprecated -webkit- properties the following properties were once supported with the -webkit- prefix but are no longer supported in evergreen browsers, with or without the -webkit- prefix. ...
background-color - CSS: Cascading Style Sheets
% transparent */ /* special keyword values */ background-color: currentcolor; background-color: transparent; /* global values */ background-color: inherit; background-color: initial; background-color: unset; the background-color property is specified as a single <color> value. values <color> the uniform color of the background. it is rendered behind any background-image that is specified,
although the color will still be visible through any transparency in the image. 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. color contrast ratio is determined by comparing the luminance of the...
border-image - CSS: Cascading Style Sheets
lement's regular border. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: you should specify a separate border-style in case the border image fails to load. indeed, this is required according to the specification,
although not all browsers implement this requirement. 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...
box-sizing - CSS: Cascading Style Sheets
= border + padding + width of the content, and height = border + padding + height of the content. formal definition initial valuecontent-boxapplies toall elements that accept width or heightinheritednocomputed valueas specifiedanimation typediscrete formal syntax content-box | border-box examples box sizes with content-box and border-box this example shows how different box-sizing values
alter the rendered size of two otherwise identical elements. 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)...
caret-color - CSS: Cascading Style Sheets
property sets the color of the insertion caret, the visible marker where the next character typed will be inserted. this is sometimes referred to as the text input cursor. the caret appears in elements such as <input> or those with the contenteditable attribute. the caret is typically a thin vertical line that flashes to help make it more noticeable. by default, it is black, but its color can be
altered with this property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that the insertion caret is only one type of caret. for example, many browsers have a “navigation caret,” which acts similarly to an inser...
clip-path - CSS: Cascading Style Sheets
th: 0; height: 0; margin: 0; } pre { margin-bottom: 0; } svg { margin: 1em; font-family: sans-serif; width: 192px; height: 192px; } svg rect { stroke: pink; stroke-width: 16px; } svg text { fill: pink; text-anchor: middle; } svg text.em { font-style: italic; } complete example html <img id="clipped" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg"
alt="mdn logo"> <svg height="0" width="0"> <defs> <clippath id="cross"> <rect y="110" x="137" width="90" height="90"/> <rect x="0" y="110" width="90" height="90"/> <rect x="137" y="0" width="90" height="90"/> <rect x="0" y="0" width="90" height="90"/> </clippath> </defs> </svg> <select id="clippath"> <option value="none">none</option> <option value="circle(100...
color-adjust - CSS: Cascading Style Sheets
ut for the device it's being rendered for. for example, when printing, a browser might opt to leave out all background images and to adjust text colors to be sure the contrast is optimized for reading on white paper. this is the default. exact the element's content has been specifically and carefully crafted to use colors, images, and styles in a thoughtful and/or important way, such that being
altered by the browser might actually make things worse rather than better. the appearance of the content should not be changed except by the user's request. for example, a page might include a list of information with rows whose background colors
alternate between white and a light grey. removing the background color would decrease the legibility of the content. usage notes there are a number of ...
cursor - CSS: Cascading Style Sheets
ne-resize nw-resize se-resize sw-resize ew-resize bidirectional resize cursor. ns-resize nesw-resize nwse-resize zooming zoom-in something can be zoomed (magnified) in or out. zoom-out usage notes
although the specification does not define any size limitations for cursor, individual user agents may choose to do so. cursor changes using images which are outside the size range supported by the browser will generally just be ignored. check the browser compatibility table for any notes on cursor size limits. formal definition initial valueautoapplies toall elementsinheritedyescomputed valueas s...
<easing-function> - CSS: Cascading Style Sheets
steps(3, start)</option> <option>steps(4)</option> </select> </li> </ul> css body > div { position: relative; height: 100px; } div > div { position: absolute; width: 50px; height: 50px; background-color: blue; background-image: radial-gradient(circle at 10px 10px, rgba(25,255,255,0.8),rgba(25,255,255,0.4)); border-radius: 50%; top: 25px; animation: 1.5s infinite
alternate; } @keyframes move-right { from { left: 10%; } to { left: 90%; } } li { display: flex; align-items: center; justify-content: center; margin-bottom: 20px; } javascript const selectelem = document.queryselector('select'); const startbtn = document.queryselector('button'); const divelem = document.queryselector('div > div'); startbtn.addeventlistener('click', () =...
font-family - CSS: Cascading Style Sheets
pecifies a prioritized list of one or more font family names and/or generic family names for the selected element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. values are separated by commas to indicate that they are
alternatives. the browser will select the first font in the list that is installed or that can be downloaded using a @font-face at-rule. it is often convenient to use the shorthand property font to set font-size and other font related properties all at once. you should always include at least one generic family name in a font-family list, since there's no guarantee that any given font is available.
font-weight - CSS: Cascading Style Sheets
der than (or as bold as) lower numbers. certain commonly used values correspond to common weight names, as described in the common weight name mapping section below. in earlier versions of the font-weight specification, the property accepts only keyword values and the numeric values 100, 200, 300, 400, 500, 600, 700, 800, and 900; non-variable fonts can only really make use of these set values,
although fine-grained values (e.g. 451) will be translated to one of these values for non-variable fonts using the fallback weights system. css fonts level 4 extends the syntax to accept any number between 1 and 1000 and introduces variable fonts, which can make use of this much finer-grained range of font weights. fallback weights if the exact weight given is unavailable, then the following rule ...
font - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with any shorthand property, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties). though not directly settable by font, the longhands font-size-adjust and font-kerning are also reset to their initial values. ...
<frequency-percentage> - CSS: Cascading Style Sheets
12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 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>. specifications specification status comment css values and units module level 4the definition of '<frequency-percentage>' in that specification. editor's draft css values and units module level 3the definition of '<frequency-percentage>' in that specification. candidate recom...
image-set() - CSS: Cascading Style Sheets
<resolution> units include x or dppx, for dots per pixel unit, dpi, for dots per inch, and dpcm for dots per centimeter. every image within an image-set() must have a unique resolution. examples background-image: image-set( "cat.png" 1x, "cat-2x.png" 2x, "cat-print.png" 600dpi); this example shows how to use image-set() to provide two
alternative background-image options, chosen depending on the resolution needed: a normal version and a high-resolution version. accessibility concerns browsers do not provide any special information on background images to assistive technology. this is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. if the image c...
<length> - CSS: Cascading Style Sheets
see <length-percentage>. syntax the <length> data type consists of a <number> followed by one of the units listed below. as with all css dimensions, there is no space between the unit literal and the number. ...
letter-spacing - CSS: Cascading Style Sheets
examples and send us a pull request. syntax /* keyword value */ letter-spacing: normal; /* <length> values */ letter-spacing: 0.3em; letter-spacing: 3px; letter-spacing: .3px; /* global values */ letter-spacing: inherit; letter-spacing: initial; letter-spacing: unset; values normal the normal letter spacing for the current font. unlike a value of 0, this keyword allows the user agent to
alter the space between characters in order to justify text. <length> specifies extra inter-character space in addition to the default space between characters. values may be negative, but there may be implementation-specific limits. user agents may not further increase or decrease the inter-character space in order to justify text. accessibility concerns a large positive or negative letter-spac...
max-block-size - CSS: Cascading Style Sheets
ertical sizes, and if you need to set lengths based on the size of your text content, you need to be able to do so with the writing direction in mind. any time you would normally use max-height or max-width, you should instead use max-block-size to set the maximum "height" of the content (even though this may not be a vertical value) and max-inline-size to set the maximum "width" of the content (
although this may instead be vertical rather than horizontal). see the example in writing-mode, which shows the different writing modes in action. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* <length> values *...
object-position - CSS: Cascading Style Sheets
| center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]where <length-percentage> = <length> | <percentage> examples positioning image content html here we see html that includes two <img> elements, each displaying the mdn logo. <img id="object-position-1" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg"
alt="mdn logo"/> <img id="object-position-2" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg"
alt="mdn logo"/> css the css includes default styling for the <img> element itself, as well as separate styles for each of the two images. img { width: 300px; height: 250px; border: 1px solid black; background-color: silver; margin-right: 1em; object-fit: none; } #object-positio...
offset-distance - CSS: Cascading Style Sheets
on aspect in css motion path typically comes from animating the offset-distance property. if you want to animate an element along its full path, you would define its offset-path and then set up an animation that takes the offset-distance from 0% to 100%. html <div id="motion-demo"></div> css #motion-demo { offset-path: path('m20,20 c20,100 200,0 200,100'); animation: move 3000ms infinite
alternate ease-in-out; width: 40px; height: 40px; background: cyan; } @keyframes move { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } } result specifications specification status comment motion path module level 1the definition of 'offset-distance' in that specification. working draft initial definition ...
offset-rotate - CSS: Cascading Style Sheets
pecifiedanimation typeas <angle>, <basic-shape> or <path()> formal syntax [ auto | reverse ] | <angle> examples setting element orientation along its offset path html <div></div> <div></div> <div></div> css div { width: 40px; height: 40px; background: #2bc4a2; margin: 20px; clip-path: polygon(0% 0%, 70% 0%, 100% 50%, 70% 100%, 0% 100%, 30% 50%); animation: move 5000ms infinite
alternate ease-in-out; offset-path: path('m20,20 c20,50 180,-10 180,20'); } div:nth-child(1) { offset-rotate: auto; } div:nth-child(2) { offset-rotate: auto 90deg; } div:nth-child(3) { offset-rotate: 30deg; } @keyframes move { 100% { offset-distance: 100%; } } result specifications specification status comment motion path module level 1the definition...
opacity - CSS: Cascading Style Sheets
sy 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="opacity"> 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 definitio...
outline-color - CSS: Cascading Style Sheets
performs a color inversion of the background. note that browsers are not required to support this value; if they don't, this keyword is considered invalid. description an outline is a line that is drawn around an element, outside the border. unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. the border, on the other hand, will actually
alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap). it is often more convenient to use the shorthand property outline when defining the appearance of an outline. accessibility concerns custom focus styles commonly involve making adjustments to the outline property. if the color of the outline is adjusted, it is important to en...
outline - CSS: Cascading Style Sheets
one if absent. see outline-style. <'outline-width'> sets the thickness of the outline. defaults to medium if absent. see outline-width. description borders and outlines are very similar. however, outlines differ from borders in the following ways: outlines never take up space, as they are drawn outside of an element's content. according to the spec, outlines don't have to be rectangular,
although they usually are. as with all shorthand properties, any omitted sub-values will be set to their initial value. accessibility concerns assigning outline a value of 0 or none will remove the browser's default focus style. if an element can be interacted with it must have a visible focus indicator. provide obvious focus styling if the default focus style is removed. how to design useful ...
<percentage> - CSS: Cascading Style Sheets
note: only calculated values can be inherited. thus, even if a percentage value is used on the parent property, a real value (such as a width in pixels for a <length> value) will be accessible on the inherited property, not the percentage value. syntax the <percentage> data type consists of a <number> followed by the percentage sign (%). optionally, it may be preceded by a single + or - sign,
although negative values are not valid for all properties. as with all css dimensions, there is no space between the symbol and the number. interpolation when animated, values of the <percentage> data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. examples width and margin-left <div style=...
repeating-linear-gradient() - CSS: Cascading Style Sheets
stop. if the first color does not have a color-stop-length, the color-stop-length defaults to 0. with each repetition, the positions of the color stops are shifted by a multiple of the length of the basic linear gradient. thus, the position of each ending color stop coincides with a starting color stop; if the color values are different, this will result in a sharp visual transition. this can be
altered with repeating the first color again as the last color. as with any gradient, a repeating linear gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. its concrete size will match the size of the element it applies to. because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. for this reason, repe...
<resolution> - CSS: Cascading Style Sheets
er. as 1 inch is 2.54 cm, 1dpi ≈ 0.39dpcm. dpcm represents the number of dots per centimeter. as 1 inch is 2.54 cm, 1dpcm ≈ 2.54dpi. dppx represents the number of dots per px unit. due to the 1:96 fixed ratio of css in to css px, 1dppx is equivalent to 96dpi, which corresponds to the default resolution of images displayed in css as defined by image-resolution. x alias for dppx. note:
although the number 0 is always the same regardless of unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0dpi, 0dpcm, or 0dppx. examples use in a media query @media print and (min-resolution: 300dpi) { ... } valid resolutions 96dpi 50.82dpcm 3dppx invalid resolutions 72 dpi spaces are not allowed between the number and the unit. ten dpi the number ...
revert - CSS: Cascading Style Sheets
th initial, which uses the initial value defined on a per-property basis by the css specifications. in contrast, user-agent stylesheets set default values on the basis of css selectors. for example, the initial value for the display property is inline, whereas a normal user-agent stylesheet sets the default display value of <div>s to block, of <table>s to table, etc. examples revert vs unset
although revert and unset are similar they differ for some properties for some elements. so in the below example, we set custom font-weight in a global stylesheet, but then try to unset and revert. unset will keep the text normal because this is an initial value for font-weight property. revert will revert to bold because this is a default value for headers in most browsers. h3 { font-weight: nor...
symbols() - CSS: Cascading Style Sheets
syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: the system cycles through the given values in the order of their definition, and returns to the start when it reaches the end. ...
text-decoration-line - CSS: Cascading Style Sheets
et; the text-decoration-line property is specified as none, or one or more space-separated values from the list below. values none produces no text decoration. underline each line of text has a decorative line beneath it. overline each line of text has a decorative line above it. line-through each line of text has a decorative line going through its middle. blink the text blinks (
alternates between visible and invisible). conforming user agents may simply not blink the text. this value is deprecated in favor of css animations. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax none | [ underline | overline | line-through | blink ] | spellin...
text-justify - CSS: Cascading Style Sheets
justify; is set on an element. 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. values none the text justification is turned off. this has the same effect as not setting text-align at all,
although it is useful if you need to turn justification on and off for some reason. auto the browser chooses the best type of justification for the current situation based on a balance between performance and quality, but also on what is most appropriate for the language of the text (e.g., english, cjk languages, etc.). this is the default justification used if text-justify is not set at all. inte...
text-shadow - CSS: Cascading Style Sheets
should define it explicitly. <offset-x> <offset-y> required. these <length> values specify the shadow's distance from the text. <offset-x> specifies the horizontal distance; a negative value places the shadow to the left of the text. <offset-y> specifies the vertical distance; a negative value places the shadow above the text. if both values are 0, the shadow is placed directly behind the text,
although it may be partly visible due to the effect of <blur-radius>. <blur-radius> optional. this is a <length> value. the higher the value, the bigger the blur; the shadow becomes wider and lighter. if not specified, it defaults to 0. formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valuea color plus three absolu...
<time-percentage> - CSS: Cascading Style Sheets
n 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. +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. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications ...
transform-box - CSS: Cascading Style Sheets
et a very different effect. svg{ width:80vh; border:1px solid #d9d9d9; position:absolute; margin: auto; top: 0; right: 0; bottom: 0; left: 0; } #box{ transform-origin:50% 50%; /*+++++++++++++++++++++++++++*/ /* if i remove this rule the pen won't work properly on chrome for mac, ff, safari will still work properly on chrome for pc & opera*/ transform-box: fill-box; /*
alternatively i can use transform-origin:15px 15px;*/ /*+++++++++++++++++++++++++++*/ animation: rotatebox 3s linear infinite; } @keyframes rotatebox { to { transform: rotate(360deg); } full credit for this example goes to pogany; see this codepen for a live version. specifications specification status comment css transforms level 1the definition of 'trans...
matrix3d() - CSS: Cascading Style Sheets
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, ...
translateZ() - CSS: Cascading Style Sheets
dinates on ℝℙ3 this transformation applies to the 3d space and can't be represented on the plane. a translation is not a linear transformation in ℝ3 and can't be represented using a cartesian-coordinate matrix. 10000100001t0001 examples in this example, two boxes are created. one is positioned normally on the page, without being translated at all. the second is
altered by applying perspective to create a 3d space, then moved towards the user. html <div>static</div> <div class="moved">moved</div> css div { position: relative; width: 60px; height: 60px; left: 100px; background-color: skyblue; } .moved { transform: perspective(500px) translatez(200px); background-color: pink; } what really matters here is the class "moved"; let's take a lo...
transform-style - CSS: Cascading Style Sheets
formal syntax flat | preserve-3d examples transform style demonstration in this example we have a 3d cube created using transforms. the parent container of the cube faces has transform-style: preserve-3d set on it by default, so it is transformed in the 3d space and you can see it as intended. we also provide a checkbox allowing you to toggle between this, and transform-style: flat. in this
alternative state, the cube faces are all flattened onto the plane of their parent, and you might not be able to see them at all, depending on the browser you are using. html <section id="example-element"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> <div class="face left">4</div> <div class="face top">5</div> <div class="face bottom">6<...
url() - CSS: Cascading Style Sheets
age.png") <css_property>: url('https://example.com/image.png') <css_property>: url(https://example.com/image.png) path references the id of an svg shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <url-modifier> in the future, the url() function may support specifying a modifier, an identifier or a functional notation, which
alters the meaning of the url string.this is not supported and not fully defined in the specification. formal syntax url( <string> <url-modifier>* ) examples content property 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>...
visibility - CSS: Cascading Style Sheets
row(s) or column(s) are present. 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. collapsed flex items are hidden, and the space they would have occupied is removed. for xul elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size,
although margins still take effect. for other elements, collapse is treated the same as hidden. accessibility concerns using a visibility value of hidden on an element will remove it from the accessibility tree. this will cause the element and all its descendant elements to no longer be announced by screen reading technology. interpolation visibility values are interpolable between visible and ...
Getting Started - Developer guides
vascript function will handle the response, by setting the onreadystatechange property of the object and naming it after the function to call when the request changes state, like this: httprequest.onreadystatechange = nameofthefunction; note that there are no parentheses or parameters after the function name, because you're assigning a reference to the function, rather than actually calling it.
alternatively, instead of giving a function name, you can use the javascript technique of defining functions on the fly (called "anonymous functions") to define the actions that will process the response, like this: httprequest.onreadystatechange = function(){ // process the server response here. }; next, after declaring what happens when you receive the response, you need to actually make the...
Ajax - Developer guides
ber of existing technologies together, including html or xhtml, css, javascript, dom, xml, xslt, and most importantly the xmlhttprequest object. when these technologies are combined in the ajax model, web applications are able to make quick, incremental updates to the user interface without reloading the entire browser page. this makes the application faster and more responsive to user actions.
although x in ajax stands for xml, json is used more than xml nowadays because of its many advantages such as being lighter and a part of javascript. both json and xml are used for packaging information in the ajax model. documentation getting started this article guides you through the ajax basics and gives you two simple hands-on examples to get you started. using the xmlhttprequest api t...
Adding captions and subtitles to HTML5 video - Developer guides
articular "voice": 0 00:00:00.000 --> 00:00:12.000 <v test>[test]</v> then this specific 'voice' will be stylable like so: ::cue(v[voice='test']) { color:#fff; background:#0095dd; } note: some of the styling of cues with ::cue currently works on chrome, opera, and safari, but not yet on firefox. browser compatibility browser support for webvtt and the <track> element is fairly good,
although some browsers differ slightly in their implementation. internet explorer internet explorer 10+ subtitles are enabled by default, and the default controls contain a button and a menu that offers the same functionality as the menu we just built. the default attribute is also supported. note: ie will completely ignore webvtt files unless you define the mime type. this can easily be done by ...
Web Audio playbackRate explained - Developer guides
a 15+ ✔ mobile chrome (android) ✖ mobile firefox 24+ ✔ ie mobile ✖ mobile safari 6+ (ios) ✔ opera mobile ✖ notes most browsers stop playing audio outside playbackrate bounds of 0.5 and 4, leaving the video playing silently. for most applications, it's recommended that you limit the range to between 0.5 and 4. the pitch of the audio track does not change when playbackrate is
altered. negative values will not cause the media to play in reverse. ie9+ switches to the default playback rate when an ended event is fired. firefox generates a ratechange event when the media source is substituted. on ios 7 you can only affect the playbackrate when the media is paused (not while it's playing). see also hyperaudio's playback rate test htmlmediaelement reference ...
Media buffering, seeking, and time ranges - Developer guides
rts of the media file to be delivered from the server and so can be ready to play almost immediately — thus they are seekable. var seekabletimeranges = myaudio.seekable; creating our own buffering feedback if we wish to create our own custom player, we may want to provide feedback on how much of the media is ready to be played. in practice a good way to do this is use the seekable attribute,
although as we have seen above seekable parts of the media are not neccessarily contiguous — they often are however and we can safely approximate this information to give the user an indication of which parts of the media can be played directly. we can find this point in the media using the following line of code: var seekableend = myaudio.seekable.end(myaudio.seekable.length - 1); note: myaudio...
Challenge solutions - Developer guides
ng a wide border all around the oceans in a color that reminds you of the sea. solution the following rule achieves this effect: ul { border: 10px solid lightblue; width: 100px; } layout default image position fixed image position challenge change your sample document, doc2.html, adding this tag to it near the end, just before </body>: <img id="fixed-pin" src="yellow-pin.png"
alt="yellow map pin"> predict where the image will appear in your document. then refresh your browser to see if you were correct. solution the image appears to the right of the second list. challenge add a rule to your stylesheet that places the image in the top right of your document. solution the following rule achieves the desired result: #fixed-pin { position:fixed; top: 3px; righ...
Touch events (Mozilla experimental) - Developer guides
pi described on this page was available from gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) to gecko/firefox 17. you should instead use the standard touch events api, supported since gecko/firefox 6 with multi-touch support added in gecko/firefox 12. this api allowed you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system.
although touch events were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time. event fields touch events were based upon mouseevent, and thereby shared all mouse event fields. they included one additional field. streamid a unique integer identifying the finger generating...
Writing forward-compatible websites - Developer guides
l public yet. don't unnecessarily create separate codepaths for different browsers don't go out of your way to run different code based on either object detection or ua sniffing if one of the codepaths involved actually works in all browsers. there is a good chance of browsers changing behavior to converge with each other and hence breaking the site for those you've sent down one or more of the
alternative paths. testing test with all major engines test your code at least in firefox, chrome, safari, opera, and internet explorer. 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. sometime...
Block-level elements - HTML: Hypertext Markup Language
ine" category roughly corresponds to the category of phrasing content, the "block-level" category doesn't directly correspond to any html5 content category, but "block-level" and "inline" elements combined together correspond to the flow content in html5. there are also additional categories, e.g. interactive content. elements the following is a complete list of all html "block-level" elements (
although "block-level" is not technically defined for elements that are new in html5). <address> contact information. <article> article content. <aside> aside content. <blockquote> long ("block") quotation. <details> disclosure widget. <dialog> dialog box. <dd> describes a term in a description list. <div> document division. <dl> description list. <dt> description list term. <...
Date and time formats used in HTML - HTML: Hypertext Markup Language
four digits long; years prior to the year 1000 are padded with leading zeroes ("0"), so the year 72 is written as 0072. years prior to the year 1 c.e. are not supported, so html doesn't support years 1 b.c.e. (1 b.c.) or earlier. a year is normally 365 days long, except during leap years. leap years a leap year is any year which is divisible by 400 or the year is divisible by 4 but not by 100.
although the calendar year is normally 365 days long, it actually takes the planet earth approximately 365.2422 days to complete a single orbit around the sun. leap years help to adjust the calendar to keep it synchronized with the actual position of the planet in its orbit. adding a day to the year every four years essentially makes the average year 365.25 days long, which is close to correct. the ...
<address>: The Contact Address element - HTML: Hypertext Markup Language
article's author. <address> you can contact author at <a href="http://www.somedomain.com/contact"> www.somedomain.com</a>.<br> if you see any bugs, please <a href="mailto:webmaster@somedomain.com"> contact webmaster</a>.<br> you may also want to visit us:<br> mozilla foundation<br> 331 e evelyn ave<br> mountain view, ca 94041<br> usa </address> result
although it renders text with the same default styling as the <i> or <em> elements, it is more appropriate to use <address> when dealing with contact information, as it conveys additional semantic information. specifications specification status comment html living standardthe definition of '<address>' in that specification. living standard html5the defin...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
ent that accepts embedded content. dom interface htmlappletelement attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape also might support absbottom, absmiddle, baseline, center, and texttop.
alt this attribute causes a descriptive text
alternate to be displayed on browsers that do not support java. page designers should also remember that content enclosed within the <applet> element may also be rendered as
alternative text. archive this attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time. code this...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
ideotracks add an addtrack listener to this videotracklist object to be informed when video tracks are added to the element. htmlmediaelement.texttracks add an addtrack event listener to this texttracklist to be notified when new text tracks are added to the element. note: even though it's an <audio> element, it still has video and text track lists, and can in fact be used to present video,
although the use interface implications can be odd. for example, to detect when audio tracks are added to or removed from an <audio> element, you can use code like this: var elem = document.queryselector("audio"); elem.audiotracklist.onaddtrack = function(event) { trackeditor.addtrack(event.track); }; elem.audiotracklist.onremovetrack = function(event) { trackeditor.removetrack(event.track);...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
to include shorter quotes inline rather than in a separate block, use the <q> (quotation) element. example this example demonstrates the use of the <blockquote> element to quote a passage from rfc 1149, a standard for the transmission of ip datagrams on avian carriers. <blockquote cite="https://tools.ietf.org/html/rfc1149"> <p>avian carriers can provide high delay, low throughput, and low
altitude service. the connection topology is limited to a single point-to-point path for each carrier, used with standard carriers, but many carriers can be used without significant interference with each other, outside of early spring. this is because of the 3d ether space available to the carriers, in contrast to the 1d ether used by ieee802.3. the carriers have an intrinsic collisi...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
for that you need display: block. specifications specification status comment html living standardthe definition of '<caption>' in that specification. living standard html5the definition of '<caption>' in that specification. recommendation html 4.01 specificationthe definition of '<caption>' in that specification. recomme...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
use other css properties like margin-left and margin-right and set them to auto (or set margin to 0 auto). dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. example 1 <center>this text will be centered. <p>so will this paragraph.</p></center> example 2 (css
alternative) <div style="text-align:center">this text will be centered. <p>so will this paragraph.</p></div> example 3 (css
alternative) <p style="text-align:center">this line will be centered.<br> and so will this line.</p> note applying text-align:center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged. ...
<command>: The HTML Command element - HTML: Hypertext Markup Language
the html command element (<command>) represents a command which the user can invoke. commands are often used as part of a context menu or toolbar. however, they can be used anywhere on the page. the <command> element is included in the w3c specification, but not in the whatwg specification, and browser support is nonexistent. you should use the <menuitem> element instead,
although that element is non-standard and only supported in edge and firefox. content categories flow content, phrasing content, metadata content. permitted content none, it is an empty element. tag omission the start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. permitted parent elements <colgroup> only, though it can be implicitly ...
<dl>: The Description List element - HTML: Hypertext Markup Language
en global attributes apply to a whole group, or for styling purposes. <dl> <div> <dt>name</dt> <dd>godzilla</dd> </div> <div> <dt>born</dt> <dd>1952</dd> </div> <div> <dt>birthplace</dt> <dd>japan</dd> </div> <div> <dt>color</dt> <dd>green</dd> </div> </dl> notes do not use this element (nor <ul> elements) to merely create indentation on a page.
although it works, this is a bad practice and obscures the meaning of description lists. to change the indentation of a description term, use the css margin property. accessibility concerns each screen reader announces <dl> content differently. some screen readers, such as voiceover on ios, will not announce that <dl> content is a list. because of this, make sure each list item's content is writte...
<em>: The Emphasis element - HTML: Hypertext Markup Language
text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself. typically this element is displayed in italic type. however, it should not be used simply to apply italic styling; use the css font-style property for that purpose. use the <cite> element to mark the title of a work (book, play, song, etc.). use the <i> element to mark text that is in an
alternate tone or mood, which covers many common situations for italics such as scientific names or words in other languages. use the <strong> element to mark text that has greater importance than surrounding text. <i> vs. <em> new developers are often confused at seeing multiple elements that produce similar results. <em> and <i> are a common example, since they both italicize text. what's the dif...
<hgroup> - HTML: Hypertext Markup Language
ikely to go away. however, given that a key purpose of the <hgroup> element is to affect how headings are displayed by the outline algorithm defined in the html specification—but the html outline algorithm is not implemented in any browsers—then the <hgroup> semantics are in practice only theoretical. so the html5 (w3c) specification provides advice on how to mark up subheadings, subtitles,
alternative titles and taglines without using <hgroup>. the <hgroup> element allows the primary heading for a document section to be grouped with any secondary headings—such as subheadings or
alternative titles—to form a multi-level heading. in other words, the <hgroup> element prevents any of its secondary <h1>–<h6> children from creating separate sections of their own in the outline—as t...
<i>: The Idiomatic Text element - HTML: Hypertext Markup Language
mlelement attributes this element only includes the global attributes. usage notes use the <i> element for text that is set off from the normal prose for readability reasons. this would be a range of text with different semantic meaning than the surrounding text. ...
<input type="file"> - HTML: Hypertext Markup Language
e selected by the user in the file picker interface. see htmlinputelement.webkitdirectory for additional details and examples. note: though originally implemented only for webkit-based browsers, webkitdirectory is also usable in microsoft edge as well as firefox 50 and later. however, even though it has relatively broad support, it is still not standard and should not be used unless you have no
alternative. unique file type specifiers a unique file type specifier is a string that describes a type of file that may be selected by the user in an <input> element of type file. each unique file type specifier may take one of the following forms: a valid case-insensitive filename extension, starting with a period (".") character. for example: .jpg, .pdf, or .doc. a valid mime type string, ...
<input type="hidden"> - HTML: Hypertext Markup Language
none. note: the input and change events do not apply to this input type. hidden inputs cannot be focused even using javascript (e.g. hiddeninput.focus()). value the <input> element's value attribute holds a domstring that contains the hidden data you want to include when the form is submitted to the server. this specifically can't be edited or seen by the user via the user interface,
although you could edit the value via browser developer tools. important: while the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools or "view source" functionality. do not rely on hidden inputs as a form of security. additional attributes in addition to the attributes common to all <input> elements, hidden inputs off...
<input type="month"> - HTML: Hypertext Markup Language
e https://github.com/mdn/interactive-examples and send us a pull request. the control's ui varies in general from browser to browser; at the moment support is patchy, with only chrome/opera and edge on desktop — and most modern mobile browser versions — having usable implementations. in browsers that don't support month inputs, the control degrades gracefully to a simple <input type="text">,
although there may be automatic validation of the entered text to ensure it's formatted as expected. for those of you using a browser that doesn't support month, the screenshot below shows what it looks like in chrome and opera. clicking the down arrow on the right hand side brings up a date picker that lets you select the month and year. the microsoft edge month control looks like this: ...
<input type="password"> - HTML: Hypertext Markup Language
y to tell the user's browser that the password field must have a valid value before the form can be submitted, simply specify the boolean required attribute. <label for="userpassword">password: </label> <input id="userpassword" type="password" required> <input type="submit" value="submit"> specifying an input mode if your recommended (or required) password syntax rules would benefit from an
alternate text entry interface than the standard keyboard, you can use the inputmode attribute to request a specific one. the most obvious use case for this is if the password is required to be numeric (such as a pin). mobile devices with virtual keyboards, for example, may opt to switch to a numeric keypad layout instead of a full keyboard, to make entering the password easier. if the pin is for one...
<input type="reset"> - HTML: Hypertext Markup Language
s key is! this is especially true since the modifiers are typically non-standard to avoid conflicts. when building a site, be sure to provide this information in a way that doesn't interfere with the site design (for example by providing an easily accessible link that points to information on what the site access keys are). adding a tooltip to the button (using the title attribute) can also help,
although it's not a complete solution for accessibility purposes. disabling and enabling a reset button to disable a reset button, simply specify the disabled global attribute on it, like so: <input type="reset" value="disabled" disabled> you can enable and disable buttons at run time by simply setting disabled to true or false; in javascript this looks like btn.disabled = true or btn.disabled ...
<input type="time"> - HTML: Hypertext Markup Language
uts, the value of step is given in seconds, with a scaling factor of 1000 (since the underlying numeric value is in milliseconds). the default value of step is 60, indicating 60 seconds (or 1 minute, or 60,000 milliseconds). at this time, it's unclear what a value of any means for step when used with time inputs. this will be updated as soon as that information is determined. using time inputs
although among the date and time input types time has the widest browser support, it is not yet approaching universal, so it is likely that you'll need to provide an
alternative method for entering the date and time, so that safari users (and users of other non-supporting browsers) can still easily enter time values. we'll look at basic and more complex uses of <input type="time">, then offer advice...
<label> - HTML: Hypertext Markup Language
an click the associated label to focus/activate the input, as well as the input itself. this increased hit area provides an advantage to anyone trying to activate the input, including those using a touch-screen device. to associate the <label> with an <input> element, you need to give the <input> an id attribute. the <label> then needs a for attribute whose value is the same as the input's id.
alternatively, you can nest the <input> directly inside the <label>, in which case the for and id attributes are not needed because the association is implicit: <label>do you like peas? <input type="checkbox" name="peas"> </label> other usage notes: the form control that the label is labeling is called the labeled control of the label element. one input can be associated with multiple labels.
<map> - HTML: Hypertext Markup Language
alue of the name attribute of another <map> element in the same document. if the id attribute is also specified, both attributes must have the same value. 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. living standard html5t...
<mark>: The Mark Text element - HTML: Hypertext Markup Language
mark>rebel spies managed to steal secret plans</mark> to the empire’s ultimate weapon, the death star, an armored space station with enough power to destroy an entire planet. </blockquote> the resulting output looks like this: identifying context-sensitive passages this example demonstrates using <mark> to mark search results within a passage. <p>it is a dark time for the rebellion. ...
<menu> - HTML: Hypertext Markup Language
es both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked. content categories flow content. if the element's children include at least one <li> element: palpable 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>. (list menu is the default state, unless the parent element is a <menu> in the context menu state.) if the element is in the context menu state: zero or more occurrences, in any order, of <menu> (context menu state only), <menuitem>, <hr>, <script>, and <template>. tag omission none, both the starting and e...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
attributes like all other html elements, this element accepts the global attributes. n reference to anchor. example the user enters four section headings into the table of contents (and presumably also writing paragraph material within these sections). the heading for each of the four sections would be assigned name values of "z0", "z1", "z2", and "...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
tribute is used on an enclosed <li> element. note: unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the css list-style-type property instead. usage notes typically, ordered list items display with a preceding marker, such as a number or letter. the <ol> and <ul> elements may nest as deeply as desired,
alternating between <ol> and <ul> however you like. the <ol> and <ul> elements both represent a list of items. the difference is with the <ol> element, the order is meaningful. for example: steps in a recipe turn-by-turn directions the list of ingredients in decreasing proportion on nutrition information labels to determine which list to use, try changing the order of the list items; if the m...
<p>: The Paragraph element - HTML: Hypertext Markup Language
html <p>this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text. this is the first paragraph of text.</p> <p>this is the second paragraph. this is the second paragraph. this is the second paragraph. this is the second paragraph.</p> result styling paragraphs by default, browsers separate paragraphs with a single blank line.
alternate separation methods, such as first-line indentation, can be achieved with css: html <p>separating paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first lines. this is often used to take up less space, such as to save paper in print.</p> <p>writing that is intended to be edited, such as school papers and rough drafts, uses both ...
<script>: The Script element - HTML: Hypertext Markup Language
olicy is not supported. if referrerpolicy is not explicitly specified on the <script> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. if a higher-level policy is not available, the empty string is treated as being equivalent to no-referrer-when-downgrade. src this attribute specifies the uri of an external script; this can be used as an
alternative to embedding a script directly within a document. type this attribute indicates the type of script represented. the value of this attribute will be in one of the following categories: omitted or a javascript mime type: this indicates the script is javascript. the html5 specification urges authors to omit the attribute rather than provide a redundant mime type. in earlier browse...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
oviding versions of an image to use when the available space exceeds certain widths. if the available width is less than the smaller of these widths, the user agent will fall back to the image given by the <img> element. <picture> <source srcset="mdn-logo-wide.png" media="(min-width: 800px)"> <source srcset="mdn-logo-medium.png" media="(min-width: 600px)"> <img src="mdn-logo-narrow.png"
alt="mdn web docs"> </picture> with the <picture> element, you must always include an <img> with a fallback image, with an
alt attribute to ensure accessibility (unless the image is an irrelevant background decorative image). specifications specification status comment html living standardthe definition of '<source>' in that specification. living standard ...
<strike> - HTML: Hypertext Markup Language
try to avoid using it. the html <strike> element (or html strikethrough element) places a strikethrough (horizontal line) over text. usage note: this element is deprecated in html 4 and xhtml 1, and obsoleted in html5. if semantically appropriate, i.e., if it represents deleted content, use <del> instead. in all other cases use <s>. dom interface htmlelement attributes this element includes the global attributes. ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
ng>? don't they both do the same thing?" not exactly. the <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important. it may help to realize that both are valid and semantic elements in html5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (
although some older browsers actually underline <strong>). each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the css font-weight property. the intended meaning or purpose of the enclosed text should be what determines which element you use. communicating meaning is what semantics are all about. <em> vs...
<style>: The Style Information element - HTML: Hypertext Markup Language
, which defaults to all if the attribute is missing. nonce a cryptographic nonce (number used once) used to whitelist inline styles in a style-src content-security-policy. the server must generate a unique nonce value each time it transmits a policy. it is critical to provide a nonce that cannot be guessed as bypassing a resource’s policy is otherwise trivial. title this attribute specifies
alternative style sheet sets. deprecated attributes scoped this attribute specifies that the styles only apply to the elements of its parent(s) and children. this attribute may be re-introduced in the future per https://github.com/w3c/csswg-drafts/issues/3547. if you want to use the attribute now, you can use a polyfill. examples a simple stylesheet in the following example, w...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
oot>, even if implicitly defined), that the cell belongs to. values higher than 65534 are clipped down to 65534. deprecated attributes abbr this attribute contains a short abbreviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. note: do not use this attribute as it is obsolete in the latest standard.
alternatively, you can put the abbreviated description inside the cell and place the long content in the title attribute. align this enumerated attribute specifies how the cell content's horizontal alignment will be handled. possible values are: left: the content is aligned to the left of the cell. center: the content is centered in the cell. right: the content is aligned to the right o...
<textarea> - HTML: Hypertext Markup Language
area> baseline is set on the baseline of the first line of the textarea's first line, on another browser it may be set on the bottom of the <textarea> box. don't use vertical-align: baseline on it; the behavior is unpredictable. controlling whether a textarea is resizable in most browsers, <textarea>s are resizable — you'll notice the drag handle in the right hand corner, which can be used to
alter the size of the element on the page. this is controlled by the resize css property — resizing is enabled by default, but you can explicitly disable it using a resize value of none: textarea { resize: none; } styling valid and invalid values valid and invalid values of a <textarea> element (e.g. those within, and outside the bounds set by minlength, maxlength, or required) can be highlig...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
ent 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. you can override this using css by creating a rule using the tt selector, as seen in the example overriding the default font above. user-configured changes to the default monospace font setting may take precedence over your css.
although this element wasn't officially deprecated in html 4.01, its use was discouraged in favor of the semantic elements and/or css. the <tt> element is obsolete in html 5. specifications specification status comment html5the definition of '<tt>' in that specification. recommendation html 4.01 specificationthe definition of '<tt>' in that specification.
<ul>: The Unordered List element - HTML: Hypertext Markup Language
, and their order in the list is meaningless. typically, unordered-list items are displayed with a bullet, which can be of several forms, like a dot, a circle, or a square. the bullet style is not defined in the html description of the page, but in its associated css, using the list-style-type property. the <ul> and <ol> elements may be nested as deeply as desired. moreover, the nested lists may
alternate between <ol> and <ul> without restriction. the <ol> and <ul> elements both represent a list of items. they differ in that, with the <ol> element, the order is meaningful. as a rule of thumb to determine which one to use, try changing the order of the list items; if the meaning is changed, the <ol> element should be used, otherwise you can use <ul>. examples simple example <ul> <li>fi...
<var>: The Variable element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. ...
<video>: The Video Embed element - HTML: Hypertext Markup Language
). however, this can be useful when creating media elements whose source will be set at a later time, under user control. see our autoplay guide for additional information about how to properly use autoplay. to disable video autoplay, autoplay="false" will not work; the video will autoplay if the attribute is there in the <video> tag at all. to remove autoplay, the attribute needs to be removed
altogether. in some browsers (e.g. chrome 70.0) autoplay doesn't work if no muted attribute is present. autopictureinpicture a boolean attribute which if true indicates that the element should automatically toggle picture-in-picture mode when the user switches back and forth between this document and another document or application. buffered an attribute you can read to determine the time r...
class - HTML: Hypertext Markup Language
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. though the specification doesn't put requirements on the name of classes, web developers are encouraged to use names that describe the semantic purpose of the element, rather than the presentation of the element. for example, attribute to describe an attribute rather than italics,
although an element of this class may be presented by italics. semantic names remain logical even if the presentation of the page changes. specifications specification status comment html living standardthe definition of 'class' in that specification. living standard no change from latest snapshot, html 5.1 html 5.1the definition of 'class' in that specificati...
contenteditable - HTML: Hypertext Markup Language
icates that the element is editable. false, which indicates that the element is not editable. if the attribute is given without a value, like <label contenteditable>example label</label>, its value is treated as an empty string. if this attribute is missing or its value is invalid, its value is inherited from its parent element: so the element is editable if its parent is editable. note that
although its allowed values include true and false, this attribute is an enumerated one and not a boolean one. you can set the color used to draw the text insertion caret with the css caret-color property. specifications specification status comment html living standardthe definition of 'contenteditable' in that specification. living standard no change from latest...
id - HTML: Hypertext Markup Language
r), scripting, or styling (with css). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this attribute's value is an opaque string: this means that web authors should not rely on it to convey human-readable information (
although having your ids somewhat human-readable can be useful for code comprehension, e.g. consider ticket-18659 versus r45tgfe-freds&$@). id's value must not contain whitespace (spaces, tabs etc.). browsers treat non-conforming ids that contain whitespace as if the whitespace is part of the id. in contrast to the class attribute, which allows space-separated values, elements can only have one sin...
itemtype - HTML: Hypertext Markup Language
<br> </span> product #: <span itemprop="mpn">925872<br></span> <span itemprop="aggregaterating" itemscope itemtype="http://schema.org/aggregaterating"> rating: <span itemprop="ratingv...
translate - HTML: Hypertext Markup Language
ute that is used to specify whether an element's translateable attribute values and its text node children should be translated when the page is localized, or whether to leave them unchanged. it can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized. "no", which indicates that the element must not be translated.
although not all browsers recognize this attribute, it is respected by automatic translation systems such as google translate, and may also be respected by tools used by human translators. as such it's important that web authors use this attribute to mark content that should not be translated. examples in this example, the translate attribute is used to ask translation tools not to translate the co...
Microdata - HTML: Hypertext Markup Language
m. web developers can design a custom vocabulary or use vocabularies available on the web, such as the widely used schema.org vocabulary. a collection of commonly used markup vocabularies are provided by schema.org. commonly used vocabularies: creative works: creativework, book, movie, musicrecording, recipe, tvseries embedded non-text objects: audioobject, imageobject, videoobject event he
alth and medical types: notes on the he
alth and medical types under medicalentity organization person place, localbusiness, restaurant product, offer, aggregateoffer review, aggregaterating action thing intangible major search engine operators like google, microsoft, and yahoo! rely on the schema.org vocabulary to improve search results. for some purposes, an ad-hoc vocabulary is adequate. ...
Basics of HTTP - HTTP
specific kind of uri that directly embeds the resource it represents. data uris are very convenient, but have some caveats. resource urls resource urls, those prefixed with the resource scheme are used by firefox and firefox browser extensions to load resources internally, but is also available to some sites the browser connects to as well. separating identity and location of a resource: the
alt-svc http header most of the time the identity and location of a web resource are shared, this can be changed with the
alt-svc header. mime types since http/1.0, different types of content can be transmitted. this article explains how this is accomplished using the content-type header and the mime standard. choosing between www and non-www urls this article provides guidance on how to choose ...
Reason: CORS request did not succeed - HTTP
ses, it is caused by a browser plugin (e.g. an ad blocker or privacy protector) blocking the request. other possible causes include: trying to access an https resource that has an invalid certificate will cause this error. trying to access an http resource from a page with an https origin will also cause this error. as of firefox 68, https pages are not permitted to access http://localhost,
although this may be changed by bug 1488740. the server did not respond to the actual request (even if it responded to the preflight request). one scenario might be an http service being developed that panicked without returning any data. ...
Content Security Policy (CSP) - HTTP
to the standard same-origin policy for web content. if the site doesn't offer the csp header, browsers likewise use the standard same-origin policy. to enable csp, you need to configure your web server to return the content-security-policy http header. (sometimes you may see mentions of the x-content-security-policy header, but that's an older version and you don't need to specify it anymore.)
alternatively, the <meta> element can be used to configure a policy, for example: <meta http-equiv="content-security-policy" content="default-src 'self'; img-src https://*; child-src 'none';"> threats mitigating cross site scripting a primary goal of csp is to mitigate and report xss attacks. xss attacks exploit the browser's trust of the content received from the server. malicious scripts are exe...
HTTP caching - HTTP
must-revalidate" directive, the cache must verify the status of the stale resources before using it and expired ones should not be used. for more details, see the validation section below. cache-control: must-revalidate the pragma header pragma is a http/1.0 header, it is not specified for http responses and is therefore not a reliable replacement for the general http/1.1 cache-control header,
although it does behave the same as cache-control: no-cache, if the cache-control header field is omitted in a request. use pragma only for backwards compatibility with http/1.0 clients. freshness once a resource is stored in a cache, it could theoretically be served by the cache forever. caches have finite storage so items are periodically removed from storage. this process is called cache evictio...
Compression in HTTP - HTTP
e other media types use lot of space to store their data and the need to optimize storage and regain space was apparent very early. engineers designed the optimized compression algorithm used by file formats designed for this specific purpose. compression algorithms used for files can be grouped into two broad categories: loss-less compression, where the compression-uncompression cycle doesn't
alter the data that is recovered. it matches (byte to byte) with the original. for images, gif or png are using loss-less compression. lossy compression, where the cycle
alters the original data in a (hopefully) imperceptible way for the user. video formats on the web are lossy; the jpeg image format is also lossy. some formats can be used for both loss-less or lossy compression, like webp, an...
HTTP conditional requests - HTTP
ale, this is mostly controlled by the cache-control header, the client doesn't use the cached value directly but issues a conditional request. the value of the validator is used as a parameter of the if-modified-since and if-match headers. if the resource has not changed, the server sends back a 304 not modified response. this makes the cache fresh again, and the client uses the cached resource.
although there is a response/request round-trip that consumes some resources, this is more efficient than to transmit the whole resource over the wire again. if the resource has changed, the server just sends back a 200 ok response, with the new version of the resource, like if the request wasn't conditional and the client uses this new resource (and caches it). besides the setting of the valid...
Using HTTP cookies - HTTP
ease note the security issues in the security section below. cookies available to javascript can be stolen through xss. security information should be stored in cookies with the understanding that all cookie values are visible to, and can be changed by, the end-user. depending on the application, it may be desirable to use an opaque identifier which is looked-up by the server or to investigate
alternative authentication/confidentiality mechanisms such as json web tokens. ways to mitigate attacks involving cookies: use the httponly attribute to prevent access to cookie values via javascript. cookies that are used for sensitive information (such as indicating authentication) should have a short lifetime, with the samesite attribute set to strict or lax. (see samesite cookies, above.) i...
Access-Control-Allow-Headers - HTTP
tion to the cors-safelisted request headers, a custom header named x-custom-header is supported by cors requests to the server. access-control-allow-headers: x-custom-header multiple headers this example shows access-control-allow-headers when it specifies support for multiple headers. access-control-allow-headers: x-custom-header, upgrade-insecure-requests bypassing additional restrictions
although cors-safelisted request headers are always allowed and don't usually need to be listed in access-control-allow-headers, listing them anyway will circumvent the additional restrictions that apply. access-control-allow-headers: accept example preflight request let's look at an example of a preflight request involving access-control-allow-headers. request first, the request. the preflight...
Cache-Control - HTTP
on-cacheable. however, the stored response must always go through validation with the origin server first before using it, therefore, you cannot use no-cache in-conjunction with immutable. if you mean to not store the response in any cache, use no-store instead. this directive is not effective in preventing caches from storing your response. no-store the response may not be stored in any cache.
although other directives may be set, this alone is the only directive you need in preventing cached responses on modern browsers. max-age=0 is already implied. setting must-revalidate does not make sense because in order to go through revalidation you need the response to be stored in a cache, which no-store prevents. expiration max-age=<seconds> the maximum amount of time a resource is consid...
Content-Location - HTTP
the principal use is to indicate the url of a resource transmitted as the result of content negotiation. location and content-location are different. location indicates the url of a redirect, while content-location indicates the direct url to use to access the resource, without further content negotiation in the future. location is a header associated with the response, while content-location is associated with the data returned. this distinction may seem abstract without examples. header type entity header forbidden header name no syntax content-location: <url> directives <url> a relative (to the request url) or absolute url. ...
CSP: img-src - HTTP
source expressions such as 'self' or 'unsafe-inline' are ignored. see script-src for an example. 'report-sample' requires a sample of the violating code to be included in the violation report. examples violation cases given this csp header: content-security-policy: img-src https://example.com/ the following <img> is blocked and won't load: <img src="https://not-example.com/foo.jpg"
alt="example picture"> specifications specification status comment content security policy level 3the definition of 'img-src' in that specification. working draft no changes. content security policy level 2the definition of 'img-src' in that specification. recommendation initial definition. ...
CSP: script-src - HTTP
csp supports sha256, sha384 and sha512. content-security-policy: script-src 'sha256-b2yphkaxnvfwtrchibabymubfzdvfkkxhbwtwiddvf8=' when generating the hash, don't include the <script> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. <script>var inline = 1;</script> unsafe eval expressio...
CSP: style-src - HTTP
csp supports sha256, sha384 and sha512. content-security-policy: style-src 'sha256-a330698cbe9dc4ef1fb12e2ee9fc06d5d14300262fa4dc5878103ab7347e158f' when generating the hash, don't include the <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. <style>#inline-style { background: red...
Pragma - HTTP
the pragma http/1.0 general header is an implementation-specific header that may have various effects along the request-response chain. it is used for backwards compatibility with http/1.0 caches where the cache-control http/1.1 header is not yet present. note: pragma is not specified for http responses and is therefore not a reliable replacement for the general http/1.1 cache-control header,
although it does behave the same as cache-control: no-cache, if the cache-control header field is omitted in a request. use pragma only for backwards compatibility with http/1.0 clients. header type general header, but response behavior is not specified and thus implementation-specific. forbidden header name no cors-safelisted response header yes syntax pr...
Referer - HTTP
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. important:
although this header has many innocent uses it can have undesirable consequences for user security and privacy. see referer header: privacy and security concerns for more information and mitigations. note that referer is actually a misspelling of the word "referrer". see http referer on wikipedia for more details. a referer header is not sent by browsers if: the referring resource is a local "file" or "data" uri. an unsecured http request is used and the referring page was rece...
Referrer-Policy - HTTP
html you can also set referrer policies inside html. for example, you can set the referrer policy for the entire document with a <meta> element with a name of referrer: <meta name="referrer" content="origin"> or set it for individual requests with the referrerpolicy attribute on <a>, <area>, <img>, <iframe>, <script>, or <link> elements: <a href="http://example.com" referrerpolicy="origin">
alternatively, a noreferrer link relation on an a, area, or link element can be set: <a href="http://example.com" rel="noreferrer"> integration with css css can fetch resources referenced from stylesheets. 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 th...
Save-Data - HTTP
the save-data header field is a boolean which, in requests, indicates the client's preference for reduced data usage. 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. note: disabling http/2 server push (rfc 7540, section 8.2: server push) might be desirable too for reducing data downloads. syntax save-data: <sd-token> directives <sd-token> a numerical value indicating whether the client wants to opt in to reduced data usage mode. o...
Firefox user agent string reference - HTTP
if this is the case, the firefox os ua string will look like the device-specific string in the table above, where nnnn; is the manufacturer's code for the device (see guidelines). some of them we have noticed are of the form "nexusone;",...
X-XSS-Protection - HTTP
the http x-xss-protection response header is a feature of internet explorer, chrome and safari that stops pages from loading when they detect reflected cross-site scripting (xss) attacks.
although these protections are largely unnecessary in modern browsers when sites implement a strong content-security-policy that disables the use of inline javascript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support csp. chrome has removed their xss auditor firefox have not, and will not implement x-xss-protection edge have retired their xss filter this means that if you do not need to support legacy browsers, it is recommended that you use content-security-policy without allowing unsafe-inline scripts instead. header type res...
Link prefetching FAQ - HTTP
ch the format for the link: header is described in rfc 5988 section 5. the browser observes all of these hints and queues up each unique request to be prefetched when the browser is idle. there can be multiple hints per page, as it might make sense to prefetch multiple documents. for example, the next document might contain several large images. 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? no, only <link> tags with a relation type of next or prefetch are prefetched. however, if there is sufficient interest, we may expand link prefetching support to include prefetching <a> tags, which include a relation type of next or prefetch in the future. do...
HTTP Messages - HTTP
, providing optimization and performance improvements. web developers, or webmasters, rarely craft these textual http messages themselves: software, a web browser, proxy, or web server, perform this action. they provide http messages through config files (for proxies or servers), apis (for browsers), or other interfaces. the http/2 binary framing mechanism has been designed to not require any
alteration of the apis or config files applied: it is broadly transparent to the user. http requests, and responses, share similar structure and are composed of: a start-line describing the requests to be implemented, or its status of whether successful or a failure. this start-line is always a single line. an optional set of http headers specifying the request, or describing the body included i...
PATCH - HTTP
quest method applies partial modifications to a resource. patch is somewhat analogous to the "update" concept found in crud (in general, http is different than crud, and the two should not be confused). a patch request is considered a set of instructions on how to modify a resource. contrast this with put; which is a complete representation of a resource. a patch is not necessarily idempotent,
although it can be. contrast this with put; which is always idempotent. the word "idempotent" means that any number of repeated, identical requests will leave the resource in the same state. for example if an auto-incrementing counter field is an integral part of the resource, then a put will naturally overwrite it (since it overwrites everything), but not necessarily so for patch. patch (like put) ...
HTTP request methods - HTTP
each of them implements a different semantic, but some common features are shared by a group of them: e.g. a request method can be safe, idempotent, or cacheable. get the get method requests a representation of the specified resource. requests using get should only retrieve data. head the head method asks for a response identical to that of a get request, but without the response body. ...
Proxy servers and tunneling - HTTP
lient anonymity, but in other cases information from the original request is lost. the ip address of the original client is often used for debugging, statistics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is
altered or lost when a proxy is involved in the path of the request. or the de-facto standard versions: x-forwarded-for identifies the originating ip addresses of a client connecting to a web server through an http proxy or a load balancer. x-forwarded-host identifies the original host requested that a client used to connect to your proxy or load balancer. x-forwarded-proto identifies...
HTTP resources and specifications - HTTP
dard rfc 8446 the transport layer security (tls) protocol version 1.3 supersedes tls 1.2. proposed standard rfc 2817 upgrading to tls within http/1.1 proposed standard rfc 7540 hypertext transfer protocol version 2 (http/2) proposed standard rfc 7541 hpack: header compression for http/2 on the standard track rfc 7838 http
alternative services on the standard track rfc 7301 transport layer security (tls) application-layer protocol negotiation extension used to negotiate http/2 at the transport to save an extra request/response round trip. proposed standard rfc 6454 the web origin concept proposed standard fetchthe definition of 'cors' in that specification. cross-origin ...
301 Moved Permanently - HTTP
http) 301 moved permanently redirect status response code indicates that the resource requested has been definitively moved to the url given by the location headers. a browser redirects to this page and search engines update their links to the resource (in 'seo-speak', it is said that the 'link-juice' is sent to the new url). even if the specification requires the method (and the body) not to be
altered when the redirection is performed, not all user-agents align with it - you can still find this type of bugged software out there. it is therefore recommended to use the 301 code only as a response for get or head methods and to use the 308 permanent redirect for post methods instead, as the method change is explicitly prohibited with this status. status 301 moved permanently example clien...
302 Found - HTTP
ol (http) 302 found redirect status response code indicates that the resource requested has been temporarily moved to the url given by the location header. a browser redirects to this page but search engines don't update their links to the resource (in 'seo-speak', it is said that the 'link-juice' is not sent to the new url). even if the specification requires the method (and the body) not to be
altered when the redirection is performed, not all user-agents conform here - you can still find this type of bugged software out there. it is therefore recommended to set the 302 code only as a response for get or head methods and to use 307 temporary redirect instead, as the method change is explicitly prohibited in that case. in the cases where you want the method used to be changed to get, use 3...
308 Permanent Redirect - HTTP
ertext transfer protocol (http) 308 permanent redirect redirect status response code indicates that the resource requested has been definitively moved to the url given by the location headers. a browser redirects to this page and search engines update their links to the resource (in 'seo-speak', it is said that the 'link-juice' is sent to the new url). the request method and the body will not be
altered, whereas 301 may incorrectly sometimes be changed to a get method. note: some web applications may use the 308 permanent redirect in a non-standard way and for other purposes. for example, google drive uses a 308 resume incomplete response to indicate to the client when an incomplete upload stalled.[1] status 308 permanent redirect specifications specification title ...
HTTP response status codes - HTTP
ocation: http response header. this has the same semantics as the 301 moved permanently http response code, with the exception that the user agent must not change the http method used: if a post was used in the first request, a post must be used in the second request. client error responses 400 bad request the server could not understand the request due to invalid syntax. 401 unauthorized
although the http standard specifies "unauthorized", semantically this response means "unauthenticated". that is, the client must authenticate itself to get the requested response. 402 payment required this response code is reserved for future use. the initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard conventi...
HTTP
pening a connection to make a request, then waiting until it receives a response. http is a stateless protocol, meaning that the server does not keep any data (state) between two requests. though often based on a tcp/ip layer, it can be used on any reliable transport layer, that is, a protocol that doesn't lose messages silently like udp does. rudp — the reliable update of udp — is a suitable
alternative. tutorials learn how to use http with guides and tutorials. overview of http the basic features of the client-server protocol: what it can do and its intended uses. http cache caching is very important for fast web sites. this article describes different methods of caching and how to use http headers to control them. http cookies how cookies work is defined by rfc 6265. when s...
A re-introduction to JavaScript (JS tutorial) - JavaScript
ly 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). for this reason, we sometimes speak simply of "true values" and "false values," meaning values that become true and false, respectively, when converted to booleans.
alternatively, such values can be called "truthy" and "falsy", respectively. boolean operations such as && (logical and), || (logical or), and ! (logical not) are supported; see below. variables new variables in javascript are declared using one of three keywords: let, const, or var. let allows you to declare block-level variables. the declared variable is available from the block it is enclose...
About JavaScript - JavaScript
besides the above implementations, there are other popular javascript engines such as:- google's v8, which is used in the google chrome browser and recent versions of opera browser. this is also the engine used by node.js. the javascriptcore (squirrelfish/nitro) used in some webkit browsers such as apple safari. carakan in old versions of opera. the chakra engine used in internet explorer (
although the language it implements is formally called "jscript" in order to avoid trademark issues). each of mozilla's javascript engines expose a public api which application developers can use to integrate javascript into their software. by far, the most common host environment for javascript is web browsers. web browsers typically use the public api to create host objects responsible for reflec...
Closures - JavaScript
{'id': 'age', 'help': 'your age (you must be over 16)'} ]; for (let i = 0; i < helptext.length; i++) { let item = helptext[i]; document.getelementbyid(item.id).onfocus = function() { showhelp(item.help); } } } setuphelp(); this example uses let instead of var, so every closure binds the block-scoped variable, meaning that no additional closures are required. ...
JavaScript data types and data structures - JavaScript
are not safe anymore and will be a double-precision floating point approximation of the value. the number type has only one integer with two representations: 0 is represented as both -0 and +0. (0 is an alias for +0.) in the praxis, this has almost no impact. for example, +0 === -0 is true. however, you are able to notice this when you divide by zero: > 42 / +0 infinity > 42 / -0 -infinity
although a number often represents only its value, javascript provides binary (bitwise) operators. caution:
although bitwise operators can be used to represent several boolean values within a single number using bit masking, this is usually considered a bad practice. javascript offers other means to represent a set of booleans (like an array of booleans, or an object with boolean values assigned to...
Equality comparisons and sameness - JavaScript
ond to 11.9.3.1.a–f. a model for understanding equality comparisons? prior to es2015, you might have said of double equals and triple equals that one is an "enhanced" version of the other. for example, someone might say that double equals is an extended version of triple equals, because the former does everything that the latter does, but with type conversion on its operands. e.g., 6 == "6". (
alternatively, someone might say that double equals is the baseline, and triple equals is an enhanced version, because it requires the two operands to be the same type, so it adds an extra constraint. which one is the better model for understanding depends on how you choose to view things.) however, this way of thinking about the built-in sameness operators is not a model that can be stretched to al...
Expressions and operators - JavaScript
se evaluations are always correct. note that the anything part of the above expressions is not evaluated, so any side effects of doing so do not take effect. note that for the second case, in modern code you can use the new nullish coalescing operator (??) that works like ||, but it only returns the second expression, when the first one is "nullish", i.e. null or undefined. it is thus the better
alternative to provide defaults, when values like '' or 0 are valid values for the first expression, too. string operators in addition to the comparison operators, which can be used on string values, the concatenation operator (+) concatenates two string values together, returning another string that is the union of the two operand strings. for example, console.log('my ' + 'string'); // console l...
Iterators and generators - JavaScript
numbers returned, that took interval in between: 0 to 10] note: it is not possible to know reflectively whether a particular object is an iterator. if you need to do this, use iterables. generator functions while custom iterators are a useful tool, their creation requires careful programming due to the need to explicitly maintain their internal state. generator functions provide a powerful
alternative: they allow you to define an iterative algorithm by writing a single function whose execution is not continuous. generator functions are written using the function* syntax. when called, generator functions do not initially execute their code. instead, they return a special type of iterator, called a generator. when a value is consumed by calling the generator's next method, the generator...
Loops and iteration - JavaScript
ver all the object's properties and returns a string that lists the property names and their values. function dump_props(obj, obj_name) { let result = ''; for (let i in obj) { result += obj_name + '.' + i + ' = ' + obj[i] + '<br>'; } result += '<hr>'; return result; } for an object car with properties make and model, result would be: car.make = ford car.model = mustang arrays
although it may be tempting to use this as a way to iterate over array elements, the for...in statement will return the name of your user-defined properties in addition to the numeric indexes. therefore, it is better to use a traditional for loop with a numeric index when iterating over arrays, because the for...in statement iterates over user-defined properties in addition to the array elements, if...
JavaScript modules - JavaScript
o your script, you can use them just like they were defined inside the same file. the following is found in main.js, below the import lines: let mycanvas = create('mycanvas', document.body, 480, 320); let reportlist = createreportlist(mycanvas.id); let square1 = draw(mycanvas.ctx, 50, 50, 100, 'blue'); reportarea(square1.length, reportlist); reportperimeter(square1.length, reportlist); note:
although imported features are available in the file, they are read only views of the feature that was exported. you cannot change the variable that was imported, but you can still modify properties similar to const. additionally, these features are imported as live bindings, meaning that they can change in value even if you cannot modify the binding unlike const. applying the module to your html ...
Regular expression syntax cheatsheet - JavaScript
whose members are in the same order as the left parentheses in the capturing group. this is usually just the order of the capturing groups themselves. this becomes important when capturing groups are nested. matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). capturing groups have a performance pen
alty. if you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). string.match() won't return groups if the /.../g flag is set. however, you can still use string.matchall() to get all matches. \n where "n" is a positive integer. a back reference to the last substring matching the n parenthetical in the regular expression (counting le...
Groups and ranges - JavaScript
whose members are in the same order as the left parentheses in the capturing group. this is usually just the order of the capturing groups themselves. this becomes important when capturing groups are nested. matches are accessed using the index of the the result's elements ([1], ..., [n]) or from the predefined regexp object's properties ($1, ..., $9). capturing groups have a performance pen
alty. if you don't need the matched substring to be recalled, prefer non-capturing parentheses (see below). string.match() won't return groups if the /.../g flag is set. however, you can still use string.matchall() to get all matches. \n where "n" is a positive integer. a back reference to the last substring matching the n parenthetical in the regular expression (counting le...
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
the javascript warning "08 (or 09) is not a legal ecma-262 octal constant" occurs when 08 or 09 number literals are used. they can't be interpreted as an octal number. message warning: syntaxerror: 08 is not a legal ecma-262 octal constant. warning: syntaxerror: 09 is not a legal ecma-262 octal constant. error type warning. javascript execution won't be h
alted. what went wrong? decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number. because this is not the case with 08 and 09, javascript warns about it. note that octal literals and octal escape sequences are deprecated and will present an additional deprecation warning. with ecmascript 6 and later, the syntax ...
TypeError: cyclic object value - JavaScript
s when object references were found in json. json.stringify() doesn't try to solve them and fails accordingly. message typeerror: cyclic object value (firefox) typeerror: converting circular structure to json (chrome and opera) typeerror: circular reference in value argument not supported (edge) error type typeerror what went wrong? the json format per se doesn't support object references (
although an ietf draft exists), hence json.stringify() doesn't try to solve them and fails accordingly. 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 y...
Warning: String.x is deprecated; use String.prototype.x instead - JavaScript
eprecated; use string.prototype.touppercase instead warning: string.trim is deprecated; use string.prototype.trim instead warning: string.trimleft is deprecated; use string.prototype.trimleft instead warning: string.trimright is deprecated; use string.prototype.trimright instead error type warning. javascript execution won't be h
alted. what went wrong? the non-standard generic string methods are deprecated and have been removed in firefox 68 and later. 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 fol...
ReferenceError: deprecated caller or arguments usage - JavaScript
ee' and 'caller' are restricted function properties and cannot be accessed in this context (edge) warning: referenceerror: deprecated caller usage (firefox) warning: referenceerror: deprecated arguments usage (firefox) typeerror: 'callee' and 'caller' cannot be accessed in strict mode. (safari) error type a strict-mode-only warning that a referenceerror occurred. javascript execution won't be h
alted. what went wrong? in strict mode, the function.caller or function.arguments properties are used and shouldn't be. they are deprecated, because they leak the function caller, are non-standard, hard to optimize and potentially a performance-harmful feature. examples deprecated function.caller or arguments.callee.caller function.caller and arguments.callee.caller are deprecated (see the refer...
SyntaxError: missing : after property id - JavaScript
key: 'value' }; examples colons vs. equal signs this code fails, as the equal sign can't be used this way in this object initializer syntax. var obj = { propertykey = 'value' }; // syntaxerror: missing : after property id correct would be to use a colon, or to use square brackets to assign a new property after the object has been created already. var obj = { propertykey: 'value' }; // or
alternatively var obj = { }; obj['propertykey'] = 'value'; empty properties you can't create empty properties like this: var obj = { propertykey; }; // syntaxerror: missing : after property id if you need to define a property without a value, you might use null as a value. var obj = { propertykey: null }; computed properties if you create a property key from an expression, you need to use s...
SyntaxError: missing = in const declaration - JavaScript
s when a const declaration was not given a value in the same statement (like const red_flag;). you need to provide one (const red_flag = '#ff0'). message syntaxerror: const must be initalized (edge) syntaxerror: missing = in const declaration (firefox) syntaxerror: missing initializer in const declaration (chrome) error type syntaxerror what went wrong? a constant is a value that cannot be
altered by the program during normal execution. it cannot change through re-assignment, and it can't be redeclared. in javascript, constants are declared using the const keyword. an initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which makes sense, given that it can't be changed later). examples missing const initializer unl...
SyntaxError: missing name after . operator - JavaScript
javascript use either the dot (.) or square brackets ([]), but not both. square brackets allow computed property access. var obj = { foo: { bar: "baz", bar2: "baz2" } }; var i = 2; obj.[foo].[bar] // syntaxerror: missing name after . operator obj.foo."bar"+i; // syntaxerror: missing name after . operator to fix this code, you need to access the object like this: obj.foo.bar; // "baz" // or
alternatively obj["foo"]["bar"]; // "baz" // computed properties require square brackets obj.foo["bar" + i]; // "baz2" property access vs. concatenation if you are coming from another programming language (like php), it is also easy to mix up the dot operator (.) and the concatenation operator (+). console.log("hello" . "world"); // syntaxerror: missing name after . operator instead you need t...
The arguments object - JavaScript
thtml = list('u', 'one', 'two', 'three'); /* listhtml is: "<ul><li>one</li><li>two</li><li>three</li></ul>" */ rest, default, and destructured parameters the arguments object can be used in conjunction with rest, default, and destructured parameters. function foo(...args) { return args; } foo(1, 2, 3); // [1, 2, 3] while the presence of rest, default, or destructured parameters does not
alter the behavior of the arguments object in strict mode code, there are subtle differences for non-strict code. in strict-mode code, the arguments object behaves the same whether or not a function is passed rest, default, or destructured parameters. that is, assigning new values to variables in the body of the function will not affect the arguments object. nor will assigning new variables to the a...
getter - JavaScript
n sometimes it is desirable to allow access to a property that returns a dynamically computed value, or you may want to reflect the status of an internal variable without requiring the use of explicit method calls. in javascript, this can be accomplished with the use of a getter. it is not possible to simultaneously have a getter bound to a property and have that property actually hold a value,
although it is possible to use a getter and a setter in conjunction to create a type of pseudo-property. 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 mu...
Functions - JavaScript
* 9 - for 'expr' by function expression (current scope) * 5 - for 'cons' by function constructor (global scope) */ functions defined by function expressions and function declarations are parsed only once, while those defined by the function constructor are not. that is, the function body string passed to the function constructor must be parsed each and every time the constructor is called.
although a function expression creates a closure every time, the function body is not reparsed, so function expressions are still faster than "new function(...)". therefore the function constructor should generally be avoided whenever possible. it should be noted, however, that function expressions and function declarations nested within the function generated by parsing a function constructor 's st...
Array.prototype[@@iterator]() - JavaScript
for...of loop html <ul id="letterresult"> </ul> javascript var arr = ['a', 'b', 'c']; var earr = arr[symbol.iterator](); var letterresult = document.getelementbyid('letterresult'); // your browser must support for..of loop // and let-scoped variables in for loops // const and var could also be used for (let letter of earr) { letterresult.innerhtml += "<li>" + letter + "</li>"; } result
alternative iteration var arr = ['a', 'b', 'c', 'd', 'e']; var earr = arr[symbol.iterator](); console.log(earr.next().value); // a console.log(earr.next().value); // b console.log(earr.next().value); // c console.log(earr.next().value); // d console.log(earr.next().value); // e use case for brace notation the use case for this syntax over using the dot notation (array.prototype.values()) is in a ...
Array.prototype.concat() - JavaScript
details. return value a new array instance. 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). it does not recurse into nested array arguments. the concat method does not
alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains copies of the same elements combined from the original arrays. elements of the original arrays are copied into the new array as follows: object references (and not the actual object): concat copies object references into the new array. both the original and new array refer to the same object. tha...
Array.prototype.copyWithin() - JavaScript
ft the data of an array. this especially applies to the typedarray method of the same name. the sequence is copied and pasted as one operation; pasted sequence will have the copied values even when the copy and paste region overlap. the copywithin function is intentionally generic, it does not require that its this value be an array object. the copywithin method is a mutable method. it does not
alter the length of this, but it will change its content and create new properties, if necessary. polyfill if (!array.prototype.copywithin) { object.defineproperty(array.prototype, 'copywithin', { value: function(target, start/*, end*/) { // steps 1-2. if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); // steps 3-5. ...
Array.prototype.flat() - JavaScript
f you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var newarray = arr.flat([depth]); parameters depth optional the depth level specifying how deep a nested array structure should be flattened. defaults to 1. return value a new array with the sub-array elements concatenated into it. ...
Array.prototype.flatMap() - JavaScript
ional the array map was called upon. thisargoptional value to use as this when executing callback. return value a new array with each element being the result of the callback function and flattened to a depth of 1. description see array.prototype.map() for a detailed description of the callback function. the flatmap method is identical to a map followed by a call to flat of depth 1. ...
Array.prototype.forEach() - JavaScript
m2', 'item3'] const copyitems = [] // before for (let i = 0; i < items.length; i++) { copyitems.push(items[i]) } // after items.foreach(function(item){ copyitems.push(item) }) printing the contents of an array note: in order to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array. the following example illustrates an
alternative approach, using foreach(). the following code logs a line for each element in an array: function logarrayelements(element, index, array) { console.log('a[' + index + '] = ' + element) } // notice that index 2 is skipped, since there is no item at // that position in the array... [2, 5, , 9].foreach(logarrayelements) // logs: // a[0] = 2 // a[1] = 5 // a[3] = 9 using thisarg the f...
Array.prototype.slice() - JavaScript
nd of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence. if end is omitted, slice extracts through the end of the sequence (arr.length). if end is greater than the length of the sequence, slice extracts through to the end of the sequence (arr.length). return value a new array containing the extracted elements. description slice does not
alter the original 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. both the original and new array refer to the same object. if a referenced object changes, the changes are visible to both the new a...
Array - JavaScript
0] console.log(years.0) // a syntax error console.log(years[0]) // works properly renderer.3d.settexture(model, 'character.png') // a syntax error renderer['3d'].settexture(model, 'character.png') // works properly in the 3d example, '3d' had to be quoted (because it begins with a digit). but it's also possible to quote the array indexes as well (e.g., years['2'] instead of years[2]),
although it's not necessary. the 2 in years[2] is coerced into a string by the javascript engine through an implicit tostring conversion. 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 nume...
DataView - JavaScript
2-bit (4-byte) parts const left = dataview.getuint32(byteoffset, littleendian); const right = dataview.getuint32(byteoffset+4, littleendian); // combine the two 32-bit values const combined = littleendian? left + 2**32*right : 2**32*left + right; if (!number.issafeinteger(combined)) console.warn(combined, 'exceeds max_safe_integer. precision may be lost'); return combined; }
alternatively, if you need full 64-bit range, you can create a bigint. 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. const bigint = window.bigint, bigthirtytwo = bigint(32), bigzero = bigint(0); function getuint64bigint(dataview, byteoffset, littleend...
Date - JavaScript
ticularly useful are the functions that output the date and time in coordinated universal time (utc), the global standard time defined by the world time standard. (this time is historically known as greenwich mean time, as utc lies along the meridian that includes london—and nearby greenwich—in the united kingdom.) the user's device provides the local time. in addition to methods to read and
alter individual components of the local date and time (such as getday() and sethours()), there are also versions of the same methods that read and manipulate the date and time using utc (such as getutcday() and setutchours()). constructor date() creates a new date object. static methods date.now() returns the numeric value corresponding to the current time—the number of milliseconds ela...
Error.prototype.lineNumber - JavaScript
the linenumber property contains the line number in the file that raised this error. examples using linenumber var e = new error('could not parse input'); throw e; console.log(e.linenumber) // 2
alternative example using error event window.addeventlistener('error', function(e) { console.log(e.linenumber); // 5 }); var e = new error('could not parse input'); throw e; this is not a standard feature and lacks widespread support. see the browser compatability table below. specifications not part of any standard. ...
EvalError - JavaScript
the evalerror object indicates an error regarding the global eval() function. this exception is not thrown by javascript anymore, however the evalerror object remains for compatibility. constructor evalerror() creates a new evalerror object. instance properties evalerror.prototype.message error message.
although ecma-262 specifies that evalerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. evalerror.prototype.name error name. inherited from error. evalerror.prototype.filename path to file that raised this error. inherited from error. evalerror.prototype.linenumber line number in file that raised this error. inherited from error. evalerror.prototype.columnnumber column number in line that raised this error. inherited from er...
Function.prototype.apply() - JavaScript
java). 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. function.prototype.construct = function(aargs) { let onew = object.create(this.prototype); this.apply(onew, aargs); return onew; }; note: the object.create() method used above is relatively new. ...
Function.prototype.bind() - JavaScript
need not do anything special to create a bound function for use with new. the corollary is that you need not do anything special to create a bound function to be called plainly, even if you would rather require the bound function to only be called using new. // example can be run directly in your javascript console // ...continued from above // can still be called as a normal function // (
although usually this is undesired) yaxispoint(13); `${emptyobj.x},${emptyobj.y}`; // > '0,13' if you wish to support the use of a bound function only using new, or only by calling it, the target function must enforce that restriction. creating shortcuts bind() is also helpful in cases where you want to create a shortcut to a function which requires a specific this value. take array.prototype.
Generator.prototype.next() - JavaScript
function will be assigned to variable. return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence. in this case value optionally specifies the return value of the iterator. has the value false if the iterator was able to produce the next value in the sequence. this is equivalent of not specifying the done property
altogether. value any javascript value returned by the iterator. can be omitted when done is true. 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, do...
Generator.prototype.throw() - JavaScript
to make it an instanceof error. return value an object with two properties: done (boolean) has the value true if the iterator is past the end of the iterated sequence. in this case value optionally specifies the return value of the iterator. has the value false if the iterator was able to produce the next value in the sequence. this is equivalent of not specifying the done property
altogether. value any javascript value returned by the iterator. can be omitted when done is true. examples using throw() the following example shows a simple generator and an error that is thrown using the throw method. an error can be caught by a try...catch block as usual. function* gen() { while(true) { try { yield 42; } catch(e) { console.log('error caught!'); ...
Map - JavaScript
ts elements in insertion order — a for...of loop returns an array of [key, value] for each iteration. key equality key equality is based on the samevaluezero algorithm. nan is considered the same as nan (even though nan !== nan) and all other values are considered equal according to the semantics of the === operator. in the current ecmascript specification, -0 and +0 are considered equal,
although this was not so in earlier drafts. see "value equality for -0 and 0" in the browser compatibility table for details. objects vs. maps object is similar to map—both let you set keys to values, retrieve those values, delete keys, and detect whether something is stored at a key. for this reason (and because there were no built-in
alternatives), objects have been used as maps historically. ...
Math.clz32() - JavaScript
r |= integer << 4; integer |= integer << 2; integer |= integer << 1; // 2. now, inversing the bits reveals the lowest bits return 32 - clz(~integer) |0; // `|0` ensures integer coercion } function ctron(integer){ // count trailing ones // no shift-filling-in-with-ones operator is available in // javascript, so the below code is the fastest return ctrz(~integer); /*
alternate implementation for demonstrational purposes: // 1. erase all the higher bits after the first zero integer &= (integer << 16) | 0xffff; integer &= (integer << 8 ) | 0x00ff; integer &= (integer << 4 ) | 0x000f; integer &= (integer << 2 ) | 0x0003; integer &= (integer << 1 ) | 0x0001; // 2. now, inversing the bits reveals the lowest zeros ...
Object.assign() - JavaScript
if the source value is a reference to an object, it only copies the reference value. function test() { 'use strict'; let obj1 = { a: 0 , b: { c: 0}}; let obj2 = object.assign({}, obj1); console.log(json.stringify(obj2)); // { "a": 0, "b": { "c": 0}} obj1.a = 1; console.log(json.stringify(obj1)); // { "a": 1, "b": { "c": 0}}...
Object.freeze() - JavaScript
a properties of a frozen object, values cannot be changed, the writable and configurable attributes are set to false. accessor properties (getters and setters) work the same (and still give the illusion that you are changing the value). note that values that are objects can still be modified, unless they are also frozen. as an object, an array can be frozen; after doing so, its elements cannot be
altered and no elements can be added to or removed from the array. freeze() returns the same object that was passed into the function. it does not create a frozen copy. in es5, if the argument to this method is not an object (a primitive), then it will cause a typeerror. in es2015, a non-object argument will be treated as if it were a frozen ordinary object, and be simply returned. > object.free...
Object.seal() - JavaScript
making all properties non-configurable also prevents them from being converted from data properties to accessor properties and vice versa, but it does not prevent the values of data properties from being changed. attempting to delete or add properties to a sealed object, or to convert a data property to accessor or vice versa, will fail, either silently or by throwing a typeerror (most commonly,
although not exclusively, when in strict mode code). the prototype chain remains untouched. however, the __proto__ property is sealed as well. comparison to object.freeze() existing properties in objects frozen with object.freeze() are made immutable. objects sealed with object.seal() can have their existing properties changed. examples using object.seal var obj = { prop: function() {}, foo...
Object.setPrototypeOf() - JavaScript
the object.setprototypeof() method sets the prototype (i.e., the internal [[prototype]] property) of a specified object to another object or null. warning: changing the [[prototype]] of an object is, by the nature of how modern javascript engines optimize property accesses, currently a very slow operation in every browser and javascript engine. in addition, the effects of
altering inheritance are subtle and far-flung, and are not limited to simply the time spent in the object.setprototypeof(...) statement, but may extend to any code that has access to any object whose [[prototype]] has been
altered. because this feature is a part of the language, it is still the burden on engine developers to implement that feature performantly (ideally). until engine developers address this issue, if you...
Promise - JavaScript
e that function troublewithgetnumber() ends with a throw(). that is forced because an es6 promise chain goes through all the .then() promises, even after an error, and without the "throw()", the error would seem "fixed". this is a hassle, and for this reason, it is common to omit rejectionfunc throughout the chain of .then() promises, and just have a single rejectionfunc in the final catch(). the
alternative is to throw a special value (in this case "-999", but a custom error type would be more appropriate). this code can be run under nodejs. comprehension is enhanced by seeing the errors actually occur. to force more errors, change the threshold values. "use strict"; // to experiment with error handling, "threshold" values cause errors randomly const threshold_a = 8; // can use zero 0 to ...
RangeError - JavaScript
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(). constructor rangeerror() creates a new rangeerror object. instance properties rangeerror.prototype.message error message.
although ecma-262 specifies that rangeerror should provide its own message property, in spidermonkey, it inherits error.prototype.message. rangeerror.prototype.name error name. inherited from error. rangeerror.prototype.filename path to file that raised this error. inherited from error. rangeerror.prototype.linenumber line number in file that raised this error. inherited from error. rangeerror...
ReferenceError - JavaScript
referenceerror.prototype.name error name. inherited from error. referenceerror.prototype.filename path to file that raised this error. inherited from error. ...
empty - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax ; description the empty statement is a semicolon (;) indicating that no statement will be executed, even if javascript syntax requires one. 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. ...
async function - JavaScript
return await promisevalue vs. return promisevalue the implicit wrapping of return values in promise.resolve does not imply that return await promisevalue is functionally equivalent to return promisevalue. consider the followi...
block - JavaScript
onal label for visual identification or as a target for break. description the block statement is often called compound statement in other languages. it allows you to use multiple statements where javascript expects only one statement. combining statements into blocks is a common practice in javascript. the opposite behavior is possible using an empty statement, where you provide no statement,
although one is required. blocks are commonly used in association with if...else and for statements. examples block scoping rules with var or function declaration in non-strict mode variables declared with var or created by function declarations in non-strict mode do not have block scope. variables introduced within a block are scoped to the containing function or script, and the effects of setti...
const - JavaScript
ue in the same statement in which it's declared. (this makes sense, given that it can't be changed later.) the const declaration creates a read-only reference to a value. it does not mean the value it holds is immutable—just that the variable identifier cannot be reassigned. for instance, in the case where the content is an object, this means the object's contents (e.g., its properties) can be
altered. all the considerations about the "temporal dead zone" apply to both let and const. a constant cannot share its name with a function or a variable in the same scope. examples basic const usage constants can be declared with uppercase or lowercase, but a common convention is to use all-uppercase letters. // define my_fav as a constant and give it the value 7 const my_fav = 7; // this wi...
with - JavaScript
statement adds the given object to the head of this scope chain during the evaluation of its statement body. if an unqualified name used in the body matches a property in the scope chain, then the name is bound to the property and the object containing the property. otherwise a referenceerror is thrown. using with is not recommended, and is forbidden in ecmascript 5 strict mode. the recommended
alternative is to assign the object whose properties you want to access to a temporary variable. performance pro & contra pro: the with statement can help reduce file size by reducing the need to repeat a lengthy object reference without performance pen
alty. the scope chain change required by 'with' is not computationally expensive. use of 'with' will relieve the interpreter of parsing repeated obj...
Statements and declarations - JavaScript
pair of curly brackets. break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. continue terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. empty an empty statement is used to provide no statement,
although the javascript syntax would expect one. if...else executes a statement if a specified condition is true. if the condition is false, another statement can be executed. switch evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case. throw throws a user-defined exception. try...catch marks a block of statements to try,...
Template literals (Template strings) - JavaScript
'}` }`; tagged templates a more advanced form of template literals are tagged templates. tags allow you to parse template literals with a function. the first argument of a tag function contains an array of string values. the remaining arguments are related to the expressions. the tag function can then perform whatever operations on these arguments you wish, and return the manipulated string. (
alternatively, it can return something completely different, as described in one of the following examples.) the name of the function used for the tag can be whatever you want. let person = 'mike'; let age = 28; function mytag(strings, personexp, ageexp) { let str0 = strings[0]; // "that " let str1 = strings[1]; // " is a " // there is technically a string after // the final expression (i...
JavaScript reference - JavaScript
this part of the javascript section on mdn serves as a repository of facts about the javascript language. read more about this reference. built-ins javascript standard built-in objects, along with their methods and properties. ...
related_applications - Web app manifests
type array mandatory no the related_applications field is an array of objects specifying native applications that are installable by, or accessible to, the underlying platform — for example, a native android application obtainable through the google play store. such applications are intended to be
alternatives to the manifest's website that provides similar/equivalent functionality — like the native app equivalent. note: developer can specify that the native applications are preferred over the web application by setting prefer_related_applications to true. examples "related_applications": [ { "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.example.app1", "id": "com.example.app1" }, { "platform": "itunes...
start_url - Web app manifests
andatory no the start_url member is a string that represents the start url of the web application — the prefered url that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen). note: the start_url member is purely advisory, and a user agent may ignore it or allow the user to
alter it at install time or afterwards. examples absolute url "start_url": "https://example.com" relative url if the url is relative, the manifest url is used as the base url to resolve it. "start_url": "../startpoint.html" specification specification status comment feedback web app manifestthe definition of 'start_url' in that specification. w...
MathML attribute reference - MathML
a string value specifying the action happening for this element. align <mtable> <munder>, <mover>, <munderover> <mstack> specifies different alignments of several elements (see element pages for details). unimplemented alignmentscope <mtable> a boolean value specifying whether table columns should act as alignment scopes or not. unimplemented
altimg
altimg-width
altimg-height
altimg-valign
alttext <math> visual and textual fall-back options. bevelled <mfrac> specifies the style how the fraction should be displayed. deprecated. use u+2044 (fraction slash) instead. unimplemented charalign <mstack> specifies the horizontal alignment of digits. close <mfenced> a string for t...
<maction> - MathML
attributes actiontype the action which specifies what happens for this element. possible values are: statusline: if there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. the syntax is: <maction actiontype="statusline"> expression message </maction>. toggle: when there is a click on the subexpression, the rendering
alternates the display of selected subexpressions. therefore each click increments the selection value. the syntax is: <maction actiontype="toggle" selection="positive-integer" > expression1 expression2 expressionn </maction>. tooltip: when the pointer moves over the expression, a tooltip box with a message is displayed near the expression. the syntax is: <maction actiontype="tooltip"> expressi...
<mi> - MathML
hbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this logical class of the identifier, which varies in typography. that is,
although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value for more than one character) ; example bold ; example italic (default value for a single character) ; example bo...
<mn> - MathML
ckground color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the number which varies in typography. that is,
although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ;...
<mo> - MathML
ground color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the operator which varies in typography. that is,
although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ;...
<ms> - MathML
und color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. that is,
although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ;...
<mstyle> - MathML
sentation elements with the following exceptions: height, depth or width do not apply to <mglyph>, <mpadded> or <mtable>. rowalign, columnalign, or groupalign do not apply to <mtr>, <mlabeledtr>, <mtd> or <maligngroup>. lspace or voffset do not apply to <mpadded>. fontfamily does not apply to <mglyph>. align does not apply to <mtable> or <mstack>. index cannot be set on <mstyle>. src and
alt on <mglyph> cannot be set on <mstyle>. actiontype on <maction> cannot be set on <mstyle>. examples using displaystyle and mathcolor to effect style changes in the layout of the whole sum. <math> <mstyle displaystyle="true" mathcolor="teal"> <mrow> <munderover> <mo stretchy="true" form="prefix">∑</mo> <mrow> <mi>i</mi> <mo form="infix">=</...
<mtext> - MathML
und color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. mathsize the size of the content. see length for possible values. deprecated values are: small, normal and big. these will be removed in the future. mathvariant this attribute specifies the logical class of the identifier, which varies in typography. that is,
although the names suggest the typographic style for the class, semantically, items with the same class are treated "the same" within an expression, which might or might not involve displaying them with the named typography. the following values are allowed: normal (default value) ; example bold ; example italic ; example bold-italic ; example double-struck ; example bold-fraktur ;...
The "codecs" parameter in common media types - Web media technologies
e constrained to all-intra use, and to using only cavlc entropy coding. 44 00 scalable baseline profile intended for use with video conferencing as well as surveillance and mobile uses, the svc baseline profile is based on avc's constrained baseline profile. the base layer within the stream is provided at a high quality level, with some number of secondary substreams that offer
alternative forms of the same video for use in various constrained environments. these may include any combination of reduced resolution, reduced frame rate, or increased compression levels. 53 00 scalable constrained baseline profile primarily used for real-time communication applications. not yet supported by webrtc, but an extension to the webrtc api to allow svc is in developme...
Media type and format guide: image, audio, and video content - Web media technologies
coding, and so forth. tutorials and how-tos learning: video and audio content this tutorial introduces and details the use of media on the web. handling media support issues in web content in this guide, we look at how to build web content that maximizes quality or performance while providing the broadest possible compatibility, by choosing media formats wisely, and offering fallbacks and
alternate formats where it would be helpful. other topics media capabilities api the media capabilities api lets you discover the encoding and decoding capabilities of the device your app or site is running on. this lets you make real-time decisions about what formats to use and when. ...
Guide to streaming audio and video - Web media technologies
uality and performance possible. <<<...xxxxxx...>>> protocols in addition to the configuration of the server and the streaming code, there are sometimes special protocols which can be used to optimize performance. https live streaming https live streaming (hls) is a protocol developed by apple and supported by safari on all of their platforms. hls may also be supported in other environments,
although in some cases this support is conditional. for example, because many web sites' mobile-specific content assume that mobile browsers support hls, firefox for android does as well, in order to avoid strange compatibility errors from occurring due to this assumption being incorrect. the desktop version of android, however, does not support hls. hls uses playlists to allow the user to not only...
Using images in HTML - Web media technologies
to resources that deal with adding images to websites. references these articles cover some of the html elements and css properties that are used to control how images are displayed on the web. html <img> the html <img> element is used to embed an image in a webpage. it supports a wide range of attributes that control how the image behaves and allows you to add important information like
alt text for people who don't see the image. <picture> the html <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. the browser considers each child <source> element and chooses the best match among them. css object-fit the object-fit css property sets how the content of a replaced element,...
Web media technologies
ulation, and recording. if you're not sure which api you should use, this is the place to start. using audio and video in html a guide to using the html <audio> and <video> elements. accessibility guide for media in web design in this guide, we cover ways web designers and developers can create content that is accessible to people with different capabilities. this ranges from simply using the
alt attribute on <img> elements to captions to tagging media for screen readers. guide to media types and formats on the web a guide to the file types and codecs available for images, audio, and video media on the web. this includes recommendations for what formats to use for what kinds of content, best practices including how to provide fallbacks and how to prioritize media types, and also include...
Lazy loading - Web Performance
load. most of those images are off-screen (non-critical), requiring user interaction (an example being scroll) in order to view them. loading attribute the loading attribute on an <img> element (or the loading attribute on an <iframe>) can be used to instruct the browser to defer loading of images/iframes that are off-screen until the user scrolls near them. <img src="image.jpg" loading="lazy"
alt="..." /> <iframe src="video-player.html" loading="lazy"></iframe> the load event fires when the eagerly-loaded content has all been loaded; at that time, it's entirely possible (or even likely) that there may be lazily-loaded images that are within the visual viewport that haven't yet loaded. you can determine if a given image has finished loading by examining the value of its boolean complete ...
Performance budgets - Web Performance
time to interactive, first contentful paint). quantity-based (e.g. amount of js files/total image size). rule-based (e.g. pagespeed index, lighthouse score). their primary goal is to prevent regressions, but they can provide insights to forecast trends (i.e. on september, 50% of the budget was spent in a week). additionally, it can uncover development needs (i.e. a large library with smaller
alternatives is often picked to solve a common problem). how do i define a performance budget? a budget should include 2 levels: warning. error. the warning level allows you to be proactive and plan any tech debt, while not blocking development or deploys. the error level is an upper bound limit, where changes will have a negative and noticeable impact. in order to begin, you need to first ...
Introduction to progressive web apps - Progressive web apps (PWAs)
for example storing them offline), the cache api for storing responses to network requests offline (very useful for storing site assets), and client-side data storage technologies such as web storage and indexeddb to store application data offline. progressive enhancement suppport modern web apps can be developed to provide an excellent experience to fully capable browsers, and an acceptable (
although not quite as shiny) experience to less capable browsers. we've been doing this for years with best practices such as progressive enhancement. by using progressive enhancement, pwas are cross-browser. this means developers should take into account the differences in implementation of some pwa features and technologies between different browser implementations. re-engageability one major a...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
it defines the arrowhead or polymarker that will be drawn at every vertex other than the first and last vertex of the given <path> element or basic shape. value: <funciri>|none|inherit; animatable: yes marker-start it defines the arrowhead or polymarker that will be drawn at the first vertex of the given <path> element or basic shape. value: <funciri>|none|inherit; animatable: yes mask it
alters the visibility of an element by either masking or clipping the image at specific points. value: see css mask; animatable: yes opacity it specifies the transparency of an object or a group of objects. value: <opacity-value>; animatable: yes overflow specifies whether the content of a block-level element is clipped when it overflows the element's box. value: visible|hidden|scroll|auto|inh...
alignment-baseline - SVG: Scalable Vector Graphics
habetic baselines in roman text to stay aligned across font size changes. it defaults to the baseline with the same name as the computed value of the alignment-baseline property. note: as a presentation attribute alignment-baseline can be used as a css property. ...
baseline-shift - SVG: Scalable Vector Graphics
t-baseline of the parent text content element. the shifted object might be a sub- or superscript. note: as a presentation attribute baseline-shift can be used as a css property. note: this property is going to be deprecated and authors are advised to use vertical-align instead. as a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <
altglyph>, <textpath>, <tref>, and <tspan> usage notes value <length-percentage> | sub | super default value 0 animatable yes sub the dominant-baseline is shifted to the default position for subscripts. super the dominant-baseline is shifted to the default position for superscripts. <length-percentage> a length value raises (positive value) or lower...
class - SVG: Scalable Vector Graphics
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> <g> <glyph> <glyphref> <image> <line> <lineargra...
direction - SVG: Scalable Vector Graphics
s, 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. see css direction for further information. as a presentation attribute, it can be applied to any element but it only has effect on shapes and text context elements, including: <
altglyph>, <textpath>, <text>, <tref>, and <tspan>. html, body, svg { height: 100%; } <svg viewbox="0 0 600 72" xmlns="http://www.w3.org/2000/svg" direction="rtl" lang="fa"> <text x="300" y="50" text-anchor="middle" font-size="36">داستان svg 1.1 se طولا ني است.</text> </svg> usage notes value ltr | rtl default value ltr animatabl...
display - SVG: Scalable Vector Graphics
ntainer and all of its children to be invisible; thus, it acts on groups of elements as a group. this means that any child of an element with display="none" will never be rendered even if the child has a value for display other than none. when the display attribute is set to none, then the given element does not become part of the rendering tree. it has implications for the <tspan>, <tref>, and <
altglyph> elements, event processing, for bounding box calculations and for calculation of clipping paths: if display is set to none on a <tspan>, <tref>, or <
altglyph> element, then the text string is ignored for the purposes of text layout. regarding events, if display is set to none, the element receives no events. the geometry of a graphics element with display set to none is not included in...
dur - SVG: Scalable Vector Graphics
ons like hh:mm:ss.iii or mm:ss.iii. media this value specifies the simple duration as the intrinsic media duration. this is only valid for elements that define media. (for animation elements the attribute will be ignored if media is specified.) indefinite this value specifies the simple duration as indefinite. note: the interpolation will not work if the simple duration is indefinite (
although this may still be useful for <set> elements). specifications specification status comment svg animations level 2the definition of 'dur' in that specification. editor's draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'dur' in that specification. recommendation initial definition ...
fill-opacity - SVG: Scalable Vector Graphics
the fill-opacity attribute is a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to a shape. note: as a presentation attribute fill-opacity can be used as a css property. ...
fill-rule - SVG: Scalable Vector Graphics
the fill-rule attribute is a presentation attribute defining the algorithm to use to determine the inside part of a shape. note: as a presentation attribute, fill-rule can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <
altglyph>, <path>, <polygon>, <polyline>, <text>, <textpath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- default value for fill-rule --> <polygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled...
font-family - SVG: Scalable Vector Graphics
te indicates which font family will be used to render the text, specified as a prioritized list of font family names and/or generic family names. note: as a presentation attribute, font-family can be used as a css property. see the css font-family property for more information. ...
font-size-adjust - SVG: Scalable Vector Graphics
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. note: as a presentation attribute, font-size-adjust can be used as a css property. see the css font-size-adjust property for more information. 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"> ...
font-size - SVG: Scalable Vector Graphics
-size attribute refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment. note: as a presentation attribute, font-size can be used as a css property. see the css font-size property for more information. ...
font-stretch - SVG: Scalable Vector Graphics
the font-stretch attribute indicates the desired amount of condensing or expansion in the glyphs used to render the text. note: as a presentation attribute, font-stretch can be used as a css property. see the css font-stretch property for more information. ...
font-style - SVG: Scalable Vector Graphics
the font-style attribute specifies whether the text is to be rendered using a normal, italic, or oblique face. note: as a presentation attribute, font-style can be used as a css property. see the css font-style property for more information. ...
font-weight - SVG: Scalable Vector Graphics
font-weight attribute refers to the boldness or lightness of the glyphs used to render the text, relative to other fonts in the same font family. note: as a presentation attribute, font-weight can be used as a css property. see the css font-weight property for more information. ...
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
180 degrees, then the current text position is incremented according to the vertical metrics of the glyph. this attribute is applied only to text written in a horizontal writing-mode. note: as a presentation attribute, glyph-orientation-horizontal can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following 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. if another angle is specified, it is rounded to the closest of the permitted values. a value of 0deg indicates that all glyphs are set with the top of the glyphs ...
kerning - SVG: Scalable Vector Graphics
in the relevant font (i.e., enable auto-kerning) or instead disable auto-kerning and set the spacing between them to a specific length (typically, zero). note: as a presentation attribute kerning can be used as a css property. in css the property is called font-kerning, though. ...
<tspan> - SVG: Scalable Vector Graphics
candidate recommendation scalable vector graphics (svg) 1.1 (second edition)the definition of '<tspan>' in that specification. recommendation initial definition ...
Namespaces crash course - SVG: Scalable Vector Graphics
itemns the first parameter for all the dom2 namespace aware methods must be the namespace name (also known as the namespace uri) of the element or parameter in question. for svg elements this is 'http://www.w3.org/2000/svg'. however, note carefully: the namespaces in xml 1.1 recommendation states that the namespace name for parameters without a prefix does not have a value. in other words,
although the parameters belong to the namespace of the element, you do not use the tag's namespace name. instead, you must use null as the namespace name for unqualified (prefixless) parameters. so, to create an svg rect element using document.createelementns(), you must write: document.createelementns('http://www.w3.org/2000/svg', 'rect'); but to retrieve the value of the xparameter on an svg rect...
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
implemented bindings: selectsubstring recently implemented attributes: textlength, lengthadjust tref this feature, present in early draft of the spec, has been removed from it and is therefor not implemented (bug 273171). textpath implemented. recently implemented bindings: selectsubstring
altglyph implemented as tspans, no font features as of gecko 2.0 (bug 456286, bug 571808).
altglyphdef not implemented.
altglyphitem not implemented. glyphref not implemented. marker module marker implemented. color profile module ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
mplemented (bug 1446617) reference basic shapes to <textpath> implementation status unknown side attribute for <textpath> implemented (bug 1446650) render characters for one loop of a single closed path, effected by the startoffset attribute and text-anchor property implementation status unknown <tref> removed implementation status unknown <
altglyph>, <
altglyphdef>, <
altglyphitem> and <glyphref> removed <
altglyph>, <
altglyphdef> and <
altglyphitem> removed (bug 1260032), <glyphref> never really implemented (bug 1302693) svgtextcontentelement.selectsubstring() deprecated implementation status unknown getcomputedtextlength() not including dx and dy values implementation status unknown text in non-rendere...
SVG animation with SMIL - SVG: Scalable Vector Graphics
firefox 4 introduced support for animating svg using synchronized multimedia integration language (smil). smil allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path this is done adding an svg element like <animate> inside the svg element to animate. below are examples for the four different ways. animating attributes of an element the following example animates the cx attribute of a circle. to do so, we add an <animate> element inside the <circle> element. ...
Scripting - SVG: Scalable Vector Graphics
ace. prior to svg 2, svg documents were represented using that interface. however, svg documents are now represented using the xmldocument interface instead. inter-document scripting: calling javascript functions when calling a javascript function that resides in the html file from an svg file that is embedded in an html document, you should use parent.functionname() to reference the function.
although the adobe svg viewer plugin allows the use of functionname(), it's not the preferred way to do things. according to the svg wiki the "parent" js variable is broken in adobe's svg version 6 preview plugin. the suggested workaround is to use "top" instead of "parent". since it is a beta version of their plugin, we can probably safely ignore this. more information and some examples can be f...
Gradients in SVG - SVG: Scalable Vector Graphics
t have to recreate all the stops in gradient2. <lineargradient id="gradient1"> <stop id="stop1" offset="0%"/> <stop id="stop2" offset="50%"/> <stop id="stop3" offset="100%"/> </lineargradient> <lineargradient id="gradient2" x1="0" x2="0" y1="0" y2="1" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#gradient1"/> i've included the xlink namespace here directly on the node,
although usually you would define it at the top of your document. more on that when we talk about images. radial gradient radial gradients are similar to linear ones but draw a gradient that radiates out from a point. to create one you add a <radialgradient> element to the definitions section of your document. basic example <?xml version="1.0" standalone="no"?> <svg width="120" height="240" versi...
Referer header: privacy and security concerns - Web security
uch risks using: the referrer-policy header on your server to control what information is sent through the referer header. again, a directive of no-referrer would omit the referer header entirely. the referrerpolicy attribute on html elements that are in danger of leaking such information (such as <img> and <a>). this can for example be set to no-referrer to stop the referer header being sent
altogether. the rel attribute set to noreferrer on html elements that are in danger of leaking such information (such as <img> and <a>). see link types and search for noreferrer for more information. the exit page technique. security-conscious server-side frameworks tend to have built in mitigations for such problems, for example: security in django (especially see cross site request forgery (...
Tutorials
you use to style your webpage. css basics takes you through what you need to get started. we'll answer questions like: how do i make my text black or red? how do i make my content show up in such-and-such a place on the screen? how do i decorate my webpage with background images and colors? css first steps css (cascading style sheets) is used to style and lay out web pages — for example, to
alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks like, and how you can start using it to add styling to html. css building blocks this module carries on where css first steps...
Using custom elements - Web Components
t.append(style,wrapper); finally, we register our custom element on the customelementregistry using the define() method we mentioned earlier — in the parameters we specify the element name, and then the class name that defines its functionality: customelements.define('popup-info', popupinfo); it is now available to use on our page. over in our html, we use it like so: <popup-info img="img/
alt.png" data-text="your card validation code (cvc) is an extra security feature — it is the last 3 or 4 numbers on the back of your card."></popup-info> note: you can see the full javascript source code here. internal vs. external styles in the above example we apply style to the shadow dom using a <style> element, but it is perfectly possible to do it by referencing an external styleshee...
Using templates and slots - Web Components
ript. 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. using templates with web components templates are useful on their own, but they work even better with web components. let's define a web component that uses our template as the content of its shadow dom. we'll call it <my-paragraph>: customelements.define('my-paragraph', class extends htmlelement { constructor() { ...
XPath snippets - XPath
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" city="denver" state="co" country="usa"/> </person> </people> you can now "query" the document with xpath expressions.
although walking the dom tree can achieve similar results, using xpath expressions is much quicker and more powerful. if you can rely on id attributes, document.getelementbyid() is still powerful, but it's not nearly as powerful as xpath. here are some examples. example: javascript code with the custom evaluatexpath() utility function // display the last names of all people in the doc var results ...
<xsl:choose> - XSLT: Extensible Stylesheet Language Transformations
it behaves like a switch statement in procedural languages. syntax <xsl:choose> <xsl:when test="[whatever to test1]"></xsl:when> <xsl:when test="[whatever to test2]"></xsl:when> <xsl:otherwise></xsl:otherwise> [optional] </xsl:choose> required attributes none. optional attributes none. type instruction, appears with a template. ...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
(transformiix). creating an xsltprocessor to start, you need to create an xsltprocessor object: var processor = new xsltprocessor(); specifying the stylesheet before you can use it, you must import a stylesheet with the xsltprocessor.importstylesheet() method. it has a single parameter, which is the dom node of the xslt stylesheet to import. note: the import is live, meaning that if you
alter the stylesheet dom after importing it, this will be reflected in the processing. rather than modifying the dom it is recommended to use stylesheet parameters which are usually easier and can give better performance. var testtransform = document.implementation.createdocument("", "test", null); // just an example to get a transform into a script as a dom // xmldocument.load is asynchronous, so a...