Search completed in 1.29 seconds.
nsIDOMWindowUtils
dom/interfaces/base/
nsidomwindowutils.idlscriptable this interface is a dom utility interface that provides useful dom methods and attributes.
...to get this interface, use: var domwindowutils = window.windowutils; method overview void activatenativemenuitemat(in astring indexstring); void clearmozafterpaintevents(); pruint32 comparecanvases(in
nsidomhtmlcanvaselement acanvas1, in
nsidomhtmlcanvaselement acanvas2, out unsigned long amaxdifference); double computeanimationdistance(in
nsidomelement element, in astring property, in astring value1, in astring value2); nsicompositionstringsynthesizer createcompositionstringsynthesizer(); obsolete since gecko 38.0 void disablenontestmouseevents(in boolean adisable); ...
... boolean dispatchdomeventviapresshell(in
nsidomnode atarget, in
nsidomevent aevent, in boolean atrusted);
nsidomelement elementfrompoint(in float ax, in float ay, in boolean aignorerootscrollframe, in boolean aflushlayout); void entermodalstate();
nsidomelement findelementwithviewid(in nsviewid aid); void focus(in
nsidomelement aelement); void forceupdatenativemenuat(in astring indexstring); void garbagecollect([optional] in nsicyclecollectorlistener alistener); short getcursortype(); astring getdocumentmetadata(in astring aname);
nsidomwindow getouterwindowwithid(in unsigned long long aouterwindowid); long getpccountscriptcount(); astring getpccountscriptsummary(in long ascri...
...And 32 more matches
nsIDocShell
docshell/base/
nsidocshell.idlscriptable ???
...instead, retrieve an
nsidocshell from a browser or other document container element.
... note that out-of-process browsers do not have an
nsidocshell; instead you can access the
nsidocshell object from a frame script.
...And 27 more matches
nsIDOMWindowInternal
dom/interfaces/base/
nsidomwindowinternal.idlscriptable this interface is part of a chain of interfaces used to represent a window in the dom.
... 66 introduced gecko 1.0 deprecated gecko 8.0 inherits from:
nsidomwindow last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) in gecko 8.0 this interface was merged into the
nsidomwindow interface.
...add-ons should be updated to use
nsidomwindow instead.
...And 22 more matches
nsIDOMMozNetworkStatsManager
please check dom/network/interfaces/
nsidomnetworkstatsmanager.idl to make sure this data is accurate.
... dom/network/interfaces/
nsidomnetworkstatsmanager.idlscriptable interface that provides access to network usage statistics.
...to create an instance, use: var networkstatsmanager = components.classes["@mozilla.org/networkstatsmanager;1"] .createinstance(components.interfaces.
nsidomnetworkstatsmanager); furthermore, the networkstatsmanager is published through a moznetworkstats child object within the navigator object.
...And 17 more matches
nsIDOMWindow
dom/interfaces/base/
nsidomwindow.idlscriptable this interface is the primary interface for a window object.
... starting in firefox 3, dom windows are actually based on
nsidomwindow2, which is a subclass of
nsidomwindow that adds some new features to this interface.
... in gecko 7.0
nsidomwindow2 has been merged into this interface.
...And 17 more matches
nsIDownloadProgressListener
/toolkit/components/downloads/
nsidownloadprogresslistener.idlscriptable this interface gives applications and extensions a way to monitor the status of downloads being processed by the download manager.
... inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) to use simply implement this interface in your code, then call
nsidownloadmanager.addlistener() to start listening.
... when you no longer need to listen to the download manager's state, call
nsidownloadmanager.removelistener() to stop listening.
...And 16 more matches
nsIDownloadManager
toolkit/components/downloads/public/
nsidownloadmanager.idlscriptable this interface lets applications and extensions communicate with the download manager, adding and removing files to be downloaded, fetching information about downloads, and being notified when downloads are completed.
...to get the service, use: var downloadmanager = components.classes["@mozilla.org/download-manager;1"] .getservice(components.interfaces.
nsidownloadmanager); method overview
nsidownload adddownload(in short adownloadtype, in nsiuri asource, in nsiuri atarget, in astring adisplayname, in nsimimeinfo amimeinfo, in prtime astarttime, in nsilocalfile atempfile, in nsicancelable acancelable, in boolean aisprivate); void addlistener(in
nsidownloadprogresslistener alistener); void canceldownload(in unsigned long aid); void cleanup(); void endbatchupdate(); obsolete since gecko...
... 1.9.1 void flush(); obsolete since gecko 1.8
nsidownload getdownload(in unsigned long aid); void onclose(); obsolete since gecko 1.9.1 void open(in
nsidomwindow aparent, in
nsidownload adownload); obsolete since gecko 1.9.1 void openprogressdialogfor(in
nsidownload adownload, in
nsidomwindow aparent, in boolean acanceldownloadonclose); obsolete since gecko 1.9.1 void pausedownload(in unsigned long aid); void removedownload(in unsigned long aid); void removedownloadsbytimeframe(in long long abegintime, in long long aendtime); void removelistener(in
nsidownloadprogresslistener alistener); void resumedownload(in unsigned long aid); void retrydownload(in unsigned long aid); void savest...
...And 13 more matches
break-inside - CSS: Cascading Style Sheets
the break-i
nside css property sets how page, column, or region breaks should behave i
nside a generated box.
... /* keyword values */ break-i
nside: auto; break-i
nside: avoid; break-i
nside: avoid-page; break-i
nside: avoid-column; break-i
nside: avoid-region; /* global values */ break-i
nside: inherit; break-i
nside: initial; break-i
nside: unset; each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the previous element, the break-before value of the next element, and the break-i
nside value of the containing element.
...thus, the break-before value has precedence over the break-after value, which in turn has precedence over the break-i
nside value.
...And 10 more matches
nsIDBChangeListener
the
nsidbchangelistener interface is used by components wanting to receive notification when the current database changes somehow.
...ction(akeychanged, oldparent, newparent, ainstigator) {}, onannouncergoingaway: function(ainstigator) {}, onreadchanged: function(ainstigator) {}, onjunkscorechanged: function(ainstigator) {}, onhdrpropertychanged: function(ahdrtochange, aprechange, astatus, ainstigator) {}, onevent: function(adb, aevent) {}, queryinterface: function(aiid) { if (!aiid.equals(components.interfaces.
nsidbchangelistener) && !aiid.equals(components.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.
...essage database: if you have a nsimsgfolder, you can do this like so: somefolder.msgdatabase.addlistener(mylistener); alternately, you can access the message database through the nsimsgdbview like so: gfolderdisplay.view.dbview.db.addlistener(mylistener); method overview void onhdrflagschanged(in nsimsgdbhdr ahdrchanged, in unsigned long aoldflags, in unsigned long anewflags, in
nsidbchangelistener ainstigator); void onhdrdeleted(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in
nsidbchangelistener ainstigator); void onhdradded(in nsimsgdbhdr ahdrchanged, in nsmsgkey aparentkey, in long aflags, in
nsidbchangelistener ainstigator); void onparentchanged(in nsmsgkey akeychanged, in nsmsgkey oldparent, in nsmsgkey newparent, in
nsid...
...And 9 more matches
nsIDOMElement
dom/interfaces/core/
nsidomelement.idlscriptable this interface represents an element in an html or xml document.
... inherits from:
nsidomnode last changed in gecko 1.7 method overview domstring getattribute(in domstring name);
nsidomattr getattributenode(in domstring name);
nsidomattr getattributenodens(in domstring namespaceuri, in domstring localname); domstring getattributens(in domstring namespaceuri, in domstring localname);
nsidomnodelist getelementsbytagname(in domstring name);
nsidomnodelist getelementsbytagnamens(in domstring namespaceuri, in domstring localname); boolean hasattribute(in domstring name); boolean hasattributens(in domstring namespaceuri, in domstring localname); void removeattribute(in domstring name)
nsidomattr removeattributenode(in
nsidomattr oldattr) void removeattributens(in domstring namespaceuri, in domstring localname) void setattribute(in doms...
...tring name, in domstring value)
nsidomattr setattributenode(in
nsidomattr newattr)
nsidomattr setattributenodens(in
nsidomattr newattr) void setattributens(in domstring namespaceuri, in domstring qualifiedname, in domstring value) attributes attribute type description tagname domstring the element tag name.
...And 9 more matches
nsIDOMNode
dom/interfaces/core/
nsidomnode.idlscriptable this interface is the primary datatype for the entire document object model.
... inherits from: nsisupports last changed in gecko 0.9.6 method overview
nsidomnode appendchild(in
nsidomnode newchild)
nsidomnode clonenode(in boolean deep); boolean hasattributes(); boolean haschildnodes();
nsidomnode insertbefore(in
nsidomnode newchild, in
nsidomnode refchild) boolean issupported(in domstring feature, in domstring version); void normalize();
nsidomnode removechild(in
nsidomnode oldchild)
nsidomnode replacechild(in
nsidomnode newchild, in
nsidomnode oldchild) attributes attribute type description attributes
nsidomnamednodemap read only.
... childnodes
nsidomnodelist read only.
...And 9 more matches
nsIDOMGeoGeolocation
summary the
nsidomgeogeolocation interface provides access to geolocation information.
... dom/interfaces/geolocation/
nsidomgeogeolocation.idlscriptable please add a summary to this article.
...starting in gecko 1.9.2, you can access this service using: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.
nsidomgeogeolocation); note: if
nsidgeogeolocation throws an exception when importing, try using this: var geolocation = components.classes["@mozilla.org/geolocation;1"] .getservice(components.interfaces.nsisupports); method overview void clearwatch(in unsigned short watchid); void getcurrentposition(in
nsidomgeopositioncallback successcallback, [optional] in
nsidomgeopositionerrorca...
...And 8 more matches
nsIDeviceMotion
xpcom/system/
nsidevicemotion.idlscriptable this interface is used to implement accelerometer support.
... 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named
nsidevicemotion prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3).
... method overview void addlistener(in
nsidevicemotionlistener alistener); void addwindowlistener(in
nsidomwindow awindow); native code only!
...And 8 more matches
Using nsIDirectoryService
when you have it, queryinterface for the
nsidirectoryservice interface.
... apart from this interface there is a function, registerprovider which will allow you to register a
nsidirectoryserviceprovider, which implements the getfile callback function: var provider = { getfile : function(prop, persistant) { // return an nsifile }, } components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.
nsidirectoryservice).registerprovider(provider); when the callback is called, it will be passed the string key, and should return an nsifile.
...the new method the new method uses
nsidirectoryservice to locate files and directories.
...And 8 more matches
page-break-inside - CSS: Cascading Style Sheets
this property has been replaced by the break-i
nside property.
... the page-break-i
nside css property adjusts page breaks i
nside the current element.
... /* keyword values */ page-break-i
nside: auto; page-break-i
nside: avoid; /* global values */ page-break-i
nside: inherit; page-break-i
nside: initial; page-break-i
nside: unset; syntax values auto initial value.
...And 8 more matches
nsIDOMOfflineResourceList
the
nsidomofflineresourcelist interface provides access to the application cache that allows web content's resources to be cached locally for use while offline.
... dom/interfaces/offline/
nsidomofflineresourcelist.idlscriptable please add a summary to this article.
...6 / thunderbird 3.1 / fennec 1.0) inherits from: nsisupports method overview void mozadd(in domstring uri); boolean mozhasitem(in domstring uri); domstring mozitem(in unsigned long index); void mozremove(in domstring uri); void swapcache(); void update(); attributes attribute type description mozitems
nsidomofflineresourcelist the list of dynamically-managed entries in the offline resource list.
...And 7 more matches
nsIDOMNSHTMLDocument
dom/interfaces/html/
nsidomnshtmldocument.idlscriptable this interface defines methods and properties supported by gecko on the document object that are not part of dom level 2.
...isupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void captureevents(in long eventflags); void clear(); boolean execcommand(in domstring commandid, in boolean doshowui, in domstring value); boolean execcommandshowhelp(in domstring commandid); obsolete since gecko 14.0 domstring getselection();
nsidomdocument open(in acstring acontenttype, in boolean areplace); boolean querycommandenabled(in domstring commandid); boolean querycommandindeterm(in domstring commandid); boolean querycommandstate(in domstring commandid); boolean querycommandsupported(in domstring commandid); domstring querycommandtext(in domstring commandid); obsolete since gecko 14.0 ...
... domstring querycommandvalue(in domstring commandid); void releaseevents(in long eventflags); void routeevent(in
nsidomevent evt); void write(); obsolete since gecko 2.0 void writeln(); obsolete since gecko 2.0 attributes attribute type description alinkcolor domstring same as body.alink bgcolor domstring same as body.bgcolor compatmode domstring returns "backcompat" if the document is in quirks mode or "css1compat" if the document is in full standards or almost standards mode.
...And 5 more matches
nsIDOMXPathEvaluator
dom/interfaces/xpath/
nsidomxpathevaluator.idlscriptable this interface is used to evaluate xpath expressions against a dom node.
...to create an instance, use: var domxpathevaluator = components.classes["@mozilla.org/dom/xpath-evaluator;1"] .createinstance(components.interfaces.
nsidomxpathevaluator); method overview
nsidomxpathexpression createexpression(in domstring expression, in
nsidomxpathnsresolver resolver)
nsidomxpathnsresolver creatensresolver(in
nsidomnode noderesolver); nsisupports evaluate(in domstring expression, in
nsidomnode contextnode, in
nsidomxpathnsresolver resolver, in unsigned short type, in nsisupports result) methods createexpression() creates an
nsidomxpathexpression which can then be used for (repeated) evaluations.
...
nsidomxpathexpression createexpression( in domstring expression, in
nsidomxpathnsresolver resolver ); parameters expression a string representing the xpath to be created.
...And 5 more matches
nsIDragService
widget/
nsidragservice.idlscriptable implements the drag service for handling drag and drop operations.
...
nsidragsession getcurrentsession( ) ; void invokedragsession( in
nsidomnode adomnode, in nsisupportsarray atransferables, in nsiscriptableregion aregion, in unsigned long aactiontype ); void invokedragsessionwithimage(in
nsidomnode adomnode, in nsisupportsarray atransferablearray, in nsiscriptableregion aregion, in unsigned long aactiontype, in
nsidomnode aimage, in long aimagex, in ...
...long aimagey, in
nsidomdragevent adragevent, in
nsidomdatatransfer adatatransfer); void invokedragsessionwithselection(in nsiselection aselection, in nsisupportsarray atransferablearray, in unsigned long aactiontype, in
nsidomdragevent adragevent, in
nsidomdatatransfer adatatransfer); void startdragsession( ) ; void suppress(); void unsuppress(); constants constant value description dragdrop_action_none 0 no action.
...And 5 more matches
nsIDNSService
netwerk/dns/
nsidnsservice.idlscriptable provides domain name resolution service.
...to access the service, use: var dnsservice = components.classes["@mozilla.org/network/dns-service;1"] .createinstance(components.interfaces.
nsidnsservice); note: starting in gecko 7.0, the "happy eyeballs" strategy is used to reduce lengthy timeouts when attempting backup connections during attempts to connect from clients that have broken ipv6 connectivity.
... method overview nsicancelable asyncresolve(in autf8string ahostname, in unsigned long aflags, in
nsidnslistener alistener, in nsieventtarget alistenertarget); void init(); obsolete since gecko 1.8
nsidnsrecord resolve(in autf8string ahostname, in unsigned long aflags); void shutdown(); obsolete since gecko 1.8 attributes attribute type description myhostname autf8string read only.
...And 4 more matches
nsIDOMEvent
dom/interfaces/events/
nsidomevent.idlscriptable this interface is the primary data type for all events in the document object model.
...n boolean cancelablearg); boolean isdispatchstopped(); violates the xpcom interface guidelines void preventbubble(); obsolete since gecko 24 void preventcapture(); obsolete since gecko 24 void preventdefault(); void serialize(in ipcmessageptr amsg, in boolean aserializeinterfacetype); violates the xpcom interface guidelines void settarget(in
nsidomeventtarget atarget); native code only!
... currenttarget
nsidomeventtarget used to indicate the eventtarget whose eventlisteners are currently being processed.
...And 4 more matches
nsIDOMWindow2
dom/interfaces/base/
nsidomwindow2.idlscriptable this interface is the primary interface for a dom window object.
... inherits from:
nsidomwindow last changed in gecko 1.9 (firefox 3) because
nsidomwindow is frozen, this interface was introduced in firefox 3 (gecko 1.9) to allow dom windows to take on new features.
... dom windows implement
nsidomwindow2, which is a subclass of
nsidomwindow.
...And 4 more matches
nsIDirectoryService
xpcom/io/
nsidirectoryservice.idlscriptable this interface provides methods to initialize and configure a directory service instance.
... inherits from: nsisupports last changed in gecko 1.7 method overview void init(); void registerprovider(in
nsidirectoryserviceprovider prov); void unregisterprovider(in
nsidirectoryserviceprovider prov); init() initializes the
nsidirectoryservice instance.
... this method must be called before an
nsidirectoryservice instance can be used.
...And 4 more matches
nsIDroppedLinkHandler
dom/base/
nsidroppedlinkhandler.idlscriptable please add a summary to this article.
... 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean candroplink(in
nsidomdragevent aevent, in prbool aallowsamedocument); astring droplink(in
nsidomdragevent aevent, out astring aname, [optional] in boolean adisallowinherit); void droplinks(in
nsidomdragevent aevent, [optional] in boolean adisallowinherit, [optional] out unsigned long acount, [retval, array, size_is(acount)] out
nsidroppedlinkitem alinks); methods candroplink() determines if a link being dragged can be dropped.
... boolean candroplink( in
nsidomdragevent aevent, in prbool aallowsamedocument ); parameters aevent a dragenter or dragover event.
...And 4 more matches
nsIDBFolderInfo
nsidbfolderinfo - careful, pulled from the wrong (cvs) repo!
... mailnews/db/msgdb/public/
nsidbfolderinfo.idlscriptable ???
...as a service: var dbfolderinfo = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.
nsidbfolderinfo); method overview long andflags(in long flags); void changeexpungedbytes(in long delta); void changenummessages(in long delta); void changenumunreadmessages(in long delta); boolean getbooleanproperty(in string propertyname, in boolean defaultvalue); void getcharacterset(out acstring charset,...
...And 3 more matches
nsIDOMFontFaceList
layout/inspector/public/
nsidomfontfacelist.idlscriptable a list of
nsidomfontface objects, each representing a single font face.
... 1.0 66 introduced gecko 7.0 inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview
nsidomfontface item(in unsigned long index); attributes attribute type description length unsigned long the number of items in the list.
... methods item() returns the
nsidomfontface object at the specified index into the list.
...And 3 more matches
nsIDOMMouseScrollEvent
dom/interfaces/events/
nsidommousescrollevent.idlscriptable this interface represents a mouse scroll wheel event.
... 1.0 66 introduced gecko 1.9.1 inherits from:
nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) gecko 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.
...And 3 more matches
nsIDOMXPathExpression
dom/interfaces/xpath/
nsidomxpathexpression.idlscriptable represents a compiled xpath query returned from
nsidomxpathevaluator.createexpression or document.createexpression inherits from: nsisupports last changed in gecko 1.7 method overview nsisupports evaluate(in
nsidomnode contextnode, in unsigned short type, in nsisupports result) methods evaluate() evaluate the xpath expression.
... nsisupports evaluate( in
nsidomnode contextnode, in unsigned short type, in nsisupports result ); parameters contextnode a dom node to evaluate the xpath expression against.
... type a number that corresponds to one of the type constants of
nsidomxpathresult.
...And 3 more matches
nsIDOMGeoPositionCallback
the
nsidomgeopositioncallback interface is called when updated position information is available.
... you need to implement this interface to accept callbacks after using
nsidomgeolocation.watchposition().
... dom/interfaces/geolocation/
nsidomgeopositioncallback.idlscriptable please add a summary to this article.
...And 2 more matches
nsIDOMStorageEventObsolete
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.
... 1.0 66 introduced gecko 1.8 obsolete gecko 2.0 inherits from:
nsidomevent last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) when a dom storage event is received, the recipient can check its domain attribute to determine which domain's data store has changed.
...you should use the
nsidomstorageevent interface instead.
...And 2 more matches
nsIDOMStorageWindow
dom/interfaces/storage/
nsidomstoragewindow.idlscriptable this interface provides access to a dom window's client side storage objects.
... 1.0 66 introduced gecko 1.8.1 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 has been merged into
nsidomwindow, and this interface has been removed.
... attributes attribute type description globalstorage
nsidomstoragelist global storage, accessible by domain.
...And 2 more matches
nsIDOMXPathResult
dom/interfaces/xpath/
nsidomxpathresult.idlscriptable this interface describes an xpath result returned by
nsidomxpathevaluator or document.evaluate inherits from: nsisupports last changed in gecko 1.7 method overview
nsidomnode iteratenext();
nsidomnode snapshotitem(in unsigned long index); attributes attribute type description booleanvalue boolean if resulttype is boolean_type, the boolean value.
... singlenodevalue
nsidomnode if resulttype is any_unordered_node_type or first_ordered_node_type, a single dom node.
...
nsidomnode iteratenext(); parameters none.
...And 2 more matches
nsIDOMXULElement
dom/interfaces/xul/
nsidomxulelement.idlscriptable represents a xul element within the dom.
... 66 introduced gecko 1.0 inherits from:
nsidomelement last changed in gecko 1.9 (firefox 3) method overview void blur(); void click(); void docommand(); void focus();
nsidomnodelist getelementsbyattribute(in domstring name, in domstring value);
nsidomnodelist getelementsbyattributens(in domstring namespaceuri, in domstring name, in domstring value); attributes attribute type description align domstring gets/sets the value of the element's align attribute.
... style
nsidomcssstyledeclaration read only.
...And 2 more matches
nsIDownload
toolkit/components/downloads/public/
nsidownload.idlscriptable this interface describes a download object.
... download objects are used by the download manager (see
nsidownloadmanager to manage files that are queued to download, being downloaded, and finished being downloaded.) inherits from: nsitransfer last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) note: once the download is completed, the download manager stops updating the
nsidownload object.
... completed states are
nsidownloadmanager::download_finished,
nsidownloadmanager::download_failed, and
nsidownloadmanager::download_canceled.
...And 2 more matches
nsIDragSession
widget/public/
nsidragsession.idlscriptable provides support for interacting with an ongoing drag session during a drag and drop operation.
... datatransfer
nsidomdatatransfer the data transfer object for the current drag operation.
...(see
nsidragservice) numdropitems unsigned long get the number of items that were dropped.
...And 2 more matches
nsIDOMChromeWindow
dom/interfaces/base/
nsidomchromewindow.idlscriptable this interface is implemented on the window object in chrome.
... inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void beginwindowmove(in
nsidomevent mousedownevent); void getattention(); void getattentionwithcyclecount(in long acyclecount); void maximize(); void minimize(); void notifydefaultbuttonloaded(in
nsidomelement defaultbutton); void restore(); void setcursor(in domstring cursor); attributes attribute type description browserdomwindow nsibrowserdomwindow the related nsibrowserdomwindow instance which provides access to yet another layer of utility functions by chrome script.
...void beginwindowmove( in
nsidomevent mousedownevent ); parameters mousedownevent exceptions thrown ns_error_not_implemented if the operating system does not support this method.
...void notifydefaultbuttonloaded( in
nsidomelement defaultbutton ); parameters defaultbutton the default button element of the window.
nsIDOMFileReader
the
nsidomfilereader interface provides a way to read data from a file specified by an
nsidomfile.
... content/base/public/
nsidomfilereader.idlscriptable please add a summary to this article.
...to create an instance, use: var filereader = components.classes["@mozilla.org/files/filereader;1"].createinstance(components.interfaces.
nsidomfilereader); this interface implements the dom filereader object; see that documentation for details.
... examples os.file for the main thread - example - save canvas to disk see also file api specification working draft
nsidomfile
nsidomfilelist
nsidomfileexception ...
nsIDOMGeoPositionErrorCallback
the
nsidomgeopositionerrorcallback interface is used to represent an object that receives callback notifications when geolocation errors occur.
... dom/interfaces/geolocation/
nsidomgeopositionerrorcallback.idlscriptable please add a summary to this article.
... last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void handleevent(in
nsidomgeopositionerror position); methods handleevent() called to handle a geolocation error.
... void handleevent( in
nsidomgeoposition position ); parameters position the error that occurred, as an
nsidomgeopositionerror object.
nsIDOMHTMLTimeRanges
the
nsidomhtmltimeranges interface represents a set of time ranges in media; it's primarily used by the
nsidomhtmlmediaelement interface, and implements the dom timeranges interface.
... each time range represented by an
nsidomhtmltimeranges object has an index number; you call the start() and end() methods to obtain the start and end times of each range, specifying the index number of the range to look up.
... dom/interfaces/html/
nsidomhtmltimeranges.idlscriptable please add a summary to this article.
... last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from: nsisupports method overview float start(in unsigned long index); float end(in unsigned long index); attributes attribute type description length unsigned long the number of ranges represented by the
nsidomhtmltimeranges object.
nsIDOMMozTouchEvent
the
nsidommoztouchevent interface describes a raw touch event.
... dom/interfaces/events/
nsidommoztouchevent.idlscriptable please add a summary to this article.
... last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from:
nsidommouseevent method overview void initmoztouchevent(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 ns...
...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 ...
nsIDOMSerializer
content/base/public/
nsidomserializer.idlscriptable this interface is really a placeholder till the w3c dom working group defines a mechanism for serializing dom nodes.
...to create an instance, use: var domserializer = components.classes["@mozilla.org/xmlextras/xmlserializer;1"] .createinstance(components.interfaces.
nsidomserializer); method overview void serializetostream(in
nsidomnode root, in nsioutputstream stream, in autf8string charset); astring serializetostring(in
nsidomnode root); methods serializetostream() the subtree rooted by the specified element is serialized to a byte stream using the character set specified.
... void serializetostream( in
nsidomnode root, in nsioutputstream stream, in autf8string charset ); parameters root the root of the subtree to be serialized.
...astring serializetostring( in
nsidomnode root ); parameters root the root of the subtree to be serialized.
nsIDOMSimpleGestureEvent
dom/interfaces/events/
nsidomsimplegestureevent.idlscriptable this interface describes a mouse or trackpad gesture event.
... 1.0 66 introduced gecko 1.9.1 inherits from:
nsidommouseevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the
nsidomsimplegestureevent interface is the datatype for all mozilla-specific simple gesture events in the document object model.
... 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 ...
... 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 ); parameters typearg canbubblea...
nsIDOMStorageList
dom/interfaces/storage/
nsidomstoragelist.idlscriptable this interface is used to access the contextual storage areas used by globalstorage by domain.
... 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview
nsidomstorage nameditem(in domstring domain); methods nameditem() called when the list of available access points changes.
...
nsidomstorage nameditem( in domstring domain ); parameters domain the name of the domain for whom to return the storage object.
... return value the
nsidomstorage object representing the data store for the specified domain.see also dom storage structured client-side storage (html 5 specification)
nsidomwindow ...
nsIDeviceMotionListener
xpcom/system/
nsidevicemotion.idlscriptable this interface can be implemented by clients that want to be notified orientation or acceleration changes on supported devices.
... 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview void onmotionchange(in
nsidevicemotiondata amotiondata); methods onmotionchange() called when new orientation or acceleration data is available.
... void onmotionchange( in
nsidevicemotiondata amotiondata ); parameters aacceleration the
nsidevicemotiondata object describing updated motion information.
... see also mozorientation
nsidomorientationevent
nsidevicemotion
nsidevicemotiondata ...
nsIDirectoryServiceProvider
xpcom/io/
nsidirectoryservice.idlscriptable this interface is used by the directory service to get file locations.
... inherits from: nsisupports last changed in gecko 1.7
nsidirectoryserviceprovider.
... __definegetter__("currdir", function getcurrdir() { return components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.
nsidirectoryserviceprovider) .getfile("curworkd",{}).path; }); test it with to see the magic happen.
... alert(currdir); see also nsdirectoryservice
nsidirectoryservice additionally, see section 16.5.2 of the rapid application development with mozilla book for instructions on how to get the current working directory and the process binary directory, among other things.
nsIDragDropHandler
nsidragdrophandler is an interface for communicating with the built-in drag and drop implementation in the content area.
... content/base/public/
nsidragdrophandler.idlscriptable please add a summary to this article.
... last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsisupports method overview void detach(); void hookupto(in
nsidomeventtarget attachpoint, in nsiwebnavigation navigator); methods detach() unregisters all handlers related to drag and drop.
...void hookupto( in
nsidomeventtarget attachpoint, in nsiwebnavigation navigator ); parameters attachpoint the receiver to which to attach drag handlers.
display-inside - Archive of obsolete content
the display-i
nside css property specifies the inner display type of the box generated by an element, dictating how its contents lay out i
nside the box.
... /* keyword values */ display-i
nside: auto; display-i
nside: block; display-i
nside: table; display-i
nside: flex; display-i
nside: grid; display-i
nside: ruby; /* global values */ display-i
nside: inherit; display-i
nside: initial; display-i
nside: unset; value not found in db!
... specifications specification status comment css display module level 3the definition of 'display-i
nside' in that specification.
nsIDNSListener
netwerk/dns/
nsidnslistener.idlscriptable please add a summary to this article.
... inherits from: nsisupports last changed in gecko 1.7 method overview void onlookupcomplete(in nsicancelable arequest, in
nsidnsrecord arecord, in nsresult astatus); methods onlookupcomplete() called when an asynchronous host lookup completes.
... void onlookupcomplete( in nsicancelable arequest, in
nsidnsrecord arecord, in nsresult astatus ); parameters arequest the value returned from asyncresolve.
nsIDOMEventGroup
dom/interfaces/events/
nsidomeventgroup.idlscriptable this interface is the interface implemented by all event targets in the document object model.
... inherits from: nsisupports last changed in gecko 1.7 method overview boolean issameeventgroup(in
nsidomeventgroup other); methods issameeventgroup() reports whether or not another event group is the same as this one.
... boolean issameeventgroup( in
nsidomeventgroup other ); parameters other instance of
nsidomeventgroup object to compare against.
nsIDOMFile
the
nsidomfile interface retrieves data from a file submitted to a form using the input type "file".
... content/base/public/
nsidomfile.idlscriptable please add a summary to this article.
... see also
nsidomfilelist
nsidomfileexception datatransfer drag and drop ...
nsIDOMFileException
the
nsidomfileexception interface represents exceptions that can be raised by calls to the methods in the
nsidomfile interface.
... content/base/public/
nsidomfileexception.idlscriptable please add a summary to this article.
... see also
nsidomfile
nsidomfilelist
nsidomfilereader ...
nsIDOMFontFace
layout/inspector/public/
nsidomfontface.idlscriptable describes a single font face.
... rule
nsidomcssfontfacerule null if no associated @font-face rule.
... see also
nsidomfontfacelist ...
nsIDOMGeoPosition
dom/interfaces/geolocation/
nsidomgeoposition.idlscriptable this interface describes a geographical location at a specific time.
... 1.0 66 introduced gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) attributes attribute type description address
nsidomgeopositionaddress the address of the user's current location, if available.
... coords
nsidomgeopositioncoords the user's current position information.
nsIDOMHTMLAudioElement
the
nsidomhtmlaudioelement interface is used to implement the html5 <audio> element.
... dom/interfaces/html/
nsidomhtmlaudioelement.idlscriptable please add a summary to this article.
... last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) inherits from:
nsidomhtmlmediaelement method overview unsigned long long mozcurrentsampleoffset(); void mozsetup(in pruint32 channels, in pruint32 rate); [implicit_jscontext] unsigned long mozwriteaudio(in jsval data); methods mozcurrentsampleoffset() non-standard this feature is non-standard and is not on a standards track.
nsIDOMHTMLSourceElement
the
nsidomhtmlsourceelement interface is the dom interface to the source child of the audio and video media elements in html.
... dom/interfaces/html/
nsidomhtmlsourceelement.idlscriptable please add a summary to this article.
... last changed in gecko 1.9.1.2 inherits from:
nsidomhtmlelement the source element allows authors to specify multiple media resources for media elements.
nsIDOMMozNetworkStats
dom/network/interfaces/
nsidomnetworkstats.idlscriptable interface of the network stats object.
...to create an instance, use: var networkstatsmanager = components.classes["@mozilla.org/networkstats;1"] .createinstance(components.interfaces.
nsidomnetworkstats); attributes attribute type description connectiontype domstring connection type of the stats.
... data
nsidommoznetworkstatsdata array stats samples.
nsIDOMNavigatorDesktopNotification
dom/interfaces/notification/
nsidomnavigatordesktopnotification.idlscriptable property that extends the navigator object.
...attributes attribute type description moznotification
nsidomdesktopnotificationcenter read only.
... see also
nsidomdesktopnotificationcenter ...
nsIDOMOrientationEvent
the
nsidomorientationevent interface describes the event that can be delivered to dom windows, providing information from the device's accelerometer, allowing code to determine the orientation of the device.
... dom/interfaces/events/
nsidomorientationevent.idlscriptable please add a summary to this article.
... last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) inherits from:
nsidomevent method overview void initorientationevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg, in double x, in double y, in double z); attributes attribute type description x double the amount of tilt along the x axis.
nsIDOMStorage
dom/interfaces/storage/
nsidomstorage.idlscriptable this interface represents the storage space used for session storage in the dom.
... return value an
nsidomstorageitem object describing the data corresponding to the specified key, or null if no data exists for the given key.
... see also dom storage structured client-side storage (html 5 specification)
nsidomstorageitem ...
nsIDOMStorageManager
dom/interfaces/storage/
nsidomstoragemanager.idlscriptable this interface provides methods for managing data stored in the offline apps cache.
... 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) implemented by @mozilla.org/dom/storagemanager;1 as a service: var domstoragemanager = components.classes["@mozilla.org/dom/storagemanager;1"] .getservice(components.interfaces.
nsidomstoragemanager); method overview void clearofflineapps();
nsidomstorage getlocalstorageforprincipal(in nsiprincipal aprincipal, in domstring adocumenturi); long getusage(in astring aownerdomain); methods clearofflineapps() clears keys owned by offline applications.
...
nsidomstorage getlocalstorageforprincipal( nsiprincipal aprincipal, domstring adocumenturi ); parameters aprincipal the principal for which to return the local storage object.
nsIDOMUserDataHandler
dom/interfaces/core/
nsidomuserdatahandler.idlscriptable the callback function for the setuserdata method.
... 1.0 66 introduced gecko 1.5 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview void handle(in unsigned short operation, in domstring key, in nsivariant data, in
nsidomnode src, in
nsidomnode dst); constants constant value description node_cloned 1 the node was cloned.
...void handle( in unsigned short operation, in domstring key, in nsivariant data, in
nsidomnode src, in
nsidomnode dst ); parameters operation one of the node_* operation type constants from the above table.
nsIDOMXULSelectControlElement
dom/interfaces/xul/
nsidomxulselectcntrlel.idlscriptable please add a summary to this article.
... inherits from:
nsidomxulcontrolelement last changed in gecko 1.9 (firefox 3) method overview
nsidomxulselectcontrolitemelement appenditem(in domstring label, in domstring value); long getindexofitem(in
nsidomxulselectcontrolitemelement item);
nsidomxulselectcontrolitemelement getitematindex(in long index);
nsidomxulselectcontrolitemelement insertitemat(in long index, in domstring label, in domstring value);
nsidomxulselectcontrolitemelement removeitemat(in long index); attributes attribute type description itemcount unsigned long read only.
... selectedindex long selecteditem
nsidomxulselectcontrolitemelement value domstring methods appenditem()
nsidomxulselectcontrolitemelement appenditem( in domstring label, in domstring value ); parameters label value return value getindexofitem() long getindexofitem( in
nsidomxulselectcontrolitemelement item ); parameters item return value getitematindex()
nsidomxulselectcontrolitemelement getitematindex( in long index ); parameters index return value insertitemat()
nsidomxulselectcontrolitemelement insertitemat( in long index, in domstring label, in domstring value ); parameters index label value return value removeitemat()
nsidomxulselectcontrolitemelement removeitemat( in long index ); parameters index return value ...
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.
... see also
nsidebug2 ...
nsIDebug2
xpcom/base/
nsidebug2.idlscriptable adds access to additional information in debug builds of mozilla code by expanding upon the features in
nsidebug 1.0 66 introduced gecko 1.9.2 inherits from:
nsidebug last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) attributes attribute type description assertioncount long the number of assertions since process start.
... this is normally zero in release builds, but does include calls to
nsidebug.assertion().
... see also
nsidebug ...
nsIDeviceMotionData
xpcom/system/
nsidevicemotion.idlscriptable this interface provides information about device motion.
... 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) note: this interface was named
nsidevicemotiondata prior to gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3).
... see also mozorientation
nsidomorientationevent
nsidevicemotionlistener
nsidevicemotion ...
nsIDirIndex
netwerk/streamconv/public/
nsidirindex.idlscriptable a class holding information about a directory index.
...this is encoded with the encoding specified in the
nsidirindexparser, and is also escaped.
... see also
nsidirindexlistener
nsidirindexparser ...
nsIDirIndexListener
netwerk/streamconv/public/
nsidirindexlistener.idlscriptable this interface is used to receive contents of directory index listings from a protocol.
... they can then be transformed into an output format (such as rdf, html and so on) inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void onindexavailable(in nsirequest arequest, in nsisupports actxt, in
nsidirindex aindex); void oninformationavailable(in nsirequest arequest, in nsisupports actxt, in astring ainfo); methods onindexavailable() called for each directory entry.
... void onindexavailable( in nsirequest arequest, in nsisupports actxt, in
nsidirindex aindex ); parameters arequest the request.
nsIDocumentLoader
uriloader/base/
nsidocumentloader.idlscriptable this interface responsible for tracking groups of loads that belong together (images, external scripts, and so on.) and subdocuments (iframe, frame, and so on.).
...to create an instance, use: var documentloader = components.classes["@mozilla.org/docloaderservice;1"] .createinstance(components.interfaces.
nsidocumentloader); method overview void clearparentdocloader(); obsolete since gecko 1.8 void createdocumentloader(out
nsidocumentloader aninstance); obsolete since gecko 1.8 void destroy(); obsolete since gecko 1.8 void fireonlocationchange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri auri); obsolete since gecko 1.8 void fireonstatuschange(in ...
... createdocumentloader() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void createdocumentloader( out
nsidocumentloader aninstance ); parameters aninstance destroy() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) void destroy(); parameters none.
nsIDownloadObserver
netwerk/base/public/
nsidownloader.idlscriptable please add a summary to this article.
... inherits from: nsisupports last changed in gecko 1.7 method overview void ondownloadcomplete(in
nsidownloader downloader, in nsirequest request, in nsisupports ctxt, in nsresult status, in nsifile result); methods ondownloadcomplete() called to signal a download that has completed.
... void ondownloadcomplete( in
nsidownloader downloader, in nsirequest request, in nsisupports ctxt, in nsresult status, in nsifile result ); parameters downloader request ctxt status result ...
nsIDownloader
netwerk/base/public/
nsidownloader.idlscriptable a special implementation of a nsistreamlistener that will make the contents of the stream available as a file.
... inherits from: nsistreamlistener last changed in gecko 1.7 method overview void init(in
nsidownloadobserver observer, in nsifile downloadlocation); methods init() initialize this downloader.
... void init( in
nsidownloadobserver observer, in nsifile downloadlocation ); parameters observer the
nsidownloadobserver to be notified when the download completes.
<display-inside> - CSS: Cascading Style Sheets
syntax valid <display-i
nside> values: flow the element lays out its contents using flow layout (block-and-inline layout).
... html <div class="box"> <div class="float">i am a floated box!</div> <p>i am content i
nside the container.</p> </div> css .box { background-color: rgb(224, 206, 247); border: 5px solid rebeccapurple; display: flow-root; } .float { float: left; width: 200px; height: 150px; background-color: white; border:1px solid black; padding: 10px; } result specifications specification status css display module level 3the definiti...
...on of 'display-i
nside' in that specification.
Firefox UI considerations for web developers
otherwise, bitmapped icons which are at least 96 pixels wide are co
nsidered.
... examples co
nsider again the example top sites box shown at the top of the page, repeated below: let's look at some examples among the icons shown here (note that this discussion is based on the site designs as of early january, 2019).
nsIDOMGeoPositionAddress
dom/interfaces/geolocation/
nsidomgeopositionaddress.idlscriptable this interface describes the geographical address of a location, including street, city, and country information, for example.
... 1.0 66 introduced gecko 1.9.2 obsolete gecko 14.0 inherits from: nsisupports last changed in gecko 11 (firefox 11 / thunderbird 11 / seamonkey 2.8) this object is obtained from an
nsidomgeopositionaddress object via its address attribute.
nsIDOMGeoPositionCoords
the
nsidomgeopositioncoords interface describes a geographical location.
... dom/interfaces/geolocation/
nsidomgeopositioncoords.idlscriptable please add a summary to this article.
nsIDOMGeoPositionError
the
nsidomgeopositionerror interface represents an error that occurred while performing geolocation operations.
... dom/interfaces/geolocation/
nsidomgeopositionerror.idlscriptable please add a summary to this article.
nsIDOMGeoPositionOptions
the
nsidomgeopositionoptions interface is used to specify options for geolocation operations.
... dom/interfaces/geolocation/
nsidomgeopositionoptions.idlscriptable please add a summary to this article.
nsIDOMGlobalPropertyInitializer
dom/interfaces/base/
nsidomglobalpropertyinitializer.idlscriptable an initializer for global properties that lets them know about the window they're being attached to.
...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.
nsIDOMHTMLMediaElement
dom/interfaces/html/
nsidomhtmlmediaelement.idlscriptable the basis for the
nsidomhtmlaudioelement and
nsidomhtmlvideoelement interfaces, which in turn implement the <audio> and <video> html5 elements.
... 1.0 67 introduced gecko 1.9.1 inherits from:
nsidomhtmlelement last changed in gecko 1.1 the
nsidomhtmlmediaelement interface implements the dom htmlmediaelement interface.
nsIDOMParser
to create a domparser when the constructor is not available (e.g., from a js xpcom component, a js module, or an xpcshell test), use: var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.
nsidomparser); // optionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri note: this section covers changes introduced to domparser in gecko 1.9.
...examples within the context of a window: var parser = new domparser(); var doc = parser.parsefromstring(astr, "application/xml"); outside of a window (e.g., a js xpcom component, a js module, or an xpcshell test): var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.
nsidomparser); var doc = parser.parsefromstring(astr, "application/xml"); using components.constructor(): const domparser = new components.constructor("@mozilla.org/xmlextras/domparser;1", "
nsidomparser"); var parser = new domparser(); parser.init(principal, documenturi, baseuri); var doc = parser.parsefromstring(astr, "application/xml"); ...
nsIDOMProgressEvent
dom/interfaces/events/
nsidomprogressevent.idlscriptable this interface represents the events sent with progress information while uploading data using the xmlhttprequest object.
... 1.0 66 introduced gecko 1.9.1 deprecated gecko 22 inherits from:
nsidomevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) the
nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download.
nsIDOMStorage2
the
nsidomstorage2 interface represents the storage space used for local storage in the dom.
... dom/public/idl/storage/
nsidomstorage2.idlscriptable please add a summary to this article.
nsIDOMStorageItem
dom/interfaces/storage/
nsidomstorageitem.idlscriptable this interface represents an object in dom storage.
... see also dom storage structured client-side storage (html 5 specification)
nsidomstorage
nsidomstorage2 ...
nsIDOMXPathException
dom/interfaces/xpath/
nsidomxpathexception.idlscriptable describes an exception resulting from xpath operations.
... see also introduction to using xpath in javascript document object model (dom) level 3 xpath specification
nsidomxpathevaluator document.evaluate
nsidomxpathresult ...
nsIDOMXULControlElement
dom/interfaces/xul/
nsidomxulcontrolelement.idlscriptable provides additional attributes specific to control elements.
... 66 introduced gecko 1.0 inherits from:
nsidomxulelement last changed in gecko 1.0 attributes attribute type description disabled boolean indicates whether the element is disabled or not.
nsIDOMXULLabeledControlElement
dom/interfaces/xul/
nsidomxullabeledcontrolel.idlscriptable this interface is used as a basis for labeled control elements in xul.
... inherits from:
nsidomxulcontrolelement last changed in gecko 1.7 attributes attribute type description accesskey domstring this should be set to a character that is used as a shortcut key.
nsIDOMXULSelectControlItemElement
dom/interfaces/xul/
nsidomxulselectcntrlitemel.idlscriptable please add a summary to this article.
... inherits from:
nsidomxulelement last changed in gecko 1.7 attributes attribute type description accesskey domstring command domstring control
nsidomxulselectcontrolelement read only.
nsIDialogCreator
embedding/base/
nsidialogcreator.idlscriptable please add a summary to this article.
... 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void opendialog(in unsigned long atype, in acstring aname, in acstring afeatures, in
nsidialogparamblock aarguments, [optional] in
nsidomelement aframeelement); constants constant value description unknown_dialog 0 generic_dialog 1 select_dialog 2 methods opendialog() void opendialog( in unsigned long atype, in acstring aname, in acstring afeatures, in
nsidialogparamblock aarguments, in
nsidomelement aframeelement optional ); parameters atype aname afeatures aarguments aframeelement optional ...
nsIDirIndexParser
netwerk/streamconv/public/
nsidirindexlistener.idlscriptable a parser for 'application/http-index-format' directories.
... listener
nsidirindexlistener the interface to use as a callback for new entries.
nsIDirectoryServiceProvider2
xpcom/io/
nsidirectoryservice.idlscriptable an extension of
nsidirectoryserviceprovider which allows multiple files to be returned for the given key.
... inherits from:
nsidirectoryserviceprovider last changed in gecko 0.9.6 method overview nsisimpleenumerator getfiles(in string prop); methods getfiles() the directory service calls this when it gets a request for a prop and the requested type is nsisimpleenumerator.
nsIDispatchSupport
js/src/xpconnect/idl/
nsidispatchsupport.idlnot scriptable please add a summary to this article.
...boolean isclassmarkedsafeforscripting( in nscidref cid, out boolean classexists ); parameters cid the
nsid representation of the clsid to test.
nsIDialogParamBlock
embedding/components/windowwatcher/public/
nsidialogparamblock.idlscriptable an interface to pass strings, integers and nsisupports to a dialog.
nsIDictionary
extensions/xml-rpc/idl/
nsidictionary.idlscriptable a simple mutable table of objects, maintained as key/value pairs.
nsIDirectoryEnumerator
xpcom/io/
nsidirectoryenumerator.idlscriptable this interface provides a means for enumerating the contents of a directory.
nsIDirectoryIterator
the
nsidirectoryiterator interface provides a way to iterate over the entries in a directory.
nsIDownloadHistory
docshell/base/
nsidownloadhistory.idlscriptable this interface can be used to add a download to history.
nsIDownloadManagerUI
toolkit/components/downloads/public/
nsidownloadmanagerui.idlscriptable this interface is used to implement the user interface for the download manager.
nsIDynamicContainer
toolkit/components/places/public/
nsidynamiccontainer.idlscriptable this interface provides a base class for services that want to provide containers for temporary contents.
Index
34 components.utils.evalinsandbox add-ons, developing mozilla, extensions, javascript, xpcom:language bindings, xpconnect the evalinsandbox() function enables you to evaluate javascript code i
nside a sandbox you've previously created using the components.utils.sandbox constructor.
...it lets you get pointers to components i
nside mozilla, and it lets you talk about their interfaces as well.
... 85 using
nsidirectoryservice extensions, guide, xpcom nsdirectoryservice implements the nsiproperties interface.
...And 122 more matches
Index - Archive of obsolete content
while this is generally co
nsidered acceptable behavior, co
nsiderable care must be taken to avoid violating the mozilla add-on guidelines or creating an adverse user experience.
...in addition, you can augment or replace the download manager's user interface by implementing the new
nsidownloadmanagerui interface.
... 429 editor embedding guide embedding mozilla, guide, midas, needshelp given an nsiwebbrowser instance, get an
nsidomwindow from the getcontentdomwindow call.
...And 59 more matches
Index - Web APIs
308 bluetoothdevice api, bluetooth, bluetoothdevice, experimental, interface, reference, web bluetooth api the bluetoothdevice interface of the web bluetooth api represents a bluetooth device i
nside a particular script execution environment.
...the symbols < and & don’t need escaping as they normally do when i
nside a cdata section.
... 526 drawing text canvas, graphics, intermediate, tutorial the canvas rendering context provides two methods to render text: 527 finale canvas, graphics, tutorial there are a variety of demos and further explanations about canvas on these sites: 528 hit regions and accessibility canvas, graphics, tutorial the content i
nside the <canvas> ...
...And 47 more matches
Index - Archive of obsolete content
30 browser.type xul attributes, xul reference type: one of the values below.the type of browser, which can be used to set access of the document loaded i
nside the browser.
... 595 node this is a scriptable interface corresponding to the
nsidomnode xpcom interface.
... 611 special per-platform menu co
nsiderations beginner, guide, xul, xul popup guide for many menu commands, convention dictates where these items will be placed.
...And 45 more matches
nsISessionStore
method overview void deletetabvalue(in
nsidomnode atab, in astring akey); void deletewindowvalue(in
nsidomwindow awindow, in astring akey);
nsidomnode duplicatetab(in
nsidomwindow awindow, in
nsidomnode atab);
nsidomnode forgetclosedtab(in
nsidomwindow awindow, in unsigned long aindex);
nsidomnode forgetclosedwindow(in unsigned long aindex); astring getbrowserstate(); unsigned long g...
...etclosedtabcount(in
nsidomwindow awindow); astring getclosedtabdata(in
nsidomwindow awindow); unsigned long getclosedwindowcount(); astring getclosedwindowdata(); astring gettabstate(in
nsidomnode atab); astring gettabvalue(in
nsidomnode atab, in astring akey); astring getwindowstate(in
nsidomwindow awindow); astring getwindowvalue(in
nsidomwindow awindow, in astring akey); void init(in
nsidomwindow awindow); void persisttabattribute(in astring aname); void restorelastsession(); void setbrowserstate(in astring astate); void settabstate(in
nsidomnode atab, in astring astate); void settabvalue(in
nsidomnode atab, in astring akey, in astring astringvalue); void setwin...
...dowstate(in
nsidomwindow awindow, in astring astate, in boolean aoverwrite); void setwindowvalue(in
nsidomwindow awindow, in astring akey, in astring astringvalue);
nsidomnode undoclosetab(in
nsidomwindow awindow, in unsigned long aindex);
nsidomwindow undoclosewindow(in unsigned long aindex); attributes attribute type description canrestorelastsession boolean is it possible to restore the previous session.
...And 28 more matches
Introduction to XPCOM for the DOM
let's co
nsider what happens when the class nsfoo implements an interface nsifoo.
... queryinterface() co
nsider again the class nsfoo that implements two interfaces, nsifoo and nsifoo2: class nsfoo : public nsifoo, public nsifoo2 let's assume an instance of nsfoo was somehow created (this assertion is true most of the time).
...and finally, we will look at the implementation of our new interface through the creation of an
nsidomfabian interface (fabian is my first name ;-).
...And 25 more matches
Mozilla DOM Hacking Guide
for example, when we ask for |document.getelementbyid("myid");|, xpconnect will find that |document| is a property of the window object, so it will look on the interface
nsidomwindow, and it will find the getdocument() method.
... the return value of getdocument() is a
nsidomdocument.
... so xpconnect will then try to find a method named getelementbyid() on the
nsidomdocument interface.
...And 22 more matches
Client-side storage - Learn web development
for example, you could download a batch of music files (perhaps used by a web game or music player application), store them i
nside a client-side database, and play them as needed.
... all of your web storage data is contained within two object-like structures i
nside the browser: sessionstorage and localstorage.
... next, add the following to the bottom of your code: window.onload = function() { }; we will write all of our subsequent code i
nside this window.onload event handler function, called when the window's load event fires, to make sure we don't try to use indexeddb functionality before the app has completely finished loading (it could fail if we don't).
...And 20 more matches
nsIFocusManager
1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) implemented by: @mozilla.org/focus-manager;1 as a service: var focusmanager = components.classes["@mozilla.org/focus-manager;1"] .getservice(components.interfaces.nsifocusmanager); method overview void clearfocus(in
nsidomwindow awindow); void contentremoved(in
nsidocument adocument, in nsicontent aelement); native code only!
... obsolete since gecko 2.0 void firedelayedevents(in
nsidocument adocument); native code only!
...
nsidomelement getfocusedelementforwindow(in
nsidomwindow awindow, in prbool adeep, out
nsidomwindow afocusedwindow); pruint32 getlastfocusmethod(in
nsidomwindow window); void movecarettofocus(in
nsidomwindow awindow); void elementisfocusable(in
nsidomelement aelement, in unsigned long aflags);
nsidomelement movefocus(in
nsidomwindow awindow, in
nsidomelement astartelement, in unsigned long atype, in unsigned long aflags); void setfocus(in
nsidomelement aelement, in unsigned long aflags); void windowhidden(in
nsidomwindow awindow); native code only!
...And 19 more matches
Creating our first Vue component - Learn web development
along the way, we'll learn about a few important concepts such as calling components i
nside other components, passing data to them via props, and saving data state.
... objective: to learn how to create a vue component, render it i
nside another component, pass data into it using props, and save its state.
...i
nside the <script> tags, add a default exported object export default {}, which is your component object.
...And 18 more matches
nsIHTMLEditor
inherits from: nsisupports last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) method overview void adddefaultproperty(in nsiatom aproperty, in astring aattribute, in astring avalue); void addinsertionlistener(in nsicontentfilter infilter); void align(in astring aalign); boolean breakisvisible(in
nsidomnode anode); boolean candrag(in
nsidomevent aevent); void checkselectionstateforanonymousbuttons(in nsiselection aselection);
nsidomelement createanonymouselement(in astring atag, in
nsidomnode aparentnode, in astring aanonclass, in boolean aiscreatedhidden);
nsidomelement createelementwithdefaults(in astring atagname); void decreasefontsize(); ...
... void dodrag(in
nsidomevent aevent); void getalignment(out boolean amixed, out short aalign); astring getbackgroundcolorstate(out boolean amixed);
nsidomelement getelementorparentbytagname(in astring atagname, in
nsidomnode anode); astring getfontcolorstate(out boolean amixed); astring getfontfacestate(out boolean amixed); astring getheadcontentsashtml(); astring gethighlightcolorstate(out boolean amixed); void getindentstate(out boolean acanindent, out boolean acanoutdent); void getinlineproperty(in nsiatom aproperty, in astring aattribute, in astring avalue, out boolean afirst, out boolean aany, out boolean aall); astring getinlinepropertywithattrvalue(in nsiatom aproperty, in astring aattribute, in ...
...astring avalue, out boolean afirst, out boolean aany, out boolean aall); nsisupportsarray getlinkedobjects(); void getlistitemstate(out boolean amixed, out boolean ali, out boolean adt, out boolean add); void getliststate(out boolean amixed, out boolean aol, out boolean aul, out boolean adl); astring getparagraphstate(out boolean amixed);
nsidomelement getselectedelement(in astring atagname);
nsidomelement getselectioncontainer(); void ignorespuriousdragevent(in boolean aignorespuriousdragevent); void increasefontsize(); void indent(in astring aindent); void insertelementatselection(in
nsidomelement aelement, in boolean adeleteselection); void insertfromdrop(in
nsidomevent aevent); void ...
...And 18 more matches
window/utils - Archive of obsolete content
globals functions getmostrecentbrowserwindow() get the topmost browser window, as an
nsidomwindow instance.
... returns
nsidomwindow: the topmost browser window.
...this function wraps
nsidomwindowutils.currentinnerwindowid.
...And 17 more matches
Vue conditional rendering: editing existing todos - Learn web development
to do that, we'll need to first define it i
nside our data() property.
... add isediting below your existing isdone data point: data() { return { isdone: this.done, isediting: false }; } now add your methods i
nside a methods property, right below your data() property: methods: { deletetodo() { this.$emit('item-deleted'); }, toggletoitemeditform() { this.isediting = true; } } conditionally displaying components via v:if and v:else now we have an isediting flag that we can use to signify that the item is being edited (or not).
...v-if also has corresponding v-else-if and v-else directives to provide the equivalent of javascript else if and else logic i
nside vue templates.
...And 17 more matches
inIDOMUtils
inherits from: nsisupports last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/inspector/dom-utils;1 as a service: var inidomutils = components.classes["@mozilla.org/inspector/dom-utils;1"] .getservice(components.interfaces.inidomutils); method overview void addpseudoclasslock(in
nsidomelement aelement, in domstring apseudoclass); void clearpseudoclasslocks(in
nsidomelement aelement); [implicit_jscontext] jsval colornametorgb(in domstring acolorname); nsiarray getbindingurls(in
nsidomelement aelement);
nsidomnodelist getchildrenfornode(in
nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long long getcontentstate(in ...
...
nsidomelement aelement); void getcsspropertynames([optional] in unsigned long aflags, [optional] out unsigned long acount, [retval, array, size_is(acount)] out wstring aprops); nsisupportsarray getcssstylerules(in
nsidomelement aelement, [optional] in domstring apseudo);
nsidomnode getparentfornode(in
nsidomnode anode, in boolean ashowinganonymouscontent); unsigned long getruleline(in
nsidomcssstylerule arule); unsigned long getrulecolumn(in
nsidomcssstylerule arule); unsigned long getselectorcount(in
nsidomcssstylerule arule); astring getselectortext(in
nsidomcssstylerule arule, in unsigned long aselectorindex); unsigned long long getspecificity(in
nsidomcssstylerule arule, in unsigned long aselectorindex);
nsid...
...omfontfacelist getusedfontfaces(in
nsidomrange arange); bool haspseudoclasslock(in
nsidomelement aelement, in domstring apseudoclass); boolean isignorablewhitespace(in
nsidomcharacterdata adatanode); bool isinheritedproperty(in astring apropertyname); void parsestylesheet(in
nsidomcssstylesheet asheet, in domstring ainput); void removepseudoclasslock(in
nsidomelement aelement, in domstring apseudoclass); astring rgbtocolorname(in octet ar, in octet ag, in octet ab); bool selectormatcheselement(in
nsidomelement aelement, in
nsidomcssstylerule arule, in unsigned long aselectorindex, [optional] in domstring apseudo); void setcontentstate(in
nsidomelement aelement, in unsigned long long astate); constants co...
...And 17 more matches
Fetching data from the server - Learn web development
just i
nside the <script> element, add the following code.
...the value of the <select> element at any time is the same as the text i
nside the selected <option> (unless you specify a different value in a value attribute) — so for example "verse 1".
...add the following lines i
nside your updatedisplay() function: verse = verse.replace(" ", ""); verse = verse.tolowercase(); let url = verse + '.txt'; to begin creating an xhr request, you need to create a new request object using the xmlhttprequest() constructor.
...And 16 more matches
Handling common accessibility problems - Learn web development
each label needs to be included i
nside a <label> to link it unambiguously to its partner form input (each <label> for attribute value needs to match the form element id value), and it will make sense even if the source order is not completely logical (which to be fair it should be).
... there are a few other co
nsiderations you should take into account.
... note: webaim's accessible javascript provides some useful further details about co
nsiderations for accessible javascript.
...And 16 more matches
Setting up your own test automation environment - Learn web development
next, we need to install a framework to allow us to work with selenium from i
nside node.
...to install selenium-webdriver, run the following command, making sure you are i
nside your project folder: npm install selenium-webdriver note: it is still a good idea to follow these steps even if you previously installed selenium-webdriver and downloaded the browser drivers.
... create a new file i
nside your project directory called google_test.js: give it the following contents, then save it: const webdriver = require('selenium-webdriver'), by = webdriver.by, until = webdriver.until; const driver = new webdriver.builder() .forbrowser('firefox') .build(); driver.get('http://www.google.com'); driver.findelement(by.name('q')).sendkeys('webdriver'); driver.sleep(1000).then(f...
...And 16 more matches
Functions — reusable blocks of code - Learn web development
previous overview: building blocks next another essential concept in coding is functions, which allow you to store a piece of code that does a single task i
nside 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.
... you've also seen a lot of custom functions in the course so far — functions defined in your code, not i
nside the browser.
...see also the full source code) from our loops article, we included a custom draw() function that looked like this: function draw() { ctx.clearrect(0,0,width,height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } this function draws 100 random circles i
nside a <canvas> element.
...And 15 more matches
Elements - Archive of obsolete content
content <!element content any> <!attlist content id id #implied > a binding can specify new content that is placed i
nside the bound element.
...the only xbl element that can appear i
nside the content tag is the children tag.
... constructor the code i
nside the constructor is called when a binding has just been attached to an element.
...And 14 more matches
Graceful asynchronous programming with Promises - Learn web development
let's co
nsider a hypothetical video chat application.
... in the first example, we'll use the fetch() method to fetch an image from the web, the blob() method to transform the fetch response's raw body contents into a blob object, and then display that blob i
nside an <img> element.
... i
nside your <script> element, add the following line: let promise = fetch('coffee.jpg'); this calls the fetch() method, passing it the url of the image to fetch from the network as a parameter.
...And 14 more matches
Manipulating documents - Learn web development
there are a few really obvious bits you'll reference regularly in your code — co
nsider the following diagram, which represents the main parts of a browser directly involved in viewing web pages: the window is the browser tab that a web page is loaded into; this is represented in javascript by the window object.
...try opening this up in your browser — it is a very simple page containing a <section> element i
nside which you can find an image, and a paragraph with a link i
nside.
... child node: a node directly i
nside another node.
...And 13 more matches
nsISelection
as a service: var selection = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsiselection); method overview void addrange(in
nsidomrange range); void collapse(in
nsidomnode parentnode, in long offset); [noscript,notxpcom,nostdcall] boolean collapsed(); void collapsenative(in
nsidomnode parentnode, in long offset); native code only!
... void collapsetoend(); void 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!
...
nsidomrange getrangeat(in long index); void modify(in domstring alter, in domstring direction, in domstring granularity); void removeallranges(); void removerange(in
nsidomrange range); void selectallchildren(in
nsidomnode parentnode); void selectionlanguagechange(in boolean langrtl); domstring tostring(); attributes attribute type description anchornode
nsidomnode returns the node in which the selection begins.
...And 13 more matches
How to structure a web form - Learn web development
each time you want to create an html form, you must start it by using this element, nesting all the contents i
nside.
... warning: it's strictly forbidden to nest a form i
nside another form.
...this was introduced to let you explicitly bind a control with a form even if it is not nested i
nside it.
...And 12 more matches
Build your own function - Learn web development
next, add the following i
nside the <script> element: function displaymessage() { } we start off with the keyword function, which means we are defining a function.
...any parameters we want to give to our function go i
nside the parentheses, and the code that runs when we call the function goes i
nside the curly braces.
... finally, add the following code i
nside the curly braces: const html = document.queryselector('html'); const panel = document.createelement('div'); panel.setattribute('class', 'msgbox'); html.appendchild(panel); const msg = document.createelement('p'); msg.textcontent = 'this is a message box'; panel.appendchild(msg); const closebtn = document.createelement('button'); closebtn.textcontent = 'x'; panel.appendchild(closebtn); closebtn.onclick = function() { panel.parentnode.removechild(panel); } this is quite a lot of code to go through, so we'll walk you through it bit by bit.
...And 12 more matches
A first splash into JavaScript - Learn web development
the place where we'll be adding all our code is i
nside the <script> element at the bottom of the html: <script> // your javascript goes here </script> adding variables to store our data let's get started.
... first of all, add the following lines i
nside your <script> element: let randomnumber = math.floor(math.random() * 100) + 1; const guesses = document.queryselector('.guesses'); const lastresult = document.queryselector('.lastresult'); const loworhi = document.queryselector('.loworhi'); const guesssubmit = document.queryselector('.guesssubmit'); const guessfield = document.queryselector('.guessfield'); let guesscount = 1; let resetbutton; this section of the code sets up the variables and constants we need to store the data our program will use.
...in this case, we are using constants to store references to parts of our user interface; the text i
nside some of them might change, but the html elements referenced stay the same.
...And 12 more matches
nsIMsgDatabase
last changed in gecko 1.9 (firefox 3) inherits from:
nsidbchangeannouncer method overview void open(in nsilocalfile afoldername, in boolean acreate, in boolean aleaveinvaliddb); void forcefolderdbclosed(in nsimsgfolder afolder); void close(in boolean aforcecommit); void commit(in nsmsgdbcommit committype); void forceclosed(); void clearcachedhdrs; void resethdrcachesize(in unsigned long size); nsimsgdbhdr getmsghdrforkey(in nsmsgkey key); nsimsgdbhdr getmsghdrformessageid(in string messageid); boolean containskey(in nsmsgkey key); nsimsgdbhdr createnewhdr(in nsmsgkey ke...
... nsisimpleenumerator enumeratemessages(); nsisimpleenumerator enumeratethreads(); void synccounts; nsimsgthread getthreadcontainingmsghdr(in nsimsgdbhdr msghdr); void markhdrread(in nsimsgdbhdr msghdr, in boolean bread, in
nsidbchangelistener instigator); void markhdrreplied(in nsimsgdbhdr msghdr, in boolean breplied, in
nsidbchangelistener instigator); void markhdrmarked(in nsimsgdbhdr msghdr, in boolean mark,in
nsidbchangelistener instigator); void markmdnneeded(in nsmsgkey key, in boolean bneeded,in
nsidbchangelistener instigator); boolean ismdnneeded(in nsmsgkey key); void markmdnsent(in nsmsgkey key, in b...
...oolean bneeded, in
nsidbchangelistener instigator); boolean ismdnsent(in nsmsgkey key); void markread(in nsmsgkey key, in boolean bread, in
nsidbchangelistener instigator); void markreplied(in nsmsgkey key, in boolean breplied, in
nsidbchangelistener instigator); void markforwarded(in nsmsgkey key, in boolean bforwarded, in
nsidbchangelistener instigator); void markhasattachments(in nsmsgkey key, in boolean bhasattachments, in
nsidbchangelistener instigator); void markthreadread(in nsimsgthread thread, in
nsidbchangelistener instigator, in nsmsgkeyarrayptr thosemarked); native code only!
...And 12 more matches
Grids - Archive of obsolete content
i
nside a grid, you declare two things, the columns that are used and the rows that are used.
... just like html tables, you put content such as labels and buttons i
nside the rows.
...alternatively, you can put content i
nside the columns, and use the rows to specify the appearance.
...And 11 more matches
The Implementation of the Application Object Model - Archive of obsolete content
examples of these interfaces include
nsidomelement,
nsidomnode, nsixmlcontent, and nsicontent.
...in html or xul, when you put one tag i
nside another tag, a relationship of containment can safely be assumed.
...since an aom tree cannot be placed i
nside a dom tree, xul applications don't ever occur i
nside web pages.
...And 11 more matches
Getting started with HTML - Learn web development
for example, co
nsider the following line of text: my cat is very grumpy if we wanted the text to stand by itself, we could specify that it is a paragraph by enclosing it in a paragraph (<p>) element: <p>my cat is very grumpy</p> note: tags in html are case-insensitive.
... the following is an example of the wrong way to do nesting: <p>my cat is <strong>very grumpy.</p></strong> the tags have to open and close in a way that they are i
nside or outside one another.
...a block-level element wouldn't be nested i
nside an inline element, but it might be nested i
nside another block-level element.
...And 11 more matches
Index - Learn web development
accessibility, beginner, design, example, intro, mobile, needsactivelearning when you're building a website, one top issue to co
nsider is universal design: accommodating all users regardless of disability, technical constraints, culture, location, and so on.
... beginner, browser, css, codingscripting, dev tools, html, javascript, learn the devtools live i
nside your browser in a subwindow that looks roughly like this, depending on what browser you are using: 26 what are hyperlinks?
...a set number of times per second), discusses what they are useful for, and co
nsiders their inherent issues.
...And 11 more matches
nsITextInputProcessor
dom/interfaces/base/nsitextinputprocessor.idlscriptable this interface is a text input events synthesizer and manages its composition and modifier state 1.0 66 introduced gecko 38 inherits from: nsisupports last changed in gecko 38.0 (firefox 38.0 / thunderbird 38.0 / seamonkey 2.35) the motivation of this interface is to provide better api than
nsidomwindowutils to dispatch key events and create, modify, and commit composition in higher level.
...
nsidomwindowutils has provided the methods which dispatched keyboard events and composition events almost directly.
... method overview void appendclausetopendingcomposition(in unsigned long alength, in unsigned long aattribute); boolean begininputtransaction(in
nsidomwindow awindow, in nsitextinputprocessorcallback acallback); boolean begininputtransactionfortests(in
nsidomwindow awindow, [optional] in nsitextinputprocessorcallback acallback); void cancelcomposition([optional] in
nsidomkeyevent adomkeyevent, [optional] in unsigned long akeyflags); boolean commitcomposition([optional] in
nsidomkeyevent adomkeyevent, [optional] in un...
...And 11 more matches
nsIWindowWatcher
method overview nsiwebbrowserchrome getchromeforwindow(in
nsidomwindow awindow); nsiauthprompt getnewauthprompter(in
nsidomwindow aparent); nsiprompt getnewprompter(in
nsidomwindow aparent);
nsidomwindow getwindowbyname(in wstring atargetname, in
nsidomwindow acurrentwindow); nsisimpleenumerator getwindowenumerator();
nsidomwindow openwindow(in
nsidomwindow aparent, in string aurl, in string aname, in string afeat...
...ures, in nsisupports aarguments); void registernotification(in nsiobserver aobserver); void setwindowcreator(in nsiwindowcreator creator); void unregisternotification(in nsiobserver aobserver); attributes attribute type description activewindow
nsidomwindow the watcher serves as a global storage facility for the current active (front most non-floating-palette-type) window, storing and returning it on demand.
...this attribute will be null if the active window is not an
nsidomwindow; for example, if the active window is an alert.
...And 11 more matches
Functions - JavaScript
function scope variables defined i
nside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function.
... however, a function can access all variables and functions defined i
nside the scope in which it is defined.
...a function defined i
nside another function can also access all variables defined in its parent function, and any other variables to which the parent function has access.
...And 11 more matches
JavaScript modules - JavaScript
the modules directory's two modules are described below: canvas.js — contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height i
nside a wrapper <div> with a specified id, which is itself appended i
nside a specified parent element.
... createreportlist() — creates an unordered list appended i
nside a specified wrapper element, which can be used to output report data into.
...they need to be top-level items; you can't use export i
nside a function, for example.
...And 11 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
extensions also can be co
nsidered xul applications with chrome.
...the dtd file is located i
nside the locale package, and the correct file is picked automatically to match the user’s language preferences.
...the clock.dtd file i
nside the fr-fr folder must be encoded as utf-8.
...And 10 more matches
Fundamental text and font styling - Learn web development
as you'll have already experienced in your work with html and css, text i
nside an element is laid out i
nside the element's content box.
... note: bear in mind that the text i
nside an element is all affected as one single entity.
... the list of actual web safe fonts will change as operating systems evolve, but it's reasonable to co
nsider the following fonts web safe, at least for now (many of them have been popularized thanks to the microsoft core fonts for the web initiative in the late 90s and early 2000s): name generic type notes arial sans-serif it's often co
nsidered best practice to also add helvetica as a preferred alternative to arial as, although their font faces are almost identical, ...
...And 10 more matches
Making decisions in your code — conditionals - Learn web development
a condition to test, placed i
nside the parentheses (typically "is this value bigger than this other value?", or "does this value exist?").
... a set of curly braces, i
nside which we have some code — this can be any code we like, and it only runs if the condition returns true.
... another set of curly braces, i
nside which we have some more code — this can be any code we like, and it only runs if the condition is not true — or in other words, the condition is false.
...And 10 more matches
Working with JSON - Learn web development
you can include the same basic data types i
nside json as you can in a standard javascript object — strings, numbers, arrays, booleans, and other object literals.
... }, { "name": "eternal flame", "age": 1000000, "secretidentity": "unknown", "powers": [ "immortality", "heat immunity", "inferno", "teleportation", "interdimensional travel" ] } ] } if we loaded this object into a javascript program, parsed in a variable called superheroes for example, we could then access the data i
nside it using the same dot/bracket notation we looked at in the javascript object basics article.
... i
nside that we want to access the members property, so we use ["members"].
...And 10 more matches
React interactivity: Events and state - Learn web development
once we have our callback prop, we can call it i
nside <form /> to send the right data to <app />.
... handling form submission via callbacks i
nside the top of our app() component function, create a function named addtask() which has a single parameter of name: function addtask(name) { alert(name); } next, we'll pass addtask() into <form /> as a prop.
...your <form /> component call should be updated as follows: <form addtask={addtask} /> finally, you can use this prop i
nside the handlesubmit() function in your <form /> component!
...And 10 more matches
Introduction to automated testing - Learn web development
automation makes things easy throughout this module we have detailed loads of different ways in which you can test your websites and apps, and explained the sort of scope your cross-browser testing efforts should have in terms of what browsers to test, accessibility co
nsiderations, and more.
...i
nside this section we'll look at how to automate task running with node and gulp, a beginner-friendly option.
... create a new directory somewhere sensible using your file manager ui, or, on a command line, by navigating to the location you want and running the following command: mkdir node-test to make this directory an npm project, you just need to go i
nside your test directory and initialize it, with the following: cd node-test npm init this second command will ask you many questions to find out the information required to set up the project; you can just select the defaults for now.
...And 10 more matches
Command line crash course - Learn web development
better programs exist for providing a terminal experience on windows, such as powershell (see here to find installers), and gitbash (which comes as part of the git for windows toolset) however, the best option for windows in the modern day is the windows subsystem for linux (wsl) — a compatibility layer for running linux operating systems directly from i
nside windows 10, allowing you to run a “true terminal” directly on windows, without needing a virtual machine.
...ach case: navigate your computer’s file system along with base level tasks such as create, copy, rename and delete: move around your directory structure: cd create directories: mkdir create files (and modify their metadata): touch copy files: cp move files: mv delete files or directories: rm download files found at specific urls: curl search for fragments of text i
nside larger bodies of text: grep view a file's contents page by page: less, cat manipulate and transform streams of text (for example changing all the instances of <div>s in an html file to <article>): awk, tr, sed note: there are a number of good tutorials on the web that go much deeper into the command line on the web — this is only a brief introduction!
...assuming the directory is i
nside your home directory, you can use cd desktop (see the screenshots below).
...And 10 more matches
Performance best practices for Firefox front-end engineers
you might want to co
nsider using a worker if you need to do some computation that can be done off of the main thread.
... if you need more elevated privileges than a standard worker allows, co
nsider using a chromeworker, which is a firefox-only api which lets you create workers with more elevated privileges.
...normally, the changes to the dom just result in the standard style calculation occurring immediately after the javascript has finished running during the 16ms window, i
nside the "style" step.
...And 10 more matches
nsIWindowMediator
nsisimpleenumerator getenumerator(in wstring awindowtype);
nsidomwindow getmostrecentwindow(in wstring awindowtype);
nsidomwindow getouterwindowwithid(in unsigned long long aouterwindowid); nsisimpleenumerator getxulwindowenumerator(in wstring awindowtype); pruint32 getzlevel(in nsixulwindow awindow); native code only!
... var {cc: classes, ci: interfaces} = components; var windowlistener = { onopenwindow: function (awindow) { // wait for the window to finish loading let domwindow = awindow.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.
nsidomwindowinternal || ci.
nsidomwindow); domwindow.addeventlistener("load", function () { domwindow.removeeventlistener("load", arguments.callee, false); //this removes this load function from the window //window has now loaded now do stuff to it //as example this will add a function to listen to tab select and will fire alert in that window if ...
... return value an enumerator of
nsidomwindows.
...And 10 more matches
Using Service Workers - Web APIs
in order to facilitate local development, localhost is co
nsidered a secure origin by browsers as well.
... when the oninstall handler completes, the service worker is co
nsidered installed.
... promises can do a variety of things, but all you need to know for now is that if something returns a promise, you can attach .then() to the end and include callbacks i
nside it for success cases, or you can insert .catch() on the end if you want to include a failure callback.
...And 10 more matches
JXON - Archive of obsolete content
the algorithms proposed here (see: #1, #2, #3, #4) will co
nsider only the following types of nodes and their attributes: document (only as function argument), documentfragment (only as function argument), element, text (never as function argument), cdatasection (never as function argument), attr (never as function argument).
...this type of algorithm is still co
nsidered lossless, since what is lost is meta-information and not information.
... we co
nsider the third algorithm as the most representative and practical jxon parsing algorithm.
...And 9 more matches
Templates - Archive of obsolete content
i
nside it, you can place the elements that you want to use for each constructed element.
... the template element should be placed i
nside the container that will contain the constructed elements.
... for example, if you are using a tree, you should place the template element i
nside a tree element.
...And 9 more matches
Client-side form validation - Learn web development
however, client-side validation should not be co
nsidered an exhaustive security measure!
... "please enter your phone number in the format xxx-xxxx" (a specific data format is required for it to be co
nsidered valid).
... if the data entered in a form field follows all of the rules specified by the above attributes, it is co
nsidered valid.
...And 9 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
a set number of times per second), discusses what they are useful for, and co
nsiders their inherent issues.
... passing parameters to a settimeout() function any parameters that you want to pass to the function being run i
nside the settimeout() must be passed to it as additional parameters at the end of the list.
... if, however, you are doing something more complex and involving objects that are not directly accessible i
nside the dom (such as 2d canvas api or webgl objects), requestanimationframe() is the better option in most cases.
...And 9 more matches
Looping code - Learn web development
let's co
nsider the case of a farmer that is making sure he has enough food to feed his family for the week.
... i
nside the parentheses we have three items, separated by semi-colons: an initializer — this is usually a variable set to a number, which is incremented to count the number of times the loop has run.
... i
nside the loop, we concatenate the current loop item (cats[i] , which is cats[whatever i is at the time]) along with a comma and space, onto the end of the info variable.
...And 9 more matches
Drawing graphics - Learn web development
webgl allows you to create real 3d graphics i
nside your web browser; the below example shows a simple rotating webgl cube: this article will focus mainly on 2d canvas, as raw webgl code is very complex.
... i
nside the canvas tags, you can put some fallback content, which is shown if the user's browser doesn't support canvas.
... now add the following lines of javascript i
nside the <script> element: const canvas = document.queryselector('.mycanvas'); const width = canvas.width = window.innerwidth; const height = canvas.height = window.innerheight; here we have stored a reference to the canvas in the canvas constant.
...And 9 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
in our checkalltodos() function, when we run: todos.foreach(t => t.completed = completed) svelte will not mark todos as changed because it does not know that when we update our t variable i
nside the foreach() method, we are also modifying the todos array.
... don't forget to pass the prop into moreactions from i
nside todos.svelte, where the component is called: <moreactions {todos} on:checkall={e => checkalltodos(e.detail)} on:removecompleted={removecompletedtodos} /> working with the dom: focusing on the details now that we have completed all of the app's required functionality, we'll concentrate on some accessibility features that will improve the usability of our app for both keyboard-on...
... put the following contents i
nside it: <script> import { createeventdispatcher } from 'svelte' const dispatch = createeventdispatcher() let name = '' const addtodo = () => { dispatch('addtodo', name) name = '' } const oncancel = () => name = '' </script> <form on:submit|preventdefault={addtodo} on:keydown={e => e.key === 'escape' && oncancel()}> <h2 class="label-wrapper"> <label for="todo-0" clas...
...And 9 more matches
Creating localizable web applications
for example, if not all the pages of your website are going to be localized, you may co
nsider removing links to the english-only pages from the navigation (headers, footers, sidebars) in the localized versions.
...use the dir attribute on the <html/> element and co
nsider using a rtl class on <html/> or <body/> as well, in order to easily change css rules like in the example below.
...co
nsider the following example: a filmreel-like slideshow showcasing highlighted features of the product or featured designs.
...And 9 more matches
nsIPromptService
to get an instance, use: var promptservice = components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getservice(components.interfaces.nsipromptservice); method overview void alert(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext); void alertcheck(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in wstring acheckmsg, inout boolean acheckstate); boolean confirm(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext); boolean confirmcheck(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in ...
...wstring acheckmsg, inout boolean acheckstate); print32 confirmex(in
nsidomwindow aparent,in wstring adialogtitle,in wstring atext, in unsigned long abuttonflags,in wstring abutton0title, in wstring abutton1title,in wstring abutton2title,in wstring acheckmsg, inout boolean acheckstate); boolean prompt(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring avalue, in wstring acheckmsg, inout boolean acheckstate); boolean promptusernameandpassword(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring ausername, inout wstring apassword, in wstring acheckmsg, inout boolean acheckstate); boolean promptpassword(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, inout wstring apassword, in wstri...
...ng acheckmsg, inout boolean acheckstate); boolean select(in
nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in pruint32 acount, [array, size_is(acount)] in wstring aselectlist, out long aoutselection); constants the following flags are combined to form the abuttonflags parameter passed to confirmex.
...And 9 more matches
Element Positioning - Archive of obsolete content
box element positioning so far, we know how to position elements either horizontally or vertically i
nside a box.
...for example, a button's width is determined by the amount of text i
nside the button.
...a box will be large enough to hold the elements i
nside the box.
...And 8 more matches
Creating hyperlinks - Learn web development
anatomy of a link a basic link is created by wrapping the text or other content, see block level links, i
nside an <a> element and using the href attribute, also known as a hypertext reference, or target, that contains the web address.
... i
nside the html body, add one or more paragraphs or other types of content you already know about.
...i
nside the root, we have an index.html file and a contacts.html.
...And 8 more matches
Making asynchronous programming easier with async and await - Learn web development
the await keyword the real advantage of async functions becomes apparent when you combine it with the await keyword — in fact, await only works i
nside async functions.
... you'll note that we've wrapped the code i
nside a function, and we've included the async keyword before the function keyword.
... this is necessary — you have to create an async function to define a block of code in which you'll run your async code; as we said earlier, await only works i
nside of async functions.
...And 8 more matches
Introduction to events - Learn web development
in the case of the web, events are fired i
nside the browser window, and tend to be attached to a specific item that resides in it — this might be a single element, set of elements, the html document loaded in the current tab, or the entire browser window.
...> button { margin: 10px }; the javascript looks like so: const btn = document.queryselector('button'); function random(number) { return math.floor(math.random() * (number+1)); } btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; } in this code, we store a reference to the button i
nside a constant called btn, using the document.queryselector() function.
...the above example invokes a function defined i
nside a <script> element on the same page, but you could also insert javascript directly i
nside the attribute, for example: <button onclick="alert('hello, this is my old-fashioned event handler!');">press me</button> you can find html attribute equivalents for many of the event handler properties; however, you shouldn't use these — they are co
nsidered bad practice.
...And 8 more matches
Silly story generator - Learn web development
if the online editor you are using doesn't have a separate javascript panel, feel free to put it inline in a <script> element i
nside the html page.
...in addition you've got a function called randomvaluefromarray() that takes an array, and returns one of the items stored i
nside the array at random.
...we'd like you to contain these i
nside variables i
nside main.js: store the first, big long, string of text i
nside a variable called storytext.
...And 8 more matches
Observer Notifications
profile-before-change-qm called to shut down the quotamanager; this is separated from profile-before-change to allow everything i
nside profile-before-change to continue using it.
... web-workers-shutdown called i
nside xpcom-shutdown.
... 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.
...And 8 more matches
nsIAccessibleRetrieval
inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsiaccessible getaccessiblefor(in
nsidomnode anode); nsiaccessible getaccessibleinshell(in
nsidomnode anode, in nsipresshell apresshell); nsiaccessible getaccessibleinweakshell(in
nsidomnode anode, in nsiweakreference apresshell); obsolete since gecko 2.0 nsiaccessible getaccessibleinwindow(in
nsidomnode anode, in
nsidomwindow adomwin); obsolete since gecko 2.0 nsiaccessible getapplicationaccessible(); nsiaccessible getattachedaccessiblefo...
...r(in
nsidomnode anode); nsiaccessible getcachedaccessible(in
nsidomnode anode, in nsiweakreference ashell); obsolete since gecko 2.0 nsiaccessnode getcachedaccessnode(in
nsidomnode anode, in nsiweakreference ashell); obsolete since gecko 2.0
nsidomnode getrelevantcontentnodefor(in
nsidomnode anode); astring getstringeventtype(in unsigned long aeventtype); astring getstringrelationtype(in unsigned long arelationtype); astring getstringrole(in unsigned long arole);
nsidomdomstringlist getstringstates(in unsigned long astates, in unsigned long aextrastates); methods getaccessiblefor() return an nsiaccessible for a dom node in pres shell 0.
...nsiaccessible getaccessiblefor( in
nsidomnode anode ); parameters anode the dom node to get an accessible for.
...And 8 more matches
nsIXULTemplateQueryProcessor
a template query is the contents i
nside a <query> element within the template.
...method overview void addbinding(in
nsidomnode arulenode, in nsiatom avar, in nsiatom aref, in astring aexpr); print32 compareresults(in nsixultemplateresult aleft, in nsixultemplateresult aright, in nsiatom avar, in unsigned long asorthints); nsisupports compilequery(in nsixultemplatebuilder abuilder, in
nsidomnode aquery, in nsiatom arefvariable, in nsiatom amembervariable); void done(); nsisimpleenumerator generateresults(in ...
...nsisupports adatasource, in nsixultemplateresult aref, in nsisupports aquery); nsisupports getdatasource(in nsiarray adatasources, in
nsidomnode arootnode, in boolean aistrusted, in nsixultemplatebuilder abuilder, out boolean ashoulddelaybuilding); void initializeforbuilding(in nsisupports adatasource, in nsixultemplatebuilder abuilder, in
nsidomnode arootnode); nsixultemplateresult translateref(in nsisupports adatasource, in astring arefstring); methods addbinding() add a variable binding for a particular rule.
...And 8 more matches
Reference Manual
the problem is that i
nside the getter there is no knowledge of nscomptrs.
...co
nsider, however, what would happen if you were trying to do this with a raw xpcom interface pointer.
...
nsidomnode* p = ...; while ( p ) { // ...
...And 8 more matches
Tabbed browser - Archive of obsolete content
within the firefox browser are tabs and i
nside each tab is a browser, both in the common sense of a web page browser and the xul sense of a browser element.
... from a sidebar basically, if your extension code is a sidebar you can use: var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.
nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindow); mainwindow.gbrowser.addtab(...); from a dialog if your code is running in a dialog opened directly by a browser window, you can use: window.opener.gbrowser.addtab(...); if window.op...
...note that the code above does not work i
nside of the electrolysis (e10s) enabled tabs.
...And 7 more matches
Drag and Drop - Archive of obsolete content
the first is a drag service,
nsidragservice and the second is the drag session,
nsidragsession.
... the
nsidragservice is responsible for creating drag sessions when a drag starts, and removing the drag session when the drag is complete.
... the function invokedragsession should be called to start a drag i
nside an ondraggesture event handler.
...And 7 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
5 api codingscripting, glossary, infrastructure an api (application programming interface) is a set of features and rules that exist i
nside a software program (the application) enabling interaction with it through software - as opposed to a human user interface.
...for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code i
nside the block if the condition is true, or skip the whole block if the condition is false.
... 49 cors-safelisted request header cors, fetch a cors-safelisted request header is one of the following http headers: 50 cors-safelisted response header cors, fetch, glossary, http a cors-safelisted response header is an http header which has been safelisted so that it will not be filtered when responses are processed by cors, since they're co
nsidered safe (as the headers listed in access-control-expose-headers).
...And 7 more matches
Cascade and inheritance - Learn web development
for example, if you set a color and font-family on an element, every element i
nside it will also be styled with that color and font, unless you've applied different color and font values directly to them.
...in the example below we have a <ul>, with two levels of unordered lists nested i
nside it.
... the color has applied to the direct children, but also the indirect children — the immediate child <li>s, and those i
nside the first nested list.
...And 7 more matches
How to build custom form controls - Learn web development
for example, if you need to perform advanced styling on some controls such as the <select> element or if you want to provide custom behaviors, you may co
nsider building your own controls.
...we will also discuss how, when, and whether building your own control makes sense, and what to co
nsider when building a control is a requirement.
...if you co
nsider that the active state and the open state are completely different, the answer is again "nothing will happen" because we did not define any keyboard interactions for the opened state.
...And 7 more matches
Useful string methods - Learn web development
retrieving a specific string character on a related note, you can return any character i
nside a string by using square bracket notation — this means you include square brackets ([]) on the end of your variable name.
... i
nside the square brackets you include the number of the character you want to return, so for example to retrieve the first letter you'd do this: browsertype[0]; remember: computers count from 0, not 1!
... finding a substring i
nside a string and extracting it sometimes you'll want to find if a smaller string is present i
nside a larger one (we generally say if a substring is present i
nside a string).
...And 7 more matches
Ember interactivity: Events, classes and state - Learn web development
add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='what needs to be done?' placeholder='what needs to be done?' autofocus {{on 'keydown' this.onkeydown}} > this new attribute is i
nside double curly braces, which tells you it is part of ember's dynamic templating syntax.
... we can define what is available i
nside this by generating a component class to go along with your component.
... to create a header class to go with your header component, type this in to your terminal: ember generate component-class header this will create the following empty class file — todomvc/app/components/header.js: import component from '@glimmer/component'; export default class headercomponent extends component { } i
nside this file we will implement the event handler code.
...And 7 more matches
Introduction to client-side frameworks - Learn web development
there are many frameworks out there, but currently the "big four" are co
nsidered to be the following.
... co
nsider a common kind of application: a to-do list creator, which we'll look at implementing using a variety of frameworks in future chapters.
...we want to represent each task as a list item – an html <li> element i
nside of an unordered list element (a <ul>).
...And 7 more matches
Adding a new todo form: Vue events, methods, and models - Learn web development
previous overview: client-side javascript frameworks next we now have sample data in place, and a loop that takes each bit of data and renders it i
nside a todoitem in our app.
...go back to app.vue and add the following import statement just below the previous one, i
nside your <script> element: import todoform from './components/todoform'; you also need to register the new component in your app component — update the components property of the component object so that it looks like this: components: { todoitem, todoform } finally for this section, render your todoform component i
nside your app by adding the <to-do-form /> element i
nside yo...
...what we actually want to do is run a method on the submit event that will add the new todo to the todoitem data list defined i
nside app.
...And 7 more matches
nsIContentViewer
[noscript,notxpcom]
nsidocumentptr getdocument(); void hide(); void init(in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds); native code only!
... void setdocumentinternal(in
nsidocumentptr adocument, in boolean aforcereuseinnerwindow); native code only!
... [noscript,notxpcom,nostdcall] void setnavigationtiming(in nsdomnavigationtimingptr atiming); void setpagemode(in boolean apagemode, in nsiprintsettings aprintsettings); void show(); void stop(); void unload(); obsolete since gecko 1.8 attributes attribute type description container nsisupports domdocument
nsidomdocument enablerendering boolean obsolete since gecko 2.0 historyentry nsishentry get the history entry that this viewer will save itself into when destroyed.
...And 7 more matches
nsIMessenger
method overview void setdisplaycharset(in acstring acharset); void setwindow(in
nsidomwindow ptr, in nsimsgwindow msgwindow); void openurl(in acstring aurl); void loadurl(in
nsidomwindow ptr, in acstring aurl); void launchexternalurl(in acstring aurl); boolean canundo(); boolean canredo(); unsigned long getundotransactiontype(); unsigned long getredotransactiontype(); void undo(in nsimsgwindow msgwindow); ...
...vice messageservicefromuri(in acstring auri); nsimsgdbhdr msghdrfromuri(in acstring auri); acstring getmsguriatnavigatepos(in long apos); acstring getfolderuriatnavigatepos(in long apos); void getnavigatehistory(out unsigned long acurpos, out unsigned long acount, [array, size_is(acount)] out string ahistory); note: prior to gecko 8.0, all references to
nsidomwindow used in this interface were
nsidomwindow.
... void setwindow(in
nsidomwindow awin, in nsimsgwindow amsgwindow); parameters awin the window to set as the window for the messaging session.
...And 7 more matches
Introduction to formatting contexts - CSS: Cascading Style Sheets
this means that every element i
nside the <html> element's block is laid out according to normal flow following the rules for block and inline layout.
...display: table-caption block elements where overflow has a value other than visible elements with display: flow-root or display: flow-root list-item elements with contain: layout, content, or strict flex items grid items multicol containers elements with column-span set to all this is useful because a new bfc will behave much like the outermost document in that it becomes a mini-layout i
nside the main layout.
... a bfc contains everything i
nside it, float and clear only apply to items i
nside the same formatting context, and margins only collapse between elements in the same formatting context.
...And 7 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
the two-value syntax as you can see from the above explanation, the display property has gained co
nsiderable new powers.
... in addition to indicating whether something is block-level or inline-level in relationship to other boxes on the page, it now also indicates the formatting context i
nside the box it is applied to.
...a bfc ensures that everything i
nside your box stays i
nside it, and things from outside the box cannot intrude into it.
...And 7 more matches
Mobile first - Progressive web apps (PWAs)
this guide looks at a few useful techniques i
nside the mobile first umbrella.
... first things first — mobile as a default you may think that concentrating on the mobile experience first sounds pointless, as we are more used to dealing with desktop sites, and we surely need to co
nsider the full gamut of features for the overall experience across desktop, mobile, etc., before then paring it down to a mobile experience that is simpler, more streamlined, or whatever.
... we co
nsider the overall experience during the planning stage, look at what subset of features will be available on mobile, desktop, etc.
...And 7 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
for a start, let's have a look at what happens when we include the <video> and <img> elements i
nside our first two columns, naked and unstyled.
...this is pretty horrible, but generally this kind of problem is easily fixed with some simple css: img, video { max-width: 100%; } this tells the replaced elements to remain constrained i
nside their container's widths, no matter what.
...this is created by all of the css i
nside 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).
...And 7 more matches
Understanding WebAssembly text format - WebAssembly
each node in the tree goes i
nside a pair of parentheses — ( ...
... the first label i
nside the parenthesis tells you what type of node it is, and after that there is a space-separated list of either attributes or child nodes.
... there are a lot more things that can be put i
nside function bodies, but we will start off simple for now, and you’ll see a lot more examples as you go along.
...And 7 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
pros and cons i co
nsider the mpl to be an extremely well balanced oss license.
... the gpl does not state whether linked files and the like are co
nsidered “derivative works under copyright law.” the lgpl does make the declaration below.
... the following tasks can be co
nsidered modifications revision: rewriting the source code; addition: adding new code, or adding parts of it to other code; linkage: creating static or dynamic links.
...And 6 more matches
browser - Archive of obsolete content
ontentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, webprogress methods addprogresslistener, goback, goforward, gohome, gotoindex, loaduri, loaduriwithflags, reload, reloadwithflags, removeprogresslistener, stop, swapdocshells examples <!-- shows mozilla homepage i
nside a groupbox --> <groupbox flex="1"> <caption label="mozilla homepage"/> <browser type="content" src="http://www.mozilla.org" flex="1"/> </groupbox> attributes autocompleteenabled type: boolean set to true to enable autocomplete of fields.
... droppedlinkhandler(event, uri, name) -- firefox 51 or older droppedlinkhandler(event, links) -- firefox 52 or newer event -- drop event, or null if no event is available uri -- uri string of the dropped link name -- name string of the dropped link links -- array of the dropped items with
nsidroppedlinkitem interface homepage type: url this attribute allows you to set a homepage for the browser element.
... the type of browser, which can be used to set access of the document loaded i
nside the browser.
...And 6 more matches
Getting started with CSS - Learn web development
to link styles.css to index.html add the following line somewhere i
nside the <head> of the html document: <link rel="stylesheet" href="styles.css"> this <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute.
...in our document are two <em> elements — one i
nside a paragraph and the other i
nside a list item.
... to select only an <em> that is nested i
nside an <li> element i can use a selector called the descendant combinator, which simply takes the form of a space between two other selectors.
...And 6 more matches
Other form controls - Learn web development
in contrast, the <input> is an empty element with no closing tag — any default value is put i
nside the value attribute.
... note that even though you can put anything i
nside a <textarea> element (including other html elements, css, and javascript), because of its nature, it is all rendered as if it was plain text content.
... the <option> elements can be nested i
nside <optgroup> elements to create visually associated groups of values: <select id="groups" name="groups"> <optgroup label="fruits"> <option>banana</option> <option selected>cherry</option> <option>lemon</option> </optgroup> <optgroup label="vegetables"> <option>carrot</option> <option>eggplant</option> <option>potato</option> </optgroup> </select> on the <optgr...
...And 6 more matches
Mozilla splash page - Learn web development
you don't need to touch the css, just the html i
nside the <body> element — as long as you insert the correct markup, the styling will make it look correct.
... along with mdn.svg, these images will be your icons to link to further resources, i
nside the further-info area.
...save copies of all these i
nside the same directory as index.html.
...And 6 more matches
What is JavaScript? - Learn web development
the core client-side javascript language consists of some common programming features that allow you to do things like: store useful values i
nside variables.
...you will need to co
nsider cross browser testing in more detail when you get closer to delivering production code (i.e.
...when you load a web page in your browser, you are running your code (the html, css, and javascript) i
nside an execution environment (the browser tab).
...And 6 more matches
Getting started with React - Learn web development
they're a signal to you (and your computer) that the multiple lines of code i
nside are part of the same expression.
...create-react-app uses this name to make a new directory, then creates the necessary files i
nside it.
... make sure you cd to the place you'd like your app to live on your hard drive, then run the following in your terminal: npx create-react-app moz-todo-react this creates a moz-todo-react directory, and does several things i
nside it: installs some npm packages essential to the functionality of the app.
...And 6 more matches
Strategies for carrying out testing - Learn web development
you may also co
nsider using open source and privacy focussed analytics platforms like open web analytics and matomo.
... other co
nsiderations there are other co
nsiderations that you should probably include as well.
... you should definitely include accessibility as a grade a testing requirement (we'll cover exactly what you should test in our handling common accessibility problems article) plus you might have other co
nsiderations.
...And 6 more matches
Introducing a complete toolchain - Learn web development
tools used in our toolchain in this article we're going to use the following tools and features: jsx, a react-related set of syntax extensions that allow you to do things like defining component structures i
nside javascript.
... all web projects will be different, and you need to co
nsider what parts of your toolchain are necessary and co
nsider each part carefully.
...you will probably want to review this part of the toolchain semi-regularly and co
nsider if there's any upgrades or changes you should introduce, but this shouldn't be required too often.
...And 6 more matches
Starting WebLock
this works for most cases, but co
nsider the case when you have this notification create a component.
...in c++, this is co
nsidered a public variable and "compiled" into a get method (e.g., getsites).
...this service, available as
nsidirectoryservice, stores the location of various common system locations, such as the the directory containing the running process, the user's home directory, and others.
...And 6 more matches
nsIEventListenerService
method overview void geteventtargetchainfor(in
nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out
nsidomeventtarget aoutarray); void getlistenerinfofor(in
nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out nsieventlistenerinfo aoutarray); boolean haslistenersfor(in
nsidomeventtarget aeventtarget, in domstrin...
...g atype); void addsystemeventlistener(in
nsidomeventtarget target, in domstring type, in
nsidomeventlistener listener, in boolean usecapture); void removesystemeventlistener(in
nsidomeventtarget target, in domstring type, in
nsidomeventlistener listener, in boolean usecapture); attributes attribute type description systemeventgroup
nsidomeventgroup returns system event group.
...void geteventtargetchainfor( in
nsidomeventtarget aeventtarget, [optional] out unsigned long acount, [retval, array, size_is(acount)] out
nsidomeventtarget aoutarray ); parameters aeventtarget the
nsidomeventtarget for which to return the event target chain.
...And 6 more matches
nsISelectionController
void charactermove(in boolean forward, in boolean extend); boolean checkvisibility(in
nsidomnode node, in short startoffset, in short endoffset); void completemove(in boolean forward, in boolean extend); void completescroll(in boolean forward); boolean getcaretenabled(); short getdisplayselection(); nsiselection getselection(in short type); void intralinemove(in boolean forward, in boolean e...
...this will also have the effect of collapsing the selection if the extend = pr_false the "point" of selection that is extended is co
nsidered the "focus" point, or the last point adjusted by the selection.
...boolean checkvisibility( in
nsidomnode node, in short startoffset, in short endoffset ); parameters node
nsidomnode to test.
...And 6 more matches
nsISelectionPrivate
void getrangesforinterval(in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out
nsidomrange results); void getrangesforintervalarray(in nsinode beginnode, in print32 beginoffset, in nsinode endnode, in print32 endoffset, in boolean allowadjacent, in rangearray results); native code only!
... void getrangesforintervalcomarray(in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results); native code only!
... obsolete since gecko 12.0 long gettableselectiontype(in
nsidomrange range); void removeselectionlistener(in nsiselectionlistener listenertoremove); void scrollintoview(in short aregion, in boolean aissynchronous, in short avpercent, in short ahpercent); void setancestorlimiter(in nsicontent acontent); native code only!
...And 6 more matches
nsIXULTemplateBuilder
if a result passes a rule's conditions, this is co
nsidered a match, and the content within the rule's <action> body is inserted as a sibling of the <template>, assuming the template builder creates real dom content.
... last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void rebuild(); void refresh(); void addresult(in nsixultemplateresult aresult, in
nsidomnode aquerynode); void removeresult(in nsixultemplateresult aresult); void replaceresult(in nsixultemplateresult aoldresult, in nsixultemplateresult anewresult, in
nsidomnode aquerynode); void resultbindingchanged(in nsixultemplateresult aresult); nsixultemplateresult getresultforid(in astring aid); nsixultemplateresult getresultforcontent(in
nsidomelement aelement); boolean hasgener...
...atedcontent(in nsirdfresource anode, in nsiatom atag); void addrulefilter(in
nsidomnode arule, in nsixultemplaterulefilter afilter); [noscript] void init(in nsicontent aelement); [noscript] void createcontents(in nsicontent aelement, in boolean aforcecreation); void addlistener(in nsixulbuilderlistener alistener); void removelistener(in nsixulbuilderlistener alistener); attributes attribute type description root
nsidomelement readonly: the root node in the dom to which this builder is attached.
...And 6 more matches
Accessibility documentation index - Accessibility
5 aria annotations aria, accessibility, wai-aria, annotations, comments, details, suggestions wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations i
nside web documents.
... 11 multipart labels: using aria for labels with embedded fields i
nside them aria, accessibility, ben millard, firefox, guide, help, html, html 4, jaws, needscontent, aria-labelledby, label, solution, trouble shoot, troubleshoot the solution is in an aria attribute called aria-labelledby.
...it is normally used in conjunction with the listitem role, which is used to identify a list item contained i
nside the list.
...And 6 more matches
<input type="number"> - HTML: Hypertext Markup Language
you can set a default value for the input by including a number i
nside the value attribute, like so: <input id="number" type="number" value="42"> additional attributes in addition to the attributes commonly supported by all <input> types, inputs of type number support these attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options max the maximum ...
...value to accept for this input min the minimum value to accept for this input placeholder an example value to display i
nside the field when it's empty readonly a boolean attribute indicating whether the value is read-only step a stepping interval to use when using up and down arrows to adjust the value, as well as for validation list the values of the list attribute is the id of a <datalist> element located in the same document.
... important: bear in mind that, logically, you should not be able to enter characters i
nside a number input other than numbers.
...And 6 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
so if a variable is defined using var in a compound statement (for example i
nside an if control structure), it will be visible to the entire function.
...co
nsider the following: var a = ['dog', 'cat', 'hen']; a[100] = 'fox'; a.length; // 101 remember — the length of the array is one more than the highest index.
... add(); // nan // you can't perform addition on undefined you can also pass in more arguments than the function is expecting: add(2, 3, 4); // 5 // added the first two; 4 was ignored that may seem a little silly, but functions have access to an additional variable i
nside their body called arguments, which is an array-like object holding all of the values passed to the function.
...And 6 more matches
Patterns - SVG: Scalable Vector Graphics
rn id="pattern" x="0" y="0" width=".25" height=".25"> <rect x="0" y="0" width="50" height="50" fill="skyblue"/> <rect x="0" y="0" width="25" height="25" fill="url(#gradient2)"/> <circle cx="25" cy="25" r="20" fill="url(#gradient1)" fill-opacity="0.5"/> </pattern> </defs> <rect fill="url(#pattern)" stroke="black" width="200" height="200"/> </svg> screenshotlive sample i
nside the <pattern> element, you can include any of the other basic shapes you've included before, and each of them can be styled using any of the styles you've learned before, including gradients and opacity.
... here, we've just drawn two rectangle elements i
nside the pattern (which overlap, and one of which is twice the size of the other and is used to fill in the entire pattern), and one circle.
... unlike gradients, patterns have a second attribute, patterncontentunits, which describes the units system used i
nside the pattern element, on the basic shapes themselves.
...And 6 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
mtp1"); lockpref("mail.startup.enabledmailcheckonce", true); lockpref("mailnews.quotingprefs.version", 1); lockpref("mailnews.ui.threadpane.version", 5); /* 3) define here (because if set after "4)" below it doesn't work!) processldapvalues which is eventually called by getldapattributes() just below, check getldapattributes() code from $mozilla_home/defaults/autoconfig/prefcalls.js to see the i
nside call to "user defined" processldapvalues */ function processldapvalues(values) { if(values) { // set the global var with the values returned from the ldap query ldap_values = values; var uid = getldapvalue(values, "uid"); var cn = getldapvalue(values, "cn"); var mail = getldapvalue(values, "mail"); var url = getldapvalue(values, "labeleduri"); // those ldap variables a...
... // windows settings var env_user = getenv("username"); var env_home = getenv("homepath"); } var env_mozdebug= getenv("mozilla_debug"); // 2) define here (because if set after "3)" below it doesn't work !) processldapvalues which is eventually called by getldapattributes() just below, // check getldapattributes() code from $mozilla_home/defaults/autoconfig/prefcalls.js to see the i
nside call to "user defined" processldapvalues /* commented all this section about ldap calls, not supported in ff5 packages :-( function processldapvalues (values) { if(values) { // set the global var with the values returned from the ldap query ldap_values = values; var uid = getldapvalue ( values ,"uid" ); var cn = getldapvalue ( values ,"cn" ); var mail = get...
...); } else { // windows settings var env_user = getenv("username"); var env_home = getenv("homepath"); } var env_mozdebug = getenv("mozilla_debug"); /* 2) define here (because if set after "3)" below it doesn't work!) processldapvalues which is eventually called by getldapattributes() just below, check getldapattributes() code from $mozilla_home/defaults/autoconfig/prefcalls.js to see the i
nside call to "user defined" processldapvalues */ function processldapvalues(values) { if(values) { // set the global var with the values returned from the ldap query ldap_values = values; var uid = getldapvalue(values, "uid"); var cn = getldapvalue(values, "cn"); var mail = getldapvalue(values, "mail"); var url = getldapvalue(values, "labeleduri"); //debug with popup error m...
...And 5 more matches
Monitoring downloads - Archive of obsolete content
in particular, it needs to get an instance of the download manager's
nsidownloadmanager interface and create the database into which its data will be stored.
... onload: function() { // initialization code this.initialized = true; this.strings = document.getelementbyid("downloadlogger-strings"); this.dlmgr = components.classes["@mozilla.org/download-manager;1"] .getservice(components.interfaces.
nsidownloadmanager); this.dlmgr.addlistener(downloadlogger); // open the database, placing its file in the profile directory this.dbfile = components.classes["@mozilla.org/file/directory_service;1"] .getservice(components.interfaces.nsiproperties) .get("profd", components.interfaces.nsifile); this.dbfile.append("downloadlogger.sqlite"); // get access to the storage service and open the database this.storageservice = components.classes["@mozilla.org/storage/se...
...this is part of the
nsidownloadprogresslistener interface.
...And 5 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
<body> <-- method script goes here --> </body> </method> </implementation> a method declaration goes i
nside the implementation element, like the fields and properties do.
... elements with an xbl behavior attached to them have a special property which holds an array of the anonymous child elements i
nside it.
...note that it is possible for an xbl-bound element to be placed i
nside another one, in which case you will have to use the getanonymousnodes() function again.
...And 5 more matches
Building up a basic demo with A-Frame - Game development
the webxr and webgl apis already enable us to start creating virtual reality (vr) experiences i
nside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier.
... save a copy of the latest a-frame javascript library file i
nside your directory (check the github repository for latest stable a dev builds).
... html structure the first step is to create an html document — i
nside your project directory, create a new index.html file, and save the follow html i
nside it: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: a-frame demo</title> <script src="aframe.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this contains some basic information like the document charset and <title>.
...And 5 more matches
Dealing with files - Learn web development
i
nside your chosen place, create a new folder called web-projects (or similar).
... i
nside this first folder, create another folder to store your first website in.
...using your text editor, create a new file called index.html and save it just i
nside your test-site folder.
...And 5 more matches
Images in HTML - Learn web development
fortunately, it wasn't too long before the ability to embed images (and other more interesting types of content) i
nside web pages was added.
... there are other types of multimedia to co
nsider, but it is logical to start with the humble <img> element, used to embed a simple image in a webpage.
... so for example, if your image is called dinosaur.jpg, and it sits in the same directory as your html page, you could embed the image like so: <img src="dinosaur.jpg"> if the image was in an images subdirectory, which was i
nside the same directory as the html page (which google recommends for seo/indexing purposes), then you'd embed it like this: <img src="images/dinosaur.jpg"> and so on.
...And 5 more matches
From object to iframe — other embedding technologies - Learn web development
these were co
nsidered the height of coolness in the mid to late 90s, and there was evidence that having a webpage split up into smaller chunks like this was better for download speeds — especially noticeable with network connections being so slow back then.
... finally, the <iframe> element appeared (along with other ways of embedding content, such as <canvas>, <video>, etc.) this provides a way to embed an entire web document i
nside another one, as if it were an <img> or other such element, and is used regularly today.
... there are some serious security concerns to co
nsider with <iframe>s, as we'll discuss below, but this doesn't mean that you shouldn't use them in your websites — it just requires some knowledge and careful thinking.
...And 5 more matches
Image gallery - Learn web development
if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements i
nside the html page.
...the html body looks like this: <h1>image gallery example</h1> <div class="full-img"> <img class="displayed-img" src="images/pic1.jpg"> <div class="overlay"></div> <button class="dark">darken</button> </div> <div class="thumb-bar"> </div> the example looks like this: the most interesting parts of the example's css file: it absolutely positions the three elements i
nside the full-img <div> — the <img> in which the full-sized image is displayed, an empty <div> that is sized to be the same size as the <img> and put right over the top of it (this is used to apply a darkening effect to the image via a semi-transparent background color), and a <button> that is used to control the darkening effect.
... it sets the width of any images i
nside the thumb-bar <div> (so-called "thumbnail" images) to 20%, and floats them to the left so they sit next to one another on a line.
...And 5 more matches
Framework main features - Learn web development
the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expression represents an html <header> element with a <h1> element i
nside.
...for instance, co
nsider a function add(), which takes integers a and b and returns their sum.
...to render this component, we would write code like this in the place where we want it rendered (which will probably be i
nside another component): <authorcredit src="./assets/zelda.png" alt="portrait of zelda schiff" byline="zelda schiff is editor-in-chief of the library times." /> this will ultimately render the following <figure> element in the browser, with its structure as defined in the authorcredit component, and its content as defined in the props included on the authorcredit component call: <figure> <...
...And 5 more matches
Deploying our app - Learn web development
here's just a few things to co
nsider for this particular project: generating a production build: ensuring files are minimised, chunked, have tree-shaking applied, and that versions are "cache busted".
... 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 i
nside of netlify and if the build is successful, the website changes will be deployed.
... "build": "parcel build src/index.html" } note: if the scripts property already has a command i
nside it, put a comma at the end of it.
...And 5 more matches
mach
if the current working directory mach is invoked with is i
nside an object directory, the mozconfig used when creating that object directory is used.
...if you don't use mach, you have to find another solution for the following problems: discovering what commands or make targets are available (mach exposes everything through mach help while i
nside "mozilla-central" , else you'll just get a cryptic error message) making more sense out of command output (mach offers terminal colorization and structured logging) getting productive tools in the hands of others (mach "advertises" tools to people through mach help (unless it actually just gives you a cryptic error message) - in the former case, people don't need to discover your tool from a b...
...generally speaking, if you have some piece of functionality or action that is useful to multiple people (especially if it results in productivity wins), then you should co
nsider implementing a mach command for it.
...And 5 more matches
Localization content best practices
it's important to co
nsider this when adding strings, and especially localization comments for strings that contain references, or obscure technical details.
... create localizable strings don't assume grammar structures you need to co
nsider the need for different grammar structures in different locales, and add switching mechanisms to present them appropriately.
... unless there are significant savings of translation volume involved, it is usually easier and quicker for translators to handle these as fixed strings rather than composed strings, especially co
nsidering the time needed for locating, checking and potentially fixing composed strings.
...And 5 more matches
nsIJSID
method overview boolean equals(in nsijsid other); const
nsid* getid(); violates the xpcom interface guidelines void initialize(in string idstring); string tostring(); attributes attribute type description id
nsidptr read only.
...obsolete since gecko 1.9 the internal
nsid.
...the string representation of the internal
nsid.
...And 5 more matches
nsISmsRequestManager
to create an instance, use: var smsrequestmanager = components.classes["@mozilla.org/sms/smsrequestmanager;1"] .createinstance(components.interfaces.nsismsrequestmanager); method overview long addrequest(in
nsidommozsmsrequest arequest); long createrequest(in
nsidommozsmsmanager amanager, out
nsidommozsmsrequest arequest); void notifycreatemessagelist(in long arequestid, in long alistid, in
nsidommozsmsmessage amessage); void notifygetsmsfailed(in long arequestid, in long aerror); void notifygotnextmessage(in long arequestid, in
nsidommozsmsmessage amessage); void notifygotsms(in long arequesti...
...d, in
nsidommozsmsmessage amessage); void notifymarkedmessageread(in long arequestid, in bool aread); void notifymarkmessagereadfailed(in long arequestid, in long aerror); void notifynomessageinlist(in long arequestid); void notifyreadmessagelistfailed(in long arequestid, in long aerror); void notifysmsdeleted(in long arequestid, in bool adeleted); void notifysmsdeletefailed(in long arequestid, in long aerror); void notifysmssendfailed(in long arequestid, in long aerror); void notifysmssent(in long arequestid, in
nsidommozsmsmessage amessage); constants all sms related errors that could apply to smsrequest objects.
...long addrequest( in
nsidommozsmsrequest arequest ); parameters arequest an smsrequest.
...And 5 more matches
nsIWinTaskbar
to create an instance, use: var wintaskbar = components.classes["@mozilla.org/windows-taskbar;1"] .getservice(components.interfaces.nsiwintaskbar); method overview nsijumplistbuilder createjumplistbuilder(); nsitaskbartabpreview createtaskbartabpreview(in
nsidocshell shell, in nsitaskbarpreviewcontroller controller); nsitaskbarprogress gettaskbarprogress(in
nsidocshell shell); nsitaskbarwindowpreview gettaskbarwindowpreview(in
nsidocshell shell); void setgroupidforwindow(in
nsidomwindow aparent, in astring aidentifier); attributes attribute type description available boolean returns true if the operating system supports windows 7 or late...
...createtaskbartabpreview() creates a taskbar tab preview, given an
nsidocshell reference to a top-level window.
... nsitaskbartabpreview createtaskbartabpreview( in
nsidocshell shell, in nsitaskbarpreviewcontroller controller ); parameters shell an
nsidocshell object representing the top-level window from which to create the preview.
...And 5 more matches
nsIXMLHttpRequestEventTarget
1.0 66 introduced gecko 1.9.1 inherits from:
nsidomeventtarget last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) attributes attribute type description onabort
nsidomeventlistener a javascript function object that gets invoked if the operation is canceled by the user.
... onerror
nsidomeventlistener a javascript function object that gets invoked if the operation fails to complete due to an error.
... onload
nsidomeventlistener a javascript function object that gets invoked when the operation is successfully completed.
...And 5 more matches
XPIDL
nsresult (xpidl unsigned long typedef, 32 bits) number nsrefcnt (xpidl unsigned long typedef, 32 bits) number size_t (xpidl unsigned long typedef, 32 bits) number voidptr void* void* not allowed charptr char* char** not allowed unicharptr char16_t* char16_t** not allowed
nsidref const
nsid&
nsid* ?
...
nsidptr const
nsid*
nsid** ?
...
nsid const
nsid nsid* ?
...And 5 more matches
Working with windows in chrome code
technically speaking, it implements a number of interfaces, including
nsidomjswindow and
nsidomwindow, but it also contains the user-defined properties for global variables and functions of the window.
... the same holds for chrome windows opened i
nside a tab of <tabbrowser>.
... accessing content documents assume you have a document loaded in a <tabbrowser>, <browser>, or <iframe> element i
nside your document.
...And 5 more matches
Using Web Workers - Web APIs
you can run whatever code you like i
nside the worker thread, with some exceptions.
... for example, you can't directly manipulate the dom from i
nside a worker, or use some default methods and properties of the window object.
...first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.postmessage([first.value,second.value]); console.log('message posted to worker'); } so here we have two <input> elements represented by the variables first and second; when the value of either is changed, myworker.postmessage([first.value,second.value]) is used to send the value i
nside both to the worker, as an array.
...And 5 more matches
ARIA Test Cases - Accessibility
expected at behavior: when any control is focused i
nside the groupbox, where focus was previously outside of the groupbox, the description for the entire groupbox should be read by a screen reader.
.../a jaws 10 - - - - voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - group (no examples yet) expected at behavior: (mz) when focus first lands on a control i
nside the group, the name should be spoken.
... voiceover (leopard) n/a n/a - fail window-eyes - - - - nvda - n/a - - zoom (leopard) pass n/a pass pass zoomtext - - - - orca - - - - menubar and menu yui menubar menubar 1 dojo nightly build - popup menu expected at behavior: (mz) as focus is placed i
nside a menu or menubar, a screen reader should announce the name (if any) of the menu, the role of the menu, and then read the current menu item.
...And 5 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
that said, hsl colors incorporate lightness, not luminance, and this is a significant co
nsideration.
... another important point to co
nsider is the ambience of light surrounding the color.
... color combinations contrast alone is not enough when it comes to accessibility co
nsiderations.
...And 5 more matches
Using HTML sections and outlines - Developer guides
you can have primary and secondary menus, but you cannot nest a <nav> element i
nside another <nav> element.
...the header can also be used i
nside other semantic elements such as <article> or <section>.
... </p> </article> nesting elements i
nside an article the <article> element can have other semantic elements such as headers, asides, and footers.
...And 5 more matches
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
it takes few attributes, the most notable of which are form, which can contain the id of a <form> on the same page, allowing you to make the <fieldset> part of that <form> even if it is not nested i
nside it, and disabled, which allows you to disable the <fieldset> and all its contents in one go.
...note that form elements i
nside the <legend> element won't be disabled.
... form this attribute takes the value of the id attribute of a <form> element you want the <fieldset> to be part of, even if it is not i
nside the form.
...And 5 more matches
Closures - JavaScript
lexical scoping co
nsider the following example code: function init() { var name = 'mozilla'; // name is a local variable created by init function displayname() { // displayname() is the inner function, a closure alert(name); // use variable declared in the parent function } displayname(); } init(); init() creates a local variable called name and a function called displayname().
... the displayname() function is an inner function that is defined i
nside init() and is available only within the body of the init() function.
... closure co
nsider the following code example: function makefunc() { var name = 'mozilla'; function displayname() { alert(name); } return displayname; } var myfunc = makefunc(); myfunc(); running this code has exactly the same effect as the previous example of the init() function above.
...And 5 more matches
Media container formats (file types) - Web media technologies
audio codecs supported by webm codec browser support chrome edge firefox safari opus yes yes yes yes vorbis yes yes yes yes choosing the right container there are a few factors to co
nsider when selecting the best container or containers to use for your media.
... if your target audience is likely to include users on mobile, especially on lower-end devices or on slow networks, co
nsider providing a version of your media in a 3gp container with appropriate compression.
... if you want your media to be in a non-proprietary, open format, co
nsider using one of the open container formats such as flac (for audio) or webm (for video).
...And 5 more matches
Web Performance
this article starts the module off with a good look at what performance actually is — this includes the tools, metrics, apis, networks, and groups of people we need to co
nsider when thinking about performance, and how we can make performance part of our web development workflow.
...this article outlines some javascript best practices that should be co
nsidered to ensure even complex content is as performant as possible.
... mobile performance with web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited bandwidth, cpu and battery life, it is important to co
nsider the performance of your web content on these platforms.
...And 5 more matches
fill-rule - SVG: Scalable Vector Graphics
the fill-rule attribute is a presentation attribute defining the algorithm to use to determine the i
nside part of a shape.
...it is therefore co
nsidered outside the shape, and not filled.
... --> <polygon fill-rule="evenodd" stroke="red" points="150,0 121,90 198,35 102,35 179,90"/> </svg> usage notes value nonzero | evenodd default value nonzero animatable yes the fill-rule attribute provides two options for how the i
nside (that is, the area to be filled) of a shape is determined: nonzero the value nonzero determines the "i
nsideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray.
...And 5 more matches
Secure contexts - Web security
when is a context co
nsidered secure?
... a context is co
nsidered secure when it meets certain minimum standards of authentication and confidentiality defined in the secure contexts specification.
... a particular document is co
nsidered to be in a secure context when it is the active document of a top-level browsing context (basically, a containing window or tab) that is a secure context.
...And 5 more matches
Using shadow DOM - Web Components
as an example, co
nsider the following html fragment: <!doctype html> <html> <head> <meta charset="utf-8"> <title>simple dom example</title> </head> <body> <section> <img src="dinosaur.png" alt="a red tyrannosaurus rex: a two legged dinosaur standing upright like a human, with small arms, and a large head with lots of sharp teeth."> <p>here we will add a link to the <a href="https:/...
... shadow tree: the dom tree i
nside the shadow dom.
... you can affect the nodes in the shadow dom in exactly the same way as non-shadow nodes — for example appending children or setting attributes, styling individual nodes using element.style.foo, or adding style to the entire shadow dom tree i
nside a <style> element.
...And 5 more matches
content/mod - Archive of obsolete content
window :
nsidomwindow the window to be modified.
...detachfrom(style, window); parameters modification : object the modification we want to remove from the target window :
nsidomwindow the window to be modified.
... gettargetwindow(target) function takes target, value representing content (page) and returns
nsidomwindow for that content.
...And 4 more matches
Actions - Archive of obsolete content
the content to generate goes directly i
nside the action element.
...instead, the action element is placed directly i
nside the <xul:template> element after the query is defined.
...for result b, the builder would have generated the following content: <button id="http://www.xulplanet.com/rdf/b" label="http://www.xulplanet.com/rdf/b"/> naturally, you wouldn't use an id attribute i
nside a template action since the id would be replaced anyway.
...And 4 more matches
Content Panels - Archive of obsolete content
the web pages would appear i
nside the iframe.
...there are three classes of browser, depending on the kind of content that you want to display i
nside.
...in this case, the content loaded i
nside the browser is treated as if it was part of the same application and has access to the outer window.
...And 4 more matches
Trees - Archive of obsolete content
all of the columns should be placed directly i
nside a treecols element.
... treerow a single row in the tree, which should be placed i
nside a treeitem tag.
...this element would go i
nside a treerow element.
...And 4 more matches
Using Spacers - Archive of obsolete content
as we've seen, the find files window has appeared in a size that will fit the elements i
nside it.
...if you place a spacer directly i
nside a window, the spacer will grow in size when the size of the window is changed.
...you'll notice that the cancel button in the dialogs has always set its width so that it fits the text i
nside it.
...And 4 more matches
3D collision detection - Game development
the box constantly changes dimensions to snugly fit the entity contained i
nside.
...aabb checking if a point is i
nside an aabb is pretty simple — we just need to check whether the point's coordinates fall i
nside the aabb; co
nsidering each axis separately.
...re the ranges of each axis of the aabb, we can calculate whether a collision has occurred between the two using the following formula: f(p,b)=(px>=bminx∧px<=bmaxx)∧(py>=bminy∧py<=bmaxy)∧(pz>=bminz∧pz<=bmaxz)f(p,b)= (p_x >= b_{minx} \wedge p_x <= b_{maxx}) \wedge (p_y >= b_{miny} \wedge p_y <= b_{maxy}) \wedge (p_z >= b_{minz} \wedge p_z <= b_{maxz}) or in javascript: function ispointi
nsideaabb(point, box) { return (point.x >= box.minx && point.x <= box.maxx) && (point.y >= box.miny && point.y <= box.maxy) && (point.z >= box.minz && point.z <= box.maxz); } aabb vs.
...And 4 more matches
Styling tables - Learn web development
link the css to the html by placing the following line of html i
nside your <head>: <link href="style.css" rel="stylesheet" type="text/css"> spacing and layout the first thing we need to do is sort out the spacing/layout — default table styling is so cramped!
...this is why we've selected the four different headings with the thead th:nth-child(n) (:nth-child) selector ("select the nth child that is a <th> element in a sequence, i
nside a <thead> element") and given them set percentage widths.
...we've also set our custom font on the headings i
nside the <thead> and <tfoot> elements, for a nice grungy, punky look.
...And 4 more matches
Introduction to CSS layout - Learn web development
we also have entire layout methods that are switched on via specific display values, for example css grid and flexbox, which alter how elements i
nside the element they are set on are laid out.
... the position property — allows you to precisely control the placement of boxes i
nside other boxes.
...if you create a link around some text i
nside a paragraph, that link remains inline with the rest of the text, and doesn’t break onto a new line.
...And 4 more matches
Styling lists - Learn web development
previous overview: styling text next lists behave like any other text for the most part, but there are some css properties specific to lists that you need to know about, and some best practices to co
nsider.
... list-style-position: sets whether the bullets appear i
nside the list items, or outside them before the start of each item.
... bullet position the list-style-position property sets whether the bullets appear i
nside the list items, or outside them before the start of each item.
...And 4 more matches
JavaScript basics - Learn web development
for example: let icecream = 'chocolate'; if(icecream === 'chocolate') { alert('yay, i love chocolate ice cream!'); } else { alert('awwww, but chocolate is my favorite...'); } the expression i
nside the if( ...
...arguments go i
nside the parentheses, separated by commas if there is more than one argument.
... for example, the alert() function makes a pop-up box appear i
nside the browser window, but we need to give it a string as an argument to tell the function what message to display.
...And 4 more matches
HTML text fundamentals - Learn web development
search engines indexing your page co
nsider the contents of headings as important keywords for influencing the page's search rankings.
...co
nsider the following: <span style="font-size: 32px; margin: 21px 0; display: block;">is this a top level heading?</span> this is a <span> element.
... nesting lists it is perfectly ok to nest one list i
nside another one.
...And 4 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
to get started, open the local copy i
nside your favorite text editor, and your browser.
...what's even more useful is that the console gives you error messages whenever a syntax error exists i
nside the javascript being fed into the browser's javascript engine.
... note: this error didn't come up as soon as the page was loaded because this error occurred i
nside a function (i
nside the checkguess() { ...
...And 4 more matches
Inheritance in JavaScript - Learn web development
i
nside here you'll find the same person() constructor example that we've been using all the way through the module, with a slight difference — we've defined only the properties i
nside the constructor: function person(first, last, age, gender, interests) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; }; the methods are all defined o...
... the last line i
nside the constructor simply defines the new subject property that teachers are going to have, which generic people don't have.
...so, for example, if you had something really simple like this: function brick() { this.width = 10; this.height = 20; } you could inherit the width and height properties by doing this (as well as the other steps described below, of course): function blueglassbrick() { brick.call(this); this.opacity = 0.5; this.color = 'blue'; } note that we've only specified this i
nside call() — no other parameters are required as we are not inheriting any properties from the parent that are set via parameters.
...And 4 more matches
React interactivity: Editing, filtering, conditional rendering - Learn web development
add the edittask() function i
nside your app component, in the same place as the other functions: function edittask(id, newname) { const editedtasklist = tasks.map(task => { // if this task has the same id as the edited task if (id === task.id) { // return {...task, name: newname} } return task; }); settasks(editedtasklist); } pass edittask into our <todo /> components as a prop in the same way we...
...add the following line just i
nside the top of your todo(props) { … } component definition: const [isediting, setediting] = usestate(false); next, we're going to rethink the <todo /> component — from now on, we want it to display one of two possible “templates", rather than the single template it's used so far: the "view" template, when we are just viewing a todo; this is what we’ve used in rest of the tutorial so far...
...="visually-hidden">{props.name}</span> </button> <button type="button" classname="btn btn__danger" onclick={() => props.deletetask(props.id)} > delete <span classname="visually-hidden">{props.name}</span> </button> </div> </div> ); we've now got the two different template structures — "edit" and "view" — defined i
nside two separate constants.
...And 4 more matches
TypeScript support in Svelte - Learn web development
steep learning curve: even though typescript is a superset of javascript and not a completely new language, there is a co
nsiderable learning curve, especially if you have no experience at all with static languages like java or c#.
...alternatively, you can download the setuptypescript.js file to a scripts folder i
nside your project's root folder, and then run node scripts/setuptypescript.js.
... note: if you find any trouble working with typescript i
nside a svelte application, have a look at this troubleshooting/faq section about typescript support.
...And 4 more matches
Focus management with Vue refs - Learn web development
i
nside it, assign your ref to a variable, and then call the focus() method on the ref.
... since the focusoneditbutton() method needs to be invoked after the dom has updated, we can wrap the existing function body i
nside a $nexttick() call.
...however, because our edit form is in a different component to our "edit" button, we can't just set focus i
nside the "edit" button’s click event handler.
...And 4 more matches
Handling common JavaScript problems - Learn web development
incorrectly using functions i
nside loops — for example, in bad-for-loop.html (see source code), we loop through 10 iterations, each time creating a paragraph and adding an onclick event handler to it.
...each scope can be expanded to show the values of variables i
nside the scope when execution of the code was stopped.
...as an example, the fetch api (a modern equivalent to xmlhttprequest) uses promises to fetch resources across the network and make sure that the response has been returned before they are used (for example, displaying an image i
nside an <img> element).
...And 4 more matches
Creating Custom Events That Can Pass Data
as of gecko 1.8, if your event names do not start with "nsdom" and their interfaces do not start with "
nsidom" then you can forget about passing data.
... you need to make the following two modifications: around line 1000: ns_define_classinfo_data({truncated name}, nsdomgenericsh, dom_default_scriptable_flags) around line 2900: dom_classinfo_map_begin({truncated name},
nsidom{truncatedname}) dom_classinfo_map_entry(
nsidom{truncated name}) dom_classinfo_event_map_entries dom_classinfo_map_end remember, {truncated name} is the same as above.
...your event in order for your event to work you must do the following: create a scriptable interface called
nsidom{youreventname} inheriting from
nsidomevent.
...And 4 more matches
Eclipse CDT
when eclipse's indexer tries to process the mozilla source, eclipse will need co
nsiderably more memory than the limits imposed by its default configuration.
...(if you're thinking of adding tips, please first co
nsider how widely useful they'll be before adding to this already lengthy page.) for further documentation see the official eclipse user guide and eclipse cdt user guide.
... the benefit of building from i
nside eclipse is that build errors will appear in the problems tab at the bottom of the window, and from there you can double click on the build error and it will take you straight to the source file and line where the problem occurred.
...And 4 more matches
Listening to events on all tabs
void onlocationchange(
nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, nsiuri alocation [optional] in unsigned long aflags ); parameters abrowser the browser representing the tab whose location changed.
...void onprogresschange(
nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, print32 acurselfprogress, print32 amaxselfprogress, print32 acurtotalprogress, print32 amaxtotalprogress ); parameters abrowser the browser representing the tab for which updated progress information is being provided.
...void onsecuritychange(
nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, unsigned long astate ); parameters abrowser the browser that fired the notification.
...And 4 more matches
Midas
it also has a property called contentwindow that refers to the window object i
nside the inline frame.
...if the caret is i
nside a list, that item becomes a sub-item one level deeper.
... insertbronreturn true/false selects whether pressing return i
nside a paragraph creates another paragraph or just inserts a <br> tag.
...And 4 more matches
A Web PKI x509 certificate primer
in order for a certificate to be valid these three requirements must be met: there is a verification path from the site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is co
nsidered trusted by the browser).
... the attributes of the certificates in the verification path have valid parameters for that verification (for example the validity period of all the certificates are valid for the time the verification is being done) revocation checks are co
nsidered ok for that particular validation.
... extensions while rfc 5280 defines 16 extensions for webpki in this document we will be describing the six extensions we co
nsidered critical for understanding.
...And 4 more matches
Avoiding leaks in JavaScript XPCOM components
with this strategy, a single pointer to the object is co
nsidered the "owner" of the object and the object is deleted through that pointer.
...co
nsider the example where j is implemented in javascript and n is implemented in c++.
... to understand closures a little better before examining how they can cause leaks, co
nsider the following example, in which there are two pairs of function objects, and each pair has an instance of the private_data variable: // this function returns an array containing two functions.
...And 4 more matches
nsIAppShellService
oid doprofilestartup(in nsicmdlineservice acmdlineservice, in boolean caninteract); obsolete since gecko 1.8 void ensure1window(in nsicmdlineservice acmdlineservice); obsolete since gecko 1.8 void enterlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void exitlastwindowclosingsurvivalarea(); obsolete since gecko 1.8 void gethiddenwindowandjscontext(out
nsidomwindow ahiddendomwindow, out jscontext ajscontext); native code only!
... void quit(in pruint32 aferocity); obsolete since gecko 1.8 void registertoplevelwindow(in nsixulwindow awindow); void run(); obsolete since gecko 1.8 void toplevelwindowismodal(in nsixulwindow awindow, in boolean amodal); obsolete since gecko 1.9.1 void unregistertoplevelwindow(in nsixulwindow awindow); note: prior to gecko 8.0, all references to
nsidomwindow used in this interface were
nsidomwindowinternal.
... hiddendomwindow
nsidomwindow return the (singleton) application hidden window, automatically created and maintained by this appshellservice.
...And 4 more matches
nsIEditor
66 introduced gecko 1.0 inherits from: nsisupports last changed in gecko 18.0 (firefox 18.0 / thunderbird 18.0 / seamonkey 2.15) method overview [noscript] void init(in
nsidomdocument doc, in nsicontent aroot, in nsiselectioncontroller aselcon, in unsigned long aflags); void setattributeorequivalent(in
nsidomelement element, in astring sourceattrname, in astring sourceattrvalue, in boolean asuppresstransaction); void removeattributeorequivalent(in
nsidomelement element, in domstring sourceattrname, in boolean asuppresstransaction); void postcreate(); void predestroy(in boolean adestroyingframes);...
...; 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 endofdocument(); drag/drop methods boolean candrag(in
nsidomevent aevent); void dodrag(in
nsidomevent aevent); void insertfromdrop(in
nsidomevent aevent); node manipulation methods void setattribute(in
nsidomelement aelement, in astring attributestr,in astring attvalue); boolean getattributevalue(in
nsidomelement aelement, in astring attributestr, out astring resultvalue); void removeattribute(in
nsid...
...omelement aelement, in astring aattribute); void cloneattribute(in astring aattribute, in
nsidomnode asourcenode); void cloneattributes(in
nsidomnode destnode, in
nsidomnode sourcenode);
nsidomnode createnode(in astring tag, in
nsidomnode parent, in long position); void insertnode(in
nsidomnode node, in
nsidomnode parent, in long aposition); void splitnode(in
nsidomnode existingrightnode, in long offset, out
nsidomnode newleftnode); void joinnodes(in
nsidomnode leftnode, in
nsidomnode rightnode, in
nsidomnode parent); void deletenode(in
nsidomnode child); void marknodedirty(in
nsidomnode node); direction controller void switchtextdirection(); output methods astring outputtostring(in...
...And 4 more matches
nsIUUIDGenerator
xpcom/base/nsiuuidgenerator.idlscriptable this interface can be used to generate an id that can be co
nsidered globally unique, often referred to as a uuid or guid.
... 1.0 66 introduced gecko 1.8.1 inherits from: nsisupports last changed in gecko 1.8.1 (firefox 2 / thunderbird 2 / seamonkey 1.1) implemented by @mozilla.org/uuid-generator; as a service: var uuidgenerator = components.classes["@mozilla.org/uuid-generator;1"] .getservice(components.interfaces.nsiuuidgenerator); method overview
nsidptr generateuuid(); void generateuuidinplace(in nsnonconstidptr id); native code only!
... methods generateuuid() obtains a new uuid using appropriate platform-specific methods to obtain a
nsid that can be co
nsidered to be globally unique.
...And 4 more matches
XPCOM Interface Reference by grouping
browser autocomplete nsiautocompletecontroller nsiautocompleteinput nsiautocompletesearch console nsiconsolelistener nsiconsolemessage nsiconsoleservice document
nsidocshell dom device
nsidomgeogeolocation
nsidomgeoposition
nsidomgeopositionaddress
nsidomgeopositioncallback
nsidomgeopositioncoords
nsidomgeopositionerror
nsidomgeopositionerrorcallback
nsidomgeopositionoptions
nsidomglobalpropertyinitializer element
nsidomchromewindow
nsidomclientrect
nsidomelement
nsidomhtmlaudioelement n...
...sidomhtmlformelement
nsidomhtmlmediaelement
nsidomhtmlsourceelement
nsidomhtmltimeranges
nsidomjswindow
nsidomnode
nsidomnshtmldocument
nsidomstorageitem
nsidomstoragemanager
nsidomwindow
nsidomwindow2
nsidomwindowinternal
nsidomwindowutils
nsidynamiccontainer nsieditor event
nsidomevent
nsidomeventgroup
nsidomeventlistener
nsidomeventtarget
nsidommousescrollevent
nsidommoztouchevent
nsidomorientationevent
nsidomprogressevent
nsidomsimplegestureevent
nsidragdrophandler
nsidragservice
nsidragsession html nsiaccessibilityservice nsiaccessiblecoordinatetype nsiaccessibledocument nsiaccessibleeditabletext nsiaccessibleevent nsiaccessiblehyperlink nsiac...
... nsiaccessibleselectable nsiaccessiblestates nsiaccessibletable nsiaccessibletext nsiaccessibletreecache nsiaccessiblevalue nsiaccessnode nsisyncmessagesender script nsiscriptableunescapehtml nsiscriptableunicodeconverter nsiscripterror nsiscripterror2 stylesheet nsistylesheetservice url nsiuri nsiurl util
nsidomserializer
nsidomxpathevaluator
nsidomxpathexception
nsidomxpathexpression
nsidomxpathresult xslt nsixsltexception nsixsltprocessor download
nsidownload
nsidownloadmanager
nsidownloadprogresslistener element internal nsiworker nsiworkerglobalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree ...
...And 4 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
</h1> this source code contains a couple of line feeds after the doctype and a bunch of space characters before, after, and i
nside the <h1> element, but the browser doesn’t seem to care at all and just shows the words "hello world!" as if these characters didn’t exist at all: this is so that whitespace characters don't impact the layout of your page.
... creating space around and i
nside elements is the job of css.
... i
nside this context, whitespace character processing can be summarized as follows: first, all spaces and tabs immediately before and after a line break are ignored so, if we take our example markup from before and apply this first rule, we get: <h1>◦◦◦hello⏎ <span>◦world!</span>⇥◦◦</h1> next, all tab characters are handled as space characters, so the example becomes: <...
...And 4 more matches
Pointer events - Web APIs
a pointer is co
nsidered active if it can still produce further events.
... for example, a pen that is a down state is co
nsidered active because it can produce additional events when the pen is lifted or moved.
...typically, this is determined by co
nsidering the pointer's location and also the visual layout of elements in a document on screen media.
...And 4 more matches
WebGL best practices - Web APIs
take advantage of universally supported webgl 1 extensions these webgl 1 extensions are universally supported: angle_instanced_arrays ext_blend_minmax oes_element_index_uint oes_standard_derivatives oes_vertex_array_object webgl_debug_renderer_info webgl_lose_context (see also: https://jdashg.github.io/misc/webgl/webgl-feature-levels.html) co
nsider polyfilling these into webglrenderingcontext, like: https://github.com/jdashg/misc/blob/master/webgl/webgl-v1.1.js universally supported limits the minimum requirements for webgl are quite low.
... co
nsider rendering to a smaller backbuffer size a common (and easy) way to trade off quality for speed is rendering into a smaller backbuffer, and upscaling the result.
... co
nsider reducing canvas.width and height and keeping canvas.style.width and height at a constant size.
...And 4 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
third party assistive technology, such as screen readers, screen magnifiers and voice input software, want to track what's happening i
nside mozilla.
...one dow
nside to this solution is that means that you cannot use "client data" for the list items, because windows won't allow owner drawn list items to use client data.
... solution: when an object is about to get focused in a different window, make sure you focus a window before you fire your own focus events for objects i
nside it.
...And 4 more matches
Block and inline layout in normal flow - CSS: Cascading Style Sheets
by default block elements will consume all of the space in the inline direction, so our paragraphs spread out and get as big as they can i
nside their containing block.
... in the following example, we have three inline boxes created by a paragraph with a <strong> element i
nside it.
... the line box size in the block direction (so the height when working in english) is defined by the tallest box i
nside it.
...And 4 more matches
display - CSS: Cascading Style Sheets
keyword values are grouped into six value categories: .container { display: [ <display-outside> || <display-i
nside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> ; } outside <display-outside> these keywords specify the element’s outer display type, which is essentially its role in flow layout.
... i
nside <display-i
nside> these keywords specify the element’s inner display type, which defines the type of formatting context that its contents are laid out in (assuming it is a non-replaced element).
... valid <display-i
nside> values: flow the element lays out its contents using flow layout (block-and-inline layout).
...And 4 more matches
Block formatting context - Developer guides
there's no floating children avaliable i
nside a flex/grid container, but exclude external floats and suppress margin collapsing still works.
... in the following example, we have a floated element i
nside a <div> with a border applied.
...our <div> now becomes a mini-layout i
nside our layout.
...And 4 more matches
Web audio codec guide - Web media technologies
however, if your target is primarily macos and ios users, it may be worth co
nsidering, as the operating systems have integrated support for alac.
... when mp3-format audio is stored i
nside an mpeg container, the resulting file is also referred to as just an "mp3 file" or simply "mp3." files with the ubiquitous .mp3 extension are stored in what is perhaps the most widely distributed audio file format in the world, which is in large part responsible for the digital audio revolution of the late 1990s and early 2000s.
... when choosing a codec to use for your audio, you should first co
nsider the following questions: will the encoded audio be getting remixed or recompressed?
...And 4 more matches
Web video codec guide - Web media technologies
this guide introduces the video codecs you're most likely to encounter or co
nsider using on the web, summaries of their capabilities and any compatibility and utility concerns, and advice to help you choose the right codec for your project's video.
... h.263 has been superseded by h.264 and is therefore co
nsidered a legacy media format which you generally should avoid using if you can.
...otherwise, you should probably co
nsider a different codec.
...And 4 more matches
Codecs used by WebRTC - Web media technologies
for details on webrtc-related co
nsiderations for each codec, see the sub-sections below by following the links on each codec's name.
... mandatory audio codecs codec name browser compatibility opus chrome, edge, firefox, safari g.711 pcm (a-law) chrome, firefox, safari g.711 pcm (µ-law) chrome, firefox, safari see below for more details about any webrtc-specific co
nsiderations that exist for each codec listed above.
... due to its low sample rate and sample size, g.711 audio quality is generally co
nsidered poor by modern standards, even though it's roughly equivalent to what a landline telephone sounds like.
...And 4 more matches
SVG documentation index - SVG: Scalable Vector Graphics
the attribute does not specify any processing restrictions; it can be co
nsidered metadata.
... 73 fill-rule svg, svg attribute the fill-rule attribute is a presentation attribute defining the algorithm to use to determine the i
nside part of a shape.
... 263 xml:space svg, svg attribute svg supports the built-in xml xml:space attribute to handle whitespace characters i
nside elements.
...And 4 more matches
Using custom elements - Web Components
it is possible to define specific lifecycle callbacks i
nside the class, which run at specific points in the element's lifecycle.
... i
nside the constructor, we define all the functionality the element will have when an instance of it is instantiated.
...this.getattribute('img') : 'img/default.png'; const info = wrapper.appendchild(document.createelement('span')); info.setattribute('class','info'); // take attribute content and put it i
nside the info span info.textcontent = this.getattribute('data-text'); // create some css to apply to the shadow dom const style = document.createelement('style'); style.textcontent = '.wrapper {' + // css truncated for brevity // attach the created elements to the shadow dom this.shadowroot.append(style,wrapper); finally, we register our custom element on the customelementregistry using the defi...
...And 4 more matches
Finding window handles - Archive of obsolete content
var basewindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.
nsidocshelltreeitem) .treeowner .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsibasewindow); then in c++ part, a function take nsibasewindow as param hwnd getparentwindowhwnd(nsibasewindow *window) { nativewindow hwnd; nsresult rv = window->getparentnativewindow(&hwnd); if ...
...s components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.
nsidocshelltreeitem) .treeowner .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsibasewindow); var hwndstring = basewindow.nativehandle; components.utils.import('resource://gre/modules/ctypes.jsm'); var user32 = ctypes.open('user32.dll'); /* http://msdn.microsoft.com/en-us/library/ms633539%28v=vs.
...c components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.
nsidocshelltreeitem) .treeowner .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsibasewindow); var nswindowstring = basewindow.nativehandle; components.utils.import('resource://gre/modules/ctypes.jsm'); var objc = ctypes.open(ctypes.libraryname('objc')); // types let id = ctypes.voidptr_t; let sel...
...And 3 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
please co
nsider all of your options carefully before deciding to use native code (c++) in your extension.
...on the other hand, if you are an experienced developer or team, and you know that you are going to build a large, complex extension, you would do well to co
nsider the approach described in this article.
... one final note: i've only tried these techniques i
nside firefox, but they'll probably work more or less unchanged on other gecko-based platforms like thunderbird or seamonkey.
...And 3 more matches
Updating addons broken by private browsing changes - Archive of obsolete content
if your code refers to any of the following interfaces: ff 15:
nsidomstoragemanager ff 16: nsitransferable ff 18: imgicache moziasyncfavicons nsifaviconservice nsiwebbrowserpersist ff 19: nsicontentprefservice
nsidownloadmanager
nsidownload nsihttpauthmanager nsistricttransportsecurityservice ff 20: nsiprivatebrowsingservice nsirecentbadcertservice furthermore, if your code uses any of these common chrome apis: ff 19: saveurl saveinternal openlinkin ff 20: openbrowserwindow gprivatebrowsingui finally, if y...
...
nsidownloadmanager/
nsidownload: integer download ids (and specifically the id property of
nsidownload) are deprecated, and don't allow access to private downloads.
...
nsidownload now has retry, cancel, remove, pause, and resume methods which should be used instead of deprecated similarly-named
nsidownloadmanager methods.
...And 3 more matches
Layout System Overview - Archive of obsolete content
the in-flow case is co
nsidered the 'normal' case, and corresponds to normal html formatting.
...co
nsider a text entry field: the user types text into a form on the web.
...thus the html editor and text controls put co
nsiderable performance requirements on the layout system's handling of dynamic content manipulation.
...And 3 more matches
Adding HTML Elements - Archive of obsolete content
you can also add labels to controls either by using the html label element, or you can simply put the text i
nside another html block element (such as p or div) as in the example below.
...notice that the xul button can appear i
nside the html elements, as it does here.
... plain text will only be displayed when placed i
nside an html element that would normally allow you to display text (such as a p tag).
...And 3 more matches
More Menu Features - Archive of obsolete content
« previousnext » in this section, we'll look at creating submenus and checked menus creating submenus you can create submenus i
nside other menus (nested menus) using the existing elements.
... remember that you can put any element i
nside a menupopup.
...however, you can create submenus by simply placing the menu element i
nside the menupopup element.
...And 3 more matches
The Box Model - Archive of obsolete content
elements i
nside of a box will orient themselves horizontally or vertically.
...login prompt example you can add as many elements as you want i
nside a box, including other boxes.
...the labels and textboxes are i
nside the inner hbox elements, so they are oriented according to those boxes, which are horizontal.
...And 3 more matches
Toolbars - Archive of obsolete content
a simple toolbar i
nside a toolbox source view <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="back"/> <toolbarbutton label="forward"/> </toolbar> </toolbox> this has created a toolbar containing two buttons, a back button and a forward button.
... the one toolbar has been placed i
nside the toolbox.
...i
nside it are placed the individual toolbar items, usually buttons, but they can be other elements.
...And 3 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
although this approach was co
nsidered reasonable at the time, this approach caused problems for browser vendors right from the beginning.
...co
nsider the following example: // wrong approach - do not use!
...netscape navigator 4 and internet explorer 4 should both be co
nsidered downlevel browsers for most pages due to their limited support for css and the more recent dom based standards.
...And 3 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
in particular: raw < and & characters are not allowed except i
nside of cdata sections (<![cdata[ ...
... use of comments i
nside inline style and script authors who are familiar with html commonly enclose the contents of inline style and script tags in comments in order to hide the contents of the tags from browsers which do not understand them.
... <style type="text/css"> <!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> this example illustrates that a conformant browser can ignore content i
nside of comments.
...And 3 more matches
WAI-ARIA basics - Learn web development
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 i
nside the alt attribute.
... there are many combinations of operating system, browser, and screenreader to co
nsider.
...if you are looking for a 3rd party javascript solution for rapid ui development, you should definitely co
nsider the accessibility of its ui widgets as an important factor when making your choice.
...And 3 more matches
What is accessibility? - Learn web development
overview: accessibility next this article starts the module off with a good look at what accessibility is — this overview includes what groups of people we need to co
nsider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow.
...the main types of disability to co
nsider are explained below, along with any special tools they use to access web content (known as assistive technologies, or ats).
... you have only started to co
nsider accessibility and uncovered related issues in the late stages of a project.
...And 3 more matches
Backgrounds and borders - Learn web development
in this case we could use the background-size property, which can take length or percentage values, to size the image to fit i
nside the background.
... contain — the browser will make the image the right size to fit i
nside the box.
... in the example below i have used the larger image from the example above and used length units to size it i
nside the box.
...And 3 more matches
The box model - Learn web development
boxes also have an inner display type, however, which dictates how elements i
nside that box are laid out.
... by default, the elements i
nside a box are laid out in normal flow, which means that they behave just like any other block and inline elements (as explained above).
...this establishes flex layout for the items i
nside the container, however, the list itself is a block box and — like the paragraph — expands to the full container width and breaks onto a new line.
...And 3 more matches
CSS values and units - Learn web development
absolute length units the following are all absolute length units — they are not relative to anything else and are generally co
nsidered to always be the same size.
...the <li> elements i
nside the <ul> with a class of ems take their sizing from their parent.
...(rem stands for "root em".) the <li> elements i
nside the <ul> with a class of rems take their sizing from the root element (<html>).
...And 3 more matches
Multiple-column layout - Learn web development
our starting point contains some very simple html; a wrapper with a class of container i
nside which is a heading and some paragraphs.
...in the live example below, i have used multicol to lay out a series of boxes, each of which have a heading and some text i
nside.
...for example, add the property break-i
nside with a value of avoid to the rules for .card.
...And 3 more matches
Positioning - Learn web development
previous overview: css layout next positioning allows you to take elements out of the normal document layout flow, and make them behave differently; for example sitting on top of one another, or always remaining in the same place i
nside the browser viewport.
...what if you want to slightly alter the position of some boxes i
nside a layout from their default layout flow position, to give a slightly quirky, distressed feel?
...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 i
nside the browser window no matter how much the page is scrolled?
...And 3 more matches
How CSS is structured - Learn web development
here are three examples: <!-- i
nside a subdirectory called styles i
nside the current directory --> <link rel="stylesheet" href="styles/style.css"> <!-- i
nside a subdirectory called general, which is in a subdirectory called styles, i
nside the current directory --> <link rel="stylesheet" href="styles/general/style.css"> <!-- go up one directory level, then i
nside a subdirectory called styles --> <link rel="stylesheet" href="../sty...
...to create an internal stylesheet, you place css i
nside a <style> element contained i
nside the html <head>.
...i
nside the folder, copy the text below to create two files: index.html: <!doctype html> <html lang="en"> <head> <meta charset="utf-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 t...
...And 3 more matches
Basic native form controls - Learn web development
they can have a placeholder; this is text that appears i
nside the text input box that should be used to briefly describe the purpose of the box.
... due to the on-off nature of checkboxes, the checkbox is co
nsidered a toggle button, with many developers and designers expanding on the default checkbox styling to create buttons that look like toggle switches you can see an example in action here (also see the source code).
...if they share the same value for their name attribute, they will be co
nsidered to be in the same group of buttons.
...And 3 more matches
Third-party APIs - Learn web development
you can expand the controls available using the map.addcontrol() method; add this to your code, i
nside the window.onload handler: map.addcontrol(l.mapquest.control()); the mapquest.control() method just creates a simple full-featured control set, and it is placed in the top-right hand corner by default.
...add the following code to your example, again i
nside window.onload: l.marker([53.480759, -2.242631], { icon: l.mapquest.icons.marker({ primarycolor: '#22407f', secondarycolor: '#3b5998', shadow: true, size: 'md', symbol: 'a' }) }) .bindpopup('this is manchester!') .addto(map); as you can see, this at its simplest takes two parameters, an array containing the coordinates at which to display the marker, and an options objec...
... add the following code block i
nside the fetchresults() function, just above the closing curly brace: // use fetch() to make the request to the api fetch(url).then(function(result) { return result.json(); }).then(function(json) { displayresults(json); }); here we run the request by passing our url variable to fetch(), convert the response body to json using the json() function, then pass the resulting json to the displayresul...
...And 3 more matches
Video and Audio APIs - Learn web development
here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> this creates a video player i
nside the browser like so: you can review what all the html features do in the article linked above; for our purposes here, the most interesting attribute is controls, which enables the default set of playback controls.
... each <button> has a class name, a data-icon attribute for defining what icon should be shown on each button (we'll show how this works in the below section), and an aria-label attribute to provide an understandable description of each button, since we're not providing a human-readable label i
nside the tags.
... exploring the css now open the css file and have a look i
nside.
...And 3 more matches
Componentizing our Svelte app - Learn web development
i
nside this file we will declare a filter prop, and then copy the relevant markup over to it from todos.svelte.
... the <script> section of our filterbutton component should end up looking like this — update it now: <script> export let filter = 'all' export let onclick = (clicked) => {} $: onclick(filter) </script> now when we call filterbutton i
nside todos.svelte we'll need to specify the handler.
... put the following contents i
nside this file: <script> export let todo </script> <div class="stack-small"> <div class="c-cb"> <input type="checkbox" id="todo-{todo.id}" on:click={() => todo.completed = !todo.completed} checked={todo.completed} /> <label for="todo-{todo.id}" class="todo-label">{todo.name}</label> </div> <div class="btn-group"> <button type="button" class="btn"> edit <s...
...And 3 more matches
Dynamic behavior in Svelte: working with variables and props - Learn web development
{/each} </ul> go back to the app; you'll see something like this: now we've seen that this is working, let's generate a complete todo item with each loop of the {#each} directive, and i
nside embed the information from the todos array: id, name, and completed.
... update the <input type="checkbox"> element i
nside src/components/todos.svelte as follows: <input type="checkbox" id="todo-{todo.id}" on:click={() => todo.completed = !todo.completed} checked={todo.completed} /> next we'll add a function to remove a todo from our todos array.
... update your totaltodos and completedtodos variable definitions i
nside src/components/todos.svelte to look like so: $: totaltodos = todos.length $: completedtodos = todos.filter(todo => todo.completed).length if you check your app now, you'll see that the heading's numbers are updated when todos are completed or deleted.
...And 3 more matches
Getting started with Vue - Learn web development
this will check for errors when we save a file i
nside the project.
...in fact, if you look i
nside the src folder in the project we created with the cli, you'll see your first .vue file: app.vue.
...locally registered components can only be used i
nside the components that register them, so you need to import and register them in every component file that uses them.
...And 3 more matches
Rendering a list of Vue components - Learn web development
in this artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display i
nside todoitem components using the v-for directive.
...this is a built-in vue directive that lets us include a loop i
nside of our template, repeating the rendering of a template feature for each item in an array.
...in this case, we want to display an <li> element for every to-do item i
nside our todoitems array.
...And 3 more matches
Eclipse CDT Manual Setup
this page contains the content that used to live on the eclipse cdt page that most people will likely just co
nsider noise.
...if you're interested in future improvements to eclipse that would allow parallel builds to be run from i
nside eclipse while still allowing it to obtain the compiler options, see the faq isn't there a better method of build option discovery?
...(this directory doesn't show in the project explorer tab, but eclipse still indexes it without this filter!) if you have secondary object directories (object directories that are not your only/the primary object directory) for the source tree and those directories are i
nside the source tree (or if you might have such object directories in future), then add an "exclude all", regular expression filter for folders with a project relative path matching "obj(?!-debug(?:$|/)).+".
...And 3 more matches
Inner and outer windows
co
nsider that when the user is looking at a document in a browser window, not only can the document the user is currently viewing change, but the document's contents can change.
...in order to represent these levels of complexity, two "types" of window need to be co
nsidered.
...co
nsider this view of a window and the browser history: as the user navigates, documents are added to the backward-forward cache (often referred to as the bfcache).
...And 3 more matches
Fonts for Mozilla's MathML engine
open the zip archive, move i
nside the latinmodern-math-1959 directory and then i
nside the otf directory.
... open the zip archive, move i
nside the /stixv2.0.0/fonts/otf/ directory.
... extract the zip archive, move i
nside the latinmodern-math-1959 directory and then i
nside the otf directory.
...And 3 more matches
Index
a trust anchor is just another x.509 certificate that is already known and has been deliberately marked as trusted by a software vendor, administrators i
nside an organizational infrastructure, or the software user.
...for example: certificates were valid at the time the signature was made, name in certificates matches the expected signer (check subject name, common name, email, based on application), the trust restrictions recorded i
nside the certificate (extensions) permit the use (e.g., encryption might be allowed, but not signing), and based on environment/application policy it might be required to perform a revocation check (ocsp or crl), that asks the issuer(s) of the certificates whether there have been events that made it necessary to revoke the trust (revoke the validity of the cert).
...a complex string must not include newlines or carriage returns.outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is co
nsidered equal and is used only to delimit tokens.
...And 3 more matches
Places utilities for JavaScript
string atype); nsitransaction maketransaction(string data, string type, nsinavhistoryresultnode container, int index, boolean copy); nsinavhistoryresult getfoldercontents(int afolderid, boolean aexcludeitems, boolean aexpandqueries); boolean showaddbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadi
nsidebar, string akeyword, string apostdata); boolean showminimaladdbookmarkui(nsiuri auri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker, boolean aloadi
nsidebar, string akeyword, string apostdata); boolean showaddlivemarkui(nsiuri afeeduri, nsiuri asiteuri, string atitle, string adescription, int adefaultinsertionpoint, boolean ashowpicker); ...
...ean showfolderproperties(int aid); boolean showaddfolderui(string atitle, int adefaultinsertionpoint, boolean ashowpicker); array object getannotationsforuri(nsiuri auri); array object getannotationsforitem(int aitemid); void setannotationsforuri(nsiuri auri, object aannos); void setannotationsforuri(int aitemid, object aannos); getviewfornode(
nsidomnode anode); void markpageastyped(string aurl); void markpageasfollowedbookmark(string aurl); boolean checkurlsecurity(nsinavhistoryresultnode aurinode); string getquerystringforfolder(int afolderid); string getdescriptionfromdocument(
nsidomdocument doc); string setpostdataforbookmark(int aboomarkid, string apostdata); string getpost...
...landpostdataforkeyword(string akeyword); string getitemdescription(int aitemid); nsinavhistoryresultnode getmostrecentbookmarkforuri(nsiuri auri); nsinavhistoryresultnode getmostrecentfolderforfeeduri(nsiuri auri); nsinavhistoryresultnode geturlsforcontainernode(nsinavhistoryresultnode anode); void opencontainernodeintabs(nsinavhistoryresultnode anode,
nsidomevent aevent); void openurinodesintabs(array nsinavhistoryresultnode anodes,
nsidomevent aevent); void createmenuitemfornode(nsinavhistoryresultnode anode, acontainersmap); constants mimetypes type_x_moz_place_container type_x_moz_place_separator: "text/x-moz-place-separator", type_x_moz_place: "text/x-moz-place", type_x_moz_url: "text/x-moz-url", type_html: "tex...
...And 3 more matches
An Overview of XPCOM
co
nsider, for example, a class that isn't well encapsulated.
...when a component gets created, an integer i
nside the component tracks the number of clients who have an interface to the components -- also known as the reference count.
... xpcom identifier classes the nsiid class is actually a typedef for the
nsid class.
...And 3 more matches
Detailed XPCOM hashtable guide
key type: integer string/cstring
nsid nsisupports* complex data type: none (hash set) nsthashtable<...> simple (pruint32) nsdatahashtable nsthashtable<...> <nsuint32hashkey, pruint32> <ns(c)stringhashkey, pruint32> <
nsidhashkey, pruint32> <nsisupportshashkey, pruint32> interface (nsisupports) nsinterfacehashtable <nsuint32hashkey, nsisuppor...
...ts> <ns(c)stringhashkey, nsisupports> <
nsidhashkey, nsisupports> <nsisupportshashkey, nsisupports> class (nsstring*) nsclasshashtable <nsuint32hashkey, nsstring> <ns(c)stringhashkey, nsstring> <
nsidhashkey, nsstring> <nsisupportshashkey, nsstring> complex (structures, etc.) nsthashtable<...> pldhash the pldhash implementation is a fairly low-level implementation, written in c.
...if you need entry pointers to remain constant, you may want to co
nsider using plhashtable instead.
...And 3 more matches
nsIBoxObject
propertyname); obsolete since gecko 1.9 wstring getproperty(in wstring propertyname); nsisupports getpropertyassupports(in wstring propertyname); void removeproperty(in wstring propertyname); void setproperty(in wstring propertyname, in wstring propertyvalue); void setpropertyassupports(in wstring propertyname, in nsisupports value); attributes attribute type description element
nsidomelement read only.
... firstchild
nsidomelement the first child of the box, in box-ordinal-group order.
... lastchild
nsidomelement the last child of the box, in box-ordinal-group order.
...And 3 more matches
nsIIOService
ring extractscheme(in autf8string urlstring); unsigned long getprotocolflags(in string ascheme); nsiprotocolhandler getprotocolhandler(in string ascheme); nsichannel newchannel(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); obsolete since gecko 48 nsichannel newchannel2(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri, in
nsidomnode aloadingnode, in nsiprincipal aloadingprincipal, in nsiprincipal atriggeringprincipal, in uint32_t asecurityflags, in uint32_t acontentpolicytype); nsichannel newchannelfromuri(in nsiuri auri); obsolete since gecko 48 nsichannel newchannelfromuri2(in nsiuri auri, in
nsidomnode aloadingnode, in nsiprincipal aloadingprincipal, in nsiprincipal atriggeringprincipal, in unsign...
...ed long asecurityflags, in unsigned long acontentpolicytype); nsichannel newchannelfromuriwithloadinfo(in nsiuri auri, in nsiloadinfo aloadinfo); nsichannel newchannelfromuriwithproxyflags2(in nsiuri auri, in nsiuri aproxyuri, in uint32_t aproxyflags,in
nsidomnode aloadingnode, in nsiprincipal aloadingprincipal, in nsiprincipal atriggeringprincipal, in uint32_t asecurityflags, in uint32_t acontentpolicytype); nsiuri newfileuri(in nsifile afile); nsiuri newuri(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); attributes attribute type description offline boolean returns true if networking is in "offline" mode.
...if the given port is co
nsidered unsafe, then the protocol handler (corresponding to ascheme) will be asked whether it wishes to override the io service's decision to block the port.
...And 3 more matches
nsINavBookmarkObserver
index the folder's index i
nside its parent.
... oldindex the folder's old index i
nside oldparent.
... newindex the folder's index i
nside newparent.
...And 3 more matches
nsIScriptableUnescapeHTML
implemented by: @mozilla.org/feed-unescapehtml;1 as a service: var scriptableunescapehtml = components.classes["@mozilla.org/feed-unescapehtml;1"] .getservice(components.interfaces.nsiscriptableunescapehtml); method overview
nsidomdocumentfragment parsefragment(in astring fragment, in prbool isxml, in nsiuri baseuri, in
nsidomelement element); astring unescape(in astring src); methods parsefragment() parses a string of html or xml source into a sanitized documentfragment.
...
nsidomdocumentfragment parsefragment( in astring fragment, in prbool isxml, in nsiuri baseuri, in
nsidomelement element ); parameters fragment a string of html or xml source to parse as a fragment.
... element the
nsidomelement to be used as the context node for the purposes of the fragment parsing algorithm.
...And 3 more matches
WebIDL bindings
the return value is guaranteed to not be affected by any code running i
nside gecko itself, but we might get a new value every time the method or getter is called even if no gecko code ran between the calls.
... [securecontext] we implement the standard extended attribute with a few details specific to gecko: system principals are co
nsidered secure.
...if the xpcom component implements
nsidomglobalpropertyinitializer, then the object's init method will be invoked with a single argument: the content window the constructor came from.
...And 3 more matches
Applying styles and colors - Web APIs
if you co
nsider a path from (3,1) to (3,5) with a line thickness of 1.0, you end up with the situation in the second image.
...for lines which are at large angles with each other, this point is not far from the i
nside connection point.
... the miterlimit property determines how far the outside connection point can be placed from the i
nside connection point.
...And 3 more matches
ServiceWorkerState - Web APIs
values installing the service worker in this state is co
nsidered an installing worker.
... during this state, extendableevent.waituntil() can be called i
nside the install event handler to extend the life of the installing worker until the passed promise resolves successfully.
... installed the service worker in this state is co
nsidered a waiting worker.
...And 3 more matches
Using writable streams - Web APIs
i
nside this method, you should include code that sets up the stream functionality, e.g.
...i
nside this block we use writablestreamdefaultwriter.ready to check whether the writer is ready to have another chunk written to it.
... ready returns a promise that fulfills when this is the case, i
nside of which we call writablestreamdefaultwriter.write() to actually write the chunk to the stream.
...And 3 more matches
ARIA: dialog role - Accessibility
the label given to the dialog will provide contextual information for the interactive controls i
nside the dialog.
... in other words, the dialog's label acts like a grouping label for the controls i
nside it (similar to how a <legend> element provides a grouping label for the controls i
nside a <fieldset> element).
... if a dialog already has a visible title bar, the text i
nside that bar can be used to label the dialog itself.
...And 3 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
if you initially learned flexbox then you may co
nsider these properties to be part of the flexbox specification, and some of the properties are indeed listed in level 1 of flexbox.
...on the block (cross) axis the alignment of the items i
nside their grid areas is controlled with align-items.
... relationship to writing modes alignment is linked to writing modes in that when we align an item we do not co
nsider whether we are aligning it to the physical dimensions of top, right, bottom and left.
...And 3 more matches
Specificity - CSS: Cascading Style Sheets
(the selectors declared i
nside :not() do, however.) for more information, visit: "specificity" in "cascade and inheritance", you can also visit: https://specifishity.com inline styles added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity.
... some rules of thumb: always look for a way to use specificity before even co
nsidering !important only use !important on page-specific css that overrides foreign css (from external libraries, like bootstrap or normalize.css).
... instead of using !important, co
nsider: make better use of the css cascade use more specific rules.
...And 3 more matches
Syntax - CSS: Cascading Style Sheets
the css syntax reflects this goal and its basic building blocks are: the property which is an identifier, that is a human-readable name, that defines which feature is co
nsidered.
...the pair is separated by a colon, ':' (u+003a colon), and white spaces before, between, and after properties and values, but not necessarily i
nside, are ignored.
... such blocks are naturally called declaration blocks and declarations i
nside them are separated by a semi-colon, ';' (u+003b semicolon).
...And 3 more matches
<input type="email"> - HTML: Hypertext Markup Language
ements regardless of their type, email inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be co
nsidered valid multiple whether or not to allow multiple, comma-separated, e-mail addresses to be entered pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should...
... note: normally, if you specify the required attribute, the user must enter a valid e-mail address for the field to be co
nsidered valid.
...in its most basic form, an email input can be implemented like this: <input id="emailaddress" type="email"> notice that it's co
nsidered valid when empty and when a single validly-formatted e-mail address is entered, but is otherwise not co
nsidered valid.
...And 3 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
<input> types how an <input> works varies co
nsiderably depending on the value of its type attribute, hence the different types are covered in their own separate reference pages.
... use careful co
nsideration for accessibility when applying the autofocus attribute.
... what's in a name co
nsider the name a required attribute (even though it's not).
...And 3 more matches
Grammar and types - JavaScript
(for more information, see the detailed reference about javascript's lexical grammar.) it is co
nsidered best practice, however, to always write a semicolon after a statement, even when it is not strictly needed.
...(spaces, tabs, and newline characters are co
nsidered whitespace.) comments the syntax of comments is the same as in c++ and in many other languages: // a one line comment /* this is a longer, * multi-line comment */ /* you can't, however, /* nest comments */ syntaxerror */ comments behave like whitespace, and are discarded during script execution.
...for example, co
nsider the following statements: x = 'the answer is ' + 42 // "the answer is 42" y = 42 + ' is the answer' // "42 is the answer" with all other operators, javascript does not convert numeric values to strings.
...And 3 more matches
this - JavaScript
function context i
nside a function, the value of this depends on how the function is called.
...the same applies to arrow functions created i
nside other functions: their this remains that of the enclosing lexical context.
...ll bar as a method of obj, setting its this to obj // assign a reference to the returned function to fn var fn = obj.bar(); // call fn without setting this, would normally default // to the global object or undefined in strict mode console.log(fn() === obj); // true // but caution if you reference the method of obj without calling it var fn2 = obj.bar; // calling the arrow function's this from i
nside the bar method() // will now return window, because it follows the this from fn2.
...And 3 more matches
let - JavaScript
break; } however, it's important to point out that a block nested i
nside a case clause will create a new block scoped lexical environment, which will not produce the redeclaration errors shown above.
... value of undefined, using the typeof operator to check for the type of a variable in that variable's temporal dead zone will throw a referenceerror: // prints out 'undefined' console.log(typeof undeclaredvariable); // results in a 'referenceerror' console.log(typeof i); let i = 10; another example of temporal dead zone combined with lexical scoping due to lexical scoping, the identifier foo i
nside the expression (foo + 55) evaluates to the if block's foo, and not the overlying variable foo with the value of 33.
...the instruction let n of n.a is already i
nside the private scope of the for loop's block.
...And 3 more matches
Strict mode - JavaScript
co
nsider concatenating a strict mode script with a non-strict mode script: the entire concatenation looks strict!
...obviously, concatenation of scripts is never ideal, but if you must, co
nsider enabling strict on a function-by-function basis.
...the problem with with is that any name i
nside the block might map either to a property of the object passed to it, or to a variable in surrounding (or even global) scope, at runtime: it's impossible to know which beforehand.
...And 3 more matches
Graphic design for responsive sites - Progressive web apps (PWAs)
css media queries allow us to serve different css rules dependant on viewport dimensions, and you should co
nsider using mobile first media queries where possible.
...most hi res devices apply a default zoom factor to the whole web page so that the content is a bit more legible, but the dow
nside of this is that the images in question start to look pixellated and ugly because they have been zoomed in.
...you could use css3 properties for generating effects like drop shadows, gradients and rounded corners, and you could also co
nsider using svg for other ui elements, instead of raster graphics formats.
...And 3 more matches
Web Components
using templates and slots a guide showing how to define a reusable html structure using <template> and <slot> elements, and then use that structure i
nside your web components.
... life cycle callbacks special callback functions defined i
nside the custom element's class definition, which affect its behavior: connectedcallback: invoked when the custom element is first connected to the document's dom.
... :host: selects the shadow host of the shadow dom containing the css it is used i
nside.
...And 3 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
there are earlier experiments going back a long way in developing user interfaces using a combination of html and scripting languages, and xul could be co
nsidered an evolutionary step from that.
... note: these values are stored in localstore.rdf, i
nside the user profile.
... earlier we placed the menupopup child element i
nside a menu element; here, we use it outside the menu element.
...And 2 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
if you put the toolbarpalette element i
nside the window element in your overlay, some weird errors will begin to happen.
... setting the image for a toolbar button is done with css: #xulschoolhello-hello-world-button { list-style-image: url("chrome://xulschoolhello/skin/hello-world.png"); } it's not really that simple to set the image for a toolbar button, because we need to co
nsider the appearance of the button on different systems, and also co
nsider the different button states, but we'll get into that further ahead.
...the way icons are handled in firefox changed co
nsiderably after firefox 4, so supporting older versions is not mentioned here (you can check this document's change history for older revisions, though).
...And 2 more matches
Download Manager improvements in Firefox 3 - Archive of obsolete content
in addition, you can augment or replace the download manager's user interface by implementing the new
nsidownloadmanagerui interface.
... download manager interfaces
nsidownloadmanager gives applications and extensions access to the download manager, allowing them to add and remove files to the download list, retrieve information about past and present downloads, and request notifications as to the progress of downloads.
...
nsidownload describes a file in the download queue; these files may currently be queued for download, actively being downloaded, or finished being downloaded.
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
the main issue here is when javascript, embedded i
nside an html document (thus, i
nside an <script> tag), generates html that contains a <script> tag.
... if the document is in strict rendering mode, it will parse the </script> i
nside the string as the closing tag for the enclosing <script>.
... mimetypes (when css files are not applied) the most common css-related issue is that css definitions i
nside referenced css files are not applied.
...And 2 more matches
Anonymous Content - Archive of obsolete content
[actually, only tag names may be specified; see the includes attribute description in <children> element reference, bug 174614 and bug 51527.] if no attribute is specified, an insertion point is co
nsidered generic and will match on all content.
... as an example, co
nsider the html file upload control.
...it then generates a focus event on the textfield i
nside the file control.
...And 2 more matches
Manipulating Lists - Archive of obsolete content
in fact, these methods are part of the
nsidomxulselectcontrolelement interface so any xul elements which implement this interface have these methods.
... list selection the
nsidomxulselectcontrolelement interface provides two additonal properties, selectedindex and selecteditem.
...getelementbyid('level').selectedindex = val - 1; } </script> <hbox align="center"> <label value="enter a number from 1 to 3:"/> <textbox id="number"/> <button label="select" oncommand="doselect();"/> </hbox> <radiogroup id="level"> <radio label="excellent"/> <radio label="good"/> <radio label="poor"/> </radiogroup> listboxes also support multiple selection and the functions of the
nsidomxulmultiselectcontrolelement interface.
...And 2 more matches
More Button Features - Archive of obsolete content
buttons with extra content buttons may have arbitrary markup contained i
nside them, and it will be rendered i
nside the button.
...for example, the following will create a button where two of the words are red: example 4 : source view <button> <description value="this is a"/> <description value="rather strange" style="color: red;"/> <description value="button"/> </button> any xul element may be placed i
nside the button.
... html elements will be ignored, so you need to wrap them i
nside a description element.
...And 2 more matches
XBL Example - Archive of obsolete content
the content of the pages will be specified in the xul file, not in xbl, but we'll need to add it i
nside the deck.
...the children of the element that the xbl is bound to will be placed i
nside the deck.
...the body of the method has been enclosed i
nside <![cdata[ and ]]>.
...And 2 more matches
Using the Editor from XUL - Archive of obsolete content
nseditorshell is able to observe the document load on the <iframe>, because it implements
nsidocumentloaderobserver, and registered itself as a doc loader when it was assigned the content window.
...for text widgets and composer): nstexteditorkeylistener (as a
nsidomkeylistener) nstexteditormouselistener (as a
nsidommouselistener) nstexteditorfocuslistener (as a
nsidomfocuslistener) nstexteditortextlistener (as a
nsidomtextlistener) nstexteditorcompositionlistener (as a
nsidomcompositionlistener) nstexteditordraglistener (as a
nsidomdraglistener) in nseditorshell::preparedocumentforediting(), we install a mouse listener.
...not for text widgets): nseditorshellmouselistener (as a
nsidommouselistener) note: starting in gecko 12, the editor refuses any events sent by unprivileged content.
...And 2 more matches
Accessibility/XUL Accessibility Reference - Archive of obsolete content
therefore, with jaws 7.10, to use xul i
nside of a browser, the type attribute cannot not be used.
... 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 i
nside of the iframe.
... okay to use html i
nside of iframe.
...And 2 more matches
button - Archive of obsolete content
you can specify the label of the button using the label attribute or by placing content i
nside the button.
...constants for the possible values for this attribute are in the
nsidomxulbuttonelement interface.
...place a menupopup element i
nside the button in this case.
...And 2 more matches
iframe - Archive of obsolete content
the type of browser, which can be used to set access of the document loaded i
nside the browser.
...the content that is loaded i
nside the browser is not allowed to access the chrome above it.
...the content that is loaded i
nside the browser is not allowed to access the chrome above it.
...And 2 more matches
promptBox - Archive of obsolete content
method overview
nsidomelement appendprompt(args, onclosecallback); void removeprompt(
nsidomelement aprompt); nodelist listprompts(
nsidomelement aprompt); methods appendprompt() creates a new prompt, adding it to the tab.
...
nsidomelement appendprompt( args, onclosecallback ); parameters args arguments for the prompt.
... return value an
nsidomelement object representing the new prompt.
...And 2 more matches
Table Reflow Internals - Archive of obsolete content
incremental - has a reflow path (tree) where each node has a command with a target frame, reflow command types are: dirty - something changed i
nside a target (e.g.
...the table figures out the column widths (balances) given the style width constraints on the table, col groups, cols, cells the preferred and max element sizes of the cells (from the pass 1 reflow), and co
nsiders colspans pass 2 - cell widths are constrained by the column widths (heights are only constrained in paginated mode).
...when a target is the cell or below and the cell changes size, the row tells the table so it can decide if it needs to rebalance when a target is i
nside the cell's block, the cell requests max element, preferred sizes of its block in case they change after the table reflows the row group(s) containing the targets, if it rebalances, it then does a pass 2 reflow.
...And 2 more matches
XForms Custom Controls - Archive of obsolete content
for example, you might want to render images that are held i
nside an instance document or you would like to show a disabled trigger when its bound node becomes irrelevant rather than having it not display (the current default behavior).
...you can put the xforms controls i
nside your xbl binding.
...interface nsixformsuiwidget :
nsidomelement { /** * is called when control should be updated to reflect the value of the bound node.
...And 2 more matches
Implementation Status - Archive of obsolete content
7.4 expression categories supported 7.4.2 model binding expressions and computed expressions supported 7.4.3 expressions in actions and submissions partial 7.4.4 ui expressions partial scenarios exist where controls contained i
nside other controls i
nside a repeat won't be bound correctly 333638; 7.4.5 ui binding in other xml vocabularies unsupported not a compliance requirement for an xforms processor 7.4.6 binding examples supported 7.5 xforms core function library supported ...
... supported 8.1.6 upload supported 8.1.7 range partial 316355; 343523; 8.1.8 trigger supported 8.1.9 submit supported 8.1.10 select partial @selection does not work, select i
nside repeat may not work correctly, select that mixes itemsets with items may show them in the wrong order 282840; 371595; 372127; 8.1.11 select1 partial there are some resize issues, select/deselect/valuechange firing in wrong order.
... 8.2.1 choices supported 8.2.2 item supported 8.2.3 value supported 8.3.1 filename supported 8.3.2 mediatype supported 8.3.3 label partial labels for items i
nside a choices element has bind problems.
...And 2 more matches
Anatomy of a video game - Game development
that is not by accident and it is co
nsidered best practice.
...it is known as a domhighrestimestamp but, for all intents and purposes, co
nsider it a floating point number.
...you will also need to co
nsider how gracefully your game will fail if the user's system cannot keep up with the workload.
...And 2 more matches
Building up a basic demo with Three.js - Game development
save a copy of the latest minimized three.js library i
nside your directory.
...the first <script> element includes the three.js library in the page, and we will write our example code i
nside the second.
...when creating new objects in the demo, we add them all i
nside the scene to become visible on the screen.
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
good for seo — search engines give more importance to keywords i
nside headings, links, etc.
... another co
nsideration when creating layouts is using html5 semantic elements as seen in the above example (see content sectioning) — you can create a layout using only nested <div> elements, but it is better to use appropriate sectioning elements to wrap your main navigation (<nav>), footer (<footer>), repeating content units (<article>), etc.
... note: this is why you should never include text content i
nside an image — screen readers simply can't access it.
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
good for seo — search engines give more importance to keywords i
nside headings, links, etc.
... another co
nsideration when creating layouts is using html5 semantic elements as seen in the above example (see content sectioning) — you can create a layout using only nested <div> elements, but it is better to use appropriate sectioning elements to wrap your main navigation (<nav>), footer (<footer>), repeating content units (<article>), etc.
... note: this is why you should never include text content i
nside an image — screen readers simply can't access it.
...And 2 more matches
Mobile accessibility - Learn web development
previous overview: accessibility next with web access on mobile devices being so popular and renowned platforms such as ios and android having full-fledged accessibility tools, it is important to co
nsider the accessibility of your web content on these platforms.
... this article looks at mobile-specific accessibility co
nsiderations.
... there are some exceptions that need special co
nsideration for mobile; the main ones are: control mechanisms — make sure interface controls such as buttons are accessible on mobiles (i.e., mainly touchscreen), as well as desktops/laptops (mainly mouse/keyboard).
...And 2 more matches
Flexbox - Learn web development
the following simple layout requirements are either difficult or impossible to achieve with such tools, in any kind of convenient, flexible way: vertically centering a block of content i
nside its parent.
... you'll see that we have a <header> element with a top level heading i
nside it, and a <section> element containing three <article>s.
... the items being laid out as flexible boxes i
nside the flex container are called flex items (the <article> elements in our example).
...And 2 more matches
Legacy layout methods - Learn web development
4, 6, or 12), and then fit your content columns i
nside these imaginary columns.
...replace whatever is i
nside the body currently with the following: <h1>2 column layout example</h1> <div> <h2>first column</h2> <p> lorem ipsum dolor sit amet, consectetur adipiscing elit.
... easier calculations using the calc() function you could use the calc() function to do the math right i
nside your css — this allows you to insert simple mathematical equations into your css values, to calculate what a value should be.
...And 2 more matches
Styling web forms - Learn web development
to position it somewhere else, for example i
nside the fieldset somewhere, or near the bottom left corner, you need to rely on positioning.
...et { position: relative; } legend { position: absolute; bottom: 0; right: 0; } the <fieldset> needs to be positioned too, so that the <legend> is positioned relative to it (otherwise the <legend> would be positioned relative to the <body>.) the <legend> element is very important for accessibility — it will be spoken by assistive technologies as part of the label of each form element i
nside the fieldset — but using a technique like the one above is fine.
... i
nside the unzipped contents you will find some font files (at the time of writing, two .woff files and two .woff2 files; they might vary in the future.) copy these files into a directory called fonts, in the same directory as before.
...And 2 more matches
UI pseudo-classes - Learn web development
in-range and out-of-range data as we hinted at above, there are two other related pseudo-classes to co
nsider — :in-range and :out-of-range.
... these match numeric inputs where range limits are specified by the min and max, when their data is i
nside or outside the specified range, respectvely.
...but there are a couple of other states to co
nsider too: :default: matches radios/checkboxes that are checked by default, on page load (i.e.
...And 2 more matches
HTML basics - Learn web development
nesting elements you can put elements i
nside other elements too — this is called nesting.
...the following is incorrect: <p>my cat is <strong>very grumpy.</p></strong> the elements have to open and close correctly so that they are clearly i
nside or outside one another.
...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 co
nsidered good html, which could mean automatic error checking and other useful things.
...And 2 more matches
The web and web standards - Learn web development
this can be co
nsidered a forerunner of the web, as it worked on packet switching, and featured the first implementation of the tcp/ip protocol suite.
... browsers you are probably reading these words i
nside a web browser in this very moment (unless you've printed it out, or are using assistive technology, such as a screenreader to read it out to you).
...the following simple javascript will store a reference to our paragraph in memory and change the text i
nside it: let pelem = document.queryselector('p'); pelem.textcontent = 'we changed the text!'; in the house analogy, javascript is like the cooker, tv, microwave, or hairdryer — the things that give your house useful functionality tooling once you've learned the "raw" technologies that can be used to build web pages (such as html, css, and javascript), you'll soon start to come across vari...
...And 2 more matches
Add a hitmap on top of an image - Learn web development
here we go over how to set up an image map, and some dow
nsides to co
nsider first.
... image maps, and their drawbacks when you nest an image i
nside <a>, the entire image links to one webpage.
... formerly, image maps were a popular navigation device, but it’s important to thoroughly co
nsider their performance and accessibility ramifications.
...And 2 more matches
Advanced text formatting - Learn web development
blockquotes if a section of block level content (be it a paragraph, multiple paragraphs, a list, etc.) is quoted from somewhere else, you should wrap it i
nside a <blockquote> element to signify this, and include a url pointing to the source of the quote i
nside a cite attribute.
...there is no reason however why you couldn't link the text i
nside <cite> to the quote source in some way: <p>according to the <a href="/docs/web/html/element/blockquote"> <cite>mdn blockquote page</cite></a>: </p> <blockquote cite="/docs/web/html/element/blockquote"> <p>the <strong>html <code><blockquote></code> element</strong> (or <em>html block quotation element</em>) indicates that the enclosed text is an extended quotation.</p> </blockquote> ...
...t solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; abbreviations another fairly common element you'll meet when looking around the web is <abbr> — this is used to wrap around an abbreviation or acronym, and provide a full expansion of the term (included i
nside a title attribute.) let's look at a couple of examples: <p>we use <abbr title="hypertext markup language">html</abbr> to structure our web documents.</p> <p>i think <abbr title="reverend">rev.</abbr> green did it in the kitchen with the chainsaw.</p> these will come out looking something like this (the expansion will appear in a tooltip when the term is hovered over): note: there is ano...
...And 2 more matches
Document and website structure - Learn web development
many web designers co
nsider the navigation bar to be part of the header rather than an individual component, but that's not a requirement; in fact, some also argue that having the two separate is better for accessibility, as screen readers can read the two features better if they are separate.
... sidebar: <aside>; often placed i
nside <main>.
...all rights reversed.</p> </footer> </body> </html> take some time to look over the code and understand it — the comments i
nside the code should also help you to understand it.
...And 2 more matches
HTML table advanced features and accessibility - Learn web development
adding a caption to your table with <caption> you can give your table a caption by putting it i
nside a <caption> element and nesting that i
nside the <table> element.
... put the obvious headers row i
nside a <thead> element, the "sum" row i
nside a <tfoot> element, and the rest of the content i
nside a <tbody> element.
...i
nside the head of your html document, you'll see an empty <style> element.
...And 2 more matches
HTML table basics - Learn web development
add these i
nside the body of your html.
... the smallest container i
nside a table is a table cell, which is created by a <td> element ('td' stands for 'table data').
... add the following i
nside your table tags: <td>hi, i'm your first cell.</td> if we want a row of four cells, we need to copy these tags three times.
...And 2 more matches
Introduction to web APIs - Learn web development
the most obvious ones are: audiocontext, which represents an audio graph that can be used to manipulate audio playing i
nside the browser, and has a number of methods and properties available to manipulate that audio.
... mediaelementaudiosourcenode, which represents an <audio> element containing sound you want to play and manipulate i
nside the audio context.
... we start by creating an audiocontext instance i
nside which to manipulate our track: const audiocontext = window.audiocontext || window.webkitaudiocontext; const audioctx = new audiocontext(); next, we create constants that store references to our <audio>, <button>, and <input> elements, and use the audiocontext.createmediaelementsource() method to create a mediaelementaudiosourcenode representing the source of our audio — the <audio> element w...
...And 2 more matches
Arrays - Learn web development
array objects can be stored in variables and dealt with in much the same way as any other type of value, the difference being that we can access each value i
nside 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.
... note that an array i
nside an array is called a multidimensional array.
... you can access an item i
nside an array that is itself i
nside another array by chaining two sets of square brackets together.
...And 2 more matches
Handling text — strings in JavaScript - Learn web development
for example, both of these are okay: let sgldbl = 'would you eat a "fish supper"?'; let dblsgl = "i'm feeling blue."; sgldbl; dblsgl; however, you can't include the same quote mark i
nside the string if it's being used to contain them.
...e's an example from earlier in the course: <button>press me</button> const button = document.queryselector('button'); button.onclick = function() { let name = prompt('what is your name?'); alert('hello ' + name + ', nice to see you!'); } here we're using a window.prompt() function in line 4, which asks the user to answer a question via a popup dialog box then stores the text they enter i
nside a given variable — in this case name.
...so, taking a simple example: let song = 'fight the youth'; would be turned into a template literal like so: song = `fight the youth`; if we want to concatenate strings, or include expression results i
nside them, traditional strings can be fiddly to write: let score = 9; let highestscore = 10; let output = 'i like the song "' + song + '".
...And 2 more matches
JavaScript object basics - Learn web development
object basics an object is a collection of related data and/or functionality (which usually consists of several variables and functions — which are called properties and methods when they are i
nside objects.) let's work through an example to understand what they look like.
...i\'m ' + this.name[0] + '.'); } }; after saving and refreshing, try entering some of the following into the javascript console on your browser devtools: person.name person.name[0] person.age person.interests[1] person.bio() person.greeting() you have now got some data and functionality i
nside your object, and are now able to access them with some nice simple syntax!
...the object name (person) acts as the namespace — it must be entered first to access anything encapsulated i
nside the object.
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
the basic idea of oop is that we use objects to model real world things that we want to represent i
nside our programs, and/or provide a simple way to access functionality that would otherwise be hard or impossible to make use of.
...object data (and often, functions too) can be stored neatly (the official word is encapsulated) i
nside an object package (which can be given a specific name to refer to, which is sometimes called a namespace), making it easy to structure and access; objects are also commonly used as data stores that can be easily sent across the network.
... defining an object template let's co
nsider a simple program that displays information about the students and teachers at a school.
...And 2 more matches
Object prototypes - Learn web development
object.is(), object.keys(), and other members not defined i
nside the prototype bucket are not inherited by object instances or object types that inherit from object.prototype.
...bye for now!'); }; save the code and load the page in the browser, and try entering the following into the text input: person1.farewell(); you should get an alert message displayed, featuring the person's name as defined i
nside the constructor.
...this worked fine on the method we defined earlier in the prototype because it is sitting i
nside a function scope, which will be transferred successfully to the object instance scope.
...And 2 more matches
Getting started with Svelte - Learn web development
the markup section in the markup section you can insert any html you like, and in addition you can insert valid javascript expression i
nside single curly brackets ({}).
... in svelte, css i
nside a component's <style> block will be scoped only to that component.
...then in line 3 it instantiates it, passing an option object with the following properties: target: the dom element i
nside which we want the component to be rendered, in this case the <body> element.
...And 2 more matches
Package management basics - Learn web development
type the following command, making sure you are i
nside 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.
... one disadvantage is that parcel is only available i
nside our parcel-experiment app; you won't be able to run it in a different directory.
... this is determined using a system called semver, which might look a bit complicated from the documentation but can be simplified by co
nsidering only the summary information and that a version is represented by major.minor.patch, such as 2.0.1 being major version 2 with patch version 1.
...And 2 more matches
Gecko info for Windows accessibility vendors
microsoft active accessibility (msaa) an api devised by microsoft so that accessibility aids can track what's going on i
nside the user interface of any software package that supports it.
...i
nside the gecko process, code has full access to dom apis.
... the accname is an accumulation of the descendents' accnames, so may be co
nsidered redundant with them.
...And 2 more matches
Configuring Build Options
be aware that changing your mozconfig will require the configure process to be rerun and therefore the build will take co
nsiderably longer, so if you find yourself changing the same options regularly, it may be worth having a separate mozconfig for each.
... the main dow
nside of this is that each objdir will take up a significant amount of space on disk.
...many of these extensions are now co
nsidered an integral part of the browsing experience.
...And 2 more matches
The Firefox codebase: CSS Guidelines
this document contains guidelines defining how css i
nside the firefox codebase should be written, it is notably relevant for firefox front-end engineers.
... using css variables adding new variables before adding new css variables, please co
nsider the following questions: is the variable value changed at runtime?
... (either from javascript or overriden by another css file) if the answer is no, co
nsider using a preprocessor variable or simply inlining the value.
...And 2 more matches
Overview of Mozilla embedding APIs
contract-id: ns_document_loader_service_contractid implemented interfaces: nsiwebprogress
nsidocumentloader related interfaces: nsiwebprogresslistener public components nswebbrowser the nswebbrowser is the main embedding component which gecko exposes.
...contract-id: ns_webbrowser_contractid implemented interfaces: nsiwebbrowser nsiwebnavigation nsiwebbrowsersetup nsiwebbrowserpersist nsiwebbrowserfind nsiwebbrowserprint nsiwebbrowserfocus nsibasewindow requestor interfaces:
nsidomwindow
nsidomdocument nsiwebprogress nsiclipboardcommands nsiprompt related interfaces: nsiprompt nsiwebbrowserchrome nsiwebbrowsersitewindow nsiwebprogresslistener nsicontextmenulistener nsiprintoptions overview: most of gecko's functionality is exposed through the nswebbrowser component.
...being reviewed interface definition: nsimemory.idl
nsidomwindow this interface is used to represent the window containing a specific document.
...And 2 more matches
Bytecode Descriptions
if the function call is not i
nside a with statement, use jsop::gimplicitthis instead.
...we could implement switch statements using jsop::ifne and jsop::pop, but that would also be awkward--putting the jsop::pop i
nside the switch body would complicate fallthrough.
...jsop::gosub is co
nsidered to have two "successors": the target of offset, which is the actual next instruction to run; and the instruction immediately following jsop::gosub, even though it won't run until later.
...And 2 more matches
JIT Optimization Strategies
co
nsider the following constructor: function point(x, y) { this.x = x; this.y = y; } if only integers are ever stored in the x and y properties, then the instances of point will be represented in an "unboxed" mode - with the property values stored as raw 4-byte values within the object.
... co
nsider the following example: function base() {} base.prototype = { get x() { return 3; } }; function derived1() {} derived1.prototype = object.create(base.prototype); function derived2() {} derived1.prototype = object.create(base.prototype); if a property access for d.x sees only instances of both derived1 and derived2 for d, it can optimize the access to x to a call to the getter function define...
... co
nsider the following example: function base() {} base.prototype = { set x(val) { ...
...And 2 more matches
amIWebInstallListener
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview boolean onwebinstallblocked(in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); void onwebinstalldisabled(in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); boolean onwebinstallrequested(in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstal...
...ls, [optional] in pruint32 acount); note: prior to gecko 8.0, all references to
nsidomwindow used in this interface were
nsidomwindowinternal.
...boolean onwebinstallblocked( in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs.
...And 2 more matches
nsIAccessNode
method overview nsiaccessnode getchildnodeat(in long childnum); obsolete since gecko 2.0
nsidomcssprimitivevalue getcomputedstylecssvalue(in domstring pseudoelt, in domstring propertyname); domstring getcomputedstylevalue(in domstring pseudoelt, in domstring propertyname); void scrollto(in unsigned long ascrolltype); void scrolltopoint(in unsigned long acoordinatetype, in long ax, in long ay); attributes note: attempting to access the attributes of a ...
...obsolete since gecko 2.0 innerhtml domstring the innerhtml for the dom node this is a text string of all the markup i
nside the dom node, not including the start and end tag for the node.
... getcomputedstylecssvalue() retrieve the computed style value as
nsidomcssprimitivevalue for the dom node this access node is associated with.
...And 2 more matches
nsIClipboardDragDropHooks
method overview boolean allowdrop(in
nsidomevent event, in
nsidragsession session); boolean allowstartdrag(in
nsidomevent event); boolean oncopyordrag(in
nsidomevent aevent, in nsitransferable trans); boolean onpasteordrop(in
nsidomevent event, in nsitransferable trans); methods allowdrop() tells gecko whether a drop is allowed on this content area.
... boolean allowdrop( in
nsidomevent event, in
nsidragsession session ); parameters event the dom event (drag gesture).
...boolean allowstartdrag( in
nsidomevent event ); parameters event the dom event (drag gesture).
...And 2 more matches
nsIContentFrameMessageManager
attributes content
nsidomwindow: the current top level window in the frame or null.
... docshell
nsidocshell: the top level docshell or null.
... examples once you obtain the conten frame messge manager, you can send messages to listeners who registered with services.mm.addmessagelistener get content message manager from browser this could would run in a
nsidomwindow scope.
...And 2 more matches
nsIEditorMailSupport
inherits from: nsisupports last changed in gecko 1.7 method overview nsisupportsarray getembeddedobjects();
nsidomnode insertascitedquotation(in astring aquotedtext, in astring acitation, in boolean ainserthtml);
nsidomnode insertasquotation(in astring aquotedtext); void inserttextwithquotations(in domstring astringtoinsert); void pasteascitedquotation(in astring acitation, in long aselectiontype); void pasteasquotation(in long aselectiontype); void rewrap(in boolean arespectnewlines); void stripcites(); methods getembeddedobjects() get a list of img and object tags in the current document.
...
nsidomnode insertascitedquotation( in astring aquotedtext, in astring acitation, in boolean ainserthtml ); parameters aquotedtext the actual text to be quoted.
...(vs plaintext) return value the
nsidomnode which was inserted.
...And 2 more matches
nsIFrameLoader
docshell
nsidocshell get the docshell from the frame loader.
... destroy() destroys the frame loader and everything i
nside it.
...see
nsidomwindowutils.sendkeyevent() for details; this method is its equivalent for cross-process event handling.
...And 2 more matches
Working with Multiple Versions of Interfaces
to do this i used the accessibility framework: hwnd gethwnd(
nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsiaccessibleretrieval> refp; refp = do_createinstance( "@mozilla.org/accessibleretrieval;1", &rv); if (ns_failed(rv)){ return self; } //line 6.
...unfortunately we compiled this in the latest sdk, and so this magic number happens to be: "244e4c67-a1d3-44f2-9cab-cdaa31b68046" whereas, i
nside firefox 2, the iid it happens to know about is: "663ca4a8-d219-4000-925d-d8f66406b626".
... hwnd gethwndb(
nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsicomponentmanager> compmgr; rv = ns_getcomponentmanager(getter_addrefs(compmgr)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessibleretrieval> refp; rv = compmgr->createinstancebycontractid(accretcid, 0, iar_iid_old, getter_addrefs(refp)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessible> accnode; rv = re...
...And 2 more matches
Migrating from Firebug - Firefox Developer Tools
the developer tools console offers similar functionality via the filter buttons i
nside its toolbar — centralized at one place.
...the difference is that they show the properties and methods within a side panel i
nside the web console.
... inspect cookies all cookies related to a website are listed i
nside the cookies panel in firebug.
...And 2 more matches
Basic usage of canvas - Web APIs
providing fallback content is very straightforward: just insert the alternate content i
nside the <canvas> element.
... browsers that don't support <canvas> will ignore the container and render the fallback content i
nside it.
... browsers that do support <canvas> will ignore the content i
nside the container, and just render the canvas normally.
...And 2 more matches
Intersection Observer API - Web APIs
co
nsider a web page that uses infinite scrolling.
...a value of 1.0 means that the threshold isn't co
nsidered passed until every pixel is visible.
... how intersection is calculated all areas co
nsidered by the intersection observer api are rectangles; elements which are irregularly shaped are co
nsidered as occupying the smallest rectangle which encloses all of the element's parts.
...And 2 more matches
PointerEvent.isPrimary - Web APIs
a pointer is co
nsidered primary if the pointer represents a mouse device.
... a pointer representing pen input is co
nsidered the primary pen input if its pointerdown event was dispatched when no other active pointers representing pen input existed.
... a pointer representing touch input is co
nsidered the primary touch input if its pointerdown event was dispatched when no other active pointers representing touch input existed.
...And 2 more matches
RTCConfiguration - Web APIs
if the policy isn't specified, all is assumed by default, allowing all candidates to be co
nsidered.
... rtcicetransportpolicy enum the rtcicetransportpolicy enum defines string constants which can be used to limit the transport policies of the ice candidates to be co
nsidered during the connection process.
... constant description "all" all ice candidates will be co
nsidered.
...And 2 more matches
Using bounded reference spaces - Web APIs
the space i
nside the boundary is then the user's safe movement area, within which they are tracked and their movements replicated into the virtual world.
... although the user's xr system may provide automated detection and protection against exiting the safe area, it is always good practice to handle this yourself, watching for collisions between the user's position and the boundary of the world, and providing guidance to move back toward the origin point, or at least to stay i
nside the safe zone.
... the interior of the bounded area is always co
nsidered to be on the right side of the boundary.
...And 2 more matches
Web Audio API - Web APIs
web audio concepts and usage the web audio api involves handling audio operations i
nside an audio context, and has been designed to allow modular routing.
... a simple, typical workflow for web audio would look something like this: create audio context i
nside the context, create sources — such as <audio>, oscillator, stream create effects nodes, such as reverb, biquad filter, panner, compressor choose final destination of audio, for example your system speakers connect the sources up to the effects, and the effects to the destination.
...you need to create an audiocontext before you do anything else, as everything happens i
nside a context.
...And 2 more matches
Using XMLHttpRequest - Web APIs
for example, co
nsider this snippet, which uses the responsetype of "arraybuffer" to fetch the remote content into a arraybuffer object, which stores the raw binary data.
... now, co
nsider the submission of a form containing only two fields, named foo and baz.
...for this reason, the ajax-only upload is co
nsidered an experimental technique.
...And 2 more matches
WAI-ARIA Roles - Accessibility
a feed enables screen readers to use the browse mode reading cursor to both read and scroll through a stream of rich content that may continue scrolling infinitely by loading more content as the user reads.aria: figure rolethe aria figure role can be used to identify a figure i
nside page content where appropriate semantics do not already exist.
... a figure is generally co
nsidered to be one or more images, code snippets, or other content that puts across information in a different way to a regular flow of text.aria: form rolethe form landmark role can be used to identify a group of elements on a page that provide equivalent functionality to an html form.aria: grid rolethe grid role is for a widget that contains one or more rows of cells.
...to give the page more structure, a level should also be provided to indicate relationships between sections.aria: img rolethe aria img role can be used to identify multiple elements i
nside page content that should be co
nsidered as a single image.
...And 2 more matches
Cognitive accessibility - Accessibility
cognitive accessibility covers accessibility co
nsiderations for people with cognition and learning disabilities.
... additional timing criteria to co
nsider are: people who have cognitive or language limitations may need more time to read and to understand.
...if you have added content to links for screen readers, and that content is verbose and potentially confusing to sighted readers, co
nsider clipping the added text to visually hide it from those not using assistive technologies.
...And 2 more matches
:host-context() - CSS: Cascading Style Sheets
the :host-context() css pseudo-class function selects the shadow host of the shadow dom containing the css it is used i
nside (so you can select a custom element from i
nside its shadow dom) — but only if the selector given as the function's parameter matches the shadow host's ancestor(s) in the place it sits i
nside the dom hierarchy.
... one typical use of this is with a descendant selector expression — for example h1 — to select only instances of the custom element that are i
nside an <h1>.
... in this example we have a simple custom element — <context-span> — that you can wrap around text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> i
nside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot = this.attachshadow({mode: 'open'}); shadowroot.appendchild(style); shadowroot.appendchild...
...And 2 more matches
@supports - CSS: Cascading Style Sheets
the rule may be placed at the top level of your code or nested i
nside any other conditional group at-rule.
...the following example returns true if the browser's transform-origin property co
nsiders 5% 5% valid: @supports (transform-origin: 5% 5%) {} function syntax the second basic supports condition is a supports function, the syntax for these is supported by all browsers, but the functions themselves are still being standardized.
...the following example returns true if the browser's transform-origin property doesn't co
nsider 10em 10em 10em valid: @supports not (transform-origin: 10em 10em 10em) {} as with any operator, the not operator can be applied to a declaration of any complexity.
...And 2 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
we are able to align the content i
nside grid areas, and the grid tracks themselves on these two axes.
... center an item in the area by combining the align and justify properties we can easily center an item i
nside a grid area.
...a a ."; } .item1 { grid-area: a; align-self: center; justify-self: center; } <div class="wrapper"> <div class="item1">item 1</div> </div> aligning the grid tracks on the block axis if you have a situation where your grid tracks use an area that is smaller than the grid container, then you can align the grid tracks themselves, i
nside that container.
...And 2 more matches
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
those of us who have been doing web development for more years than we care to remember might co
nsider that css grid is a little bit like using “tables for layout”.
...the biggest dow
nside however was that it tied our design to the mark-up, often creating accessibility issues as it did so.
...we can also position items using line-based placement of grid template areas, without co
nsidering their location in the source.
...And 2 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
in the first example, which uses flexbox, i have a container with three items i
nside.
...in the case of a grid layout, we are aligning the items i
nside their grid area.
... grid and absolutely positioned elements grid interacts with absolutely positioned elements, which can be useful if you want to position an item i
nside a grid or grid area.
...And 2 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
like any other property, this is written i
nside a ruleset, like so: element { --main-bg-color: brown; } note that the selector given to the ruleset defines the scope that the custom property can be used in.
... as mentioned earlier, you use the custom property value by specifying your custom property name i
nside the var() function, in place of a regular property value: element { background-color: var(--main-bg-color); } first steps with custom properties let's start with this simple css that applies the same color to elements of different classes: .one { color: white; background-color: brown; margin: 10px; width: 50px; height: 50px; display: inline-block; } .two { color: white; ...
...for example, var(--foo, red, blue) defines a fallback of red, blue — anything between the first comma and the end of the function is co
nsidered a fallback value.
...And 2 more matches
Visual formatting model - CSS: Cascading Style Sheets
this situation happens when, for example, you declare display: flex on a parent element, and directly i
nside there is a run of text not contained in another element.
...in the next example i have a string i
nside a <div>; in the middle of my string is a <p> element containing part of the text.
... something to co
nsider about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box.
...And 2 more matches
list-style-position - CSS: Cascading Style Sheets
note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: i
nside.
... syntax /* keyword values */ list-style-position: i
nside; list-style-position: outside; /* global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; the list-style-position property is specified as one of the keyword values listed below.
... values i
nside the ::marker is the first element among the list item's contents.
...And 2 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
in a similar manner to the <img> element, we include a path to the media we want to embed i
nside the src attribute; we can include other attributes to specify information such as whether we want it to autoplay and loop, whether we want to show the browser's default audio controls, etc.
... the content i
nside the opening and closing <audio></audio> tags is shown as a fallback in browsers that don't support the element.
... waiting playback has stopped because of a temporary lack of data usage notes browsers don't all support the same file types and audio codecs; you can provide multiple sources i
nside nested <source> elements, and the browser will then use the first one it understands: <audio controls> <source src="myaudio.mp3" type="audio/mpeg"> <source src="myaudio.ogg" type="audio/ogg"> <p>your browser doesn't support html5 audio.
...And 2 more matches
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
this attribute is co
nsidered a legacy attribute and redefined as allow="fullscreen".
... this attribute is co
nsidered a legacy attribute and redefined as allow="payment".
...the contentdocument property refers to the document i
nside the <iframe>, same as contentwindow.document.
...And 2 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
you can set a default value for the input by including a date and time i
nside the value attribute, like so: <label for="party">enter a date and time for your party booking:</label> <input id="party" type="datetime-local" name="partydate" value="2017-06-01t08:30"> one thing to note is that the displayed date and time formats differ from the actual value; the displayed date and time are formatted according to the user's locale as reported by their operating system, wher...
...we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed i
nside the form control, and can't be styled or shown effectively.
...if you are stuck with other hardware, you can try to emulate 64-bit hardware i
nside a 32-bit virtual machine, but most vms don't support this kind of virtualization, stability may suffer, and performance will definately suffer greatly.
...And 2 more matches
<input type="search"> - HTML: Hypertext Markup Language
regardless of their type, search field inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be co
nsidered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be ...
... setting placeholders you can provide a useful placeholder i
nside your search input that could give a hint on what to do using the placeholder attribute.
...in many cases, users should just be allowed to search for anything, but there are a few cases to co
nsider, such as searches against data of a known format.
...And 2 more matches
<input type="text"> - HTML: Hypertext Markup Language
lements regardless of their type, text inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be co
nsidered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be ...
...it can be used on any editable content, but here we co
nsider specifics related to the use of spellcheck on <input> elements.
... setting placeholders you can provide a useful placeholder i
nside your text input that can provide a hint as to what to enter by including using the placeholder attribute.
...And 2 more matches
<input type="url"> - HTML: Hypertext Markup Language
elements regardless of their type, url inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum number of characters the input should accept minlength the minimum number of characters long the input can be and still be co
nsidered valid pattern a regular expression the input's contents must match in order to be valid placeholder an exemplar value to display in the input field whenever it is empty readonly a boolean attribute indicating whether or not the contents of the input should be read-only size a number indicating how many characters wide the input field should be ...
...it can be used on any editable content, but here we co
nsider specifics related to the use of spellcheck on <input> elements.
...in its most basic form, a url input can be implemented like this: <input id="myurl" name="myurl" type="url"> notice that it's co
nsidered valid when empty and when a single validly-formatted url address is entered, but is otherwise not co
nsidered valid.
...And 2 more matches
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
nesting a <kbd> element i
nside a <samp> element represents input that has been echoed back to the user by the system.
... nesting a <samp> element i
nside 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.
... echoed input nesting a <kbd> element i
nside a <samp> element represents input that has been echoed back to the user by the system.
...And 2 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
to link an external stylesheet, you'd include a <link> element i
nside your <head> like this: <link href="main.css" rel="stylesheet"> this simple example provides the path to the stylesheet i
nside an href attribute, and a rel attribute with a value of stylesheet.
... you can also provide a media type or query i
nside a media attribute; this resource will then only be loaded if the media condition is true.
... note: this attribute is co
nsidered obsolete by the whatwg html living standard (which is the specification mdn treats as canonical).
...And 2 more matches
<select>: The HTML Select element - HTML: Hypertext Markup Language
each menu option is defined by an <option> element nested i
nside the <select>.
...if no value attribute is included, the value defaults to the text contained i
nside the element.
... you can further nest <option> elements i
nside <optgroup> elements to create separate groups of options i
nside the dropdown.
...And 2 more matches
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
values higher than 1000 will be co
nsidered as incorrect and will be set to the default value (1).
...alternatively, you can put the abbreviated description i
nside the cell and place the long content in the title attribute.
... justify (with text only): the content is stretched out i
nside the cell so that it covers its entire width.
...And 2 more matches
HTML documentation index - HTML: Hypertext Markup Language
84 <content>: the shadow dom content placeholder element (obsolete) content, dom, deprecated, element, html, html web components, placeholder, reference, web, web components, shadow dom the html <content> element—an obsolete part of the web components suite of technologies—was used i
nside of shadow dom as an insertion point, and wasn't meant to be used in ordinary html.
... 95 <dt>: the description term element definition, definition list, definition term, element, html, html grouping content, reference, term, dt, lists the html <dt> element specifies a term in a description or definition list, and as such must be used i
nside a <dl> element.
...the precise value, however, is not co
nsidered important.
...And 2 more matches
MIME types (IANA media types) - HTTP
note that text/plain does not mean "any kind of textual data." if they expect a specific kind of textual data, they will likely not co
nsider it a match.
...no other values are co
nsidered valid, and using any of those may result in scripts that do not load or run.
...only a few image types are used commonly enough to be co
nsidered safe for use on web pages: abbreviation file format mime type file extension(s) browser compatibility apng animated portable network graphics image/apng .apng chrome, edge, firefox, opera, safari bmp bitmap file image/bmp .bmp chrome, edge, firefox, internet explorer, opera, safari gif graphics interchange format ...
...And 2 more matches
Authoring MathML - MathML
using mathml mathml in html pages you can use presentation mathml i
nside html5 documents: <!doctype html> <html> <head> <title>mathml in html5</title> </head> <body> <h1>mathml in html5</h1> <p> square root of two: <math> <msqrt> <mn>2</mn> </msqrt> </math> </p> </body> </html> content mathml is not supported by browsers.
...to use it, just insert one line in your document header: <script src="https://fred-wang.github.io/mathml.css/mspace.js"></script> if you need more complex constructions, you might instead co
nsider using the heavier mathjax library as a mathml polyfill: <script src="https://fred-wang.github.io/mathjax.js/mpadded-min.js"></script> note that these two scripts perform feature detection of the mspace or mpadded elements (see the browser compatibility table on these pages).
...even if your browser supports mathml, your webmail may prevent you to send or receive mails with mathml i
nside.
...And 2 more matches
Digital audio concepts - Web media technologies
co
nsider the wave above, and how much different the blue, digital wave would look if you took samples twice as often.
... there is a reason why 44.1 khz is co
nsidered the minimum "high fidelity" sampling rate.
... for example, co
nsider a stereo audio clip (that is, two audio channels) with a sample size of 16 bits (2 bytes), recorded at 48 khz: 2×2bytessample×48000samplessecond=192000bytessecond=192kbps2 \times 2\frac { bytes }{ sample } \times 48000\frac { samples }{ second } = 192000\frac { bytes }{ second } = 192 kbps at 192 kbps, lower-end networks are already going to be strained just by a single audio stream playing...
...And 2 more matches
Using templates and slots - Web Components
and because we are appending its contents to a shadow dom, we can include some styling information i
nside the template in a <style> element, which is then encapsulated i
nside the custom element.
...we can only display one bit of text i
nside it, meaning that at the moment it is even less useful than a regular paragraph!
... to define the slot's content, we include an html structure i
nside the <my-paragraph> element with a slot attribute whose value is equal to the name of the slot we want it to fill.
...And 2 more matches
util/uuid - Archive of obsolete content
generate uuid to generate a new uuid, call uuid() with no arguments: let uuid = require('sdk/util/uuid').uuid(); parsing uuid to convert a string representation of a uuid to an
nsid, pass the string representation to uuid(): let { uuid } = require('sdk/util/uuid'); let firefoxuuid = uuid('{ec8030f7-c20a-464f-9b0e-13a3a9e97384}'); globals functions uuid(stringid) generate a new uuid, or convert a string representation of a uuid to an
nsid.
...if this argument is supplied, it will be converted to an
nsid and returned.
... otherwise a new
nsid will be generated and returned.
... returns
nsid : a uuid, represented as an
nsid object.
StringView - Archive of obsolete content
awhole.subarray(nstartidx, nendidx) : awhole; } this.buffer = awhole.buffer; this.bufferview = awhole; this.rawdata = araw; object.freeze(this); } /* constructor's methods */ stringview.loadutf8charcode = function (achars, nidx) { /* the iso 10646 view of utf-8 co
nsiders valid codepoints encoded by 1-6 bytes, * while the unicode view of utf-8 in 2003 has limited them to 1-4 bytes in order to * match utf-16's codepoints.
...if not specified (or specified as null) it will be co
nsidered as 0.
...if omitted it will be co
nsidered as 0.
... **/ }; if you want to create a stringview i
nside a bigger empty buffer, like in the following c line /* mybuffer: 12 character followed by 1012 nulls...
Custom XUL Elements with XBL - Archive of obsolete content
it's very similar to a js object variable, and we generally use a field for private variables i
nside of the element.
... <field name="fieldname">defaultvalue</field> from i
nside your binding methods, you can access fields with: this.fieldname you can also access them from outside of the element, if you have a reference to it: elementref.fieldname just like with js objects, all fields are publicly accessible, and we use a "_" to indicate a field is "private".
...this suggests that you should keep everything i
nside your binding.
...in those cases you just add regular event attributes to the nodes i
nside the content tag.
Local Storage - Archive of obsolete content
it is strongly recommended that you keep your local files i
nside the firefox profile directory.
...the common practice is to create a directory with the name of your project at the root of the profile folder, and keep your files i
nside.
...don't log i
nside functions that are called too often, such as mouseover event handlers, or certain http activity listeners.
...this approach has the dow
nside of being less stable.
The Box Model - Archive of obsolete content
this is similarly the case for xul, except there are two flexibility directions to co
nsider.
... unlike most style attributes, the flex attribute is co
nsidered acceptable to use in xul code.
... margins, paddings and spacers margins and paddings are frequently used in both html and xul to define spacing between elements and i
nside of elements.
...in order to have wrapping descriptions, you need to set the text as a child node instead of using the value attribute: <description>&xulschoolhello.description.label;</description> even then, the text will extend as much as it can in a single line, so you need to add some css limits in order to make it wrap i
nside a xul dialog or window.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
until this redesign, wired news wasn't even using css to style the content i
nside tables.
... the sheer amount [sic] of redundant <font> tags i
nside every cell was probably enough to double file size.
... what would you say to a site developer co
nsidering a similar conversion to standards-based layout, either with simple tables or no tables at all?
... i think the conversion is a matter of taking into account several co
nsiderations.
MMgc - Archive of obsolete content
normally, a pointer to the object is co
nsidered a hard reference -- any such reference will prevent the object from being destroyed.
...pointers must be marked for the gc to co
nsider the objects "live"; otherwise, the objects will be co
nsidered unreachable and will be destroyed.
...they are co
nsidered stack memory.
...another point to co
nsider is whether marking should always be on or should be turned on and off at some point based on memory allocation patterns.
Same-origin policy for file: URIs - Archive of obsolete content
in gecko 1.8 or earlier, any two file: uris are co
nsidered to be same-origin.
...for cross-window dom access, each file is treated as a separate origin, with one exception: if a file is loaded from another file that would otherwise be able to load it following this same-origin policy, they are co
nsidered to have the same origin.
...for example, if the file /home/user/foo.html is a frameset and one of the frames is /home/user/subdir/bar.html, the frame and frameset are co
nsidered to share the same origin.
... on the other hand, if the file /home/user/subdir/foo.html is a frameset and the frame is /home/user/bar.html, the frame and frameset are co
nsidered to have different origins.
In-Depth - Archive of obsolete content
this will flip it around so items i
nside of this box will be displayed bottom to top and right to left.
...to style that image, we first need to get a handle to the toolbar, then the box i
nside of it, and then to the image that we added with the xml.
...i
nside of the xml file there is an image which has its class set to toolbar-primary-icon.
...put these 3 together and you get: #navigation-toolbar > .toolbar-holder > .toolbar-primary-icon i
nside this section of the css is where you add an image.
Creating a Help Content Pack - Archive of obsolete content
next, you'll need to insert a rdf:description element into the file, i
nside the rdf:rdf element just created: <rdf:description rdf:about="urn:root" nc:title="" nc:defaulttopic="" nc:base=""> </rdf:description> fill in the attributes as follows: rdf:about must be urn:root or your pack won't work.
...(we're still not actually to the point where we're describing the actual data in each of these, so we'll just use some filler data for now.) add the following code i
nside the rdf:description element you just created: <nc:panellist> <rdf:seq> </rdf:seq> </nc:panellist> you'll create the relevant information descriptions within the rdf:seq element.
... nc:platform="win os2" nc:datasources="win-toc.rdf"/> </rdf:li> <rdf:li> <rdf:description nc:panelid="toc" nc:platform="unix mac" nc:datasources="unix-toc.rdf"/> </rdf:li> there's one final element to add i
nside rdf:seq to complete the content pack descriptor file: an element to describe the help viewer's search function.
...if you're coming anywhere close to this limit, however, you probably should be co
nsidering exactly why you need so much nesting.
Mozilla Application Framework in Detail - Archive of obsolete content
javascript, co
nsidered by many to be the best scripting language ever designed is ideal for specifying the behavior of your interface widgets.
... where speed is the foremost co
nsideration, we provide c++ libraries with multi-language interfaces for comprehensive, performant access to networking, filesystem, content, rendering, and much more.
...there is no charge for using the gecko browser engine or gecko technologies, including distributing gecko i
nside another product.
...mozilla engineers have written and are in the process of refining a new security model for web services that will ease the deployment of applications using web services while maintaining the security of sites i
nside the user's firewall.
Supporting private browsing mode - Archive of obsolete content
other co
nsiderations for extensions in some extensions, it's hard to decide whether the data retained by the extension should be written to disk in private browsing mode or not.
... in such a case, it is co
nsidered good practice for the extension to enable respecting the private browsing mode based on a preference specific to that extension, and set that preference to true by default.
... for example, the fire.fm extension has a preference called "disable station history and scrobble when firefox is in private mode", and disabling publishing of that information i
nside the private browsing mode by default.
...the following categories define what's co
nsidered "sensitive" data: the urls of pages the user has visited.
browser.type - Archive of obsolete content
the type of browser, which can be used to set access of the document loaded i
nside the browser.
...the content that is loaded i
nside the browser is not allowed to access the chrome above it.
...the content that is loaded i
nside the browser is not allowed to access the chrome above it.
...the content that is loaded i
nside the browser is not allowed to access the chrome above it.
Menus - Archive of obsolete content
submenus may be created by nesting one menu i
nside of another.
...a submenu is created by nesting a menu element i
nside another menupopup.
... you could further add a third level of menus by using another menu element as one of the items i
nside the 'sort' menupopup.
... accessing and setting the active item in a menu, there will usually be an item that is co
nsidered "active".
Tooltips - Archive of obsolete content
elements that use the tooltiptext attribute display the tooltip in a default tooltip element, which typically looks like a small yellow box large enough to fit the text i
nside it.
... the tooltip can be created using the tooltip element, the contents of which appear i
nside the tooltip.
... if you don't place any elements i
nside a tooltip element, it behaves and appears just like a standard tooltip.
... note that when using a specialized tooltip element, any labels used i
nside it are not populated based on what the tooltip applies to, so you may need to set the content in a tooltip if you wish to use the same tooltip for several elements.
Rule Compilation - Archive of obsolete content
a query is declared with the query tag (new to ff3; ff2 only worked with rdf datasources and had no query tag), which you would place directly i
nside the <template>.
...for instance, co
nsider the example below: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a" hidden="true"> <template> ...
...does this mean that templates cannot be used i
nside hidden areas of the ui?
...content i
nside a menu is not generated until the menu is opened.
Special Condition Tests - Archive of obsolete content
templates have a means of allowing a rule to match only if the generated content would be inserted i
nside an element with a particular tag name.
...if the node has one of the predicates listed in the containment attribute pointing out of it, it will also be co
nsidered to be a container.
... for instance, we might add the following to the previous example: <button label="houses in my neighbourhood" type="menu" datasources="template-guide-streets.rdf" containment="http://www.xulplanet.com/rdf/address" ref="http://www.xulplanet.com/rdf/myneighbourhood"> the houses do have a value for the 'http://www.xulplanet.com/rdf/address' predicate, so they will also be co
nsidered to be containers as well, resulting in another level of menus.
...co
nsidering the case of bookmarks, the first two rules would match folders, while the third rule would match bookmarks.
Static Content - Archive of obsolete content
one interesting thing about this example is that only one menupopup will be created, even though there are two in the code, one outside the template and another one i
nside the action body.
...remember that only the content at the uri attribute or below i
nside the action are copied for each result.
... when processing the action body, the builder looks at the first element i
nside the action, in this case, the menupopup.
...the builder then switches where generated content would be generated to i
nside to existing menupopup and moves onto the next part of the action, the menuitem.
Advanced Rules - Archive of obsolete content
in the simple syntax, the content is placed directly i
nside the rule.
...ontent uri="?list"/> <member container="?list" child="?city"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#name" object="?name"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#prediction" object="?pred"/> </conditions> generating content the content to generate for a rule is specified i
nside the action element.
... adding additional bindings the final element you can add i
nside a rule is the bindings element.
... i
nside it, you place one or more binding elements.
Anonymous Content - Archive of obsolete content
xbl content xbl can be used to automatically add a set of elements i
nside another element.
...all of the elements i
nside the content tag will be added i
nside the element that the binding is bound to.
...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 i
nside it and a second arrow button at the end, which are the elements that appear in the xbl above.
...if you place child elements i
nside the xul, they will override the elements provided by the binding.
Box Model Details - Archive of obsolete content
if a box has a maximum height, the elements i
nside it are constrained by this.
... you can put boxes anywhere in a xul file, including i
nside an html element such as a table.
...remember that flexibility only has meaning for elements that are directly i
nside a box or an element that is a type of box.
...centering buttons example 4 : source view <hbox pack="center" align="center" flex="1"> <button label="look at me!"/> <button label="push me!"/> </hbox> this example contains a horizontal box with two buttons in it, contained i
nside a flexible box.
Commands - Archive of obsolete content
it is normal to put a group of commands i
nside a commandset element, together near the top of the xul file, as in the following: <commandset> <command id="cmd_open" oncommand="alert('open!');"/> <command id="cmd_help" oncommand="alert('help!');"/> </commandset> a command is invoked when the user activates the button or other element attached to the command.
...if the focus is i
nside 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 i
nside a frame.
... this works well for a browser, since editing commands invoked from the main menu will work i
nside the content area.
Popup Menus - Archive of obsolete content
when invoked, it will display a window containing whatever you put i
nside the menupopup.
...as the name popupset implies, you can put multiple popup declarations i
nside it.
...whenever you context-click (right-click) anywhere i
nside the box, the popup menu will appear.
...note that the tooltip element is still placed i
nside a popupset element like other popup types.
Splitters - Archive of obsolete content
when a splitter is placed i
nside a horizontal box, it will allow resizing horizontally.
... when a splitter is placed i
nside a vertical box, it will allow resizing vertically.
... if you set the collapse attribute, you should also add a grippy element i
nside the splitter which the user can use to collapse the element.
...the splitter grippy is drawn centered i
nside the splitter.
Styling a Tree - Archive of obsolete content
all of the content i
nside the tree's body is rendered by the treechildren element.
... however, css has a concept to access parts of elements co
nsidering them to be pseudo-elements.
... this selector matches some tree rows i
nside the treechildren element as pseudo-elements.
...this style rule means, i
nside a treechildren element, set the background color to blue for all tree rows that have the 'makeitblue' property.
Using Remote XUL - Archive of obsolete content
xul is often used by desktop applications like mozilla but can also be loaded from a web server and rendered i
nside the content pane of a compatible browser.
... note: the dow
nside to using xul is that it only works with browsers that understand it.
... this isn't a problem i
nside an organization that uses mozilla-based browsers exclusively, but for other sites you may need to provide another form of navigation as well.
...because we added it to the menubar item, and events "bubble up" from child element to parent element, it'll fire any time the user manipulates an element i
nside the menu bar, so we don't have to add it to each menu item and button.
menupopup - Archive of obsolete content
there are several ways in which a menupopup may be used: it may be placed i
nside a menu, menulist, toolbarbutton, or a button with the type attribute set to "menu" to create a popup that will open when the menu or button is pressed.
... anchornode type:
nsidomelement this read-only property holds the dom node that was specified as the anchor when opening the popup.
... triggernode type:
nsidomnode this read-only property holds the dom node that generated the event triggering the opening of the popup.
... related elements menu, menubar, menuitem, menulist, menuseparator interfaces nsiaccessibleprovider,
nsidomxulpopupelement ...
radiogroup - Archive of obsolete content
only one radio button i
nside the group can be selected at a time.
...place the radiogroup i
nside a groupbox if you would like a border or caption for the group.
...this attribute only has any effect when used i
nside a prefwindow.
... related interfaces nsiaccessibleprovider,
nsidomxulselectcontrolelement ...
tabbrowser - Archive of obsolete content
properties browsers type: nodelist of browser elements holds a list of the browser elements i
nside the tabbrowser.
... docshell type:
nsidocshell this read-only property contains the
nsidocshell object for the document.
... documentcharsetinfo obsolete since gecko 12.0 type:
nsidocumentcharsetinfo this read-only property contains the
nsidocumentcharsetinfo object for the document which is used to handle which character set should be used to display the document.
... the properties of the
nsidocumentcharsetinfo object were merged into the docshell in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9).
textbox - Archive of obsolete content
prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element i
nside the textbox binding.
...prior to gecko 1.9 (firefox 3), the script code would execute in the context of the anonymous html <input> element i
nside the textbox binding.
...this attribute only has any effect when used i
nside a prefwindow.
...tiline="true" rows="2" cols="70" onkeypress="return pncountnotechars(event);"/> the javascript: function pncountnotechars(evt) { //allow non character keys (delete, backspace and and etc.) if ((evt.charcode == 0) && (evt.keycode != 13)) return true; if (evt.target.value.length < 10) { return true; } else { return false; } } related interfaces nsiaccessibleprovider,
nsidomxultextboxelement ...
toolbar - Archive of obsolete content
it can be collapsed with a grippy when the toolbar is placed i
nside a toolbox.
...items that are placed directly i
nside the toolbar without being in the toolbarpalette are permanent.
...items that are placed directly i
nside the toolbar without being in the toolbarpalette are permanent.
...this will either be the toolbox's parent (if it's in a toolbox), or, if the toolbar is an external toolbar (that is, one not contained in a toolbox), the id of the toolbox it should be co
nsidered to be part of.
Browser Feature Detection - Archive of obsolete content
borderrightcolor true true true borderbottomcolor true true true borderleftcolor true true true bordertopstyle true true true borderrightstyle true true true borderbottomstyle true true true borderleftstyle true true true bottom true true true captio
nside true false true clear true true true clip true true true content true false true counterincrement true false true counterreset true false true cue true false false cueafter true false false cuebefore true false false cursor true t...
...ue false true outline true false true outlinecolor true false true outlinestyle true false true outlinewidth true false true overflow true true true page true false true pagebreakafter true true true pagebreakbefore true true true pagebreaki
nside true false true pause true false true pauseafter true false true pausebefore true false true pitch true false false pitchrange true false true playduring false false false position true true true quotes true false true richness true ...
...ame: 'borderrightcolor', 'supported': false}, {name: 'borderbottomcolor', 'supported': false}, {name: 'borderleftcolor', 'supported': false}, {name: 'bordertopstyle', 'supported': false}, {name: 'borderrightstyle', 'supported': false}, {name: 'borderbottomstyle', 'supported': false}, {name: 'borderleftstyle', 'supported': false}, {name: 'bottom', 'supported': false}, {name: 'captio
nside', 'supported': false}, {name: 'clear', 'supported': false}, {name: 'clip', 'supported': false}, {name: 'content', 'supported': false}, {name: 'counterincrement', 'supported': false}, {name: 'counterreset', 'supported': false}, {name: 'cue', 'supported': false}, {name: 'cueafter', 'supported': false}, {name: 'cuebefore', 'supported': false}, {name: 'cursor', 'supported': false},...
...', 'supported': false}, {name: 'outline', 'supported': false}, {name: 'outlinecolor', 'supported': false}, {name: 'outlinestyle', 'supported': false}, {name: 'outlinewidth', 'supported': false}, {name: 'overflow', 'supported': false}, {name: 'page', 'supported': false}, {name: 'pagebreakafter', 'supported': false}, {name: 'pagebreakbefore', 'supported': false}, {name: 'pagebreaki
nside', 'supported': false}, {name: 'pause', 'supported': false}, {name: 'pauseafter', 'supported': false}, {name: 'pausebefore', 'supported': false}, {name: 'pitch', 'supported': false}, {name: 'pitchrange', 'supported': false}, {name: 'playduring', 'supported': false}, {name: 'position', 'supported': false}, {name: 'quotes', 'supported': false}, {name: 'richness', 'supported': fals...
GLSL Shaders - Game development
everything i
nside void main() will be executed by the vertex shader.
... save a copy of the latest minimized three.js library i
nside your directory.
... go to the cube.html file on github, copy all the javascript code from i
nside the second <script> element, and paste it into the third <script> element of the current example.
... the vertex shader code let's continue by writing a simple vertex shader — add the code below i
nside the body's first <script> tag: void main() { gl_position = projectionmatrix * modelviewmatrix * vec4(position.x+10.0, position.y, position.z+5.0, 1.0); } the resulting gl_position is calculated by multiplying the model-view and the projection matrices by each vector to get the final vertex position, in each case.
2D maze game with device orientation - Game development
src: the javascript files with all the source code of the game defined i
nside.
...without the framework, to add the canvas element to the page, you would have to write something like this i
nside the <body> tag: <canvas id='game' width='320' height='480'></canvas> the important thing to remember is that the framework is setting up helpful methods to speed up a lot of things like image manipulation or assets management, which would be a lot harder to do manually.
... the best way to use it in our case is to vibrate the phone every time the ball hits the walls — i
nside the wallcollision function: if("vibrate" in window.navigator) { window.navigator.vibrate(100); } if the vibrate method is supported by the browser and available in the window.navigator object, vibrate the phone for 100 miliseconds.
...in this tutorial we used phaser, but there are a number of other frameworks worth co
nsidering too like impactjs, construct 2 or playcanvas — it depends on your preferences, coding skills (or lack thereof), project scale, requirements and other aspects.
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
in programming, semantics refers to the meaning of a piece of code — for example "what effect does running that line of javascript have?", or "what purpose or role does that html element have" (rather than "what does it look like?".) semantics in javascript in javascript, co
nsider a function that takes a string parameter, and returns an <li> element with that string as its textcontent.
... semantics in css in css, co
nsider styling a list with li elements representing different types of fruits.
...co
nsider the following: <span style="font-size: 32px; margin: 21px 0;">is this a top level heading?</span> this will render it to look like a top level heading, but it has no semantic value, so it will not get any extra benefits as described above.
... some of the benefits from writing semantic markup are as follows: search engines will co
nsider its contents as important keywords to influence the page's search rankings (see seo) screen readers can use it as a signpost to help visually impaired users navigate a page finding blocks of meaningful code is significantly easier than searching though endless divs with or without semantic or namespaced classes suggests to the developer the type of data that will be populated semantic naming mirrors proper custom element/component ...
CSS and JavaScript accessibility best practices - Learn web development
this article outlines some css and javascript best practices that should be co
nsidered to ensure even complex content is as accessible as possible.
...to put it another way, it is important that you co
nsider some best practice advice to make sure that your use of css and javascript doesn't ruin the accessibility of your documents.
...the following sections summarize the main html features to co
nsider.
...as we looked at in our html: a good basis for accessibility article, the key co
nsiderations are: good semantics: using the right element for the right job.
Accessibility - Learn web development
this article starts off the module with a good look at what accessibility is — this includes what groups of people we need to co
nsider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow.
...this article outlines some css and javascript best practices that should be co
nsidered to ensure that even complex content is as accessible as possible.
... 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 co
nsider the accessibility of your web content on these platforms.
... this article looks at mobile-specific accessibility co
nsiderations.
Floats - Learn web development
previous overview: css layout next originally for floating images i
nside blocks of text, the float property became one of the most commonly used tools for creating multiple column layouts on webpages.
... the background of floats the float property was introduced to allow web developers to implement simple layouts involving an image floating i
nside a column of text, with the text wrapping around the left or right of it.
... first, we'll start off with some simple html — add the following to your html body, removing anything that was i
nside there before: <h1>simple float example</h1> <div class="box">float</div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.
...this is like a mini layout i
nside your page, i
nside which everything is contained, therefore our floated element is contained i
nside the bfc and the background runs behind both items.
Beginner's guide to media queries - Learn web development
@media screen and (min-width: 40em) { article { display: grid; grid-template-columns: 3fr 1fr; column-gap: 20px; } nav ul { display: flex; } nav li { flex: 1; } } this css gives us a two-column layout i
nside the article, of the article content and related information in the aside element.
...i
nside a media query we'll make the main element into a two column grid.
... there are a number of other options you can put i
nside the content attribute of the viewport meta tag — see using the viewport meta tag to control layout on mobile browsers for more details.
...it's always worth co
nsidering whether these layout methods can achieve what you want without adding media queries.
Supporting older browsers - Learn web development
you should also co
nsider the type of devices and the way people use your site, for example, you may expect a higher than an average number of mobile devices.
... accessibility and people using assistive technology should always be co
nsidered, but for some sites that may be even more critical.
... in my experience, developers are often very worried about the experience of 1% of users in an old version of internet explorer, while not co
nsidering at all the far greater number who have accessibility needs.
...the browsers that support the feature query also support css grid and so will run the grid code and the code i
nside the feature query.
CSS layout - Learn web development
at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits i
nside.
... floats originally for floating images i
nside blocks of text, the float property became one of the most commonly used tools for creating multiple column layouts on webpages.
... positioning positioning allows you to take elements out of the normal document layout flow, and make them behave differently, for example sitting on top of one another, or always remaining in the same place i
nside the browser viewport.
...4, 6, or 12), and then fit your content columns i
nside these imaginary columns.
Web fonts - Learn web development
the syntax required looks something like this: first of all, you have a @font-face block at the start of the css, which specifies the font file(s) to download: @font-face { font-family: "myfont"; src: url("myfont.woff"); } below this you can then use the font family name specified i
nside @font-face to apply your custom font to anything you like, as normal: html { font-family: "myfont", "bitstream vera serif", serif; } the syntax does get a bit more complex than this; we'll go into more detail below.
...when you find each font, press on the download button, and save the file i
nside the same directory as the html and css files you saved earlier.
...i
nside the unzipped directory you'll see three useful items: multiple versions of each font: (for example .ttf, .woff, .woff2, etc.; the exact fonts provided will be updated over time as browser support requirements change).
... open up the stylesheet.css file and copy both the @font-face blocks contained i
nside into your web-font-start.css file — you need to put them at the very top, before any of your css, as the fonts need to be imported before you can use them on your site.
What is a URL? - Learn web development
an anchor represents a sort of "bookmark" i
nside the resource, giving the browser the directions to show the content located at that "bookmarked" spot.
... how to use urls any url can be typed right i
nside the browser's address bar to get to the resource behind it.
...because the browser already has the document's own url, it can use this information to fill in the missing parts of any url available i
nside that document.
...people are at the core of the web, and so it is co
nsidered best practice to build what is called semantic urls.
The HTML5 input types - Learn web development
but it should not be co
nsidered an exhaustive security measure!
...you could display an input value or the output of a calculation i
nside any element, but <output> is special — like <label>, it can take a for attribute that allows you to associate it with the element or elements that the output value came from.
...note that the usage of these types is quite complex, especially co
nsidering browser support (see below); to find out the full details, follow the links below to the reference pages for each type, including detailed examples.
... the reference pages linked to above provide suggestions on how to program fallbacks for non-supporting browsers; another option is to co
nsider using a javascript library to provide a date picker.
Sending form data - Learn web development
co
nsider the following form: <form action="http://www.foo.com" method="get"> <div> <label for="say">what greeting do you want to say?</label> <input name="say" id="say" value="hi"> </div> <div> <label for="to">who do you want to say it to?</label> <input name="to" id="to" value="mom"> </div> <div> <button>send my greetings</button> </div> </form> since the get method ha...
...files are binary data — or co
nsidered as such — whereas all other data is text data.
...in human terms, this means: "this is form data that has been encoded into url parameters." if you want to send files, you need to take three extra steps: set the method attribute to post because file content can't be put i
nside url parameters.
... security issues each time you send data to a server, you need to co
nsider security.
CSS basics - Learn web development
add the <link> element somewhere i
nside your index.html's head (anywhere between the <head> and </head> tags).
...since <html> is the parent element of the whole page, all elements i
nside it inherit the same font-size and font-family.
... now let's set font sizes for elements that will have text i
nside the html body (<h1>, <li>, and <p>).
... text-shadow sets a drop shadow on the text i
nside an element.
Choosing the right approach - Learn web development
single delayed operation repeating operation multiple sequential operations multiple simultaneous operations no no yes see promise.all(), below code example the following code fetches an image from the server and displays it i
nside an <img> element; see it live also, and see also the source code: fetch('coffee.jpg') .then(response => response.blob()) .then(myblob => { let objecturl = url.createobjecturl(myblob); let image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); }) .catch(e => { console.log('there has been a problem with your fetch operation: ' + e.message); }); ...
....createelement('img'); image1.src = objecturl1; image2.src = objecturl2; document.body.appendchild(image1); document.body.appendchild(image2); // display the text in a paragraph let para = document.createelement('p'); para.textcontent = desctext; document.body.appendchild(para); }); pitfalls if a promise.all() rejects, then one or more of the promises you are feeding into it i
nside its array parameter must be rejecting, or might not be returning promises at all.
...n image, written using async/await (see it live, and see the source code): async function myfetch() { let response = await fetch('coffee.jpg'); let myblob = await response.blob(); let objecturl = url.createobjecturl(myblob); let image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); } myfetch(); pitfalls you can't use the await operator i
nside a non-async function, or in the top level context of your code.
...if you want to use async/await but are concerned about older browser support, you could co
nsider using the babeljs library — this allows you to write your applications using the latest javascript and let babel figure out what changes if any are needed for your user’s browsers.
Introducing asynchronous JavaScript - Learn web development
it is “called back” (hence the name) asynchronously somewhere i
nside the containing function’s body.
... 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 i
nside the catch(), which can be used to report the kind of error that has occurred.
... it worked :) if this confuses you, then co
nsider the following smaller example: console.log("registering click handler"); button.addeventlistener('click', () => { console.log("get click"); }); console.log("all done"); this is very similar in behavior — the first and third console.log() messages will be shown immediately, but the second one is blocked from running until someone clicks the mouse button.
...this can be done by moving it i
nside another .then() block chained onto the end of the second one, or by simply moving it i
nside the second then() block.
Solve common problems in your JavaScript code - Learn web development
for example: function myfunction() { alert('this is my function.'); }; this code won't do anything unless you call it with the following statement: myfunction(); function scope remember that functions have their own scope — you can't access a variable value set i
nside a function from outside the function, unless you declared the variable globally (i.e.
... not i
nside any functions), or return the value from the function.
... how do you nest one decision block i
nside another?
... how do you iterate over the members of an object nested i
nside an array?
Web performance - Learn web development
this article introduces the components of performance, from web page loading and rendering, including how your content makes it into your users browser to be viewed, to what groups of people we need to co
nsider when thinking about performance, how do users perceive performance?
...this article outlines some javascript best practices that should be co
nsidered to ensure even complex content is as performant as possible.
... mobile performance with web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited bandwidth, cpu and battery life, it is important to co
nsider the performance of your web content on these platforms.
... this article looks at mobile-specific performance co
nsiderations.
Introduction to the server side - Learn web development
they run i
nside different operating system environments.
... client-side code is written using html, css, and javascript — it is run i
nside a web browser and has little or no access to the underlying operating system (including limited access to the file system).
... in contrast, you would almost never co
nsider writing the server-side component of a web app without a framework — implementing a vital feature like an http server is really hard to do from scratch in say python, but python web frameworks like django provide one out of the box, along with other very useful tools.
... note: co
nsider other real examples where access to content is controlled.
Server-side web frameworks - Learn web development
i
nside the html skeleton we have an expression that first checks if the youngest_teams variable exists, and then iterates it in a for loop.
...if you're starting from absolutely no programming experience then co
nsider django (it is one of the easiest to learn based on the above criteria).
...at this point you may co
nsider adding support for caching.
... for the next article in this module we'll change direction slightly and co
nsider web security.
Accessibility in React - Learn web development
useeffect() is so named because it runs after react renders a given component, and will run any side-effects that we'd like to add to the render process, which we can't run i
nside the main function body.
...let's see this in action; put the following useeffect() call just above the return statement in the body of todo(), and pass into it a function that logs the words "side effect" to your console: useeffect(() => { console.log("side effect"); }); to illustrate the difference between the main render process and code run i
nside useeffect(), add another log – put this one below the previous addition: console.log("main render"); now, open the app in your browser.
... creating our ref import the useref() and useeffect() hooks into app.js — you'll need them both below: import react, { usestate, useref, useeffect } from "react"; then declare a new ref i
nside the app() function.
...add it to the top of your app.js file, just below the imports: function useprevious(value) { const ref = useref(); useeffect(() => { ref.current = value; }); return ref.current; } now add the following, above the return statement i
nside the app() function: const prevtasklength = useprevious(tasks.length); here we are invoking useprevious() to track the length of the tasks state, like so: note: since we're now utilizing useprevious() in two files, a good efficiency refactor would be to move the useprevious() function into its own file, export it from that file, and import it where you need it.
Starting our Svelte Todo list app - Learn web development
objective: to learn how to create a svelte component, render it i
nside another component, pass data into it using props, and save its state.
... note: you can put your components anywhere i
nside the src folder, but the components folder is a recognized convention to follow, allowing you to find your components easily.
...te to-do list</title> open src/app.svelte and replace its contents with the following: <script> import todos from './components/todos.svelte' </script> <todos /> in development mode, svelte will issue a warning in the browser console when specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the app component i
nside src/main.js, which isn't used i
nside app.
... if you want to globally disable this warning you can add this onwarn handler to your rollup.config.js file i
nside the configuration for the svelte plugin, like this: plugins: [ svelte({ dev: !production, css: css => { css.write('public/build/bundle.css'); }, // warnings are normally passed straight to rollup.
Creating JavaScript callbacks in components
remember (or discover) that addeventlistener is a method of the
nsidomeventtarget interface and is defined as such: void addeventlistener(in domstring type, in
nsidomeventlistener listener, in boolean usecapture); however, it is extremely common to see developers pass a normal javascript function for the listener instead of an
nsidomeventlistener implementation: function doload(event) { // do something here } window.
...is
nsidomeventlistener magical?
...the
nsidomeventlistener interface is "marked" with the function attribute.
...note, that since the javascript function is a single method, this magic only works for callback interfaces with a single method, like
nsidomeventlistener.
Storage access policy: Block cookies from trackers
co
nsider the following examples: hostname on the list hostname of resource matched example.com example.com yes example.com a.b.example.com yes blah.example.com example.com no a.b.example.com c.d.example.com no blah.example.com foo.blah.example.com yes what does the storage access policy block?
... co
nsider the following embedding scenarios on a top-level page loaded from example.com on which tracker.example has been granted storage access.
...these providers should co
nsider switching to explicitly request storage access through the storage access api as soon as possible.
...co
nsider the following examples: you run an ad on a social media website that is seen several times by a user, but never clicked.
Embedding Tips
nscomptr<nsiwindowwatcher> wwatch(do_getservice(ns_windowwatcher_contractid)); if (wwatch) { wwatch->setwindowcreator(mywindowcreator); } i need the javascript i
nside the browser window to talk to my embedding client.
... specify a profile directory in your implementation of
nsidirectoryserviceprovider passed to xre_initembedding.
... nscomptr<
nsidomdocument> doc; nscomptr<
nsidomwindow> window; webbrowser->getcontentdomwindow(getter_addrefs(window)); if (window) { window->getdocument(getter_addrefs(doc)); } what is the docshell?
... nscomptr<nsicommandmanager> commandmanager = do_getinterface(iwebbrowser); if (commandmanager) { nscomptr<
nsidomwindow> thedomwindow = do_getinterface(iwebbrowser); nscomptr<nsicommandparams> cmdparamsobj = do_createinstance(ns_command_params_contractid,&rv); cmdparamsobj->setisupportsvalue("addhook", reinterpret_cast<nsisupports*>(ichromeimplementation)); commandmanager->docommand("cmd_clipboarddragdrophook", cmdparamsobj, thedomwindow); } ...
FileUtils.jsm
perms_directory 0755 default permissions when creating directories methods getfile() gets a file at the specified hierarchy under a
nsidirectoryservice key.
... nsifile getfile( string key, array patharray, bool followlinks ); parameters key the
nsidirectoryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key.
... getdir() gets a directory at the specified hierarchy under a
nsidirectoryservice key.
... nsifile getdir( string key, array patharray, bool shouldcreate, bool followlinks ); parameters key the
nsidirectoryservice key to start from (see getting special files for more info) patharray an array of path components to locate beneath the directory specified by key.
Task.jsm
you can use the yield operator i
nside the generator function to wait on a promise, spawn another task, or propagate a value: let resolutionvalue = yield (promise/generator/iterator/value); if you specify a promise, the yield operator returns its resolution value as soon as the promise is resolved.
... method overview function async(atask); promise spawn(atask); properties attribute type description result read only constructor constructs a special exception that, when thrown i
nside a legacy generator function, allows the associated task to be resolved with a specific value.
... try { let info = yield os.file.stat(path); console.log("the .mozconfig file is " + info.size + " bytes long."); } catch (ex if ex instanceof os.file.error && ex.becausenosuchfile) { console.log("you don't have .mozconfig in " + currentdir); } }).then(null, components.utils.reporterror); in this example, if the promise returned by os.file.stat is rejected, an exception is thrown i
nside the task.
... any other unhandled exception that is thrown i
nside the task is reported by components.utils.reporterror.
Localizing without a specialized tool
assuming that you have installed mercurial, issue the following command: $ hg clone http://hg.mozilla.org/releases/mozilla-1.9.2 this will pull the mozilla 1.9.2 sources from the remote repository and create a mercurial clone in mozilla-1.9.2 i
nside your working directory.
... next, again in your working dir, create a directory that will serve as localization base: $ mkdir l10n-mozilla-1.9.2 $ cd l10n-mozilla-1.9.2 i
nside this directory you will put all the localization files in a folder named after your locale, e.g.
... you can always check the path by typing pwd once you are in the root working directory with both en-us source and the l10n base, copy the searchbar.dtd file by typing cp mozilla-1.9.2/browser/locales/chrome/browser/searchbar.dtd l10n-mozilla-1.9.2/x-testing/browser/chrome/browser/ open the file in your x-testing directory and translate the words i
nside the quotation marks.
... each time you see a directory or set of sub-directories, you will need to run the mkdir command i
nside your locale directory and then copy the .dtd or .properties files into that directory.
GCIntegration - SpiderMonkey Redirect 1
if there is a choice between storing a gc thing i
nside a c++ object or its js corresponding representation, prefer to store it in the js representation.
...co
nsider the following example.
... to understand the problem more, let's co
nsider some reasons why barriers 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.
...to see how weak pointers can cause trouble, co
nsider the following situation: {{ svg{source: "http://people.mozilla.org/~wmccloskey/incremental2.svg", embedding: "iframe", height:"130"} }} in the left frame, a has a weak pointer to c.
Exact Stack Rooting
storing a gcpointer in a gcthing storing your gcpointer i
nside of a gcthing that is already in the liveset is the easiest way to keep a gcthing to the liveset.
...instead, every pointer on the cstack should be co
nsidered part of the rootset.
...the dow
nside of this efficiency is that gcpointers must be added to and removed from this rootedset tracking structure in lifo order.
...this is not a terribly safe option for embedder code, so only co
nsider this as a very last resort.
TPS Bookmark Lists
loadi
nsidebar: true or false.
...the properties for this object include the uri, title, loadi
nsidebar, description, tags, keyword properties above, plus two additional properties: location: the full path of the folder that the bookmark should be moved to position: the title of the existing bookmark item, in the current folder, where this bookmark should be moved to (i.e., this bookmark would be inserted into the bookmark list at the position of the named bookmark, causing that bookmark to be...
... positioned below the current one) example: { uri: "http://www.google.com", title: "google", loadi
nsidebar: false, tags: [ "google", "computers", "misc" ] } livemark objects valid properties are: livemark: the livemark name.
...if a location property exists i
nside the changes object, it is applied before the position property.
mozIThirdPartyUtil
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean isthirdpartychannel(in nsichannel achannel, [optional] in nsiuri auri); boolean isthirdpartyuri(in nsiuri afirsturi, in nsiuri aseconduri); boolean isthirdpartywindow(in
nsidomwindow awindow, [optional] in nsiuri auri); methods isthirdpartychannel() determine whether the given channel and its content window hierarchy is third party.
...obtain the bottommost
nsidomwindow, and its same-type parent if it exists, from the channel's notification callbacks.
...(this means that nested iframes with different base domains, even though the bottommost and topmost uris might be equal, will be co
nsidered third party.) for example, if auri is "http://mail.google.com/", 'awindow' has a uri of "http://google.com/", and its parent is the topmost content window with a uri of "http://mozilla.com", the result will be true.
... boolean isthirdpartywindow( in
nsidomwindow awindow, in nsiuri auri optional ); parameters awindow the bottommost window in the hierarchy.
nsIAccessibleDocument
you can also get one from nsiaccessnode.getaccessibledocument() or nsiaccessibleevent.getaccessibledocument() method overview nsiaccessible getaccessibleinparentchain(in
nsidomnode adomnode, in boolean acancreate); obsolete since gecko 2.0 nsiaccessnode getcachedaccessnode(in voidptr auniqueid); native code only!
... domdocument
nsidomdocument the
nsidomdocument interface associated with this document.
... window
nsidomwindow the
nsidomwindow that the document resides in.
... nsiaccessible getaccessibleinparentchain( in
nsidomnode adomnode, in boolean acancreate ); parameters adomnode the dom node we need an accessible for.
nsIFeedTextConstruct
method overview
nsidomdocumentfragment createdocumentfragment(in
nsidomelement element); astring plaintext(); attributes attribute type description base nsiuri if the text construct contains html or xhtml, relative references in the content should be resolved against this base uri.
...
nsidomdocumentfragment createdocumentfragment( in
nsidomelement element ); parameters element the element in which to create the new document fragment.
... return value an
nsidocumentfragment containing the text and markup.
... see also
nsidomelement
nsidocumentfragment interwiki link ...
nsIMicrosummaryGenerator
1.0 66 introduced gecko 1.8 obsolete gecko 6.0 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview long calculateupdateinterval(in
nsidomnode apagecontent); boolean equals(in nsimicrosummarygenerator aother); astring generatemicrosummary(in
nsidomnode apagecontent); attributes attribute type description loaded boolean has the generator itself (which may be a remote resource) been loaded.
...long calculateupdateinterval( in
nsidomnode apagecontent ); parameters apagecontent the content of the page being summarized.
...generators are co
nsidered equal if their canonical locations (uri attribute) are equal.
...astring generatemicrosummary( in
nsidomnode apagecontent ); parameters apagecontent the content of the page being summarized.
nsIParserUtils
implemented by: @mozilla.org/parserutils;1 as a service: var parserutils = components.classes["@mozilla.org/parserutils;1"] .getservice(components.interfaces.nsiparserutils); method overview astring converttoplaintext(in astring src, in unsigned long flags, in unsigned long wrapcol);
nsidomdocumentfragment parsefragment(in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, in
nsidomelement element); astring sanitize(in astring src, in unsigned long flags); constants constant value description sanitizerallowcomments (1 << 0) flag for sanitizer: allow comment nodes.
... astring converttoplaintext( in astring src, in unsigned long flags, in unsigned long wrapcol ); parameters src the html source to parse (c++ callers are allowed but not required to use the same string for the return value.) flags conversion option flags defined in
nsidocumentencoder.
...
nsidomdocumentfragment parsefragment( in astring fragment, in unsigned long flags, in boolean isxml, in nsiuri baseuri, in
nsidomelement element ); parameters fragment the input markup.
... return value an
nsidomdocumentfragment object for the resulting sanitized document fragment.
nsISelection2
method overview void getrangesforinterval(in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out
nsidomrange results); void getrangesforintervalcomarray(in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results); native code ...
... void getrangesforinterval( in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, out pruint32 resultcount, [retval, array, size_is(resultcount)] out
nsidomrange results ); parameters beginnode beginoffset endnode endoffset these four parameters represent the range to compare against the selection.
... native code only!getrangesforintervalcomarray void getrangesforintervalcomarray( in
nsidomnode beginnode, in print32 beginoffset, in
nsidomnode endnode, in print32 endoffset, in prbool allowadjacent, in rangearray results ); parameters beginnode beginoffset endnode endoffset these four parameters represent the range to compare against the selection.
... void scrollintoview( in short aregion, in boolean aissynchronous, in short avpercent, in short ahpercent ); parameters aregion the region i
nside the selection to scroll into view (see selection region constants defined in nsiselectioncontroller).
nsITreeView
method overview boolean candrop(in long index, in long orientation, in
nsidomdatatransfer datatransfer); boolean candropbeforeafter(in long index, in boolean before); obsolete since gecko 1.8 boolean candropon(in long index); obsolete since gecko 1.8 void cyclecell(in long row, in nsitreecolumn col); void cycleheader(in nsitreecolumn col); void drop(in long row, in long orientation, in
nsidomdatatransfer datatransfer); ...
... boolean candrop( in long index, in long orientation, in
nsidomdatatransfer datatransfer ); parameters index the index of the row.
... void drop( in long row, in long orientation, in
nsidomdatatransfer datatransfer ); parameters row the index of the row.
...for very simple tree views, such as those without multi-level data, you might want to co
nsider using something simpler than a tree view, such as a listbox.
nsIWebBrowserPersist
to create an instance, use: var webbrowserpersist = components.classes["@mozilla.org/embedding/browser/nswebbrowserpersist;1"] .createinstance(components.interfaces.nsiwebbrowserpersist); method overview void cancelsave(); void savechannel(in nsichannel achannel, in nsisupports afile); void savedocument(in
nsidomdocument adocument, in nsisupports afile, in nsisupports adatapath, in string aoutputcontenttype, in unsigned long aencodingflags, in unsigned long awrapcolumn); void saveuri(in nsiuri auri, in nsisupports acachekey, in nsiuri areferrer, in long areferrerpolicy, in nsiinputstream apostdata, in string aextraheaders, in nsisupports afile, in nsiloadcontext aprivacycontext); void ...
...implies wrap (except i
nside <pre>), since html wraps.
... void savedocument( in
nsidomdocument adocument, in nsisupports afile, in nsisupports adatapath, in string aoutputcontenttype, in unsigned long aencodingflags, in unsigned long awrapcolumn ); parameters adocument document to save to file.
... saveprivacyawareuri() save the specified uri to file, explicitly dictating whether the operation should be co
nsidered private for the purposes of network requests, caching, etc.
nsIXSLTProcessor
to create an instance, use: var xsltprocessor = components.classes["@mozilla.org/document-transformer;1?type=xslt"] .createinstance(components.interfaces.nsixsltprocessor); method overview void clearparameters(); nsivariant getparameter(in domstring namespaceuri, in domstring localname); void importstylesheet(in
nsidomnode style); void removeparameter(in domstring namespaceuri, in domstring localname); void reset(); void setparameter(in domstring namespaceuri, in domstring localname, in nsivariant value);
nsidomdocument transformtodocument(in
nsidomnode source);
nsidomdocumentfragment transformtofragment(in
nsidomnode source, in
nsidomdocument output); methods clearparameters() removes all set pa...
...void importstylesheet( in
nsidomnode style ); parameters style the root-node of a xslt stylesheet.
...
nsidomdocument transformtodocument( in
nsidomnode source ); parameters source the node to be transformed.
...
nsidomdocumentfragment transformtofragment( in
nsidomnode source, in
nsidomdocument output ); parameters source the node to be transformed.
nsIXULBrowserWindow
method overview astring onbeforelinktraversal(in astring originaltarget, 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.
...astring onbeforelinktraversal( in astring originaltarget, in nsiuri linkuri, in
nsidomnode linknode, in prbool isapptab ); parameters originaltarget the specified target for the link.
...linknode the
nsidomnode representing the dom node in which the link is located.
...void setoverlink( in astring link, in
nsidomelement element ); parameters link the link string.
nsIXULWindow
void assumechromeflagsarefrozen(); void center(in nsixulwindow arelative, in boolean ascreen, in boolean aalert); nsixulwindow createnewwindow(in print32 achromeflags, in nsiappshell aappshell);
nsidocshelltreeitem getcontentshellbyid(in wstring id); void removechildwindow(in nsixulwindow achild); void showmodal(); attributes attribute type description chromeflags pruint32 chromeflags are from nsiwebbrowserchrome.
... docshell
nsidocshell the docshell owning the xul for this window.
... primarycontentshell
nsidocshelltreeitem the primary content shell.
...
nsidocshelltreeitem getcontentshellbyid( in wstring id ); parameters id the id of the content shell, which is the same as the "type" attribute on the containing frame element.
XPCOM Interface Reference
licynsicontentsniffernsicontentviewnsicontentviewmanagernsicontentviewernsicontrollernsicontrollersnsiconverterinputstreamnsiconverteroutputstreamnsicookiensicookie2nsicookieacceptdialognsicookieconsentnsicookiemanagernsicookiemanager2nsicookiepermissionnsicookiepromptservicensicookieservicensicookiestoragensicrashreporternsicryptohmacnsicryptohashnsicurrentcharsetlistenernsicyclecollectorlistener
nsidbchangelistener
nsidbfolderinfo
nsidnslistener
nsidnsrecord
nsidnsrequest
nsidnsservice
nsidomcanvasrenderingcontext2d
nsidomchromewindow
nsidomclientrect
nsidomdesktopnotification
nsidomdesktopnotificationcenter
nsidomelement
nsidomevent
nsidomeventgroup
nsidomeventlistener
nsidomeventtarget
nsidomfile
nsidomfileerror
nsidomfileexception
nsidomfilelist
nsidomfilereader
nsidomfontface
nsidomfontfacelist
nsidomgeogeoloca...
...tion
nsidomgeoposition
nsidomgeopositionaddress
nsidomgeopositioncallback
nsidomgeopositioncoords
nsidomgeopositionerror
nsidomgeopositionerrorcallback
nsidomgeopositionoptions
nsidomglobalpropertyinitializer
nsidomhtmlaudioelement
nsidomhtmlformelement
nsidomhtmlmediaelement
nsidomhtmlsourceelement
nsidomhtmltimeranges
nsidomjswindow
nsidommousescrollevent
nsidommoznetworkstats
nsidommoznetworkstatsdata
nsidommoznetworkstatsmanager
nsidommoztouchevent
nsidomnshtmldocument
nsidomnavigatordesktopnotification
nsidomnode
nsidomofflineresourcelist
nsidomorientationevent
nsidomparser
nsidomprogressevent
nsidomserializer
nsidomsimplegestureevent
nsidomstorage
nsidomstorage2
nsidomstorageeventobsolete
nsidomstorageitem
nsidomstoragelist
nsidomstoragemanager
nsidomstoragewindow
nsidomuserdatahandler
nsidomwindow
nsidomwindow2
nsidomwindowi...
...nternal
nsidomwindowutils
nsidomxpathevaluator
nsidomxpathexception
nsidomxpathexpression
nsidomxpathresult
nsidomxulcontrolelement
nsidomxulelement
nsidomxullabeledcontrolelement
nsidomxulselectcontrolelement
nsidomxulselectcontrolitemelement
nsidatasignatureverifier
nsidebug
nsidebug2
nsidevicemotion
nsidevicemotiondata
nsidevicemotionlistener
nsidialogcreator
nsidialogparamblock
nsidictionary
nsidirindex
nsidirindexlistener
nsidirindexparser
nsidirectoryenumerator
nsidirectoryiterator
nsidirectoryservice
nsidirectoryserviceprovider
nsidirectoryserviceprovider2
nsidiskcachestreaminternal
nsidispatchsupport
nsidocshell
nsidocumentloader
nsidownload
nsidownloadhistory
nsidownloadmanager
nsidownloadmanagerui
nsidownloadobserver
nsidownloadprogresslistener
nsidownloader
nsidragdrophandler
nsidragservice
nsidragsession
nsidroppedlinkhand...
...ler
nsidroppedlinkitem
nsidynamiccontainernsieditornsieditorboxobjectnsieditordocshellnsieditorimesupportnsieditorloggingnsieditormailsupportnsieditorobservernsieditorspellchecknsieffectivetldservicensienumeratornsienvironmentnsierrorservicensieventlistenerinfonsieventlistenerservicensieventsourcensieventtargetnsiexceptionnsiextensionmanagernsiexternalhelperappservicensiexternalprotocolservicensiexternalurlhandlerservicensiftpchannelnsiftpeventsinknsifactorynsifavicondatacallbacknsifaviconservicensifeednsifeedcontainernsifeedelementbasensifeedentrynsifeedgeneratornsifeedpersonnsifeedprocessornsifeedprogresslistenernsifeedresultnsifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotocolhandlernsifilespecnsifilestreamsnsifileurlnsifileutilities...
Storage Inspector - Firefox Developer Tools
cookies — all the cookies created by the page or any iframes i
nside of the page.
... indexeddb — all indexeddb databases created by the page or any iframes i
nside the page, their object stores and the items stored in these object stores.
... local storage — all local storage items created by the page or any iframes i
nside the page.
... session storage — all session storage items created by the page or any iframes i
nside the page.
AbstractRange - Web APIs
contents of elements when trying to access the contents of an element, keep in mind that the element itself is a node, but so is any text i
nside it.
... in order to set a range endpoint within the text of an element, be sure to find the text node i
nside the element: let startelem = document.queryselector("p"); let endelem = startelem.queryselector("span"); let range = document.createrange(); range.setstart(startelem, 0); range.setend(endelem, endelem.childnodes[0].length/2); let contents = range.clonecontents(); document.body.appendchild(contents); this example creates a new range, rng, and sets its starting point to the third child node of the first element whose class is elementclass.
... to illustrate this, co
nsider the html below: <div class="container"> <div class="header"> <img src="" class="sitelogo"> <h1>the ultimate website</h1> </div> <article> <section class="entry" id="entry1"> <h2>section 1: an interesting thing...</h2> <p>a <em>very</em> interesting thing happened on the way to the forum...</p> <aside class="callout"> <h2>aside</h2> <p>an inte...
... example co
nsider this simple html fragment of html.
CanvasRenderingContext2D - Web APIs
fill and stroke styles fill styling is used for colors and styles i
nside shapes and stroke styling is used for the lines around shapes.
... canvasrenderingcontext2d.fillstyle color or style to use i
nside shapes.
...everything drawn after clip() is called appears i
nside the clipping path only.
... canvasrenderingcontext2d.ispointinstroke() reports whether or not the specified point is i
nside the area contained by the stroking of a path.
Element.insertAdjacentHTML() - Web APIs
it does not reparse the element it is being used on, and thus it does not corrupt the existing elements i
nside that element.
... 'afterbegin': just i
nside the element, before its first child.
... 'beforeend': just i
nside the element, after its last child.
... example // <div id="one">one</div> var d1 = document.getelementbyid('one'); d1.insertadjacenthtml('afterend', '<div id="two">two</div>'); // at this point, the new structure is: // <div id="one">one</div><div id="two">two</div> notes security co
nsiderations when inserting html into a page by using insertadjacenthtml(), be careful not to use user input that hasn't been escaped.
Element.querySelector() - Web APIs
the entire hierarchy of elements is co
nsidered when matching, including those outside the set of elements including baseelement and its descendants; in other words, selectors is first applied to the whole document, not the baseelement, to generate an initial list of potential elements.
... examples let's co
nsider a few examples.
... find a specific element with specific values of an attribute in this first example, the first <style> element which either has no type or has type "text/css" in the html document body is returned: var el = document.body.queryselector("style[type='text/css'], style:not([type])"); the entire hierarchy counts this example demonstrates that the hierarchy of the entire document is co
nsidered when applying selectors, so that levels outside the specified baseelement are still co
nsidered when locating matches.
... html <div> <h5>original content</h5> <p> i
nside paragraph <span>i
nside span</span> i
nside paragraph </p> </div> <div> <h5>output</h5> <div id="output"></div> </div> javascript var baseelement = document.queryselector("p"); document.getelementbyid("output").innerhtml = (baseelement.queryselector("div span").innerhtml); result the result looks like this: notice how the "div span" selector still successfully matches the <span> element, even though the baseelement's child nodes do not include the div element (it is still part of the specified selector).
EventTarget.addEventListener() - Web APIs
handler, nonepassive); function oncehandler(event) { alert('outer, once'); } function noneoncehandler(event) { alert('outer, none-once, default'); } function capturehandler(event) { //event.stopimmediatepropagation(); alert('middle, capture'); } function nonecapturehandler(event) { alert('middle, none-capture, default'); } function passivehandler(event) { // unable to preventdefault i
nside passive event listener invocation.
... if attaching a handler function to an element using addeventlistener(), the value of this i
nside the handler is a reference to the element.
...</table> note that the value of this i
nside a function, called by the code in the attribute value, behaves as per standard rules.
...co
nsider this example.
Capabilities, constraints, and settings - Web APIs
however, if you use simple values for properties when calling mediastreamtrack.applyconstraints(), the request will always succeed, because these values will be co
nsidered a request, not a requirement.
... advanced constraints so-called advanced constraints are created by adding an advanced property to the constraint set; this property's value is an array of additional constraint sets which are co
nsidered optional.
...the browser should do its best to match these settings but will settle for anything it co
nsiders a close match.
... when that happens, we know the video has started playing, so we call our getcurrentsettings() function (described above) to display the actual settings that the browser decided upon after co
nsidering our constraints and the capabilities of the hardware.
RTCPeerConnection - Web APIs
rtcicetransportpolicy enum the rtcicetransportpolicy enum defines string constants which can be used to limit the transport policies of the ice candidates to be co
nsidered during the connection process.
... constant description "all" all ice candidates will be co
nsidered.
... "public" only ice candidates with public ip addresses will be co
nsidered.
... "relay" only ice candidates whose ip addresses are being relayed, such as those being passed through a turn server, will be co
nsidered.
Reporting API - Web APIs
reporting observers reports can also be obtained via reportingobserver objects created via javascript i
nside the website you are aiming to get reports on.
... a reportingobserver object is created using the reportingobserver() constructor, which is passed two parameters: a callback function that has available as parameters the reports available in the observer's report queue, and a copy of the same reportingobserver object, so observation can be controlled directly from i
nside the callback.
...web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to start observing reports using reportingobserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified i
nside the constructor: observer.observe(); later on in the example we deliberately use the deprecated version of mediadevices.getusermedia(): if(navigator.mozgetusermedia) { navigator.mozgetusermedia( constraints, success, failure); } else { navigator.getusermedia( constraints, success, failure); } this causes a deprecation report to be generated; because of the event h...
...andler we set up i
nside the reportingobserver() constructor, we can now click the button to display the report details.
SVGSVGElement - Web APIs
each candidate graphics element is to be co
nsidered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.
...each candidate graphics element is to be co
nsidered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.
...each candidate graphics element is to be co
nsidered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.
...each candidate graphics element is to be co
nsidered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.
Screen.lockOrientation() - Web APIs
a screen is co
nsidered in its primary portrait mode if the device is held in its normal position and that position is in portrait, or if the normal position of the device is in landscape and the device held turned by 90° clockwise.
...a screen is co
nsidered in its secondary portrait mode if the device is held 180° from its normal position and that position is in portrait, or if the normal position of the device is in landscape and the device held is turned by 90° anticlockwise.
...a screen is co
nsidered in its primary landscape mode if the device is held in its normal position and that position is in landscape, or if the normal position of the device is in portrait and the device held is turned by 90° clockwise.
...a screen is co
nsidered in its secondary landscape mode if the device held is 180° from its normal position and that position is in landscape, or if the normal position of the device is in portrait and the device held is turned by 90° anticlockwise.
SourceBuffer - Web APIs
sourcebuffer.audiotracks read only a list of the audio tracks currently contained i
nside the sourcebuffer.
... sourcebuffer.texttracks read only a list of the text tracks currently contained i
nside the sourcebuffer.
... sourcebuffer.timestampoffset controls the offset applied to timestamps i
nside media segments that are subsequently appended to the sourcebuffer.
... sourcebuffer.videotracks read only a list of the video tracks currently contained i
nside the sourcebuffer.
WebGL model view projection - Web APIs
co
nsider our camera, which is viewing an area that starts immediately in front of its lens and extends off into the distance.
...finally it's very helpful to have a fine-tuned control over what points get placed i
nside and outside of clip space.
... co
nsider a box sitting on a table and a camera resting on the table one meter away, pointed at the box, the front of which is pointed toward the camera.
... then co
nsider moving the camera away from the box until it's two meters away (by adding a meter to the camera's z position), then sliding it 10 centimeters to the its left.
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
the first and most important thing to understand when co
nsidering the code to manage point-of-view and cameras in your application is this: webxr does not have cameras.
... there's another aspect of the spatial relationship of an object to the origin in space left to be co
nsidered: perspective.
...you should strongly co
nsider using one instead of directly using webgl.
... for example, co
nsider a device which uses a 2560x1440 pixel frame buffer.
Web Audio API best practices - Web APIs
as long as you co
nsider security, performance, and accessibility, you can adapt to your own style.
... autoplay policy browsers have started to implement an autoplay policy, which in general can be summed up as: "create or resume context from i
nside a user gesture".
... when working with an audiocontext, if you create the audio context from i
nside a click event the state should automatically be set to running.
... here is a simple example of creating the context from i
nside a click event: const button = document.queryselector('button'); button.addeventlistener('click', function() { const audioctx = new audiocontext(); }, false); if however, you create the context outside of a user gesture, its state will be set to suspended and it will need to be started after user interaction.
Window.prompt() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetpromptchrome full support 1notes full support 1notes notes starting with chrome 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 4notes full support 4notes notes this function has no effect in the modern ui/metro version...
...desktop versions of ie do implement this function.opera full support 3notes full support 3notes notes starting with opera 33, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1webview android full support 1notes full support 1notes notes starting with webview 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value ...
...allow-modals.chrome android full support 18notes full support 18notes notes starting with chrome 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android full support 4opera android full support 10.1notes full support 10.1notes notes starting with opera 33, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0note...
...s full support 1.0notes notes starting with samsung internet 5.0, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.legend full support full supportsee implementation notes.see implementation notes.
ARIA: application role - Accessibility
associated wai-aria roles, states, and properties document, article used to indicate parts of the application that should be treated as normal web content aria-activedescendant used to manage focus i
nside the application.
...the one exception is if focus is set to a standard widget i
nside the application that supports keyboard navigation from the browser, for example an input element.
... required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus i
nside the application container.
...the author of the application must take full responsibility for not letting users get stuck in a focus limbo or trap focus i
nside something the user cannot exit of.
ARIA: figure role - Accessibility
the aria figure role can be used to identify a figure i
nside page content where appropriate semantics do not already exist.
... a figure is generally co
nsidered 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.
... instead of using aria to create a figure, co
nsider using the native, semantic html <figure> element.
...you could add an id to an element containing content that describes the figure, and then reference that id i
nside an appropriate attribute on the figure to associate the figure with the label: <div role="figure" aria-labelledby="figure-1"> ...
Accessibility
this article starts off the module with a good look at what accessibility actually is — this includes what groups of people we need to co
nsider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow.
...this article outlines some css and javascript best practices that should be co
nsidered to ensure even complex content is as accessible as possible.
... 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 co
nsider the accessibility of your web content on these platforms.
... this article looks at mobile-specific accessibility co
nsiderations.
:host() - CSS: Cascading Style Sheets
the :host() css pseudo-class function selects the shadow host of the shadow dom containing the css it is used i
nside (so you can select a custom element from i
nside its shadow dom) — but only if the selector given as the function's parameter matches the shadow host.
...you can't use this with a descendant selector expression to select only instances of the custom element that are i
nside a particular ancestor.
... in this example we have a simple custom element — <context-span> — that you can wrap around text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> i
nside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot = this.attachshadow({mode: 'open'}); shadowroot.appendchild(style); shadowroot.appendchild...
..., aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; the :host(.footer) { color : red; } rule styles all instances of the <context-span> element (the shadow host in this instance) in the document that have the footer class set on them — we've used it to give instances of the element i
nside the <footer> a special color.
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
justify-self the justify-self property is used to align an item i
nside its containing block on the inline axis.
... aligning in these layout methods today as we do not currently have browser support for box alignment in block layout, your options for alignment are either to use one of the existing alignment methods or, to make even a single item i
nside a container a flex item in order to use the alignment properties as specified in flexbox.
...a margin of auto will absorb all available space in that dimension, therefore setting a left and right margin of auto, you can push a block into the center: .container { width: 20em; margin-left: auto; margin-right: auto; } in table layout, you have access to the vertical-align property to align the contents of a cell i
nside that cell.
...in the example below, a container with a single item i
nside has been turned into a flex container for the purpose of being able to use the alignment properties.
Handling content breaks in multicol - CSS: Cascading Style Sheets
there are various places we might want to control our breaks: breaks i
nside boxes, for example i
nside a figure element.
... breaks i
nside boxes to control breaks i
nside boxes use the break-i
nside property.
... this property takes values of: auto avoid avoid-page avoid-column avoid-region in the example below, we have applied break-i
nside to the figure element to prevent the caption from becoming separated from the image.
...note that these properties only work i
nside a block container, such as a paragraph.
Spanning and Balancing Columns - CSS: Cascading Style Sheets
in this guide we look at how to make elements span across columns i
nside the multicol container and how to control how the columns are filled.
...for example, a heading nested directly i
nside the container could become a spanner, as could a heading nested i
nside a section nested i
nside the multicol container.
... in this second example, the heading is i
nside an <article> element, yet still spans the content as expected.
... things to watch out for if the spanning element is i
nside another element which has margins, padding and a border or a background color, it is possible to end up with the top of the box appearing above the spanner and the rest displaying below, as shown in the next example.
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
when a flex container has positive free space, it has more space than is required to display the flex items i
nside the container.
...let's co
nsider the case of three flex items of differing content lengths and the following flex rules applied to them: flex: 1 1 auto; in this case the flex-basis value is auto and the items don’t have a width set, and so are auto-sized.
...co
nsider the following aspects, which we have already discussed in these guides: what sets the base size of the item?
...if so then the item size is not taken into co
nsideration for the space-sharing calculation.
Typical use cases of Flexbox - CSS: Cascading Style Sheets
it forms the most simple of flexbox examples, and could be co
nsidered the ideal flexbox use case.
...we either display the space outside of the items — therefore spacing them out with white space between or around them — or we absorb the extra space i
nside the items and therefore need a method of allowing the items to grow and take up this space.
...for now however, if you need to properly centre one thing i
nside another, flexbox is the way to do it.
...any content i
nside uses regular block layout, meaning that on a card with less content the footer will rise up to the bottom of the content rather than stick to the bottom of the card.
Overview of CSS Shapes - CSS: Cascading Style Sheets
there are a number of ways to create these shapes and in these guides we will find out how css shapes work, and co
nsider some ways you might like to use them.
...this means we can keep things used for styling i
nside the css.
... future css shapes features the initial shapes specification included a property shape-i
nside for creating shapes i
nside an element.
...as the shape-i
nside property was initially in level 1 of the specification, you may find tutorials on the web detailing both properties.
CSS reference - CSS: Cascading Style Sheets
ft-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottom@bottom-centerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-i
nsidebrightness()ccalc()caption-sidecaret-colorch@character-variantcharacter-variant()@charset:checkedcircle()clamp()clearclipclip-pathcm<color>colorcolor-adjustcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnsconic-gradient()containcontentcontrast()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cros...
...s-fade()cubic-bezier()::cue::cue-regioncursor<custom-ident>d:defaultdeg<dimension>:dirdirection:disableddisplay<display-box><display-i
nside><display-internal><display-legacy><display-listitem><display-outside>dpcmdpidppxdrop-shadow()eelement()ellipse()em:emptyempty-cells:enabledenv()exffallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloat:focusfont@font-facefont-familyfont-family (@font-face)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-sizefont-size-adjustfont-stretchfont-stretch (@font-face)font-stylefont-style (@font-face)font-synthesi...
...rflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-yppad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepage-break-afterpage-break-beforepage-break-i
nsidepaint()paint-orderpath()pc<percentage>perspectiveperspective()perspective-originplace-contentplace-itemsplace-self::placeholderpointer-eventspolygon()<position>positionprefix (@counter-style)ptpxqqquotesrradradial-gradient()range (@counter-style)<ratio>:read-only:read-writerect()remrepeat()repeating-linear-gradient()repeating-radial-gradient():requiredresize<resolution>revertrgb()rgba():rightrigh...
...elements which span multiple columns are co
nsidered to be a member of all of those columns.
Viewport concepts - CSS: Cascading Style Sheets
the area within the innerheight and innerwidth is generally co
nsidered the layout viewport.
... the browser chrome is not co
nsidered part of the viewport.
...any sub-viewport that is fully or partially displayed within the layout viewport is co
nsidered a visual viewport.
... <iframe> i
nside an iframe, the visual viewport is the size of the inner width and height of the iframe, rather than the parent document.
break-after - CSS: Cascading Style Sheets
oid-column; break-after: column; /* region break values */ break-after: avoid-region; break-after: region; /* global values */ break-after: inherit; break-after: initial; break-after: unset; each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the previous element, the break-before value of the next element, and the break-i
nside value of the containing element.
...if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-i
nside value).
...if we are i
nside a multicol container then it would force a column break, i
nside paged media (but not i
nside a multicol container) a page break.
...so a break i
nside a multicol container, which was i
nside a page container would force a column and page break.
break-before - CSS: Cascading Style Sheets
lumn; break-before: column; /* region break values */ break-before: avoid-region; break-before: region; /* global values */ break-before: inherit; break-before: initial; break-before: unset; each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the previous element, the break-before value of the next element, and the break-i
nside value of the containing element.
...if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-i
nside value).
...if we are i
nside a multicol container then it would force a column break, i
nside paged media (but not i
nside a multicol container) a page break.
...so a break i
nside a multicol container, which was i
nside a page container would force a column and page break.
justify-items - CSS: Cascading Style Sheets
the effect of this property is dependent of the layout mode we are in: in block-level layouts, it aligns the items i
nside their containing block on the inline axis.
... for absolutely-positioned elements, it aligns the items i
nside their containing block on the inline axis, accounting for the offset values of top, left, bottom, and right.
... in table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns the items i
nside their grid areas on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-items: auto; justify-items: normal; justify-items: stretch; /* positional alignment */ justify-items: center; /* pack items around the center */ justify-items: start; /* pack items from the start */ justify-items: end; /* pack items from the end */ justify-items: flex-start; /* equivalent to 'start'.
...note that if a descendant has a justify-self: auto value, the legacy keyword is not co
nsidered by the descend, only the left, right, or center value associated to it.
justify-self - CSS: Cascading Style Sheets
the css justify-self property sets the way a box is justified i
nside its alignment container along the appropriate axis.
... the effect of this property is dependent of the layout mode we are in: in block-level layouts, it aligns an item i
nside its containing block on the inline axis.
... for absolutely-positioned elements, it aligns an item i
nside its containing block on the inline axis, accounting for the offset values of top, left, bottom, and right.
... in table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns an item i
nside its grid area on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-self: auto; justify-self: normal; justify-self: stretch; /* positional alignment */ justify-self: center; /* pack item around the center */ justify-self: start; /* pack item from the start */ justify-self: end; /* pack item from the end */ justify-self: flex-start; /* equivalent to 'start'.
Event reference
pointerenter pointerevent pointer events pointing device is moved i
nside the hit-testing boundary.
... mozbrowsercaretstatechanged firefox os browser api-specific sent when the text selected i
nside the browser <iframe> content changes.
... mozbrowserselectionstatechanged firefox os browser api-specific sent when the text selected i
nside the browser <iframe> content changes.
... domlinkremoved addons specific a link has been removed i
nside from a document.
A hybrid approach - Developer guides
of course, this technique suffers from all the dow
nsides associated with user-agent detection.
... the bad one dow
nside of mixing approaches is that it can lead to an increase in the number of code paths, both on the client and server side.
...another dow
nside is that because this approach relies on responsive design, it typically works best on a new project or one that has an existing flexible layout, not as a retrofit.
... when it is right to choose this option combining server-side and client-side techniques is something that is always worth co
nsidering; there are so many options that one must just weigh the pros and cons of each individual technique employed.
<input type="date"> - HTML: Hypertext Markup Language
you can set a default value for the input with a date i
nside the value attribute, like so: <input type="date" value="2017-06-01"> the displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd.
...we had to put the icon on a <span> next to the input, not on the input itself, because in chrome at least the input's generated content is placed i
nside the form control, and can't be styled or shown effectively.
...ment.queryselector('#month'); var dayselect = document.queryselector('#day'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'date'; } catch (e) { console.log(e.description); } // if it does, run the code i
nside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the days and years dynamically // (the months are always the same, therefore hardcoded) populatedays(monthselect.value); populateyears(); } function populateda...
...you'll need to take this into co
nsideration when developing production apps.
<input type="month"> - HTML: Hypertext Markup Language
you can set a default value for the input control by including a month and year i
nside the value attribute, like so: <label for="bday-month">what month were you born in?</label> <input id="bday-month" type="month" name="bday-month" value="2017-06"> one thing to note is that the displayed date format differs from the actual value; most user agents display the month and year in a locale-appropriate form, based on the set locale of the user's operating system, whereas the date ...
...we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed i
nside the form control, and can't be styled or shown effectively.
....queryselector('#year'); var monthselect = document.queryselector('#month'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'month'; } catch (e) { console.log(e.description); } // if it does, run the code i
nside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the years dynamically // (the months are always the same, therefore hardcoded) populateyears(); } function populateyears() { // get the current year as a numbe...
...you'll need to take this into co
nsideration when developing production apps.
<input type="tel"> - HTML: Hypertext Markup Language
on all <input> elements regardless of their type, telephone number inputs support the following attributes: attribute description list the id of the <datalist> element that contains the optional pre-defined autocomplete options maxlength the maximum length, in utf-16 characters, to accept as a valid input minlength the minimum length that is co
nsidered valid for the field's contents pattern a regular expression the entered value must match to pass constraint validation placeholder an example value to display i
nside the field when it has no value readonly a boolean attribute which, if present, indicates that the field's contents should not be user-editable size the number of characters wide the...
... fortunately, you can co
nsider the requirements of your own site and implement an appropriate level of validation yourself.
...a placeholder is a value that demonstrates the form the value should take by presenting an example of a valid value, which is displayed i
nside the edit box when the element's value is "".
...let's co
nsider some options.
<input type="week"> - HTML: Hypertext Markup Language
you can set a default value for the input by including a value i
nside the value attribute, like so: <label for="week">what week would you like to start?</label> <input id="week" type="week" name="week" value="2017-w01"> one thing to note is that the displayed format may differ from the actual value, which is always formatted yyyy-www.
...we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed i
nside the form control, and can't be styled or shown effectively.
...yselector('#year'); var weekselect = document.queryselector('#fallbackweek'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'week'; } catch (e) { console.log(e.description); } // if it does, run the code i
nside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the weeks dynamically populateweeks(); } function populateweeks() { // populate the week select with 52 weeks for(var i = 1; i <= 52; i++) { var option = d...
...you'll need to take this into co
nsideration when developing production apps.
<label> - HTML: Hypertext Markup Language
alternatively, you can nest the <input> directly i
nside the <label>, in which case the for and id attributes are not needed because the association is implicit: <label>do you like peas?
...if there are other elements which also match the id value, later in the document, they are not co
nsidered.
... styling with css there are no special styling co
nsiderations for <label> elements — structurally they are simple inline elements, and so can be styled in much the same way as a <span> or <a> element.
... examples simple label example <label>click me <input type="text"></label> using the "for" attribute <label for="username">click me</label> <input type="text" id="username"> accessibility concerns interactive content don't place interactive elements such as anchors or buttons i
nside a label.
<th> - HTML: Hypertext Markup Language
values higher than 1000 will be co
nsidered as incorrect and will be set to the default value (1).
... justify (with text only): the content is stretched out i
nside the cell so that it covers its entire width.
... char (with text only): the content is aligned to a character i
nside the <th> element with minimal offset.
... valign obsolete since html5 this attribute specifies how a text is vertically aligned i
nside a cell.
<video>: The Video Embed element - HTML: Hypertext Markup Language
in a similar manner to the <img> element, we include a path to the media we want to display i
nside the src attribute; we can include other attributes to specify information such as video width and height, whether we want it to autoplay and loop, whether we want to show the browser's default video controls, etc.
... the content i
nside the opening and closing <video></video> tags is shown as a fallback in browsers that don't support the element.
... waiting playback has stopped because of a temporary lack of data usage notes browsers don't all support the same video formats; you can provide multiple sources i
nside nested <source> elements, and the browser will then use the first one it understands.
... there are no special co
nsiderations for styling <video>; a common strategy is to give it a display value of block to make it easier to position, size, etc., and then provide styling and layout information as required.
HTML elements reference - HTML: Hypertext Markup Language
<dt> the html <dt> element specifies a term in a description or definition list, and as such must be used i
nside a <dl> element.
... <rtc> the html ruby text container (<rtc>) element embraces semantic annotations of characters presented in a ruby of <rb> elements used i
nside of <ruby> element.
... element description <slot> the html <slot> element—part of the web components technology suite—is a placeholder i
nside a web component that you can fill with your own markup, which lets you create separate dom trees and present them together.
... <content> the html <content> element—an obsolete part of the web components suite of technologies—was used i
nside of shadow dom as an insertion point, and wasn't meant to be used in ordinary html.
HTTP caching - HTTP
cache-control: private cache-control: public expiration the most important directive here is "max-age=<seconds>" which is the maximum amount of time a resource will be co
nsidered fresh.
...that way each new revision of this resource is co
nsidered as a resource on its own that never changes and that can have an expiration time very far in the future, usually one year or even more.
...it is co
nsidered weak because it only has 1-second resolution.
...when using the vary: user-agent header, caching servers should co
nsider the user agent when deciding whether to serve the page from cache.
Equality comparisons and sameness - JavaScript
if the values have different types, the values are co
nsidered unequal.
... if the values have the same type, are not numbers, and have the same value, they're co
nsidered equal.
... finally, if both values are numbers, they're co
nsidered equal if they're both not nan and are the same value, or if one is +0 and one is -0.
... same-value-zero equality similar to same-value equality, but +0 and -0 are co
nsidered equal.
Control flow and error handling - JavaScript
if break is omitted, the program continues execution i
nside the switch statement (and will evaluate the next case, and so on).
... try { throw 'myexception'; // generates an exception } catch (err) { // statements to handle any exceptions logmyerrors(err); // pass exception object to error handler } best practice: when logging errors to the console i
nside a catch block, using console.error() rather than console.log() is advised for debugging.
... block has completed console.log(2); // not reachable } finally { console.log(3); return false; // overwrites the previous "return" console.log(4); // not reachable } // "return false" is executed now console.log(5); // not reachable } console.log(f()); // 0, 1, 3, false overwriting of return values by the finally block also applies to exceptions thrown or re-thrown i
nside of the catch block: function f() { try { throw 'bogus'; } catch(e) { console.log('caught inner "bogus"'); throw e; // this throw statement is suspended until // finally block has completed } finally { return false; // overwrites the previous "throw" } // "return false" is executed now } try { console.log(f()); } catch(e) { // this is never reached!
... // while f() executes, the `finally` block returns false, // which overwrites the `throw` i
nside the above `catch` console.log('caught outer "bogus"'); } // output // caught inner "bogus" // false nesting try...catch statements you can nest one or more try...catch statements.
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
the javascript warning "javascript 1.6's for-each-in loops are deprecated; co
nsider using es6 for-of instead" occurs when a for each (variable in obj) statement is used.
... message warning: javascript 1.6's for-each-in loops are deprecated; co
nsider using es6 for-of instead error type warning what went wrong?
... deprecated syntax var object = { a: 10, b: 20 }; for each (var x in object) { console.log(x); // 10 // 20 } alternative standard syntax you can now use the standard for...in loop to iterate over specified object keys, and get each value i
nside the loop: var object = { a: 10, b: 20 }; for (var key in object) { var x = object[key]; console.log(x); // 10 // 20 } or, using for...of (es2015) and object.values (es2017), you can get an array of the specified object values and iterate over the array like this: var object = { a: 10, b: 20 }; for (var x of object.values(object)) { console.log(x); ...
... var object = { a: 10, b: 20 }; for each (var [key, value] in iterator(object)) { console.log(key, value); // "a", 10 // "b", 20 } alternative standard syntax you can now use the standard for...in loop to iterate over specified object keys, and get each value i
nside the loop: var object = { a: 10, b: 20 }; for (var key in object) { var value = object[key]; console.log(key, value); // "a", 10 // "b", 20 } or, using for...of (es2015) and object.entries (es2017), you can get an array of the specified object values and iterate over the array like this: var object = { a: 10, b: 20 }; for (var [key, value] of object.entries(...
Functions - JavaScript
here is an example of an anonymous function expression (the name is not used): var myfunction = function() { statements } it is also possible to provide a name i
nside the definition in order to create a named function expression: var myfunction = function namedfunction(){ statements } one of the benefits of creating a named function expression is that in case we encountered an error, the stack trace will contain the name of the function, making it easier to find the origin of the error.
... /* * declare and initialize a variable 'p' (global) * and a function 'myfunc' (to change the scope) i
nside which * declare a varible with same name 'p' (current) and * define three functions using three different ways:- * 1.
...ction foo() {} // function expression (function bar() {}) // function expression x = function hello() {} if (x) { // function expression function world() {} } // function declaration function a() { // function declaration function b() {} if (0) { // function expression function c() {} } } block-level functions in strict mode, starting with es2015, functions i
nside blocks are now scoped to that block.
... in non-strict code, function declarations i
nside blocks behave strangely.
eval() - JavaScript
in a related circumstance, what if you actually wanted your date() function to be able to be called from the code i
nside function().
...co
nsider the following example where the property of the object to be accessed is not known until the code is executed.
... parsing json (converting strings to javascript objects) if the string you're calling eval() on contains data (for example, an array: "[1, 2, 3]"), as opposed to code, you should co
nsider switching to json, which allows the string to use a subset of javascript syntax to represent data.
... run code with limited privileges if you must run the code, co
nsider running it with reduced privileges.
async function - JavaScript
the await keyword is only valid i
nside async functions.
...if there is an await expression i
nside the function body, however, the async function will always complete asynchronously.
...co
nsider the following code: function getprocesseddata(url) { return downloaddata(url) // returns a promise .catch(e => { return downloadfallbackdata(url) // returns a promise }) .then(v => { return processdatainworker(v) // returns a promise }) } it can be rewritten with a single async function as follows: async function getprocesseddata(url) { let v try { v ...
... co
nsider the following rewrite of the above code.
JavaScript typed arrays - JavaScript
multiple views on the same data things start to get really interesting when you co
nsider that you can create multiple views onto the same data.
...co
nsider this: int16view[0] = 32; console.log('entry 0 in the 32-bit array is now ' + int32view[0]); the output from this is "entry 0 in the 32-bit array is now 32".
... co
nsider this c structure: struct somestruct { unsigned long id; char username[16]; float amountdue; }; you can access a buffer containing data in this format like this: let buffer = new arraybuffer(24); // ...
...take precautions and co
nsiderations for these padding differences.
Image file type and format guide - Web media technologies
typically, modern content should use png for lossless and indexed still images, and should co
nsider using apng for lossless animation sequences.
...if you use ico files, you should use the bmp format, as support for png i
nside ico files wasn't added until windows vista and may not be well supported.
...to maximize quality and minimize download time, co
nsider providing both using a fallback with webp as the first choice and jpeg as the second.
... if the icon can be represented using vector graphics, co
nsider svg, since it scales across various resolutions and sizes, so it's perfect for responsive design.
color-profile - SVG: Scalable Vector Graphics
this differs from auto in that it overrides an embedded profile i
nside an image.
...if a match is found, the corresponding profile overrides an embedded profile i
nside an image.
... if no match is found, then the embedded profile i
nside the image is used.
...the referenced color profile overrides an embedded profile i
nside the image.
Referer header: privacy and security concerns - Web security
for example, co
nsider a "reset password" page with a social media link in a footer.
...this is becoming less useful in this context now that most of the web is using https, but it is still a worthy co
nsideration.
... in addition, you should co
nsider removing any third party content (e.g.
...you should enlist the help of a web security expert to write these requirements, and co
nsider both user needs and welfare, as well as other issues like policy and regulation enforced by legislation such as the eu general data protection regulation (gdpr).
Using the WebAssembly JavaScript API - WebAssembly
add the following to your script, below the first block: webassembly.instantiatestreaming(fetch('simple.wasm'), importobject) .then(obj => obj.instance.exports.exported_func()); the net result of this is that we call our exported webassembly function exported_func, which in turn calls our imported javascript function imported_func, which logs the value provided i
nside the webassembly instance (42) to the console.
... memory in the low-level memory model of webassembly, memory is represented as a contiguous range of untyped bytes called linear memory that are read and written by load and store instructions i
nside the module.
... just like functions, linear memories can be defined i
nside a module or imported.
... to create a webassembly global instance from i
nside your javascript, you use the webassembly.global() constructor, which looks like this: const global = new webassembly.global({value:'i32', mutable:true}, 0); you can see that this takes two parameters: an object that contains two properties describing the global variable: value: its data type, which can be any data type accepted within webassembly modules — i32, i64, f32, or f64.
panel - Archive of obsolete content
for example, here's an add-on whose content script intercepts mouse clicks on links i
nside the panel, and sends the target url to the main add-on code.
...addon.port.on("show", function onshow() { textarea.focus(); }); finally, the html file now references "get-text.js" i
nside a <script> tag: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> <script src="get-text.js"></script> </body> </html> styling panel content the panel's default style is different for each oper...
... 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 i
nside panels: prior to firefox 33, you don't get a context menu.
core/promise - Archive of obsolete content
promises co
nsider another approach, instead of continuation via callbacks, a function returns an object that represents a eventual result, either successful or failed.
...you can chain them using either i
nside or outside handlers.
...}); to see why this is, co
nsider the parallel between promises and try/catch.
stylesheet/utils - Archive of obsolete content
parameters window :
nsidomwindow uri : string, nsiuri} type : string the type of the sheet.
... parameters window :
nsidomwindow uri : string, nsiuri} type : string the type of the sheet.
...the values co
nsidered valid are: "agent", "user" and "author".
Bootstrapped extensions - Archive of obsolete content
shutdown called when the exte
nsidisableon needs to shut itself down, such as when the application is quitting or when the extension is about to be upgraded or disabled.
...i
nside this folder must be a property file.
... i
nside the chrome.manifest file these locale must be defined.
Downloading Files - Archive of obsolete content
var privacy = privatebrowsingutils.privacycontextfromwindow(urlsourcewindow); persist.persistflags = persist.persist_flags_from_cache | persist.persist_flags_replace_existing_files; persist.saveuri(uritosave, null, null, null, "", targetfile, privacy); if you don't need detailed progress information, you might be happier with
nsidownloader.
...vepassword, pwd) { pwd.value = hardcodedpassword; return true; }, promptusernameandpassword: function(dialogtitle, text, passwordrealm, savepassword, user, pwd) { user.value = hardcodedusername; pwd.value = hardcodedpassword; return true; } }; persist.saveuri(urltosave, null, null, null, "", nsfileinstance, privacy); the above is going to give you errors about missing
nsidownloadprogresslistener methods, so you should implement that as well.
...l && channel.responsestatus != 200) { return ""; } var bstream = components.classes["@mozilla.org/binaryinputstream;1"] .createinstance(components.interfaces.nsibinaryinputstream); bstream.setinputstream(stream); var size = 0; var file_data = ""; while(size = bstream.available()) { file_data += bstream.readbytes(size); } return file_data; } see also
nsidownloadprogresslistener saving an arbitrary url to a local file customizing the download progress bar appearance ...
Windows - Archive of obsolete content
you can get a dom window's id using the
nsidomwindowutils attribute outerwindowid.
...this can be used in cases in which you need to uniquely identify a dom window during the duration of the application's lifespan: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.
nsidomwindowutils); var windowid = util.outerwindowid; after running that code, windowid contains the outer window's unique id.
... similarly, you can get the current inner window id using the
nsidomwindowutils attribute currentinnerwindowid: var util = win.queryinterface(components.interfaces.nsiinterfacerequestor).getinterface(components.interfaces.
nsidomwindowutils); var windowid = util.currentinnerwindowid; programatically modifying html when attempting to modify html elements, it is important to specify the namespace.
Default Preferences - Archive of obsolete content
default preferences are set similarly but i
nside an extension and use the pref() function.
...you may not set variables i
nside of it, nor may do any kind of program flow control (ifs, loops etc.) nor even calculated values (i.e.
...i
nside your file you set preferences using the pref() function: pref("name", "value") example: pref('extensions.defaultprefs.example.int', 1); pref('extensions.defaultprefs.example.float', 0.1); pref('extensions.defaultprefs.example.string', 'fadf'); pref('extensions.defaultprefs.example.bool', true); notice that unlike when you're reading preferences, writing default preferences uses the same function no matter the data type of the preference.
How to convert an overlay extension to restartless - Archive of obsolete content
well, you should probably co
nsider switching to be extractionless when you go restartless.
...see here for the list of stuff you can't have in addition to no resource:// uris or file:// uris to files i
nside your xpi.
...w) { /* call/move your ui construction function here */ } function unloadfromwindow(window) { /* call/move your ui tear down function here */ } function foreachopenwindow(todo) // apply a function to all open browser windows { var windows = services.wm.getenumerator("navigator:browser"); while (windows.hasmoreelements()) todo(windows.getnext().queryinterface(components.interfaces.
nsidomwindow)); } var windowlistener = { onopenwindow: function(xulwindow) { var window = xulwindow.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindow); function onwindowload() { window.removeeventlistener("load",onwindowload); if (window.document.documentelem...
Chapter 1: Introduction to Extensions - Archive of obsolete content
what features are co
nsidered standard for web browsers these days?
...d for installing add-ons helps troubleshoot add-ons by disabling them and offering a safe mode confirms and runs updates provides access to add-ons' settings dialogs provides access to add-ons' support sites development environment amenities initially, there wasn't adequate documentation available, and extension developers were largely left to fend for themselves1; however, now there's a co
nsiderable store of knowledge.
... these are sophisticated extensions that can be co
nsidered full-scale applications in their own right, essentially using firefox as the development platform.
Intercepting Page Loads - Archive of obsolete content
few modern sites use framesets, but it is common for ads to appear i
nside iframe elements.
...make sure you access it from i
nside the state validation if condition.
... document loader service
nsidocumentloader is nothing but a global web progress listener.
JavaScript Object Management - Archive of obsolete content
} // more stuff }; window.addeventlistener( "load", function() { 〈namespace〉.browseroverlay.init(); }, false); there are some things you can't (or shouldn't) do i
nside load handlers, such as closing the window being loaded, or opening new windows, alerts or dialogs.
...if you have to use a reference to this i
nside the function, declare a variable called that that equals this, and use that in the anonymous function.
...all of the objects i
nside of it are exported as well, since they are members of the 〈modulenamespace〉 object.
Mozilla Documentation Roadmap - Archive of obsolete content
if you find it lacking or missing some piece of information, please co
nsider adding it once you've found it.
...one way to do this is to look into your firefox installation directory, maybe unpack a few jars and see what's i
nside.
...here are some important feeds you should co
nsider following: planet mozilla.
CSS3 - Archive of obsolete content
it consists mainly in allowing nested at-rules i
nside @media and the adding of a new css at-rule, @supports, and a new dom method css.supports().
... css multi-column layout module working draft adds support for easy multi-column layouts using the css columns, column-count, column-fill, column-gap, column-rule, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, break-after, break-before, and break-i
nside.
... the image-orientation property by adding the keyword from-image, allowing to follow exif data stored into images to be co
nsidered.
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
the first one looks like a traditional dhtml ticker application and uses hidden iframes and javascript to provide updates i
nside the webpage's ticker headlines section.
...another approach is to request an html page in the iframe and i
nside this page (requested data), set the onload event to callback a function notifying the parent document (originator).
...here, iframecallback is co
nsidered the data binder, so it is responsible for getting the content from the iframe and putting it in the proper repository in the page's context.
Working with BFCache - Archive of obsolete content
q: when a user clicks a link that replaces the view in the current tab with a new page, what is the fate of the
nsidomwindow supporting the view they click on?
...a: the outer
nsidomwindow (the |window| object in content js, aka the <browser>'s contentwindow object in the parent document) stays right where it is.
...the inner
nsidomwindow (the global scope object in content js) is either thrown away when gc happens, or frozen and placed in the bfcache.
Autodial for Windows NT - Archive of obsolete content
essentially, if some address at domain.com is in the database, then any address at domain.com is co
nsidered to be in the database.
... also, if any address that starts with www is in the database, then any other address that begins with www is co
nsidered to be in the database.
...if an address can't be reached, we trigger the autodial features from i
nside mozilla.
Editor Embedding Guide - Archive of obsolete content
in the beginning there is makeeditable given an nsiwebbrowser instance, get an
nsidomwindow from the getcontentdomwindow call.
...the first parameter is the
nsidomwindow you just retrieved, the second is the editor type you want to create, and the third is whether you want the window editable immediately or when the document is done loading.
...the above strings should be co
nsidered examples of base functionality and in no way imply that this command won't handle other fonts.
Embedding FAQ - Archive of obsolete content
you can find more information on adding new protocols here how to embedding mozilla i
nside of java there hasn't been any good code examples found.
...here is the code : import org.eclipse.swt.swt; import org.eclipse.swt.browser.mozillabrowser; import org.eclipse.swt.browser.progressevent; import org.eclipse.swt.browser.progresslistener; import org.eclipse.swt.widgets.display; import org.eclipse.swt.widgets.shell; import org.mozilla.xpcom.
nsidomdocument; public class test { public static void main(string args[]) { display display = new display(); shell shell = new shell(display); final mozillabrowser browser = new mozillabrowser(shell,wt.border); browser.seturl("http://www.google.com"); browser.addprogresslistener(new progresslistener() { ...
... public void changed(progressevent event) { } public void completed(progressevent event) {
nsidomdocument doc = browser.getdocument(); system.out.println(doc); } }); while (!shell.isdisposed()) { if (!display.readanddispatch()) { display.sleep(); } } } how to map a javascript function to a c++ function define an xpcom class defining the function you'll be doing in javascript.
Modularization techniques - Archive of obsolete content
this mechanism can be used both i
nside an executable at run-time and externally using the apersist flag to tell the repository to store the class id/library relationship in its permenant store.
...for those who like gory details, their structure is this: struct
nsid { pruint32 m0; pruint16 m1, m2; pruint8 m3[8]; }; frequently you see them represented as strings, like this: {221ffe10-ae3c-11d1-b66c-00805f8a2676} to initialize an id struct you declare them like this: id = {0x221ffe10, 0xae3c, 0x11d1, {0xb6, 0x6c, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76}}; why the b66c couplet gets broken up and grouped with the last set of bytes is probably a footnote somewhere.
...the implementation takes into co
nsideration two things when deciding whether or not a dll can be unloaded: whether any of its factories are currently in use, and whether anyone has locked the server.
Prism - Archive of obsolete content
javascript api: an api that can be used by scripts i
nside the bundle to customize the application.
... firefox extension: a firefox extension, code-named "refractor", can be used to spin out new prism apps from i
nside the web browser.
... refractor adds a new menu item to call up the shortcut creation dialog for i
nside firefox.
The Download Manager schema - Archive of obsolete content
this information is available using
nsidownloadmanager methods to retrieve
nsidownload objects for each download entry; however, if you feel like poking directly into the table, you can do so using the storage api.
...see the constants list in the
nsidownloadmanager documentation.
... see also
nsidownloadmanager
nsidownloadmanagerui
nsidownloadprogresslistener ...
The life of an HTML HTTP request - Archive of obsolete content
now the channel knows the content type of the incoming data, so the documentloader can find an
nsidocumentloaderfactory for the "text/html" content type (in this case an nslayoutdlf).
...in most cases (including this) it also creates a
nsidocument (nshtmldocument) and binds it to the contentviewer.
... (7) since the presentation shell (nspresshell) has registred as an documentobserver with the
nsidocument it also gets notified of changes in the document/content tree.
DOM Interfaces - Archive of obsolete content
the
nsidomdocumentxbl interface the
nsidomdocumentxbl interface contains methods for manipulating xbl bindings.
... idl definition interface
nsidomdocumentxbl { nodelist getanonymousnodes(in element elt); element getanonymouselementbyattribute(in element elt, in domstring attrname, in domstring attrvalue); element getbindingparent(in node node); void loadbindingdocument(in domstring documenturl); }; methods getanonymousnodes the getanonymousnodes method retrieves the anonymous children of the specified element.
... if (element.ownerdocument instanceof ci.
nsidomdocumentxbl) { var anonchildren = element.ownerdocument.getanonymousnodes(element); if (anonchildren) { for (var i = 0; i < anonchildren.length; i++) { if (anonchildren[i].nodetype == 1) return false; } } } return true; ...
tag - Archive of obsolete content
if set, the conditions will only match if the template builder is parsing content for an element directly i
nside this tag.
... for example, by using a value of treechildren, the condition will only match when placing elements directly i
nside a treechildren tag.
... thus, nested elements will not match because they are directly i
nside a treeitem.
Additional Template Attributes - Archive of obsolete content
« previousnext » referencing templates all the templates used so far have had the template placed i
nside the root element with the datasources attribute.
...the generated content is always inserted into the root node, in this example the listbox, not i
nside the template.
...the container or starting node variable is specified in the <content> tag i
nside a query, while the member variable is determined by the value of the uri attribute i
nside the action body.
Building Hierarchical Trees - Archive of obsolete content
the tree builder creates rows lazily, so a closed container will not have any data generated i
nside in it until the row is opened.
...similarly, when the user closes a tree row, the rows i
nside it are removed, such that they will have to be generated again the next time the row is opened.
... if you want to put rows i
nside the photo rows, you will either need to make each photo resource a container (for this rdf datasource, this will usually be an rdf seq), or use the containment attribute to specify additional properties that indicate containership.
The Joy of XUL - Archive of obsolete content
co
nsidering the broad range of platforms that currently support mozilla, this may be one of the most compelling features of xul as a technology for building applications.
... porting xul applications to other platforms is trivial.the calendar originated as a linux application with no co
nsideration given to porting it to other platforms.
... whether you need to migrate an existing web application to the desktop, are looking for a technology that will enable you to easily port your applications to multiple platforms, or want to integrate your own cool features into the browser, xul warrants serious co
nsideration.
Complete - Archive of obsolete content
install.js installation script for seamonkey chrome directory containing the extension code chrome/allcustom.jar the extension jar defaults/preferences directory containing a preferences file i
nside the jar there are three directories: content xul, javascript and other content that does not depend on the locale or theme locale files for each locale skin files for each theme version checks firefox etc.
...this is how it happens: for example, if your locale is fr-fr, it loads: locale/fr-fr/allcustom/allcustom.dtd from i
nside the jar file.
...for example, if you are using modern, it loads: skin/modern/allcustom/seamonkey/allcustom.css from i
nside the jar.
Document Object Model - Archive of obsolete content
the window object isn't defined by any dom specification, but in mozilla is sometimes co
nsidered part of dom level 0, a name used by some developers to refer to the dom-like functions before they were added to specifications.
...the script tag does allow code to be contained directly i
nside of it.
... the children are the child tags of the element and will be nested i
nside the element in the source.
Groupboxes - Archive of obsolete content
more complex captions you can also add child elements i
nside the caption element to create a more complex caption.
...you can put any element you want i
nside it, and apart from its special handling of radio buttons, it works like any other box.
... any radio buttons placed i
nside the radio group will be grouped together, even if they are i
nside nested boxes.
More Tree Features - Archive of obsolete content
to create a set of nested rows, all we need to do is add a second treechildren element i
nside the parent treeitem.
... you can then add items i
nside that to specify the child rows of an item.
... don't put the inner treechildren element i
nside the treerow as this won't work.
Simple Menu Bars - Archive of obsolete content
the menu bar can optionally be placed i
nside a toolbox and the menu would work just like any other toolbar.
...the size of the popup will be large enough to fit the commands i
nside it.
...note that it has been placed i
nside a flexible toolbox.
Stacks and Decks - Archive of obsolete content
however, the specialized types of boxes work just like regular boxes in the way they orient the elements i
nside them, but they have additional features.
...the third page is a box with two elements i
nside it.
... both the box and the elements i
nside it make up the page.
Tabboxes - Archive of obsolete content
shown below is the general syntax of a tabbox: <tabbox id="tablist"> <tabs> <!-- tab elements go here --> </tabs> <tabpanels> <!-- tabpanel elements go here --> </tabpanels> </tabbox> the tab elements are placed i
nside a tabs element, which is much like a regular box.
... the tabs element itself has been placed i
nside a tabbox.
... the contents of the individual tab pages should go i
nside each tabpanel element.
XUL FAQ - Archive of obsolete content
are there any elements i
nside the <prefwindow>, before the <prefpane>s?
...(the animation effect when you open the preference window will not stop, if a script outside <prefpane> refers any element i
nside <prefpane>, while initializing the window.
... if you want to access elements i
nside <prefpane>, you should put script in the <prefpane> or write script into "onpaneload" of the <prefpane>.) note, that prefwindow only works in chrome xul.
XUL Questions and Answers - Archive of obsolete content
how to add and remove values to/from, set up i
nside a <prefwindow> container to handle the preference?
... see also http://developer.mozilla.org/en/docs...in_chrome_code how can i include a .js document from i
nside a javascript document?
... with mozilla trunk ---------------------------------------------------------
nsidomcanvasrenderingcontext2d* c2d = //coming from <canvas>
nsidomwindow* window = //coming from <iframe> c2d->drawwindow( window, ..., "rgba(0,0,0,0)"); --------------------------------------------------------- this makes canvas background transparent if background is transparent but when "window" is coming from top level content window, background is not transparent.
XUL element attributes - Archive of obsolete content
if this attribute is not specified, there should be a template element directly i
nside the node.
...if this attribute is set to '_child', the first tooltip child element i
nside the element is used.
... elements that appear i
nside the element with the attribute will be repeated for each node in the rdf datasource.
XUL accessibility guidelines - Archive of obsolete content
co
nsider using context menu items or other xul elements along with keyboard shortcuts.
...describe keyboard shortcuts and any other accessibility co
nsiderations.
...these include language-neutral guidelines and also refer to techniques for xhtml, which is relevant for xul, as html can also be included i
nside of xul by use of the xhtml namespace.
colorpicker - Archive of obsolete content
this attribute only has any effect when used i
nside a prefwindow.
... type type: string if this attribute is not present, the colorpicker is displayed i
nside the window.
...s(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related interfaces
nsidomxulcontrolelement bugs the onchange event only fires if attribute type is set to "button".
content - Archive of obsolete content
if set, the conditions will only match if the template builder is parsing content for an element directly i
nside this tag.
... for example, by using a value of treechildren, the condition will only match when placing elements directly i
nside a treechildren tag.
... thus, nested elements will not match because they are directly i
nside a treeitem.
menulist - Archive of obsolete content
to create the drop-down, put a menupopup i
nside the menulist containing the choices as menuitem elements.
...this attribute only has any effect when used i
nside a prefwindow.
... related elements menu, menubar, menuitem, menupopup, menuseparator interfaces nsiaccessibleprovider,
nsidomxulmenulistelement ...
splitter - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element which should appear before or after an element i
nside a container.
...if a grippy is placed i
nside the splitter, one sibling element of the splitter is collapsed when the grippy is clicked.
...you should put a grippy element i
nside the splitter when it is used for collapsing.
toolbarbutton - Archive of obsolete content
constants for the possible values for this attribute are in the
nsidomxulbuttonelement interface.
...place a menupopup element i
nside the button in this case.
...removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements toolbar, toolbargrippy, toolbaritem, toolbarpalette, toolbarseparator, toolbarset, toolbarspacer, toolbarspring, toolbox interfaces nsiaccessibleprovider,
nsidomxulbuttonelement ...
toolbox - Archive of obsolete content
if a toolbar is placed i
nside a toolbox, a grippy is displayed on its left or upper edge.
...ymaster/gatekeeper/there.is.only.xul" title="toolbox example" width="300"> <toolbox> <toolbar> <toolbarbutton label="back"/> <toolbarbutton label="forward"/> <toolbarbutton label="home"/> </toolbar> <toolbar> <toolbarbutton label="stop"/> <toolbarbutton label="reload"/> </toolbar> </toolbox> <textbox multiline="true" value="we have two toolbars i
nside of one toolbox above." width="20"/> </window> attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, o...
... externaltoolbars type: array of elements an array of external toolbars; that is, toolbar elements that should be co
nsidered to be members of this toolbox, even if they are not actually children of the toolbox.
Deploying XULRunner - Archive of obsolete content
copy xulrunner/ to this directory when deploying with xulrunner 2.0 and above do the following: move chrome.manifest to the root directory, and adjust resource paths i
nside chrome.manifest accordingly with xulrunner 9.0 or 10.0 you may need to copy "mozutils.dll" and/or "mozcrt19.dll" from the xulrunner directory to the root directory.
... xulrunner 39 and later due to mac os x code signing rules and how they interact with the design of xulrunner (see bug 1105044 for the i
nside scoop), starting with xulrunner 39 the xulrunner library files are no longer able to reside in a xulrunner framework directory.
...you should copy this file from /library/frameworks/xul.framework/versions/1.8/xulrunner.) when deploying with xulrunner 2.0, move chrome.manifest to the root directory, and adjust resource paths i
nside chrome.manifest accordingly.
Archived Mozilla and build documentation - Archive of obsolete content
in addition, you can augment or replace the download manager's user interface by implementing the new
nsidownloadmanagerui interface.
... help viewer help viewer: allows information to be shown to the user i
nside mozilla.
...the only dow
nside is you can't specify how much of the resource to use, only which one to consume.
Mozilla release FAQ - Archive of obsolete content
take this into co
nsideration when posting things) ftp see the mozilla ftp mirror section for ftp sites under which license terms was mozilla released?
...for these reasons, this is generally co
nsidered a bad idea.
...i would suggest that before you devote much time and effort to your port, you co
nsider: how many users the os has that are likely to use mozilla does the os support multitasking well enough for mozilla does the os have a sufficiently evolved gui for mozilla to work does the os have sufficient networking support for mozilla is the os typically run on systems that have the resources to run mozilla does gcc or some other easily available compiler exist for the target platform if many of these answers are no, then there will be large issues that will hamper the port.
Building a Theme - Archive of obsolete content
i
nside your new theme folder, create two new empty text files, one called chrome.manifest and the other called install.rdf.
... create the install manifest open the file called install.rdf that you created at the top of your extension's folder hierarchy and put this i
nside: <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>sample@example.net</em:id> <em:version>1.0</em:version> <em:type>4</em:type> <!-- target application this theme can install into, with minimum and maximum supported versions.
... create a new text file and put the full path to your development folder i
nside (e.g.
LiveConnect Overview - Archive of obsolete content
(although this functionality (along with some others) had been broken in gecko 1.9 (see bug 391642) as the mozilla-specific liveconnect code had not been maintained i
nside mozilla, with java 6 update 11 and 12 building support for reliance on mozilla's implementation of the generic (and cross-browser) npapi plugin code, this has again been fixed.) for example, suppose you are using the java forname method to assign the name of a java class to a variable called theclass.
...also, any time you use javascript objects in your java code, you should put the call to the javascript object i
nside a try...catch statement which handles exceptions of type netscape.javascript.jsexception.
...note: a more realistic example would place the call to getmember i
nside a try...catch statement to handle errors of type jsexception.
Index - Game development
16 building up a basic demo with a-frame 3d, a-frame, vr, virtual reality, web, webgl the webxr and webgl apis already enable us to start creating virtual reality (vr) experiences i
nside web browsers, but the community is still waiting for tools and libraries to appear, to make this easier.
... 50 initialize the framework 2d, beginner, canvas, games, html, javascript, phaser, tutorial before we can start writing the game's functionality, we need to create a basic structure to render the game i
nside.
... 63 create the canvas and draw on it 2d, beginner, canvas, games, html, javascript, tutorial before we can start writing the game's functionality, we need to create a basic structure to render the game i
nside.
Building up a basic demo with Babylon.js - Game development
saving a copy of the latest babylon.js engine i
nside your directory.
...to show actual animation, we need to make changes to these values i
nside the rendering loop at the end of our code, so they are updated on every frame.
... define a helper variable — t — that we will use for animations, just before the renderloop, and decrement it on every frame i
nside the loop, like this: var t = 0; var renderloop = function () { scene.render(); t -= 0.01; // animation code goes here }; engine.runrenderloop(renderloop); the t variable will be incremented on every rendered frame.
Building up a basic demo with the PlayCanvas engine - Game development
saving a copy of the latest playcanvas engine i
nside your directory.
...to show actual animation, we need to make changes to these values i
nside the rendering loop, so they are updated on every frame.
...add this line of code i
nside the app.on("update") callback function, right after the addition of the deltatime to the timer variable: box.rotate(deltatime*10, deltatime*20, deltatime*30); it will rotate the box by deltatime*10 on the x axis, deltatime*20 on the y axis and deltatime*30 on the z axis, on very frame — giving us a smooth animation.
Implementing controls using the Gamepad API - Game development
the gamepad api achieves this by providing an interface exposing button presses and axis changes that can be used i
nside javascript code to handle the input.
...update() is executed on every frame i
nside the game loop, to update the actual status of the gamepad object regularly: update: function() { // clear the buttons cache gamepadapi.buttonscache = []; // move the buttons status from the previous frame to the cache for(var k=0; k<gamepadapi.buttonsstatus.length; k++) { gamepadapi.buttonscache[k] = gamepadapi.buttonsstatus[k]; } // clear the buttons status gamepadapi.buttons...
...ess if(!hold) { // loop through the cached states from the previous frame for(var j=0,p=gamepadapi.buttonscache.length; j<p; j++) { // if the button was already pressed, ignore new press if(gamepadapi.buttonscache[j] == button) { newpress = false; } } } } } return newpress; }, there are two types of action to co
nsider for a button: a single press and a hold.
Animations and tweens - Game development
applying the animation when the ball hits the paddle in the arcade.collide() method call that handles the collision between the ball and the paddle (the first line i
nside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the ballhitbrick() function.
... update the first line i
nside update() as shown below: function update() { game.physics.arcade.collide(ball, paddle, ballhitpaddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } then we can create the ballhitpaddle() function (having ball and paddle as default parameters), playing the wobble animation when it is called.
...you can add the animations.play() call i
nside the ballhitbrick() function too, if you feel it would make the game look better.
Load the assets and print them on screen - Game development
add the following new line just i
nside the preload() function, at the bottom: function preload() { // ...
...grab the ball image from github, and save it i
nside an /img directory in the same place as your index.html file.
... now, to show it on the screen we will use another phaser method called add.sprite(); add the following new code line i
nside the create() function as shown: function create() { ball = game.add.sprite(50, 50, 'ball'); } this will add the ball to the game and render it on the screen.
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
call stack list: - greeting execute all lines of code i
nside the greeting() function.
... call stack list: - sayhi - greeting execute all lines of code i
nside the sayhi() function, until reaches its end.
... call stack list: - greeting when everything i
nside the greeting() function has been executed, return to its invoking line to continue executing the rest of the js code.
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
it correctly finds our variable instantiated with our first statement after finding it, the expression is evaluated, foo is replaced by 5 and the javascript engine passes that value to the functions as an argument before executing the statements i
nside the functions' bodies, javascript takes a copy of the originally passed argument (which is a primitive) and creates a local copy.
... these copies, existing only i
nside the functions' scopes, are accessible via the identifiers we specified in the functions' definitions (num for addtwo, foo for addtwo_v2) then, the functions' statements are executed: in the first function, a local num variable had been created.
...(note that window.foo could still be used to access the external foo variable.) in conclusion, any changes i
nside our functions won't affect the original foo at all, as we are modifying copies of it that's why primitives are immutable - instead of changing them directly, we're modifying a copy, without affecting the original.
Fundamental CSS comprehension - Learn web development
above the two rules, add a css comment with some text i
nside it to indicate that this is a set of general styles for the overall page.
... write a ruleset that gives the <p> i
nside the footer an effective font size of 15px (but expressed in ems) and an appropriate line height to place it in the center of the footer's content box.
... as a last little touch, give the paragraph i
nside the <article> an appropriate padding value so that its left edge lines up with the <h2> and footer paragraph, and set its color to be fairly light so it is easy to read.
Images, media, and form elements - Learn web development
if you place an image i
nside a box that is smaller or larger than the intrinsic dimensions of the image file in either direction, it will either appear smaller than the box, or overflow the box.
... you can make other choices about images i
nside containers.
... if we use contain as a value the image will be scaled down until it is small enough to fit i
nside the box.
Sizing items in CSS - Learn web development
in the example above, try adding some text i
nside the empty element.
...as we discovered in our previous lesson on overflow, a set height can cause content to overflow if there is more content than the element has space to fit i
nside it.
...in the case of a box i
nside another container, if you give the child box a percentage width it will be a percentage of the width of the parent container.
Normal Flow - Learn web development
you can't set width or height on inline elements — they just sit i
nside the content of block level elements.
...the normal layout flow (mentioned in the layout introduction article) is the system by which elements are placed i
nside the browser's viewport.
... inline elements behave differently — they don't appear on new lines; instead, they sit on the same line as one another and any adjacent (or wrapped) text content, as long as there is space for them to do so i
nside the width of the parent block level element.
Responsive design - Learn web development
flexible layout before responsive design a number of approaches were developed to try to solve the dow
nsides of the liquid or fixed-width methods of building websites.
...this is still an approach used today, and in most stylesheets, you will find the following css somewhere: img { max-width: 100%; } there are obvious dow
nsides to this approach.
...co
nsider the sites that you visit on your phone — it is probably fairly unusual to come across a site that is the desktop version scaled down, or where you need to scroll sideways to find things.
How can we design for all types of users? - Learn web development
summary when you're building a website, one top issue to co
nsider is universal design: accommodating all users regardless of disability, technical constraints, culture, location, and so on.
...if no parent can be found, the default font size within the browser is co
nsidered as the base size for the calculation (usually the equivalent of 16 pixels).
...let's co
nsider this html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>font size experiment</title> </head> <body> <div class="container"> <h1>this is our main heading <span class="subheading">this is our subheading</span> </h1> <p>[lengthly text that spans many lines]</p> </div> </body> </html> we have a div with class container.
HTML forms in legacy browsers - Learn web development
for that reason, it's co
nsidered best practice to work with "unobtrusive" javascript.
... conclusion as you can see, co
nsidering browser and operating system default form control appearance is important.
...the basic premise is to co
nsider whether altering the default implemenation is worth the work before embarking on the challenge.
Your first form - Learn web development
from a ux point of view, this is co
nsidered bad practice, so you should avoid using this type of button unless you really have a good reason to include one.
... first of all, add a <style> element to your page, i
nside your html head.
... it should look like so: <style> </style> i
nside the style tags, add the following css: form { /* center the form on the page */ margin: 0 auto; width: 400px; /* form outline */ padding: 1em; border: 1px solid #ccc; border-radius: 1em; } ul { list-style: none; padding: 0; margin: 0; } form li + li { margin-top: 1em; } label { /* uniform size & alignment */ display: inline-block; width: 90px; text-align: right; } input, textarea { /* to make sure that all text fields have the same font settings by default, textareas have a monospace font */ font: 1em sans-serif; /* uniform text field size */ width: 300px; box-sizing: border-box; /* match form field borders */ border: 1px solid #999; } input:focus, textarea:focus { /* additional highl...
Tips for authoring fast-loading HTML pages - Learn web development
tables are still co
nsidered valid markup but should be used for displaying tabular data.
...co
nsider compressing your images before adding them to your page, using compression features built into image-manipulation tools such as photoshop, or using a specialized tool such as compress jpeg or tiny png,.
... ideally, your basic minimum requirements should be based on the co
nsideration of modern browsers that support the relevant standards.
Debugging HTML - Learn web development
"co
nsider adding a lang attribute to the html start tag to declare the language of this document.": this is not an error but a warning.
... "end of file reached when i
nside an attribute value.
... ignoring tag": this one is rather cryptic; it refers to the fact that there is an attribute value not properly formed somewhere, possibly near the end of the file because the end of the file appears i
nside the attribute value.
Marking up a letter - Learn web development
put the two addresses i
nside <address> elements.
... the provided css should be included i
nside an appropriate tag.
... you just need to put the provided css i
nside an html element.
What’s in the head? Metadata in HTML - Learn web development
browsers will support favicons in more common formats like .gif or .png, but using the ico format will ensure it works as far back as internet explorer 6.) adding the following line into your html's <head> block to reference it: <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> here is an example of a favicon in a bookmarks panel: there are lots of other icon types to co
nsider these days as well.
... the <link> element should always go i
nside the head of your document.
...instead of pointing to an external script file, you can also choose to put your script i
nside the <script> element.
Adding vector graphics to the Web - Learn web development
you can make the image into a hyperlink easily by nesting the <img> i
nside an <a> element.
... how to include svg code i
nside your html you can also open up the svg file in a text editor, copy the svg code, and paste it into your html document — this is sometimes called putting your svg inline, or inlining svg.
...ser code is being shown, // not the solution, so that solution is not saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; summary this article has provided you with a quick tour of what vector graphics and svg are, why they are useful to know about, and how to include svg i
nside your webpages.
Responsive images - Learn web development
the header image will likely span the whole of the width of the header, and the content image will fit somewhere i
nside the content column.
... the content images have been set so that if the body element becomes smaller than the image, the images start to shrink so that they always stay i
nside the body, rather than overflowing it.
...you can supply mime types i
nside type attributes so the browser can immediately reject unsupported file types: <picture> <source type="image/svg+xml" srcset="pyramid.svg"> <source type="image/webp" srcset="pyramid.webp"> <img src="pyramid.png" alt="regular pyramid built from four equilateral triangles"> </picture> do not use the media attribute, unless you also need art direction.
Test your skills: Strings - Learn web development
you already have half of a famous quote i
nside a variable called quotestart; we would like you to: look up the other half of the quote, and add it to the example i
nside a variable called quoteend.
...save the result i
nside a variable called finalquote.
...do the calculation i
nside the placeholder.
Adding features to our bouncing balls demo - Learn web development
if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements i
nside the html page.
... i
nside the if() statements, if the tests return true we don't want to update velx/vely; we want to instead change the value of x/y so the evil circle is bounced back onto the screen slightly.
...the following code block should be put i
nside the method definition: let _this = this; window.onkeydown = function(e) { if (e.key === 'a') { _this.x -= _this.velx; } else if (e.key === 'd') { _this.x += _this.velx; } else if (e.key === 'w') { _this.y -= _this.vely; } else if (e.key === 's') { _this.y += _this.vely; } } so when a key is pressed, the event object's keycode property is consulted to see which key is pressed.
Object building practice - Learn web development
immediately i
nside the for loop, we use an if statement to check whether the current ball being looped through is the same ball as the one we are currently checking.
...to negate the check, so that the code i
nside the if statement only runs if they are not the same.
... if a collision is detected, the code i
nside the inner if statement is run.
Test your skills: JSON - Learn web development
the values of these variables are then printed to the screen i
nside paragraphs.
... some hints/questions: the json data is provided as text i
nside the displaycatinfo() function.
... why are the para1.textcontent = motherinfo; and para2.textcontent = kitteninfo; lines i
nside the displaycatinfo() function, and not at the end of the script?
Multimedia: Images - Learn web development
you need to be co
nsiderate of data usage.
... you also need to be co
nsiderate of memory as many mobile devices have limited ram.
...which is why you could co
nsider offering your images in that flavor, too, for the browsers that support it.
The "why" of web performance - Learn web development
in a sense, web performance can be co
nsidered a subset of web accessibility.
... with performance as with accessibility, you co
nsider what device a site visitor is using to access the site and the device connection speed.
... as an example, co
nsider the loading experience of cnn.com, which at the time of this writing had over 400 http requests with a file size of over 22.6mb.
Getting started with Ember - Learn web development
this creates a new directory i
nside the current directory you are in called todomvc, containing the scaffolding for a new ember app.
... now run the following command to place the common todomvc css i
nside your app: npm install --save-dev todomvc-app-css todomvc-common next, find the ember-cli-build.js file i
nside the todomvc directory (it's right there i
nside the root) and open it in your chosen code editor.
... starting the development server you may start the app in development mode by typing the following command in your terminal, while i
nside 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 (totaltime >= 5%) | total (avg) -----------------------------------------+----------- broccolimergetrees (17) | 35ms (2 ms) package /assets/vendor.js (1) | 13ms concat: vendor styles/asse...
Routing in Ember - Learn web development
to do this you’ll need to enter the following commands into your terminal, i
nside the root directory of your app: ember generate route index ember generate route completed ember generate route active the second and third commands should have not only generated new files, but also updated an existing file, app/router.js.
...the location in the page where <todolist /> is rendered is determined by the {{ outlet }} i
nside the parent route, which in this case is application.hbs.
... updating the todos display i
nside todolist one small final thing that we need to fix is that previously, i
nside todomvc/app/components/todo-list.hbs, we were accessing the todo-data service directly and looping over all todos, as shown here: {{#each this.todos.all as |todo| }} since we now want to have our todolist component show a filtered list, we'll want to pass an argument to the todolist component representing the "curre...
Componentizing our React app - Learn web development
go back to src/app.js, copy the first <li> from i
nside the unordered list, and paste it into todo.js so that it reads like this: export default function todo() { return ( <li classname="todo stack-small"> <div classname="c-cb"> <input id="todo-0" type="checkbox" defaultchecked={true} /> <label classname="todo-label" htmlfor="todo-0"> eat </label> </div> <div classname="btn-group"> <b...
... copy the <form> tags and everything between them from i
nside app.js, and paste them i
nside form()’s return statement.
... </label> </h2> <input type="text" id="new-todo-input" classname="input input__lg" name="text" autocomplete="off" /> <button type="submit" classname="btn btn__primary btn__lg"> add </button> </form> ); } export default form; the <filterbutton /> do the same things you did to create form.js i
nside filterbutton.js, but call the component filterbutton() and copy the html for the first button i
nside the <div> element with the class of filters from app.js into the return statement.
Understanding client-side JavaScript frameworks - Learn web development
along the way, we'll learn about a few important concepts such as calling components i
nside other components, passing data to them via props and saving data state.
...in this article we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display i
nside todoitem components using the v-for directive.
...adding a new todo form: vue events, methods, and models we now have sample data in place and a loop that takes each bit of data and renders it i
nside a todoitem in our app.
Implementing feature detection - Learn web development
note how the javascript representations of those properties that are stored i
nside the htmlelement.style object use lower camel case, not hyphens, to separate the words.
...this is a property that allows you to run media query tests i
nside javascript.
... finally, add another <script> element at the bottom of the html body (just before the </body> tag), and put the following script i
nside the tags: if (modernizr.geolocation) { navigator.geolocation.getcurrentposition(function(position) { let latlng = new google.maps.latlng(position.coords.latitude,position.coords.longitude); let myoptions = { zoom: 8, center: latlng, maptypeid: google.maps.maptypeid.terrain, disabledefaultui: true } let map = new google.maps.map(document.getelementbyi...
Handling common HTML and CSS problems - Learn web development
if you have a widget, make sure it has a distinct class, and then start the selectors that select elements i
nside the widget with this class, so conflicts are less likely.
... for example, in the firefox dev tools, you get this kind of output at the bottom of the dom inspector: if for example you were trying to use this selector, you'd be able to see that it wouldn't select the input element as desired: form > #date (the date form input isn't directly i
nside the <form>; you'd be better off using a general descendant selector instead of a child selector).
...it is really easy and convenient to use, although it does have some dow
nsides (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.
Accessibility API cross-reference
for an index, use <index> with a <l>(list) i
nside.
...in aria, used to nest browsable rich text content i
nside interactive content document n/a n/a document document a drop down list, different from combobox droplist n/a n/a listbox for math & chemistry equation n/a n/a math a scrollable list of articles where scrolling may cause articles to be added to or removed from either end of the list.
... n/a n/a canvas n/a <canvas> (accessible alternative richtext content may be nested i
nside, but the canvas itself is presentational) a dialog for picking a color n/a color_chooser color_chooser n/a <input type=color> a dialog for picking a file n/a file_chooser file_chooser n/a invoked with <input type=file> no explanation given n/a n/a invalid n/a contains acc...
Adding a new event
create xpcom interface for the dom event if your event class should be accessible via xpcom interface, you should create a new
nsidomfooevent interface in dom/interfaces/events/.
...if all information of the event is stored by its internal event, c++ event handlers can access them with following code: ns_imethodimp aneventlistener::handleevent(
nsidomevent* aevent) { internalfooevent* internalevent = aevent->getinternalnsevent()->asfooevent(); if (ns_warn_if(!internalevent)) { return ns_error_unexpected; } dosomethingwith(internalevent->mbar); aevent->preventdefault(); return ns_ok; } implement dom event class generate dom event implementation if it's possible if you're creating simple dom event class, it might be generated automatically.
... in
nsidomevent.idl, you need to define ns_newdomfooevent().
Debugging Table Reflow
block reflow another way to debug the reflow process is implemented i
nside nsblockframe.cpp.
...ow the available options are: reflow really-noisy-reflow max-element-size space-manager verify-lines damage-repair lame-paint-metrics lame-reflow-metrics disable-resize-opt these options can be combined with a comma separated list messages generated by the reflow switch: block(div)(1)@00be5ac4: reflowing dirty lines computedwidth=9000 computedheight=1500 this message is generated i
nside of nsresult nsblockframe::reflowdirtylines(nsblockreflowstate& astate) it first shows the block id and address and then the computed width and height from the htmlreflowstate.
...th + padding due to col spans #define fix_adj 5 // fixed width + padding due to col spans #define pct 6 // percent width of cell or col #define pct_adj 7 // percent width of cell or col from percent colspan #define min_pro 8 // desired width due to proportional <col>s or cols attribute #define final 9 // width after the table has been balanced, co
nsidering all of the others in the last log snippet none of these width's has been set.
Debugging on Mac OS X
if you try to do that then xcode will simply copy the source files under the project directory rather than link to them (still the case in xcode 10?) which breaks debugging and the possibility to modify-rebuild-relaunch from i
nside xcode.
...the .app file is typically found i
nside the dist folder in your build directory.
...set the executable by clicking on the "executable" drop-down, and selecting the plugin-container.app that is i
nside the app bundle of the copy of firefox you want to debug.
Reviewer Checklist
make sure the patch doesn't create any unused code (e.g., remove strings when removing a feature) all caught exceptions should be logged at the appropriate level, bearing in mind personally identifiable information, but also co
nsidering the expense of computing and recording log output.
... if working on a new feature, co
nsider adding prefs to control the behavior.
... co
nsider adding prefs to disable the feature entirely in case bugs are found later in the release cycle.
SVG Guidelines
for example, co
nsider an image of a path with a gradient fill.
...co
nsider an image that involves some complex gradients and filters.
...most of time, cdata isn't needed, for example, the content in <style> tags doesn't need to be wrapped in a cdata section as the content i
nside the tag is already correctly parsed as css.
Error codes returned by Mozilla APIs
xxx currently unused - co
nsider removing.
...xxx currently unused - co
nsider removing.
...(0x80540008) ns_error_wont_handle_content (0x805d0001) moz_error_storage_error (0x80630001) ns_error_schemavalidator_no_schema_loaded (0x80640001) ns_error_schemavalidator_no_dom_node_specified (0x80640002) ns_error_schemavalidator_no_type_found (0x80640003) ns_error_schemavalidator_type_not_found (0x80640004) note: there are other errors in these files: gfx/public/
nsidevicecontext.h base/public/nsneterror.h parser/htmlparser/public/nsiparser.h layout/base/nslayouterrors.h profile/public/nsiprofileinternal.idl security/manager/ssl/public/nsicmsmessageerrors.idl directory/xpcom/base/public/nsildaperrors.idl content/base/public/nscontenterrors.h see also mozilla error lookup lets you quickly look up the error name by its code in different formats.
Limitations of frame scripts
for example: nsisessionstore nsiwindowmediator <need more examples> places api the places api can't be used i
nside a frame script.
...it looks something like this: window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.
nsidocshelltreeitem) .roottreeitem .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.
nsidomwindow); this will no longer work.
... in the content process the root tree item is an nsitabchild, that cannot be converted to an
nsidomwindow, so the second getinterface call here will fail.
Limitations of frame scripts
for example: nsisessionstore nsiwindowmediator <need more examples> places api the places api can't be used i
nside a frame script.
...it looks something like this: window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.
nsidocshelltreeitem) .roottreeitem .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.
nsidomwindow); this will no longer work.
... in the content process, the root tree item is an nsitabchild, that cannot be converted to an
nsidomwindow, so the second getinterface call here will fail.
Browser API
the following new events can be listened for: mozbrowseractivitydone sent when something i
nside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
... mozbrowsercaretstatechanged sent when the text selected i
nside the browser <iframe> content changes.
... mozbrowserselectionstatechanged sent when the text selected i
nside the browser <iframe> content changes.
Gecko Keypress Event
if gecko doesn't replace the charcode with an ascii character, the web application developers would need to co
nsider all non-latin keyboard layouts (arabic, greek, hebrew, russian, etc.).
... when handling web content accesskeys, the handlers should co
nsider both characters that are available on the key (without and with shift).
...because numerals are common in short cuts, the numeral from the key should be co
nsidered as a low priority shortcut key candidate (bug 429219).
OS.File for the main thread
ge(); img.onload = function() { var canvas = document.createelementns('http://www.w3.org/1999/xhtml', 'canvas'); canvas.width = img.naturalwidth; canvas.height = img.naturalheight; var ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); (canvas.toblobhd || canvas.toblob).call(canvas, function(b) { var r = cc['@mozilla.org/files/filereader;1'].createinstance(ci.
nsidomfilereader); //new filereader(); r.onloadend = function() { // r.result contains the arraybuffer.
...this is co
nsiderably slower (not just for the application but for the whole system) and more battery expensive but also safer: if the system shuts down improperly (typically due to a kernel freeze or a power failure) or if the device is disconnected before the buffer is flushed, the file has more chances of not being corrupted.
...if your data is user-critical (e.g., preferences, application data), you may wish to co
nsider adding options tmppath and/or flush to reduce the likelihood of corruption, as detailed above.
source-editor.jsm
all changes made to the text between the two calls is co
nsidered to be a single edit for the purposes of undo operations.
... ignorecase boolean if true, the search is performed in a case-insensitive manner; otherwise case is co
nsidered.
...all changes made between a call to startcompoundchange() and its corresponding call to endcompoundchange() are co
nsidered to be a single operation on the undo stack.
SVN for Localizers
mac os x users can find svn i
nside the command line tools (available on the apple developer website), or use tools like homebrew or fink.
... i
nside mozilla.com/trunk/locales, there are separate directories for each locale that is localizing mozilla.com.
... note: the directory you create will be located i
nside the directory that you're currently in with your console (or cygwin console).
Profiling with Xperf
this is shorthand for "allocated i
nside, freed i
nside", "allocated i
nside, freed outside", "allocated outside, freed i
nside".
... these refer to the time range that was selected for the summary graph; for example, something that's in the aofi category was allocated before the start of the selected time range, but the free event happened i
nside.
...also experiment with turning columns on and off; removing a column will allow data to be aggregated without co
nsidering that column's contributions.
Profiling with the Firefox Profiler
for very time-sensitive profiling, you may want to co
nsider a non-sampling profiler.
... because of the non-zero overhead of the instrumentation, the sample label shouldn't be placed i
nside hot loops.
... warning: dumping texture data slows performance co
nsiderably, and requires a lot of storage for the profile files.
PKCS #11 Module Specs
the value is co
nsidered quoted if the first character after the '=' is ', ", {, [, or <.
...embedded '\' charaters are co
nsidered escape characters for the next character in the stream.
...valid names i
nside nss_params are: flags - comma separated list of flag values, parsed case-insensitive.
SpiderMonkey 1.8.5
while this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble i
nside the jsval.
...note also that spidermonkey can now fit a full 32-bit integer (jsint) i
nside a jsval without promoting to a jsdouble.
... the team is co
nsidering the removal of tinyids js_threadsafe is going away, with future versions supporting only thread-safe builds a new debugging api is on the way to replace jsd.
SpiderMonkey 1.8.7
while this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble i
nside the jsval.
...note also that spidermonkey can now fit a full 32-bit integer (jsint) i
nside a jsval without promoting to a jsdouble.
... the team is co
nsidering the removal of tinyids js_threadsafe is going away, with future versions supporting only thread-safe builds a new debugging api is on the way to replace jsd.
Redis Tips
* * notice: failing an execution of multi is not co
nsidered * an error.
... if the structure matters, co
nsider using redis hashes or flattening your data across your keyspace.
... or co
nsider storing the json data in mongodb and manipulating pointers and commonly-used and/or rapidly-changing metadata in redis.
Gecko object attributes
applied to: listitem, option exposed in aria: aria-setsize live region attribues atomic true when the entire region should be presented as a whole, when changes within it are co
nsidered important enough to automatically present.
...if not specified, the default should be co
nsidered "additions text", which indicates that newly created objects and changes to text and text equivalents should be co
nsidered relevant, and that the hiding or removal of items is not.
... exposed in aria: aria-relevant container-atomic is this change i
nside a region that should always be presented at once.
Finishing the Component
the rule of thumb is that interfaces outside of the sdk are co
nsidered "experimental" or unfrozen.
...in the weblock component, the shouldload method looks like this: ns_imethodimp weblock::shouldload(print32 contenttype, nsiuri *contentlocation, nsisupports *ctxt,
nsidomwindow *window, prbool *_retval) uniform resource locators the method passes in an interface pointer of type nsiuri, which is based on the uniform resource identifier, or uri.
... here is the complete implementation of the shouldload() method: ns_imethodimp weblock::shouldload(print32 contenttype, nsiuri *contentlocation, nsisupports *ctxt,
nsidomwindow *window, prbool *_retval) { if (!contentlocation) return ns_error_failure; nsembedcstring scheme; contentlocation->getscheme(scheme); if (strcmp("http", scheme.get()) != 0 && strcmp("https", scheme.get()) != 0 && strcmp("ftp", scheme.get()) != 0) { // this isn't a type of uri that we deal with *_retval = pr_true; return ns_ok...
Mozilla internal string guide
outside of libxul you should use ns_free to deallocate the result when you no longer need it, i
nside libxul free() is preferred..
... // call init(const char16_t*) - bad signature, will need to do runtime length calculation i
nside init(l"start value"); // bad - l"..." is not portable!
...you could co
nsider not using a macro at all but a named constexpr constant instead.
IAccessible2
refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
...refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
...refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
IAccessibleTable
refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
...refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
...refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
amIWebInstaller
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview boolean installaddonsfromwebpage(in astring amimetype, in
nsidomwindow awindow, in nsiuri areferer, [array, size_is(ainstallcount)] in wstring auris, [array, size_is(ainstallcount)] in wstring ahashes, [array, size_is(ainstallcount)] in wstring anames, [array, size_is(ainstallcount)] in wstring aicons, [optional] in amiinstallcallback acallback, [optional] in pruint32 ainstallcount); boolean isinstallenabled(in astring amimetype, in nsiuri areferer); note: prio...
...r to gecko 8.0, all references to
nsidomwindow used in this interface were
nsidomwindow.
...boolean installaddonsfromwebpage( in astring amimetype, in
nsidomwindow awindow, in nsiuri areferer, [array, size_is(ainstallcount)] in wstring auris, [array, size_is(ainstallcount)] in wstring ahashes, [array, size_is(ainstallcount)] in wstring anames, [array, size_is(ainstallcount)] in wstring aicons, in amiinstallcallback acallback, optional in pruint32 ainstallcount optional ); parameters amimetype the mimetype for the add-ons.
nsIAccessibilityService
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsiaccessibleretrieval method overview nsiaccessible createouterdocaccessible(in
nsidomnode anode); nsiaccessible createrootaccessible(in nsipresshell ashell, in
nsidocument adocument); nsiaccessible createhtml4buttonaccessible(in nsisupports aframe); nsiaccessible createhypertextaccessible(in nsisupports aframe); nsiaccessible createhtmlbraccessible(in nsisupports aframe); nsiaccessible createhtmlbuttonaccessible(in nsisupports aframe); nsiaccessible createhtmlaccessiblebymarkup(in nsiframe aframe, in nsiweakreference aweakshell, in
nsidomnode adomnode); nsiaccessible c...
...reatehtmlliaccessible(in nsisupports aframe, in nsisupports abulletframe, in astring abullettext); nsiaccessible createhtmlcheckboxaccessible(in nsisupports aframe); nsiaccessible createhtmlcomboboxaccessible(in
nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtmlhraccessible(in nsisupports aframe); nsiaccessible createhtmlimageaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in
nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlobjectframeaccessible(in nsobjectframe aframe); nsiaccessible createhtml...
...radiobuttonaccessible(in nsisupports aframe); nsiaccessible createhtmlselectoptionaccessible(in
nsidomnode anode, in nsiaccessible aaccparent, in nsiweakreference apresshell); nsiaccessible createhtmltableaccessible(in nsisupports aframe); nsiaccessible createhtmltablecellaccessible(in nsisupports aframe); nsiaccessible createhtmltableheadaccessible(in
nsidomnode adomnode); nsiaccessible createhtmltextaccessible(in nsisupports aframe); nsiaccessible createhtmltextfieldaccessible(in nsisupports aframe); nsiaccessible createhtmlcaptionaccessible(in nsisupports aframe); nsiaccessible getaccessible(in
nsidomnode anode, in nsipresshell apresshell, in nsiweakreference aweakshell, inout nsiframe framehint, out boolean aishidden); nsiaccessible addnativerootaccessible(in voi...
nsIAccessibleProvider
xformsitemcheckgroup 0x00002012 used for xforms item element that is used i
nside xforms select elements represented by group of checkboxes.
... xformsitemradiogroup 0x00002013 used for xforms item element that is used i
nside xforms select1 elements represented by radio group.
... xformsitemcombobox 0x00002015 used for xforms item element that is used i
nside xforms select1 elements represented by combobox.
nsIBrowserBoxObject
note: please co
nsider using nsicontainerboxobject instead.
... attributes attribute type description docshell
nsidocshell read only.
... obsolete since gecko 1.9 the
nsidocshell object that manages the contained document.
nsICommandLineRunner
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) inherits from: nsicommandline method overview void init(in long argc, in nscharptrarray argv, in nsifile workingdir, in unsigned long state); void run(); void setwindowcontext(in
nsidomwindow awindow); attributes attribute type description helptext autf8string process and combine the help text provided by each command-line handler.
...void setwindowcontext( in
nsidomwindow awindow ); parameters awindow the dom window object which will be set.
... it is an
nsidomwindow object.
nsIEditorBoxObject
note: please co
nsider using nsicontainerboxobject instead.
... attributes attribute type description docshell
nsidocshell read only.
... obsolete since gecko 1.9 the
nsidocshell object that manages the contained document.
nsIIFrameBoxObject
note: please co
nsider using nsicontainerboxobject instead.
... attributes attribute type description docshell
nsidocshell read only.
... obsolete since gecko 1.9 the
nsidocshell object that manages the contained document.
nsILoginManager
to create an instance, use: var loginmanager = components.classes["@mozilla.org/login-manager;1"] .getservice(components.interfaces.nsiloginmanager); method overview void addlogin(in nsilogininfo alogin); nsiautocompleteresult autocompletesearch(in astring asearchstring, in nsiautocompleteresult apreviousresult, in
nsidomhtmlinputelement aelement); unsigned long countlogins(in astring ahostname, in astring aactionurl, in astring ahttprealm); boolean fillform(in
nsidomhtmlformelement aform); void findlogins(out unsigned long count, in astring ahostname, in astring aactionurl, in astring ahttprealm, [retval, array, size_is(count)] out nsilogininfo logins); void getalldisabledho...
... nsiautocompleteresult autocompletesearch( in astring asearchstring, in nsiautocompleteresult apreviousresult, in
nsidomhtmlinputelement aelement ); parameters asearchstring missing description apreviousresult missing description aelement missing description return value missing description countlogins() returns the number of logins matching the specified criteria.
... boolean fillform( in
nsidomhtmlformelement aform ); parameters aform the htmlform to attempt to fill out.
nsIMsgFolder
id markmessagesflagged(in nsisupportsarray messages, in boolean markflagged); void markthreadread(in nsimsgthread thread); void setlabelformessages(in nsisupportsarray messages, in nsmsglabelvalue label); nsimsgdatabase getmsgdatabase(in nsimsgwindow msgwindow); void setmsgdatabase(in nsimsgdatabase msgdatabase); nsimsgdatabase getdbfolderinfoanddb(out
nsidbfolderinfo folderinfo); nsimsgdbhdr getmessageheader(in nsmsgkey msgkey); boolean shouldstoremsgoffline(in nsmsgkey msgkey); boolean hasmsgoffline(in nsmsgkey msgkey); nsiinputstream getofflinefilestream(in nsmsgkey msgkey, out pruint32 offset, out pruint32 size); void downloadmessagesforoffline(in nsisupportsarray messages, in nsimsgwindow window); ...
... dbtransferinfo
nsidbfolderinfo subfolders nsisimpleenumerator readonly: returns an enumerator containing a list of nsimsgfolder items that are subfolders of the instance this is called on.
... void markthreadread(in nsimsgthread thread); setlabelformessages() void setlabelformessages(in nsisupportsarray messages, in nsmsglabelvalue label); getmsgdatabase() nsimsgdatabase getmsgdatabase(in nsimsgwindow msgwindow); setmsgdatabase() void setmsgdatabase(in nsimsgdatabase msgdatabase); getdbfolderinfoanddb() nsimsgdatabase getdbfolderinfoanddb(out
nsidbfolderinfo folderinfo); getmessageheader() nsimsgdbhdr getmessageheader(in nsmsgkey msgkey); shouldstoremsgoffline() boolean shouldstoremsgoffline(in nsmsgkey msgkey); hasmsgoffline() boolean hasmsgoffline(in nsmsgkey msgkey); getofflinefilestream() nsiinputstream getofflinefilestream(in nsmsgkey msgkey, out pruint32 offset, ...
nsIMsgThread
inherits from: nsisupports method overview void addchild(in nsimsgdbhdr child, in nsimsgdbhdr inreplyto, in boolean threadinthread, in
nsidbchangeannouncer announcer); nsimsgdbhdr getchildat(in long index); nsmsgkey getchildkeyat(in long index); nsimsgdbhdr getchild(in nsmsgkey msgkey); nsimsgdbhdr getchildhdrat(in long index); nsimsgdbhdr getroothdr(out long index); void removechildat(in long index); void removechildhdr(in nsimsgdbhdr child, in
nsidbchangeannouncer announcer); void markchildread(in boolean bread); nsimsgdbhdr getfirstunreadchild(); nsisimpleenumerator enumeratemessages(in nsmsgkey parent); ...
... void addchild(in nsimsgdbhdr child, in nsimsgdbhdr inreplyto, in boolean threadinthread, in
nsidbchangeannouncer announcer); parameters child the message to add inreplyto the message this should be in reply to threadinthread announcer an
nsidbchangeannouncer to receive notification when the change is made.
... removechildat() void removechildat(in long index); parameters index the index to remove the message from removechildhdr() void removechildhdr(in nsimsgdbhdr child, in
nsidbchangeannouncer announcer); parameters child the message to remove announcer an
nsidbchangeannouncer to receive notification when the change is made.
nsIMsgWindow
rootdocshell
nsidocshell this is used to track the chrome window's
nsidocshell object.
... messagewindowdocshell
nsidocshell readonly: this retrieves the
nsidocshell object for the message pane.
... domwindow
nsidomwindow the message window's global chrome window object.
Component; nsIPrefBranch
it is co
nsidered reset to its default value.
...if you find yourself wondering what is the maximum amount of data you can store in a string preference, co
nsider storing data separately, for example in a flat file or an sqlite database.
...if you find yourself wondering what is the maximum amount of data you can store in a string preference, co
nsider storing data separately, for example in a flat file or an sqlite database.
nsISHEntry
to create an instance, use: var shentry = components.classes["@mozilla.org/browser/session-history-entry;1"] .createinstance(components.interfaces.nsishentry); method overview void addchildshell(in
nsidocshelltreeitem shell);
nsidocshelltreeitem childshellat(in long index); void clearchildshells(); nsishentry clone(); void create(in nsiuri uri, in astring title, in nsiinputstream inputstream, in nsilayouthistorystate layouthistorystate, in nsisupports cachekey, in acstring contenttype, in nsisupports owner, in unsigned long long docshellid, in boolean dynamiccreation); native code onl...
... document
nsidomdocument dom document.
...void addchildshell( in
nsidocshelltreeitem shell ); parameters shell childshellat()
nsidocshelltreeitem childshellat( in long index ); parameters index the child shell at index; null if index is out of bounds.
nsITaskbarPreviewController
method overview boolean drawpreview(in
nsidomcanvasrenderingcontext2d ctx); boolean drawthumbnail(in
nsidomcanvasrenderingcontext2d ctx, in unsigned long width, in unsigned long height); boolean onactivate(); void onclick(in nsitaskbarpreviewbutton button); void onclose(); attributes attribute type description height unsigned long the height in pixels of the preview ...
... boolean drawpreview( in
nsidomcanvasrenderingcontext2d ctx ); parameters ctx an
nsidomcanvasrenderingcontext2d object representing the drawing context into which the preview is to be rendered.
... boolean drawthumbnail( in
nsidomcanvasrenderingcontext2d ctx, in unsigned long width, in unsigned long height ); parameters ctx an
nsidomcanvasrenderingcontext2d object representing the drawing context into which the thumbnail is to be rendered.
nsITreeContentView
last changed in gecko 1.8.0 inherits from: nsisupports method overview long getindexofitem(in
nsidomelement item);
nsidomelement getitematindex(in long index); attributes attribute type description root
nsidomelement the element in the dom which this view uses as root content.
...long getindexofitem( in
nsidomelement item ); parameters item a tree row for which to find the row index.
...
nsidomelement getitematindex( in long index ); parameters index the row index for which to get the item return value the
nsidomelement item.
nsIUpdate
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview nsiupdatepatch getpatchat(in unsigned long index);
nsidomelement serialize(in
nsidomdocument updates); attributes attribute type description appversion astring the application version of this update.
...
nsidomelement serialize( in
nsidomdocument updates ); parameters updates the dom document into which to serialize the update.
... return value the patch object serialized into an
nsidomelement.
nsIUpdatePatch
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview
nsidomelement serialize(in
nsidomdocument updates); attributes attribute type description finalurl astring the final url this patch was being downloaded from.
...
nsidomelement serialize( in
nsidomdocument updates ); parameters updates the dom document into which to serialize the patch.
... return value the patch object serialized into an
nsidomelement.
nsIWebContentHandlerRegistrar
rbird 8.0 / seamonkey 2.5) implemented by @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 as a service: var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); method overview void registercontenthandler(in domstring mimetype, in domstring uri, in domstring title, in
nsidomwindow contentwindow) void registerprotocolhandler(in domstring protocol,in domstring uri, in domstring title, in
nsidomwindow contentwindow) methods registercontenthandler summary of registercontenthandler void registercontenthandler( in domstring mimetype, in domstring uri, in domstring title, in...
...
nsidomwindow contentwindow ); parameters mimetype the desired mime type as a string uri the uri to the handler as a string.
... registerprotocolhandler summary of registerprotocolhandler void registerprotocolhandler( in domstring protocol, in domstring uri, in domstring title, in
nsidomwindow contentwindow ); parameters protocol the protocol the site wishes to handle, specified as a string.
nsIWebProgressListener
(see below for a description of document requests.) other types of requests, such as requests for inline content (for example images and stylesheets) are co
nsidered normal requests.
..."); var mylistener = { queryinterface: xpcomutils.generateqi(["nsiwebprogresslistener", "nsisupportsweakreference"]), onstatechange: function(awebprogress, arequest, aflag, astatus) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.
nsidomwindowutils) .outerwindowid; sendasyncmessage("myaddonmessage", { name: "onstatechange", flag: aflag, status: astatus, }); }, onlocationchange: function(aprogress, arequest, auri, aflag) { let win = awebprogress.domwindow; let outerwindowid = win.queryinterface(ci.nsiinterfacerequestor) ...
... .getinterface(ci.
nsidomwindowutils) .outerwindowid; sendasyncmessage("myaddonmessage", { name: "onlocationchange", outerwindowid: outerwindowid, uri: auri.spec, charset: auri.charset, flag: aflag, }); }, // for definitions of the remaining functions see related documentation onprogresschange: function(awebprogress, arequest, curself, maxself, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } let filter = cc["@mozilla.org/appshell/component/browser-status-filter;1"] .createinstance(ci.nsiwebprogress); filter.addprogre...
nsIWorkerScope
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface represents the global scope in which a worker's script runs.
... 1.0 66 introduced gecko 1.9.1 inherits from: nsiworkerglobalscope last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); void close(); attributes attribute type description onclose
nsidomeventlistener a listener object to be called when the worker stops running.
... onmessage
nsidomeventlistener a listener object to be called when a message is posted on the port.
nsIXULTemplateResult
method overview astring getbindingfor(in nsiatom avar); nsisupports getbindingobjectfor(in nsiatom avar); void hasbeenremoved(); void rulematched(in nsisupports aquery, in
nsidomnode arulenode); attributes attribute type description id astring id of the result.
...the question mark is co
nsidered part of the variable name, thus avar should be ?name and not simply name.
...void rulematched( in nsisupports aquery, in
nsidomnode arulenode ); parameters aquery the query that matched.
nsIXmlRpcClient
supported arguments are: nsisupportspruint8, nsisupportspruint16, nsisupportsprint16, nsisupportsprint32: i4, nsisupportsprbool: boolean, nsisupportschar, nsisupportscstring: string, nsisupportsfloat, nsisupportsdouble: double, nsisupportsprtime: datetime.iso8601, nsiinputstream: base64, nsisupportsarray: array,
nsidictionary: struct note that both nsisupportsarray and
nsidictionary can only hold any of the supported input types.
... return value will be converted as follows: i4 or int: nsisupportsprint32 boolean: nsisupportsprbool string: nsisupportscstring double: nsisupportsdouble datetime.iso8601: nsisupportsprtime base64: nsisupportscstring array: nsisupportsarray struct:
nsidictionary faults (server side errors) are indicated by returning ns_error_failure.
...te method to call arguments array of arguments to pass to the remote method count void asynccall ( in nsixmlrpcclientlistener listener, in nsisupports ctxt, in string methodname, [array, size_is(count)] in nsisupports arguments, in pruint32 count ); createtype() convenience: return the correct nsisupportsprimitive for a given xml-rpc type, or nsisupportsarray or
nsidictionary.
nsIZipReader
the only character that must be escaped i
nside the brackets is ].
...if ] is to appear i
nside the brackets as a character to not match, it must be escaped.
... example demonstrating this function: list contents of xpi and read file contents openinner() opens a zip file i
nside a zip file for reading.
nsPIPromptService
this interface defines the meaning of each indexes of getint(), setint(), getstring() and setstring() of the
nsidialogparamblock interface but they are defined on in c++.
... method overview void dodialog(in
nsidomwindow aparent, in
nsidialogparamblock aparamblock, in string achromeurl); methods dodialog() opens a dialog.
... void dodialog( in
nsidomwindow aparent, in
nsidialogparamblock aparamblock, in string achromeurl ); parameters aparent the parent window of the dialog.
Weak reference
if the referent object is destroyed before the weak reference, the pointer i
nside the weak reference is set to nsnull.
...this technique can significantly simplify certain relationships, and you should co
nsider it when an owning reference is inappropriate, but where a raw pointer might end up dangling.
... } alternatives this technique is useful, but in situations where you need this, there are two alternatives which you may want to co
nsider: 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.
Accessibility Inspector - Firefox Developer Tools
here we are mainly talking about exposing information to people with visual disabilities — this is done via the accessibility apis available i
nside web browsers, which expose information on what roles the different elements on your page play (e.g., are they just text, or are they buttons, links, form elements, etc.?).
... indexinparent — an index value indicating what number child the item is, i
nside its parent.
... if the item is the first item i
nside its parent, it has a value of 0.
Edit fonts - Firefox Developer Tools
fonts are co
nsidered "used" when there is text content in the inspected element that has the font applied to it.
... variable fonts, or opentype font variations, define a new font file format that allows the font designer to include multiple variations of a typeface i
nside a single font file.
... here are the registered axes along with their corresponding css properties: axis tag css property "wght" font-weight "wdth" font-stretch "slnt" (slant) font-style: oblique + angle "ital" font-style: italic "opsz" font-optical-sizing any axis that is not on the list of registered axes is co
nsidered a custom axis.
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
extend lines infinitely: by default, grid lines/tracks are only shown i
nside the element with display: grid set on it; when toggling this option on, the grid lines extend to the edge of the viewport along each axis.
... a target icon that when clicked immediately selects the html element that this grid entry relates to, i
nside the html pane.
... extend lines infinitely by default, the grid lines/tracks are only shown i
nside the element with display: grid set on it.
BiquadFilterNode.type - Web APIs
frequencies outside the given range of frequencies are attenuated; the frequencies i
nside it pass through.
... peaking frequencies i
nside the range get a boost or an attenuation; frequencies outside it are unchanged.
...it is the opposite of a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies i
nside it are attenuated.
BiquadFilterNode - Web APIs
frequencies outside the given range of frequencies are attenuated; the frequencies i
nside it pass through.
... peaking frequencies i
nside the range get a boost or an attenuation; frequencies outside it are unchanged.
...it is the opposite of a bandpass filter: frequencies outside the give range of frequencies pass through; frequencies i
nside it are attenuated.
CanvasRenderingContext2D.isPointInStroke() - Web APIs
the canvasrenderingcontext2d.ispointinstroke() method of the canvas 2d api reports whether or not the specified point is i
nside the area contained by the stroking of a path.
... return value boolean a boolean, which is true if the point is i
nside the area contained by the stroking of a path, otherwise false.
...t const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create ellipse const ellipse = new path2d(); ellipse.ellipse(150, 75, 40, 60, math.pi * .25, 0, 2 * math.pi); ctx.linewidth = 25; ctx.strokestyle = 'red'; ctx.fill(ellipse); ctx.stroke(ellipse); // listen for mouse moves canvas.addeventlistener('mousemove', function(event) { // check whether point is i
nside ellipse's stroke if (ctx.ispointinstroke(ellipse, event.offsetx, event.offsety)) { ctx.strokestyle = 'green'; } else { ctx.strokestyle = 'red'; } // draw ellipse ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.fill(ellipse); ctx.stroke(ellipse); }); result specifications specification status comment html living standardthe definition o...
Element.getClientRects() - Web APIs
html example 1: this html creates three paragraphs with a <span> i
nside, each embedded in a <div> block.
... <h3>a paragraph with a span i
nside</h3> <p>both the span and the paragraph have a border set.
.../th></tr> </thead> <tbody> <tr><td>tbody</td></tr> </tbody> </table> </div> <div> <strong>table's rect</strong> <table class="withclientrectsoverlay"> <caption>caption</caption> <thead> <tr><th>thead</th></tr> </thead> <tbody> <tr><td>tbody</td></tr> </tbody> </table> </div> css the css draws borders around the paragraph and the <span> i
nside each <div> block for the first example, around the <ol> and <li> for the second example, and around <table>, <th>, and <td> elements for the third example.
Element.insertAdjacentElement() - Web APIs
'afterbegin': just i
nside the targetelement, before its first child.
... 'beforeend': just i
nside the targetelement, after its last child.
...empdiv); }); afterbtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('afterend',tempdiv); } setlistener(tempdiv); }); have a look at our insertadjacentelement.html demo on github (see the source code too.) here we have a sequence of <div> elements i
nside a container.
Using files from web applications - Web APIs
accessing selected file(s) co
nsider this html: <input type="file" id="input" multiple> the file api makes it possible to access a filelist containing file objects representing the files selected by the user.
... co
nsider this html: <input type="file" id="fileelem" multiple accept="image/*" style="display:none"> <button id="fileselect">select some files</button> the code that handles the click event can look like this: const fileselect = document.getelementbyid("fileselect"), fileelem = document.getelementbyid("fileelem"); fileselect.addeventlistener("click", function (e) { if (fileelem) { fileelem.c...
... co
nsider this html: <input type="file" id="fileelem" multiple accept="image/*" class="visually-hidden"> <label for="fileelem">select some files</label> and this css: .visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); } /* separate rule for compatibility, :focus-within is required on modern firefox and chrome */ input...
Fullscreen API - Web APIs
you may wish to co
nsider using a library such as fscreen for vendor agnostic access to the fullscreen api.
... no support 9 — 65notes alternate name notes before firefox 44, firefox incorrectly allowed elements i
nside a <frame> or <object> element to request, and to be granted, fullscreen.
... no support 9 — 65notes alternate name notes before firefox 44, firefox incorrectly allowed elements i
nside a <frame> or an <object> to request, and to be granted, fullscreen.
Basic concepts - Web APIs
indexeddb is a way for you to persistently store data i
nside a user's browser.
... this transaction model is really useful when you co
nsider what might happen if a user opened two instances of your web app in two different tabs simultaneously.
...the only place where the schema of the database can be updated is i
nside the handler of that event.
Using IndexedDB - Web APIs
indexeddb is a way for you to persistently store data i
nside a user's browser.
...once you are i
nside the transaction, you can access the object stores that hold your data and make your requests.
... version changes while a web app is open in another tab when your web app changes in such a way that a version change is required for your database, you need to co
nsider what happens if the user has the old version of your app open in one tab and then loads the new version of your app in another.
Using the Notifications API - Web APIs
to avoid duplicating code, we have stored a few bits of housekeeping code i
nside the handlepermission() function, which is the first main block i
nside this snippet.
... i
nside here we explicitly set the notification.permission value (some old versions of chrome failed to do this automatically), and show or hide the button depending on what the user chose in the permission dialog.
... for example, in the to-do-list example we use the following snippet to create a notification when required (found i
nside the createnotification() function): var img = '/to-do-notifications/img/icon-128.png'; var text = 'hey!
Page Visibility API - Web APIs
use cases let's co
nsider a few use cases for the page visibility api.
... tabs which are playing audio are co
nsidered foreground and aren’t throttled.
... videoelement.addeventlistener("play", function(){ document.title = 'playing'; }, false); } properties added to the document interface the page visibility api adds the following properties to the document interface: document.hidden read only returns true if the page is in a state co
nsidered to be hidden to the user, and false otherwise.
ParentNode.querySelectorAll() - Web APIs
if you need only a single result, co
nsider the queryselector() method instead.
...list of all of the <p> elements in the document: var matches = document.queryselectorall("p"); this example returns a list of all <div> elements within the document with a class of either note or alert: var matches = document.queryselectorall("div.note, div.alert"); here, we get a list of <p> elements whose immediate parent element is a <div> with the class highlighted and which are located i
nside a container whose id is test.
... html co
nsider this html, with its three nested <div> blocks.
RTCIceCandidate.priority - Web APIs
the rtcicecandidate interface's read-only priority property specifies the candidate's priority according to the remote peer; the higher this value is, the better the remote peer co
nsiders the candidate to be.
...the larger this value is, the more preferable the remote peer co
nsiders this candidate to be.
... usage notes co
nsider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the priority is the number after the protocol, so it's the fourth field in the candidate string.
Screen Wake Lock API - Web APIs
performance co
nsiderations release the screen wake lock when user ends activity that required always-on screen.
... if your app is performing long-running downloads, co
nsider using background fetch.
... if you app is synchronizing data from a remote server, co
nsider using background sync.
Service Worker API - Web APIs
it is designed to be fully async; as a consequence, apis such as synchronous xhr and localstorage can't be used i
nside a service worker.
...if successful, your service worker will be downloaded to the client and attempt installation/activation (see below) for urls accessed by the user i
nside the whole origin, or i
nside a subset specified by you.
... you can listen for the installevent; a standard action is to prepare your service worker for usage when this fires, for example by creating a cache using the built in storage api, and placing assets i
nside it that you'll want for running your app offline.
ShadowRoot - Web APIs
shadowroot.innerhtml sets or returns a reference to the dom tree i
nside the shadowroot.
... i
nside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element.
...from here we use standard dom traversal techniques to find the <style> element i
nside the shadow dom and then update the css found i
nside it: function updatestyle(elem) { var shadow = elem.shadowroot; var childnodes = shadow.childnodes; for(var i = 0; i < childnodes.length; i++) { if(childnodes[i].nodename === 'style') { childnodes[i].textcontent = 'div {' + 'width: ' + elem.getattribute('l') + 'px;' + 'height: ' + elem.getattribute('l...
Storage API - Web APIs
one of the most likely methods—one which the specification specifically encourages, in fact—would be to co
nsider the popularity and/or usage levels of individual sites to determine what their quotas should be.
... "persistent" the user agent will retain the data as long as possible, clearing all "best-effort" boxes before co
nsidering clearing a box marked "persistent".
... if it becomes necessary to co
nsider clearing persistent boxes, the user agent will notify the user and provide a way to clear one or more persistent boxes as needed.
SubtleCrypto.wrapKey() - Web APIs
wrapping a key helps protect it in untrusted environments, such as i
nside an otherwise unprotected data store or in transmission over an unprotected network.
...*/ window.crypto.subtle.generatekey( { name: "rsa-pss", // co
nsider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["sign", "verify"] ) .then((keypair) => { return wrapcryptokey(keypair.privatekey); }) .then((wrappedkey) => { console.log(wrappedkey); }); subjectpublickeyinfo wrap this example wraps an rsa public encryption key.
...*/ window.crypto.subtle.generatekey( { name: "rsa-oaep", // co
nsider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["encrypt", "decrypt"] ) .then((keypair) => { return wrapcryptokey(keypair.publickey); }) .then((wrappedkey) => { console.log(wrappedkey); }); json web key import this code wraps an ecdsa private signing key.
Using Touch Events - Web APIs
from interfaces to gestures an application may co
nsider different factors when defining the semantics of a gesture.
...the directionality of a swipe (for example left to right, right to left, etc.) is another factor to co
nsider.
... // touchmove handler function process_touchmove(ev) { // set call preventdefault() ev.preventdefault(); } best practices here are some best practices to co
nsider when using touch events: minimize the amount of work that is done in the touch handlers.
Geometry and reference spaces in WebXR - Web APIs
after putting on a headset, co
nsider the virtual world around you to have a coordinate system in which your position is (0, 0, 0)—that is, you're at the center of everything.
... next, co
nsider the xr controller you have in your left hand.
...co
nsider the model of a player's avatar standing in the game world's space.
Inputs and input sources - Web APIs
not only would this controller then take the responsibility of clicking through the user interface of your app, but it would also be co
nsidered the "main hand," while other controllers would then be off-hand or additional controllers.
... note: if an input source doesn't have a primary action, the input source is co
nsidered to be an auxiliary input source.
... transient actions if an xr device uses the mouse to simulate a controller when in the inline mode, the approximate sequence of things takes place: the user presses the mouse button while i
nside the <canvas> presenting the webxr scene.
Lighting a WebXR setting - Web APIs
it is at this time that the scene's lighting is co
nsidered and applied as appropriate to the pixel before the pixel is stored into the framebuffer.
...in this section, we provide some basic mixed reality lighting guidelines to co
nsider as you construct, render, and light your scene.
... temporal and spatial filtering co
nsider an attack that uses a building's automated lighting system to flash the lights on and off quickly in a known pattern.
Basic concepts behind Web Audio API - Web APIs
audio graphs the web audio api involves handling audio operations i
nside an audio context, and has been designed to allow modular routing.
... i
nside the context, create sources — such as <audio>, oscillator, or stream.
... audio buffers: frames, samples and channels an audiobuffer takes as its parameters a number of channels (1 for mono, 2 for stereo, etc), a length, meaning the number of sample frames i
nside the buffer, and a sample rate, which is the number of sample frames played per second.
Background audio processing using AudioWorklet - Web APIs
let's start at the i
nside and work our way out.
... in general, the lifetime policy of any audio node is simple: if the node is still co
nsidered to be actively processing audio, it will continue to be used.
... in the case of an audioworkletnode, the node is co
nsidered to be active if its process() function returns true and the node is either generating content as a source for audio data, or is receiving data from one or more inputs.
Web Workers API - Web APIs
you can run whatever code you like i
nside the worker thread, with some exceptions.
... for example, you can't directly manipulate the dom from i
nside a worker, or use some default methods and properties of the window object.
... audio workers provide the ability for direct scripted audio processing to be done i
nside a web worker context.
Window.print() - Web APIs
desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webviewchrome for androidfirefox for androidopera for androidsafari on iossamsung internetprintchrome full support 1notes full support 1notes notes starting with chrome 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.edge full support 12firefox full support 1ie full support 5opera full support 6notes full support 6notes...
... notes starting with opera 33, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.safari full support 1.1webview android full support 1notes full support 1notes notes starting with webview 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.chrome android full support 18notes full support 18notes notes starting with chrome 46, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.firefox android no support ...
... nonotes no support nonotes notes see bug 1247609.opera android full support 10.1notes full support 10.1notes notes starting with opera 33, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.safari ios full support 1samsung internet android full support 1.0notes full support 1.0notes notes starting with samsung internet 5.0, this method is blocked i
nside an <iframe> unless its sandbox attribute has the value allow-modals.legend ...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" settimeout(myarray.mymethod, 1000); // prints "[object window]" after 1 second settimeout(myarray.mymethod, 1500, "1"); // prints "undefined" after 1,5 seconds // passing the 'this' object with .call won't work // because this will change the value of this i
nside settimeout itself // while we want to change the value of this i
nside myarray.mymethod // in fact, it will be an error because settimeout code expects this to be the window object: settimeout.call(myarray, myarray.mymethod, 2000); // error: "ns_error_xpc_bad_op_on_wn_proto: illegal operation on wrappednative prototype object" settimeout.call(myarray, myarray.mymethod, 2500, 2); // same error a...
...also, es2015 supports arrow functions, with lexical this allowing us to write setinterval( () => this.mymethod) if we're i
nside myarray method.
...loop() is recursively called i
nside settimeout() after the logic has completed executing.
XRBoundedReferenceSpace.boundsGeometry - Web APIs
the read-only xrboundedreferencespace property boundsgeometry is an array of dompointreadonly objects which specifies the points making up a polygon i
nside which the viewer is allowed to move.
... syntax bounds = xrreferencespace.boundsgeometry; value the boundsgeometry property is an array of dompointreadonly objects, each of which defines one vertex in a polygon i
nside which the viewer is required to remain.
...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 co
nsidered an error condition.
Using the aria-relevant attribute - Accessibility
values a space-delimited list of one or more of the following values: additions element nodes added to the accessibility tree within the live region; should be co
nsidered relevant.
... removals are deletion of nodes in the accessiblity tree; should be co
nsidered relevant.
... text are changes to the textual content of existing nodes; should be co
nsidered relevant.
ARIA: timer role - Accessibility
required javascript features keypress used to handle keyboard input and control the focus click, touch handle as appropriate for your widget as well changing attribute values aria-activedescendant is used to manage the focus i
nside the application container.
...the author of the timer must take full responsibility for not letting users get stuck in a focus limbo or trap focus i
nside something the user cannot exit of.
... as an illustration of aria-atomic, co
nsider a site with a simple clock, showing hours and minutes.
ARIA: feed role - Accessibility
by identifying the elements i
nside of an article that provide the title and the primary content, assistive technologies can provide functions that enable users to jump from article to article and efficiently discern which articles they want to read.
... keyboard interaction supporting the following, or a similar, interface is recommended when focus is i
nside the feed: page down: move focus to next article.
...each article should preferably have aria-describedby referring to one or more elements i
nside the article that serve as the primary content of the article.
ARIA: List role - Accessibility
it is normally used in conjunction with the listitem role, which is used to identify a list item contained i
nside the list.
... <section 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 i
nside it can be identified to assistive technologies using the list and listitem containers respectively.
...so, the li elements are not exposed to assistive technologies, but elements contained i
nside of those li elements, including nested lists, are visible to assistive technologies.
ARIA: img role - Accessibility
the aria img role can be used to identify multiple elements i
nside page content that should be co
nsidered as a single image.
... you shouldn't count on the alt text of individual elements images for conveying context to assistive technologies; most screenreaders will co
nsider the element with role="img" set on it to be to be like a black box, and not access the individual elements i
nside it.
...this will cause screen readers to just co
nsider it as a single entity and describe it using the label, rather than trying to read out all the child nodes: <svg role="img" aria-label="description of your svg image"> <!-- contents of the svg image --> </svg> using role="img" to confer meaning that is obscured or implied in certain cases, assistive technology users won't be able to get the meaning of content expressed in certain ways, thro...
ARIA: tab role - Accessibility
the aria tab role indicates an interactive element i
nside a tablist that, when activated, displays its associated tabpanel.
...some assistive technology will provide a count of the number of tab role elements i
nside a tablist, and inform users of which tab they currently have targeted.
...we then find all tabs with aria-selected=true i
nside the parent element and sets it to false, then sets the triggering element's aria-selected to true.
ARIA: button role - Accessibility
the values include aria-pressed="false" when a button is not currently pressed, aria-pressed="true" to indicate a button is currently pressed, and aria-pressed="mixed" if the button is co
nsidered to be partially pressed.
...for most buttons, this name will be the same as the text i
nside the button.
... if aria-pressed="mixed" is used, the button is co
nsidered to be partially pressed.
An overview of accessible web applications and widgets - Accessibility
for example, co
nsider an "inline edit" widget: a component that allows users to edit a piece of text in place, without switching contexts.
... when the widget is not i
nside a form, both the enter and spacebar keys should select or activate the control.
...once keyboard focus is i
nside the container, the arrow keys should allow the user to navigate between each tab (the <li> elements).
Keyboard-navigable JavaScript widgets - Accessibility
for techniques for managing focus within widgets, see "managing focus i
nside groups" below.
... managing focus i
nside groups when a user tabs away from a widget and returns, focus should return to the specific element that had focus, for example, the tree item or grid cell.
...dom focus events are co
nsidered informational only: generated by the system after something is focused, but not actually used to set focus.
::slotted() - CSS: Cascading Style Sheets
the ::slotted() css pseudo-element represents any element that has been placed into a slot i
nside an html template (see using templates and slots for more information).
... this only works when used i
nside css placed within a shadow dom.
... /* selects any element placed i
nside a slot */ ::slotted(*) { font-weight: bold; } /* selects any <span> placed i
nside a slot */ ::slotted(span) { font-weight: bold; } syntax ::slotted( <compound-selector-list> )where <compound-selector-list> = <compound-selector>#where <compound-selector> = [ <type-selector>?
:where() - CSS: Cascading Style Sheets
to make selecting the links i
nside them simpler, but still distinct, we could use :is() or :where(), in the following manner: html { font-family: sans-serif; font-size: 150%; } :is(section.is-styling, aside.is-styling, footer.is-styling) a { color: red; } :where(section.where-styling, aside.where-styling, footer.where-styling) a { color: orange; } however, what if we later want to override the color of links in the fo...
... footer a { color: blue; } this won't work for the red links, because the selectors i
nside :is() count towards the specificity of the overall selector, and class selectors have a higher specificity than element selectors.
... however, selectors i
nside :where() have specificity 0, so the orange footer link will be overidden by our simple selector.
@font-face - CSS: Cascading Style Sheets
to provide the browser with a hint as to what format a font resource is — so it can select a suitable one — it is possible to include a format type i
nside a format() function: src: url(ideal-sans-serif.woff) format("woff"), url(basic-sans-serif.ttf) format("truetype"); the available types are: "woff", "woff2", "truetype", "opentype", "embedded-opentype", and "svg".
... by allowing authors to provide their own fonts, @font-face makes it possible to design content without being limited to the so-called "web-safe" fonts (that is, the fonts which are so common that they're co
nsidered to be universally available).
... the @font-face at-rule may be used not only at the top level of a css, but also i
nside any css conditional-group at-rule.
Basic concepts of flexbox - CSS: Cascading Style Sheets
in doing so, you should co
nsider each line as a new flex container.
... before we can make sense of these properties we need to co
nsider the concept of available space.
...try this in the live example — i have given the flex container a height in order that you can see how the items can be moved around i
nside the container.
Layout using named grid lines - CSS: Cascading Style Sheets
* {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } when defining the grid, i name my lines i
nside square brackets.
...to do this add the names i
nside the square brackets with whitespace between them [sidebar-end main-start].
...if you co
nsider grid systems such as those found in frameworks like foundation or bootstrap, these are based on a 12 column grid.
Introducing the CSS Cascade - CSS: Cascading Style Sheets
if several @font-face rules with the same descriptor are defined, only the most appropriate @font-face, as a whole, is co
nsidered.
... 1 user agent normal 2 user normal 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 co
nsidered to choose one or the other.
...inline styles within the html: user-agent css: li { margin-left: 10px } author css 1: li { margin-left: 0 } /* this is a reset */ author css 2: @media screen { li { margin-left: 3px } } @media print { li { margin-left: 1px } } user css: .specific { margin-left: 1em } html: <ul> <li class="specific">1<sup>st</sup></li> <li>2<sup>nd</sup></li> </ul> in this case, declarations i
nside li and .specific rules should apply.
Pagination - CSS: Cascading Style Sheets
to ensure that the pagination is understandable by people using a screenreader, we mark the items up as a list i
nside a <nav> element, and then use css to display the layout visually as a row.
... recipe download this example choices made this pattern is laid out using flexbox — one flex container nested i
nside another.
... the <nav> element is designated a flex container in order that we can center the list i
nside using the justify-content property.
box-shadow - CSS: Cascading Style Sheets
the presence of the inset keyword changes the shadow to one i
nside the frame (as if the content was depressed i
nside the box).
... inset shadows are drawn i
nside the border (even transparent ones), above the background, but below content.
...the specification does not include an exact algorithm for how the blur radius should be calculated, however, it does elaborate as follows: …for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow’s edge, and that ranges from the full shadow color at the radius endpoint i
nside the shadow to fully transparent at the endpoint outside it.
clip - CSS: Cascading Style Sheets
the <top> and <bottom> values are offsets from the i
nside top border edge of the box, while <right> and <left> are offsets from the i
nside left border edge of the box — that is, the extent of the padding box.
...if any side's value is auto, the element is clipped to that side's i
nside border edge.
...this is different from rect(auto, auto, auto, auto), which clips to the element’s i
nside border edges.
font-weight - CSS: Cascading Style Sheets
note that only four font weights are co
nsidered for relative weight calculation; see the meaning of relative weights section below.
...note that only four font weights are co
nsidered for relative weight calculation; see the meaning of relative weights section below.
... note that when using relative weights, only four font weights are co
nsidered — thin (100), normal (400), bold (700), and heavy (900).
list-style - CSS: Cascading Style Sheets
because this property is inherited, it can be set on a parent element (normally <ol> or <ul>) to make the same list styling apply to all the items i
nside.
... constituent properties this property is a shorthand for the following css properties: list-style-image list-style-position list-style-type syntax /* type */ list-style: square; /* image */ list-style: url('../img/shape.png'); /* position */ list-style: i
nside; /* type | position */ list-style: georgian i
nside; /* type | image | position */ list-style: lower-roman url('../img/shape.png') outside; /* keyword value */ list-style: none; /* global values */ list-style: inherit; list-style: initial; list-style: unset; the list-style property is specified as one, two, or three keywords in any order.
...rmal syntax <'list-style-type'> | <'list-style-position'> | <'list-style-image'> examples setting list style type and position html list 1 <ul class="one"> <li>list item1</li> <li>list item2</li> <li>list item3</li> </ul> list 2 <ul class="two"> <li>list item a</li> <li>list item b</li> <li>list item c</li> </ul> css .one { list-style: circle; } .two { list-style: square i
nside; } result specifications specification status comment css lists module level 3the definition of 'list-style' in that specification.
overscroll-behavior-block - CSS: Cascading Style Sheets
contain default scroll overflow behavior is observed i
nside the element this value is set on (e.g.
... formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing block overscrolling in this demo we have two block-level boxes, one i
nside the other.
...the inner box has a small width (and height) set on it so it sits comforably i
nside the viewport, but its content is given a large height so it will also scroll vertically.
overscroll-behavior-inline - CSS: Cascading Style Sheets
contain default scroll overflow behavior is observed i
nside the element this value is set on (e.g.
... formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing inline overscrolling in this demo we have two block-level boxes, one i
nside the other.
...the inner box has a small width (and height) set on it so it sits comforably i
nside the viewport, but its content is given a large width so it will also scroll horizontally.
overscroll-behavior-x - CSS: Cascading Style Sheets
contain default scroll overflow behavior is observed i
nside the element this value is set on (e.g.
... formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples preventing an underlying element from scrolling horizontally in our simple overscroll-behavior-x example (see source code also), we have two block-level boxes, one i
nside the other.
...the inner box has a small width (and height) set on it so it sits comforably i
nside the viewport, but its content is given a large width so it will scroll horizontally.
text-transform - CSS: Cascading Style Sheets
this resulted in differences between browsers in the way the first letter was calculated (firefox co
nsidered - and _ as letters, but other browsers did not.
... both webkit and gecko incorrectly co
nsidered letter-based symbols like ⓐ to be real letters.
... full-width is a keyword that forces the writing of a character — mainly ideograms and latin scripts — i
nside a square, allowing them to be aligned in the usual east asian scripts (like chinese or japanese).
unicode-bidi - CSS: Cascading Style Sheets
this means that i
nside the element, reordering is strictly in sequence according to the direction property; the implicit part of the bidirectional algorithm is ignored.
... isolate this keyword indicates that the element's container directionality should be calculated without co
nsidering the content of this element.
... plaintext this keyword makes the elements directionality calculated without co
nsidering its parent bidirectional state or the value of the direction property.
Audio and Video Delivery - Developer guides
co
nsider this html: <video> <source id="mp4_src" src="video.mp4" type='video/mp4; codecs="avc1.42e01e, mp4a.40.2"'> </source> <source id="3gp_src" src="video.3gp" type='video/3gpp; codecs="mp4v.20.8, samr"'> </source> <source id="ogg_src" src="video.ogv" type='video/ogv; codecs="theora, vorbis"'> </source> </video> since firefox doesn't support mp4 and 3gp on some platforms due to their pa...
...co
nsider using a different format or using a fallback.
... setting up adaptive streaming media sources let's say you want to set up an adaptive streaming media source on a server, to be consumed i
nside an html5 media element.
Orientation and motion data explained - Developer guides
there are two coordinate frames to co
nsider when using orientation and motion events: earth coordinate frame the earth coordinate frame is the coordinate frame fixed on the center of the earth; that is, the axes are aligned based on the pull of gravity and the standard magnetic north orientation.
... note: on a phone or tablet, the orientation of the device is always co
nsidered in relation to the standard orientation of the screen; this is the "portrait" orientation on most devices.
... on a laptop computer, the orientation is co
nsidered in relation to the keyboard.
User input and controls - Developer guides
using features such as contenteditable elements you can implement fast rich-text editors and with drag&drop let users moving elements i
nside your app.
... finger touch when developing web applications meant to be installed on touchscreen devices, it’s a good practice to take into co
nsideration the different capabilities in terms of screen resolution and user input.
...the demo uses javascript to draw a ball i
nside a <canvas> element.
<button>: The Button element - HTML: Hypertext Markup Language
(if this attribute is not set, the <button> is associated with its ancestor <form> element, if any.) this attribute lets you associate <button> elements to <form>s anywhere in the document, not just i
nside a <form>.
... formenctype html5 if the button is a submit button (it's i
nside/associated with a <form> and doesn't have type="button"), specifies how to encode the form data that is submitted.
... formmethod html5 if the button is a submit button (it's i
nside/associated with a <form> and doesn't have type="button"), this attribute specifies the http method used to submit the form.
<dfn>: The Definition element - HTML: Hypertext Markup Language
the <p> element, the <dt>/<dd> pairing, or the <section> element which is the nearest ancestor of the <dfn> is co
nsidered to be the definition of the term.
... specifying the term being defined the term being defined is identified following these rules: if the <dfn> element has a title attribute, the value of the title attribute is co
nsidered to be the term being defined.
...it has been in orbit for over 20 years, scanning the sky and returning data and photographs of unprecedented quality and detail.</p> <p>indeed, the <abbr title="hubble space telescope">hst</abbr> has arguably done more to advance science than any device ever built.</p> note the <abbr> element nested i
nside the <dfn>.
<img>: The Image Embed element - HTML: Hypertext Markup Language
note: you cannot use this attribute if the <img> element is i
nside an <a> or <button> element.
...to do so, nest the <img> tag i
nside the <a>.
...if the alt attribute is purposefully left off because the image has no textual equivalent, co
nsider alternate methods to present what the image is trying to communicate.
<input type="checkbox"> - HTML: Hypertext Markup Language
if you wanted to submit a default value for the checkbox when it is unchecked, you could include an <input type="hidden"> i
nside the form with the same name and value, generated by javascript perhaps.
... essentially, then, the indeterminate attribute adds a third possible state to the checkbox: "i don't know." in this state, the browser may draw the checkbox in grey or with a different mark i
nside the checkbox.
... for instance, browsers on macos may draw the checkbox with a hyphen "-" i
nside to indicate an unexpected state.
<picture>: The Picture element - HTML: Hypertext Markup Language
the browser will co
nsider each child <source> element and choose the best match among them.
... examples these examples demonstrate how different attributes of the <source> element change the selection of the image i
nside <picture>.
... if the <source>'s media condition evaluates to false, the browser skips it and evaluates the next element i
nside <picture>.
Choosing between www and non-www URLs - HTTP
this way, search engines don't index the same page several times, potentially leading to it being co
nsidered as duplicate content or spam, and even removing or lowering your page from the search engine result pages.
...in the previous example, http://www.example.org/whaddup would serve the same content as http://example.org/whaddup, but with an additional <link> element in the head: <link href="http://example.org/whaddup" rel="canonical"> unlike the previous case, browser history will co
nsider non-www and www urls as independent entries.
... deciding the case this is a very subjective topic it could be co
nsidered a bikeshedding issue.
Evolution of HTTP - HTTP
on august 6th 1991, tim berners-lee's post on the public alt.hypertext newsgroup is now co
nsidered as the official start of the world wide web as a public project.
...theoretically, several parallel connections could be used (typically between 5 and 8), bringing co
nsiderable overhead and complexity.
...high-traffic web sites showed the most rapid adoption, saving co
nsiderably on data transfer overheads and subsequent budgets.
Browser detection using the user agent - HTTP
co
nsiderations before using browser detection when co
nsidering using the user agent string to detect which browser is being used, your first step is to try to avoid it if possible.
...also co
nsider the following.
...if there is a lot calculated by this layout function before it determines the new layout of the page, then co
nsider debouncing the event listener such that it is not called as often.
HTTP conditional requests - HTTP
weak validation weak validation differs from strong validation, as it co
nsiders two versions of the document as identical if the content is equivalent.
... for example, a page that would differ from another only by a different date in its footer, or different advertising, would be co
nsidered identical to the other with weak validation.
... these same two versions are co
nsidered different when using strong validation.
Content negotiation - HTTP
though strictly speaking user-agent is not in this list, it is sometimes also used to send a specific representation of the requested resource, though this is not co
nsidered as a good practice.
... the user-agent header though there are legitimate uses of this header for selecting content, it is co
nsidered bad practice to rely on it to define what features are supported by the user agent.
... agent-driven negotiation server-driven negotiation suffers from a few dow
nsides: it doesn't scale well.
Referrer-Policy - HTTP
there is effort from browsers in moving to a stricter default value, namely strict-origin-when-cross-origin (see https://github.com/whatwg/fetch/pull/952), co
nsider using this value (or a stricter one), if possible, when changing the referrer-policy.
...carefully co
nsider the impact of this setting.
... integration with html you can also set referrer policies i
nside html.
JavaScript data types and data structures - JavaScript
caution: although bitwise operators can be used to represent several boolean values within a single number using bit masking, this is usually co
nsidered a bad practice.
...this technique should only be co
nsidered when it is the last measure that can be taken to optimize size.
...this has the dow
nside that the data is available to any script running in the same context.
Details of the object model - JavaScript
a class defines all of the properties that characterize a certain set of objects (co
nsidering methods and fields in java, or members in c++, to be properties).
... you might think that, having called the workerbee constructor from i
nside the engineer constructor, you have set up inheritance appropriately for engineer objects.
...for example, co
nsider the following statements: function hobbyist(hobby) { this.hobby = hobby || 'scuba'; } function engineer(name, projs, mach, hobby) { this.base1 = workerbee; this.base1(name, 'engineering', projs); this.base2 = hobbyist; this.base2(hobby); this.machine = mach || ''; } engineer.prototype = new workerbee; var dennis = new engineer('doe, dennis', ['collabra'], 'hugo'); further...
Indexed collections - JavaScript
for example, co
nsider an array called emp, which contains employees' names indexed by their numerical employee number.
...if provided, thisobject becomes the value of the this keyword i
nside the body of the callback function.
... 1] < b[b.length - 1]) return -1; if (a[a.length - 1] > b[b.length - 1]) return 1; if (a[a.length - 1] == b[b.length - 1]) return 0; } myarray.sort(sortfn) // sorts the array so that myarray = ["wind","fire","rain"] if a is less than b by the sorting system, return -1 (or any negative number) if a is greater than b by the sorting system, return 1 (or any positive number) if a and b are co
nsidered equivalent, return 0.
Keyed collections - JavaScript
the private data and methods belong i
nside the object and are stored in the privates weakmap object.
... -0 and +0 are co
nsidered equal.
... nan is co
nsidered equal to itself (contrary to ===).
Map - JavaScript
nan is co
nsidered the same as nan (even though nan !== nan) and all other values are co
nsidered equal according to the semantics of the === operator.
... in the current ecmascript specification, -0 and +0 are co
nsidered equal, although this was not so in earlier drafts.
... setting object properties setting object properties works for map objects as well, and can cause co
nsiderable confusion.
globalThis - JavaScript
the this keyword could be used i
nside functions running in non–strict mode, but this will be undefined in modules and i
nside functions running in strict mode.
... html and the windowproxy in many engines globalthis will be a reference to the actual global object, but in web browsers, due to iframe and cross-window security co
nsiderations, it references a proxy around the actual global object (which you can't directly access).
... naming several other popular name choices such as self and global were removed from co
nsideration because of their potential to break compatibility with existing code.
Iteration protocols - JavaScript
therefore i
nside of the function, the this keyword can be used to access the properties of the iterable object, to decide what to provide during the iteration.
...i
nside of this generator function, each entry can be provided by using yield.
..., 'b', 'c']) { console.log(value); } // "a" // "b" // "c" console.log([...'abc']); // ["a", "b", "c"] function* gen() { yield* ['a', 'b', 'c']; } console.log(gen().next()); // { value: "a", done: false } [a, b, c] = new set(['a', 'b', 'c']); console.log(a); // "a" non-well-formed iterables if an iterable's @@iterator method doesn't return an iterator object, then it's co
nsidered a non-well-formed iterable.
for await...of - JavaScript
like the await operator, the statement can only be used i
nside an async function.
... async function* asyncgenerator() { let i = 0; while (i < 3) { yield i++; } } (async function() { for await (let num of asyncgenerator()) { console.log(num); } })(); // 0 // 1 // 2 for a more concrete example of iterating over an async generator using for await...of, co
nsider iterating over data from an api.
...rejectedpromises()) { console.log(numorpromise); } } catch (e) { console.log('catched', e) } // 0 // 1 // promise { 2 } // promise { <rejected> 3 } // 4 // catched 5 // called finally to make finally blocks of a sync generator to be always called use appropriate form of the loop, for await...of for the async generator and for...of for the sync one and await yielded promises explicitly i
nside the loop.
Autoplay guide for media and Web Audio APIs - Web media technologies
media with an active audio track are co
nsidered to be audible, and autoplay blocking applies to them.
... that means that both of the following are co
nsidered autoplay behavior, and are therefore subject to the browser's autoplay blocking policy: <audio src="/music.mp4" autoplay> and audioelement.play(); the following web features and apis may be affected by autoplay blocking: the html <audio> and <video> elements the web audio api from the user's perspective, a web page or app that spontaneously starts making noise without warning can be...
... co
nsider this html for a media element: <video src="myvideo.mp4" autoplay onplay=handlefirstplay(event)"> here we have a <video> element whose autoplay attribute is set, with an onplay event handler set up; the event is handled by a function called handlefirstplay(), which receives as input the play event.
Optimizing startup performance - Web Performance
other than the reasons suggested above, co
nsider the impact of a non-responsive page or user interface.
...you should also co
nsider gzipping your data to make it as small as you can.
...for games, co
nsider having background music playing or a nice splash screen displayed.
SVG Presentation Attributes - SVG: Scalable Vector Graphics
value: none|<funciri>|inherit; animatable: yes clip-rule it indicates how to determine what side of a path is i
nside a shape in order to know how a <clippath> should clip its target.
... value: accumulate|new|inherit; animatable: no fill it defines the color of the i
nside of the graphical element it applies to.
... value: <number>|<percentage>; animatable: yes fill-rule it indicates how to determine what side of a path is i
nside a shape.
clipPathUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates i
nside the <clippath> element refer to the user coordinate system as defined when the clipping path was created.
... objectboundingbox this value indicates that all coordinates i
nside the <clippath> element are relative to the bounding box of the element the clipping path is applied to.
... it means that the origin of the coordinate system is the top left corner of the object bounding box and the width and height of the object bounding box are co
nsidered to have a length of 1 unit value.
maskContentUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates i
nside the <mask> element refer to the user coordinate system as defined when the mask was created.
... objectboundingbox this value indicates that all coordinates i
nside the <mask> element are relative to the bounding box of the element the mask is applied to.
... a bounding box could be co
nsidered the same as if the content of the <mask> were bound to a "0 0 1 1" viewbox.
patternContentUnits - SVG: Scalable Vector Graphics
value userspaceonuse | objectboundingbox default value userspaceonuse animatable yes userspaceonuse this value indicates that all coordinates i
nside the <pattern> element refer to the user coordinate system as defined when the pattern tile was created.
... objectboundingbox this value indicates that all coordinates i
nside the <pattern> element are relative to the bounding box of the element the pattern is applied to.
... a bounding box could be co
nsidered the same as if the content of the <pattern> were bound to a "0 0 1 1" viewbox for a pattern tile of width and height of 100%.
rendering-intent - SVG: Scalable Vector Graphics
colors that are outside the gamut are converted to colors that have the same saturation but fall just i
nside the gamut.
... saturation this value leaves colors that fall i
nside the gamut unchanged.
... this method usually converts out of gamut colors to colors that have the same lightness but fall just i
nside the gamut.
<image> - SVG: Scalable Vector Graphics
the <image> svg element includes images i
nside svg documents.
...to include svg files and run scripts i
nside them, try <object> i
nside of <foreignobject>.
...this specific element and its behavior only apply i
nside svg documents or inline svg.
Namespaces crash course - SVG: Scalable Vector Graphics
dtds were never designed with mixed content in mind, and past attempts to create mixed content dtds are now co
nsidered to have failed.
...however, sometimes it is necessary to define parameters so that they can be reused on many different elements and still be co
nsidered to be the same parameter, independently of the element with which they are used.
...co
nsider the following example.
SVG animation with SMIL - SVG: Scalable Vector Graphics
smil allows you to: animate the numeric attributes of an element (x, y, ...) animate transform attributes (translation or rotation) animate color attributes follow a motion path this is done adding an svg element like <animate> i
nside the svg element to animate.
...to do so, we add an <animate> element i
nside the <circle> element.
... if you want to animate more attributes i
nside the same element, just add more <animate> elements.
Gradients in SVG - SVG: Scalable Vector Graphics
you must give the gradient an id attribute; otherwise it can't be referenced by other elements i
nside the file.
...to insert one, you create a <lineargradient> node i
nside the definitions section of your svg file.
...i
nside the linear gradient are several <stop> nodes.
SVG fonts - SVG: Scalable Vector Graphics
internet explorer hasn't co
nsidered implementing this, the functionality has been removed from chrome 38 (and opera 25) and firefox has postponed its implementation indefinitely to concentrate on woff.
...it also shows how glyphs are created: by simply adding any graphical svg content i
nside.
... there are two further elements that can be defined i
nside font: <hkern> and <vkern>.
Mixed content - Web security
passive content list this section lists all types of http requests which are co
nsidered 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.
... active content examples this section lists some types of http requests which are co
nsidered active content: <script> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xmlhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth).
... <object> (data attribute) navigator.sendbeacon (url attribute) other resource types like web fonts and workers may be co
nsidered active mixed content, as they are in chrome.
Index - XSLT: Extensible Stylesheet Language Transformations
the element must be defined before any other output document element i
nside the output document element for which it establishes attribute values.
... but it may be after or i
nside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.).
...when used i
nside an <xsl:template> element, the parameter is local to that template.
Compiling from Rust to WebAssembly - WebAssembly
calling external functions in javascript from rust the next part looks like this: #[wasm_bindgen] extern { pub fn alert(s: &str); } the bit i
nside the #[ ] is called an "attribute", and it modifies the next statement somehow.
...you have an npm package i
nside of the pkg directory.
...this isn't co
nsidered a best practice, but this is a demo, so it's ok for now.
Classes and Inheritance - Archive of obsolete content
co
nsider the following: let circle = circle(2, 3, 5); circle.draw(); // => typeerror: circle.draw is not a function this is not quite right.
...co
nsider the following: let circle = circle(2, 3, 5); circle instanceof shape; // => false since instances of circle inherit from shape, we definitely want the result of this expression to be true.
context-menu - Archive of obsolete content
the example above works because <img> elements can't contain other elements, but in the example below, node.nodename is not guaranteed to be "p" - for example, it won't be "p" if the user context-clicked a link i
nside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + '});' }); the content script is executed for every page that a context menu is shown for.
... if you run this add-on you'll see that it always logs "body", even if you click on a paragraph element i
nside the page: info: contextmenu-example: clicked: body by contrast, this add-on uses the pagecontext: var script = "self.on('click', function (node, data) {" + " console.log('clicked: ' + node.nodename);" + "});"; var cm = require("sdk/context-menu"); cm.item({ label: "body context", context: cm.pagecontext(), contentscript: script }); it will log the name of t...
widget - Archive of obsolete content
for example, this widget contains an image, so it looks like a simple icon: require("sdk/widget").widget({ id: "mozilla-icon", label: "my mozilla widget", contenturl: "http://www.mozilla.org/favicon.ico" }); you can make contenturl point to an html or icon file which you have packaged i
nside your add-on.
... the widget: data = require("sdk/self").data var clockpanel = require("sdk/panel").panel({ width:215, height:160, contenturl: data.url("clock.html") }); widget = require("sdk/widget").widget({ id: "open-clock-btn", label: "clock", contenturl: data.url("history.png") }); widget.panel = clockpanel; // will not be anchored widget.panel.show(); also, if you try to call panel.show() i
nside your widget's click event listener, the panel will not be anchored: data = require("sdk/self").data var clockpanel = require("sdk/panel").panel({ width:215, height:160, contenturl: data.url("clock.html") }); require("sdk/widget").widget({ id: "open-clock-btn", label: "clock", contenturl: data.url("history.png"), panel: clockpanel, onclick: function() { // will not be ancho...
frame/utils - Archive of obsolete content
usage module exports create function that takes the
nsidomdocument of a privileged document and creates a browser element in its documentelement: let { open } = require('sdk/window/utils'); let { create } = require('sdk/frame/utils'); let window = open('data:text/html,foo'); let frame = create(window.document); optionally create can be passed set of options to configure created frame even further.
... parameters document :
nsidomdocument options : object optional options: name type type string string that defines access type of the document loaded into it.
test/utils - Archive of obsolete content
if the callback is defined, then the beforefn is co
nsidered asynchronous, and the callback must be invoked before the test runs.
...if the callback is defined, then the afterfn is co
nsidered asynchronous, and the callback must be invoked before the next test runs.
ui/frame - Archive of obsolete content
right now it can be used in conjunction with a toolbar: you create a frame, then supply it to the toolbar's constructor, and the content is then displayed i
nside the toolbar.
...so there are three cases to co
nsider: sending messages from a frame script to the main add-on code sending messages from the main add-on code to all instances of a frame, across all browser windows sending messages from the main add-on code to a single instance of a frame, attached to a specific browser window in all cases, postmessage() takes two arguments: the message itself and a targetorigin.
cfx - Archive of obsolete content
for example, if you type: cfx run ---no-run you will see something like: to launch the application, enter the following command: /path/to/firefox/firefox-bin -profile /path/to/profile/tmpjdnlp6.mozrunner -foreground -no-remote this enables you to run the add-on without going through cfx, which might be useful if you want to run it i
nside a debugger like gdb.
... for example, if you type: cfx run ---no-run you will see something like: to launch the application, enter the following command: /path/to/firefox/firefox-bin -profile /path/to/profile/tmpjdnlp6.mozrunner -foreground -no-remote this enables you to run the add-on without going through cfx, which might be useful if you want to run it i
nside a debugger like gdb.
Creating annotations - Archive of obsolete content
999/xhtml" xml:lang="en"> <head> <title>annotation</title> <style type="text/css" media="all"> body { font: 100% arial, helvetica, sans-serif; background-color: #f5f5f5; } textarea { width: 180px; height: 180px; margin: 10px; padding: 0px; } </style> </head> <body> <textarea rows='10' cols='20' id='annotation-box'> </textarea> </body> </html> save this i
nside data/editor as annotation-editor.html.
... here's the code: var textarea = document.getelementbyid('annotation-box'); textarea.onkeyup = function(event) { if (event.keycode == 13) { self.postmessage(textarea.value); textarea.value = ''; } }; self.on('message', function() { var textarea = document.getelementbyid('annotation-box'); textarea.value = ''; textarea.focus(); }); save this i
nside data/editor as annotation-editor.js.
Creating Reusable Modules - Archive of obsolete content
md5 is a commonly used hash function: although it's no longer co
nsidered secure, it works fine outside a security context.
... var filepicker = require("./filepicker.js"); var md5 = require("./md5.js"); require("sdk/ui/button/action").actionbutton({ id: "show-panel", label: "show panel", icon: { "16": "./icon-16.png" }, onclick: function() { console.log(md5.hashfile(filepicker.promptforfile())); } }); distributing modules with jpm, we use npm as the package manager for sdk modules that don't ship i
nside firefox.
Modifying Web Pages Based on URL - Archive of obsolete content
self.port.on("replacepage", function(message) { document.body.innerhtml = "<h1>" + message + "</h1>"; }); in the add-on script, we'll send the content script a message i
nside onattach.
... // import the page-mod api var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: self.data.url("my-script.js"), // send the content script a message i
nside onattach onattach: function(worker) { worker.port.emit("replacepage", "page matches ruleset"); } }); the replacepage message isn't a built-in message: it's a message defined by the add-on in the port.emit() call.
Using third-party modules (jpm) - Archive of obsolete content
the add-on sdk is extensible by design: you can use the modules that ship i
nside firefox, but you can also create your own modules and make them available for anyone else to use.
... with jpm, we use npm as the package manager for sdk modules that don't ship i
nside firefox.
Drag & Drop - Archive of obsolete content
next, setup the handlers so that files can be dropped on the application: function _dragover(aevent) { var dragservice = components.classes["@mozilla.org/widget/dragservice;1"].getservice(components.interfaces.
nsidragservice); var dragsession = dragservice.getcurrentsession(); var supported = dragsession.isdataflavorsupported("text/x-moz-url"); if (!supported) supported = dragsession.isdataflavorsupported("application/x-moz-file"); if (supported) dragsession.candrop = true; } function _dragdrop(aevent) { var dragservice = components.classes["@mozilla.org/widget/dragser...
...vice;1"].getservice(components.interfaces.
nsidragservice); var dragsession = dragservice.getcurrentsession(); var _ios = components.classes['@mozilla.org/network/io-service;1'].getservice(components.interfaces.nsiioservice); var uris = new array(); // if sourcenode is not null, then the drop was from i
nside the application if (dragsession.sourcenode) return; // setup a transfer item to retrieve the file data var trans = components.classes["@mozilla.org/widget/transferable;1"].createinstance(components.interfaces.nsitransferable); trans.adddataflavor("text/x-moz-url"); trans.adddataflavor("application/x-moz-file"); for (var i=0; i<dragsession.numdropitems; i++) { var uri = null; dragsession.getdata(trans, i); var flavor = {}, ...
HTML in XUL for rich tooltips - Archive of obsolete content
ooltiphtml", "<font color='red'>red foo</font>") document.getelementbyid("htmltip2").setattribute("tooltiphtml", "<font color='green'>green foo</font>") }, onmousetooltip: function(event) { //get the html tooltip string assigned to the element that the mouse is over (which will soon launch the tooltip) var txt = event.target.getattribute("tooltiphtml"); // get the html div element that is i
nside the custom xul tooltip var div = document.getelementbyid("myhtmltipdiv"); //clear the html div element of any prior shown custom html while(div.firstchild) div.removechild(div.firstchild); //safely convert html string to a simple dom object, stripping it of javascript and more complex tags var injecthtml = components.classes["@mozilla.org/feed-unescapehtml;1"] .getservice(components.interface...
...s.nsiscriptableunescapehtml) .parsefragment(txt, false, null, div); //attach 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 i
nside the xul.
Miscellaneous - Archive of obsolete content
simulating mouse and key events https://developer.mozilla.org/samples/domref/dispatchevent.html also, new in firefox 3 / gecko 1.9: var utils = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindowutils); utils.sendmouseevent("mousedown", 10, 10, 0, 1, 0); utils.sendmouseevent("mouseup", 10, 10, 0, 1, 0); getting the currently selected text from browser.xul overlay context: var selectedtext = document.commanddispatcher.focusedwindow.getselection().tostring(); or: content.getselection(); // |window| object is implied; i.e., window.content.getselection() or: getbrowserselect...
... then create a xpcom service that adds the certificates i
nside that directory to the certs database on application startup.
Scrollbar - Archive of obsolete content
scrollbars i
nside browser elements will be styled to.
...so to make this work with osx, make an extra override: override chrome://global/skin/nativescrollbars.css chrome://app-global/skin/scrollbars.css change some color values i
nside the app/chrome/skin/global/scrollbars.css to test that the css is used.
Install Manifests - Archive of obsolete content
accepted values are: 1 opens optionsurl in a dialog box 2 options are displayed i
nside the add-on manager 3 opens optionsurl in a new tab (if the application supports that), or a dialog box optionstype defaults to 1 if there is an optionsurl included in install.rdf or 2 if there is no optionsurl and the file options.xul exists in the root of the add-on.
...if a value for the application's os is encountered that requires any specific abi, the abi is co
nsidered important for that os and the application will refuse to install the add-on if it does not find a matching os/abi combination.
Adding menus and submenus - Archive of obsolete content
adding elements to existing menus just as explained in the previous sections, the best place to overlay your extension menu is i
nside the tools menu.
... that is, unless there's a place i
nside the menu structure where your extension menus make more sense.
Adding preferences to an extension - Archive of obsolete content
i
nside that, we create a file, defaults.js, that describes the default value of our preferences: pref("extensions.stockwatcher2.symbol", "goog"); the standard for third-party preferences, such as those used in extensions, is to use the string "extensions", a period, the name of the extension, another period, then a preference name, as seen in the example above.
...the <hbox> element is used to lay out the user interface by indicating that the widgets i
nside it should be positioned horizontally, next to each other in the window.
Creating a dynamic status bar extension - Archive of obsolete content
inforeceived() when the server responds to our request, our the inforeceived() function, which is embedded i
nside refreshinformation(), gets called automatically.
... we embed this function i
nside refreshinformation() so that its variable scope includes the variables used by that function.
Getting the page URL in NPAPI plugin - Archive of obsolete content
via dom from benjamin smedberg: the npapi gives you the ability to get access to the
nsidomwindow object which contains the current plugin via the npnvdomelement enum passed to npn_getvalue.
... this returns an addrefed
nsidomelement interface pointer from which you can call .ownerdocument (on
nsidomnode), queryinterface that object to
nsidom3document, and call .documenturi.
Images, Tables, and Mysterious Gaps - Archive of obsolete content
now co
nsider what happens when we put that line in a table cell (figure 6).
...in the simplest case, we might add a style like this: td img {display: block;} co
nsider this rule when applied to the following markup: <table cellspacing="0" cellpadding="0" border="0" width="500"> <tr><td><img src="nav1.gif"><img src="nav2.gif"><img src="nav3.gif"><img src="nav4.gif"><img src="nav5.gif"></td></tr> <tr><td style="background: red;"> <img src="smallred.gif" height="1" width="1"></td></tr> <tr><td> <p style="margin: 0.5em;">this is text in another cell of the tabl...
Bookmark Keywords - Archive of obsolete content
the %s is a little flag that means "insert user input here." it doesn't have to go at the end of the location field-- it can be anywhere i
nside the field.
...thus we could type any of the following into the address bar and get back useful results: <tt>google geitost</tt> <tt>google mozilla keyword bookmark</tt> <tt>google bookmark site:developer.netscape.com</tt> <tt>google netscape xml support -site:netscape.com</tt> a few examples in the course of writing this article, a number of potentially useful bookmarks were co
nsidered as possible examples.
Creating a Firefox sidebar extension - Archive of obsolete content
open your profile folder open the extensions folder (create it if it doesn't exist) create a new text file, and put the path to your extension folder i
nside, e.g.
... since we are packaging the extension with a jar file, we need to update the chrome.manifest file to take to jar file into co
nsideration: example 7.
Exception logging in JavaScript - Archive of obsolete content
exception reporting in firefox 3 firefox 3 improves reporting of unhandled exceptions by establishing a set of rules that determines whether or not an exception is worth reporting: any methods on interfaces annotated with the [function] attribute in idl (see, for example,
nsidomeventlistener) that throw exceptions always report those exceptions into the error console.
...co
nsider this call chain: here we see c++ code calling javascript, which calls back into c++, which then calls back into javascript.
Menu - Archive of obsolete content
for example, if the user clicks on an image i
nside a link, this property will be set to the image, not the link.
...age.beforeshow = function (menu, context) { menu.reset(); if (matchesmycriteria(context)) menu.add("match!"); }; add an item to both the hyperlink context menu and the image context menu: jetpack.menu.context.page.on("a, img").set("a link or image"); add an item to the image context menu, but only for images contained in hyperlinks: jetpack.menu.context.page.on("a > img").set("an image i
nside a link"); add a "recent tweets" submenu to the jetpack menu.
Microsummary XML grammar reference - Archive of obsolete content
a generator is co
nsidered to be able to summarize a page if at least one of the <include> expressions matches the url of the page and none of the <exclude> expressions match the url of the page.
...white space between the child element tags and the regular expressions they contain is also not significant; it is not co
nsidered part of the regular expression, and it does not affect evaluation of the expressions.
New Security Model for Web Services - Archive of obsolete content
an entry is created if and only if the declaration file is co
nsidered valid (validation based on the syntax described above); an invalid document will result in access denial.
...normally a server will be either i
nside or outside of a firewall, so this is not a problem.
Table Layout Strategy - Archive of obsolete content
i
nside this routine the corresponding table layout strategy is created and initialized (basictablelayoutstrategy::initialize).
...th + padding due to col spans #define fix_adj 5 // fixed width + padding due to col spans #define pct 6 // percent width of cell or col #define pct_adj 7 // percent width of cell or col from percent colspan #define min_pro 8 // desired width due to proportional <col>s or cols attribute #define final 9 // width after the table has been balanced, co
nsidering all of the others the priority of allocations for columns is as follows: max(min_con, min_adj) max (pct, pct_adj) fix fix_adj max(des_con, des_adj), but use min_pro if present for a fixed width table, the column may get more space if the sum of the col allocations is insufficient column width info columns get their width information from style info <col width="200px"> and from the...
URIs and URLs - Archive of obsolete content
not all resources are network "retrievable"; e.g., human beings, corporations, and bound books in a library can also be co
nsidered resources.
...nsiuri and nsiurl in a strict sense necko does only know urls, uris by the above definition are much too generic to be properly represented i
nside a library.
Binding Attachment and Detachment - Archive of obsolete content
no bindings will be attached to elements that match the style rule, but are i
nside an element that has style display:none set.
... if the binding needs to execute any initialization code following its attachment to an element, it can do so using a <constructor> block i
nside <implementation> section.
Building accessible custom components in XUL - Archive of obsolete content
(technically, it draws the border i
nside the element instead of outside.) <code> grid.spreadsheet description:focus, grid.spreadsheet label:focus { outline: 1px dotted black; outline-offset: -2px; } </code> however, neither of those are our biggest problem.
...we want to be able to tab to the spreadsheet, then tab off of it, without cycling through every single cell i
nside the spreadsheet.
Deprecated and defunct markup - Archive of obsolete content
{many elements on this page are wrongly marked as deprecated, this page needs review} the following xul tags and attribute should be co
nsidered deprecated, if not defunct.
...--neil 03 march 2011 <bulletinboard> (made to support left/top styles, but <stack> can now do as well) <gripper> (i
nside of <scrollbar><thumb>; not to be used by itself) <listboxbody> (internal use only; part of xbl for <listbox>) <menubutton> (experiment in combining buttons and menus; use <button type> instead) <nativescrollbar> (displayed a native scrollbar; had been for mac only with native themes on) <outliner> (former name for <tree>; <listbox> had been "<tree>") <popup> (use menupopup) <pack...
Introduction to XUL - Archive of obsolete content
note that the frame is qualified with the prefix html:, since it is an html object being used i
nside a default xul namespace.
... the frame also has a special attribute called flex, which indicates how much the frame is allowed to stretch to consume available space i
nside its window.
Node - Archive of obsolete content
summary this is a scriptable interface corresponding to the
nsidomnode xpcom interface.
... constants the
nsidomnode interface is the primary datatype for the entire document object model.
Panels - Archive of obsolete content
note that the panel is not placed in a separate file and is instead placed i
nside another window.
...when you want to associate a panel with a button, place the <panel> element directly i
nside the button element.
Positioning - Archive of obsolete content
for a menupopup placed i
nside a menu, button or toolbarbutton, the position attribute controls how the menupopup is anchored to the parent menu, button or toolbarbutton.
...roughly equivalent to topleft topleft with the additional co
nsideration of the offset mentioned.
Popup Guide - Archive of obsolete content
a popup is not created as a separate window or file, instead it is included i
nside another window or dialog.
... platform specific menu co
nsiderations see special per-platform menu co
nsiderations for some notes about handling menus on certain platforms, for instance creating the application menu on a macintosh.
documentCharsetInfo - Archive of obsolete content
« xul reference documentcharsetinfo obsolete since gecko 12.0 type:
nsidocumentcharsetinfo this read-only property contains the
nsidocumentcharsetinfo object for the document which is used to handle which character set should be used to display the document.
... the properties of the
nsidocumentcharsetinfo object were merged into the docshell in gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9).
Attribute Substitution - Archive of obsolete content
that is '?name?age' is co
nsidered to be a single variable with that name, not two variables together.
...<label value="?name" class="?gender^?nationality"/> the caret is co
nsidered a separator between variables, however it will not appear in the output.
Bindings - Archive of obsolete content
this tag doesn't go in the query block but instead i
nside a rule element.
...note that when bindings are used, the bindings and the action must be enclosed i
nside a rule element.
Building Menus With Templates - Archive of obsolete content
you might be wondering why we couldn't just put the datasources attribute on the menupopup instead and not have a menupopup i
nside the action body.
...the houses match the first rule so a menupopup and menuitem element are generated and inserted i
nside the street content (the menu element).
Building Trees - Archive of obsolete content
rather than generate content for every row in the tree, the results are stored in a list i
nside the builder.
...for instance, co
nsider 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.
Filtering - Archive of obsolete content
this can be done by modifying the dom nodes i
nside the query and rebuilding the template.
... <action> <menupopup> <menuitem uri="?country" label="?countrytitle" value="?country"/> </menupopup> </action> the result will be two generated menuitems, one for each country, i
nside a menupopup.
Simple Query Syntax - Archive of obsolete content
instead, the builder uses a default query, and the action is placed directly i
nside the <template> element.
...in reality, the builder could be co
nsidered to convert a simple query into an extended query, so that it can be processed in the same way.
Template Logging - Archive of obsolete content
unexpected <queryset> element a <queryset> element was placed in an invalid location; they should be placed directly i
nside the <template> element with no other kinds of elements as siblings.
...you should specify an element i
nside the first <action> body with a uri attribute.
Using Recursive Templates - Archive of obsolete content
the content of the action body is again generated for each result, but instead of being inserted i
nside the outermost groupbox, this new content is inserted i
nside the content generated from the previous iteration.
... the content is always inserted directly i
nside the element with the uri attribute.
Things I've tried to do with XUL - Archive of obsolete content
(to add insult, xul layout code *explicitly* trims off '%' from width/height, thus treating it as pixels.) for reference, i'd like the following to give a vbox that resizes along with the window, with the green, red, and blue i
nside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox.
...so, as soon as you add a label or some other element i
nside, there will be a different amount of "empty space" to allocate in different boxes.
Adding Event Handlers - Archive of obsolete content
for example, when the mouse is moved over a button that is i
nside a box, a 'mousemove' event is generated, and sent first to the window, followed by the document, and then the box.
...naturally, an event attached to an element higher up will receive notification of all elements i
nside it, whereas an event attached to a button will only receive events pertaining to that button.
Adding Labels and Images - Archive of obsolete content
if the text needs to wrap, you can place the text content i
nside opening and closing tags as in the following example: example 2 : <label>this is some longer text that will wrap onto several lines.</label> as with html, line breaks and extra whitespace are collapsed into a single space.
...as with the label element, you can either use the value attribute for a single line of text or place text or xhtml content i
nside opening and closing description tags for longer blocks of text.
Adding Style Sheets - Archive of obsolete content
toolbar > button matches all buttons that are directly i
nside toolbar elements.
... toolbar > button.bigbuttons matches all button elements with a class of bigbuttons that are directly i
nside toolbar elements.
Broadcasters and Observers - Archive of obsolete content
you should declare all your broadcasters i
nside a broadcasterset element so that they are all kept together.
...the observes element itself does not change but the element it is i
nside changes, which in this case is a button.
Localization - Archive of obsolete content
i
nside these archives, you will find the files that hold the localized text for each window.
... i
nside the archives, you would place the dtd files in which you declare entities.
Manifest Files - Archive of obsolete content
the path 'content/browser' specifies the path i
nside the archive where the xul files are located.
...many people put this as a subdirectory i
nside mozilla's chrome directory, but this isn't necessary.
Trees and Templates - Archive of obsolete content
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 i
nside 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 i
nside the rule.
checkbox - Archive of obsolete content
this attribute only has any effect when used i
nside a prefwindow.
...defaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related interfaces nsiaccessibleprovider,
nsidomxulcheckboxelement ...
columns - Archive of obsolete content
the columns element may be nested i
nside another columns element.
... other elements placed i
nside a columns element occupy the full height of the grid and are placed in their corresponding positions between the columns.
key - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the key element defines a window-global keyboard shortcut and must be placed i
nside a keyset element.
...isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata details on key, keycode, and modifiers attributes for example, co
nsider the following key: <key key="r" modifiers="shift"/> this key will only match when the shift key is pressed as well as the r key, and no other keys.
label - Archive of obsolete content
related elements description attributes label interfaces nsiaccessibleprovider,
nsidomxullabelelement notes labels are not focusable note: starting in gecko 2.0, labels are properly not focusable.
... they used to incorrectly inherit from
nsidomxulcontrolelement.
listbox - Archive of obsolete content
this attribute only has any effect when used i
nside a prefwindow.
... related elements listcell, listcol, listcols, listhead, listheader, listitem interfaces nsiaccessibleprovider,
nsidomxulmultiselectcontrolelement ...
listitem - Archive of obsolete content
this attribute only has any effect when used i
nside a prefwindow.
... related elements listbox, listcell, listcol, listcols, listhead, listheader interfaces nsiaccessibleprovider,
nsidomxulselectcontrolitemelement ...
menu - Archive of obsolete content
control type: menu element returns the enclosing menu that the item is i
nside, if any, or null if there is no enclosing menu.
... related elements menubar, menuitem, menulist, menupopup, menuseparator interfaces nsiaccessibleprovider,
nsidomxulcontainerelement,
nsidomxulcontaineritemelement,
nsidomxulselectcontrolitemelement ...
menubar - Archive of obsolete content
on the macintosh, the menubar is displayed along the top of the screen, and all non-menu related elements i
nside the menubar will be ignored.
... to look native (at least on windows), the menubar element needs to be placed i
nside a toolbox element.
menuitem - Archive of obsolete content
control type: menu element returns the enclosing menu that the item is i
nside, if any, or null if there is no enclosing menu.
... related elements menu, menubar, menulist, menupopup, menuseparator interfaces nsiaccessibleprovider,
nsidomxulcontaineritemelement,
nsidomxulselectcontrolitemelement ...
menuseparator - Archive of obsolete content
control type: menu element returns the enclosing menu that the item is i
nside, if any, or null if there is no enclosing menu.
... lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements menu, menubar, menuitem, menulist, menupopup interfaces nsiaccessibleprovider,
nsidomxulcontaineritemelement,
nsidomxulselectcontrolitemelement ...
panel - Archive of obsolete content
warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor i
nside a panel is not supported.
... related interfaces nsiaccessibleprovider,
nsidomxulpopupelement ...
rows - Archive of obsolete content
the rows element may be nested i
nside another rows element.
... non-row related elements placed i
nside a rows element occupy the full width of the grid and are placed in their corresponding positions between the rows.
tab - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a single tab which should be placed i
nside a tabs element.
... interfaces nsiaccessibleprovider,
nsidomxulselectcontrolitemelement ...
tabs - Archive of obsolete content
a tabs element should be placed i
nside a tabbox and should contain tab elements.
... interfaces nsiaccessibleprovider,
nsidomxulselectcontrolelement ...
textnode - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] normally when substituting rdf resources in template rules, you place the rdf property name i
nside an attribute value preceded with rdf:.
... this is useful if you want to use the html element or other elements that have text content i
nside them instead of in attributes.
titlebar - Archive of obsolete content
elements i
nside the titlebar usually don't receive any mouse events, so e.g.
... buttons i
nside it can't be clicked and textboxes can't be focused with the mouse.
tree - Archive of obsolete content
unlike other elements, the data to display i
nside the tree is not specified using tags, but is determined from a view object.
... interfaces nsiaccessibleprovider,
nsidomxultreeelement,
nsidomxulmultiselectcontrolelement script examples to have alternating colors for each row, use the style rules like the following: treechildren::-moz-tree-row(selected) { background-color: #ffffaa; } treechildren::-moz-tree-row(odd) { background-color: #eeeeee; } treechildren::-moz-tree-row(odd, selected) { background-color: #ffffaa; } treechildren::-moz-tree-cell-text(selec...
treeitem - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a treeitem should be placed i
nside a treechildren element and should contain treerow elements.
... elements that appear i
nside the element with the attribute will be repeated for each node in the rdf datasource.
treerow - Archive of obsolete content
it should be placed i
nside a treeitem element.
...if child rows are necessary, they should be placed in a treechildren element i
nside the parent treeitem.
nsIContentPolicy - Archive of obsolete content
acontext {optional_inline}} the
nsidomnode or
nsidomwindow that initiated the request, or something that can queryinterface() to one of those; can be null if inapplicable.
...the
nsidomnode or
nsidomwindow that initiated the request, or something that can query interface to one of those; can be null if inapplicable.
Gecko Compatibility Handbook - Archive of obsolete content
since a browser is supposed to ignore html tags it does not recognize and render the content i
nside the tags, web page authors have used the technique of combining proprietary html that will work as expected in each browser.
...to understand why, co
nsider the following: html without optional ending tags equivalent html with optional ending tags <select> <option>optionvalue </select> <select> <option>optionvalue</option> </select> now co
nsider if we used the xml empty tag notation: the <option />.
Extentsions FAQ - Archive of obsolete content
e and the corresponding css see http://www.w3.org/tr/rec-css2/cascade.html#cascade friday, october 13 - 20, 2006 (↑ top) how to get a refenece to the sidebar window assuming you have chrome privileges, this should work: var ci = components.interfaces; var toplevelwindow = window.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.
nsidocshelltreeitem) .roottreeitem .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.
nsidomwindow) .queryinterface(ci.
nsidomchromewindow); var sidebar = toplevelwindow.document.getelementbyid("sidebar"); alert(sidebar.contentdocument); is there anyone successfully using dojo in a firefox extension and where to fine sample codes?
... friday, october 6 - 13, 2006 (↑ top) has anyone experienced problem with update that it only co
nsiders themes and extensions during the update check, ignoring langpacks with firefox 2.0?
NP_GetMIMEDescription - Archive of obsolete content
one mime type // example i
nside http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/unix/plugin.cpp #define mime_type_description "application/basic-plugin:bsp:basic example plug-in for mozilla" const char* np_getmimedescription(void) { return(mime_types_description); } two mime types const char* np_getmimedescription(void) { return "application/basic-example-plugin:xmp1:example 1;application/basic-example2-...
... #include <gio/gio.h> const char* desc = g_content_type_get_description("audio/ogg"); javascript i
nside a web page, you can retrieve these informations with this code: var mimetype = navigator.mimetypes['application/basic-example-plugin']; if (mimetype) { alert(mimetype.type + ':' + mimetype.suffixes + ':' + mimetype.description); } ...
Encryption and Decryption - Archive of obsolete content
(for more information about rc4 and other ciphers used with ssl, see "introduction to ssl.") an encryption key is co
nsidered full strength if the best known attack to break the key is no faster than a brute force attempt to test every key possibility.
... because it is relatively trivial to break an rsa key, an rsa public-key encryption cipher must have a very long key, at least 1024 bits, to be co
nsidered cryptographically strong.
Array comprehensions - Archive of obsolete content
for future-facing usages, co
nsider using array.prototype.map, array.prototype.filter, arrow functions, and spread syntax.
... syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of iterable) x + y] description i
nside array comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component.
Generator comprehensions - Archive of obsolete content
for future-facing usages, co
nsider using generator.
... syntax (for (x of iterable) x) (for (x of iterable) if (condition) x) (for (x of iterable) for (y of iterable) x + y) description i
nside generator comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component.
XForms Repeat Element - Archive of obsolete content
here comes the output: <br/> <xf:output ref="@id"><xf:label>output: </xf:label></xf:output> <div xf:repeat-nodeset="nest"><xf:output ref="."><xf:label>nested output: </xf:label></xf:output></div> </div> repeat in anonymous content (usage in xbl) you can use repeat elements i
nside anonymous content to create powerful new widgets.
... in this scenario, though, you should use the anonid attribute to identify the repeat element that has been placed i
nside anonymous content.
XForms Switch Module - Archive of obsolete content
binding a switch to a data node will also set a context that the expressions contained i
nside the case elements can build upon.
...if no case is initially selected, the first case i
nside the switch becomes selected and visible.
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
bare pseudo-classes the second piece of the problem comes when we co
nsider the effects of a "bare" pseudo-class in a selector.
...co
nsider 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).
Common causes of memory leaks in extensions - Extensions
co
nsider the following example code that could be part of your browser.xul overlay: gbrowser.addeventlistener("domcontentloaded", function(evt) { var contentdoc = evt.originaltarget; var i = 0; // refresh the title once each second setinterval(function() { contentdoc.title = ++i; }, 1000); }, false); one would normally expect that the interval (or timer) would be destroyed as soon as t...
... co
nsider the following example: var myobserver = { observe: function(subject, topic, data) { window.document.documentelement.setattribute( "pbm", (data == "enter") ?
Game monetization - Game development
when you've spent your time building a game, distributing it and promoting it you should co
nsider earning some money out of it.
... publishers taking your games for revenue share, and/or licensing may require implementing their own apis, which could take extra work, so co
nsider that in your rates too.
Publishing games - Game development
game monetization when you spend your time building, publishing and promoting your game, you will at some point co
nsider earning money out of it.
... game monetization is essential to anyone who co
nsiders their game development work a serious endeavour on the path to becoming an independent game developer able to make a living, so read on and see what your options are.
Building up a basic demo with PlayCanvas editor - Game development
animating our scene animating 3d models might be co
nsidered an advanced thing to do, but all we want to do is to control a few properties of a given object — we can use a script component to do that.
...add the following line i
nside this function, to rotate the cube on every frame: this.entity.rotate(dt*10, dt*20, dt*30); in the line above this.entity refers to the object to which the script will be attached (the box); using the dt variable, which contains the delta time passed since the previous frame, we can rotate the box by a different amount around all three axes.
WebVR — Virtual Reality for the Web - Game development
boris smus has written about the concept of responsive webvr, where a single web game can be played on various devices like laptops without vr hardware, pcs with oculus rift, or smartphones i
nside google cardboard and still deliver a unique and valuable experience across all of them.
... immersion is more important than gameplay or graphics - you have to feel you're "i
nside" the experience.
Collision detection - Game development
for better readability of the code we will define the b variable for storing the brick object in every loop of the collision detection: function collisiondetection() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { var b = bricks[c][r]; // calculations } } } if the center of the ball is i
nside the coordinates of one of our bricks, we'll change the direction of the ball.
... for the center of the ball to be i
nside the brick, all four of the following statements need to be true: the x position of the ball is greater than the x position of the brick.
Create the Canvas and draw on it - Game development
before we can start writing the game's functionality, we need to create a basic structure to render the game i
nside.
...the body contains <canvas> and <script> elements — we will render the game i
nside the first one and write the javascript code that controls it in the second one.
Move the ball - Game development
delete all the javascript you currently have i
nside your html file except for the first two lines, and add the following below them.
...now, let's draw the ball — add the following i
nside your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame.
Paddle and keyboard controls - Game development
i
nside the draw() function, we will check if the left or right cursor keys are pressed when each frame is rendered.
...add the following line i
nside your draw() function, just below the line that calls drawball(): drawpaddle(); compare your code here's the working code for you to compare yours against: exercise: make the paddle move faster or slower, or change its size.
Build the brick field - Game development
drawing the bricks we will place all the code for drawing the bricks i
nside an initbricks function to keep it separated from the rest of the code.
...now we need to add some code i
nside the nested loop stucture to draw each brick.
Collision detection - Game development
first, add a new line i
nside your update() function that checks for collision detection between ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, paddle); game.physics.arcade.collide(ball, bricks, ballhitbrick); paddle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the positions of all the bricks in the group.
...i
nside the function we remove the brick in question from the screen simply by running the kill() method on it.
Initialize the framework - Game development
before we can start writing the game's functionality, we need to create a basic structure to render the game i
nside.
... save the phaser code i
nside a /js directory in the same location as your index.html file.
Move the ball - Game development
the code i
nside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen.
... add the following new lines of the code i
nside update(), as shown: function update() { ball.x += 1; ball.y += 1; } the code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame.
Callback function - MDN Web Docs Glossary: Definitions of Web-related terms
a callback function is a function passed into another function as an argument, which is then invoked i
nside the outer function to complete some kind of routine or action.
...a good example is the callback functions executed i
nside a .then() block chained onto the end of a promise after that promise fulfills or rejects.
Advanced styling effects - Learn web development
the really nice thing about filters however, is that they work on the exact shapes of the content i
nside the box, not just the box itself as one big chunk, so it is worth knowing the difference.
...instead, the circle function is taking its centre point from the centre of the image file, as if we had put a compass in the middle of the file and drawn a circle that fits i
nside the file.
Test your skills: Images and Form elements - Learn web development
we want the image to scale down to fit i
nside the box without any extra white space, but we do not mind if some part of the image is cropped.
...your task is to make the following changes to the way this form looks: use attribute selectors to target the search field and button i
nside .myform.
Organizing your CSS - Learn web development
for example, you might have something like the below selector, which applies the rule to a <p> with a class of box i
nside an <article> with a class of main.
... so for example, with partials, you could have several style files i
nside a directory, say foundation/_code.scss, foundation/_lists.scss, foundation/_footer.scss, foundation/_links.scss, etc., then use the sass @use role to load them into other stylesheets: // foundation/_index.sass @use 'code' @use 'lists' @use 'footer' @use 'links' if the partials are all loaded into an index file, as implied above, you can then load that entire directory into another stylesheet i...
Overflowing content - Learn web development
css tries to avoid "data loss" let's co
nsider two examples that demonstrate the default behavior of css when there is overflow.
...if you have a long word in a small box, you might co
nsider using the word-break or overflow-wrap properties.
Attribute selectors - Learn web development
[attr=value] a[href="https://example.com"] matches elements with an attr attribute whose value is exactly value — the string i
nside the quotes.
... substring matching selectors these selectors allow for more advanced matching of substrings i
nside the value of your attribute.
Combinators - Learn web development
body article p in the example below, we are matching only the <p> element which is i
nside an element with a class of .box.
...for example, to select only <p> elements that are direct children of <article> elements: article > p in this next example, we have an unordered list, nested i
nside of which is an ordered list.
CSS selectors - Learn web development
it is a pattern of elements and other terms that tell the browser which html elements should be selected to have the css property values i
nside the rule applied to them.
...for example, ::first-line always selects the first line of text i
nside an element (a <p> in the below case), acting as if a <span> was wrapped around the first formatted line and then selected.
Grids - Learn web development
add this to the css i
nside your file: .container { display: grid; } unlike flexbox, the items will not immediately look any different.
...therefore if one of your tracks has something large i
nside it there will be less free space to share out.
Practical positioning examples - Learn web development
the unordered list contains three list items with links i
nside, which will become the actual tabs to click on for displaying our content panels.
...here we simply set a fixed height to make sure the panels fit snugly i
nside the info-box, position relative to set the <div> as the positioning context, so you can then place positioned child elements relative to it and not the <html> element, and finally we clear the float set in the css above so that it doesn't interfere with the remainder of the layout.
What is CSS? - Learn web development
note: a browser is sometimes called a user agent, which basically means a computer program that represents a person i
nside a computer system.
...i
nside those will be one or more declarations, which take the form of property and value pairs.
CSS FAQ - Learn web development
</div> in case of complex html hierarchies, if a rule seems to be ignored, check if the element is i
nside another element with a different style.
...</div> in this example the body * selector applies the rule to all elements i
nside body, at any hierarchy level, including the .stockup class.
create fancy boxes - Learn web development
as you will notice, color gradients are co
nsidered to be images and can be manipulated as such */ background-image: linear-gradient(175deg, rgba(0,0,0,0) 95%, #8da389 95%), linear-gradient( 85deg, rgba(0,0,0,0) 95%, #8da389 95%), linear-gradient(175deg, rgba(0,0,0,0) 90%, #b4b07f 90%), linear-gradient( 85deg, rgba(0,0,0,0) 92%, #b4b07f 92%), linear-gradient...
...even if it is necessary, it's somewhat co
nsidered bad practice.
Styling links - Learn web development
the text "http" should therefore only appear in external links (like the second and third ones), and we can select this with an attribute selector: a[href*="http"] selects <a> elements, but only if they have an href attribute with a value that contains "http" somewhere i
nside it.
...we center the text i
nside each link, set the line-height to 3 to give the buttons some height (which also has the advantage of centering the text vertically), and set the text color to black.
How do I use GitHub Pages? - Learn web development
here's what you'd type if you've put your website in a directory called test-site on your desktop: cd desktop/test-site when the command line is pointing i
nside your website directory, type the following command, which tells the git tool to turn the directory into a git repository: git init an aside on command line interfaces the best way to upload your code to github is via the command line — this is a window where you type in commands to do things like create files and run programs, rather than clicking i
nside a user interface.
... it will look something like this: note: you could also co
nsider using a git graphical user interface to do the same work, if you feel uncomfortable with the command line.
Assessment: Structuring planet data - Learn web development
if the online editor you are using doesn't have separate javascript/css panels, feel free to put them inline <script>/<style> elements i
nside the html page.
... create all the content rows i
nside the table body, remembering to make all the row headings into headings semantically.
General asynchronous programming concepts - Learn web development
we couldn't render our 1 million blue circles i
nside our worker; it can basically just do the number crunching.
...co
nsider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b then does something to the image like applying a filter to it.
Asynchronous JavaScript - Learn web development
the former allows standard functions to implicitly behave asynchronously with promises, whereas the latter can be used i
nside async functions to wait for promises before the function continues.
... choosing the right approach to finish this module off, we'll co
nsider the different coding techniques and features we've discussed throughout, looking at which ones you should use when, with recommendations and reminders of common pitfalls where appropriate.
Function return values - Learn web development
our draw() function draws 100 random circles somewhere on an html <canvas>: function draw() { ctx.clearrect(0, 0, width, height); for (let i = 0; i < 100; i++) { ctx.beginpath(); ctx.fillstyle = 'rgba(255,0,0,0.5)'; ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); ctx.fill(); } } i
nside each loop iteration, three calls are made to the random() function, to generate a random value for the current circle's x-coordinate, y-coordinate, and radius, respectively.
...therefore, a sentence is printed out i
nside the paragraph element that states the square, cube, and factorial values of the number.
Test your skills: Events - Learn web development
dom manipulation: co
nsidered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them i
nside existing elements on the page — all via javascript.
... events 1 in our first events-related task, you need to create a simple event handler that causes the text i
nside the button (btn) to change when it is clicked on, and change back when it is clicked again.
Test your skills: Loops - Learn web development
dom manipulation: co
nsidered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them i
nside existing elements on the page — all via javascript.
... loops 1 in our first looping task we want you start by creating a simple loop that goes through all the items in the provided myarray and prints them out on the screen i
nside list items (i.e., <li> elements), which are appended to the provided list.
Basic math in JavaScript — numbers and operators - Learn web development
first try entering some simple examples of your own, such as 10 + 7 9 * 8 60 % 3 you can also try declaring and initializing some numbers i
nside variables, and try using those in the sums — the variables will behave exactly like the values they hold for the purposes of the sum.
....queryselector('p'); btn.addeventlistener('click', updatebtn); function updatebtn() { if (btn.textcontent === 'start machine') { btn.textcontent = 'stop machine'; txt.textcontent = 'the machine has started!'; } else { btn.textcontent = 'start machine'; txt.textcontent = 'the machine is stopped.'; } } open in new window you can see the equality operator being used just i
nside the updatebtn() function.
Test your skills: Arrays - Learn web development
in this task we'd like you to create an array of three items, stored i
nside a variable called myarray.
... go over each item in the array and add its index number after the name i
nside parentheses, for example ryu (0).
Aprender y obtener ayuda - Learn web development
different learning methods it is interesting to co
nsider that there are two main ways in which your brain learns things — focused and diffuse learning: focused learning is what you might more traditionally associate with academic subjects.
... make sure the text is centered i
nside each menu item etc.
Multimedia: video - Learn web development
optimizing video delivery it's best to compress all video, optimize <source> order, set autoplay, remove audio from muted video, optimize video preload, and co
nsider streaming the video.
... co
nsider streaming video streaming allows the proper video size and bandwidth (based on network speed) to be delivered to the end user.
Client-Server Overview - Learn web development
the web application dynamically creates an html page by putting the data (from the database) into placeholders i
nside an html template.
... for example, co
nsider the following django (python) code that maps two url patterns to two view functions.
Website security - Learn web development
for example, co
nsider a site search function where the search terms are encoded as url parameters, and these terms are displayed along with the results.
...co
nsider two-factor authentication for your site, so that in addition to a password the user must enter another authentication code (usually one that is delivered via some physical hardware that only the user will have, such as a code in an sms sent to their phone).
Ember app structure and componentization - Learn web development
this is because the default css absolutely positions the checkbox + label with negative top and left values to move it next to the input, rather than it being i
nside the "main" section.
...enter the following lines into your terminal, one by one: ember generate component todo-list ember generate component todo ember generate component footer you’ll now see the following i
nside your todomvc/app/components directory: now that we have all of our component structure files, we can cut and paste the html for each component out of the application.hbs file and into each of those components, and then re-write the application.hbs to reflect our new abstractions.
Deployment and next steps - Learn web development
create a .gitlab-ci.yml file i
nside your project's root and give it the following content: image: node:latest pages: stage: deploy script: - npm install - npm run build artifacts: paths: - public only: - master here we are telling gitlab to use an image with the latest version of node to build our app.
...we already covered most of its content, so it won't take you much time to complete it — you should co
nsider it as practise!
Using Vue computed properties - Learn web development
computed: { listsummary() { const numberfinisheditems = this.todoitems.filter(item =>item.done).length return `${numberfinisheditems} out of ${this.todoitems.length} items completed` } } now we can add {{listsummary}} directly to our template; we'll add this i
nside an <h2> element, just above our <ul>.
... add the described <h2> and update the <ul> i
nside your app's template as follows: <h2 id="list-summary">{{listsummary}}</h2> <ul aria-labelledby="list-summary" class="stack-large"> <li v-for="item in todoitems" :key="item.id"> <to-do-item :label="item.label" :done="item.done" :id="item.id"></to-do-item> </li> </ul> you should now see the list summary in your app, and the total number of items update as you add more todo items!
Styling Vue components with CSS - Learn web development
to keep the style definitions close to the component we can add a <style> element i
nside it.
... to use the scoped modifier, create a <style> element i
nside todoitem.vue, at the bottom of the file, and give it a scoped attribute: <style scoped> </style> next, copy the following css into the newly created <style> element: .custom-checkbox > .checkbox-label { font-family: arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-weight: 400; font-size: 16px; font-size: 1rem; line-height: 1.25; color: #0b0c0c; display: ...
Introduction to cross browser testing - Learn web development
ios safari on iphone/ipad, chrome and firefox on iphone/ipad/android), also do tests in any other browsers you have included i
nside your target list.
... testing on prerelease browsers it is often a good idea to test on prerelease versions of browsers; see the following links: firefox developer edition edge i
nsider preview safari technology preview chrome canary opera developer this is especially prevalent if you are using very new technologies in your site, and you want to test against the latest implementations, or if you are coming across a bug in the latest release version of a browser, and you want to see if the browser's developers have fixed the bug in a newer version.
Learn web development
frameworks and tooling: after mastering the essentials of vanilla html, css, and javascript, you should learn about client-side web development tools, and then co
nsider digging into client-side javascript frameworks, and server-side website programming.
... you can update the learning-area repository with any changes made to the master version on github with the following steps: in your command prompt/terminal, go i
nside the learning-area directory using cd.
Embedding API for Accessibility
text zoom on a per-window basis the
nsidomwindow::gettextzoom(float *zoomfactor) and
nsidomwindow::settextzoom(float zoomfactor) methods can be used to set a wide range of text zoom factors on a content window.
...for double-sized text, use
nsidomwindow::settextzoom(2.0); using accessibility preferences there are a number of prefs related to accessibility.
Multiprocess on Windows
since gecko's main thread uses com, and com requires threads to declare their threading model, the main thread must initialize itself to live i
nside its own single threaded apartment (sta).
...as you should already know, you can't directly touch a com object's reference count unless you're already i
nside the apartment which contains that object.
Software accessibility: Where are we today?
hearing impaired we must also co
nsider the increasing numbers of aging baby boomers that are beginning to experience problems with their sight, vision or dexterity.
...extremely consistent keystroke support is a very important co
nsideration.
Mozilla’s UAAG evaluation report
we co
nsider this to be a very difficult problem.
...however, any such use should be carefully co
nsidered, given the potential impact on network traffic of automatically making such requests for every link/object in the page.
A bird's-eye view of the Mozilla framework
let’s co
nsider a resource description framework (rdf) example, where rdf is a framework for describing and interchangingmetadata, that is, information about information.
... i
nside an xpcom component figure 3 shows a more detailed view of an xpcom component.
Creating reftest-based unit tests
for example, the html 4.01 specification at the w3c specifies that text i
nside of a <blockquote> will be indented, but it does not specify the number of pixels of the indentation.
...create a directory (i
nside firefox's source code tree) and make that your current directory (i.e.
Simple Thunderbird build
it now needs to be placed i
nside the mozilla source code, in a directory named comm/ (this is inverse from thunderbird 59 and earlier): hg clone https://hg.mozilla.org/mozilla-central source/ cd source/ hg clone https://hg.mozilla.org/comm-central comm/ the source code requires 3.6gb of free space or more and additionally 5gb or more for default build.
...closed), you may wish to co
nsider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction).
Multiple Firefox profiles
from profile manager i
nside firefox if you already have firefox instance running, you can open another profile from the integrated profile manager on any platform: type about:profiles into the browser url search bar.
...if you choose a folder that isn't empty, and you later remove the profile and choose the \"delete files\" option, everything i
nside that folder will be deleted.
Limitations of chrome scripts
a common pattern here is to use the notificationcallbacks property of the nsihttpchannel to get the dom window that initiated the load, like this: observe: function (subject, topic, data) { if (topic == "http-on-modify-request") { var httpchannel = subject.queryinterface(ci.nsihttpchannel); var domwindow = httpchannel.notificationcallbacks.getinterface(ci.
nsidomwindow); } } or this: observe: function (subject, topic, data) { if (topic == "http-on-modify-request") { var httpchannel = subject.queryinterface(ci.nsihttpchannel); var domwindow = httpchannel.notificationcallbacks.getinterface(ci.nsiloadcontext).associatedwindow; } } in multiprocess firefox these patterns will no longer work: the getinterface call will fail.
... to make the shim unnecessary: register event listeners on the global object i
nside a frame script.
Process scripts
this can be achieved by traversing the docshell tree up to the top window and then retrieving its content message manager, as follows: function contentmmfromcontentwindow(window) { let tree = window.queryinterface(ci.nsiinterfacerequestor).getinterface(ci.
nsidocshelltreeitem); let top = tree.sametyperoottreeitem; let iface = queryinterface(ci.
nsidocshell).queryinterface(ci.nsiinterfacerequestor); return iface.getinterface(ci.nsicontentframemessagemanager); } this is intended for unprivileged pages running in a content process.
... if the above doesn't work try this: function contentmmfromcontentwindow_method2(acontentwindow) { return acontentwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.
nsidocshell) .queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsicontentframemessagemanager); } ...
mozbrowsercontextmenu
details the details property returns an anonymous javascript object with the following properties: clientx the x value of the coordinate that was clicked i
nside the browser <iframe>'s viewport.
... clienty the y value of the coordinate that was clicked i
nside the browser <iframe>'s viewport.
Embedding the editor
the problem with this ownership model is that there can be only one editor per <editor> tag, yet the document loaded in the <iframe> may itself contain multiple <iframe>s (co
nsider a frameset document, or a document itself containing an <html:iframe>).
...you should be able to qi from
nsidocshell to one of these; if this succeeds, it indicates that the frame is editable.
Gecko's "Almost Standards" Mode
a common case that this affects is the layout of images i
nside table cells.
...for example, co
nsider the following doctype: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> the parts are as follows: public identifier: "-//w3c//dtd html 4.01 transitional//en" system identifier: "http://www.w3.org/tr/html4/loose.dtd" thus any html 4.01 transitional or frameset doctype with a uri (system identifier) will trigger "almost standards" m...
Getting from Content to Layout
nscssframeconstructor gets notified from the document's presshell (which implements
nsidocumentobserver and observes the document) about all nodes in the document.
... to give a trivial example of when this might be necessary, co
nsider: "<span>foo <div></div> bar</span>".
HTTP Cache
similarity with the old cache: this interface may be with some limitations co
nsidered as a mirror to nsicachesession, but less generic and not inclining to abuse.
...regular expression: (.([^,]+)?,)* the first letter is an identifier, identifiers are to be alphabetically sorted and always terminate with ',' a - when present the scope is belonging to an anonymous load b - when present the scope is in browser element load i - when present must have a decimal integer value that represents an app id the scope belongs to, otherwise there is no app (app id is co
nsidered 0) p - when present the scope is of a private browsing load, this never persists cachestorageservice keeps a global hashtable mapped by the scope key.
Introduction to Layout in Mozilla
ution reflow painting setting up assume basic knowledge of embedding and network apis (doc shell, streams) content dll auto-registers a document loader factory (dlf) @mozilla.org/content-viewer-factory/view;1?type=text/html all mime types mapped to the same class, nscontentdlf nsdocshell receives inbound content via nsdsuricontentlistener invokes
nsidlf::createinstance, passes mime type to dlf nscontentdlf creates a nshtmldocument object, invokes startdocumentload.
...h parser node objects some buffering and fixup occurs here opencontainer, closecontainer, addleaf content sink creates and attaches content nodes using nsicontent interface content sink maintains stack of “live” elements more buffering and fixup occurs here insertchildat, appendchildto, removechildat frame construction content sink uses
nsidocument interface to notify of Δs in content model contentappended, contentinserted, contentremoved presshell is registered as document observer receives contentappended, etc.
JavaScript-DOM Prototypes in Mozilla
one of these interfaces is
nsidomhtmlimageelement, others are
nsidomnshtmlimageelement (netscape extensions to the standard interface),
nsidomeventtarget,
nsidomeventlistener,
nsidom3node, and so on.
...ns_get_iid(
nsidomnode) for node).
AddonManager
callback) void installaddonsfromwebpage(in string mimetype, in
nsidomwindow source, in nsiuri uri, in addoninstall installs[]) void addinstalllistener(in installlistener listener) void removeinstalllistener(in installlistener listener) promise?
... void installaddonsfromwebpage( in string mimetype, in
nsidomwindow source, in nsiuri uri, in addoninstall installs[] ) parameters mimetype the mimetype of add-ons being installed source the
nsidomwindow that started the installs uri the nsiuri that started the installs installs the array of addoninstalls to be installed addinstalllistener() adds a new installlistener if the listener is not already registered.
Examples
co
nsider the following cases: function f() { return promise.reject(new error("boom!")); // if nobody catches the error, how will it be reported?
...for instance, co
nsider: let deferred = promise.defer(); let p1 = deferred.promise.then(); let p2 = deferred.promise.then(); deferred.reject(new error("i am an uncaught error")); p1 = p2 = deferred = null; in this snippet, the error is reported both at p1 and at p2.
Promise.jsm
if you just need a promise, co
nsider using a dom promise instead.
... if you need a deferred, because you want to create a promise and manually resolve or reject it, co
nsider using promiseutils.jsm instead.
Sqlite.jsm
when a statement is executed via executecached(), the prepared statement object is cached i
nside the opened connection.
...the dow
nside is the cached statement object lingers in the opened connection, taking up memory.
L10n Checks
if you want to test the localization for de, run: check-l10n-completeness browser/locales/l10n.ini ../l10n/ de add-ons (xpi) mode l10n checks gathers the locales to compare from the chrome.manifest file i
nside the xpi file.
...you pass both paths to the xpi file and both paths to the locales i
nside the files, e.g.: check-l10n-completeness -i xpis en-us-langpack.xpi my-langpack.xpi jar:chrome/en-us.jar!locale/ jar:chrome/my.jar!locale/my/ jar/zip file (jar) mode l10n checks can compare two locales found in different jar files.
Localizing with Koala
they can be found in two files, i
nside the browser/chrome/browser directory: searchbar.dtd, search.properties.
...for example, try issuing "hg status" i
nside c:\mozilla\l10n\locale\x-testing\3.6: c:\mozilla\l10n\locale\x-testing\3.6> hg status ?
Localizing with Mozilla Translator
from cvs to mercurial in mt so, you have a firefox product in mt with a platform neutral and, i
nside it, several directories (''components'' in mt terminology) more or less like the second sample above, checked out from cvs.
... when mozilla l10n switched to ''source l10n'', one of the many problems that mt had to solve was how to fit a directory structure in what had been designed for five jars, and the ''patch'' consisted of providing a ''read from dir instead of jar'' and ''put everything i
nside platform neutral''.
Release phase
add the following lines to your ~/.ssh/config file, replacing user@host.domain with your mozilla ldap account name: host hg.mozilla.org user user@host.domain if you have already cloned the remote repository using the http protocol using this command: $ hg clone http://hg.mozilla.org/releases/l10n-central/x-testing then you will need to edit the .hg/hgrc file (i
nside the x-testing local clone) to tell mercurial to push using ssh.
...this is done by generating a diff between the new release revision being co
nsidered and the previously approved release revision.
gettext
co
nsider the following code snippet: <?php $num = 1; printf(ngettext("%d user likes this.", "%d users like this.", $num), $num); ?> depending on the value of the $num variable, this code will either use the singular ("user likes) or the plural ("users like") form of the string.
...co
nsider another example, gaeilge (irish): plural-forms: nplurals=3; plural=n==1 ?
Basics
a n n ] [ x1 x2 x3 : xn ] in mozilla, mathml runs i
nside the main browser.
... mathml button html content <div style="text-align: center"> <button style="white-space: normal;"> <span style="color: brown;"> for example, <b>click</b> this mathml continued fraction<br/> i
nside this html button<br /> </span> <math> <mrow> <mfrac> <mi>π</mi> <mn>4</mn> </mfrac> <mo>=</mo> <mfrac numalign="left"> <mstyle scriptlevel="0"> <mn>1</mn> </mstyle> <mstyle scriptlevel="0"> <mrow> <mn>2</mn> <mo>+</mo> <mfrac numalign="left"> <mstyle scriptlevel="0"> <msup><mn>1</mn><mn>2</mn></msup> </mstyle> <mstyle scriptlevel="0"> <mrow> <mn>2</mn> <mo>+</mo> <mfrac numalign="left"> ...
Mozilla Web Developer FAQ
the <link> and <style> elements should be i
nside the <head> element.
... things that look like xml comments are treated as xml comments—even i
nside script or style elements.
DMD
/dmd.cpp:1286) #02: malloc (/home/njn/moz/mi5/go64dmd/memory/build/../../../memory/build/replace_malloc.c:153) #03: moz_xmalloc (/home/njn/moz/mi5/memory/mozalloc/mozalloc.cpp:84) #04: nscyclecollectingautorefcnt::incr(void*, nscyclecollectionparticipant*) (/home/njn/moz/mi5/go64dmd/dom/xul/../../dist/include/nsisupportsimpl.h:250) #05: nsxulelement::create(nsxulprototypeelement*,
nsidocument*, bool, bool,mozilla::dom::element**) (/home/njn/moz/mi5/dom/xul/nsxulelement.cpp:287) #06: nsxblcontentsink::createelement(char16_t const**, unsigned int, mozilla::dom::nodeinfo*, unsigned int, nsicontent**, bool*, mozilla::dom::fromparser) (/home/njn/moz/mi5/dom/xbl/nsxblcontentsink.cpp:874) #07: nscomptr<nsicontent>::startassignment() (/home/njn/moz/mi5/go64dmd/dom/xml/../../dis...
...::sizeofincludingthis(unsigned long (*)(void const*)) const (/home/njn/moz/mi5/go64dmd/parser/html/../../../dom/base/nsinode.h:307) #06: mozilla::dom::nodeinfo::nodetype() const (/home/njn/moz/mi5/go64dmd/dom/base/../../dist/include/mozilla/dom/nodeinfo.h:127) #07: nshtmldocument::docaddsizeofexcludingthis(nswindowsizes*) const (/home/njn/moz/mi5/dom/html/nshtmldocument.cpp:3710) #08:
nsidocument::docaddsizeofincludingthis(nswindowsizes*) const (/home/njn/moz/mi5/dom/base/nsdocument.cpp:12820) } } the choice of whether to record an allocation stack trace for all blocks is controlled by an option (see below).
Gecko Profiler FAQ
in general, the gecko profiler is a profiling tool that helps you figure out what happens i
nside the browser as a performance issue is happening, it doesn’t help with reproducing the performance issues in the first place.
...(see many of the questions above for examples of such limitations.) note that these tools should all be co
nsidered as complementary, it’s typical to capture a profile in gecko profiler and based on some investigations decide to delve into some part of it using a native profiler, etc.
NSPR Contributor Guide
when you co
nsider a new api for nspr ask yourself if your proposed feature can implement it across all platforms supported by nspr.
...give co
nsideration to providing a test case when fixing a bug if an existing test case did not catch a bug it should have caught.
NSPR Poll Method
we co
nsider a stack of nspr i/o layers on top of the network transport.
...for example, co
nsider an i/o layer that buffers input data.
An overview of NSS Internals
a trust anchor is just another x.509 certificate that is already known and has been deliberately marked as trusted by a software vendor, administrators i
nside an organizational infrastructure, or the software user.
...for example: certificates were valid at the time the signature was made, name in certificates matches the expected signer (check subject name, common name, email, based on application), the trust restrictions recorded i
nside the certificate (extensions) permit the use (e.g., encryption might be allowed, but not signing), and based on environment/application policy it might be required to perform a revocation check (ocsp or crl), that asks the issuer(s) of the certificates whether there have been events that made it necessary to revoke the trust (revoke the validity of the cert).
NSS 3.12.4 release notes
expressions i
nside unions may not include unions or exclusions.
... i
nside a union, to be matched and not treated as a special character, these characters must be escaped: \ ( | ) [ ~ except when they occur i
nside a bracketed expression, where only \ and ] require escaping.
NSS 3.12.6 release notes
bug 275744: support for tls compression rfc 3749 bug 494603: update nss's copy of sqlite3 to 3.6.22 to get numerous bug fixes bug 496993: add accessor functions for ssl_implementedciphers bug 515279: cert_pkixverifycert co
nsiders a certificate revoked if cert_processocspresponse fails for any reason bug 515870: gcc compiler warnings in nss 3.12.4 bug 518255: the input buffer for sgn_update should be declared const bug 519550: allow the specification of an alternate library for sqlite bug 524167: crash in [[@ find_objects_by_template - nsstoken_findcertificatebyissuerandserialnumber] ...
... bug 542538: nss: add function for recording ocsp stapled replies bug 544191: use system zlib on mac os x bug 544584: segmentation fault when enumerating the nss database bug 544586: various nss-sys-init patches from fedora bug 545273: remove unused function sec_init bug 546389: nsssysinit binary built i
nside source tree documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation.
NSS 3.14 release notes
because the test coverage and interoperability testing is not yet at the same level as other nss code, this feature should be co
nsidered "experimental" and may contain bugs.
...note that ssl cipher suites with "md5" in their names are not disabled by this change; those cipher suites use hmac-md5, not plain md5, and are still co
nsidered safe.
NSS sources building testing
these can be found by looking at the files with the .def file extension, i
nside the nss/lib directory hierarchy.
...i
nside the directory you'll find text file output.log, which contains a detailed report of all tests being executed.
NSS tools : signtool
in some situations, a digital signature may be co
nsidered as legally binding as a handwritten signature.
...this option makes the manifest files (required by the jar format) co
nsiderably smaller, but they contain slightly less information.
Scripting Java
all the functionality covered in this chapter should thus be co
nsidered an extension.
... as an example, co
nsider the following java class that defines a number of overloaded methods and calls them.
Hacking Tips
(gdb) continue compiling self-hosted:650:20470-21501 bailout from self-hosted:20:403-500 invalidate self-hosted:20:403-500 note: the line 3196, listed above, corresponds to the location of the jit spew i
nside jit::invalidate function.
... to run these benchmarks localy, you can clone arewefastyet sources and look i
nside the benchmarks directory to run individual benchmarks with your js shell.
64-bit Compatibility
for example, co
nsider this code: #define pointer_tagbits 3 static inline uintptr_t unmaskpointer(uintptr_t v) { return v & ~pointer_tagbits; } the value 3 will be inverted to 0xfffffffc, then zero-extended to 0x00000000fffffffc - a subtle and nasty bug, assuming it is unintended.
... the best way to fix this is to make types explicit, such as: const uintptr_t pointer_tagbits = 3 or by using a cast i
nside the macro.
TPS Tests
tps consists of a firefox extension of the same name, along with a python test runner, both of which live i
nside mozilla-central.
... for example, co
nsider the first action in the phase above: [bookmarks.add, bookmarks_initial] you could rewrite this as a custom function so as to add some custom logging: [async () => { logger.loginfo("adding bookmarks_initial"); await bookmarks.add(bookmarks_initial); }] note that this is probably best used for debugging, and new tests that want custom behavior should add it to the tps addon so that othe...
Secure Development Guidelines
fd_set(fd, &fdset); } file i/o: race conditions operating on files can often lead to race conditions since the file system is shared with other processes you check the state of a file at one point in time and immediately after the state might have changed most file name operations suffer from these race conditions, but not when performed on file descriptors file i/o: race conditions co
nsider the following example int main(int argc, char **argv) { char *file = argv[1]; int fd; struct stat statbuf; stat(file, &statbuf); if (s_islink(statbuf.st_mode)) { bailout(“symbolic link”); } else if (statbuf.st_uid != getuid) { bailout(“you don’t own the file”); } fd = open(file, o_rdwr); write(fd, argv[2], strlen(argv[2]...
... unlock(locka); unlock(lockb); } writing secure code: good coding practices banned api list badly designed apis can often lead to vulnerabilities it’s too easy to use the api inappropriately for example, co
nsider the libc string handling apis strcpy() performs no bounds checking strncpy() doesn’t always 0-terminate strncat() length parameter is very confusing banned api list examples of incorrect strncat usage buffer overflow strncat(buffer, string, sizeof(buffer)); off-by-one strncat(buffer, string, sizeof(buffer) – strlen(string)); correct usage s...
Handling Mozilla Security Bugs
the applicant's nomination for membership will then be co
nsidered for a period of a few days, during which members of the security bug group can speak out in favor of or against the applicant.
...if necessary mozilla.org staff will serve as the "court of final appeal." a final point about duplicate bug reports: note that security bugs marked as duplicates are still co
nsidered separate as far as disclosure is concerned.
AT APIs Support
supported at apis at apis terms microsoft active accessibility (msaa) an api devised by microsoft so that accessibility aids can track what's going on i
nside the user interface of any software package that supports it.
... assistive technology service provider interface (at-spi) an api devised by sun microsystems so that accessibility aids can track what's going on i
nside the user interface of any software package that supports it.
XUL Accessibility
aggregating the text from element subtree if the child node is hidden then it's ignored excepting the case when the element used as label is hidden itself if the child node is text node then its rendered value is appended if the child node is element then if it implements
nsidomxullabeledcontrolelement then the value of label property is appended otherwise if it's a label element then then value attribute is appended otherwise append tooltiptext attribute append the accessible value searching specific element in neighbour of the element search i
nside the element subtree go up through parents (max level is 5) and search i
nside theirs subtrees if the element is an...
...name the following rules to generate accessible name are applied: check aria-labelledby attribute, name is generated from elements pointed by aria-labelledby attribute <description id="descr1">label1</description> <description id="descr2">label2</description> <textbox aria-labelledby="descr1 descr2" /> if the element implements
nsidomxullabeledcontrolelement or
nsidomxulselectcontrolitemelement interface then it is used label property if the element doesn't implement
nsidomxulselectcontrolelement then label attribute is used if neighbour of the element has label element pointing to this element by the control attribute, if the label element is found then use value attribute or its content.
Embedded Dialog API
most if not all of these dialogs will need to be child/dependent/transient windows, so each method responsible for actually opening a window must take an
nsidomwindow *aparent parameter, and use that window as the dialog's parent, if non-null.
...embedded dialog posing interface coding conventions the
nsidomwindow *aparent parameter mentioned above should be the first parameter to each method in which it appears.
Mork
meta-rows do not appear to be used at all, although the parser seems to co
nsider setting the charset, row scope, and atom scope.
...if i
nside the meta-dictionary, the only cell we care about is if the key is 'a' (for atom scope).
XML Extras
additionally, "foo.com:80" and "foo.com:313" are co
nsidered different hosts for security purposes.
...
nsidomserializer (currently, the javascript constructor is xmlserializer())
nsidomparser (currently, the javascript constructor is domparser()) nsixmlhttprequest please see the xml linking and pointing section in xml in mozilla document for fixptr and xpointer documentation.
Using XPCOM Utilities to Make Things Easier
i
nside the macro, the interface name expands to ns_get_iid(), which is another macro that extracts the iid from the generated header of the interface.
...co
nsider the following real class: class myenumerator : public nsisimpleenumerator { public: ns_decl_isupports ns_decl_nsisimpleenumerator myenumerator(); virtual ~myenumerator() {} }; the declaration of this nsisimpleenumerator class doesn't include any methods other than the contructor and destructor.
Components.ID
components.classes, components.classesbyid, components.interfaces provide pretty much all the
nsids that most javascript code would ever need to deal with.
... the exception to this is the case where a component is written in javascript and needs to register itself with the component manager using its own
nsid - an id that is not already registered and thus does not appear in components.classes.
Components.utils.Sandbox
system principal to specify the system principal, you can create it using code like: cc["@mozilla.org/systemprincipal;1"].createinstance(ci.nsiprincipal); content principal you can specify a content principal for a particular origin in one of three ways: as an nsiprincipal, for example by using the nodeprincipal property of a dom node as an
nsidomwindow, such as that returned by the dom window property as a string uri like "http://www.example.com/" (discouraged) when possible, specify a window or an nsiprincipal object instead of using a string uri.
...}; complex objects can be cloned into the sandbox using components.utils.cloneinto: mysandbox.someobject = components.utils.cloneinto({ a: 'string', b: 21 }, mysandbox); obviously you need to co
nsider the security implications of the functions you import.
Components.utils.importGlobalProperties
the following strings are supported: string/object xpcom component atob blob btoa crypto css fetch file
nsidomfile indexeddb nodefilter firefox 60
nsidomnodefilter obsolete since gecko 60 rtcidentityprovider textdecoder textencoder url urlsearchparams xmlhttprequest nsixmlhttprequest obsolete since gecko 60 for string/object in table without a minimum firefox version, it is not exactly k...
...the dow
nside of using hiddendomwindow is that on startup of firefox, the hiddendomwindow objects cannot be accessed until it is fully loaded.
nsDirectoryService
class id f00152d0-b40b-11d3-8c9c-000064657374 contractid @mozilla.org/file/directory_service;1 supported interfaces nsiproperties
nsidirectoryservice remarks this component is a singleton and should therefore be accessed via the xpcom service manager.
... see also using
nsidirectoryservice nsiproperties.get()
nsidirectoryserviceprovider ...
IAccessibleAction
refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
...if there are more than one, the first one is co
nsidered the "default" action of the object.
amIWebInstallInfo
originatingwindow
nsidomwindow the window that started the installs.
... note: prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), this was an
nsidomwindowinternal.
amIWebInstallPrompt
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) method overview void confirm(in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, [optional] in pruint32 acount); prior to gecko 8.0, all references to
nsidomwindow used in this interface were
nsidomwindow.
...void confirm( in
nsidomwindow awindow, in nsiuri auri, [array, size_is(acount)] in nsivariant ainstalls, in pruint32 acount optional ); parameters awindow the window that triggered the installs.
nsIAbstractWorker
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface is an abstract interface used to implement the web workers architecture.
... 1.0 66 introduced gecko 1.9.1 inherits from:
nsidomeventtarget last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) attributes attribute type description onerror
nsidomeventlistener the error listener for the worker.
nsIContainerBoxObject
attributes attribute type description docshell
nsidocshell read only.
... the
nsidocshell object that manages the contained document.
nsIContentSecurityPolicy
1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview boolean permitsancestry(in
nsidocshell docshell); void refinepolicy(in astring policystring, in nsiuri selfuri); void scanrequestdata(in nsihttpchannel achannel); void sendreports(in astring blockeduri, in astring violateddirective); short shouldload(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiuri arequestorigin, in nsisupports acontext, in acstring amimetypeguess, in nsisupports aextra); short shouldprocess(in unsigned long acontenttype, in nsiuri...
...boolean permitsancestry( in
nsidocshell docshell ); parameters docshell containing the protected resource.
nsICookiePromptService
last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview long cookiedialog(in
nsidomwindow parent, in nsicookie cookie, in acstring hostname, in long cookiesfromhost, in boolean changingcookie, out boolean rememberdecision); constants constant value description deny_cookie 0 holds the value for a denying the cookie.
... long cookiedialog( in
nsidomwindow parent, in nsicookie cookie, in acstring hostname, in long cookiesfromhost, in boolean changingcookie, out boolean rememberdecision ); parameters parent the parent window for the dialog.
nsIFilePicker
to create an instance, use: var filepicker = components.classes["@mozilla.org/filepicker;1"] .createinstance(components.interfaces.nsifilepicker); method overview void appendfilter(in astring title, in astring filter); void appendfilters(in long filtermask); void init(in
nsidomwindow parent, in astring title, in short mode); void open(in nsifilepickershowncallback afilepickershowncallback); short show(); obsolete since gecko 57.0 attributes attribute type description addtorecentdocs boolean if true, the file is added to the operating system's "recent documents" list (if the operating system has one; nothing hap...
... void init( in
nsidomwindow parent, in astring title, in short mode ); parameters parent the
nsidomwindow parent.
nsIGeolocationUpdate
method overview void update(in
nsidomgeoposition position); methods update() notify the geolocation service that a new geolocation has been discovered.
...void update( in
nsidomgeoposition position ); parameters position a
nsidomgeoposition object describing the updated position information.
nsILoginManagerPrompter
to call this service, use: var loginmanagerprompter = components.classes["@mozilla.org/login-manager/prompter;1"] .getservice(components.interfaces.nsiloginmanagerprompter); method overview void init(in
nsidomwindow awindow); void prompttochangepassword(in nsilogininfo aoldlogin, in nsilogininfo anewlogin); void prompttochangepasswordwithusernames([array, size_is(count)] in nsilogininfo logins, in pruint32 count, in nsilogininfo anewlogin); void prompttosavepassword(in nsilogininfo alogin); methods init() initialize the prompter.
... void init( in
nsidomwindow awindow ); parameters awindow the in which the user is doing some login-related action that is resulting in a need to prompt them for something.
nsIMarkupDocumentViewer
inherits from: nsisupports last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) method overview void scrolltonode(in
nsidomnode node); void sizetocontent(); attributes attribute type description allowplugins boolean if true, plugins are allowed within the doc shell.
...void scrolltonode( in
nsidomnode node ); parameters node the
nsidomnode of the node to make visible.
nsIMenuBoxObject
inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) to get access to the box object for a given menu, use code like this: var boxobject = xulmenu.boxobject.queryinterface(components.interfaces.nsimenuboxobject); method overview boolean handlekeypress(in
nsidomkeyevent keyevent); void openmenu(in boolean openflag); attributes attribute type description activechild
nsidomelement the currently active menu or menuitem child of the menu box.
...methods handlekeypress() boolean handlekeypress( in
nsidomkeyevent keyevent ); parameters keyevent the key event to handle for the menu.
nsIMicrosummaryService
atoruri); nsisimpleenumerator getbookmarks(); nsimicrosummarygenerator getgenerator(in nsiuri generatoruri); nsimicrosummaryset getmicrosummaries(in nsiuri pageuri, in long long bookmarkid); nsimicrosummary getmicrosummary(in long long bookmarkid); boolean hasmicrosummary(in long long bookmarkid); nsimicrosummarygenerator installgenerator(in
nsidomdocument xmldefinition); boolean ismicrosummary(in long long bookmarkid, in nsimicrosummary microsummary); nsimicrosummary refreshmicrosummary(in long long bookmarkid); void removemicrosummary(in long long bookmarkid); void setmicrosummary(in long long bookmarkid, in nsimicrosummary microsummary); methods addgenerator() install the microsummary generator...
...nsimicrosummarygenerator installgenerator( in
nsidomdocument xmldefinition ); parameters xmldefinition an
nsidomdocument xml document defining the generator.
nsIMsgMessageService
adisplayconsumer is (for now) an
nsidocshell which the message is loaded into.
... adisplayconsumer for now, a
nsidocshell which the message is loaded into.
nsINavBookmarksService
from c++ code i
nside the places component, use nsbookmarksupdatebatcher defined in nsnavbookmarks.h to scope batches.
... runinbatchmode() this method runs the passed callback in batch mode (i
nside a database transaction).
nsINavHistoryQuery
hasbegintime boolean read only: whether or not, the corresponding begin time is co
nsidered.
... hasendtime boolean read only: whether or not, the corresponding end time is co
nsidered.
nsIPrincipal
principals are co
nsidered equal if they are the same principal, they have the same origin, or have the same certificate fingerprint id.
...note: for the future: perhaps we should co
nsider a certificate principal for a given uri subsuming a codebase principal for the same uri?
nsIPrompt
inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) note: this interface is identical to nsipromptservice but without the parent
nsidomwindow parameter.
...if you are using this interface, you must remove the
nsidomwindow arguments from those methods.
nsIRequest
co
nsider, for example, a http response with a "cache-control: no-cache" header.
... note: suspended requests are still co
nsidered pending.
nsISmsDatabaseService
domstring asender, in domstring abody, in unsigned long long adate); long savesentmessage(in domstring areceiver, in domstring abody, in unsigned long long adate); void getmessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void deletemessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void createmessagelist(in
nsidommozsmsfilter filter, in boolean reverse, in long requestid, [optional] in unsigned long long processid); void getnextmessageinlist(in long listid, in long requestid, [optional] in unsigned long long processid); void clearmessagelist(in long listid); void markmessageread(in long messageid, in boolean value, in long requestid, [optional] in unsigned long long processid) methods saverecei...
... createmessagelist() void createmessagelist( in
nsidommozsmsfilter filter, in boolean reverse, in long requestid, [optional] in unsigned long long processid ); parameters filter a smsfilter to filter out sms messages from a list.
nsISmsService
to create an instance, use: var smsservice = components.classes["@mozilla.org/sms/smsservice;1"] .createinstance(components.interfaces.nsismsservice); method overview [implicit_jscontext]
nsidommozsmsmessage createsmsmessage(in long id, in domstring delivery, in domstring sender, in domstring receiver, in domstring body, in jsval timestamp, in bool read ); unsigned short getnumberofmessagesfortext(in domstring text); boolean hassupport(); void send(in domstring number, in domstring message, in long requestid, [optional] in unsigned long long processid); ...
... methods createsmsmessage() [implicit_jscontext]
nsidommozsmsmessage createsmsmessage( in long id, in domstring delivery, in domstring sender, in domstring receiver, in domstring body, in jsval timestamp, in bool read ); parameters id a number representing the id of the message.
nsITransferable
requestingnode
nsidomnode the source dom node this transferable was created from.
...pt callers, one needs to get to the document that the transferable corresponds to, and then get the load context from the document like this: var loadcontext = doc.defaultview.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.nsiloadcontext); in c++ callers, if you have the corresponding document, you can just call
nsidocument.getloadcontext() to get to the load context object.
nsITreeBoxObject
treebody
nsidomelement readonly: obtain the treebody content node.
...a page is co
nsidered to be the amount displayed by the tree.
nsITreeColumns
last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview nsitreecolumn getcolumnat(in long index); nsitreecolumn getcolumnfor(in
nsidomelement element); nsitreecolumn getfirstcolumn(); nsitreecolumn getkeycolumn(); nsitreecolumn getlastcolumn(); nsitreecolumn getnamedcolumn(in astring id); nsitreecolumn getprimarycolumn(); nsitreecolumn getsortedcolumn(); void invalidatecolumns(); void restorenaturalorder(); attributes attribute type description count long the number of columns.
...nsitreecolumn getcolumnfor( in
nsidomelement element ); parameters element a dom element return value a nsitreecolumn for this element.
nsIUpdatePrompt
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void checkforupdates(); void showupdateavailable(in nsiupdate update); void showupdatedownloaded(in nsiupdate update, [optional] in boolean background); void showupdateerror(in nsiupdate update); void showupdatehistory(in
nsidomwindow parent); void showupdateinstalled(); methods checkforupdates() presents a user interface that checks for and displays the available updates.
...void showupdatehistory( in
nsidomwindow parent ); parameters parent an
nsidomwindow indicating the parent window to which to anchor the update list window.
nsIVariant
nsresult getasid(out
nsid retval); violates the xpcom interface guidelines print16 getasint16(); native code only!
... violates the xpcom interface guidelines getasid() nsresult getasid( out
nsid retval ); parameters retval if the internal value is an iid then it is returned.
nsIWebBrowser
contentdomwindow
nsidomwindow the top-level dom window.
... see also nsibasewindow nsicontextmenulistener
nsidomwindow nsiembeddingsitewindow nsiinterfacerequestor nsishistorylistener nsitooltiplistener nsiuricontentlistener nsiweakreference nsiwebbrowserchrome nsiwebbrowserchromefocus nsiwebprogresslistener ...
nsIWebBrowserChrome3
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 originaltarget, in nsiuri linkuri, in
nsidomnode linknode, in prbool isapptab); methods onbeforelinktraversal() determines the appropriate target for a link.
... astring onbeforelinktraversal( in astring originaltarget, in nsiuri linkuri, in
nsidomnode linknode, in prbool isapptab ); parameters originaltarget the original link target.
nsIWebBrowserFindInFrames
attributes attribute type description currentsearchframe
nsidomwindow frame at which to start the search.
... rootsearchframe
nsidomwindow frame within which to confine the search (normally the content area frame).
nsIWorker
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface represents a dom worker thread.
...method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); attributes attribute type description onmessage
nsidomeventlistener an object to receive notifications when messages are received on the worker's message port.
nsIWorkerGlobalScope
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface is an abstract interface representing the 'i
nside' of a worker.
... onerror
nsidomeventlistener self nsiworkerglobalscope returns the global scope object itself.
nsIWorkerMessageEvent
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface represents an event in a web worker thread's event queue.
... 1.0 66 introduced gecko 1.9.1 inherits from:
nsidomevent last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) method overview void initmessageevent(in domstring atypearg, in boolean acanbubblearg, in boolean acancelablearg, in domstring adataarg, in domstring aoriginarg, in nsisupports asourcearg); attributes attribute type description data domstring the event's data.
nsIXFormsModelElement
1.0 66 introduced gecko 1.8 obsolete gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview
nsidomdocument getinstancedocument(in domstring instanceid); void rebuild(); void recalculate(); void refresh(); void revalidate(); methods getinstancedocument()
nsidomdocument getinstancedocument( in domstring instanceid ); parameters instanceid the id of the instance element to be returned.
... return value an
nsidomdocument.
nsIXMLHttpRequest
here is a comment from johnny stenback <jst@netscape.com>: the mozilla implementation of nsixmlhttprequest implements the interface
nsidomeventtarget and that's how you're supported to add event listeners.
... try something like this: nscomptr<
nsidomeventtarget> target(do_queryinterface(myxmlhttpreq)); target->addeventlistener(ns_literal_string("load"), mylistener, pr_false) where mylistener is your event listener object that implements the interface
nsidomeventlistener.
nsIXSLTException
inherits from: nsiexception last changed in gecko 1.7 attributes attribute type description sourcenode
nsidomnode the context node, may be null.
... stylenode
nsidomnode the node in the stylesheet that triggered the exception.
nsIXULSortService
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.
...void sort( in
nsidomnode anode, in astring asortkey, in astring asorthints ); parameters anode a node in the xul widget whose children are to be sorted.
XPCOM primitive
(however, if you are designing that kind of api today, you should probably use nsivariant instead.) idl data type interface component idl
nsidptr nsisupportsid @mozilla.org/supports-id;1 [scriptable, uuid(d18290a0-4a1c-11d3-9890-006008962422)] interface nsisupportsid : nsisupportsprimitive { attribute
nsidptr data; string tostring(); }; astring nsisupportsstring @mozilla.org/supports-string;1 [scriptable, uuid(d79dc970-4a1c-11d3-9890-006008962422)] interface nsisupportsstring : nsisupportsprimitive { attribute astring data...
...4f0-568d-11d3-baf8-00805f8a5dd7)] interface nsisupportsvoid : nsisupportsprimitive { [noscript] attribute voidptr data; string tostring(); }; nsisupports nsisupportsinterfacepointer @mozilla.org/supports-interface-pointer;1 [scriptable, uuid(995ea724-1dd1-11b2-9211-c21bdd3e7ed0)] interface nsisupportsinterfacepointer : nsisupportsprimitive { attribute nsisupports data; attribute
nsidptr dataiid; string tostring(); }; ...
Frequently Asked Questions
{ // i only need the |nsifoo| interface for a short time // so i control its lifetime by declaring it i
nside // a block statement.
... interface pointers co
nsidered harmful by don box originally appeared in the september 1995 issue of "the c++ report".
Using the clipboard
if (source instanceof ci.
nsidomwindow) // note: in gecko versions >16, you can import the privatebrowsingutils.jsm module // and use privatebrowsingutils.privacycontextfromwindow(sourcewindow) instead source = source.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation); res.init(source); } return res; } here, the string "t...
...next we need to initialize it with a "privacy context", which will ensure that source data from i
nside private browsing mode will be cleared when the mode is exited.
XPCOM
you'll have to turn to the xpcom newsgroup or another experienced nscomptr user, or find the answer by experimentation.using nsiclassinfoif you use a c++ class which implements nsiclassinfo from javascript, then you don't have to explicitly call queryinterface on the javascript object to access the object's interfaces.using
nsidirectoryservicensdirectoryservice implements the nsiproperties interface.
...if the referent object is destroyed before the weak reference, the pointer i
nside the weak reference is set to nsnull.working with multiple versions of interfacesin this short note we illustrate how one can update an xpcom module in order for it to work in both firefox 2 and firefox 3, even if the interfaces have changed in the interim.working with out parameterswrappedjsobjectwrappedjsobject is a property sometimes available on xpconnect wrappers.
XPIDL Syntax
libidl only co
nsiders a single line feed as a newline, and not carriage returns (although xpidl begs to differ).
...text i
nside raw code fragments are not otherwise parsed by xpidl directly.
Building a Thunderbird extension 5: XUL
the status bar is implemented in a xul file called messenger.xul, which can be found in the chrome/messenger/content/messenger folder which is packaged i
nside the omni.ja archive.
... to view this xul file use the dom inspector extension (no longer supported) or look i
nside the omni.ja archive, which is located in the thunderbird program folder.
Drawing and Event Handling - Plugins
if a plug-in does not make this call, it is co
nsidered a windowed plug-in.
...because the browser does not need to draw the background behind the plug-in, opaque windowless plug-ins are co
nsiderably more efficient than transparent plug-ins.
Debugger.Frame - Firefox Developer Tools
(note that the debuggee is not co
nsidered an “immediate caller” of handler methods it triggers.
... even though the debuggee and debugger share the same javascript stack, frames pushed for spidermonkey’s calls to handler methods to report events in the debuggee are never co
nsidered visible frames.) invocation functions and “debugger” frames aninvocation function is any function in this interface that allows the debugger to invoke code in the debuggee: debugger.object.prototype.call, debugger.frame.prototype.eval, and so on.
Debugger - Firefox Developer Tools
allowunobservedasmjs a boolean value indicating whether asm.js code running i
nside this debugger instance’s debuggee globals is invisible to debugger api handlers and breakpoints.
... collectcoverageinfo a boolean value indicating whether code coverage should be enabled i
nside each debuggee of this debugger instance.
Index - Firefox Developer Tools
for each resource, you'll see: 107 cookies cookies, dev tools, firefox, guide, storage, storage inspector, tools, l10n:priority when you select an origin i
nside the cookies storage type from the storage tree, all the cookies present for that origin will be listed in a table.
...this table contains the following columns: 109 indexeddb dev tools, firefox, guide, indexeddb, storage, storage inspector, tools, l10n:priority when you select an origin i
nside the indexed db storage type in the storage tree of the storage inspector, a table lists the details of all the databases present for that origin.
Call Tree - Firefox Developer Tools
let's expand the entry for swap(): there were 253 samples taken i
nside swap().
...if we look at the code for sort(), it should be fairly obvious that the high platform data cost is coming from repeated calls to console.log(): function sort(unsorted) { console.log(bubblesort(unsorted)); console.log(selectionsort(unsorted)); console.log(quicksort(unsorted)); } it would certainly be worthwhile co
nsidering more efficient ways of implementing this.
Waterfall - Firefox Developer Tools
if this is i
nside a callback from a promise, this will also show the "async stack".
... for example, co
nsider code like this: var timerbutton = document.getelementbyid("timer"); timerbutton.addeventlistener("click", handleclick, false); function handleclick() { console.time("timer"); runtimer(1000).then(timerfinished); } function timerfinished() { console.timeend("timer"); console.log("ready!"); } function runtimer(t) { return new promise(function(resolve) { settimeout(resolve, t); ...
Cookies - Firefox Developer Tools
when you select an origin i
nside the cookies storage type from the storage tree, all the cookies present for that origin will be listed in a table.
... you can edit cookies by double-clicking i
nside cells in the table widget and editing the values they contain, and add new cookies by clicking the "plus" (+) button and then editing the resulting new row to the value you want.
Animation - Web APIs
it will cause the end styling state to be written to the element being animated, in the form of properties i
nside a style attribute.
... co
nsider providing a mechanism for pausing or disabling animation, as well as using the reduced motion media query to create a complimentary experience for users who have expressed a preference for no animated experiences.
CSSRule - Web APIs
if this rule is a style rule i
nside an @media block, the parent rule would be that cssmediarule.
...(until the documentation is completed, see the interface definition in the mozilla source code:
nsidomcssimportrule.) cssrule.media_rule 4 cssmediarule cssrule.font_face_rule 5 cssfontfacerule cssrule.page_rule 6 csspagerule cssrule.keyframes_rule 7 csskeyframesrule cssrule.keyframe_rule 8 csskeyframerule reserved for future use 9 should be used to define color profiles in the fu...
CSSStyleDeclaration.setProperty() - Web APIs
we know that the rule we want to alter to do this is contained i
nside 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 i
nside the stylesheet, which are contained in the array found at stylesheet.cssrules; for each one, we check whether its cssstylerule.selectortext property is equal to the selector .box p, which indicates it is the one we want.
CanvasRenderingContext2D.isPointInPath() - Web APIs
fillrule the algorithm by which to determine if a point is i
nside or outside the path.
... html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create circle const circle = new path2d(); circle.arc(150, 75, 50, 0, 2 * math.pi); ctx.fillstyle = 'red'; ctx.fill(circle); // listen for mouse moves canvas.addeventlistener('mousemove', function(event) { // check whether point is i
nside circle if (ctx.ispointinpath(circle, event.offsetx, event.offsety)) { ctx.fillstyle = 'green'; } else { ctx.fillstyle = 'red'; } // draw circle ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.fill(circle); }); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.ispointinpath'...
Compositing and clipping - Web APIs
everything that's drawn after creating the clipping path will only appear i
nside that path.
...again the stars only appear i
nside the defined clipping path.
ConstrainDouble - Web APIs
exact a double-precision floating-point number specifying a specific, required, value the property must have to be co
nsidered acceptable.
... ideal a double-precision floating-point number specifying a value the property would ideally have, but which can be co
nsidered optional if necessary to find a match.
ConstrainULong - Web APIs
exact an integer specifying precise, required, value the property must have to be co
nsidered acceptable.
... ideal an integer specifying a value the property would ideally have, but which can be co
nsidered optional if necessary to find a match.
Constraint validation API - Web APIs
in this case the custom error message is cleared, the element is co
nsidered valid, and no message is shown.
...i
nside this function we work out whether the value is invalid because it is empty, or because it doesn't match the pattern, using an if() block, and set a custom validity error message.
DedicatedWorkerGlobalScope.onmessage - Web APIs
messages are passed to the worker when the value i
nside the form input first changes.
...a dedicatedworkerglobalscope.onmessage handler is used to handle messages from the main script: onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } notice how in the main script, onmessage has to be called on myworker, whereas i
nside the worker script you just need onmessage because the worker is effectively the global scope (the dedicatedworkerglobalscope, in this case).
DedicatedWorkerGlobalScope.postMessage() - Web APIs
i
nside the handler a calculation is done from which a result message is created; this is then sent back to the main thread using postmessage(workerresult); onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } in the main script, onmes...
...sage would have to be called on a worker object, whereas i
nside the worker script you just need onmessage because the worker is effectively the global scope (dedicatedworkerglobalscope).
DeprecationReportBody - Web APIs
web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to start observing reports using reportingobserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified i
nside the constructor: observer.observe(); because of the event handler we set up i
nside the reportingobserver() constructor, we can now click the button to display the report details.
...we loop over each report using a basic for loop, then iterate over each entry of in the report's body (a deprecationreportbody instance) using a for...in structure, displaying each key/value pair i
nside a list item.
Document.cookie - Web APIs
co
nsider also that: any of the following cookie attribute values can optionally follow the key-value pair, specifying the cookie to set/update, and preceded by a semi-colon separator: ;path=path (e.g., '/', '/mydir') if not specified, defaults to the current path of the current document location.
... the dash is co
nsidered part of the prefix.
Document.querySelectorAll() - Web APIs
list of all of the <p> elements in the document: var matches = document.queryselectorall("p"); this example returns a list of all <div> elements within the document with a class of either note or alert: var matches = document.queryselectorall("div.note, div.alert"); here, we get a list of <p> elements whose immediate parent element is a <div> with the class highlighted and which are located i
nside a container whose id is test.
... html co
nsider this html, with its three nested <div> blocks.
Document - Web APIs
document.hiddenread only returns a boolean value indicating if the page is co
nsidered hidden or not.
... document.hasfocus() returns true if the focus is currently located anywhere i
nside the specified document.
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
st) such element mybody = document.getelementsbytagname("body")[0]; // now, get all the p elements that are descendants of the body mybodyelements = mybody.getelementsbytagname("p"); // get the second item of the list of p elements myp = mybodyelements[1]; myp.style.background = "rgb(255,0,0)"; } in this example, we set the myp variable to the dom object for the second p element i
nside the body: first, we get a list of all the body elements via mybody = document.getelementsbytagname("body")[0] since there is only one body element in any valid html document, this list will have only one item, which we retrieve by selecting the first element in that list using [0].
...the following figure shows the recently created text node object i
nside the document tree.
Element: click event - Web APIs
an element receives a click event when a pointing device button (such as a mouse's primary mouse button) is both pressed and released while the pointer is located i
nside the element.
... safari mobile co
nsiders the following elements to be typically interactive (and thus they aren't affected by this bug): <a> (but it must have an href) <area> (but it must have an href) <button> <img> <input> <label> (but it must be associated with a form control) <textarea> this list is incomplete; you can help mdn by doing further testing/research and expanding it.
Element.innerHTML - Web APIs
security co
nsiderations it is not uncommon to see innerhtml used to insert text into a web page.
... javascript function log(msg) { var logelem = document.queryselector(".log"); var time = new date(); var timestr = time.tolocaletimestring(); logelem.innerhtml += timestr + ": " + msg + "<br/>"; } log("logging mouse events i
nside this container..."); the log() function creates the log output by getting the current time from a date object using tolocaletimestring(), and building a string with the timestamp and the message text.
Element: mousedown event - Web APIs
the mousedown event is fired at an element when a pointing device button is pressed while the pointer is i
nside the element.
... note: this differs from the click event in that click is fired after a full click action occurs; that is, the mouse button is pressed and released while the pointer remains i
nside the same element.
Element.querySelectorAll() - Web APIs
ts contained within the element "mybox": var matches = mybox.queryselectorall("p"); this example returns a list of all <div> elements within "mybox" with a class of either "note" or "alert": var matches = mybox.queryselectorall("div.note, div.alert"); here, we get a list of the document's <p> elements whose immediate parent element is a div with the class "highlighted" and which are located i
nside a container whose id is "test".
... html co
nsider this html, with its three nested <div> blocks.
Element.setAttribute() - Web APIs
boolean attributes are co
nsidered to be true if they're present on the element at all, regardless of their actual value; as a rule, you should specify the empty string ("") in value (some people use the attribute's name; this works but is non-standard).
...all that matters is that if the attribute is present at all, regardless of its actual value, its value is co
nsidered to be true.
Element.shadowRoot - Web APIs
i
nside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updatestyle(), which actually applies the size and color to the element.
...from here we use standard dom traversal techniques to find the <style> element i
nside the shadow dom and then update the css found i
nside it: function updatestyle(elem) { const shadow = elem.shadowroot; const childnodes = array.from(shadow.childnodes); childnodes.foreach(childnode => { if (childnode.nodename === 'style') { childnode.textcontent = ` div { width: ${elem.getattribute('l')}px; height: ${elem.getattribute('l')}px; ...
Element.slot - Web APIs
a slot is a placeholder i
nside a web component that users can fill with their own markup (see using templates and slots for more information).
... when <my-paragraph> is used in the document, the slot is populated by a slotable element by including it i
nside the element with a slot attribute with the value my-text.
Element - Web APIs
element.scroll() scrolls to a particular set of coordinates i
nside a given element.
... element.scrollto() scrolls to a particular set of coordinates i
nside a given element.
EventTarget.removeEventListener() - Web APIs
for example, co
nsider this call to addeventlistener(): element.addeventlistener("mousedown", handlemousedown, true); now co
nsider each of these two calls to removeeventlistener(): element.removeeventlistener("mousedown", handlemousedown, false); // fails element.removeeventlistener("mousedown", handlemousedown, true); // succeeds the first call fails because the value of usecapture doesn't match.
... now co
nsider this: element.addeventlistener("mousedown", handlemousedown, { passive: true }); here, we specify an options object in which passive is set to true, while the other options are left to the default value of false.
ExtendableEvent.waitUntil() - Web APIs
if the promise passed to waituntil() rejects, the install is co
nsidered a failure, and the installing service worker is discarded.
... this is primarily used to ensure that a service worker is not co
nsidered installed until all of the core caches it depends on are successfully populated.
FileSystemEntrySync - Web APIs
you cannot do the following: move a directory i
nside itself or to any child at any depth move an entry into its parent if a name different from its current one isn't provided move a file to a path occupied by a directory or move a directory to a path occupied by a file move any element to a path occupied by a directory that is not empty.
...you cannot copy an entry i
nside itself if it is a directory, nor can you copy it into its parent without providing a new name.
FormData - Web APIs
methods formdata.append() appends a new value onto an existing key i
nside a formdata object, or adds the key if it does not already exist.
... formdata.set() sets a new value for an existing key i
nside a formdata object, or adds the key/value if it does not already exist.
Guide to the Fullscreen API - Web APIs
let's co
nsider this <video> element: <video controls id="myvideo"> <source src="somevideo.webm"></source> <source src="somevideo.mp4"></source> </video> we can put that video into full-screen mode as follows: var elem = document.getelementbyid("myvideo"); if (elem.requestfullscreen) { elem.requestfullscreen(); } this code checks for the existence of the requestfullscreen() method before calling it.
...to get the same fullscreen behavior in webkit, you need to add your own "width: 100%; height: 100%;" css rules to the element yourself: #myvideo:-webkit-full-screen { width: 100%; height: 100%; } on the other hand, if you're trying to emulate webkit's behavior on gecko, you need to place the element you want to present i
nside another element, which you'll make fullscreen instead, and use css rules to adjust the inner element to match the appearance you want.
Geolocation API - Web APIs
a geolocationposition instance is returned by a successful call to one of the methods contained i
nside geolocation, i
nside a success callback, and contains a timestamp plus a geolocationcoordinates object instance.
... geolocationpositionerror a geolocationpositionerror is returned by an unsuccessful call to one of the methods contained i
nside geolocation, i
nside an error callback, and contains an error code and message.
GlobalEventHandlers.onselect - Web APIs
the select event only fires after text i
nside an <input type="text"> or <textarea> is selected.
... examples this example logs the text you select i
nside a <textarea> element.
HTMLFormElement - Web APIs
fires an event named invalid at any control that does not satisfy its constraints; such controls are co
nsidered invalid if the event is not canceled.
... elements that are co
nsidered form controls the elements included by htmlformelement.elements and htmlformelement.length are the following: <button> <fieldset> <input> (with the exception that any whose type is "image" are omitted for historical reasons) <object> <output> <select> <textarea> no other elements are included in the list returned by elements, which makes it an excellent way to get at the elements ...
HTMLFrameSetElement - Web APIs
htmlframesetelement.cols is a domstring structured as a comma-seperated list specifing the width of each column i
nside a frameset.
... htmlframesetelement.rows is a domstring structured as a comma-seperated list specifing the height of each column i
nside a frameset.
HTMLImageElement.complete - Web APIs
the image is co
nsidered completely loaded if any of the following are true: neither the src nor the srcset attribute is specified.
... examples co
nsider a photo library app that provides the ability to open images into a lightbox mode for improved viewing as well as editing of the image.
HTMLImageElement.naturalHeight - Web APIs
this is the height the image is if drawn with nothing constraining its height; if you don't specify a height for the image, or place the image i
nside a container that either limits or expressly specifies the image height, it will be rendered this tall.
... html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed i
nside a <div>.
HTMLImageElement.naturalWidth - Web APIs
this is the width the image is if drawn with nothing constraining its width; if you neither specify a width for the image nor place the image i
nside a container that limits or expressly specifies the image width, this is the number of css pixels wide the image will be.
... html <div class="box"> <img src="/files/16797/clock-demo-400px.png" class="image"> </div> <div class="output"> </div> the html features a 400x398 pixel image which is placed i
nside a <div>.
HTMLInputElement.setSelectionRange() - Web APIs
optionally, in newer browser versions, you can specify the direction in which selection should be co
nsidered to have occurred.
... selectiondirection optional a string indicating the direction in which the selection is co
nsidered to have been performed.
HTMLSlotElement.name - Web APIs
a slot is a placeholder i
nside a web component that users can fill with their own markup.
... every time the element inserted in the slot changes, we log a report to the console saying which slot has changed, and what the new node i
nside the slot is.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
when a fragment of javascript code runs, it runs i
nside an execution context.
...co
nsider the javascript program below: let outputelem = document.getelementbyid("output"); let userlanguages = { "mike": "en", "teresa": "es" }; function greetuser(user) { function localgreeting(user) { let greeting; let language = userlanguages[user]; switch(language) { case "es": greeting = `¡hola, ${user}!`; break; case "en": default: g...
The HTML DOM API - Web APIs
for example, co
nsider a document with two elements, one of which has two more elements nested i
nside it: while the document interface is defined as part of the dom specification, the html specification significantly enhances it to add information specific to using the dom in the context of a web browser, as well as to using it to represent html documents specifically.
...for example, co
nsider a <a> element, which is represented in the dom by an object of type htmlanchorelement.
Recommended Drag Types - Web APIs
to drag multiple links, separate each link i
nside the text/uri-list data with a crlf linebreak.
... lines that begin with a number sign (#) are comments, and should not be co
nsidered urls.
Headers - Web APIs
methods headers.append() appends a new value onto an existing header i
nside a headers object, or adds the header if it does not already exist.
... headers.set() sets a new value for an existing header i
nside a headers object, or adds the header if it does not already exist.
IDBDatabase - Web APIs
idbdatabase.createmutablefile() creates a file handle, allowing files to be stored i
nside an indexeddb database.
...y", { unique: false }); objectstore.createindex("month", "month", { unique: false }); objectstore.createindex("year", "year", { unique: false }); objectstore.createindex("notified", "notified", { unique: false }); note.innerhtml += '<li>object store created.</li>'; }; this next line opens up a transaction on the database, then opens an object store that we can then manipulate the data i
nside of.
IDBKeyRange - Web APIs
instance methods idbkeyrange.includes() returns a boolean indicating whether a specified key is i
nside the key range.
...this means that the cursor will only retrieve records with keys i
nside that range.
Checking when a deadline is due - Web APIs
var minutecheck = now.getminutes(); var hourcheck = now.gethours(); var daycheck = now.getdate(); var monthcheck = now.getmonth(); var yearcheck = now.getfullyear(); the date object has a number of methods to extract various parts of the date and time i
nside it.
...when a notification is fired for each item object, its notification property is set to "yes" so this check will not pass on the next iteration, via the following code i
nside the createnotification() function (read using indexeddb for an explanation): // now we need to update the value of notified to "yes" in this particular data object, so the // notification won't be set off on it again // first open up a tranaction as usual var objectstore = db.transaction(['todolist'], "readwrite").objectstore('todolist'); // get the to-do list object that ...
IntersectionObserver.IntersectionObserver() - Web APIs
you can provide any combination of the following options: root an element or document object which is an ancestor of the intended target, whose bounding rectangle will be co
nsidered the viewport.
... any part of the target not visible in the visible area of the root is not co
nsidered visible.
Timing element visibility with the Intersection Observer API - Web APIs
if it's become at least 75% visible, then we co
nsider the ad visible and we start the timer by setting the ad's dataset.lastviewstarted attribute to the transition time in entry.time, then add the ad to the set visibleads so we know to process it as time goes by.
... drawing an ad's timer i
nside each ad, for demonstration purposes, we draw the current value of its totalviewtime, converted into minutes and seconds.
KeyboardEvent.key - Web APIs
the keyboardevent interface's key read-only property returns the value of the key pressed by the user, taking into co
nsideration the state of modifier keys such as shift as well as the keyboard locale and layout.
... keyboardevent sequence example co
nsider the event sequence generated when we interact with the shift and the 2 key using a u.s keyboard layout as compared to when we do so using a uk keyboard layout.
Using the MediaStream Recording API - Web APIs
next, we call getusermedia() and i
nside it define: the constraints: only audio is to be captured for our dictaphone.
... note: all of the code below is placed i
nside the getusermedia success callback.
MessageEvent - Web APIs
the different scripts are using the same worker file to perform the calculation — they can both access it, even if their pages are running i
nside different windows.
...ctively: first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } myworker.port.onmessage = function(e) { result1.textcontent = e.data; console.log('message received from worker'); } i
nside the worker we use the sharedworkerglobalscope.onconnect handler to connect to the same port discussed above.
MouseScrollEvent - Web APIs
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 indic...
... methods initmousescrollevent() see
nsidommousescrollevent::initmousescrollevent().
Node.getRootNode() - Web APIs
this will differ in exact form depending on where you called getrootnode(); for example: calling it on an element i
nside a standard web page will return an htmldocument object representing the entire page.
... calling it on an element i
nside a shadow dom will return the associated shadowroot.
Node.nodeType - Web APIs
node.text_node 3 the actual text i
nside an element or attr.
...== node.document_node; // true document.doctype.nodetype === node.document_type_node; // true document.createdocumentfragment().nodetype === node.document_fragment_node; // true var p = document.createelement("p"); p.textcontent = "once upon a time…"; p.nodetype === node.element_node; // true p.firstchild.nodetype === node.text_node; // true comments this example checks if the first node i
nside the document element is a comment, and displays a message if not.
Node.textContent - Web APIs
if the node is a cdata section, comment, processing instruction, or text node, textcontent returns the text i
nside the node, i.e., the node.nodevalue.
...sometimes people use innerhtml to retrieve or write text i
nside an element, but textcontent has better performance because its value is not parsed as html.
NodeFilter.acceptNode() - Web APIs
the children of skipped nodes are still co
nsidered.
... example var nodeiterator = document.createnodeiterator( // node to use as root document.getelementbyid('someid'), // only co
nsider nodes that are text nodes (nodetype 3) nodefilter.show_text, // object containing the function to use for the acceptnode method // of the nodefilter { acceptnode: function(node) { // logic to determine whether to accept, reject or skip node // in this case, only accept nodes that have content // other than whitespace if ( !
NodeFilter - Web APIs
the children of skipped nodes are still co
nsidered.
... example const nodeiterator = document.createnodeiterator( // node to use as root document.getelementbyid('someid'), // only co
nsider nodes that are text nodes (nodetype 3) nodefilter.show_text, // object containing the function to use for the acceptnode method // of the nodefilter { acceptnode: function(node) { // logic to determine whether to accept, reject or skip node // in this case, only accept nodes that have content // other than whitespace if ( !
PannerNode - Web APIs
pannernode.coneinnerangle is a double value describing the angle, in degrees, of a cone i
nside of which there will be no volume reduction.
...you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is co
nsidered "low." the default value is 0.
... syntax var threshold = adatachannel.bufferedamountlowthreshold; adatachannel.bufferedamountlowthreshold = threshold; value the number of queued outgoing data bytes below which the buffer is co
nsidered to be "low." example in this snippet of code, bufferedamountlowthreshold is set to 64kb, and a handler for the bufferedamountlow event is established by setting the rtcdatachannel.onbufferedamountlow property to a function which should send more data into the buffer by calling send().
RTCIceCandidateStats.deleted - Web APIs
if this value is true, the candidate described by the rtcicecandidatestats object is no longer under co
nsideration.
... the net result is the same; the candidate is no longer under co
nsideration if this value is true.
RTCIceTransport.state - Web APIs
however, there are still candidates pairings to co
nsider, and there may still be gathering underway on one or both of the two devices.
...in addition, all candidate pairs have been co
nsidered and a pair has been selected for use.
RTCIceTransportState - Web APIs
however, there are still candidates pairings to co
nsider, and there may still be gathering underway on one or both of the two devices.
...in addition, all candidate pairs have been co
nsidered and a pair has been selected for use.
RTCPeerConnection.addTrack() - Web APIs
for example, co
nsider 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(track, gumstream); } } the remote peer might ...
... the rtcrtpsender being co
nsidered has never been used to send data.
RTCStatsReport - Web APIs
since this only provides statistics related to inbound data, without co
nsidering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included.
...this information co
nsiders only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states.
RTCStatsType - Web APIs
since this only provides statistics related to inbound data, without co
nsidering the local peer's state, any values that require knowledge of both, such as round-trip time, is not included.
...this information co
nsiders only the outbound rtp stream, so any data which requires information about the state of the remote peers (such as round-trip time) is unavailable, since those values can't be computed without knowing about the other peers' states.
Range.setEnd() - Web APIs
syntax range.setend(endnode, endoffset); parameters endnode the node i
nside which the range should end.
... exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located i
nside a doctype node.
Range - Web APIs
range.comparenode() returns a constant representing whether the node is before, after, i
nside, or surrounding the range.
... range.comparepoint() returns -1, 0, or 1 indicating whether the point occurs before, i
nside, or after the range.
Report - Web APIs
web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to start observing reports using reportingobserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified i
nside the constructor: observer.observe(); because of the event handler we set up i
nside the reportingobserver() constructor, we can now click the button to display the report details.
...we loop over each report using a basic for loop, then iterate over each entry of in the report's body using a for...in structure, displaying each key/value pair i
nside a list item.
ReportingObserver - Web APIs
web page: let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); we then tell it to start observing reports using reportingobserver.observe(); this tells the observer to start collecting reports in its report queue, and runs the callback function specified i
nside the constructor: observer.observe(); later on in the example we deliberately use the deprecated version of mediadevices.getusermedia(): if(navigator.mozgetusermedia) { navigator.mozgetusermedia( constraints, success, failure); } else { navigator.getusermedia( constraints, success, failure); } this causes a deprecation report to be generated; because of the event h...
...andler we set up i
nside the reportingobserver() constructor, we can now click the button to display the report details.
SVGGeometryElement - Web APIs
normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is co
nsidered to be within the fill.
...normal hit testing rules apply; the value of the pointer-events property on the element determines whether a point is co
nsidered to be within the stroke.
onnotificationclose - Web APIs
note: trying to create a notification i
nside the serviceworkerglobalscope using the notification() constructor will throw an error.
...}); example //i
nside a service worker.
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
therefore, it's common to call self.skipwaiting() from i
nside of an installevent handler.
... self.skipwaiting(); // perform any other actions required for your // service worker to install, potentially i
nside // of event.waituntil(); }); specifications specification status comment service workersthe definition of 'skipwaiting()' in that specification.
SharedWorker - Web APIs
the different scripts are using the same worker file to perform the calculation — they can both access it, even if their pages are running i
nside different windows.
...ctively: first.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } second.onchange = function() { myworker.port.postmessage([first.value,second.value]); console.log('message posted to worker'); } myworker.port.onmessage = function(e) { result1.textcontent = e.data; console.log('message received from worker'); } i
nside the worker we use the sharedworkerglobalscope.onconnect handler to connect to the same port discussed above.
SharedWorkerGlobalScope.applicationCache - Web APIs
don't use it to make offline websites — co
nsider using service workers instead.
... example if a shared worker has an appcache associated with it, you can return a reference to the cache using self.applicationcache from i
nside the shared worker.
SourceBuffer.abort() - Web APIs
example the spec description of abort() is somewhat confusing — co
nsider for example step 1 of reset parser state.
...for example, co
nsider this code: sourcebuffer.addeventlistener('updateend', function (_) { ...
SourceBuffer.timestampOffset - Web APIs
the timestampoffset property of the sourcebuffer interface controls the offset applied to timestamps i
nside media segments that are appended to the sourcebuffer.
...their sourcebuffer.updating property is currently true), a media segment i
nside the sourcebuffer is currently being parsed, or this sourcebuffer has been removed from the mediasource.
Using the Storage Access API - Web APIs
</iframe> now on to the code executed i
nside the embedded document.
...}); note that access requests are automatically denied unless the embedded content is currently processing a user gesture such as a tap or click — so this code needs to be run i
nside some kind of user gesture-based event handler, for example: btn.addeventlistener('click', () => { // run code here }); ...
SubtleCrypto.exportKey() - Web APIs
*/ window.crypto.subtle.generatekey( { name: "rsa-pss", // co
nsider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["sign", "verify"] ).then((keypair) => { const exportbutton = document.queryselector(".pkcs8"); exportbutton.addeventlistener("click", () => { exportcryptokey(keypair.privatekey); }); }); subjectpublickeyinfo exp...
...*/ window.crypto.subtle.generatekey( { name: "rsa-oaep", // co
nsider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["encrypt", "decrypt"] ).then((keypair) => { const exportbutton = document.queryselector(".spki"); exportbutton.addeventlistener("click", () => { exportcryptokey(keypair.publickey); }); }); json web key import t...
TouchEvent.targetTouches - Web APIs
the targettouches read-only property is a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred i
nside the same target element as the current target element.
... syntax var touches = touchevent.targettouches; return value touches a touchlist listing all the touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred i
nside the same target element as the current target element.
WebGLRenderingContext.vertexAttribPointer() - Web APIs
this is independent from the location i
nside the array buffer, so your attributes can be sent in a different order than how they are stored in the array buffer.
...keep in mind that these webgl functions have a slow performance and it is better to store the state i
nside your javascript application.
Basic scissoring - Web APIs
although the clear() drawing command writes the clear color (set by clearcolor()) to all pixels in the drawing buffer, scissor() defines a mask that only allows pixels i
nside the specified rectangular area to be updated.
...because only fragments within the specified rectangular area successfully pass the scissor test, only pixels i
nside that area are updated, and we get a rectangle on the screen.
Raining rectangles - Web APIs
timer = settimeout(drawanimation, 17); } function playerclick (evt) { // we need to transform the position of the click event from // window coordinates to relative position i
nside the canvas.
... var position = [ evt.pagex - evt.target.offsetleft, gl.drawingbufferheight - (evt.pagey - evt.target.offsettop), ]; // if the click falls i
nside the rectangle, we caught it.
Lighting in WebGL - Web APIs
sunlight, for example, is co
nsidered directional light.
... for our purposes, we're going to simplify the lighting model by only co
nsidering simple directional and ambient lighting; we won't have any specular highlights or point light sources in this scene.
WebRTC connectivity - Web APIs
the pending description (returned by rtcpeerconnection.pendinglocaldescription and rtcpeerconnection.pendingremotedescription) indicates a description which is currently under co
nsideration following a call to setlocaldescription() or setremotedescription(), respectively.
... the pendinglocaldescription contains not just the offer or answer under co
nsideration, but any local ice candidates which have already been gathered since the offer or answer was created.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
a polite peer, essentially, is one which may send out offers, but then responds if an offer arrives from the other peer with "okay, never mind, drop my offer and i'll co
nsider yours instead." an impolite peer, which always ignores incoming offers that collide with its own offers.
... the old way co
nsider this onnegotiationneeded event handler: pc.onnegotiationneeded = async () => { try { await pc.setlocaldescription(await pc.createoffer()); signaler.send({description: pc.localdescription}); } catch(err) { console.error(err); } }; because the createoffer() method is asynchronous and takes some time to complete, there's time in which the remote peer might attempt to send an o...
Signaling and video calling - Web APIs
now let's co
nsider the signaling protocol we will implement.
... optionally, see rfc 8445: interactive connectivity establishment, section 2.3 ("negotiating candidate pairs and concluding ice") if you want greater understanding of how this process is completed i
nside the ice layer.
WebRTC API - Web APIs
interoperability because implementations of webrtc are still evolving, and because each browser has different levels of support for codecs and webrtc features, you should strongly co
nsider making use of the adapter.js library provided by google before you begin to write your code.
... see also mediadevices mediastreamevent mediastreamconstraints mediastreamtrack messageevent mediastream media capture and streams api firefox multistream and renegotiation for jitsi videobridge peering through the webrtc fog with socketpeer i
nside the party bus: building a web app with multiple live video streams + interactive graphics web media technologies ...
Writing WebSocket client applications - Web APIs
to begin listening for incoming data, you can do something like this: examplesocket.onmessage = function (event) { console.log(event.data); } receiving and interpreting json objects let's co
nsider the chat client application first alluded to in using json to transmit objects.
... security co
nsiderations websockets should not be used in a mixed content environment; that is, you shouldn't open a non-secure websocket connection from a page loaded using https or vice-versa.
Fundamentals of WebXR - Web APIs
webvr was generally co
nsidered to be an experimental api designed to help specification writers determine the best approaches to creating an api for virtual reality on the web.
... basic concepts before getting into too much detail, let's co
nsider some basic concepts that you need to know before you learn how to develop xr code.
WebXR permissions and security - Web APIs
the document is co
nsidered trustworthy, in that it is responsible and is both currently active and has focus.
... if your code is executing during the launch of a web application, the runtime may co
nsider the act of launching your web application to qualify as user intent.
Advanced techniques: Creating and sequencing audio - Web APIs
also, it would be really nice to co
nsider an instrument-wide bpm control.
... this.dataset.playing = 'true'; } else { window.cleartimeout(timerid); this.dataset.playing = 'false'; } }) }); summary we've now got an instrument i
nside our browser!
Web audio spatialization basics - Web APIs
as if its extensive variety of sound processing (and other) options wasn't enough, the web audio api also includes facilities to allow you to emulate the difference in sound as a listener moves around a sound source, for example panning as you move around a sound source i
nside a 3d game.
... the boombox sits i
nside a room (defined by the edges of the browser viewport), and in this demo, we can move and rotate it with the provided controls.
Window.mozAnimationStartTime - Web APIs
returns the time, in milliseconds since the epoch, at which animations started now should be co
nsidered to have started.
... syntax time = window.mozanimationstarttime; parameters time is the time in milliseconds since the epoch at which animations for the current window should be co
nsidered to have started.
Window: popstate event - Web APIs
to better understand when the popstate event is fired, co
nsider this simplified sequence of events that occurs when the current history entry changes due to either the user navigating the site or the history being traversed programmatically.
...the destination entry is now co
nsidered to be current.
Window.window - Web APIs
for example, if we refer to "this.window.location.href", a javascript module could define a property called "window" i
nside of a class it defined (since no global "window" variable exists for it by default) which could be created after passing in a window object to the module class' constructor.
... thus, "this.window" i
nside of its functions would refer to that window object.
Window - Web APIs
see mozscreenpixelspercsspixel in
nsidomwindowutils for a conversion factor to adapt to screen pixels if needed.
... globaleventhandlers.onmousemove called continously when the mouse is moved i
nside the window.
Worker.onmessage - Web APIs
messages are passed to the worker when the value i
nside the form input first changes.
...the worker.js script, an onmessage handler is used to the handle messages from the main script: onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } notice how in the main script, onmessage has to be called on myworker, whereas i
nside the worker script you just need onmessage because the worker is effectively the global scope (dedicatedworkerglobalscope).
WorkerGlobalScope.console - Web APIs
example this property allows you to have access to a browser console for debugging purposes, i
nside a worker.
... so for example you could call console.log('test'); i
nside a worker (which would basically be the equivalent of self.console.log('test');, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), to return a test message out to the browser console.
WorkerGlobalScope.location - Web APIs
example if you called the following in a document served at localhost:8000 console.log(location); i
nside a worker (which would basically be the equivalent of self.console.log(self.location);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerlocation object written to the console — something like the following: workerlocation {hash: "", search: "", pathname: "/worker.js", port: "8000", hostname: "localhost"…} hash: "" ...
... note: firefox has a bug with using console.log i
nside shared/service workers (see bug 1058644), which may return strange results, but this should be fixed soon.
WorkerGlobalScope.performance - Web APIs
example if you called console.log(performance); i
nside a worker (which would basically be the equivalent of self.console.log(self.performance);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerperformance object written to the console — something like the following: workerperformance {now: function} __proto__: workerperformance constructor: function workerperformance() { [native code] } now: functi...
... note: firefox has a bug with using console.log i
nside shared/service workers (see bug 1058644), which may return strange results, but this should be fixed soon.
Synchronous and asynchronous requests - Web APIs
you should co
nsider using the fetch() api with the keepalive flag.
... when fetch with keepalive isn't available, you can co
nsider using the navigator.sendbeacon() api, which can support these use cases while typically delivering a good ux.
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
for example, co
nsider a device which uses a 2560x1440 pixel frame buffer (which is used to render two views, for the left and right eyes, side by side each at a resolution of 1280x1440 pixels).
... co
nsider a frame buffer which at full size looks like this: if, on this device, it's determined that due to gpu limitations the browser needs to reduce image quality in order to improve performance to an acceptable level, it might choose to halve the resolution.
ARIA live regions - Accessibility
aria-controls="myregionid1 myregio
nsid2".
... advanced use case: clock as an illustration of aria-atomic, co
nsider a site with a simple clock, showing hours and minutes.
Using the alertdialog role - Accessibility
the tab order i
nside the alert dialog must wrap.
... when the alert dialog is correctly labeled and focus is moved to a control i
nside the dialog, screen readers should announce the dialog's accessible role, name and optionally description before announcing the focused element.
Using the group role - Accessibility
the group role is used to identify a set of user interface objects which, in contrast with a region, are not intended to be included in a table of contents or a page summary (such as the structures that are dynamically created by a script or assistive technologies); a group should not be co
nsidered a major perceivable section on a page.
... assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce the group when focus first lands on a control i
nside it, and if aria-describedby has been set, the description may be spoken.
ARIA annotations - Accessibility
wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations i
nside web documents.
...9">march 30 2019, 19:29</time></p> </div> <div role="comment" id="thread-2" data-author="chris"> <h3>marcus said</h3> <p class="comment-text">the guitar solo could do with a touch more chorus, and a slightly lower volume.</p> <p><time datetime="2019-03-29t15:35">march 29 2019, 15:35</time></p> </div> nested comments are also possible with aria annotations — simply nest the comments i
nside one another, like so: <div role="comment" id="thread-1" data-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> <div role="comment" data-author="marcus"> <h3>marcus replied</h3> <p class="comment-text">i don't know about that.
ARIA: article role - Accessibility
articles are not co
nsidered a navigational landmark, but many assistive technologies that support landmarks also support a means to navigate among articles.
... i
nside an application or other widget that causes screen readers and other assistive technologies to be in pass-through mode, an article can be used to indicate that these should switch back to treating the enclosed content as regular web content.
ARIA: contentinfo role - Accessibility
mega-footers do not nest additional <footer> elements or contentinfo landmarks i
nside of the document's footer.
...note that a footer element nested within an article, aside, main, nav, or section is not co
nsidered contentinfo.
ARIA: grid role - Accessibility
even though both data grids and layout grids employ the same aria roles, states, and properties, differences in their content and purpose surface factors that are important to co
nsider in keyboard interaction design.
... row a row i
nside the grid.
ARIA: Listitem role - Accessibility
the aria listitem role can be used to identify an item i
nside a list of items.
... <section 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 i
nside it can be identified to assistive technologies using the list and listitem containers respectively.
Web applications and ARIA FAQ - Accessibility
you may want to co
nsider implementing aria using progressive enhancement techniques—such as adding aria using javascript, not directly to your markup—in order to more gracefully support older browsers and assistive technologies.
... degrading gracefully from html5 to aria when delivering content to browsers that aren't html5-aware, you may want to co
nsider gracefully degrading to the use of aria where necessary.
Text labels and names - Accessibility
use a legend to label a fieldset when grouping a set of form elements together with a <fieldset> element, you should include a nested <legend> element i
nside it, containing a clear description of the group.
... the form element can be placed i
nside the <label>, in which case the association between the form element and the label is obvious from the structure.
:host - CSS: Cascading Style Sheets
the :host css pseudo-class selects the shadow host of the shadow dom containing the css it is used i
nside — in other words, this allows you to select a custom element from i
nside its shadow dom.
... in this example we have a simple custom element — <context-span> — that you can wrap around text: <h1>host selectors <a href="#"><context-span>example</context-span></a></h1> i
nside the element's constructor, we create style and span elements, fill the span with the content of the custom element, and fill the style element with some css rules: let style = document.createelement('style'); let span = document.createelement('span'); span.textcontent = this.textcontent; const shadowroot = this.attachshadow({mode: 'open'}); shadowroot.appendchild(style); shadowroot.appendchild...
:is() (:matches(), :any()) - CSS: Cascading Style Sheets
/* selects any paragraph i
nside a header, main or footer element that is being hovered */ :is(header, main, footer) p:hover { color: red; cursor: pointer; } /* the above is equivalent to the following */ header p:hover, main p:hover, footer p:hover { color: red; cursor: pointer; } /* backwards-compatible version with :-*-any() and :matches() (it is not possible to group selectors into single rule, because pr...
...in, footer) p'); } catch(e) { try { matcheditems = document.queryselectorall(':-moz-any(header, main, footer) p'); } catch(e) { console.log('your browser doesn\'t support :is(), :matches(), or :any()'); } } } } matcheditems.foreach(applyhandler); function applyhandler(elem) { elem.addeventlistener('click', function(e) { alert('this paragraph is i
nside a ' + e.target.parentnode.nodename); }); } simplifying list selectors the :is() pseudo-class can greatly simplify your css selectors.
@charset - CSS: Cascading Style Sheets
it must be the first element in the style sheet and not be preceded by any character; as it is not a nested statement, it cannot be used i
nside conditional group at-rules.
... if several @charset at-rules are defined, only the first one is used, and it cannot be used i
nside a style attribute on an html element or i
nside the <style> element where the character set of the html page is relevant.
@media - CSS: Cascading Style Sheets
syntax the @media at-rule may be placed at the top level of your code or nested i
nside any other conditional group at-rule.
... also co
nsider using level 4 media queries to improve the user's experience.
At-rules - CSS: Cascading Style Sheets
@namespace — tells the css engine that all its content must be co
nsidered prefixed with an xml namespace.
... nested at-rules — a subset of nested statements, which can be used as a statement of a style sheet as well as i
nside of conditional group rules: @media — a conditional group rule that will apply its content if the device meets the criteria of the condition defined using a media query.
Coordinate systems - CSS: Cascading Style Sheets
whenever the mouse enters, moves around i
nside, or exits the inner box, the corresponding event is handled by updating a set of informational messages within the box, listing out the current mouse coordinates in each of the four available coordinate systems.
... let inner = document.queryselector(".inner"); let log = document.queryselector(".log"); function setcoords(e, type) { let idx = type + "x"; let idy = type + "y"; document.getelementbyid(idx).innertext = e[idx]; document.getelementbyid(idy).innertext = e[idy]; } a reference to the <div> i
nside the inner box which contains the paragraphs that will show the coordinate information is fetched into log.
Box alignment in grid layout - CSS: Cascading Style Sheets
on the block (cross) axis the alignment of the items i
nside their grid areas is controlled with align-items.
... self alignment justify-self align-self place-self justify-items align-items place-items these properties deal with aligning the item i
nside the grid area it is placed into.
Handling Overflow in Multicol - CSS: Cascading Style Sheets
in this guide we look at how multicol deals with overflow, both i
nside the column boxes and in situations where there is more content than will fit into the container.
... overflow i
nside column boxes an overflow situation happens when an item's size is larger than the column box.
Styling Columns - CSS: Cascading Style Sheets
as column boxes created i
nside multicol containers are anonymous boxes, there is little we can do to style them.
...in the next guide we will take a look at making elements i
nside a container span across all columns.
Using feature queries - CSS: Cascading Style Sheets
testing for lack of support in addition to asking the browser if it supports a feature, you can test for the opposite by adding in the not keyword: @supports not (property: value) { css rules to apply } the css i
nside the following example feature query will run if the browser does not support row-gap.
...you do however need to structure your css in a certain way, writing css for non-supporting browsers and overwriting it with the css i
nside the feature query.
CSS Containment - CSS: Cascading Style Sheets
it tells the browser that the internal layout of the element is totally separate from the rest of the page, and that everything about the element is painted i
nside its bounds.
...by using contain: layout you can tell the browser it only needs to check this element — everything i
nside the element is scoped to that element and does not affect the rest of the page, and the containing box establishes an independent formatting context.
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
aligning content on the cross axis — the align-content property so far we have been aligning the items, or an individual item i
nside the area defined by the flex-container.
...you might think that this should be a use case for a justify-self property, however co
nsider the image below.
Ordering Flex Items - CSS: Cascading Style Sheets
we will also co
nsider the implications of reordering items from an accessibility point of view.
... if you are using a reverse value, or otherwise reordering your items, you should co
nsider whether you actually need to change the logical order in the source.
CSS Fragmentation - CSS: Cascading Style Sheets
it also occurs when a block spans more than one column i
nside a column layout container, or spans a page break when printed.
... reference box-decoration-break break-after break-before break-i
nside orphans widows specifications specification status comment css fragmentation module level 3 candidate recommendation initial definition.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
my mark-up is a container with elements i
nside for a header, footer, main content, navigation, sidebar, and a block into which i am intending to place advertising.
... .wrapper { max-width: 1024px; margin: 0 auto; font: 1.2em helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; background-color: #ffec99; border-radius: 5px; padding: 10px; } .wrapper { display: grid; grid-template-columns: repeat(12, [col-start] 1fr); grid-gap: 20px; } to demonstrate how this grid system works i have four child elements i
nside my wrapper.
Subgrid - CSS: Cascading Style Sheets
note that line numbering restarts i
nside the subgrid — column line 1, when i
nside the subgrid, is the first line of the subgrid.
... take a look at the next example — it uses the same parent and child grid as in the example above, however i
nside the subgrid i have twelve items trying to autoplace into ten grid cells.
The stacking context - CSS: Cascading Style Sheets
each stacking context is completely independent of its siblings: only descendant elements are co
nsidered when stacking is processed.
... each stacking context is self-contained: after the element's contents are stacked, the whole element is co
nsidered in the stacking order of the parent stacking context.
CSS selectors - CSS: Cascading Style Sheets
syntax: a b example: div span will match all <span> elements that are i
nside a <div> element.
... syntax: a > b example: ul > li will match all <li> elements that are nested directly i
nside a <ul> element.
CSS values and units - CSS: Cascading Style Sheets
position the <position> type defines 2d positioning of an object i
nside a positioning area, for example a background image i
nside a container.
... white space is allowed, but optional i
nside the parentheses.
Center an element - CSS: Cascading Style Sheets
in this recipe you will see how to center one box i
nside another.
... recipe download this example choices made to center one box i
nside another we make the containing box a flex container.
Recipe: Media objects - CSS: Cascading Style Sheets
if the image is larger, the track stops growing at 200 pixels and as the image has a max-width of 100% applied, it scales down so that it continues to fit i
nside the column.
... when we nest one media object i
nside another we need to place it into the second track in the regular layout, and the first track when flipped.
Paged media - CSS: Cascading Style Sheets
it allows you to set page breaks, control printable area, style left and right pages differently, and control breaks i
nside elements.
... widely supported properties include: page-break-before page-break-after page-break-i
nside orphans widows @page ...
WebKit CSS extensions - CSS: Cascading Style Sheets
t-border-start-style** -webkit-border-start-width** -webkit-border-vertical-spacing -webkit-box-align** -webkit-box-direction** -webkit-box-flex-group** -webkit-box-flex** -webkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -webkit-box-pack** -webkit-box-reflect** c -webkit-column-axis -webkit-column-break-after -webkit-column-break-before -webkit-column-break-i
nside -webkit-column-progression -webkit-cursor-visibility d-i -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-character -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphenate-limit-lines -webkit-initial-letter l -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -w...
... -webkit-alt* -webkit-color-correction -webkit-flow-from -webkit-flow-into -webkit-grid-columns (see grid-column) -webkit-grid-rows (see grid-row) -webkit-hyphenate-charset -webkit-image-set (see image-set()) -webkit-mask-attachment -webkit-match-nearest-mail-blockquote-color -webkit-overflow-scrolling -webkit-region-break-after -webkit-region-break-before -webkit-region-break-i
nside -webkit-region-fragment -webkit-shape-i
nside -webkit-touch-callout (see touch-action) background-origin-x (unprefixed!) background-origin-y (unprefixed!) * still supported in the safari technology preview, but not in a generally released browser.
box-flex-group - CSS: Cascading Style Sheets
when dividing up the box's extra space, the browser first co
nsiders all elements within the first flex group.
...instead, distribution of space i
nside the flex container is now handled using flex-basis, flex-grow, and flex-shrink.
box-lines - CSS: Cascading Style Sheets
the default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be co
nsidered overflow.
...each line computes flexes independently, so only elements on that line are co
nsidered when evaluating box-flex and box-flex-groups.
calc() - CSS: Cascading Style Sheets
co
nsider the following code: .foo { --widtha: 100px; --widthb: calc(var(--widtha) / 2); --widthc: calc(var(--widthb) / 2); width: var(--widthc); } after all variables are expanded, widthc's value will be calc( calc( 100px / 2) / 2), then when it's assigned to .foo's width property, all inner calc()s (no matter how deeply nested) will be flattened to just parentheses, so the width property's va...
...in short: a calc() i
nside of a calc() is identical to just parentheses.
<color> - CSS: Cascading Style Sheets
there are a few caveats to co
nsider 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).
... accessibility co
nsiderations some people have difficulty distinguishing colors.
contain - CSS: Cascading Style Sheets
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 i
nside 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" al...
...t="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 i
nside it's containing element's bounds: specifications specification status comment css containment module level 1the definition of 'contain' in that specification.
<display-listitem> - CSS: Cascading Style Sheets
list-item can also be combined with any <display-outside> keyword and the flow or flow-root <display-i
nside> keywords.
... examples html <div class="fake-list">i will display as a list item</div> css .fake-list { display: list-item; list-style-position: i
nside; } result specifications specification status css display module level 3the definition of 'display-listitem' in that specification.
hyphens - CSS: Cascading Style Sheets
values none words are not broken at line breaks, even if characters i
nside the words suggest line break points.
... manual words are broken for line-wrapping only where characters i
nside the word suggest line break opportunities.
image() - CSS: Cascading Style Sheets
therefore, if the fragment is not understood within image(), the image will be co
nsidered invalid.
...as a use case, co
nsider a dark image being used as a background for some white text.
inherit - CSS: Cascading Style Sheets
for non-inherited properties, this specifies a behavior that typically makes relatively little sense and you may co
nsider using initial instead, or unset on the all property.
... examples exclude selected elements from a rule /* make second-level headers green */ h2 { color: green; } /* ...but leave those in the sidebar alone so they use their parent's color */ #sidebar h2 { color: inherit; } in this example the h2 elements i
nside the sidebar might be different colors.
margin-left - CSS: Cascading Style Sheets
in this case, it is set to the value centering the element i
nside its parent.
...in this case, it is set to the value centering the border area i
nside the available width, if fixed.
margin-right - CSS: Cascading Style Sheets
in this case, it is set to the value centering the element i
nside its parent.
...in this case, it is set to the value centering the border area i
nside the available width, if fixed.
overflow-wrap - CSS: Cascading Style Sheets
soft wrap opportunities introduced by the word break are co
nsidered when calculating min-content intrinsic sizes.
... break-word the same as the anywhere value, with normally unbreakable words allowed to be broken at arbitrary points if there are no otherwise acceptable break points in the line, but soft wrap opportunities introduced by the word break are not co
nsidered when calculating min-content intrinsic sizes.
position - CSS: Cascading Style Sheets
fari on iossamsung internetpositionchrome full support 1edge full support 12firefox full support 1notes full support 1notes notes before firefox 57, absolute positioning did not work correctly when applied to elements i
nside tables that have border-collapse applied to them (bug 1379306).notes before firefox 30, absolute positioning of table rows and row groups was not supported (bug 63895).ie full support 4opera full support 4safari full support 1webview android full ...
...support ≤37chrome android full support 18firefox android full support 4notes full support 4notes notes before firefox 57, absolute positioning did not work correctly when applied to elements i
nside tables that have border-collapse applied to them (bug 1379306).notes before firefox 30, absolute positioning of table rows and row groups was not supported (bug 63895).opera android full support 14safari ios full support 1samsung internet android full support 1.0absolutely-positioned flex childrenchrome...
shape-image-threshold - CSS: Cascading Style Sheets
any pixels whose alpha component's value is greater than the threshold are co
nsidered to be part of the shape for the purposes of determining its boundaries.
...the gradient is established as a css shape using shape-outside, so that pixels within the gradient which are at least 20% opaque (that is, those pixels with an alpha component greater than 0.2) are co
nsidered part of the shape.
text-overflow - CSS: Cascading Style Sheets
the ellipsis is displayed i
nside the content area, decreasing the amount of text displayed.
...the string is displayed i
nside the content area, shortening the size of the displayed text.
scale() - CSS: Cascading Style Sheets
when a coordinate value is outside the [-1, 1] range, the element grows along that dimension; when i
nside, it shrinks.
... also, co
nsider making use of the prefers-reduced-motion media feature — use it to write a media query that will turn off animations if the user has reduced animation specified in their system preferences.
white-space - CSS: Cascading Style Sheets
the white-space css property sets how white space i
nside an element is handled.
... hang pre-line preserve collapse wrap remove break-spaces preserve preserve wrap wrap formal definition initial valuenormalapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | pre | nowrap | pre-wrap | pre-line | break-spaces examples basic example code { white-space: pre; } line breaks i
nside <pre> elements pre { word-wrap: break-word; /* ie 5.5-7 */ white-space: pre-wrap; /* modern browsers */ } in action html <div id="css-code" class="box"> p { white-space: <select> <option>normal</option> <option>nowrap</option> <option>pre</option> <option>pre-wrap</option> <option>pre-line</option> <option>break-spaces</option> </select> } </div> ...
Audio and video manipulation - Developer guides
for efficiency, you should co
nsider using requestanimationframe() instead of settimeout() when running on browsers that support it.
...you can combine webgl and the <video> element to create video textures, which means you can put video i
nside 3d scenes.
HTML attribute: max - HTML: Hypertext Markup Language
valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and both the <progress> and <meter> elements, the max attribute is a number that specifies the most positive value a form control to be co
nsidered valid.
... type="time" max="17:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t23:59"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the maximum value set, the value is co
nsidered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information.
HTML attribute: min - HTML: Hypertext Markup Language
valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and the <meter> element, the min attribute is a number that specifies the most negative value a form control to be co
nsidered valid.
...nput type="time" min="09:00" step="900"> datetime-local yyyy-mm-ddthh:mm <input type="datetime-local" min="2019-12-25t19:30"> number <number> <input type="number" min="0" step="5" max="100"> range <number> <input type="range" min="60" step="5" max="100"> note: when the data entered by the user doesn't adhere to the min value set, the value is co
nsidered invalid in contraint validation and will match the :invalid pseudoclass see client-side validation and rangeunderflow for more information.
HTML attribute: step - HTML: Hypertext Markup Language
the number spinner, if present, will only show valid float values of 1.2 and greater note: when the data entered by the user doesn't adhere to the stepping configuration, the value is co
nsidered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and stepmismatch for more information.
...if providing instructions outside of labels, which allows more flexible positioning and design, co
nsider using aria-labelledby or aria-describedby.
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
a tainted canvas is one which is no longer co
nsidered secure, and any attempts to retrieve image data back from the canvas will cause an exception to be thrown.
...co
nsider the html5 boilerplate apache server configuration file for cors images, shown below: <ifmodule mod_setenvif.c> <ifmodule mod_headers.c> <filesmatch "\.(bmp|cur|gif|ico|jpe?g|png|svgz?|webp)$"> setenvif origin ":" is_cors header set access-control-allow-origin "*" env=is_cors </filesmatch> </ifmodule> </ifmodule> in short, this configures the server to allow graphic fil...
Date and time formats used in HTML - HTML: Hypertext Markup Language
that means it's possible for the first few days of january to be co
nsidered part of the previous week-year, and for the last few days of december to be co
nsidered part of the following week-year.
...for example, the first thursday of 1953 was on january 1, so that week—beginning on monday, december 29—is co
nsidered the first week of the year.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
the default closed state displays only the triangle and the label i
nside <summary> (or a user agent-defined default string if no <summary>).
...here's what your browser does with it: providing a summary this example adds a summary to the above example by using the <summary> element i
nside <details>, like this: <details> <summary>system requirements</summary> <p>requires a computer running an operating system.
<form> - HTML: Hypertext Markup Language
it is possible to use the :valid and :invalid css pseudo-classes to style a <form> element based on whether or not the elements i
nside the form are valid.
... dialog: when the form is i
nside a <dialog>, closes the dialog on submission.
<input type="file"> - HTML: Hypertext Markup Language
if it is, we: print out its name and file size into a list item i
nside the previous <div> (obtained from file.name and file.size).
... if the file type is invalid, we display a message i
nside a list item telling the user that they need to select a different file type.
<input type="password"> - HTML: Hypertext Markup Language
if the pattern attribute is specified, the content of a password control is only co
nsidered valid if the value passes validation; see validation for more information.
... additional attributes in addition to the attributes that operate on all <input> elements regardless of their type, password field inputs support the following attributes: attribute description maxlength the maximum length the value may be, in utf-16 characters minlength the minimum length in characters that will be co
nsidered valid pattern a regular expression the value must match in order to be valid placeholder an example value to display in the field when the field is empty readonly a boolean attribute which, if present, indicates that the field's contents should not be editable size the number of characters wide the input field should be maxlength the max...
<input type="range"> - HTML: Hypertext Markup Language
the precise value, however, is not co
nsidered important.
... co
nsider this range control: <input type="range" id="volume" min="0" max="11" value="7" step="1"> screenshotlive sample this control is horizontal (at least on most if not all major browers; others might vary).
<input type="time"> - HTML: Hypertext Markup Language
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed i
nside the form control, and can't be styled or shown effectively.
...queryselector('#hour'); var minuteselect = document.queryselector('#minute'); // hide fallback initially fallbackpicker.style.display = 'none'; fallbacklabel.style.display = 'none'; // test whether a new date input falls back to a text input or not var test = document.createelement('input'); try { test.type = 'time'; } catch (e) { console.log(e.description); } // if it does, run the code i
nside the if() {} block if(test.type === 'text') { // hide the native picker and show the fallback nativepicker.style.display = 'none'; fallbackpicker.style.display = 'block'; fallbacklabel.style.display = 'block'; // populate the hours and minutes dynamically populatehours(); populateminutes(); } function populatehours() { // populate the hours <select> with the 6 open hours of the ...
<output>: The Output element - HTML: Hypertext Markup Language
(if this attribute is not set, the <output> is associated with its ancestor <form> element, if any.) this attribute lets you associate <output> elements to <form>s anywhere in the document, not just i
nside a <form>.
...assistive technology will thereby announce the results of ui interactions posted i
nside it without requiring that focus is switched away from the controls that produce those results.
<p>: The Paragraph element - HTML: Hypertext Markup Language
in finished works, combining both is co
nsidered redundant and amateurish.</p> <p>in very old writing, paragraphs were separated with a special character: ¶, the <i>pilcrow</i>.
... nowadays, this is co
nsidered claustrophobic and hard to read.</p> <p>how hard to read?
<table>: The Table element - HTML: Hypertext Markup Language
deprecated attributes align this enumerated attribute indicates how the table must be aligned i
nside the containing document.
... ideally, co
nsider 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.
<template>: The Content Template element - HTML: Hypertext Markup Language
co
nsider the following html and javascript: html <div id="container"></div> <template id="template"> <div>click me</div> </template> javascript const container = document.getelementbyid("container"); const template = document.getelementbyid("template"); function clickhandler(event) { alert("clicked a div"); } const firstclone = template.content.clonenode(true); firstclone.addeventlistener("cl...
...ick", clickhandler); container.appendchild(firstclone); const secondclone = template.content.firstelementchild.clonenode(true); secondclone.addeventlistener("click", clickhandler); container.appendchild(secondclone); result firstclone is a documentfragment instance, so while it gets appended i
nside the container as expected, clicking on it does not trigger the click event.
Link types - HTML: Hypertext Markup Language
if not i
nside the <head> element, the standard doesn't distinguish between a hyperlink applying to a specific part of the document or to the document as a whole.
...starting with firefox 44, the value of the crossorigin attribute is taken into co
nsideration, making it possible to make anonymous prefetches.
Cross-Origin Resource Sharing (CORS) - HTTP
if any of those headers have ”nonstandard” values, webkit/safari does not co
nsider the request to be a “simple request”.
... what values webkit/safari co
nsider “nonstandard” is not documented, except in the following webkit bugs: require preflight for non-standard cors-safelisted request headers accept, accept-language, and content-language allow commas in accept, accept-language, and content-language request headers for simple cors switch to a blacklist model for restricted accept headers in simple cors requests no other browsers implement these extra restrictions, because they’re not part of the spec.
Content Security Policy (CSP) - HTTP
csp makes it possible for server administrators to reduce or eliminate the vectors by which xss can occur by specifying the domains that the browser should co
nsider to be valid sources of executable scripts.
... sample violation report let's co
nsider a page located at http://example.com/signup.html.
Using HTTP cookies - HTTP
the cookie is usually stored by the browser, and then the cookie is sent with requests made to the same server i
nside a cookie http header.
...the %x2f ("/") character is co
nsidered a directory separator, and subdirectories match as well.
Alt-Svc - HTTP
ma=<max-age>optional the number of seconds for which the alternative service is co
nsidered fresh.
...in that case, early entries are co
nsidered more preferable.
Content-Security-Policy-Report-Only - HTTP
header type response header forbidden header name no this header is not supported i
nside a <meta> element.
... sample violation report let's co
nsider a page located at http://example.com/signup.html.
Expect-CT - HTTP
if a cache receives a value greater than it can represent, or if any of its subsequent calculations overflows, the cache will co
nsider this value to be either 2,147,483,648 (231) or the greatest positive integer it can represent.
...browsers implement their own trust model regarding which ct logs are co
nsidered trusted for the certificate to have been logged to.
If-None-Match - HTTP
the comparison with the stored etag uses the weak comparison algorithm, meaning two files are co
nsidered identical if the content is equivalent — they don't have to be identical byte for byte.
... for example, two pages that differ by the date of generation in the footer would still be co
nsidered as identical.
CSS Houdini
the css working group does a lot of work to ensure every feature is performant, handles all edge cases, and co
nsiders security, privacy, and accessibility.
... as you extend css with houdini, make sure to keep these co
nsiderations in mind, and start small before moving on to more ambitious projects.
Concurrency model and the event loop - JavaScript
a dow
nside of this model is that if a message takes too long to complete, the web application is unable to process user interactions like click or scroll.
... legacy exceptions exist like alert or synchronous xhr, but it is co
nsidered a good practice to avoid them.
Expressions and operators - JavaScript
co
nsider these examples: w = z = x = y is equivalent to w = (z = (x = y)) or x = y; z = y; w = y z += x *= y is equivalent to z += (x *= y) or tmp = x * y; x *= y; z += tmp (except without the tmp).
...this operator is primarily used i
nside a for loop, to allow multiple variables to be updated each time through the loop.
Assertions - JavaScript
the beginning and end of a string are co
nsidered non-words.
... // 4) use \b to match characters i
nside borders of an entity.
Private class fields - JavaScript
syntax class classwithprivatefield { #privatefield } class classwithprivatemethod { #privatemethod() { return 'hello world' } } class classwithprivatestaticfield { static #private_static_field } examples private static fields private fields are accessible on the class constructor from i
nside the class declaration itself.
...like private static fields, they are only accessible from i
nside the class declaration.
Classes - JavaScript
y); } } const p1 = new point(5, 5); const p2 = new point(10, 10); p1.distance; //undefined p2.distance; //undefined console.log(point.distance(p1, p2)); // 7.0710678118654755 binding this with prototype and static methods when a static or prototype method is called without a value for this, such as by assigning a variable to the method and then calling it, the this value will be undefined i
nside the method.
... function animal() { } animal.prototype.speak = function() { return this; } animal.eat = function() { return this; } let obj = new animal(); let speak = obj.speak; speak(); // global object (in non–strict mode) let eat = animal.eat; eat(); // global object (in non-strict mode) instance properties instance properties must be defined i
nside of class methods: class rectangle { constructor(height, width) { this.height = height; this.width = width; } } static (class-side) data properties and prototype data properties must be defined outside of the classbody declaration: rectangle.staticwidth = 20; rectangle.prototype.prototypewidth = 25; field declarations public and private field declarations are an experimental fe...
Warning: Date.prototype.toLocaleFormat is deprecated - JavaScript
the javascript warning "date.prototype.tolocaleformat is deprecated; co
nsider using intl.datetimeformat instead" occurs when the non-standard date.prototype.tolocaleformat method is used.
... message warning: date.prototype.tolocaleformat is deprecated; co
nsider using intl.datetimeformat instead error type warning.
ReferenceError: "x" is not defined - JavaScript
variables defined i
nside a function cannot be accessed from anywhere outside the function, because the variable is defined only in the scope of the function function numbers() { var num1 = 2, num2 = 3; return num1 + num2; } console.log(num1); // referenceerror num1 is not defined.
... however, a function can access all variables and functions defined i
nside the scope in which it is defined.
arguments.callee - JavaScript
it can be used to refer to the currently executing function i
nside the function body of that function.
...1 : factorial(n - 1)*n; }); this has numerous benefits: the function can be called like any other from i
nside your code it does not create a variable in the outer scope (except for ie 8 and below) it has better performance than accessing the arguments object another feature that was deprecated was arguments.callee.caller, or more specifically function.caller.
The arguments object - JavaScript
arguments is an array-like object accessible i
nside functions that contains the values of the arguments passed to that function.
...you can refer to a function's arguments i
nside that function by using its arguments object.
Array.prototype.find() - JavaScript
thisarg optional object to use as this i
nside callback.
... if a thisarg parameter is provided to find, it will be used as the this value i
nside each invocation of the callback.
Array.prototype.includes() - JavaScript
values of zero are all co
nsidered to be equal, regardless of sign.
... (that is, -0 is co
nsidered to be equal to both 0 and +0), but false is not co
nsidered to be the same as 0.
Function.prototype.apply() - JavaScript
so you end up with an array i
nside an array.
...for alternative methods, please co
nsider one of the following approaches: using object.__proto__: function.prototype.construct = function (aargs) { let onew = {}; onew.__proto__ = this.prototype; this.apply(onew, aargs); return onew; }; using closures: function.prototype.construct = function(aargs) { let fconstructor = this, fnewconstr = function() { fconstructor.apply(this, aargs); }; fnewconstr.prototype = fco...
Object.defineProperty() - JavaScript
inherited properties will be co
nsidered as well.
... adding properties and default values it is important to co
nsider the way default values of attributes are applied.
Promise.prototype.catch() - JavaScript
this is co
nsidered 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.
..." }).then(function(){ console.log('after a catch the chain is restored'); }, function () { console.log('not fired due to the catch'); }); gotchas when throwing errors // throwing an error will call the catch method most of the time var p1 = new promise(function(resolve, reject) { throw new error('uh-oh!'); }); p1.catch(function(e) { console.error(e); // "uh-oh!" }); // errors thrown i
nside asynchronous functions will act like uncaught errors var p2 = new promise(function(resolve, reject) { settimeout(function() { throw new error('uncaught exception!'); }, 1000); }); p2.catch(function(e) { console.error(e); // this is never called }); // errors thrown after resolve is called will be silenced var p3 = new promise(function(resolve, reject) { resolve(); throw new error...
WebAssembly.Global - JavaScript
global.prototype.value the value contained i
nside the global variable — this can be used to directly set and get the global's value.
... instance methods global.prototype.valueof() old-style method that returns the value contained i
nside the global variable.
WebAssembly.Module.customSections() - JavaScript
syntax webassembly.module.customsections(module, sectionname); parameters module the webassembly.module object whose custom sections are being co
nsidered.
...(read high level structure for information on section structures, and how normal sections ("known sections") and custom sections are distinguished.) this provides developers with a way to include custom data i
nside wasm modules for other purposes, for example the name custom section, which allows developers to provide names for all the functions and locals in the module (like "symbols" in a native build).
WebAssembly.Table() constructor - JavaScript
webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored i
nside it (e.g.
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable i
nside the wasm instance too.
WebAssembly.Table.prototype.set() - JavaScript
the table, both of which print out a simple value): webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored i
nside it (e.g.
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable i
nside the wasm instance too.
WebAssembly.Table - JavaScript
webassembly.instantiatestreaming(fetch('table2.wasm'), importobject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); console.log(tbl.get(1)()); }); note how you've got to include a second function invocation operator at the end of the accessor to actually invoke the referenced function and log the value stored i
nside it (e.g.
... this example shows that we're creating and accessing the table from javascript, but the same table is visible and callable i
nside the wasm instance too.
Lexical grammar - JavaScript
only the following unicode code points are treated as line terminators in ecmascript, other line breaking characters are treated as white space (for example, next line, nel, u+0085 is co
nsidered as white space).
...ead so it should be used with caution: function comment(x) { console.log('hello ' + x /* insert the value of x */ + ' !'); } comment('world'); in addition, you can use it to disable code to prevent it from running, by wrapping code in a comment, like this: function comment() { /* console.log('hello world!'); */ } comment(); in this case, the console.log() call is never issued, since it's i
nside a comment.
Destructuring assignment - JavaScript
uring an array, you can unpack and assign the remaining part of it to a variable using the rest pattern: const [a, ...b] = [1, 2, 3]; console.log(a); // 1 console.log(b); // [2, 3] be aware that a syntaxerror will be thrown if a trailing comma is used on the left-hand side with a rest element: const [a, ...b,] = [1, 2, 3]; // syntaxerror: rest element may not have a trailing comma // always co
nsider using rest operator as the last element unpacking values from a regular expression match when the regular expression exec() method finds a match, it returns an array containing first the entire matched portion of the string and then the portions of the string that matched each parenthesized group in the regular expression.
... {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is co
nsidered a block and not an object literal.
Logical OR (||) - JavaScript
even though the || operator can be used with operands that are not boolean values, it can still be co
nsidered a boolean operator since its return value can always be converted to a boolean primitive.
...if you only need to filter out null or undefined, co
nsider using the nullish coalescing operator.
Nullish coalescing operator (??) - JavaScript
in other words, if you use || to provide some default value to another variable foo, you may encounter unexpected behaviors if you co
nsider some falsy values as usable (eg.
...this behavior may cause unexpected consequences if you co
nsider 0, '', or nan as valid values.
Object initializer - JavaScript
examples creating objects an empty object with no properties can be created like this: let object = {} however, the advantage of the literal or initializer notation is, that you are able to quickly create objects with properties i
nside the curly braces.
... let a = {x: 1, x: 2} console.log(a) // {x: 2} in ecmascript 5 strict mode code, duplicate property names were co
nsidered a syntaxerror.
Strict equality (===) - JavaScript
unlike the equality operator, the strict equality operator always co
nsiders operands of different types to be different.
...+0 and -0 are co
nsidered to be the same value.
Strict inequality (!==) - JavaScript
unlike the inequality operator, the strict inequality operator always co
nsiders operands of different types to be different.
... like the strict equality operator, the strict inequality operator will always co
nsider operands of different types to be different: 3 !== "3"; // true examples comparing operands of the same type console.log("hello" !== "hello"); // false console.log("hello" !== "hola"); // true console.log(3 !== 3); // false console.log(3 !== 4); // true console.log(true !== true); // false console.log(true !== false); // true console.log(nu...
Function expression - JavaScript
the function keyword can be used to define a function i
nside an expression.
...nothoisted(); // typeerror: nothoisted is not a function var nothoisted = function() { console.log('bar'); }; named function expression if you want to refer to the current function i
nside the function body, you need to create a named function expression.
block - JavaScript
in non-strict code, function declarations i
nside blocks behave strangely.
... in strict mode, starting with es2015, functions i
nside blocks are scoped to that block.
if...else - JavaScript
syntax if (condition) statement1 [else statement2] condition an expression that is co
nsidered to be either truthy or falsy.
...any value that is not false, undefined, null, 0, -0, nan, or the empty string (""), and any object, including a boolean object whose value is false, is co
nsidered truthy when used as the condition.
with - JavaScript
co
nsider this example: function f(foo, values) { with (foo) { console.log(values); } } if you call f([1,2,3], obj) in an ecmascript 5 environment, then the values reference i
nside the with statement will resolve to obj.
...so, in a javascript environment that supports ecmascript 2015, the values reference i
nside the with statement could resolve to [1,2,3].values.
JavaScript shells - JavaScript
es6console.com - an open-source javascript console to test ecmascript 2015 code i
nside the browser.
... mozrepl - connect to firefox and other mozilla apps, explore and modify them from the i
nside, while they're running.
MathML element reference - MathML
if you want to learn more about content markup you should co
nsider chapter 4 in the mathml 3 specification.
...rscript) p <mpadded> (space around content) <mphantom> (invisible content with reserved space) r <mroot> (radical with specified index) <mrow> (grouped sub-expressions) s <ms> (string literal) <mscarries> (annotations such as carries) <mscarry> (single carry, child element of <mscarries>) <msgroup> (grouped rows of <mstack> and <mlongdiv> elements) <msline> (horizontal lines i
nside <mstack> elements) <mspace> (space) <msqrt> (square root without an index) <msrow> (rows in <mstack> elements) <mstack> (stacked alignment) <mstyle> (style change) <msub> (subscript) <msup> (superscript) <msubsup> (subscript-superscript pair) t <mtable> (table or matrix) <mtd> (cell in a table or a matrix) <mtext> (text) <mtr> (row in a table or a matrix) u <munder> (undersc...
MathML documentation index - MathML
12 <menclose> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <menclose> element renders its content i
nside an enclosing notation specified by the notation attribute.
...i
nside a <mtable> only <mtr> and <mtd> elements may appear.
The "codecs" parameter in common media types - Web media technologies
f a one-digit flag indicating whether the color should be allowed to use the full range of possible values (1), or should be constrained to those values co
nsidered legal for the specified color configuration (that is, the studio swing representation).
...all cbp streams are co
nsidered to also be bp streams.
Populating the page: how browsers work - Web Performance
for the most part, browsers are co
nsidered single threaded.
...in this phase, taking the viewport size into co
nsideration, the browser determines what the dimensions of all the different boxes are going to be on the screen.
Understanding latency - Web Performance
latency is generally co
nsidered to be the amount of time it takes from when a request is made by the user to the time it takes for the response to get back to that user.
... when a request is in a queue, waiting for a network connection it is co
nsidered blocked.
Add to Home screen - Progressive web apps (PWAs)
you'll see fox pictures, but more important, you'll see a "home" icon with a plus (+) icon i
nside it — this is the "add to home screen" icon displayed for any site that has the necessary features in place.
... manifest the web manifest is written in standard json format and should be placed somewhere i
nside your app directory (in the root is probably best) with the name somefilename.webmanifest (we've chosen manifest.webmanifest).
Introduction to progressive web apps - Progressive web apps (PWAs)
an app could be co
nsidered a pwa when it meets certain requirements, or implements a set of given features: works offline, is installable, is easy to synchronize, can send push notifications, etc.
... modern web apps can have this native app feel via properties set i
nside the web app manifest, and via a feature available in modern smartphone browsers called web app installation.
clip-rule - SVG: Scalable Vector Graphics
/> </g> as a presentation attribute, it also can be used as a property directly i
nside a css stylesheet usage context categories presentation attribute value nonzero | evenodd | inherit animatable yes normative document svg 1.1 (2nd edition) nonzero see description of fill-rule property.
...venodd" /> </clippath> <rect clip-path="url(#emptystar)" width="50" height="90" fill="blue" /> <!-- right: nonzero --> <clippath id="filledstar"> <use xlink:href="#star" clip-rule="nonzero" /> </clippath> <rect clip-path="url(#filledstar)" width="50" height="90" x="50" fill="red" /> </svg> elements the following elements can use the clip-rule attribute, but only if they are i
nside a <clippath> element.
d - SVG: Scalable Vector Graphics
all subsequent sets of parameters are co
nsidered implicit absolute arc curve (a) commands.
...all subsequent sets of parameters are co
nsidered implicit relative arc curve (a) commands.
rx - SVG: Scalable Vector Graphics
the way the value of the rx attribute is interpreted depend on both the ry attribute and the width of the rectangle: if a properly specified value is provided for rx but not for ry (or the opposite), then the browser will co
nsider the missing value equal to the defined one.
... if rx is greater than half of the width of the rectangle, then the browser will co
nsider the value for rx as half of the width of the rectangle.
ry - SVG: Scalable Vector Graphics
the way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle: if a properly specified value is provided for ry but not for rx (or the opposite), then the browser will co
nsider the missing value equal to the defined one.
... if ry is greater than half of the width of the rectangle, then the browser will co
nsider the value for ry as half of the width of the rectangle.
xlink:href - SVG: Scalable Vector Graphics
if the reference is to a <glyph> element and that glyph is available, then that glyph is rendered instead of the characters that are i
nside 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 characters that are i
nside of the <altglyph> element.
xml:space - SVG: Scalable Vector Graphics
svg supports the built-in xml xml:space attribute to handle whitespace characters i
nside elements.
... child elements i
nside an element may also have an xml:space attribute that overrides the parentʼs one.
<altGlyph> - SVG: Scalable Vector Graphics
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 i
nside 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 i
nside of the <altglyph> element.
<defs> - SVG: Scalable Vector Graphics
objects created i
nside a <defs> element are not rendered directly.
... graphical objects can be referenced from anywhere, however, defining these objects i
nside of a <defs> element promotes understandability of the svg content and is beneficial to the overall accessibility of the document.
<svg> - SVG: Scalable Vector Graphics
it is used as the outermost element of svg documents, but it can also be used to embed an svg fragment i
nside an svg or html document.
...it is unnecessary for inner svg elements or i
nside html documents.
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
t with no position at (0, 0) implementation status unknown defer keyword removed from preserveaspectratio attribute removed (bug 1280425) added non-scaling-size, non-rotation and fixed-position keywords for vector-effect property not implemented yet (bug 1318208) vector-effect has no effect within 3d rendering context implementation status unknown co
nsider clip and overflow on svg document referenced by <image> implementation status unknown paths change notes b and b path commands implementation status unknown z and z path commands to add path coordinate data to previous command implementation status unknown not render <path>, <polygon> and <polyline> with no data implementation statu...
...edpoints as alias of svganimatedpoints.points implementation status unknown auto behavior for rx and ry in <ellipse> implementation status unknown text change notes text-decoration-fill and text-decoration-stroke properties not implemented yet (bug 1303569) inline-size attribute for <text> implementation status unknown shape-i
nside property inplementation status unknown shape-subtract property inplementation status unknown white-space implementation status unknown deprecated xml:space attribute implementation status unknown kerning property removed implementation status unknown path attribute for <textpath> implemented (bug 1446617) reference basic sha...
Positions - SVG: Scalable Vector Graphics
that is, the top left corner of the document is co
nsidered to be the point (0,0), or point of origin.
...however, this is the same way elements in html are positioned (by default, ltr documents are co
nsidered not the rtl documents which position x from right-to-left).
choose - XPath
object1 the first object to co
nsider returning.
... object2 the second object to co
nsider returning.
Introduction to using XPath in JavaScript - XPath
xmldoc.documentelement : xmldoc.ownerdocument.documentelement); var personiterator = xmldoc.evaluate('//person', xmldoc, nsresolver, xpathresult.any_type, null ); note when the xpathresult object is not defined, the constants can be retrieved in privileged code using components.interfaces.
nsidomxpathresult.any_type (ci.
nsidomxpathresult).
... similarly, an xpathevaluator can be created using: components.classes["@mozilla.org/dom/xpath-evaluator;1"].createinstance(components.interfaces.
nsidomxpathevaluator) appendix implementing a user defined namespace resolver this is an example for illustration only.
Compiling a New C/C++ Module to WebAssembly - WebAssembly
copy it into a sub-directory called html_template i
nside your previous new directory.
...from i
nside your latest directory (and while i
nside your emscripten compiler environment terminal window), compile your c code with the following command.
WebAssembly Concepts - WebAssembly
this article explains the concepts behind how webassembly works including its goals, the problems it solves, and how it runs i
nside the web browser's rendering engine.
... webassembly goals webassembly is being created as an open standard i
nside the w3c webassembly community group with the following goals: be fast, efficient, and portable — webassembly code can be executed at near-native speed across different platforms by taking advantage of common hardware capabilities.
Exported WebAssembly functions - WebAssembly
when you call them, you get some activity in the background to convert the arguments into types that wasm can work with (for example converting javascript numbers to int32), the arguments are passed to the function i
nside your wasm module, the function is invoked, and the result is converted and passed back to javascript.
...this may well change in the future though — a new int64 type is being co
nsidered for future standards, which could then be used by wasm.
Content Scripts - Archive of obsolete content
for example, co
nsider a page that adds a variable foo to the window object using a page script: <!doctype html"> <html> <head> <script> window.foo = "hello from page script" </script> </head> </html> another script loaded into the page after this script will be able to access foo.
hotkeys - Archive of obsolete content
no matter what you choose, it's likely to annoy some people, and to clash with some other add-on, so co
nsider making the combination you choose user-configurable.
page-mod - Archive of obsolete content
"top": the page-mod will be applied to top-level tab documents "frame": the page-mod will be applied to all iframes i
nside tab documents if the option is set at all, you must set at least one of "top" and "frame".
tabs - Archive of obsolete content
note that by attaching i
nside ready event, this becomes tab-centric: if the user navigates to a new page in the same tab, then the content scripts will be reattached to the new page.
dev/panel - Archive of obsolete content
ceiving messages from the panel document pass the other messageport to the panel document in the ports argument to postmessage // main.js // require the sdk modules const { panel } = require("dev/panel"); const { tool } = require("dev/toolbox"); const { class } = require("sdk/core/heritage"); const { messagechannel } = require("sdk/messaging"); const channel = new messagechannel(); const addo
nside = channel.port1; const panelside = channel.port2; // messages from the panel arrive here addo
nside.onmessage = function(event) { console.log(event.data); } const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devtool's panel", icon: "./my-icon.png", url: "./my-panel.html", onready: function() { // send a port to the panel document this.postmessage("...
lang/functional - Archive of obsolete content
env); return 1; // assume success and return 1 }); setup('dev'); // returns 1 // prints "successfully initialized dev" // future attempts to call this function just return the cached // value that was returned previously setup('production'); // returns 1 // no print message is displayed since the function isn't executed parameters fn : function the function that will be executed only once i
nside the once wrapper.
net/xhr - Archive of obsolete content
finally, we need to also co
nsider attenuating http/https requests such that they're "sandboxed" and don't communicate potentially sensitive cookie information.
cfx to jpm - Archive of obsolete content
requiring modules from test code similarly, suppose you've written some tests for your add-on: my-addon lib my-addon.js test test-my-addon-js with cfx, code i
nside "test-my-addon.js" can import "my-addon.js" using a statement like this: var my_addon = require("my-addon"); // this will not work with jpm!
jpm - Archive of obsolete content
under the hood, jpm sign creates an unlisted add-on i
nside addons.mozilla.org, which means you must distribute the xpi file yourself for your users to install it.
Logging - Archive of obsolete content
the following add-on logs the html content of every tab the user loads, by calling console.log() i
nside a content script: require("sdk/tabs").on("ready", function(tab) { tab.attach({ contentscript: "console.log(document.body.innerhtml);" }); }); console output if you are running your add-on from the command line (for example, executing jpm run or jpm test) then the console's messages appear in the command shell you used.
Localization - Archive of obsolete content
to reference localized strings from html, add a data-l10n-id attribute to the html tag where you want the localized string to appear, and assign the identifier to it: <html> <body> <h1 data-l10n-id="hello_id"></h1> </body> </html> then you can use this html file to build your interface, for example i
nside a panel: var button = require("sdk/ui/button/action").actionbutton({ id: "localized-hello", label: "localized hello", icon: "./icon-16.png", onclick: function() { hello.show(); } }); var hello = require("sdk/panel").panel({ height: 75, width: 150, contenturl: require("sdk/self").data.url("my-panel.html") }); given locale files for "en-us" and "fr" which provide translation...
Boxes - Archive of obsolete content
this keeps the image from stretching i
nside the box: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box align="start" style="display:block"> <image src="chrome://global/skin/icons/error.png" style="padding:5px"/> <textbox /> <image src="chrome://global/skin/icons/error.png" style="padding:5px"/> <button label="h...
HTML to DOM - Archive of obsolete content
quest.send(null); our next step is to create the document object that will represent the dom into which we'll insert our newly-retrieved html: var doc = document.implementation.createhtmldocument("example"); doc.documentelement.innerhtml = request.responsetext; after this any manipulation that we might want to do will be something as simple as the following: doc.body.textcontent = "this is i
nside the body!"; using a hidden iframe element to parse html to a window's dom sample code may need more work.
Sidebar - Archive of obsolete content
resizing the sidebar programmatically in case you need to change the width of the sidebar, use the following code: function setsidebarwidth(newwidth) { var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.
nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindow); mainwindow.document.getelementbyid("sidebar-box").width=newwidth; } or function setsidebarwidth(newwidth) { window.top.document.getelementbyid("sidebar-box").width=newwidth; } you can also disable the ability to resize it manually, using the mous...
Interaction between privileged and non-privileged pages - Archive of obsolete content
var mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.
nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindow); mainwindow.document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); if you need to to pass lots of data, co
nsider using cdata sections instead of the simp...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
listing 5: closing all browser windows var browsers = windowmediator.getenumerator('navigator:browser'); var browser; while (browsers.hasmoreelements()) { browser = browsers.getnext().queryinterface(components.interfaces.
nsidomwindowinternal); browser.browsertrytoclosewindow(); } this method returns an overview of the specified window type in the form of an iterator pattern object called nsisimpleenumerator.
Connecting to Remote Content - Archive of obsolete content
let domparser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.
nsidomparser); let filestream = components.classes["@mozilla.org/network/file-input-stream;1"] .createinstance(components.interfaces.nsifileinputstream); let xsltprocessor = components.classes["@mozilla.org/document-transformer;1?type=xslt"] .createinstance(components.interfaces.nsixsltprocessor); let xsldocument; filestream.init(somexslfile, -1, 0x01, 0444); // read o...
Firefox addons developer guide - Archive of obsolete content
todo: all fixme notes i
nside the documents; add abbreviation definition to acronyms; add some link to the internal mdc documentation when it makes sense; indent source code; make sure documentation is relevant for all platforms: gnu/linux, macos, windows; add anchor links to figures & listings; add credits to original authors and license; completed sometimes, interfaces names are misspelled: s/nsl/nsi; talk about fu...
DOMSubtreeModified - Archive of obsolete content
this event has been deprecated in favor of the mutation observer api this event can cause infinite loops if you decide to change the dom i
nside the event handler, hence it has been disabled in a number of browsers (see domattrmodified and domsubtreemodified events are no longer fired when style attribute is changed via cssom for example).
Notes on HTML Reflow - Archive of obsolete content
the xul box layout model, on the other hand, is constraint based , meaning that geometric preferences and constraints of neighboring elements are taken into co
nsideration before the elements' final geometry can be computed.
Misc top level - Archive of obsolete content
back in the early days, this approach worked, because browsers would usually make a table cell exactly as wide and tall as an image it contained.no proxy for configurationthis document provides a comprehensive discussion of the manual proxy feature "no proxy for:", including configuration issues, testing and bugs.same-origin policy for file: urisin gecko 1.8 or earlier, any two file: uris are co
nsidered to be same-origin.
Automatically Handle Failed Asserts in Debug Builds - Archive of obsolete content
as an example, co
nsider the following failed assertion: assertion: no document: 'mdocument != nsnull', file d:/cvs-1.11.4/mozilla/content/xul/content/src/nsxulelement.cpp, line 3173 (note that i have my source tree in d:/cvs-1.11.4/mozilla) if you have a dword in hkcu\software\mozilla.org\windbgdlg\ named "d:/cvs-1.11.5/mozilla/content/xul/content/src/nsxulelement.cpp," (with the comma - matches are whole-word only) a...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
(nsiwindowcreator.ns_iwindowcreator_iid); // get the window watcher service nsiwindowwatcher windowwatcher = (nsiwindowwatcher)servicemanager.getservicebycontractid("@mozilla.org/embedcomp/window-watcher;1", nsiwindowwatcher.ns_iwindowwatcher_iid); // set the window creator (from step 6) windowwatcher.setwindowcreator(windowcreator); // create the root xul window:
nsidomwindow win = windowwatcher.openwindow(null, "chrome://your-app/content/window.xul", "mywindow", "chrome,resizable,centerscreen", null); // set this as the active window windowwatcher.setactivewindow(win); // hand over the application to xpcom/xul, this will block: appstartup.run(); here is an example of a locationprovider that works : public class locationprovider...
Code snippets - Archive of obsolete content
let mainwindow = window.queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsiwebnavigation) .queryinterface(components.interfaces.
nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.
nsidomwindow); // obtain a reference to sync's tabs "engine." let tabsengine = weave.service.enginemanager.get("tabs"); // iterate over each client having data.
Me - Archive of obsolete content
i
nside the function, this is the jetpack's content.function example jetpack.me.onfirstrun(function(){ jetpack.notifications.show("oh boy, i'm installed!");}); ...
jspage - Archive of obsolete content
tend(e,b);hash.extend(e,k.associate(k.map(string.tolowercase)));var a={before:function(m,l){if(l.parentnode){l.parentnode.insertbefore(m,l); }},after:function(m,l){if(!l.parentnode){return;}var n=l.nextsibling;(n)?l.parentnode.insertbefore(m,n):l.parentnode.appendchild(m);},bottom:function(m,l){l.appendchild(m); },top:function(m,l){var n=l.firstchild;(n)?l.insertbefore(m,n):l.appendchild(m);}};a.i
nside=a.bottom;hash.each(a,function(l,m){m=m.capitalize();element.implement("inject"+m,function(n){l(this,document.id(n,true)); return this;});element.implement("grab"+m,function(n){l(document.id(n,true),this);return this;});});element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]); }break;case"string":var l=element.properties.get(o);(l&&l.set)?l.set.apply(...
statusBar - Archive of obsolete content
syntax jetpack.statusbar.append(options); possible options are: url width (string/length) the width of the panel-item html (string) the html code which will be used i
nside the item onload (event) this event fires when the item was appended.
Microsummary topics - Archive of obsolete content
createinstance(components.interfaces.
nsidomparser); var generatordoc = domparser.parsefromstring(generatortext, "text/xml"); var microsummaryservice = components.classes["@mozilla.org/microsummary/service;1"].
New Skin Notes - Archive of obsolete content
just so that (perhaps) this might revive the topic, a side bar shouldn't exceed 16% to allow proper viewing at 800 pixels width ideally in my opinion, i find strange that i'm the only person not too fond of large side bars (or side bars at all, for that matter :) co
nsidering that in most articles we scroll down to read the text, and that the side bar scrolls as well, the links aren't there anymore, but the width remains wasted anyway.
RDF Datasource How-To - Archive of obsolete content
an "address book" datasource could translate a database file into statements like "spammer128@hotmail.com's real name is 'billy dumple'" and "spammer128@hotmail.com is co
nsidered an 'important friend'." statements from one datasource can be combined with statements from another datasource using a composite datasource.
Same origin policy for XBL - Archive of obsolete content
for the
nsidomdocumentxbl interface's
nsidomdocumentxbl.addbinding() and
nsidomdocumentxbl.loadbindingdocument() methods, the originating principal is the one of the script making the call, or the principal of the document the call is made on if there isn't a script.
Space Manager High Level Design - Archive of obsolete content
the classes that are co
nsidered part of the space manager are: nsspacemanager nsbanddata nsblockbanddata bandrect / bandlist (private structs) frameinfo (private struct) nsbandtrapezoid outside of the space manager itself, the clients of the space manager also play an important part in the management of he available and used space.
Tamarin Build System Documentation - Archive of obsolete content
tamarin-redux mercurial builds are displayed in the top 3 sections: compile, smoke, test sandbox builds are displayed in next 3 sections: sandbox compile, sandbox smoke, sandbox test tamarin-central is co
nsidered a "sandbox" and will appear under sandbox phase what are the build phases?
Treehydra Manual - Archive of obsolete content
for example, if the current abstract value of a variable x is nonzero, and the analysis goes i
nside an if statement with the condition x == 1, then in the new abstract value of x will be nonzero meet 1.
XBL 1.0 Reference - Archive of obsolete content
bindings binding content children implementation constructor destructor field property getter setter method parameter body handlers handler resources stylesheet image binding attachment and detachment attachment using css attachment using element.style property <constructor> call <destructor> call binding documents dom interfaces the
nsidomdocumentxbl interface anonymous content introduction scoping and access using the dom content generation rules for generation attribute forwarding insertion points <children> handling dom changes event flow and targeting flow and targeting across scopes focus and blur events mouseover and mouseout events anonymous content and css selecto...
Using XPInstall to Install Plugins - Archive of obsolete content
using xpinstall to run an exe (native code) installer if you wish to run a native installer (exe) to install plugin software, but wish to make the delivery of this native installer streamlined and within the browser's process, then you ought to co
nsider wrapping it in an xpi package.
addDirectory - Archive of obsolete content
a relative pathname is appended to the registry name of the package as specified by the package parameter to the initinstall method.this parameter can also be null, in which case the xpisourcepath parameter is used as a relative pathname.note that the registry pathname is not the location of the software on the computer; it is the location of information about the software i
nside the client version registry.
toolboxid - Archive of obsolete content
this will either be the toolbox's parent (if it's in a toolbox), or, if the toolbar is an external toolbar (that is, one not contained in a toolbox), the id of the toolbox it should be co
nsidered to be part of.
Additional Navigation - Archive of obsolete content
retrieving parents a very uncommon form of navigation you can also do is to navigate upwards using a member tag, that is to get all the parents of a node, as in this example: <query> <content uri="?start"/> <member container="?parent" child="?start"/> </query> this might be used, for instance, to start at a particular photo and find all of the containers that it is i
nside.
Namespaces - Archive of obsolete content
"ferdinand magellan" gender="male"/> <person name="laura secord" gender="female"/> </people> <listbox datasources="people.xml" ref="*" querytype="xml"> <template xmlns:ns="www.example.com/people"> <query expr="ns:person"/> <action> <listitem uri="?" label="?ns:name"/> </action> </template> </listbox> once added to the template element the namespaces can then be referenced i
nside temple rule elements too, this works both in rdf and xml templates.
RDF Modifications - Archive of obsolete content
co
nsider the following binding: <binding subject="?start" predicate="http://www.xulplanet.com/rdf/categoryname" object="?name"/> this binding involves a triple pointing out from the starting variable that has been used in these examples.
Recursive Generation - Archive of obsolete content
however, for item c, the triple does match an item, so the data will be added to the potential result: (?start = http://www.xulplanet.com/rdf/c, ?relateditem = http://www.xulplanet.com/rdf/d) a match has occured, so the content within the action body will be created and added i
nside item c.
Writing Skinnable XUL and CSS - Archive of obsolete content
skin files that don't import any other skin files, but that are only intended to be used in the context of another component's skin are also co
nsidered derived skin files, since they are implicitly importing information from the other component's skin.
XUL Event Propagation - Archive of obsolete content
the widget hierarchy co
nsider the following xul file: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="events" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" oncommand="alert('window handler')"> <vbox> <vbox style="background-color: lightgrey;" oncommand="alert('box handler')"> <menu class="menu" la...
conditions - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] this element should appear directly i
nside a rule element and is used to define conditions for the rule.
datepicker - Archive of obsolete content
s(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related interfaces
nsidomxulcontrolelement ...
editor - Archive of obsolete content
contentwindow type: todo use the contentwindow.wrappedjsobject to obtain a dom(html) window object docshell type:
nsidocshell this read-only property contains the
nsidocshell object for the document.
grippy - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] an element that may be used i
nside a splitter which can be used to collapse a sibling element of the splitter.
radio - Archive of obsolete content
samenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related elements radiogroup, checkbox interfaces nsiaccessibleprovider,
nsidomxulselectcontrolitemelement,
nsidomxullabeledcontrolelement ...
richlistitem - Archive of obsolete content
defaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related interfaces nsiaccessibleprovider,
nsidomxulselectcontrolitemelement ...
script - Archive of obsolete content
you should usually put scripts in a separate file pointed to by the src attribute, but you may also place the script inline i
nside the opening and closing script tags.
stack - Archive of obsolete content
in some case, setting the width or height this way may even be necessary because using the width/height attributes (eg, "width", "minwidth" and "maxwidth") i
nside a stack can sometimes produce unpredictable and undesireable results.
timepicker - Archive of obsolete content
(), insertbefore(), isdefaultnamespace(), isequalnode, issamenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata related interfaces
nsidomxulcontrolelement ...
CSS - Archive of obsolete content
stereo output produce a lateral sound stage, while binaural headphones and multi-speaker setups allow for a fully three-dimensional stage.display-i
nsidethe display-i
nside css property specifies the inner display type of the box generated by an element, dictating how its contents lay out i
nside the box.display-outsidethe display-outside css property specifies the outer display type of the box generated by an element, dictating how the element participates in its parent formatting context.
E4X for templating - Archive of obsolete content
a</label> )} note that the simple xmllist() constructor (<></>) may be useful to still be able to use an expression closure (i.e., without needing return statements and braces): {_if(elems.length(), function () <> <markup/> <markup/> </>)} note that, while it is convenient to store such e4x in separate file templates (to be eval()d at a later time, taking into account security co
nsiderations, such as escaping with the above), e4x content using such functions can also be easily serialized inline (and then perhaps converted to the dom) as needed: var list = <>{_if(elems.length(), function () <> <markup/> <markup/> </>)}</>.toxmlstring(); iterating functions such as the following foreach (which can work with arrays, objects, or e4x objects) are quite convenient ...
Popup Window Controls - Archive of obsolete content
replacements for popup windows if your popup was created during the time the web page was loading, you may co
nsider using document.write() to emit appropriate html which will contain the same information as the popup window.
Game promotion - Game development
you can also sell a full version of the game from i
nside your browser demo version, which will be a great move co
nsidering high competition, some developers even manage to make full browser versions.
Desktop gamepad controls - Game development
next, we'll co
nsider the gamepadbuttonpressedhandler() function: function gamepadbuttonpressedhandler(button) { var press = false; for(var i=0; i<buttonspressed.length; i++) { if(buttonspressed[i] == button) { press = true; } } return press; } the function takes a button as a parameter; in the loop it checks if the given button's number is among the currently pressed bu...
Square tilemaps implementation: Static maps - Game development
we need to supply the atlas image, the coordinates and dimensions of the tile i
nside the atlas, and the target coordinates and size (a different tile size in here would scale the tile.) so, for instance, to draw the tree tile, which is the third in the atlas, at the screen coordinates (128, 320), we would call drawimage() with these values: context.drawimage(atlasimage, 192, 0, 64, 64, 128, 320, 64, 64); in order to support atlases with multiple rows and columns, you would ne...
Tiles and tilemaps overview - Game development
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 i
nside the game logic (for example creating a path-finding graph, or handling collisions) or to create a level editor.
Bounce off the walls - Game development
add this to your code, somewhere below the existing variable declarations: var ballradius = 10; now update the line that draws the ball i
nside the drawball() function to this: ctx.arc(x, y, ballradius, 0, math.pi*2); bouncing off the top and bottom there are four walls to bounce the ball off — let's focus on the top one first.
Finishing up - Game development
rendering the lives display now you need to add a call to drawlives() i
nside the draw() function and add it below the drawscore() call.
Track the score and win - Game development
= bricks[c][r]; if(b.status == 1) { if(x > b.x && x < b.x+brickwidth && y > b.y && y < b.y+brickheight) { dy = -dy; b.status = 0; score++; } } } } } calling drawscore() from the draw() function keeps the score up to date with every new frame — add the following line i
nside draw(), just below the drawpaddle() call: drawscore(); displaying a winning message when all bricks have been destroyed collecting the points works well, but you won't be adding them forever — what about when all the bricks have been destroyed?
Bounce off the walls - Game development
add the following line below the previous one: ball.body.bounce.set(1); try reloading index.html again — now you should see the ball bouncing off all the walls and moving i
nside the canvas area.
Extra lives - Game development
add the following lines below the existing scoretext definition i
nside your create() function: livestext = game.add.text(game.world.width-5, 5, 'lives: '+lives, { font: '18px arial', fill: '#0095dd' }); livestext.anchor.set(1,0); lifelosttext = game.add.text(game.world.width*0.5, game.world.height*0.5, 'life lost, click to continue', { font: '18px arial', fill: '#0095dd' }); lifelosttext.anchor.set(0.5); lifelosttext.visible = false; the livestext and lifelostte...
Game over - Game development
add the code below i
nside the create() function; just after you define the ball's attributes is fine: game.physics.arcade.checkcollision.down = false; this will make the three walls (top, left and right) bounce the ball back, but the fourth (bottom) will disappear, letting the ball fall off the screen if the paddle misses it.
Physics - Game development
add the physics.startsystem() method at the beginning of the create function (make it the first line i
nside the function), as shown below: game.physics.startsystem(phaser.physics.arcade); next, we need to enable our ball for the physics system — phaser object physics is not enabled by default.
Player paddle and controls - Game development
rendering the paddle, with physics next up, we will init our paddle by adding the following add.sprite() call i
nside the create() function — add it right at the bottom: paddle = game.add.sprite(game.world.width*0.5, game.world.height-5, 'paddle'); we can use the world.width and world.height values to position the paddle exactly where we want it: game.world.width*0.5 will be right in the middle of the screen.
Scaling - Game development
resize — creates the canvas with the same size as the available width and height, so you have to place the objects i
nside your game dynamically; this is more of an advanced mode.
Plug-in Development Overview - Gecko Plugin API Reference
co
nsider the following example, where a media player plug-in can be controlled with an advancetonextsong() method called i
nside the script element: <object id="myplugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var theplugin = document.getelementbyid('myplugin'); if (theplugin && theplugin.advancetonextsong) theplugin.advancetonextsong(); el...
Selector (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
co
nsider this css: p { color: green; } div.warning { width: 100%; border: 2px solid yellow; color: white; background-color: darkred; padding: 0.8em 0.8em 0.6em; } #customized { font: 16px lucida grande, arial, helvetica, sans-serif; } the selectors here are "p" (which applies the color green to the text i
nside any <p> element), "div.warning" (which makes any <div> element with the class "warning" look like a warning box), and "#customized", which sets the base font of the element with the id "customized" to 16-pixel tall lucida grande or one of a few fallback fonts.
Cryptographic hash function - MDN Web Docs Glossary: Definitions of Web-related terms
equently) not invertible (each digest could come from a very large number of messages, and only brute-force can generate a message that leads to a given digest) tamper-resistant (any change to a message leads to a different digest) collision-resistant (it should be impossible to find two different messages that produce the same digest) cryptographic hash functions such as md5 and sha-1 are co
nsidered broken, as attacks have been found that significantly reduce their collision resistance.
Distributed Denial of Service - MDN Web Docs Glossary: Definitions of Web-related terms
the united states computer emergency readiness team (us-cert) defines symptoms of denial-of-service attacks to include: unusually slow network performance (opening files or accessing websites) unavailability of a particular website inability to access any website dramatic increase in the number of spam emails received—(this type of dos attack is co
nsidered an email bomb) disconnection of a wireless or wired internet connection longterm denial of access to the web or any internet services learn more general knowledge denial-of-service attack on wikipedia ...
Function - MDN Web Docs Glossary: Definitions of Web-related terms
a named function is a function with a function name: // function declaration function foo() {}; // named function expression (function bar() {}); // or using the ecmascript 2015 arrow notation const foo = () => {}; an inner function is a function i
nside another function (square in this case).
Localization - MDN Web Docs Glossary: Definitions of Web-related terms
the following are common factors to co
nsider: language unit of measure (e.g., kilometers in europe, miles in u.s.) text direction (e.g., european languages are left-to-right, arabic right-to-left) capitalization in latin script (e.g., english uses capitals for weekdays, spanish uses lowercase) adaptation of idioms (e.g., "raining cats and dogs" makes no sense when translated literally) use of register (e.g., in japanese respectful speech differs exceptionally from casual speech) number format (e.g., 10 000,00 in germany vs.
Scope - MDN Web Docs Glossary: Definitions of Web-related terms
for instance, the following is invalid: function examplefunction() { var x = "declared i
nside function"; // x can only be used in examplefunction console.log("i
nside function"); console.log(x); } console.log(x); // causes error however, the following code is valid due to the variable being declared outside the function, making it global: var x = "declared outside function"; examplefunction(); function examplefunction() { console.log("i
nside function"); console.log(...
Test your skills: Functions - Learn web development
dom manipulation: co
nsidered useful some of the questions below require you to write some dom manipulation code to complete them — such as creating new html elements, setting their text contents to equal specific string values, and nesting them i
nside existing elements on the page — all via javascript.
JavaScript building blocks - Learn web development
functions allow you to store a piece of code that does a single task i
nside 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.
Web performance resources - Learn web development
<link rel="stylesheet" href="/path/to/my.css" media="print" onload="this.media='all'"> <noscript><link rel="stylesheet" href="/path/to/my.css"></noscript> the dow
nside with this approach is the flash of unstyled text (fout.) the simplist way to address this is by inlining css that is required for any content that is rendered above the fold, or what you see in the browser viewport before scrolling.
What is web performance? - Learn web development
there are a lot of best practices to co
nsider in making apps feel smooth, for example using css animations rather than javascript for animation, and minimizing the number of repaints the ui requires due to changes in the dom.
Server-side website programming - Learn web development
displaying all of these using different static pages would be extremely inefficient, so instead such sites display static templates (built using html, css, and javascript), and then dynamically update the data displayed i
nside those templates when needed, such as when you want to view a different product on amazon.
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
note that here we need this.incomplete.length, not this.todos.incomplete.length, because we are doing this i
nside the service, where the incomplete() getter is available directly (in the template, the contents of the service has been made available as todos via the @service('todo-data') todos; line i
nside the footer class, hence it being this.todos.incomplete.length there).
Git and GitHub - Learn web development
about pull requests (from github) a useful guide to managing pull requests, the way that your suggested code changes are delivered to people's repositories for co
nsideration.
Accessibility Features in Firefox
keyboard support "mozilla firefox is a web-browser with superior keyboard support." alan cantor, cantor access consulting firefox includes keyboard access to all of its amazing features: browse with caret allows users to select arbitrary content with the keyboard and move through content as if i
nside a read-only editor.
Mozilla accessibility architecture
the reason that the doc accessible is not created directly in the widget code where it's needed is that the widget code has no knowledge what
nsidomnode is associated with the current window's document object.
CSUN Firefox Materials
browse with caret allows users to select arbitrary content with the keyboard and move through content as if i
nside a read-only editor.
Mozilla's Section 508 Compliance
er means 2) java and in-page plugins cannot be used with the keyboard, so they must not be installed for keyboard-only users additional features for the keyboard: 1) find as you type allows for quick navigation to links and convenient text searching 2) browse with caret (f7 key toggles) allows users to select arbitrary content with the keyboard and move through content as if i
nside a readonly editor.
ZoomText
these builds are pretty stable co
nsidering they're only alpha, i'm having very good luck with them.
Adding a new CSS property
some common mistakes to watch out for when writing custom parsing code (which might go away if we redesign the parser along the lines described in css3-syntax): make sure to call skipuntil() to look for the matching close parentheses, braces, or brackets whenever you hit an error i
nside of them.
Benchmarking
it also lacks features such as instruction level profiling which can be helpful in low level profiling, or finding the hot loop i
nside a large function, etc.
Chrome registration
also, the path i
nside overridden files is relative to the overridden path, not the original one (this can be annoying and/or useful in css files, for example).
Continuous Integration
perfherder alerts we track changes to talos and other performance frameworks i
nside perfherder, and try to automatically alert when there is a sustained change exceeding a certain magnitude (specified per test).
Creating MozSearch plugins
abquulttbgccagcnnzgabbgamj5thwgvjlaaaaabjru5erkjggg%3d%3d</image> <url type="text/html" method="get" template="http://developer.mozilla.org/en/docs/special:search?search={searchterms}"/> <searchform>http://developer.mozilla.org/en/docs/special:search</searchform> </searchplugin> notice in this case that instead of using <param> to define parameters to the search engine, they're simply embedded i
nside the template url.
Creating Sandboxed HTTP Connections
it would be better to have the entire implementation i
nside a class and storing the channel as a member: function myclass() { this.mchannel = null; // ...
Debugging update problems
that url might look something like: https://aus3.mozilla.org/update/3/firefox/12.0a1/20120106040225/darwin_x86_64-gcc3-u-i386-x86_64-shark/nightly-profiling/darwin%2010.8.0/default/default/update.xml?force=1 you can then request this url manually to see what's i
nside.
Installing headers using EXPORTS
here is an example <tt>makefile.in</tt> which has both c++ and idl headers: module = content xpidl_module = content_base exports = \ nsicontent.h \
nsidocument.h \ nsistylesheet.h \ $(null) xpidlsrcs = \ nsicontentpolicy.idl \ nsiselectioncontroller.idl \ $(null) include $(topsrcdir)/config/rules.mk ...
Old Thunderbird build
closed), you may wish to co
nsider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction).
Simple Instantbird build
if the trunk is broken, you may wish to co
nsider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction).
Gecko Logging
error 1 an error occurred, generally something you would co
nsider asserting in a debug build.
Interface Compatibility
you should strongly co
nsider migrating existing code to use js-ctypes instead of binary components.
Working with Mozilla source code
the firefox codebase: css guidelines this document contains guidelines defining how css i
nside the firefox codebase should be written, it is notably relevant for firefox front-end engineers.
Index
10 firefox ui co
nsiderations for web developers activity stream, firefox, icons, mozilla, new tab, newtab, ui, web, web development, favicon there are a number of places within the firefox user interface where web sites are listed for the user to choose a destination to visit or a site to manage in some way.
Cross Process Object Wrappers
co
nsider this code: mm.addmessagelistener("gotloadevent", function (msg) { mm.sendasyncmessage("changedocumenturi", {newuri: "hello.com"}); let uri = msg.objects.document.documenturi; dump("received load event: " + uri + "\n"); }); this sends a message asking the frame script to change the current document uri, then accesses the current document uri via a cpow.
Frame script environment
the frame script's global is a contentframemessagemanager, giving it the following environment: content the dom window of the content loaded in the browser may be null (see below) docshell the
nsidocshell associated with the browser.
Message manager overview
tab docshell : access the top-level docshell components : access privileged objects and apis addeventlistener() : listen to dom events addmessagelistener() : receive messages from the chrome process sendasyncmessage() : send asynchronous messages to the chrome process sendsyncmessage() : send synchronous messages to the chrome process interfaces
nsidomeventtarget nsimessagelistenermanager nsimessagesender nsisyncmessagesender nsicontentframemessagemanager how to access the content frame message manager is the global object in frame scripts.
Multiprocess Firefox
limitations of frame scripts practices that will not work i
nside frame scripts, and what to do instead.
Firefox
the most useful is the url about:config, which displays preferences and settings that can be inspected and changed.firefox ui co
nsiderations for web developersthere are a number of places within the firefox user interface where web sites are listed for the user to choose a destination to visit or a site to manage in some way.
Using the Browser API
when this fires, we set the value i
nside the url bar input to be equal to the event object detail property — this is so that the url displayed continues to match the website being shown when the user navigates back and forth through the history.
mozbrowseractivitydone
the mozbrowseractivitydone event is fired when something i
nside the browser <iframe> triggers a web activity, and that web activity's message is consumed by the receiving app.
MozBeforePaint
this new property indicates the time, in milliseconds since epoch, at which all animations started in the specified window during the current refresh interval should be co
nsidered to have started running.
Embedding Mozilla
that means you can embed a web browser i
nside a third-party application, open channels and streams through the network backend, walk through the dom and so on.
HTML parser threading
nodes created by tree ops are owned by the parser for the lifetime of the parser, so for refcounting purposes, the parser owns each nsicontent object it creates by one reference no matter how many copies of the content handle for the node exist i
nside the parser.
Script security
i
nside the same compartment, all objects share a global and are therefore same-origin with each other.
IPDL Best Practices
co
nsider the following protocol: async protocol pasyncquerier { child: pasyncquery(); } async protocol pasyncquery { child: kickoffquery(nsstring query); parent: returnresult(nsstring result); __delete__(); } in this situation, there is a guaranteed sequence of messages that will be sent.
IPDL Tutorial
}; virtual pexamplechild* toplevelchild::allocpexample() { refptr<examplechild*> actor = new examplechild(); return actor.forget(); } virtual bool toplevelchild::deallocpexample(pexamplechild* actor) { ns_release(static_cast<examplechild*>(actor)); return true; } if an object that implements a protocol can't be constructed i
nside allocpfoo, has been previously constructed and doesn't require an ipdl connection throughout its lifetime, or implements a refcounted protocol where the first form of constructor is not available, there is a second form of sendpfooconstructor which can be used: class examplechild { public: void dosomething() { amanagerchild->sendpexampleconstructor(this, ...); } }; internally,...
JavaScript Tips
xul tips when inserting code with an xul overlay, wrap functions and variables i
nside an object with a unique name to avoid conflicting with existing or future function and variable names.
Addon
the interface can represent many different kinds of add-ons and as such, some of the methods and properties are co
nsidered "required" and others "optional," which means that the optional methods or property may not exist on addon instances for some types of add-ons.
Add-on Manager
for example: components.utils.import("resource://gre/modules/addonmanager.jsm"); addonmanager.getalladdons(function(aaddons) { // here aaddons is an array of addon objects }); // this code will execute before the code i
nside the callback notifications about changes to installed add-ons are dispatched to any registered addonlisteners.
API-provided widgets
this is only used to display the shortcut as part of the tooltip for builtin widgets (which have strings i
nside customizablewidgets.properties).
Widget Wrappers
this will point to the overflow chevron on overflowable toolbars if and only if your widget node is overflowed, to the anchor for the panel menu if your widget is i
nside the panel menu, and to the node itself in all other cases overflowed boolean indicating whether the node is currently in the overflow panel of the toolbar isgroup false, will be true for the group widget label for api-provided widgets, convenience getter for the label attribute of the dom node tooltiptext for api-provided widgets, convenience gette...
DeferredTask.jsm
this is always true when read from code i
nside the task function, but can also be true when read from external code, in case the task is an asynchronous generator function.
Downloads.jsm
close the message to stop."); } finally { yield list.remove(download); yield download.finalize(true); } } finally { yield list.removeview(view); } }).then(null, components.utils.reporterror); conversion from
nsidownloadmanager starting in firefox for desktop version 26, the
nsidownloadmanager and
nsidownload interfaces are not available anymore.
PopupNotifications.jsm
this anchorid must point to an element contained i
nside the popupnotification object's icon box (for firefox windows, the global popupnotifications object uses the notification-popup-box element).
Promise
for example, the os.file.exists function returns a promise that will eventually fulfill with a boolean: promise<boolean> exists(string path); the rejection reason may be specified separately in the function's documentation, and is co
nsidered to be an error object unless otherwise specified.
Services.jsm
ge service clipboard nsiclipboard clipboard console nsiconsoleservice error console service contentprefs nsicontentprefservice content preferences service cookies nsicookiemanager2 cookie manager 2 service cpmm nsimessagesender child process message manager4 crashmanager crashmanager.jsm dirsvc
nsidirectoryservice nsiproperties directory service domstoragemanager
nsidomstoragemanager dom storage manager domrequest
nsidomrequestservice domrequest service downloads
nsidownloadmanager download manager droppedlinkhandler
nsidroppedlinkhandler dropped link handler service els nsieventlistenerservice event listener s...
Bootstrapping a new locale
navigate to that level making sure you are *not* i
nside mozilla-1.9.x/ and then run the following commands.
Localizing XLIFF files for iOS
here is an example of such a <trans-unit> <trans-unit id="add to bookmarks"> <source>add to bookmarks</source> </trans-unit> your translations must be contained i
nside <target> child tags.
Localizing with Pontoon
and there it is, opened i
nside pontoon: main toolbar as you can see, most of the interface is taken by the website being translated.
Localization sign-off reviews
this is done by generating a diff between the new release revision being co
nsidered and the previously approved release revision.
Localization technical reviews
that being the case, there are some criteria in a technical review that will only ever be co
nsidered once, as all reviews after this only evaluate the changes you're adding on top of this revision from release to release.
Test
if not, please co
nsider installing some mathml fonts.
Fonts for Mozilla 2.0's MathML engine
the license allows you to "use this font as permitted by the eula for the product in which this font is included to display and print content", so consulting your lawyer is recommended if co
nsidering installing this on systems without the associated product.
MathML3Testsuite
when the markup is intentionally errorous, the correct behavior is not defined by the recommendation and hence the tests are co
nsidered passed if there is no fatal error (crash, etc).
MathML In Action
addeventlistener("click", zoomtoggle, false); } window.addeventlistener("load", load, false); co
nsider an interesting markup like this { u t + f ( u ) x = 0 u ( 0 , x ) = { u - if x < 0 u + if x > 0 or other complex markups like these ell ^ y ( z ; z , τ ) := ∫ y ( ∏ l ( y l 2 π i ) θ ( y l 2 π i - z ) θ ′ ( 0 ) θ ( - z ) θ ( y l 2 π i ) ) × ( ∏ k θ ( e k 2 π i - ( α k ...
Named Shared Memory
security co
nsiderations on unix platforms, depending on implementation, contents of the backing store for the shared memory can be exposed via the file system.
PR_CallOnce
from that time on, the client should co
nsider the object read-only (or even opaque) and allow the runtime to manipulate its content appropriately.
PR_Interrupt
file i/o is co
nsidered instantaneous, so file i/o functions cannot be interrupted.
Building NSS
test results running all tests can take a co
nsiderable amount of time.
FIPS Mode - an explanation
whether it is hardware or software, that device will have all the cryptographic engines in it, and also will stores keys and perhaps certificates i
nside.
JSS FAQ
jss is co
nsidered a fips-compliant software library since it only uses nss for any and all crypto routines.
JSS Provider Notes
the per-thread default token setting is only consulted i
nside getinstance().
NSS_3.12.2_release_notes.html
bug 450427: add comodo ecc certification authority certificate to nss bug 450536: remove obsolete xp_mac code bug 451024: certutil.exe crashes with segmentation fault i
nside pr_cleanup bug 451927: security/coreconf/winnt6.0.mk has invalid defines bug 452751: slot leak in pk11_findslotsbynames bug 452865: remove obsolete linker flags needed when libnss3 was linked with libsoftokn3 bug 454961: fix the implementation and use of pr_fgets in signtool bug 455348: change hyphens to underscores in debug_$(shell whoami).
NSS_3.12_release_notes.html
bug 429388: vfychain.main leaks memory bug 396044: warning: usage of uninitialized variable in ckfw/object.c(174) bug 396045: warning: usage of uninitialized variable in ckfw/mechanism.c(719) bug 401986: mac os x leopard build failure in legacydb bug 325805: diff co
nsiders mozilla/security/nss/cmd/pk11util/scripts/pkey a binary file bug 385151: remove the link time dependency from nss to softoken bug 387892: add entrust root ca certificate(s) to nss bug 433386: when system clock is off by more than two days, oscp check fails, can result in crash if user tries to view certificate [[@ secitem_compareitem_util] [[@ memcmp] bug 396256: certutil and pp do not print a...
NSS 3.29.2 release notes
bugs fixed in nss 3.29.2 nss 3.29 and 3.29.1 included a change that reduced the time that nss co
nsidered a tls session ticket to be valid.
NSS 3.39 release notes
it can be used to add a single flag to the flags= section i
nside the spec's nss= section.
NSS API Guidelines
these rules are derived from existing coding practices i
nside the security library, since consistency is more important than debates about what might look nice.
nss tech note1
in all other cases, only the first template structure passed to the decoder will be co
nsidered, even if additonal templates are passed in an array.
nss tech note2
for example, to log the softoken, use: nss_debug_pkcs11_module="nss internal pkcs #11 module" note: in the command prompt on windows, do not quote the name of the target module, otherwise the quotes are co
nsidered part of the name.
nss tech note6
if your build process modifies nss libraries in any way (for example, to strip the symbols), it should co
nsider not doing so for the reasons cited above.
nss tech note7
rsa key pairs may be generated i
nside a crypto module (also known as a token).
PKCS11 FAQ
operations the token does not support are co
nsidered impossible for the key to support.
Python binding for NSS
network byte order requirements when accessing the port i
nside a prnetaddr and simplify accessing the ipv4 vs.
NSS environment variables
before 3.0 nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 i
nside signatures.
NSS tools : modutil
a complex string must not include newlines or carriage returns.outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is co
nsidered equal and is used only to delimit tokens.
NSS tools : ssltab
-x turn on hex/ascii printing of undecoded data i
nside parsed ssl records.
NSS tools : ssltap
-x turn on hex/ascii printing of undecoded data i
nside parsed ssl records.
gtstd.html
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 co
nsiderations required to competently operate a ca.
NSS_3.12.3_release_notes.html
nss_allow_weak_signature_alg boolean (any non-empty value to enable) enables the use of md2 and md4 hash algorithms i
nside signatures.
NSS Tools modutil
a complex string must notinclude newlines or carriage returns.) outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is co
nsidered equal and is used only to delimit tokens.
NSS Tools pk12util
three of the options, -i, -o, and -l, should be co
nsidered commands of the pk12util invocation.
NSS Tools ssltap
-x turn on hex/ascii printing of undecoded data i
nside parsed ssl records.
NSS tools : modutil
a complex string must not include newlines or carriage returns.outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is co
nsidered equal and is used only to delimit tokens.
FUEL
co
nsider using the add-ons sdk instead fuel is a javascript library designed to help developers build extensions using terminology and interfaces that are familiar to them.
STEEL
co
nsider using the functions found in appconstants.jsm or services.jsm instead steel is the scriptable thunderbird easy extension library.
Creating the Component Code
co
nsider the following: referencing objects by id in this case, you have two implementations of the nsisupports interface.
Packaging WebLock
<!doctype html> <html> <title>weblock installation</title> <script> /* * trigger function that downloads the xpi so the * install.js file i
nside can be read and executed */ function installweblock() { weblock_xpi = {'weblock extension': 'weblock.xpi'}; installtrigger.install(weblock_xpi); } </script> <h1>install weblock</h1> <p><a href="#" onclick="installweblock();">install weblock</a></p> </html> distributing your component once you have the component packaged properly and the necessary installation and trigger scripts, you ...
XPCOM hashtable guide
a few examples: a hashtable that maps utf-8 origin names to a dom window - nsinterfacehashtable<nscstringhashkey,
nsidomwindow> a hashtable that maps 32 bit integers to floats - nsdatahashtable<nsuint32hashkey, float> a hashtable that maps nsisupports pointers to reference counted cacheentrys - nsrefptrhashtable<nsisupportshashkey, cacheentry> a hashtable that maps jscontext pointers to a contextinfo struct - nsclasshashtable<nsptrhashkey<jscontext>, contextinfo> a hashset of strings - nsthashtable<nsstringha...
XPCOM Stream Guide
this is also a synchronous (blocking) operation, so if you're in javascript, co
nsider using netutil.jsm as described below.
Interfacing with the XPCOM cycle collector
if the collector finds a group of objects that all refer back to one another, and establishes that the objects' reference counts are all accounted for by internal pointers within the group, it co
nsiders that group cyclical garbage, which it then attempts to free.
Components.interfaces
properties of the components.interfaces object are used where xpcom methods expect a parameter of type
nsid.
Components.utils.evalInSandbox
the evalinsandbox() function enables you to evaluate javascript code i
nside a sandbox you've previously created using the components.utils.sandbox constructor.
Components.utils.forceGC
note:
nsidomwindowutils.garbagecollect() offers similar functionality but will trigger the cycle collector in addition to the garbage collector in the javascript engine.
Components.utils.import
gecko 2.0 adds support for loading modules from chrome: urls, even those i
nside jar archives.
Components object
the components object has the following members: classes array of classes by contractid classesbyid array of classes by cid constructor constructor for constructor of components exception constructor for xpconnect exceptions id constructor for xpcom
nsids interfaces array of interfaces by interface name interfacesbyid array of interfaces by iid issuccesscode function to determine if a given result code is a success code lastresult result code of most recent xpconnect call manager the global xpcom component manager results array of known result codes by name returncode pending result for curr...
Architecture basics
it lets you get pointers to components i
nside mozilla, and it lets you talk about their interfaces as well.
XPConnect wrappers
because these are wrapped, you won't be able to peek down i
nside them from the console.
nsIRegistry
try { st.first(); do { var data = st.currentitem(); if( data instanceof ci.nsiregistrynode ) print("nsiregistrynode: " + data.nameutf8 + " (" + data.key + ")"); st.next(); } while( components.lastresult == 0 ); } catch(e) {} now, the output is something like: profiles (344) profiles/default (530) profiles/foo (1046) profiles/bar (1518) the number i
nside the parenthesis is the "key." you can use this key with the rest of the nsiregistry api (see mxr).
Language bindings
it returns a reference to the clone:components.utils.createobjectincomponents.utils.createobjectin creates a new javascript object in the scope of the specified object's compartment.components.utils.evalinsandboxthe evalinsandbox() function enables you to evaluate javascript code i
nside a sandbox you've previously created using the components.utils.sandbox constructor.components.utils.evalinwindowthis function enables code running in a more-privileged javascript context to evaluate a string in a less-privileged javascript context.
NS_InitXPCOM2
#include "nsxpcom.h" nsresult ns_initxpcom2( nsiservicemanager** aresult, nsifile* abindirectory,
nsidirectoryserviceprovider* aappfilelocationprovider ); parameters aresult [out] the resulting xpcom service manager.
NS_InitXPCOM3
#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.
NS_ConvertASCIItoUTF16
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
NS_ConvertUTF16toUTF8
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
NS_ConvertUTF8toUTF16
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
NS_LossyConvertUTF16toASCII
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsAdoptingCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsAdoptingString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsAutoString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsCAutoString
eters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsDependentCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsDependentString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsEmbedString
#include "nsembedstring.h" // or: #include "nsstringglue.h" if i
nside gecko class nsembedstring : public nsastring { ...
nsFixedCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsFixedString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsPromiseFlatCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsPromiseFlatString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
RefPtr
but this is co
nsidered bad form, and may soon be made a compile-time error.
nsString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsXPIDLCString
2, pruint32) const - source parameters nscstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount right pruint32 right(nscstring&, pruint32) const - source parameters nscstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
nsXPIDLString
uint32, pruint32) const - source parameters nsstring& aresult pruint32 astartpos pruint32 acount left pruint32 left(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount right pruint32 right(nsstring&, pruint32) const - source parameters nsstring& aresult pruint32 acount setcharat prbool setcharat(prunichar, pruint32) - source set a char i
nside this string at given index @param achar is the char you want to write into this string @param anindex is the ofs where you want to write the given char @return true if successful parameters prunichar achar pruint32 aindex stripchars void stripchars(const char*) - source these methods are used to remove all occurrences of the characters found in aset from this string.
IAccessibleRelation
refer to @ref _arrayco
nsideration "special co
nsideration when using arrays" for more details.
imgIDecoderObserver
if an image is decoded on load and not visibly discarded, decode notifications are nested logically i
nside load notifications as one might expect.
jsdIStackFrame
these are only valid i
nside the jsdiexecutionhook which gave it to you.
nsIAccelerometerUpdate
xpcom/system/nsiaccelerometer.idlnot scriptable replaced by
nsidevicemotionupdate 1.0 66 introduced gecko 2.0 obsolete gecko 6.0 inherits from: nsiaccelerometer last changed in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) this method is only used in content tabs to receive nsiacceleration data from the chrome process.
GetKeyBindings
nsidomdomstringlist getkeybindings( in pruint8 aactionindex ); parameters aactionindex[in] index of the given action.
nsIScriptableInputStream
note: it is also important to co
nsider how a language bindings may interpret the string data type.
nsIScrollable
this is a generic interface without concern for the type of content that may be i
nside.
nsISupportsID
inherits from: nsisupportsprimitive last changed in gecko 1.2 method overview string tostring(); attributes attribute type description data
nsidptr provides access to the native type represented by the object.
nsIThread
co
nsider use asynchronous callbacks instead.
nsIWebNavigation
document
nsidomdocument retrieves the current dom document for the frame, or lazily creates a blank document if there is none.
nsIWebNavigationInfo
this lets you determine whether a mime type can be displayed as-is i
nside a browser, or if the browser will instead forward handling of the data to a plug-in or an external helper application.
nsIWebProgress
last changed in gecko 1.8.0 inherits from: nsisupports method overview void addprogresslistener(in nsiwebprogresslistener alistener, in unsigned long anotifymask); void removeprogresslistener(in nsiwebprogresslistener alistener); attributes attribute type description domwindow
nsidomwindow the dom window associated with this nsiwebprogress instance.
nsIWorkerFactory
dom/interfaces/threads/
nsidomworkers.idlscriptable creates and returns a new worker 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) this interface was removed in gecko 8.0.
nsIWorkerMessagePort
dom/interfaces/threads/
nsidomworkers.idlscriptable this interface represents a worker thread's message port, which is used to allow the worker to post messages back to its creator.
nsIXFormsNSInstanceElement
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) interface code [scriptable, uuid(80669b92-8331-4f92-aaf8-06e80e6827b3)] interface nsixformsnsinstanceelement : nsisupports {
nsidomdocument getinstancedocument(); }; methods getinstancedocument
nsidomdocument getinstancedocument(); getinstancedocument returns a dom document that corresponds to the instance data associated with the instance element.
nsIXFormsNSModelElement
last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) interface code [scriptable, uuid(85fd60c7-1db7-40c0-ae8d-f723fdd1eea8)] interface nsixformsnsmodelelement : nsisupports {
nsidomnodelist getinstancedocuments(); }; methods getinstancedocuments
nsidomnodelist getinstancedocuments(); getinstancedocuments returns a
nsidomnodelist containing all the instance documents for the model, making it possible to enumerate over instances in the model without knowing their names.
nsIXMLHttpRequestUpload
1.0 66 introduced gecko 1.9.1 inherits from:
nsidomeventtarget last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) attributes attribute type description onabort
nsidomeventlistener onerror
nsidomeventlistener onload
nsidomeventlistener onloadstart
nsidomeventlistener onprogress
nsidomeventlistener see also nsixmlhttprequest nsixmlhttprequesteventtarget xmlhttprequest using xmlhttprequest ...
nsIXPConnect
the jsobject is returned i
nside a refcounted nsixpconnectjsobjectholder.
nsIZipEntry
content/base/public/
nsidomserializer.idlscriptable please add a summary to this article.
nsIZipReaderCache
s.nsizipreadercache); method overview nsizipreader getinnerzip(in nsifile zipfile, in autf8string zipentry); nsizipreader getinnerzip(in nsifile zipfile, in string zipentry); obsolete since gecko 10 nsizipreader getzip(in nsifile zipfile); void init(in unsigned long cachesize); methods getinnerzip() returns a (possibly shared) cached nsizipreader for a zip i
nside another zip.
nsIZipWriter
once you pick a folder, it will create a zip file i
nside this folder with the same name as the folder.
Storage
in both cases, you execute more than one statement i
nside of a transaction.
The Thread Manager
application/extension javascript should co
nsider using a chromeworker instead.") interfaces there are several interfaces that provide threading support: nsithreadmanager the thread manager itself lets you create threads.
XPCOM ABI
abi naming each abi is named with a string [target_xpcom_abi] of the following format: {cpu_arch}-{target_compiler_abi} {cpu_arch} [platforms] represents the cpu architecture and may be either: x86 - i386 and higher series (including x86-64 cpus in 32-bit mode) ppc - powerpc series alpha - alpha series x86_64 - amd64/emt64 series in 64-bit mode (32-bit mode is still co
nsidered x86) sparc - sparc series ia64 - itanium series {target_compiler_abi}[platforms] represents the compiler abi and may be either: msvc - microsoft visual c++ n32 - irix 6 c++ compiler gcc2 - gnu c++ compiler 2.x gcc3 - gnu c++ compiler 3.x or 4.x sunc - sun c++ compiler ibmc - ibm c++ compiler for example: firefox built with the gnu c++ compiler 4.0.0 for the intel pentium proc...
nsCOMPtr versus RefPtr
the dow
nside of this inheritance is that do_queryobject requires an extra virtual call to operator() in the helper method.
XSLT 2.0
saxon-b the extension demonstrates how one can use liveconnect code to communicate with the saxon-b library, but one might find the javascript code module approach used i
nside the extension xquseme as a more reusable approach.
Mozilla technologies
goal is to remove webshell and switch over entirely to docshell.embedded dialog apifeed content access apifirefox 2 and thunderbird 2 introduce a series of interfaces that make it easy for extension authors to access rss and atom feeds.life after xul: building firefox interfaces with htmlthis page gathers technical solutions to common problems encountered by teams shipping html-based interfaces i
nside firefox.morkmork is a database file format invented by david mccusker for the mozilla code since the original netscape database information was proprietary and could not be released open source.
Cached compose window FAQ
the dow
nsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing.
Index
the dow
nsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing.
Mail and RDF
an example of how this might work i
nside the datasource: var msgcountarc = rdf.getresource("http://home.netscape.com/nc-rdf#totalmessages"); function gettarget(target, property, unused) { var folder = target.queryinterface(components.interfaces.nsimsgfolder); if (property == msgcountarc) { var msgcount = folder.gettotalmessages(false); var result = rdf.getliteral(msgcount.tostring()); ...
Mail composition back end
pizzarro <rhp@netscape.com> contents overview sending messages nsimsgsend sending listener interfaces nsimsgsendlistener nsimsgcopyservicelistener copy operations copy to sent folder drafts templates "send later" sending unsent messages sending unsent messages listener quoting sample programs overview i've done co
nsiderable work in the past few weeks reorganizing the mail composition back end, so i thought it would be helpful to put together a small doc on the new interfaces and how one can use them.
Thunderbird Binaries
note: while beta builds have had some testing, they should be co
nsidered preview only and should not be used in a production environment.
Creating a Custom Column
looking in messenger.xul reveals that the columns reside i
nside a tree with the id "threadtree" whose columns (treecols) reside in "threadcols".
Use SQLite
this will create an sqlite db named tbird.sqlite i
nside your profile directory with a table called attachments.
customDBHeaders Preference
as you follow along the step-by-step guide in creating a custom column, you may want to co
nsider a preference setting that exposes custom header data for use in a custom column within thunderbird's main view.
Thunderbird extensions
tocols mailnews filters error reporting tools steel library (obsolete as of thunderbird 52, use https://github.com/protz/thunderbird-stdlib) developing new account types useful newsgroup discussions (anything that's very old should be regarded suspiciously, because there has been significant api rewrite over the past years making most techniques co
nsiderably easier) thunderbird api docs (mostly a collection of out-of-date pages, relevance is rather dubious) general links finding the code for a feature mozillazine articles on thunderbird community / communications thunderbird specific : add-ons section on developer.thunderbird.net thunderbird communication channels add-o...
Add to iPhoto
you can download the extension and poke through the code i
nside it if you'd like to see all of it.
Using Objective-C from js-ctypes
while ([synth isspeaking]) {} [synth release]; return 0; } save this file as test.m, and run with the following command, i
nside the same directory as the saved file (needs xcode).
Standard OS Libraries
wayland is not co
nsidered stable, but it's supposed to replace xorg in the long term.
StructType
if this isn't specified, the structure is co
nsidered opaque and you can't access its contents directly.
Mozilla
for example, a search provider can deliver a very good quality of search results — but only in a specific country or language, and we have to take this into account when co
nsidering default search engines for a locale.
Plug-in Development Overview - Plugins
co
nsider the following example, where a media player plug-in can be controlled with an advancetonextsong() method called i
nside the script element: <object id="myplugin" type="audio/wav" data="music.wav"> </object> <script type="application/javascript"> var theplugin = document.getelementbyid('myplugin'); if (theplugin && theplugin.advancetonextsong) theplugin.advancetonextsong(); el...
UI Tour - Firefox Developer Tools
they will be evaluated when code execution is paused: variable tooltip hover on a variable show a tooltip with its value i
nside: call stack when the debugger's paused, you'll see a call stack: each level of the call stack gets a line, with the name of the function and the filename and line number.
Debugger.Source - Firefox Developer Tools
(note that code passed to eval, the function constructor, or a similar function isnot co
nsidered to be loaded from a url; the url accessor on debugger.source instances for such sources should return undefined.) if the instance refers to webassembly code, the url of the script that called new webassembly.module with the string "> wasm" appended.
Debugger-API - Firefox Developer Tools
the debugger instance itself is not really a shadow of anything in the debuggee; rather, it maintains the set of global objects which are to be co
nsidered debuggees.
All keyboard shortcuts - Firefox Developer Tools
end end end expand currently selected node right arrow right arrow right arrow collapse currently selected node left arrow left arrow left arrow (when a node is selected) move i
nside the node so you can start stepping through attributes.
Examine and edit HTML - Firefox Developer Tools
if a shadow dom contains a "slotted" element (an element with a slot attribute after it has been inserted i
nside a <slot> element — see adding flexibility with slots for an explanation of how these are used), the "slotted" element will be shown i
nside its corresponding <slot> element, with a "reveal" link alongside it.
Work with animations - Firefox Developer Tools
finally, if you click i
nside the bar at the top of the timeline, you get a scrubber that you can drag left and right to move backwards and forwards through the animation, and pinpoint exactly what's happening when.
Page inspector keyboard shortcuts - Firefox Developer Tools
end end end expand currently selected node right arrow right arrow right arrow collapse currently selected node left arrow left arrow left arrow (when a node is selected) move i
nside the node so you can start stepping through attributes.
Allocations - Firefox Developer Tools
this shows you all the allocations that collectively triggered this gc event: if you're seeing these problems, co
nsider whether you can reduce the number or size of the allocations you're making here.
Frame rate - Firefox Developer Tools
to fix it, we might co
nsider splitting it into pieces and running the pieces i
nside requestanimationframe, or even running the entire function in a worker.
IndexedDB - Firefox Developer Tools
when you select an origin i
nside the indexed db storage type in the storage tree of the storage inspector, a table lists the details of all the databases present for that origin.
Local Storage / Session Storage - Firefox Developer Tools
you can edit local and session storage items by double-clicking i
nside cells in the table widget and editing the values they contain: you can delete local storage and session storage entries using the context menu: you can also delete local and session storage entries by selecting an item and pressing the delete or backspace key.
Web Console Helpers - Firefox Developer Tools
you can supply any of the following: a selector string to be passed to document.queryselector to locate the iframe element the iframe element itself the content window i
nside the iframe see working with iframes.
AbortController.abort() - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option i
nside the request's options object (see {signal}, below).
AbortController.signal - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option i
nside the request's options object (see {signal}, below).
AbortController - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option i
nside the request's options object (see {signal}, below).
AbortSignal - Web APIs
when the fetch request is initiated, we pass in the abortsignal as an option i
nside the request's options object (see {signal}, below).
Animation.id - Web APIs
syntax var animatio
nsid = animation.id; animation.id = newidstring; value a domstring which can be used to identify the animation, or null if the animation has no id.
AudioContext - Web APIs
you need to create an audiocontext before you do anything else, as everything happens i
nside a context.
AudioDestinationNode - Web APIs
their speakers), so you can get it hooked up i
nside an audio graph using only a few lines of code: var audioctx = new audiocontext(); var source = audioctx.createmediaelementsource(mymediaelement); source.connect(gainnode); gainnode.connect(audioctx.destination); to see a more complete implementation, check out one of our mdn web audio examples, such as voice-change-o-matic or violent theremin.
AudioListener.dopplerFactor - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.forwardX - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.forwardY - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.forwardZ - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.positionX - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.positionY - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.positionZ - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.setOrientation() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.setPosition() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.speedOfSound - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.upX - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.upY - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener.upZ - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioListener - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
AudioParam.value - Web APIs
co
nsider this example: const source = new audiobuffersourcenode(...); const rate = 5.3; source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); the log output will be false, because the playback rate parameter, rate, was converted to the 32-bit floating-point number closest to 5.3, which yields 5.300000190734863.
AuthenticatorAssertionResponse.authenticatorData - Web APIs
examples var options = { challenge: new uint8array(26), // will be another value, provided by the relying party server timeout: 60000 }; navigator.credentials.get({ publickey: options }) .then(function (assertionpkcred) { var authenticatordata = assertionpkcred.response.authenticatordata; // maybe try to convert the authenticatordata to see what's i
nside // send response and client extensions to the server so that it can // go on with the authentication }).catch(function (err) { console.error(err); }); specifications specification status comment web authentication: an api for accessing public key credentials level 1the definition of 'authenticatordata' in that specification.
Background Tasks API - Web APIs
it's an extremely busy chunk of code, and your main javascript code may run right i
nside this thread along with all of this.
BaseAudioContext.createPanner() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
BasicCardRequest - Web APIs
} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.billingAddress - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardNumber - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardSecurityCode - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.cardholderName - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryMonth - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse.expiryYear - Web APIs
}); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
BasicCardResponse - Web APIs
} once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
Blob() - Web APIs
syntax var newblob = new blob(array, options); parameters array an array of arraybuffer, arraybufferview, blob, usvstring objects, or a mix of any of such objects, that will be put i
nside the blob.
BluetoothDevice - Web APIs
the bluetoothdevice interface of the web bluetooth api represents a bluetooth device i
nside a particular script execution environment.
Body.arrayBuffer() - Web APIs
if you need to play ogg during downloading (stream it) - co
nsider htmlaudioelement: new audio("music.ogg").play(); in getdata() we create a new request using the request() constructor, then use it to fetch an ogg music track.
CSSPseudoElement - Web APIs
examples basic example using element.pseudo using pseudo-elements, most modern browsers will automatically add quotation marks around text i
nside a <q> element.
CanvasRenderingContext2D.clip() - Web APIs
syntax void ctx.clip([fillrule]); void ctx.clip(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is i
nside or outside the clipping region.
CanvasRenderingContext2D.fill() - Web APIs
syntax void ctx.fill([fillrule]); void ctx.fill(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is i
nside or outside the filling region.
A basic ray-caster - Web APIs
not exactly a new member of the id software family, but pretty decent co
nsidering it's a fully interpreted environment, and i didn't have to worry about memory allocation or video modes or coding inner routines in assembler or anything.
Manipulating video using canvas - Web APIs
every pixel in the frame's image data that is found that is within the parameters that are co
nsidered to be part of the green screen has its alpha value replaced with a zero, indicating that the pixel is entirely transparent.
Optimizing canvas - Web APIs
pre-render similar primitives or repeating objects on an offscreen canvas if you find yourself repeating some of the same drawing operations on each animation frame, co
nsider offloading them to an offscreen canvas.
Transformations - Web APIs
also if you're translating i
nside a loop and don't save and restore the canvas state, you might end up missing part of your drawing, because it was drawn outside the canvas edge.
Using images - Web APIs
using backdrops can make your script co
nsiderably smaller because we can avoid the need for code to generate the background.
Clients.claim() - Web APIs
example the following example uses claim() i
nside service worker's "activate" event listener so that clients loaded in the same scope do not need to be reloaded before their fetches will go through this service worker.
Console API - Web APIs
by far the most commonly-used method is console.log, which is used to log the current value contained i
nside a specific variable.
CredentialsContainer - Web APIs
credentialscontainer.store()secure context stores a set of credentials for a user, i
nside a provided credential instance and returns that instance in a promise.
CustomElementRegistry.define() - Web APIs
.attachshadow({mode: 'open'}); // create spans var wrapper = document.createelement('span'); wrapper.setattribute('class','wrapper'); var icon = document.createelement('span'); icon.setattribute('class','icon'); icon.setattribute('tabindex', 0); var info = document.createelement('span'); info.setattribute('class','info'); // take attribute content and put it i
nside the info span var text = this.getattribute('text'); info.textcontent = text; // insert icon var imgurl; if(this.hasattribute('img')) { imgurl = this.getattribute('img'); } else { imgurl = 'img/default.png'; } var img = document.createelement('img'); img.src = imgurl; icon.appendchild(img); // create some css to apply to the shadow dom ...
DOMHighResTimeStamp - Web APIs
the time origin the time origin is a standard time which is co
nsidered to be the beginning of the current document's lifetime.
DOMMatrix - Web APIs
this interface should be available i
nside web workers, though some implementations don't allow it yet.
DOMTokenList.forEach() - Web APIs
we when retrieve an iterator containing the values using foreach(), writing each one to the <span>'s node.textcontent i
nside the foreach() inner function.
DedicatedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from i
nside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from i
nside the worker's inner scope.
DedicatedWorkerGlobalScope: message event - Web APIs
messageevent event handler property onmessage examples this code creates a new worker and sends it a message using worker.postmessage(): 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(): // i
nside 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 ...
DedicatedWorkerGlobalScope: messageerror event - Web APIs
bubbles no cancelable no interface messageevent event handler property onmessageerror examples listen for messageerror using addeventlistener(): // i
nside worker.js self.addeventlistener('messageerror', (event) => { self.postmessage('error receiving message'); console.error(event); }); the same, but using the onmessageerror event handler property: // i
nside worker.js self.onmessageerror = (event) => { self.postmessage('error receiving message'); console.error(event); }; specifications specification status html living standard living standard ...
DedicatedWorkerGlobalScope.name - Web APIs
example if a worker is created using a constructor with a name option: var myworker = new worker("worker.js", { name : "myworker" }); the dedicatedworkerglobalscope will now have a name of "myworker", returnable by running self.name from i
nside the worker.
Document.characterSet - Web APIs
users can override the developer-specified encoding i
nside the content-type header or inline like <meta charset="utf-8">, such as with firefox's view → text encoding menu.
Document.createProcessingInstruction() - Web APIs
obsolete added note that the namespace of the target name is not checked whether it is well-formed, defined what is co
nsidered an illegal character for the target name and specified the returned processinginstruction object more precisely.
Document.domain - Web APIs
exceptions securityerror an attempt has been made to set domain under one of the following conditions: the document is i
nside a sandboxed <iframe> the document has no browsing context the document's effective domain is null the given value is not equal to the document's effective domain (or it is not a registerable domain suffix of it) the document-domain feature-policy is enabled examples getting the domain for the uri http://developer.mozilla.org/docs/web, this example sets currentdomain to the string...
Document.evaluate() - Web APIs
for example, if you know the content you are looking for is somewhere i
nside the body tag, you can use this: document.evaluate(".//h2", document.body, null, xpathresult.any_type, null); notice in the above document.body has been used as the context instead of document so the xpath starts from the body element.
Document.getElementsByClassName() - Web APIs
examples get all elements that have a class of 'test': document.getelementsbyclassname('test') get all elements that have both the 'red' and 'test' classes: document.getelementsbyclassname('red test') get all elements that have a class of 'test', i
nside of an element that has the id of 'main': document.getelementbyid('main').getelementsbyclassname('test') get the first element with a class of 'test', or undefined if there is no matching element: document.getelementsbyclassname('test')[0] we can also use methods of array.prototype on any htmlcollection by passing the htmlcollection as the method's this value.
Document.hasFocus() - Web APIs
the hasfocus() method of the document interface returns a boolean value indicating whether the document or any element i
nside the document has focus.
Document.hidden - Web APIs
the document.hidden read-only property returns a boolean value indicating if the page is co
nsidered hidden or not.
Document: keypress event - Web APIs
<p>press i
nside this iframe first to focus it, then try pressing keys on the keyboard.</p> <p id="log"></p> const log = document.getelementbyid('log'); document.addeventlistener('keypress', logkey); function logkey(e) { log.textcontent += ` ${e.code}`; } onkeypress equivalent document.onkeypress = logkey; specifications specification status ui events working draft ...
Document.open() - Web APIs
for example: all event listeners currently registered on the document, nodes i
nside the document, or the document's window are removed.
Document.querySelector() - Web APIs
here, the first <input> element with the name "login" (<input name="login"/>) located i
nside a <div> whose class is "user-panel main" (<div class="user-panel main">) in the document is returned: var el = document.queryselector("div.user-panel.main input[name='login']"); negation as all css selector strings are valid, you can also negate selectors: var el = document.queryselector("div.user-panel:not(.main) input[name='login']"); this will select an input with a parent div with the ...
Document.referrer - Web APIs
i
nside an <iframe>, the document.referrer will initially be set to the same value as the href of the parent window's window.location.
How to create a DOM tree - Web APIs
dynamically creating a dom tree co
nsider the following xml document: <?xml version="1.0"?> <people> <person first-name="eric" middle-initial="h" last-name="jung"> <address street="321 south st" city="denver" state="co" country="usa"/> <address street="123 main st" city="arlington" state="ma" country="usa"/> </person> <person first-name="jed" last-name="brown"> <address street="321 north st" city="atlanta" state="ga" country="usa"/> <address street="123 west st" city="seattle" state="wa" country="usa"/> <address street="321 south avenue" city...
Document Object Model (DOM) - Web APIs
it is uncertain whether some may be reintroduced in the future or not, but for the time being they should be co
nsidered obsolete and should be avoided: documenttouch domconfiguration domerrorhandler domimplementationlist domimplementationregistry domimplementationsource domlocator domobject domsettabletokenlist domuserdata elementtraversal entity entityreference namelist notation typeinfo userdatahandler html dom a document containing html is described ...
EcdsaParams - Web APIs
warning: sha-1 is also supported here but the sha-1 algorithm is co
nsidered vulnerable and should no longer be used.
EffectTiming.endDelay - Web APIs
the animation's end time—the time at which an iteration is co
nsidered to have finished—is the time at which the animation finishes an iteration (its initial delay, animationeffecttimingreadonly.delay, plus its duration,duration, plus its end delay.
EffectTiming.fill - Web APIs
that css looks like this: #box { width: 200px; height: 200px; left: 50px; top: 50px; border: 1px solid #7788ff; margin: 0; position: relative; background-color: #2233ff; display: flex; justify-content: center; } all this does is specify the size, border, and color information, as well as indicate that the box should be centered both vertically and horizontally i
nside its container.
Element.animate() - Web APIs
for example, co
nsider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state is implied.
Element: keydown event - Web APIs
omposition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keydown", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keydown example this example logs the keyboardevent.code value whenever you press down a key i
nside the <input> element.
Element: keyup event - Web APIs
rt of composition, do something like this (229 is a special value set for a keycode relating to an event that has been processed by an ime): eventtarget.addeventlistener("keyup", event => { if (event.iscomposing || event.keycode === 229) { return; } // do something }); examples addeventlistener keyup example this example logs the keyboardevent.code value whenever you release a key i
nside the <input> element.
Element: mouseup event - Web APIs
the mouseup event is fired at an element when a button on a pointing device (such as a mouse or trackpad) is released while the pointer is located i
nside it.
Element.scroll() - Web APIs
the scroll() method of the element interface scrolls the element to a particular set of coordinates i
nside a given element.
ElementCSSInlineStyle.style - Web APIs
setting styles styles should not be set by assigning a string directly to the style property (as in elt.style = "color: blue;"), since it is co
nsidered read-only, as the style attribute returns a cssstyledeclaration object which is also read-only.
Comparison of Event Targets - Web APIs
there are five targets to co
nsider: property defined in purpose event.target dom event interface the dom element on the lefthand side of the call that triggered this event, eg: element.dispatchevent(event) event.currenttarget dom event interface the eventtarget whose eventlisteners are currently being processed.
Event.composed - Web APIs
https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes i
nside the shadow boundary.
Event.composedPath() - Web APIs
https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes i
nside the shadow boundary.
Event.originalTarget - Web APIs
defined in /dom/public/idl/events/
nsidomnsevent.idl this event property is not defined in the w3.org dom level 2 events ...
ExtendableEvent() - Web APIs
currently no possible options exist i
nside the spec, but this has been defined for forward compatibility across the different derived events.
ExtendableMessageEvent.data - Web APIs
examples when the following code is used i
nside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.lastEventId - Web APIs
examples when the following code is used i
nside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.origin - Web APIs
examples when the following code is used i
nside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.ports - Web APIs
examples when the following code is used i
nside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
ExtendableMessageEvent.source - Web APIs
examples when the following code is used i
nside a service worker to respond to a push messages by sending the data received via pushmessagedata to the main context via a channel message, the event object of onmessage will be a extendablemessageevent.
File.File() - Web APIs
syntax new file(bits, name[, options]); parameters bits an array of arraybuffer, arraybufferview, blob, usvstring objects, or a mix of any of such objects, that will be put i
nside the file.
FileSystemDirectoryEntry.getDirectory() - Web APIs
{ let reader = new filereader(); reader.addeventlistener("loadend", function() { dictionary = json.parse(reader.result); }); reader.readastext(dictfile); }); }); }); } the loaddictionaryforlanguage() function starts by using getdirectory() to obtain the filesystemdirectoryentry object representing a subfolder named "dictionaries" located i
nside the specified app data directory.
FileSystemDirectoryEntry.getFile() - Web APIs
{ let reader = new filereader(); reader.addeventlistener("loadend", function() { dictionary = json.parse(reader.result); }); reader.readastext(dictfile); }); }); }); } the loaddictionaryforlanguage() function starts by using getdirectory() to obtain the filesystemdirectoryentry object representing a subfolder named "dictionaries" located i
nside the specified app data directory.
FileSystemEntry.copyTo() - Web APIs
errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory i
nside itself or one of its own child directories, or copying an item within the same directory without renaming it.
FileSystemEntry.moveTo() - Web APIs
errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory i
nside itself or one of its own child directories, or copying an item within the same directory without renaming it.
Using FormData Objects - Web APIs
you can also append a file or blob directly to the formdata object, like this: data.append("myfile", myblob, "filename.txt"); when using the append() method it is possible to use the third optional parameter to pass a filename i
nside the content-disposition header that is sent to the server.
FormData.append() - Web APIs
the append() method of the formdata interface appends a new value onto an existing key i
nside a formdata object, or adds the key if it does not already exist.
FormData.set() - Web APIs
the set() method of the formdata interface sets a new value for an existing key i
nside a formdata object, or adds the key/value if it does not already exist.
GeolocationPosition.coords - Web APIs
it contains the location, that is longitude and latitude on the earth, the altitude, and the speed of the object concerned, regrouped i
nside the returned value.
GlobalEventHandlers.onclick - Web APIs
note: when using the click event to trigger an action, also co
nsider adding this same action to the keydown event, to allow the use of that same action by people who don't use a mouse or a touch screen.
msAudioDeviceType - Web APIs
syntax <audio src="sound.mp3" msaudiodevicetype="communications" /> by default, audio on your system will output to your default speakers and be co
nsidered a foreground element, meaning that the audio will play only when the element is active in the app.
inert - Web APIs
this can be useful when building uis such as modals where you would want to "trap" the focus i
nside the modal when it's visible.
HTMLFormElement: submit event - Web APIs
bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface submitevent event handler property globaleventhandlers.onsubmit note that the submit event fires on the <form> element itself, and not on any <button> or <input type="submit"> i
nside it.
HTMLIFrameElement - Web APIs
htmliframeelement.allowpaymentrequest is a boolean indicating whether the payment request api may be invoked i
nside a cross-origin iframe.
Image() - Web APIs
examples var myimage = new image(100, 200); myimage.src = 'picture.jpg'; document.body.appendchild(myimage); this would be the equivalent of defining the following html tag i
nside the <body>: <img width="100" height="200" src="picture.jpg"> specifications specification status comment html living standardthe definition of 'image()' in that specification.
HTMLImageElement.align - Web APIs
it may be worth noting that vertical-align offers several additional options for its value; you may wish to co
nsider these when changing your code to use it.
HTMLImageElement.longDesc - Web APIs
co
nsider the following older html: <img src="taco-tuesday.jpg" longdesc="image-descriptions/taco-tuesday.html"> here, the longdesc is used to indicate that the user should be able to access a detailed description of the image taco-tuesday.jpg in the html file image-descriptions/taco-tuesday.html.
HTMLImageElement.srcset - Web APIs
syntax htmlimageelement.srcset = imagecandidatestrings; let srcset = htmlimageelement.srcset; value a usvstring containing a comma-separated list of one or more image candidate strings to be used when determining which image resource to present i
nside the <img> element represented by the htmlimageelement.
HTMLImageElement.useMap - Web APIs
co
nsider 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 a...
HTMLInputElement.webkitdirectory - Web APIs
for example, co
nsider this file system: photoalbums birthdays jamie's 1st birthday pic1000.jpg pic1004.jpg pic1044.jpg don's 40th birthday pic2343.jpg pic2344.jpg pic2355.jpg pic2356.jpg vacations mars pic5533.jpg pic5534.jpg pic5556.jpg pic5684.jpg...
HTMLInputElement - Web APIs
when nothing is selected, this returns the position of the text input cursor (caret) i
nside of the <input> element.
HTMLLIElement - Web APIs
htmllielement.value is a long indicating the ordinal position of the list element i
nside a given <ol>.
HTMLMediaElement.srcObject - Web APIs
until other browsers catch up, for mediasource, blob and file, co
nsider falling back to creating a url with url.createobjecturl() and assign it to htmlmediaelement.src.
HTMLOListElement - Web APIs
this property reflects the compact attribute only, it doesn't co
nsider the line-height css property used for that behavior in modern pages.
HTMLScriptElement - Web APIs
htmlscriptelement.text is a domstring that joins and returns the contents of all text nodes i
nside the <script> element (ignoring other nodes like comments) in tree order.
HTMLSlotElement - Web APIs
every time the element inserted in the slot changes, we log a report to the console saying which slot has changed, and what the new node i
nside the slot is.
HTMLUListElement - Web APIs
this property reflects the compact attribute only, it doesn't co
nsider the line-height css property used for that behavior in modern pages.
IDBObjectStore - Web APIs
example this example shows a variety of different uses of object stores, from updating the data structure with idbobjectstore.createindex i
nside an onupgradeneeded function, to adding a new item to our object store with idbobjectstore.add.
IDBRequest.transaction - Web APIs
the transaction read-only property of the idbrequest interface returns the transaction for the request, that is, the transaction the request is being made i
nside.
IDBTransaction - Web APIs
oke="#d4dde4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">idbtransaction</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} transactions are started when the transaction is created, not when the first request is placed; for example co
nsider this: var trans1 = db.transaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectstore2 = trans2.objectstore("foo") var objectstore1 = trans1.objectstore("foo") objectstore2.put("2", "key"); objectstore1.put("1", "key"); after the code is executed the object store should contain the value "2", since trans2 should run after trans1.
Browser storage limits and eviction criteria - Web APIs
differ slightly): <profile>/storage — the main top-level directory for storages maintained by the quota manager (see below) <profile>/storage/permanent — persistent data storage repository <profile>/storage/temporary — temporary data storage repository <profile>/storage/default — default data storage repository note: after introducing storage api, the "permanent" folder can be co
nsidered obsolete; the "permanent" folder only stores indexeddb persistent-type databases.
InputEvent.inputType - Web APIs
> <li>a sample</li> <li>bulleted</li> <li>list.</li> </ul> <p>another paragraph.</p> </div> javascript const log = document.getelementbyid('log'); const editable = document.queryselector('div[contenteditable]'); editable.addeventlistener('input', loginputtype); function loginputtype(event) { log.textcontent = `input type: ${event.inputtype}`; } result try editing the text i
nside the <div> and see what happens.
compareVersion - Web APIs
note that the registry pathname is not the location of the software on the computer; it is the location of information about the software i
nside the client version registry.
IntersectionObserver.root - Web APIs
the intersection of this bounding rectangle, offset by any margins specified in the options passed to the intersectionobserver() constructor, the target element's bounds, minus the bounds of every element or other object which overlaps the target element, is co
nsidered to be the visible area of the target element.
IntersectionObserver.rootMargin - Web APIs
this lets you, for example, adjust the bounds outward so that the target element is co
nsidered 100% visible even if a certain number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box.
KeyboardEvent.code - Web APIs
break; case "keya": case "arrowleft": // handle "turn left" angle -= turnrate; break; case "keyd": case "arrowright": // handle "turn right" angle += turnrate; break; } refresh(); // consume the event so it doesn't get handled twice event.preventdefault(); }, true); try it out to ensure that keystrokes go to the sample code, click i
nside the black game play field below before pressing keys.
Key Values - Web APIs
in the specification, they're included in other sets of keys (such as the media keys), but they are more sensibly co
nsidered to be their own category.
KeyboardEvent.location - Web APIs
possible values are: constant value description dom_key_location_standard 0 the key has only one version, or can't be distinguished between the left and right versions of the key, and was not pressed on the numeric keypad or a key that is co
nsidered to be part of the keypad.
KeyframeEffect.setKeyframes() - Web APIs
for example, co
nsider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state is implied.
MediaList - Web APIs
medialist.item() a getter that returns a cssomstring representing a media query as text, given the media query's index value i
nside the medialist.
active - Web APIs
a stream is co
nsidered active if at least one of its mediastreamtracks is not in the mediastreamtrack.ended state.
MediaStreamTrack.enabled - Web APIs
the value of enabled, in essence, represents what a typical user would co
nsider the muting state for a track, whereas the muted property indicates a state in which the track is temporarily unable to output data, such as a scenario in which frames have been lost in transit.
MediaTrackSettings - Web APIs
two devices (as identified by the deviceid) are co
nsidered part of the same group if they are from the same physical device.
Metadata.modificationTime - Web APIs
the read-only modificationtime property of the metadata interface is a date object which specifies the date and time the file system entry (or the data referenced by the entry) was last modified.a file system entry is co
nsidered to have been modified if the metadata or the contents of the referenced file (or directory, or whatever other kind of file system entry might exist on the platform in use) has changed.
msSetMediaProtectionManager - Web APIs
the mediaprotectionmanager class can be passed as an input to a media playback api or the mediaprotectionmanager property i
nside the tag's video or audio.
NamedNodeMap - Web APIs
objects i
nside a namednodemap are not in any particular order, unlike nodelist, although they may be accessed by an index as in an array.
Navigator.cookieEnabled - Web APIs
note: when the browser is configured to block third-party cookies, and navigator.cookieenabled is invoked i
nside a third-party iframe, it returns true in safari, edge spartan and ie (while trying to set a cookie in such scenario would fail).
Node.setUserData() - Web APIs
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 co
nsider user data in making the assessment.
NodeList - Web APIs
static nodelists although they are both co
nsidered nodelists, there are 2 varieties of nodelist: live and static.
Notification.close() - Web APIs
at the end of the function, it also calls close() i
nside a addeventlistener() function to remove the notification when the relevant content has been read on the webpage.
OVR_multiview2 - Web APIs
framebuffer_incomplete_view_targets_ovr if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is co
nsidered incomplete.
OfflineAudioContext - Web APIs
at this point we create another audio context, create an audiobuffersourcenode i
nside it, and set its buffer to be equal to the promise audiobuffer.
PageTransitionEvent - Web APIs
the pagetransitionevent event object is available i
nside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded.
PannerNode.coneInnerAngle - Web APIs
the coneinnerangle property of the pannernode interface is a double value describing the angle, in degrees, of a cone i
nside of which there will be no volume reduction.
PannerNode.distanceModel - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PannerNode.maxDistance - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PannerNode.panningModel - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PannerNode.setOrientation() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PannerNode.setPosition() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PannerNode.setVelocity() - Web APIs
you might be moving a character around i
nside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo.
PaymentAddress - Web APIs
"success" : "failure"; await response.complete(result); } dopaymentrequest(); once the payment flow has been triggered using paymentrequest.show() and the promise resolves successfully, the paymentresponse object available i
nside the fulfilled promise (instrumentresponse above) will have a paymentresponse.details property that will contain response details.
Using the Payment Request API - Web APIs
so for example, you could create a new paymentrequest instance like so: var request = new paymentrequest(buildsupportedpaymentmethoddata(), buildshoppingcartdetails()); the functions invoked i
nside the constructor simply return the required object parameters: function buildsupportedpaymentmethoddata() { // example supported payment methods: return [{ supportedmethods: 'basic-card', data: { supportednetworks: ['visa', 'mastercard'], supportedtypes: ['debit', 'credit'] } }]; } function buildshoppingcartdetails() { // hardcoded for demo purposes: return { ...
Payment Request API - Web APIs
note: the api is available i
nside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them.
Pbkdf2Params - Web APIs
this may be one of: sha-1 sha-256 sha-384 sha-512 warning: sha-1 is co
nsidered vulnerable in most cryptographic applications, but is still co
nsidered safe in pbkdf2.
PerformanceTiming - Web APIs
a connection is co
nsidered as opened when all secure connection handshake, or socks authentication, is terminated.
Performance API - Web APIs
the performance interfaces are co
nsidered high resolution because they are accurate to a thousandth of a millisecond (subject to hardware or software constraints).
Permissions API - Web APIs
the permissions property has been made available on the navigator object, both in the standard browsing context and the worker context (workernavigator — so permission checks are available i
nside workers), and returns a permissions object that provides access to the permissions api functionality.
PointerEvent - Web APIs
typically, this is determined by co
nsidering the pointer's location and also the visual layout of elements in a document on screen media.
RTCDataChannel.onmessage - Web APIs
example this code snippet creates a peer connection, adds a data channel to it, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents displayed i
nside it.
RTCDataChannel - Web APIs
the default is "blob".bufferedamount read only the read-only rtcdatachannel property bufferedamount returns the number of bytes of data currently queued to be sent over the data channel.bufferedamountlowthreshold the rtcdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is co
nsidered "low." the default value is 0.id read only the read-only rtcdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rtcdatachannel.label read only the read-only rtcdatachannel property label returns a domstring containing a name describing the data channel.
RTCIceCandidate.address - Web APIs
usage notes co
nsider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the fifth field, "192.168.0.56" is the ip address in this candidate's a-line string.
RTCIceCandidate.candidate - Web APIs
the new candidate is then passed into rtcpeerconnection.addicecandidate() to add the candidate to the list of candidates for webrtc to co
nsider using for the connection being established.
RTCIceCandidate.component - Web APIs
usage notes co
nsider this sdp attribute line (a-line): a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host this is an ice candidate a-line, whose foundation is 4234997325.
RTCIceCandidate.foundation - Web APIs
usage notes co
nsider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the field "4234997325" is the foundation.
RTCIceCandidate.port - Web APIs
usage notes co
nsider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the port number is found in the sixth field, which is "44323".
RTCIceCandidateStats.priority - Web APIs
during ice negotiation while setting up a webrtc peer connection, the priority values reported to the remote peer by a user agent are used to determine which candidates are co
nsidered "more desirable".
RTCOfferOptions.iceRestart - Web APIs
note: rather than manually creating and submitting an offer with icerestart set to true, you should co
nsider calling the rtcpeerconnection method restartice() instead.
RTCOutboundRtpStreamStats.pliCount - Web APIs
however, the primary purpose of a pli packet is to allow the rtcrtpsender for which this rtcoutboundrtpstreamstats object provides statistics to co
nsider techniques to mitigate network performance issues.
RTCPeerConnection.addStream() - Web APIs
if the signalingstate is set to stable, the event negotiationneeded is sent on the rtcpeerconnection to indicate that ice negotiation must be repeated to co
nsider the new stream.
RTCPeerConnection.close() - Web APIs
all rtcrtpsender objects are co
nsidered to be stopped once this returns (they may still be in the process of stopping, but for all intents and purposes, they're stopped).
RTCRtpEncodingParameters.maxBitrate - Web APIs
this value is computed using the standard transport independent application specific maximum (tias) bandwidth as defined by rfc 3890, section 6.2.2; this is the maximum bandwidth needed without co
nsidering protocol overheads from ip, tcp or udp, and so forth.
RTCRtpTransceiver - Web APIs
an rtcrtptransceiver is associated with an m-line if its mid is non-null; otherwise it's co
nsidered disassociated.
Range.commonAncestorContainer - Web APIs
to change the ancestor container of a node, co
nsider using the various methods available to set the start and end positions of the range, such as range.setstart() and range.setend().
Range.compareNode() - Web APIs
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_i
nside (3) node starts after and ends before the range, i.e.
ServiceWorkerMessageEvent.data - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.lastEventId - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.origin - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.ports - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent.source - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
ServiceWorkerMessageEvent - Web APIs
examples when the following code is used i
nside the main thread to set up a message channel between it and a service worker for sending messages between the two, the event object of onmessage will be a serviceworkermessageevent.
SharedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from i
nside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from i
nside the worker's inner scope.
SharedWorkerGlobalScope.name - Web APIs
example if a shared worker is created using a constructor with a name option: var myworker = new sharedworker("worker.js", { name : "mysharedworker" }); the sharedworkerglobalscope will now have a name of "mysharedworker", returnable by running self.name from i
nside the shared worker.
Slottable: assignedSlot - Web APIs
when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it i
nside the element with a slot attribute with the value my-text.
SourceBuffer.audioTracks - Web APIs
the audiotracks read-only property of the sourcebuffer interface returns a list of the audio tracks currently contained i
nside the sourcebuffer.
SourceBuffer.textTracks - Web APIs
the texttracks read-only property of the sourcebuffer interface returns a list of the text tracks currently contained i
nside the sourcebuffer.
SourceBuffer.videoTracks - Web APIs
the videotracks read-only property of the sourcebuffer interface returns a list of the video tracks currently contained i
nside the sourcebuffer.
SpeechSynthesis - Web APIs
i
nside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method.
SpeechSynthesisUtterance - Web APIs
i
nside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), use the constructor to create a new utterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method.
StaticRange - Web APIs
usage notes a dom range specifies a span of content in a document, potentially beginning i
nside one node (or element) and ending i
nside another one.
Streams API concepts - Web APIs
the chunks i
nside the stream are read by a reader — this processes the data one chunk at a time, allowing you to do whatever kind of operation you want to do on it.
Streams API - Web APIs
more complicated uses involve creating your own stream using the readablestream() constructor, for example to process data i
nside a service worker.
StylePropertyMapReadOnly.get() - Web APIs
let's start by creating a link i
nside a paragraph in our html, and adding a definition list which we will populate with javascript: <p> <a href="https://example.com">link</a> </p> <dl id="regurgitation"></dl> we add a bit of css, including a custom property and an inhertable property: p { font-weight: bold; } a { --colour: red; color: var(--colour); } we use the element's computedstylemap() to return a stylepropertyma...
SubtleCrypto.importKey() - Web APIs
; const pemcontents = pem.substring(pemheader.length, pem.length - pemfooter.length); // base64 decode the string to get the binary data const binaryderstring = window.atob(pemcontents); // convert from a binary string to an arraybuffer const binaryder = str2ab(binaryderstring); return window.crypto.subtle.importkey( "pkcs8", binaryder, { name: "rsa-pss", // co
nsider using a 4096-bit key for systems that require long-term security moduluslength: 2048, publicexponent: new uint8array([1, 0, 1]), hash: "sha-256", }, true, ["sign"] ); } subjectpublickeyinfo import this example imports an rsa public encryption key from a pem-encoded subjectpublickeyinfo object.
UIEvent.layerX - Web APIs
this property takes scrolling of the page into account and returns a value relative to the whole of the document unless the event occurs i
nside a positioned element, where the returned value is relative to the top left of the positioned element.
UIEvent.layerY - Web APIs
this property takes scrolling of the page into account, and returns a value relative to the whole of the document, unless the event occurs i
nside a positioned element, where the returned value is relative to the top left of the positioned element.
sourceCapabilities - Web APIs
a device is co
nsidered "responsible" for an event only when that interaction is part of the abstraction provided by the web platform.
ValidityState - Web APIs
valid read only a boolean that is true if the element meets all its validation constraints, and is therefore co
nsidered to be valid, or false if it fails any constraint.
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
when using the ovr_multiview2 extension, the following value can be returned additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is co
nsidered incomplete.
WebGLSampler - Web APIs
the webglsampler interface is part of the webgl 2 api and stores sampling parameters for webgltexture access i
nside of a shader.
Clearing with colors - Web APIs
--> <canvas>your browser does not seem to support html5 canvas.</canvas> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } // run everything i
nside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it, // and to not mess up the global scope.
Detect WebGL - Web APIs
<p>[ here would go the result of webgl feature detection ]</p> <button>press here to detect webglrenderingcontext</button> body { text-align : center; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; } // run everything i
nside window load event handler, to make sure // dom is fully loaded and styled before trying to manipulate it.
Adding 2D content to a WebGL context - Web APIs
{ const numcomponents = 2; // pull out 2 values per iteration const type = gl.float; // the data in the buffer is 32bit floats const normalize = false; // don't normalize const stride = 0; // how many bytes to get from one set of values to the next // 0 = use type and numcomponents above const offset = 0; // how many bytes i
nside the buffer to start from gl.bindbuffer(gl.array_buffer, buffers.position); gl.vertexattribpointer( programinfo.attriblocations.vertexposition, numcomponents, type, normalize, stride, offset); gl.enablevertexattribarray( programinfo.attriblocations.vertexposition); } // tell webgl to use our program when drawing gl.usepro...
Using textures in WebGL - Web APIs
lors buffer is gone, replaced with this: // tell webgl how to pull out the texture coordinates from buffer { const num = 2; // every coordinate composed of 2 values const type = gl.float; // the data in the buffer is 32 bit float const normalize = false; // don't normalize const stride = 0; // how many bytes to get from one set to the next const offset = 0; // how many bytes i
nside the buffer to start from gl.bindbuffer(gl.array_buffer, buffers.texturecoord); gl.vertexattribpointer(programinfo.attriblocations.texturecoord, num, type, normalize, stride, offset); gl.enablevertexattribarray(programinfo.attriblocations.texturecoord); } then add code to specify the texture to map onto the faces, just before draw: // tell webgl we want to affect texture unit 0 ...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
v" offer is received by the remote peer, it calls its holdended() method: async function holdended(offer, micstream) { try { await peerconnection.setremotedescription(offer); await audiotransceiver.sender.replacetrack(micstream.getaudiotracks()[0]); audiotransceiver.direction = "sendrecv"; await sendanswer(); } catch(err) { /* handle the error */ } } the steps taken i
nside the try block here are: the received offer is stored as the remote description by calling setremotedescription().
WebXR application life cycle - Web APIs
if your scene is complex, you should co
nsider creating a worker—or using one that you've previously created for this purpose—to perform the computations needed for each frame to be rendered.
WebXR Device API - Web APIs
however, there are issues specific to creating augmented and virtual reality settings that need to be co
nsidered when writing your lighting code.
Keyframe Formats - Web APIs
for example, co
nsider this simple animation — the keyframe object looks like so: let rotate360 = [ { transform: 'rotate(360deg)' } ]; we have only specified the end state of the animation, and the beginning state is implied.
window.location - Web APIs
location.assign("http://www.mozilla.org"); // or location = "http://www.mozilla.org"; example #2: force reloading the current page from the server location.reload(true); example #3 co
nsider the following example, which will reload the page by using the replace() method to insert the value of location.pathname into the hash: function reloadpagewithhash() { var initialpage = location.pathname; location.replace('http://example.com/#' + initialpage); } example #4: display the properties of the current url in an alert dialog: function showloc() { var olocation = location, alo...
Window.mozInnerScreenX - Web APIs
that means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the
nsidomwindowutils.screenpixelspercsspixel property.
Window.mozInnerScreenY - Web APIs
that means it can be affected by the zoom level; to compute the actual number of physical screen pixels, you should use the
nsidomwindowutils.screenpixelspercsspixel property.
Window.onbeforeinstallprompt - Web APIs
}); window.onbeforeinstallprompt = function(event) { ...}; example the following example uses the beforeinstallprompt event to make an install button operable, by using the event i
nside a click handler.
Obsolete features - Web APIs
forcing fullscreen onto other users is also extremely unpopular and is co
nsidered an outright rude attempt to impose web author's viewing preferences onto users.
Window.open() - Web APIs
opening new windows, even with reduced features, uses co
nsiderably a lot of the user's system resources (cpu, ram) and involves co
nsiderably a lot of coding in the source code (security management, memory management, various code branchings sometimes quite complex, window frame/chrome/toolbars building, window positioning and sizing, etc.).
Window.openDialog() - Web APIs
i
nside the dialog code, you can set the properties as follows: var retvals = window.arguments[2]; retvals.address = enteredaddress; retvals.delivery = "immediate"; specification this is not part of any specification.
Window.pkcs11 - Web APIs
syntax objref = window.pkcs11 example window.pkcs11.addmodule(smod, secpath, 0, 0); notes see
nsidompkcs11 for more information about how to manipulate pkcs11 objects.
Window.speechSynthesis - Web APIs
i
nside the inputform.onsubmit handler, we stop the form submitting with preventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method.
WindowOrWorkerGlobalScope.btoa() - Web APIs
so if you pass a string into btoa() containing characters that occupy more than one byte, you will get an error, because this is not co
nsidered binary data: const ok = "a"; console.log(ok.codepointat(0).tostring(16)); // 61: occupies < 1 byte const notok = "✓" console.log(notok.codepointat(0).tostring(16)); // 2713: occupies > 1 byte console.log(btoa(ok)); // yq== console.log(btoa(notok)); // error if you need to encode unicode text as ascii using btoa(), one option is to convert the string such that each 16-bit unit occup...
WindowOrWorkerGlobalScope.origin - Web APIs
examples executed from i
nside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e.
Worker: messageerror event - Web APIs
bubbles no cancelable no interface messageevent event handler property onmessageerror examples create a worker, and listen for message and messageerror events using addeventlistener(): // i
nside main.js const worker = new worker("static/scripts/worker.js"); worker.addeventlistener("message", (event) => { console.error(`received message from worker: ${event}`); }); worker.addeventlistener("messageerror", (event) => { console.error(`error receiving message from worker: ${event}`); }); the same, but using the onmessageerror event handler property: // i
nside main.js const worker = new worker("static/scripts/worker.js"); ...
Worker - Web APIs
not all interfaces and functions are available to scripts i
nside a worker.
WorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you wanted to close your worker instance from i
nside the worker itself, you could call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from i
nside the worker's inner scope.
WorkerGlobalScope.dump() - Web APIs
for example, on mac os x you'd run it using something like this (assuming you are i
nside the applications folder): ./firefox.app/contents/macos/firefox-bin -profile /tmp -no-remote now go into about:config and enable the browser.dom.window.dump.enabled pref.
WorkerGlobalScope.importScripts() - Web APIs
example if you had some functionality written in a separate script called foo.js that you wanted to use i
nside worker.js, you could import it using the following line: importscripts('foo.js'); importscripts() and self.importscripts() are effectively equivalent — both represent importscripts() being called from i
nside the worker's inner scope.
WorkerGlobalScope.navigator - Web APIs
example if you call the following console.log(navigator); i
nside a worker (which would basically be the equivalent of self.console.log(self.navigator);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workernavigator object written to the console — something like the following: object {online: true, useragent: "mozilla/5.0 (macintosh; intel mac os x 10_10_1) ap…ml, like gecko) chrome/40.0.2214.93 safari/537.
WorkerGlobalScope.onclose - Web APIs
}; example the following code snippet shows an onclose handler set i
nside a worker: self.onclose = function() { console.log('your worker instance has been closed'); } specifications this feature is no longer defined in any specifications.
WorkerGlobalScope.onerror - Web APIs
}; example the following code snippet shows an onerror handler set i
nside a worker: self.onerror = function() { console.log('there is an error i
nside your worker!'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onerror' in that specification.
WorkerGlobalScope.onlanguagechange - Web APIs
}; example the following code snippet shows an onlanguagechange handler set i
nside a worker: self.onlanguagechange = function() { console.log('your preferred language settings have been changed'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onlanguagechange' in that specification.
WorkerGlobalScope.onoffline - Web APIs
}; example the following code snippet shows an onoffline handler set i
nside a worker: self.onoffline = function() { console.log('your worker is now offline'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onoffline' in that specification.
WorkerGlobalScope.ononline - Web APIs
}; example the following code snippet shows an ononline handler set i
nside a worker: self.ononline = function() { console.log('your worker is now online'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.ononline' in that specification.
WorkerGlobalScope.self - Web APIs
example if you called console.log(self); i
nside a worker, you will get a worker global scope of the same type as that worker object written to the console — something like the following: dedicatedworkerglobalscope { undefined: undefined, infinity: infinity, math: mathconstructor, nan: nan, intl: object…} infinity: infinity array: function array() { [native code] } arguments: null caller: null isarray: function i...
WorkerLocation - Web APIs
this interface is only visible from i
nside a javascript script executed in the context of a web worker.
WritableStream - Web APIs
i
nside this function it calls the stream's getwriter() method, which returns an instance of writablestreamdefaultwriter.
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
let error = cc["@mozilla.org/dom-error;1"].createinstance(ci.
nsidomdomerror); error.wrappedjsobject.init(errname); return error; // xxx: errtype goes unused } function dumpsecurityinfo(xhr, error) { let channel = xhr.channel; try { dump("connection status:\n"); if (!error) { dump("\tsucceeded\n"); } else { dump("\tfailed: " + error.name + "\n"); } let secinfo = channel.securityinfo; // print general connect...
XMLHttpRequest - Web APIs
if your communication needs to involve receiving event data or message data from a server, co
nsider using server-sent events through the eventsource interface.
XMLHttpRequestResponseType - Web APIs
you shouldn't use this non-standard (and, as of firefox 68, entirely removed) api; instead, co
nsider using the fetch api with readable streams, which offers a standard alternative to accessing the response in a streaming fashion.
XRBoundedReferenceSpace - Web APIs
these bounds are defined using an array of points, each of which defines a vertex in a polygon i
nside which the user is allowed to move.
XRReferenceSpace - Web APIs
geometry the native origin of any xrreferencespace is always configured so that +x is co
nsidered to be to the right, +y is upward, and +z is "backward" or toward the user.
XRViewport.y - Web APIs
note: although other web apis typically co
nsider 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.
XRWebGLLayer.framebuffer - Web APIs
opaque framebuffers are co
nsidered incomplete and are not available for rendering other than while executing the requestanimationframe() callback.
Using the link role - Accessibility
e.target : e.srcelement; if (ref) { window.open(ref.getattribute('data-href'), '_blank'); } } } spanelem.addeventlistener('click', navigatelink); spanelem.addeventlistener('keydown', navigatelink); result notes if pressing the link triggers an action but does not change browser focus or navigate to a new page, you might wish to co
nsider using the button role instead of the link role.
Using the log role - Accessibility
assistive technology products should listen for such an event and notify the user accordingly: screen readers should announce changes i
nside a log when the user is idle, unless aria-live=”assertive” has been set and in which case the user may be interrupted.
ARIA: alert role - Accessibility
<p role="alert" style="display: none;">the alert will trigger when the element becomes visible.</p> while triggering an alert via css alone is possible, it is better to rely on javascript because it has more browser/screen reader support and is often more appropriate as part of a larger user interaction such as i
nside an event handler or form validation.
ARIA: Comment role - Accessibility
19:29</time></p> </div> <div role="comment" id="thread-2" data-author="chris"> <h3>marcus said</h3> <p class="comment-text">the guitar solo could do with a touch more chorus, and a slightly lower volume.</p> <p><time datetime="2019-03-29t15:35">march 29 2019, 15:35</time></p> </div> nested comments nested comments are also possible with aria annotations — simply nest the comments i
nside one another, like so: <div role="comment" id="thread-1" data-author="chris"> <h3>chris said</h3> <p class="comment-text">i really think this moment could use more cowbell.</p> <p><time datetime="2019-03-30t19:29">march 30 2019, 19:29</time></p> <div role="comment" data-author="marcus"> <h3>marcus replied</h3> <p class="comment-text">i don't know about that.
ARIA: Region role - Accessibility
<div role="region" aria-labelledby="please-reco
nsider"> <h3 id="please-reco
nsider">please reco
nsider your document structure</h3> <!-- content --> </div> in this example, the region's label is being generated by the aria-labelledby attribute.
ARIA: heading role - Accessibility
instead of using a <div> or <span> with a heading role and aria-level, co
nsider using a native <h1> through <h6> element instead to indicate that this text is a heading, and what part of the structure it represents.
Forms - Accessibility
the following pages provide various techniques for improving the accessibility of web forms: basic form hints: adding hints and descriptions for invalid or required fields alerts: using alerts to provide client-side validation error messages multi-part labels: enabling complex form labels with a control i
nside each label see also the yahoo!
Architecture - Accessibility
in addition, nsiaccessiblehyperlink is implemented on any non-text child i
nside a container that also has text.
Keyboard - Accessibility
note: one important exception to this rule is if the element has role="document" applied to it, i
nside an interactive context (such as role="application").
Operable - Accessibility
2.4.8 location within site (aaa) when on a page i
nside a complex site or set of steps, the user should be given an indicator of where they are in the site, for example a breadcrumb trail, sitemap or text such as "form page 2 of 10".
-moz-context-properties - CSS: Cascading Style Sheets
of the fill and stroke properties, for example: <img class="img1" src="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'> <rect width='100%' height='100%' stroke-width='30px' fill='context-fill red' stroke='context-stroke' fill-opacity='0.5'/></svg>"> here we've set the image src to a data uri containing a simple svg image; the <rect> i
nside has been made to take its fill and stroke values from the fill and stroke set on the <img> element by giving them the context-fill/context-stroke keywords in their values, along with a fallback color for the fill (red) which will be used in the case that the svg is loaded standalone in a top-level window (where it will have no context element to provide context values).
:has() - CSS: Cascading Style Sheets
/* selects any <a>, as long as it has an <img> element directly i
nside it */ /* note that this is not supported in any browser yet */ let test = document.queryselector('a:has(> img)'); syntax :has( <relative-selector-list> )where <relative-selector-list> = <relative-selector>#where <relative-selector> = <combinator>?
:in-range - CSS: Cascading Style Sheets
/* selects any <input>, but only when it has a range specified, and its value is i
nside that range */ input:in-range { background-color: rgba(0, 255, 0, 0.25); } this pseudo-class is useful for giving the user a visual indication that a field's current value is within the permitted limits.
:lang() - CSS: Cascading Style Sheets
html <div lang="en"><q>this english quote has a <q>nested</q> quote i
nside.</q></div> <div lang="fr"><q>this french quote has a <q>nested</q> quote i
nside.</q></div> <div lang="de"><q>this german quote has a <q>nested</q> quote i
nside.</q></div> css :lang(en) > q { quotes: '\201c' '\201d' '\2018' '\2019'; } :lang(fr) > q { quotes: '« ' ' »'; } :lang(de) > q { quotes: '»' '«' '\2039' '\203a'; } result specifications specification status comme...
:only-of-type - CSS: Cascading Style Sheets
/* selects each <p>, but only if it is the */ /* only <p> element i
nside its parent */ p:only-of-type { background-color: lime; } note: as originally defined, the selected element had to have a parent.
:target - CSS: Cascading Style Sheets
isn't that delightful?</p> css p:target { background-color: gold; } /* add a pseudo-element i
nside the target element */ p:target::before { font: 70% sans-serif; content: "►"; color: limegreen; margin-right: .25em; } /* style italic elements within the target element */ p:target i { color: red; } result pure-css lightbox you can use the :target pseudo-class to create a lightbox without using any javascript.
font-style - CSS: Cascading Style Sheets
formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax normal | italic | oblique <angle>{0,2} examples specifying an italic font style as an example, co
nsider the garamond font family, in its normal form, we get the following result: @font-face { font-family: garamond; src: url('garamond.ttf'); } the italicized version of this text uses the same glyphs present in the unstyled version, but they are artificially sloped by a few degrees.
@import - CSS: Cascading Style Sheets
description imported rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @import cannot be used i
nside conditional group at-rules.
@keyframes - CSS: Cascading Style Sheets
when a keyframe is defined multiple times if a keyframe is defined multiple times but not all affected properties are in each keyframe, all values specified in these keyframes are co
nsidered.
color - CSS: Cascading Style Sheets
for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is co
nsidered to use 5 bits per color component.
overflow-block - CSS: Cascading Style Sheets
optional-paged content that overflows the block axis can be seen by scrolling to it, but page breaks can be manually triggered (such as via break-i
nside, etc.) to cause the following content to display on the following page.
size - CSS: Cascading Style Sheets
formal definition related at-rule@pageinitial valueautocomputed valueas specified, but with relative lengths converted into absolute lengths formal syntax <length>{1,2} | auto | [ <page-size> | [ portrait | landscape ] ] examples specifying size and orientation @page { size: 4in 6in landscape; } nesting i
nside a @media rule @media print { @page { size: 50mm 150mm; } } specifications specification status comment css paged media module level 3the definition of 'size' in that specification.
Border-image generator - CSS: Cascading Style Sheets
ue + 'px'; }; var setpreviewareaheight = function setpreviewareaheight(value) { preview_area.style.height = value + 'px'; }; var updatedragoption = function updatedragoption(value) { if (value === true) subject.setattribute('data-draggable', 'true'); else subject.removeattribute('data-draggable'); }; var createproperty = function createproperty(topic, labelid, optio
nsid) { var slider = inputslidermanager.createslider(topic, positions[labelid]); var dropdown = dropdownmanager.createdropdown(topic, dropdown_unit_options[optio
nsid]); inputslidermanager.setsensivity(topic, 3); inputslidermanager.setprecision(topic, 1); var property = document.createelement('div'); var config = document.createelement('div'); property.classname = 'property'; ...
CSS Multi-column Layout - CSS: Cascading Style Sheets
reference multiple-column layout properties column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns related css fragmentation properties break-after break-before break-i
nside orphans widows guides basic concepts of multicol an overview of the multiple-column layout specification styling columns how to use column rules and manage the spacing between columns.
CSS Display - CSS: Cascading Style Sheets
reference css properties display css data types <display-outside> <display-i
nside> <display-listitem> <display-box> <display-internal> <display-legacy> guides css flow layout (display: block, display: inline) block and inline layout in normal flow flow layout and overflow flow layout and writing modes formatting contexts explained in flow and out of flow display: flex basic concepts of flexbox aligning items in a flex container controlling ratios of flex items along the main axis cross-browser flexbox mixins mastering wrapping of flex items ordering flex items relationship of flexbox to other layo...
In Flow and Out of Flow - CSS: Cascading Style Sheets
taking an item out of flow all elements are in-flow apart from: floated items items with position: absolute (including position: fixed which acts in the same way) the root element (html) out of flow items create a new block formatting context (bfc) and therefore everything i
nside them can be seen as a mini layout, separate from the rest of the page.
Variable fonts guide - CSS: Cascading Style Sheets
working with older browsers variable font support can be checked with css feature queries (see @supports), so it's possible to use variable fonts in production and scope the css calling the variable fonts i
nside a feature query block.
Grid template areas - CSS: Cascading Style Sheets
olor: #ffd8a8; padding: 1em; color: #d9480f; } .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } .wrapper { display: grid; grid-auto-rows: minmax(100px, auto); grid-template-columns: 1fr; grid-template-areas: "hd" "main" "sd" "ft"; } we can then redefine that layout i
nside media queries to go to our two columns layout, and perhaps take it to a three column layout if the available space is even wider.
Selector list - CSS: Cascading Style Sheets
#main, .content, article { font-size: 1.1em; } selector list invalidation a dow
nside to using selector lists is that the following aren't equivalent: h1 { font-family: sans-serif } h2:maybe-unsupported { font-family: sans-serif } h3 { font-family: sans-serif } h1, h2:maybe-unsupported, h3 { font-family: sans-serif } this is because a single unsupported selector in a selector list invalidates the whole rule.
<alpha-value> - CSS: Cascading Style Sheets
examples setting text color opacity here an alpha value is used to set partially transparent text: /* <rgba()> */ color: rgba(34, 12, 64, 0.6); color: rgba(34.0 12 64 / 60%); setting shape image threshold here an alpha value is used to determine which parts of an image are co
nsidered part of a shape: /* shape-image-threshold */ shape-image-threshold: 70%; shape-image-threshold: 0.7; specifications specification status comment css color module level 4the definition of '<alpha-value>' in that specification.
animation - CSS: Cascading Style Sheets
co
nsider providing a mechanism for pausing or disabling animation, as well as using the reduced motion media query to create a complimentary experience for users who have expressed a preference for no animated experiences.
background-clip - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritednocomputed valueas specifiedanimation typediscrete formal syntax <box>#where <box> = border-box | padding-box | content-box examples html <p class="border-box">the background extends behind the border.</p> <p class="padding-box">the background extends to the i
nside edge of the border.</p> <p class="content-box">the background extends only to the edge of the content box.</p> <p class="text">the background is clipped to the foreground text.</p> css p { border: .8em darkviolet; border-style: dotted double; margin: 1em 0; padding: 1.4em; background: linear-gradient(60deg, red, yellow, red, yellow, red); font: 900 1.2em sans-serif; text-decorat...
border-image-slice - CSS: Cascading Style Sheets
the sampled image size is scaled to fit i
nside the border, which means that if the width is bigger than the slice, the image can start to look somewhat pixellated (unless of course you use an svg image).
box-ordinal-group - CSS: Cascading Style Sheets
formal definition initial value1applies tochildren of box elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples basic usage example in an older version of the spec, box-ordinal-group was included to allow you to change the display order of flex children i
nside a flex container: article:nth-child(1) { -webkit-box-ordinal-group: 2 -moz-box-ordinal-group: 2 box-ordinal-group: 2 } article:nth-child(2) { -webkit-box-ordinal-group: 1 -moz-box-ordinal-group: 1 box-ordinal-group: 1 } the modern flexbox equivalent is order.
direction - CSS: Cascading Style Sheets
unlike the dir attribute in html, the direction property is not inherited from table columns into table cells, since css inheritance follows the document tree, and table cells are i
nside of rows but not i
nside of columns.
<display-outside> - CSS: Cascading Style Sheets
these keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the level 3 specification alongside a value from the <display-i
nside> keywords.
env() - CSS: Cascading Style Sheets
for non-rectangular displays — like a round watch face — the four values set by the user agent form a rectangle such that all content i
nside the rectangle is visible.
<filter-function> - CSS: Cascading Style Sheets
examples filter function comparison this example provides a simple graphic, along with a select menu to allow you to choose between the different types of filter function, and a slider to allow you to vary the values used i
nside the filter function.
image-rendering - CSS: Cascading Style Sheets
if system resources are constrained, images with high-quality should be prioritized over those with any other value, when co
nsidering which images to degrade the quality of and to what degree.
left - CSS: Cascading Style Sheets
n in relation to its siblings.</p> </div> <div id="example_3"> <pre> float: right; position: relative; top: 20px; left: 20px; </pre> <p>relative to its sibling div above, but removed from flow of content.</p> <div id="example_4"> <pre> position: absolute; bottom: 10px; right: 20px; </pre> <p>absolute position i
nside of a parent with relative position</p> </div> <div id="example_5"> <pre> position: absolute; right: 0; left: 0; top: 200px; </pre> <p>absolute position with both left and right declared</p> </div> </div> </div> css #wrap { width: 700px; margin: 0 auto; background: #5c5c5c; } pre { white-space: pre; white-space: pre-wrap; ...
text-combine-upright - CSS: Cascading Style Sheets
/* keyword values */ text-combine-upright: none; text-combine-upright: all; /* digits values */ text-combine-upright: digits; /* fits 2 consecutive digits horizontally i
nside vertical text */ text-combine-upright: digits 4; /* fits up to 4 consecutive digits horizontally i
nside vertical text */ /* global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset; syntax values none there is no special processing.
text-decoration-color - CSS: Cascading Style Sheets
)where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> examples <p>this paragraph has <s>some erroneous text</s> i
nside it that i want to call attention to.</p> p { text-decoration-line: underline; text-decoration-color: cyan; } s { text-decoration-line: line-through; text-decoration-color: red; text-decoration-style: wavy; } specifications specification status comment css text decoration module level 3the definition of 'text-decoration-color' in that specification.
text-emphasis-position - CSS: Cascading Style Sheets
in html, this can be done with the following pattern: em { text-emphasis: dot; /* set text-emphasis for <em> elements */ } em rt { display: none; /* hide ruby i
nside <em> elements */ } specifications specification status comment css text decoration module level 3the definition of 'text-emphasis' in that specification.
transform - CSS: Cascading Style Sheets
also, co
nsider making use of the prefers-reduced-motion media feature — use it to write a media query that will turn off animations if the user has reduced animation specified in their system preferences.
var() - CSS: Cascading Style Sheets
for example, var(--foo, red, blue) defines a fallback of red, blue; that is, anything between the first comma and the end of the function is co
nsidered a fallback value.
CSS: Cascading Style Sheets
css layout at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits i
nside.
Adding captions and subtitles to HTML5 video - Developer guides
we actually have our subtitles in three different languages — english, german, and spanish — so we will reference all three of the relevant vtt files by adding <track> elements i
nside our html5 <video> element: <video id="video" controls preload="metadata"> <source src="video/sintel-short.mp4" type="video/mp4"> <source src="video/sintel-short.webm" type="video/webm"> <track label="english" kind="subtitles" srclang="en" src="captions/vtt/sintel-en.vtt" default> <track label="deutsch" kind="subtitles" srclang="de" src="captions/vtt/sintel-de.vtt"> <track label="...
Cross-browser audio basics - Developer guides
an audio player with feedback co
nsider this snippet of html: <audio id="my-audio"> <source src="https://udn.realityripple.com/samples/6c/d385042de2.mp3" type="audio/mpeg"> <source src="https://udn.realityripple.com/samples/28/191a7bd2a5.ogg" type="audio/ogg"> <!-- place fallback here as <audio> supporting browsers will ignore it --> <a href="audiofile.mp3">audiofile.mp3</a> </audio> <div id="controls"> <span id="loading"...
Media buffering, seeking, and time ranges - Developer guides
this will work with <audio> or <video>; for now let's co
nsider a simple audio example: <audio id="my-audio" controls src="music.mp3"> </audio> we can access these attributes like so: var myaudio = document.getelementbyid('my-audio'); var bufferedtimeranges = myaudio.buffered; timeranges object timeranges are a series of non-overlapping ranges of time, with start and stop times.
Challenge solutions - Developer guides
solution the following rule puts borders around only <td> elements that are i
nside the <tbody> element of the table with id=demo-table: #demo-table tbody td { border:1px solid #7a7; } media separate print style file challenge move the print-specific style rules to a separate css file and import them into your style4.css stylesheet.
Creating and triggering events - Developer guides
, and provide any data you want to pass to the "detail" property const eventawesome = new customevent('awesome', { bubbles: true, detail: { text: () => textarea.value } }); // the form element listens for the custom "awesome" event and then consoles the output of the passed text() method form.addeventlistener('awesome', e => console.log(e.detail.text())); // as the user types, the textarea i
nside the form dispatches/triggers the event to fire, and uses itself as the starting point textarea.addeventlistener('input', e => e.target.dispatchevent(eventawesome)); creating and dispatching events dynamically elements can listen for events that haven't been created yet: <form> <textarea></textarea> </form> const form = document.queryselector('form'); const textarea = document.queryselect...
Making content editable - Developer guides
for example, even something as simple as what happens when you press enter/return to create a new line of text i
nside an editable element was handled differently across the major browsers (firefox inserted <br> elements, ie/opera used <p>, chrome/safari used <div>).
HTML5 Parser - Developer guides
if an attacker could force a premature end-of-file, the parser might change which parts of the document it co
nsidered to be executable scripts.
XHTML - Developer guides
the problems are described in more details in the following articles: beware of xhtml by david hammond sending xhtml as text/html co
nsidered harmful by ian hickson xhtml's dirty little secret by mark pilgrim xhtml - what's the point?
Index - Developer guides
12 setting up adaptive streaming media sources audio, hls, html5, http live streaming, mpeg-dash, video, adaptive streaming let's say you want to set up an adaptive streaming media source on a server, to be consumed i
nside an html5 media element.
Writing forward-compatible websites - Developer guides
for example, if you have tested that your default code path runs properly in firefox aurora but firefox beta and the latest release have a bug that make your default code path fail, it is ok to treat the firefox version number that is in aurora at the moment of testing as "current", and co
nsider the beta version as a "past" version even though it hasn't been released to the general public yet.
HTML attribute: pattern - HTML: Hypertext Markup Language
specifying a pattern you can use the pattern attribute to specify a regular expression that the inputted value must match in order to be co
nsidered valid (see validating against a regular expression for a simple crash course on using regular expressions to validate inputs).
<hgroup> - HTML: Hypertext Markup Language
<hgroup> might be shown in a rendered outline in with a colon character and space (“: ”) or other such punctuation after the primary heading and before the first secondary heading (and with the same or similar punctuation before any other secondary headings an <hgroup> might be shown in a rendered outline in with the primary heading followed by parentheses around the secondary heading(s) co
nsider the following html document: <!doctype html> <title>html standard</title> <body> <hgroup id="document-title"> <h1>html</h1> <h2>living standard — last updated 12 august 2016</h2> </hgroup> <p>some intro to the document.</p> <h2>table of contents</h2> <ol id=toc>...</ol> <h2>first section</h2> <p>some intro to the first section.</p> </body> a rendered outline for that d...
<input type="color"> - HTML: Hypertext Markup Language
for example, in safari 10.1, you would see something that looks looks like this: the same content looks like this in firefox 55: in this case, clicking on the color well presents the platform's color picker for you to choose a color from (in this case, the macos picker): validation a color input's value is co
nsidered to be invalid if the user agent is unable to convert the user's input into seven-character lower-case hexadecimal notation.
<ol>: The Ordered List element - HTML: Hypertext Markup Language
--> <ol> <li>second item first subitem</li> <li>second item second subitem</li> <li>second item third subitem</li> </ol> </li> <!-- here's the closing </li> tag --> <li>third item</li> </ol> the above html will output: unordered list i
nside ordered list <ol> <li>first item</li> <li>second item <!-- closing </li> tag not here!
<samp>: The Sample Output element - HTML: Hypertext Markup Language
for example, co
nsider this text presenting a transcript of a linux (or macos) console session: html <pre> <samp><span class="prompt">mike@interwebz:~$</span> <kbd>md5 -s "hello world"</kbd> md5 ("hello world") = 3e25960a79dbc69b674cd4ec67a72c62 <span class="prompt">mike@interwebz:~$</span> <span class="cursor">█</span></samp></pre> note the use of <span> to allow customization of the appearance of specific por...
<slot> - HTML: Hypertext Markup Language
the html <slot> element—part of the web components technology suite—is a placeholder i
nside a web component that you can fill with your own markup, which lets you create separate dom trees and present them together.
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
other elements to co
nsider using in most cases, you should use an element other than <u>, such as: <em> to denote stress emphasis <b> to draw attention to text <mark> to mark key words or phrases <strong> to indicate that text has strong importance <cite> to mark the titles of books or other publications <i> to denote technical terms, transliterations, thoughts, or names of vessels in western texts to provide ...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
m second subitem second sub-subitem</li> <li>second item second subitem third sub-subitem</li> </ul> </li> <!-- closing </li> tag for the li that contains the third unordered list --> <li>second item third subitem</li> </ul> <!-- here is the closing </li> tag --> </li> <li>third item</li> </ul> the above html will output: ordered list i
nside unordered list <ul> <li>first item</li> <li>second item <!-- look, the closing </li> tag is not placed here!
ETag - HTTP
if a user visits a given url again (that has an etag set), and it is stale (too old to be co
nsidered usable), the client will send the value of its etag along in an if-none-match header field: if-none-match: "33a64df551425fcc55e4d42a148795d9f25f89d4" the server compares the client's etag (sent with if-none-match) with the etag for its current version of the resource, and if both values match (that is, the resource has not changed), the server sends back a 304 not modified status, without a...
Expires - HTTP
the expires header contains the date/time after which the response is co
nsidered stale.
If-Match - HTTP
the comparison with the stored etag uses the strong comparison algorithm, meaning two files are co
nsidered identical byte to byte only.
Index - HTTP
62 expires caching, http, response, header the expires header contains the date/time after which the response is co
nsidered stale.
Server-Timing - HTTP
co
nsider to control which metrics are returned when and to whom on the server side.
Vary - HTTP
examples dynamic serving when using the vary: user-agent header, caching servers should co
nsider the user agent when deciding whether to serve the page from cache.
HTTP Index - HTTP
121 expires caching, http, response, header the expires header contains the date/time after which the response is co
nsidered stale.
PATCH - HTTP
a patch request is co
nsidered a set of instructions on how to modify a resource.
Network Error Logging - HTTP
usage web applications opt in to this behaviour with the nel header, which is a json-encoded object: nel: { "report_to": "nel", "max_age": 31556952 } an origin co
nsidered secure by the browser is required.
416 Range Not Satisfiable - HTTP
content-range: bytes */12777 faced with this error, browsers usually either abort the operation (for example, a download will be co
nsidered as non-resumable) or ask for the whole document again.
HTTP response status codes - HTTP
208 already reported (webdav) used i
nside a <dav:propstat> response element to avoid repeatedly enumerating the internal members of multiple bindings to the same collection.
Introduction - JavaScript
i
nside a host environment (for example, a web browser), javascript can be connected to the objects of its environment to provide programmatic control over them.
Unicode property escapes - JavaScript
note: for unicode property escapes to work, a regular expression must use the u flag which indicates a string must be co
nsidered as a series of unicode code points.
Memory Management - JavaScript
however, the reference-counting algorithm will not co
nsider them reclaimable since each of the two objects has at least one reference pointing to them, resulting in neither of them being marked for garbage collection.
Public class fields - JavaScript
class classwithfancymethods { *generatormethod() { } async asyncmethod() { } async *asyncgeneratormethod() { } } i
nside instance methods, this refers to the instance itself.
SyntaxError: missing ) after argument list - JavaScript
console.log('pi: ' math.pi); // syntaxerror: missing ) after argument list you can correct the log call by adding the "+" operator: console.log('pi: ' + math.pi); // "pi: 3.141592653589793" unterminated strings console.log('"java" + "script" = \"' + 'java' + 'script\"); // syntaxerror: missing ) after argument list here javascript thinks that you meant to have ); i
nside the string and ignores it, and it ends up not knowing that you meant the ); to end the function console.log.
InternalError: too much recursion - JavaScript
get name(){ return this.name; // recursive call } to avoid this problem, make sure that the property being assigned to i
nside the setter function is different from the one that initially triggered the setter.the same goes for the getter.
Arrow function expressions - JavaScript
var func = () => { foo: function() {} }; // syntaxerror: function statement requires a name this is because the code i
nside braces ({}) is parsed as a sequence of statements (i.e.
Default parameters - JavaScript
it also means that variables declared i
nside the function body using var will mask parameters of the same name, instead of the usual behavior of duplicate var declarations having no effect.
Array.prototype.findIndex() - JavaScript
callback is invoked with three arguments: the value of the element the index of the element the array object being traversed if a thisarg parameter is passed to findindex(), it will be used as the this i
nside each invocation of the callback.
Array.isArray() - JavaScript
var iframe = document.createelement('iframe'); document.body.appendchild(iframe); xarray = window.frames[window.frames.length-1].array; var arr = new xarray(1,2,3); // [1,2,3] // correctly checking for array array.isarray(arr); // true // co
nsidered harmful, because doesn't work through iframes arr instanceof array; // false specifications specification ecmascript (ecma-262)the definition of 'array.isarray' in that specification.
Array.prototype.shift() - JavaScript
console.log('myfish before:', json.stringify(myfish)); // myfish before: ['angel', 'clown', 'mandarin', 'surgeon'] var shifted = myfish.shift(); console.log('myfish after:', myfish); // myfish after: ['clown', 'mandarin', 'surgeon'] console.log('removed this element:', shifted); // removed this element: angel using shift() method in while loop the shift() method is often used in condition i
nside while loop.
Array - JavaScript
in general, these are convenient characteristics; but if these features are not desirable for your particular use, you might co
nsider using typed arrays.
BigInt - JavaScript
type information when tested against typeof, a bigint will give "bigint": typeof 1n === 'bigint' // true typeof bigint('1') === 'bigint' // true when wrapped in an object, a bigint will be co
nsidered as a normal "object" type: typeof object(1n) === 'object' // true operators the following operators may be used with bigints (or object-wrapped bigints): +, *, -, **, %.
Error.prototype.stack - JavaScript
text: error("myerror")@:0 trace()@file:///c:/example.html:9 b(3,4,"\n\n",(void 0),[object object])@file:///c:/example.html:16 a("first call, firstarg")@file:///c:/example.html:19 @file:///c:/example.html:21 stack of eval'ed code starting with firefox 30, the error stack of code in function() and eval() calls, now produces stacks with more detailed information about the line and column numbers i
nside these calls.
Function.caller - JavaScript
co
nsider: function f(n) { g(n - 1); } function g(n) { if (n > 0) { f(n); } else { stop(); } } f(2); at the moment stop() is called the call stack will be: f(2) -> g(1) -> f(1) -> g(0) -> stop() the following is true: stop.caller === g && f.caller === g && g.caller === f so if you tried to get the stack trace in the stop() function like this: var f = stop; var stack = 'stack trace:'; while (f) ...
Intl.Collator.prototype.compare() - JavaScript
description the compare getter function returns a number indicating how string1 and string2 compare to each other according to the sort order of this collator object: a negative value if string1 comes before string2; a positive value if string1 comes after string2; 0 if they are co
nsidered equal.
Intl.Collator.supportedLocalesOf() - JavaScript
the language tags returned are those for which the runtime supports a locale in collation that the locale matching algorithm used co
nsiders a match, so that it wouldn't have to fall back to the default locale.
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
the language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used co
nsiders a match, so that it wouldn't have to fall back to the default locale.
Intl.DisplayNames.supportedLocalesOf() - JavaScript
the language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used co
nsiders a match, so that it wouldn't have to fall back to the default locale.
Intl.ListFormat.supportedLocalesOf() - JavaScript
the language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used co
nsiders a match, so that it wouldn't have to fall back to the default locale.
Object - JavaScript
let o = new object() let o = new object(undefined) let o = new object(null) using object to create boolean objects the following examples store boolean objects in o: // equivalent to o = new boolean(true) let o = new object(true) // equivalent to o = new boolean(false) let o = new object(boolean()) object prototypes when altering the behavior of existing object.prototype methods, co
nsider injecting code by wrapping your extension before or after the existing logic.
Promise - JavaScript
if you are looking to lazily evaluate an expression, co
nsider the arrow function with no arguments: f = () => expression to create the lazily-evaluated expression, and f() to evaluate.
RegExp.prototype.exec() - JavaScript
description co
nsider the following example: // match "quick brown" followed by "jumps", ignoring characters in between // remember "brown" and "jumps" // ignore case let re = /quick\s(brown).+?(jumps)/ig; let result = re.exec('the quick brown fox jumps over the lazy dog'); the following table shows the results for this script: object property/index description example result ...
String.prototype.normalize() - JavaScript
log(string2.length); // 2 string1 = string1.normalize('nfkd'); string2 = string2.normalize('nfkd'); console.log(string1); // ff <- visual appearance changed console.log(string2); // ff console.log(string1 === string2); // true console.log(string1.length); // 2 console.log(string2.length); // 2 when applying compatibility normalization it's important to co
nsider what you intend to do with the strings, since the normalized form may not be appropriate for all applications.
Symbol.iterator - JavaScript
utes of symbol.iterator writable no enumerable no configurable no examples user-defined iterables we can make our own iterables like this: var myiterable = {} myiterable[symbol.iterator] = function* () { yield 1; yield 2; yield 3; }; [...myiterable] // [1, 2, 3] or iterables can be defined directly i
nside a class or object using a computed property: class foo { *[symbol.iterator] () { yield 1; yield 2; yield 3; } } const someobj = { *[symbol.iterator] () { yield 'a'; yield 'b'; } } [...new foo] // [ 1, 2, 3 ] [...someobj] // [ 'a', 'b' ] non-well-formed iterables if an iterable's @@iterator method does not return an iterator object, then it is a non-well-formed i...
WeakSet - JavaScript
weaksets are ideal for this purpose: // execute a callback on everything stored i
nside an object function execrecursively(fn, subject, _refs = null){ if(!_refs) _refs = new weakset(); // avoid infinite recursion if(_refs.has(subject)) return; fn(subject); if("object" === typeof subject){ _refs.add(subject); for(let key in subject) execrecursively(fn, subject[key], _refs); } } const foo = { foo: "foo", bar: { bar: "bar" } }; foo.bar.baz = foo; // circular...
WebAssembly.Module.exports() - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method, invoke an exported function from i
nside it, then show how we can return information on the available exports on a module using webassembly.module.exports.
WebAssembly.Module - JavaScript
when the module is received, we create an instance from it using the webassembly.instantiate() method and invoke an exported function from i
nside it.
const - JavaScript
all the co
nsiderations about the "temporal dead zone" apply to both let and const.
export - JavaScript
this can be achieved with the "export from" syntax: export { default as function1, function2 } from 'bar.js'; which is comparable to a combination of import and export: import { default as function1, function2 } from 'bar.js'; export { function1, function2 }; but where function1 and function2 do not become available i
nside the current module.
for...in - JavaScript
iterating over own properties only if you only want to co
nsider properties attached to the object itself, and not its prototypes, use getownpropertynames() or perform a hasownproperty() check (propertyisenumerable() can also be used).
for...of - JavaScript
examples iterating over an array const iterable = [10, 20, 30]; for (const value of iterable) { console.log(value); } // 10 // 20 // 30 you can use let instead of const too, if you reassign the variable i
nside the block.
for - JavaScript
indeed, without the semicolon the line that follows the cycle declaration will be co
nsidered a statement.
function* - JavaScript
much like a return statement, an error is thrown i
nside the generator will make the generator finished -- unless caught within the generator's body.
switch - JavaScript
if the expression matches the specified valuen, the statements i
nside the case clause are executed until either the end of the switch statement or a break.
try...catch - JavaScript
this includes exceptions thrown i
nside of the catch-block: (function() { try { try { throw new error('oops'); } catch (ex) { console.error('inner', ex.message); throw ex; } finally { console.log('finally'); return; } } catch (ex) { console.error('outer', ex.message); } })(); // output: // "inner" "oops" // "finally" the outer "oops" is not thrown because of the retu...
Transitioning to strict mode - JavaScript
strictness-neutral code a potential "dow
nside" of moving strict code to strict mode is that the semantics may be different in legacy browsers which do not implement strict mode.
scope - Web app manifests
if the user navigates outside the scope, it reverts to a normal web page i
nside a browser tab or window.
<math> - MathML
it can have one of the following values: block, which means that this element will be displayed outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be displayed i
nside the current span of text, and cannot be moved out of it without changing the meaning of that text.
<menclose> - MathML
the mathml <menclose> element renders its content i
nside an enclosing notation specified by the notation attribute.
Critical rendering path - Web Performance
if another set of starttag and endtag tokens come between a set of starttag and endtags, you have a node i
nside a node, which is how we define the hierarchy of the dom tree.
Using dns-prefetch - Web Performance
second, it’s also possible to specify dns-prefetch (and other resources hints) as an http header by using the http link field: link: <https://fonts.gstatic.com/>; rel=dns-prefetch third, co
nsider pairing dns-prefetch with the preconnect hint.
Privacy, permissions, and information security
keeping personal data safe managing site permissions bringing it all together <using feature policy with permissions and so forth; how to use them together, how they interact, etc> permission requests in <iframe> elements things can get tricky when your web app uses the <iframe> element to embed content from another site i
nside your own, especially if the document you load into the frame has its own permission needs to co
nsider.
Media - Progressive web apps (PWAs)
you can control how the content of the document breaks across page boundaries, by using the page-break-before, page-break-after and page-break-i
nside properties.
Web technology reference
if you're new to web development, co
nsider starting with our learning area, which is filled with step-by-step tutorials that will guide you from total webdev newbie to at least semi-pro!
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
example: masking for example, you can make a gradient mask for html content using svg and css code similar to the following, i
nside your html document: <svg height="0"> <mask id="mask-1"> <lineargradient id="gradient-1" y2="1"> <stop stop-color="white" offset="0"/> <stop stop-opacity="0" offset="1"/> </lineargradient> <circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/> <rect x="0.5" y="0.2" width="300" height="100" fill="url(#gradient-1)"/> </mask> </svg> .target { mask: url(#...
display - SVG: Scalable Vector Graphics
"skyblue"></rect> <rect x="20" y="20" width="60" height="60" fill="yellow"></rect> <!-- here the yellow rectangle is not displayed --> <rect x="120" y="0" width="100" height="100" fill="skyblue"></rect> <rect x="140" y="20" width="60" height="60" fill="yellow" display="none"></rect> </svg> usage notes default value inline value [ <display-outside> | <display-i
nside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy>where <display-outside> = block | inline | run-in<display-i
nside> = flow | flow-root | table | flex | grid | ruby<display-listitem> = <display-outside>?
in - SVG: Scalable Vector Graphics
workaround for backgroundimage instead of using in="backgroundimage", we need to import one of the images to blend i
nside the filter itself, using an <feimage> element.
mask - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <mask id="mymask" maskcontentunits="objectboundingbox"> <rect fill="white" x="0" y="0" width="100%" height="100%" /> <polygon fill="black" points="0.5,0.2 0.68,0.74 0.21,0.41 0.79,0.41 0.32,0.74" /> </mask> <!-- punch a hole in a shape of a star i
nside the red circle, revealing the yellow circle underneath --> <circle cx="50" cy="50" r="20" fill="yellow" /> <circle cx="50" cy="50" r="45" fill="red" mask="url(#mymask)"/> </svg> since svg2, the mask attribute is defined as a css property and is a shorthand for many other properties: mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-size, and ma...
points - SVG: Scalable Vector Graphics
olygon> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- it is usualy co
nsidered best practices to separate a x and y coordinate with a comma and a group of coordinates by a space.
textLength - SVG: Scalable Vector Graphics
html the html is also simple, with only two displayed elements contained i
nside a grouping <div>: <div class="controls"> <input type="range" id="widthslider" min="80" max="978"> <span id="widthdisplay"></span> </div> the <input> element, of type "range", is used to create the slider control the user will manipulate to change the width of the text.
<a> - SVG: Scalable Vector Graphics
0 100" xmlns="http://www.w3.org/2000/svg"> <!-- a link around a shape --> <a href="/docs/web/svg/element/circle"> <circle cx="50" cy="40" r="35"/> </a> <!-- a link around a text --> <a href="/docs/web/svg/element/text"> <text x="50" y="90" text-anchor="middle"> <circle> </text> </a> </svg> /* as svg does not provide a default visual style for links, it's co
nsidered best practice to add some */ @namespace svg url(http://www.w3.org/2000/svg); /* necessary to select only svg <a> elements, and not also html’s.
<animate> - SVG: Scalable Vector Graphics
co
nsider providing a mechanism for pausing or disabling animation, as well as using the reduced motion media query to create a complimentary experience for users who have expressed a preference for no animated experiences.
<clipPath> - SVG: Scalable Vector Graphics
--> <circle cx="40" cy="35" r="35" /> </clippath> <!-- the original black heart, for reference --> <path id="heart" d="m10,30 a20,20,0,0,1,50,30 a20,20,0,0,1,90,30 q90,60,50,90 q10,60,10,30 z" /> <!-- only the portion of the red heart i
nside the clip circle is visible.
<linearGradient> - SVG: Scalable Vector Graphics
value type: <url> ; default value: none; animatable: yes spreadmethod this attribute indicates how the gradient behaves if it starts or ends i
nside the bounds of the shape containing the gradient.
<radialGradient> - SVG: Scalable Vector Graphics
value type: <length> ; default value: 50%; animatable: yes spreadmethod this attribute indicates how the gradient behaves if it starts or ends i
nside the bounds of the shape containing the gradient.
SVG image element - SVG: Scalable Vector Graphics
in this basic example, a .jpg image referenced by an href attribute will be rendered i
nside an svg object: <?xml version="1.0" standalone="no"?> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg width="5cm" height="4cm" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <image href="firefox.jpg" x="0" y="0" height="50px" width="50px"/> </svg> there are some important things to take note of (referenced from the w3 specs): if you do not set the x or y attributes, they will be set to 0.
Information Security Basics - Web security
confidentiality, integrity, and availability describes the primary security objectives, which are absolutely fundamental to understanding security security controls defines major categories of security controls and discusses their potential disadvantages tcp/ip security an overview of the tcp/ip model, with a focus on the security co
nsiderations for ssl threats briefly introduces major threat concepts vulnerabilities defines the major categories of vulnerabilities and discusses the presence of vulnerabilities in all software ...
Same-origin policy - Web security
therefore, https://company.com:81/index.html and https://company.com/index.html are co
nsidered the same origin and no restrictions are applied.
Tutorials
intermediate level css layout at this point we've already looked at css fundamentals, how to style text, and how to style and manipulate the boxes that your content sits i
nside.
XPath
if you need a polyfill, you may co
nsider js-xpath or wicked-good-xpath.
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
for example, assume that a variable "image-dir" is defined as follows: <xsl:variable name="image-dir">/images</xsl:variable> the expression to be evaluated is placed i
nside curly brackets: <img src="{$image-dir}/mygraphic.jpg"/> this would result in the following: <img src="/images/mygraphic.jpg"/> the element annotations that follow include a description, a syntax listing, a list of required and optional attributes, a description of type and position, its source in the w3c recommendation and an explanation of the degree of present gecko support.
Caching compiled WebAssembly modules - WebAssembly
the function starts off by defining some necessary constants: function instantiatecachedurl(dbversion, url, importobject) { const dbname = 'wasm-cache'; const storename = 'wasm-cache'; setting up the database the first helper function contained i
nside instantiatecachedurl() — opendatabase() — creates an object store for storing wasm modules, and also handles clearing out the database if the dbversion is updated; it returns a promise resolving to the new database.