Search completed in 1.46 seconds.
1454 results for "child":
Your results are loading. Please wait...
:nth-child() - CSS: Cascading Style Sheets
Element indices are 1-based. Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even Represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. ...
...Element indices are 1-based. Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even Represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. ...
...Element indices are 1-based. Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc. even Represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc. ...
...And 14 more matches
:nth-last-child() - CSS: Cascading Style Sheets
Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. ...
... Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. ...
... Keyword values odd Represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. ...
...And 12 more matches
Node.childNodes - Web APIs
Web › API › Node › childNodes
The Node.childNodes read-only property returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. ...
... The Node.childNodes read-only property returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. ...
... The Node.childNodes read-only property returns a live NodeList of child nodes of the given element where the first child node is assigned index 0. ...
...And 10 more matches
ChildNode.after() - Web APIs
Web › API › ChildNode › after
The ChildNode.after() method inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.after((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...Node. DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.after((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
... Text nodes. Syntax [Throws, Unscopable] void ChildNode.after((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...And 9 more matches
Node.removeChild() - Web APIs
Web › API › Node › removeChild
The Node.removeChild() method removes a child node from the DOM and returns the removed node. Syntax var oldChild = node.removeChild(child); OR node.removeChild(child); child is the child node to be removed from the DOM. node is the parent node of child. oldChild holds a reference to the removed child node, i.e., oldChild === child. The removed child node still exists in memory, but is no longer part of the DOM. With the first syntax form shown, you may reuse the removed node later in your code, via the oldChild object reference. ...
... If child is actually not a child of the element node, the method throws an exception. ...
...the first syntax form shown, you may reuse the removed node later in your code, via the oldChild object reference. In the second syntax form, however, there is no oldChild reference kept, so assuming your code has not kept any other reference to the node elsewhere, it will immediately become unusable and irretrievable, and will usually be automatically deleted from memory after a short time. ...
...And 9 more matches
ChildNode.before() - Web APIs
Web › API › ChildNode › before
The ChildNode.before() method inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.before((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...ode. DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.before((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...Text nodes. Syntax [Throws, Unscopable] void ChildNode.before((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...And 8 more matches
system/child_process - Archive of obsolete content
Experimental An implementation of the node.js child_process API. This module enables you to execute a child program in a new process. Since it emulates the node.js child_process API, it's not documented separately here. However, there are a few differences to be aware of: you need to require() the module using require("sdk/system/child_process") fork() is not supported gid and uid are not supported in node.js, spawn() and exec() inherit the environment variables from the parent process, by default. The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
...you need to require() the module using require("sdk/system/child_process") fork() is not supported gid and uid are not supported in node.js, spawn() and exec() inherit the environment variables from the parent process, by default. The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
...cess") fork() is not supported gid and uid are not supported in node.js, spawn() and exec() inherit the environment variables from the parent process, by default. The SDK versions don't: so when you specify a command you must pass in a complete path to the command or use the env option to set up the child process environment. ...
...And 7 more matches
ParentNode.childElementCount - Web APIs
node An object representing a Document, DocumentFragment, or Element. ...
... node An object representing a Document, DocumentFragment, or Element. ...
... node An object representing a Document, DocumentFragment, or Element. ...
...And 6 more matches
:only-child - CSS: Cascading Style Sheets
The :only-child CSS pseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity. /* Selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { background-color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...ut any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity. /* Selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { background-color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...nth-child(1):nth-last-child(1), but with a lower specificity. /* Selects each <p>, but only if it is the */ /* only child of its parent */ p:only-child { background-color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...And 5 more matches
ParentNode.firstElementChild - Web APIs
The ParentNode.firstElementChild read-only property returns the object's first child Element, or null if there are no child elements. This property was initially defined in the ElementTraversal pure interface. As this interface contained two distinct set of properties, one aimed at Node that have children, one at those that are children, they have been moved into two separate pure interfaces, ParentNode and ChildNode. In this case, firstElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. ...
...versal pure interface. As this interface contained two distinct set of properties, one aimed at Node that have children, one at those that are children, they have been moved into two separate pure interfaces, ParentNode and ChildNode. In this case, firstElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. Syntax var element = node.firstElementChild; Example <ul id="foo"> <li>First (1)</li> <li>Second (2)</li> <li>Third (3)</li> </ul> <script> var foo = document.getElementById('foo'); // yields: First (1) console.log(foo.firstElementChild.textContent); </script> Polyfill for IE8, IE9 and Safari // Overwrites native 'firstElementChild' prototype. // Adds Document & DocumentFragment support for IE9 & Safari. ;(function(construc...
...pt> var foo = document.getElementById('foo'); // yields: First (1) console.log(foo.firstElementChild.textContent); </script> Polyfill for IE8, IE9 and Safari // Overwrites native 'firstElementChild' prototype. // Adds Document & DocumentFragment support for IE9 & Safari. ...
...And 4 more matches
ParentNode.lastElementChild - Web APIs
The ParentNode.lastElementChild read-only property returns the object's last child Element or null if there are no child elements. Note: This property was initially defined in the ElementTraversal pure interface. As this interface contained two distinct set of properties, one aimed at Node that have children, one at those that are children, they have been moved into two separate pure interfaces, ParentNode and ChildNode. In this case, lastElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. ...
...versal pure interface. As this interface contained two distinct set of properties, one aimed at Node that have children, one at those that are children, they have been moved into two separate pure interfaces, ParentNode and ChildNode. In this case, lastElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. ...
...separate pure interfaces, ParentNode and ChildNode. In this case, lastElementChild moved to ParentNode. This is a fairly technical change that shouldn't affect compatibility. Syntax const element = node.lastElementChild Example <ul id="foo"> <li>First (1)</li> <li>Second (2)</li> <li>Third (3)</li> </ul> <script> const foo = document.getElementById('foo'); console.log(foo.lastElementChild.textContent); // logs: Third (3) </script> Polyfill The code below adds support of lastElementChild() to Document and DocumentFragment in Internet Explorer and Safari. // Overwrites native 'lastElementChild' prototype. // Returns array instead of HTMLCollection. ...
...And 4 more matches
Accessing XML children - Archive of obsolete content
<< PreviousNext >> Accessing XML Children Warning: E4X is deprecated. It will be disabled by default for content in Firefox 16, disabled by default for chrome in Firefox 17, and removed in Firefox 18. Use DOMParser/DOMSerializer or a non-native JXON algorithm instead. Normal JavaScript Objects use the . operator or [] notation to set properties. var a = {}; a.foo = 1; a["bar"] = 2; In E4X, the . and [] operators provide access to the child nodes of an E4X element. var element1 = <foo> <bar/> </foo>; var element2 = <baz/>; element1.bar.appendChild(element2); element1["bar"].appendChild(<quux/>); adds a child to the "bar" child node of element1. This gives an XML document of <foo> <bar> <baz/> <quux/> </bar> </foo> Note, however, that...
...ide access to the child nodes of an E4X element. var element1 = <foo> <bar/> </foo>; var element2 = <baz/>; element1.bar.appendChild(element2); element1["bar"].appendChild(<quux/>); adds a child to the "bar" child node of element1. This gives an XML document of <foo> <bar> <baz/> <quux/> </bar> </foo> Note, however, that assigning a non-XML value to a child element that doesn't exist will create that element. var element1 = <foo/> element1.bar = 1; produces <foo> <bar>1</bar> </foo> If the child node already exists, the . operator allows you to change its value. var elem = <foo> <bar>1</bar> </foo> elem.bar = 2; will replace the previous value of 1 with 2. ...
...wever, that assigning a non-XML value to a child element that doesn't exist will create that element. var element1 = <foo/> element1.bar = 1; produces <foo> <bar>1</bar> </foo> If the child node already exists, the . operator allows you to change its value. var elem = <foo> <bar>1</bar> </foo> elem.bar = 2; will replace the previous value of 1 with 2. You can remove a child node by using the delete command: var elem = <foo> <bar/> <baz/> </foo> delete elem.bar; leaves just <foo> <baz/> </foo> The . ...
...And 3 more matches
ChildCount
<< nsIAccessible Page Summary Number of accessible children. ...
... << nsIAccessible Page Summary Number of accessible children. ...
... << nsIAccessible Page Summary Number of accessible children. ...
...And 3 more matches
MutationObserverInit.childList - Web APIs
If subtree is false, only the node indicated by the observer's target node is monitored for changes. ...
...If subtree is false, only the node indicated by the observer's target node is monitored for changes. ...
...If subtree is false, only the node indicated by the observer's target node is monitored for changes. ...
...And 3 more matches
Node.hasChildNodes() - Web APIs
The Node.hasChildNodes() method returns a Boolean value indicating whether the given Node has child nodes or not. Syntax bool = node.hasChildNodes(); Return value A Boolean that is true if the node has child nodes, and false otherwise. ...
... The Node.hasChildNodes() method returns a Boolean value indicating whether the given Node has child nodes or not. Syntax bool = node.hasChildNodes(); Return value A Boolean that is true if the node has child nodes, and false otherwise. ...
... The Node.hasChildNodes() method returns a Boolean value indicating whether the given Node has child nodes or not. Syntax bool = node.hasChildNodes(); Return value A Boolean that is true if the node has child nodes, and false otherwise. ...
...And 3 more matches
NonDocumentTypeChildNode.nextElementSibling - Web APIs
The NonDocumentTypeChildNode.nextElementSibling read-only property returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. Syntax var nextNode = elementNodeReference.nextElementSibling; Example <div id="div-01">Here is div-01</div> <div id="div-02">Here is div-02</div> <script type="text/javascript"> var el = document.getElementById('div-01').nextElementSibling; console.log('Siblings of div-01:'); while (el) { console.log(el.nodeName); el = el.nextElementSibling; } </script> This example outputs the following into the console when it loads: Siblings of div-01: DIV SCRIPT Polyfill for Internet Explorer 8 This property is unsupported prior to IE9, so the following snippet c...
... (el) { console.log(el.nodeName); el = el.nextElementSibling; } </script> This example outputs the following into the console when it loads: Siblings of div-01: DIV SCRIPT Polyfill for Internet Explorer 8 This property is unsupported prior to IE9, so the following snippet can be used to add support to IE8: // Source: https://github.com/Alhadis/Snippets/blob/master/js/polyfills/IE8-child-elements.js if(!("nextElementSibling" in document.documentElement)){ Object.defineProperty(Element.prototype, "nextElementSibling", { get: function(){ var e = this.nextSibling; while(e && 1 !== e.nodeType) e = e.nextSibling; return e; } }); } Polyfill for Internet Explorer 9+ and Safari // Source: https://github.com/jse...
...ocument.documentElement)){ Object.defineProperty(Element.prototype, "nextElementSibling", { get: function(){ var e = this.nextSibling; while(e && 1 !== e.nodeType) e = e.nextSibling; return e; } }); } Polyfill for Internet Explorer 9+ and Safari // Source: https://github.com/jserz/js_piece/blob/master/DOM/NonDocumentTypeChildNode/nextElementSibling/nextElementSibling.md (function (arr) { arr.forEach(function (item) { if (item.hasOwnProperty('nextElementSibling')) { return; } Object.defineProperty(item, 'nextElementSibling', { configurable: true, enumerable: true, get: function () { var el = this; while (el = el.nextSibling) { if (el.nodeType === 1) { ...
...And 3 more matches
NonDocumentTypeChildNode.previousElementSibling - Web APIs
The NonDocumentTypeChildNode.previousElementSibling read-only property returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. Syntax prevNode = elementNodeReference.previousElementSibling; Example <div id="div-01">Here is div-01</div> <div id="div-02">Here is div-02</div> <li>This is a list item</li> <li>This is another list item</li> <div id="div-03">Here is div-03</div> <script> let el = document.getElementById('div-03').previousElementSibling; document.write('<p>Siblings of div-03</p><ol>'); while (el) { document.write('<li>' + el.nodeName + '</li>'); el = el.previousElementSibling; } document.write('</ol>'); </script> This example outputs the following into the page w...
...bling; } document.write('</ol>'); </script> This example outputs the following into the page when it loads: Siblings of div-03 1. LI 2. LI 3. DIV 4. ...
...eviousElementSibling" in document.documentElement)){ Object.defineProperty(Element.prototype, "previousElementSibling", { get: function(){ var e = this.previousSibling; while(e && 1 !== e.nodeType) e = e.previousSibling; return e; } }); } Polyfill for Internet Explorer 9+ and Safari // Source: https://github.com/jserz/js_piece/blob/master/DOM/NonDocumentTypeChildNode/previousElementSibling/previousElementSibling.md (function (arr) { arr.forEach(function (item) { if (item.hasOwnProperty('previousElementSibling')) { return; } Object.defineProperty(item, 'previousElementSibling', { configurable: true, enumerable: true, get: function () { let el = this; while (el = el.previousSibling) { if (el.no...
...And 3 more matches
Children
<< nsIAccessible Page Summary Array of all this node's children. attribute nsIArray children; Remark Every child node in the array implements nsIAccessible interface. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
... << nsIAccessible Page Summary Array of all this node's children. attribute nsIArray children; Remark Every child node in the array implements nsIAccessible interface. ...
... << nsIAccessible Page Summary Array of all this node's children. attribute nsIArray children; Remark Every child node in the array implements nsIAccessible interface. ...
...And 2 more matches
FirstChild
<< nsIAccessible Page Summary Returns first child node in accessible tree. attribute nsIAccessible firstChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
... << nsIAccessible Page Summary Returns first child node in accessible tree. attribute nsIAccessible firstChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
... << nsIAccessible Page Summary Returns first child node in accessible tree. attribute nsIAccessible firstChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
...And 2 more matches
GetChildAt
<< nsIAccessible Page Summary This method returns Nth accessible child using zero-based index. nsIAccessible getChildAt( in long aChildIndex ); Parameters aChildIndex[in] The index of the Nth child. Return value Returns Nth accessible child using zero-based index. If child index is less than zero then returns last child. If child index is greater than children count then returns null. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
...ng aChildIndex ); Parameters aChildIndex[in] The index of the Nth child. Return value Returns Nth accessible child using zero-based index. If child index is less than zero then returns last child. If child index is greater than children count then returns null. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
...meters aChildIndex[in] The index of the Nth child. Return value Returns Nth accessible child using zero-based index. If child index is less than zero then returns last child. If child index is greater than children count then returns null. Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
...And 2 more matches
LastChild
<< nsIAccessible Page Summary Returns last child node in accessible tree. attribute nsIAccessible lastChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
... << nsIAccessible Page Summary Returns last child node in accessible tree. attribute nsIAccessible lastChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
... << nsIAccessible Page Summary Returns last child node in accessible tree. attribute nsIAccessible lastChild; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. ...
...And 2 more matches
ChildNode.replaceWith() - Web APIs
The ChildNode.replaceWith() method replaces this ChildNode in the children list of its parent with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.replaceWith((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to replace. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...DOMString objects are inserted as equivalent Text nodes. Syntax [Throws, Unscopable] void ChildNode.replaceWith((Node or DOMString)... nodes); Parameters nodes A set of Node or DOMString objects to replace. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. Examples Using replaceWith() var parent = document.createElement("div"); var child = document.createElement("p"); parent.appendChild(child); var span = document.createElement("span"); child.replaceWith(span); console.log(parent.outerHTML); // "<div><span></span></div>" ChildNode.replaceWith() is unscopable The replaceWith() method is not scoped into the with statement. See Symbol.unscopables for more information. with(node) { replaceWith("foo"); } // ReferenceError: rep...
...eWith("foo"); } // ReferenceError: replaceWith is not defined Polyfill You can polyfill the replaceWith() method in Internet Explorer 10+ and higher with the following code: function ReplaceWithPolyfill() { 'use-strict'; // For safari, and IE > 10 var parent = this.parentNode, i = arguments.length, currentNode; if (!parent) return; if (!i) // if there are no arguments parent.removeChild(this); while (i--) { // i-- decrements i and returns the value of i before the decrement currentNode = arguments[i]; if (typeof currentNode !== 'object'){ currentNode = this.ownerDocument.createTextNode(currentNode); } else if (currentNode.parentNode){ currentNode.parentNode.removeChild(currentNode); } // the value of "i" below is after the decrement if (!i) ...
...And 2 more matches
Node.appendChild() - Web APIs
Web › API › Node › appendChild
This means that a node can't be in two points of the document simultaneously. So if the node already has a parent, the node is first removed, then appended at the new position. The Node.cloneNode() method can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode will not be automatically kept in sync. ...
...some other node). This means that a node can't be in two points of the document simultaneously. So if the node already has a parent, the node is first removed, then appended at the new position. The Node.cloneNode() method can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode will not be automatically kept in sync. If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node. Newer API avaliable! The ParentNode.append() method supports multiple arguments and appending strings. Syntax element.appendChild(aChild) Parameters aChild The node to append to the given parent node (commonly an element). Return value The returned value is t...
...ntFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node. Newer API avaliable! The ParentNode.append() method supports multiple arguments and appending strings. Syntax element.appendChild(aChild) Parameters aChild The node to append to the given parent node (commonly an element). Return value The returned value is the appended child (aChild), except when aChild is a DocumentFragment, in which case the empty DocumentFragment is returned. Notes Chaining may not work as expected, due to appendChild() returning the child element: let aBlock = document.createElement('block').appendChild( document.createElement('b') ); Sets aBlock to <b></b> only, which is probably not what you want. Example // Create a new paragraph element...
...And 2 more matches
ParentNode.replaceChildren() - Web APIs
The ParentNode.replaceChildren() method replaces the existing children of a Node with a specified new set of children. These can be DOMString or Node objects. Syntax // [Throws, Unscopable] ParentNode.replaceChildren(...nodesOrDOMStrings) // returns undefined Parameters nodesOrDOMStrings A set of Node or DOMString objects to replace the ParentNode's existing children with. If no replacement objects are specified, then the ParentNode is emptied of all child nodes. Exceptions HierarchyRequestError: The constraints of the node tree are violated. Examples Emptying a node replaceChildren() provides a very convenient mechanism for emptying a node of all its children. ...
...ldren with. If no replacement objects are specified, then the ParentNode is emptied of all child nodes. Exceptions HierarchyRequestError: The constraints of the node tree are violated. Examples Emptying a node replaceChildren() provides a very convenient mechanism for emptying a node of all its children. You simply call it on the parent node without any argument specified: myNode.replaceChildren(); Transferring nodes between parents replaceChildren() enables you to easily transfer nodes between parents, without having to resort to verbose looping code. For example, say we have a simple application allowing you to choose what food you want for your party. This HTML might look something like this: <h2>Party food option list</h2> <main> <div> <label for="no">No thanks!</label> ...
...es" list when the "yes" button is pressed, and transfer any selected options in the "yes" list over to the "no" list when the "no" button is pressed. To do this, we give each of the buttons a click event handler, which collects together the selected options you want to transfer in one constant, and the existing options in the list you are transferring to in another constant. It then calls replaceChildren() on the list to transfer the options to, using the spread operator to pass in all the options contained in both constants. const noSelect = document.getElementById('no'); const yesSelect = document.getElementById('yes'); const noBtn = document.getElementById('to-no'); const yesBtn = document.getElementById('to-yes'); yesBtn.addEventListener('click', () => { const selectedTransferOptions =...
...And 2 more matches
:first-child - CSS: Cascading Style Sheets
The :first-child CSS pseudo-class represents the first element among a group of sibling elements. /* Selects any <p> that is the first element among its siblings */ p:first-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
... The :first-child CSS pseudo-class represents the first element among a group of sibling elements. /* Selects any <p> that is the first element among its siblings */ p:first-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...r: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...And 2 more matches
ChildNode.remove() - Web APIs
Web › API › ChildNode › remove
The ChildNode.remove() method removes the object from the tree it belongs to. Syntax node.remove(); Example Using remove() <div id="div-01">Here is div-01</div> <div id="div-02">Here is div-02</div> <div id="div-03">Here is div-03</div> var el = document.getElementById('div-02'); el.remove(); // Removes the div with the 'div-02' id ChildNode.remove() is unscopable The remove() method is not scoped into the with statement. See Symbol.unscopables for more information. ...
...iv with the 'div-02' id ChildNode.remove() is unscopable The remove() method is not scoped into the with statement. See Symbol.unscopables for more information. ...
... Living Standard Initial definition. ...
... Living Standard Initial definition. ...
Node.firstChild - Web APIs
Web › API › Node › firstChild
The Node.firstChild read-only property returns the node's first child in the tree, or null if the node has no children. If the node is a Document, it returns the first node in the list of its direct children. Syntax var childNode = node.firstChild; Example This example demonstrates the use of firstChild and how whitespace nodes might interfere with using this property. <p id="para-01"> <span>First span</span> </p> <script> var p01 = document.getElementById('para-01'); console.log(p01.firstChild.nodeName); </script> In the above, the console will show '#text' because a text node is inserted to maintain the whitespace between the end of the opening <p> and <span> tags. Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on. Anothe...
...nserted to maintain the whitespace between the end of the opening <p> and <span> tags. Any whitespace will create a #text node, from a single space to multiple spaces, returns, tabs, and so on. Another #text node is inserted between the closing </span> and </p>tags. If this whitespace is removed from the source, the #text nodes are not inserted and the span element becomes the paragraph's first child. <p id="para-01"><span>First span</span></p> <script> var p01 = document.getElementById('para-01'); console.log(p01.firstChild.nodeName); </script> Now the console will show 'SPAN'. To avoid the issue with node.firstChild returning #text or #comment nodes, ParentNode.firstElementChild can be used to return only the first element node. However, node.firstElementChild requires a shim for I...
...Name); </script> Now the console will show 'SPAN'. To avoid the issue with node.firstChild returning #text or #comment nodes, ParentNode.firstElementChild can be used to return only the first element node. However, node.firstElementChild requires a shim for Internet Explorer 9 and earlier. Specifications Specification Status Comment DOMThe definition of 'Node.firstChild' in that specification. Living Standard No change Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.firstChild' in that specification. Obsolete No change Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node.firstChild' in that specification. Obsolete No change Document Object Model (DOM) Level 1 Spec...
...ndard No change Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.firstChild' in that specification. Obsolete No change Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node.firstChild' in that specification. Obsolete No change Document Object Model (DOM) Level 1 SpecificationThe definition of 'Node.firstChild' in that specification. Obsolete Initial definition ...
ParentNode.children - Web APIs
The ParentNode property children is a read-only property that returns a live HTMLCollection which contains all of the child elements of the node upon which it was called. Syntax let children = node.children; Value An HTMLCollection which is a live, ordered collection of the DOM elements which are children of node. You can access the individual child nodes in the collection by using either the item() method on the collection, or by using JavaScript array-style notation. If the node has no element children, then children is an empty list with a length of 0. Example const foo = document.getElementById('foo'); for (let i = 0; i < foo.children.length; i++) { console.log(foo.children[i].tagName); } Polyfill // Overwrites native 'children' prototype. // Adds Document & DocumentFragment su...
...e const foo = document.getElementById('foo'); for (let i = 0; i < foo.children.length; i++) { console.log(foo.children[i].tagName); } Polyfill // Overwrites native 'children' prototype. // Adds Document & DocumentFragment support for IE9 & Safari. // Returns array instead of HTMLCollection. ...
....children.length; i++) { console.log(foo.children[i].tagName); } Polyfill // Overwrites native 'children' prototype. // Adds Document & DocumentFragment support for IE9 & Safari. // Returns array instead of HTMLCollection. ...
...ll // Overwrites native 'children' prototype. // Adds Document & DocumentFragment support for IE9 & Safari. // Returns array instead of HTMLCollection. ;(function(constructor) { if (constructor && constructor.prototype && constructor.prototype.children == null) { Object.defineProperty(constructor.prototype, 'children', { get: function() { let i = 0, node, nodes = this.childNodes, children = []; while (node = nodes[i++]) { if (node.nodeType === 1) { children.push(node); } } return children; } }); } })(window.Node || window.Element); Specification Specification Status Comment DOMThe definition of 'ParentNode.children' in that specification. Living Standard Initial ...
:last-child - CSS: Cascading Style Sheets
The :last-child CSS pseudo-class represents the last element among a group of sibling elements. /* Selects any <p> that is the last element among its siblings */ p:last-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
... The :last-child CSS pseudo-class represents the last element among a group of sibling elements. /* Selects any <p> that is the last element among its siblings */ p:last-child { color: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...olor: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...t isn't selected.</p> <h2>This text isn't selected: it's not a `p`.</h2> </div> CSS p:last-child { color: lime; background-color: black; padding: 5px; } Result Styling a list HTML <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3 <ul> <li>Item 3.1</li> <li>Item 3.2</li> <li>Item 3.3</li> </ul> </li> </ul> CSS ul li { color: blue; } ul li:last-child { border: 1px solid red; color: red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':last-child' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':last-child' in that specification. Recommendation Initial definition. ...
remote/child - Archive of obsolete content
Enables an SDK module loaded into a child process to access web content in the child process and communicate with modules in the main process. Usage The sdk/remote/parent module enables SDK code to load modules into child processes. The sdk/remote/child module is for these "child process modules". It provides two main things: access to web content loaded into this child process port mechanisms to communicate with the main process Interacting with web content To interact with web content, the sdk/remote/child module provides a frames property that's a list of all content frames loaded into this child process. Each frame then has a content property that's the top-level DOM window for the frame, and addEventListener/removeEventListener functions that enable you to listen to DOM events...
... See the documentation for sdk/remote/parent for more details. Globals Properties process A Process object. frames A Frames object. Process A link to the main process. ...
... registered. Properties port An event emitter that sends and receives events from every frame in this process. Events attach Triggered when a new content frame is opened (for example, the user opened a new tab). The event listener gets a Frame object as an argument. At this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/remote/child"); frames.on("attach", function(frame) { console.log("new frame"); frame.addEventListener("DOMContentLoaded", function(e) { console.log(e.target.location.href); }); }); detach Triggered when a frame is removed (for example, the user closed a tab). Frame A Frame represents a content frame in this process and provides a way to communicate frame specific events to the main process. M...
treechildren - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Example <tree flex...
...r(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Example <tree flex="1"> <treecols> <treecol id="sender" label="Sender" flex="1"/> <treecol id="subject" label="Subject" flex="2"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joe@somewhere.com"/> <treecell label="Top secret plans"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="mel@whereever.com"/> <treecell label="Let's do lunch"/> </treerow> </treeitem> </treechildren> </tree> Related Elements tree, treecols, treecol, treeitem, tr...
ChildNode - Web APIs
Web › API › ChildNode
The ChildNode mixin contains methods and properties that are common to all types of Node objects that can have a parent. It's implemented by Element, DocumentType, and CharacterData objects. Properties There are neither inherited, nor specific properties. Methods There are no inherited methods. ChildNode.remove() Removes this ChildNode from the children list of its parent. ChildNode.before() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes. ChildNode.after() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes. ...
... ChildNode.before() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes. ChildNode.after() Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes. ChildNode.replaceWith() Replaces this ChildNode in the children list of its parent with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes. Specifications Specification Status Comment DOMThe definition of 'ChildNode' in that specification. Living Standard Split the ElementTraversal interface in ParentNode and ChildNode. pr...
...atter. ...
Node.replaceChild() - Web APIs
Web › API › Node › replaceChild
The Node.replaceChild() method replaces a child node within the given (parent) node. Note the idiosyncratic argument order (new before old). ChildNode.replaceWith() may be easier to read and use. Syntax parentNode.replaceChild(newChild, oldChild); Parameters newChild The new node to replace oldChild. If it already exists in the DOM, it is first removed. oldChild The child to be replaced. Return value The returned value is the replaced node. This is the same node as oldChild. Example // Given: // <div> // <span id="childSpan">foo bar</span> // </div> // Create an empty element node // without an ID, any attributes, or any content var sp1 = document.createElement("span"); // Give it an id attribute called 'newSpan' sp1.id = "newSpan"; // Create some content for the new elemen...
...="childSpan">foo bar</span> // </div> // Create an empty element node // without an ID, any attributes, or any content var sp1 = document.createElement("span"); // Give it an id attribute called 'newSpan' sp1.id = "newSpan"; // Create some content for the new element. ...
...ontent var sp1 = document.createElement("span"); // Give it an id attribute called 'newSpan' sp1.id = "newSpan"; // Create some content for the new element. var sp1_content = document.createTextNode("new replacement span element."); // Apply that content to the new element sp1.appendChild(sp1_content); // Build a reference to the existing node to be replaced var sp2 = document.getElementById("childSpan"); var parentDiv = sp2.parentNode; // Replace existing node sp2 with the new span element sp1 parentDiv.replaceChild(sp1, sp2); // Result: // <div> // <span id="newSpan">new replacement span element.</span> // </div> Specifications Specification Status Comment DOMThe definition of 'Node: replaceChild' in that specification. Living Standard ...
NonDocumentTypeChildNode - Web APIs
The NonDocumentTypeChildNode interface contains methods that are particular to Node objects that can have a parent, but not suitable for DocumentType. NonDocumentTypeChildNode is a raw interface and no object of this type can be created; it is implemented by Element, and CharacterData objects. Properties There are no inherited properties. NonDocumentTypeChildNode.previousElementSibling Read only Returns the Element immediately prior to this node in its parent's children list, or null if there is no Element in the list prior to this node. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediately following this node in its parent's children list, or null if there is no Element in the list following this node. Methods There are neither inherited nor speci...
...The previousElementSibling and nextElementSibling are now defined on the latter. The CharacterData and Element implemented the new interfaces. ...
...ately following this node in its parent's children list, or null if there is no Element in the list following this node. Methods There are neither inherited nor specific methods. Specifications Specification Status Comment DOMThe definition of 'NonDocumentTypeChildNode' in that specification. Living Standard Splitted the ElementTraversal interface in ParentNode, ChildNode, and NonDocumentTypeChildNode. The previousElementSibling and nextElementSibling are now defined on the latter. The CharacterData and Element implemented the new interfaces. Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Added the initial definition of its properties to the ElementTraversal pure interface and use it on El...
Selection.selectAllChildren() - Web APIs
The Selection.selectAllChildren() method adds all the children of the specified node to the selection. Previous selection is lost. Syntax sel.selectAllChildren(parentNode) Parameters parentNode All children of parentNode will be selected. parentNode itself is not part of the selection. ...
... Working Draft Current definition ...
... Working Draft Current definition ...
Child combinator - CSS: Cascading Style Sheets
This is stricter than the descendant combinator, which matches all elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the number of "hops" up the DOM. ...
...This is stricter than the descendant combinator, which matches all elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the number of "hops" up the DOM. ...
...le properties } Examples CSS span { background-color: white; } div > span { background-color: DodgerBlue; } HTML <div> <span>Span #1, in the div. <span>Span #2, in the span that's in the div.</span> </span> </div> <span>Span #3, not in the div at all.</span> Result Specifications Specification Status Comment Selectors Level 4The definition of 'child combinator' in that specification. Working Draft Selectors Level 3The definition of 'child combinators' in that specification. Recommendation No change. CSS Level 2 (Revision 1)The definition of 'child selectors' in that specification. Recommendation Initial definition. ...
CSP: child-src - HTTP
The HTTP Content-Security-Policy (CSP) child-src directive defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. For workers, non-compliant requests are treated as fatal network errors by the user agent. CSP version 2 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the default-src directive. Syntax One or more sources can be allowed for the child-src policy: Content-Security-Policy: child-src <source>; Content-Security-Policy: child-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The...
...le. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: child-src https://example.com/ This <iframe> and worker are blocked and won't load: <iframe src="https://not-example.com"></iframe> <script> var blockedWorker = new Worker("data:application/javascript,..."); </script> Specifications Specification Status Comment Content Security Policy Level 3The definition of 'child-src' in that specification. Working Draft No chang...
... Recommendation Initial definition. ...
child - Archive of obsolete content
Archive › Mozilla › XUL › Property › child
...
... ...
firstPermanentChild - Archive of obsolete content
A permanent child is one that is not customizable and remains on the toolbar. ...
... << XUL Reference firstPermanentChild Not in SeaMonkey 1.x Type: element The first permanent child of the toolbar. A permanent child is one that is not customizable and remains on the toolbar. Items that are placed directly inside the toolbar without being in the toolbarpalette are permanent. ...
lastPermanentChild - Archive of obsolete content
A permanent child is one that is not customizable and remains on the toolbar. ...
... << XUL Reference lastPermanentChild Not in SeaMonkey 1.x Type: element The last permanent child of the toolbar. A permanent child is one that is not customizable and remains on the toolbar. Items that are placed directly inside the toolbar without being in the toolbarpalette are permanent. ...
Node.lastChild - Web APIs
Web › API › Node › lastChild
The Node.lastChild read-only property returns the last child of the node. If its parent is an element, then the child is generally an element node, a text node, or a comment node. It returns null if there are no child elements. Syntax var childNode = node.lastChild; Example var tr = document.getElementById("row1"); var corner_td = tr.lastChild; Specifications Specification Status Comment DOMThe definition of 'Node.lastChild' in that specification. Living Standard No change Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.lastChild' in that specification. Obsolete No change Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node.lastChild' in that specification. Obsolete No...
...Standard No change Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'Node.lastChild' in that specification. Obsolete No change Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'Node.lastChild' in that specification. Obsolete No change Document Object Model (DOM) Level 1 SpecificationThe definition of 'Node.lastChild' in that specification. Obsolete Initial definition ...
TreeWalker.firstChild() - Web APIs
The TreeWalker.firstChild() method moves the current Node to the first visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed. Syntax node = treeWalker.firstChild; Example var treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }, false ); var node = treeWalker.firstChild(); // returns the first child of the root element, or null if none Specifications Specification Status Comment DOMThe definition of 'TreeWalker.firstChild' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversa...
...ld of the root element, or null if none Specifications Specification Status Comment DOMThe definition of 'TreeWalker.firstChild' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range Specification Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'TreeWalker.firstChild' in that specification. Obsolete Initial definition. ...
TreeWalker.lastChild() - Web APIs
The TreeWalker.lastChild() method moves the current Node to the last visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed. Syntax node = treeWalker.lastChild(); Example var treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }, false ); var node = treeWalker.lastChild(); // returns the last visible child of the root element Specifications Specification Status Comment DOMThe definition of 'TreeWalker.lastChild' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range S...
...the last visible child of the root element Specifications Specification Status Comment DOMThe definition of 'TreeWalker.lastChild' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range Specification Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'TreeWalker.lastChild' in that specification. Obsolete Initial definition. ...
children - Archive of obsolete content
<< XUL Reference children Type: array of elements Returns the list of items in the richlistbox. ...
appendChild - Archive of obsolete content
Node appendChild ( Node newChild ) ...
GetChildNodeAt
...
FocusedChild
<< nsIAccessible Page Summary Focused accessible child of node. attribute nsIAccessible focusedChild; See Also nsIAccessible.takeFocus() ...
GetChildAtPoint
<< nsIAccessible Page Summary This method returns an accessible child which contains the coordinate at (x, y) in screen pixels. nsIAccessible getChildAtPoint( in long aX, in long aY ); Parameters aX[in] Accessible's X-coordinate.aY[out] Accessible's Y-coordinate. Return value Returns an accessible child at given (x, y) coordinate. Remarks If the point is in the current accessible but not in a child, the current accessible will be returned. If the point is in neither the current accessible or a child, then NULL will be returned. ...
child - XPath
Web › XPath › Axes › child
The child axis indicates the children of the context node. If an XPath expression does not specify an axis, the child axis is understood by default. Since only the root node or element nodes have children, any other use will select nothing. Specifications Specification Status Comment XPath 3.1The definition of 'child' in that specification. Recommendation XPath 3.0The definition of 'child' in that specification. Recommendation XPath 2.0The definition of 'child' in that specification. Recommendation XPath 1.0The definition of 'child' in that specification. Recommendation Initial definition. ...
Index - Web APIs
Web › API › Index
ing strings describing the different transports which may be used by the authenticator. 223 AuthenticatorResponse API, Authentication, AuthenticatorResponse, Interface, Reference, Web Authentication API, WebAuthn The AuthenticatorResponse interface of the Web Authentication API is the base interface for interfaces that provide a cryptographic root of trust for a key pair. The child interfaces include information from the browser such as the challenge origin and either may be returned from PublicKeyCredential.response. 224 AuthenticatorResponse.clientDataJSON API, AuthenticatorResponse, Property, Reference, Web Authentication API, WebAuthn The clientDataJSON property of the AuthenticatorResponse interface stores a JSON string in an ArrayBuffer, represent...
... 224 AuthenticatorResponse.clientDataJSON API, AuthenticatorResponse, Property, Reference, Web Authentication API, WebAuthn The clientDataJSON property of the AuthenticatorResponse interface stores a JSON string in an ArrayBuffer, representing the client data that was passed to CredentialsContainer.create() or CredentialsContainer.get(). This property is only accessed on one of the child objects of AuthenticatorResponse, specifically AuthenticatorAttestationResponse or AuthenticatorAssertionResponse. 225 Background Tasks API API, Background Tasks API, Guide, IdleDeadline, Overview, cancelIdleCallback, requestIdleCallback The Cooperative Scheduling of Background Tasks API (also referred to as the Background Tasks API or simply the requestIdleCallback() API) pr...
...CSS, CSS Typed OM, Houdini, Learn This should get you started with understanding the CSS Typed OM. Take a look at all the CSS Typed OM interfaces to learn more. 403 CSSConditionRule API, CSSOM, Interface, Reference An object implementing the CSSConditionRule interface represents a single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. 404 CSSCounterStyleRule API, CSS Counter Styles, Interface, Reference The CSSCounterStyleRule interface represents an @counter-style at-rule. 405 CSSGroupingRule API, CSSOM, Interface, Reference An object implementing the CSSGroupingRule interface represents any CSS at-rule that contains other rules nested within it. 406 CSS...
...And 48 more matches
IPDL Tutorial
process-communication Protocol Definition Language", is a Mozilla-specific language allowing C++ code to pass messages between processes or threads in an organized and secure way. All messages for multi-process plugins and tabs in Firefox are declared in the IPDL language. To experiment with adding a new IPDL protocol, see Creating a New Protocol. All IPDL messages are sent between parent and a child end points, called actors. An IPDL protocol declares how actors communicate: it declares the possible messages that may be sent between actors, as well as a state machine describing when messages are allowed to be sent. The parent actor is typically the more permanent side of the conversation: Parent/Child Actors Parent Child IPC Tabs Chrome process Content p...
...iler generates several C++ headers from each IPDL protocol. This generated code manages the details of the underlying communication layer (sockets and pipes), constructing and sending messages, ensuring that all actors adhere to their specifications, and handling many error conditions. The following IPDL code defines a very basic interaction of browser and plugin actors: async protocol PPlugin { child: async Init(nsCString pluginPath); async Shutdown(); parent: async Ready(); }; This code declares the PPlugin protocol. Two messages can be sent from the parent to the child, Init() and Shutdown(). One message can be sent from the child to the parent, Ready(). IPDL protocols start with the letter P. The file in which the protocol is declared must have a matching name, PPlugin.ipdl. Gen...
... This code declares the PPlugin protocol. Two messages can be sent from the parent to the child, Init() and Shutdown(). One message can be sent from the child to the parent, Ready(). IPDL protocols start with the letter P. The file in which the protocol is declared must have a matching name, PPlugin.ipdl. Generated C++ Code When PPlugin.ipdl is compiled, the headers PPluginParent.h, and PPluginChild.h will be generated in the ipc/ipdl/_ipdlheaders/ directory of the build tree. The PPluginParent and PPluginChild classes are abstract classes that must be subclassed. Each outgoing message is a C++ method which can be called. Each incoming message is a pure-virtual C++ method which must be implemented: class PPluginParent { public: bool SendInit(const nsCString& pluginPath) { // generated...
...And 47 more matches
Index - Archive of obsolete content
ces/history Access the user's browsing history. 99 platform/xpcom Implement XPCOM objects, factories, and services. 100 preferences/event-target Add-on SDK Listen to changes to the Preferences system in Firefox. 101 preferences/service Add-on SDK, Jetpack, SDK Access the Preferences system in Firefox. 102 remote/child Module, Reference, SDK Enables an SDK module loaded into a child process to access web content in the child process and communicate with modules in the main process. 103 remote/parent Reference, SDK Enables you to load modules, and privileged parts of your add-on in general, into child processes. 104 stylesheet/style Modify styles using stylesh...
... 107 system/environment Access, set and clear environment variables. ...
... 107 system/environment Access, set and clear environment variables. 108 system/events API for working with the application observer service. ...
...And 34 more matches
JXON - Archive of obsolete content
about working with Objects and how Javascript is Object-Oriented). We can use several algorithms to convert its content to a Javascript Object Tree. Algorithm #1: a verbose way This simple recursive constructor will convert an XML DOM tree to a JavaScript Object tree. The text content of each element is stored into the keyValue property, while nodeAttributes, if they exist, are listed under the child object keyAttributes. The constructor's argument can be the entire XML Document, a DocumentFragment or simply an Element node. /*\ |*| |*| JXON Snippet #1 MDNDeveloper Network |*| |*| https://developer.mozilla.org/docs/JXON |*| https://developer.mozilla.org/User:fusionchess |*| |*| This framework is released under the GNU Public License, version 3 or later. |*| http://www.gnu.org/licenses/g...
...oNode.nodeValue.trim() : oNode.nodeValue; } // nodeType is "Text" (3) or "CDATASection" (4) else if (oNode.nodeType === 1 && !oNode.prefix) { // nodeType...
...oNode.nodeValue.trim() : oNode.nodeValue; } // nodeType is "Text" (3) or "CDATASection" (4) else if (oNode.nodeType === 1 && !oNode.prefix) { // nodeType is "Element" (1) sProp = oNode.nodeName.toLowerCase(); vContent = ...
...And 31 more matches
Message manager overview
These processes run web content. Message managers are designed to enable chrome-privileged JavaScript code in one process to communicate with chrome-privileged JavaScript code in a different process. ...
...ts are called frame scripts, and as the name suggests, they are scoped to a specific browser frame. If chrome code wants to run code in the content process so it can access web content, this is usually the sort of message manager to use. Process message managers: these correspond to process boundaries, and enable code running in the parent (chrome) process to communicate with code running in the child (content) process. From Firefox 38 onwards, they also enable code running in the parent process to load process scripts into the child process. These are like frame scripts, except they are global to the child process. Process scripts are most likely to be useful when an extension wants to run some code only once in the content process, to access some global service: for example, to register an o...
...tabs. If you load a frame script using the global frame message manager, the script gets loaded separately into every open tab: three times, in the diagram above. Similarly, if you send a message using the global frame message manager, it's received by all content tabs, and is then delivered to any frame scripts that are listening for it. ...
...And 30 more matches
Extending a Protocol
WG DOM APIs. What are we going to implement? tl:dr: you can see the final implementation of PEcho.ipdl as a diff in Phabricator. To make this tutorial less abstract (more fun!), we are going to implement a JS method called echo() on the Navigator interface. The method will take one argument, a DOMString, which we will pass to the parent process. Then we will send that same string back to the child process. The WebIDL for this will be: partial interface Navigator { Promise<DOMString> echo(DOMString someString); }; Learning goals are: Extending an existing IPDL protocol. Simple message passing. Working with MozPromises and JS promises. Managing child actors with reference counting. Visually, it's going to look something like this (except for the Operating System bit, which we ...
... everything is compiling ok. Once it's compiled, ./mach run and you should be able to spin up the developer console and type: navigator.echo("hi!"); That will return a pending Promise that never settles. Our goal is now to get that to settle with the value we sent in. IPDL basics While you are compiling, let's cover some IPDL basics. ...
... type: navigator.echo("hi!"); That will return a pending Promise that never settles. Our goal is now to get that to settle with the value we sent in. IPDL basics While you are compiling, let's cover some IPDL basics. In IPDL there two kinds of "actors" - a "parent" and "child" - these actors are literally implemented as C++ classes, so they are more than just abstract ideas. Usually, a child wants to send messages to the parent to do something off main thread for us. ...
...And 29 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
636 canGoBack XUL Properties, XUL Reference No summary! 637 canGoForward XUL Properties, XUL Reference No summary! 638 canRewind XUL Properties, XUL Reference No summary! 639 checkState XUL Properties, XUL Reference No summary! 640 checked XUL Properties, XUL Reference No summary! 641 child XUL Properties, XUL Reference No summary! 642 children XUL Properties, XUL Reference No summary! 643 className XUL Properties, XUL Reference No summary! 644 clickSelectsAll XUL Properties, XUL Reference No summary! 645 collapsed XUL Properties, XUL Reference No summary! 646 color NeedsCont...
... 702 enableColumnDrag XUL Properties, XUL Reference No summary! 703 eventNode XUL Properties, XUL Reference No summary! 704 externalToolbars Toolbars, XUL, XUL Reference No summary! 705 findMode No summary! 706 firstOrdinalColumn XUL Properties, XUL Reference No summary! 707 firstPermanentChild XUL Properties, XUL Reference No summary! 708 flex XUL Properties, XUL Reference No summary! 709 flexGroup No summary! 710 focused XUL Properties, XUL Reference No summary! 711 focusedItem XUL Properties, XUL Reference No summary! 712 forceComplete XUL Properties, XUL Reference No s...
... isSearching XUL Properties, XUL Reference No summary! 734 isWaiting XUL Properties, XUL Reference No summary! 735 itemCount XUL Properties, XUL Reference No summary! 736 label XUL Properties, XUL Reference No summary! 737 labelElement XUL Properties, XUL Reference No summary! 738 lastPermanentChild XUL Properties, XUL Reference No summary! 739 lastSelected NeedsHelp, XUL Properties, XUL Reference No summary! 740 left XUL Properties, XUL Reference No summary! 741 linkedPanel XUL Properties, XUL Reference No summary! 742 listBoxObject XUL Properties, XUL Reference No summary! 743 listbox.c...
...And 26 more matches
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
// creates a table row var row = document.createElement("tr"); for (var j = 0; j < 2; j++) { // Create a <td> element and a text node, make the text // node the contents of the <td>, and put the <td> at // the end of the table row var cell = document.createElement("td"); var cellText = document.createTextNode("cell in row "+i+", column "+j); cell.appendChild(cellText); row.appendChild(cell); } // add the row to the end of the table body tblBody.appendChild(row); } // put the <tbody> in the <table> tbl.appendChild(tblBody); // appends <table> into <body> body.appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "2"); } Note the order in which we created the elements and the text no...
... tblBody.appendChild(row); } // put the <tbody> in the <table> tbl.appendChild(tblBody); // appends <table> into <body> body.appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "2"); } Note the order in which we created the elements and the text node: First we created the <table> element. Next, we created the <tbody> element, which is a child of the <table> element. Next, we used a loop to create the <tr> elements, which are children of the <tbody> element. For each <tr> element, we used a loop to create the <td> elements, which are children of <tr> elements. For each <td> element, we then created the text node with the table cell's text. Once we have created the <table>, <tbody>, <tr>, and <td> elements, and then the text node, ...
...used a loop to create the <td> elements, which are children of <tr> elements. For each <td> element, we then created the text node with the table cell's text. ...
...And 23 more matches
Color picker tool - CSS: Cascading Style Sheets
**************************************/ ColorPicker.prototype.createPickingArea = function createPickingArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'picking-area'; picker.className = 'picker'; this.picking_area = area; this.color_picker = picker; setMouseTracking(area, this.updateColor.bind(this)); area.appendChild(picker); this.node.appendChild(area); }; ColorPicker.prototype.createHueArea = function createHueArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'hue'; picker.className ='slider-picker'; this.hue_area = area; this.hue_picker = picker; setMouseTracking(area, this.updateHueSlider.bind(this)); area.appendChild(pi...
...endChild(area); }; ColorPicker.prototype.createHueArea = function createHueArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'hue'; picker.className ='slider-picker'; this.hue_area = area; this.hue_picker = picker; setMouseTracking(area, this.updateHueSlider.bind(this)); area.appendChild(picker); this.node.appendChild(area); }; ColorPicker.prototype.createAlphaArea = function createAlphaArea() { var area = document.createElement('div'); var mask = document.createElement('div'); var picker = document.createElement('div'); area.className = 'alpha'; mask.className = 'alpha-mask'; picker.className = 'slider-picker'; this.alpha_area = area; this.alpha_mask = mask; this.alpha_picker = picker; ...
...rea() { var area = document.createElement('div'); var mask = document.createElement('div'); var picker = document.createElement('div'); area.className = 'alpha'; mask.className = 'alpha-mask'; picker.className = 'slider-picker'; this.alpha_area = area; this.alpha_mask = mask; this.alpha_picker = picker; setMouseTracking(area, this.updateAlphaSlider.bind(this)); area.appendChild(mask); mask.appendChild(picker); this.node.appendChild(area); }; ColorPicker.prototype.createPreviewBox = function createPreviewBox(e) { var preview_box = document.createElement('div'); var preview_color = document.createElement('div'); preview_box.className = 'preview'; preview_color.className = 'preview-color'; this.preview_color = preview_color; preview_box.appendChild(pr...
...And 20 more matches
Tree View Details - Archive of obsolete content
tures of tree views. Creating a Hierarchical Custom View In the last section, we created a simple tree view that implemented only a minimum amount of functionality. Next, let's look at some additional functions that views may implement. Here, we will examine how to create a hierarchical set of items using the view. This is a fairly tricky process as it involves keeping track of which items have children and also which rows are open and closed. Nesting Level Every row in the tree has a nesting level. The topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. The tree will query the view for each row by calling its getLevel method to find out the level of that row. The view will need to return 0 for the outermost rows and higher values for...
...hasNextSibling function which, given a row, should return true if there is another row afterwards at the same level. This function is used, specifically, to draw the nesting lines along the side of the tree. The getParentIndex method is expected to return the parent row of a given row, that is, the row before it with a lower nesting value. All of these methods must be implemented by the view for children to be handled properly. Containers There are also three functions, isContainer, isContainerEmpty and isContainerOpen that are used to handle a parent item in the tree. The isContainer method should return true if a row is a container and might contain children. The isContainerEmpty method should return true if a row is an empty container, for instance, a directory with no files in it. T...
...he isContainer method. A container may be rendered differently than a non-container. For instance, a container may have a folder icon beside it. A style sheet may be used to style items based on various properties such as whether a row is open. This is described in a later section. A non-empty container will be displayed with a twisty next to it so that the user may open and close the row to see child items. Empty containers will not have a twisty, but will still be treated like a container. When the user clicks the twisty to open a row, the tree will call the view's toggleOpenState method. The view should then perform any necessary operations to retrieve the child rows and then update the tree with the new rows. Note: As of this writing (Gecko 2.0), custom nsITreeView implementations must ...
...And 19 more matches
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
Unlike other elements, the data to display inside the tree is not specified using tags, but is determined from a view object. ...
...icates whether treeitem element are used. If you would like to allow the tree to be horizontally scrolled, simply set the width attributes for each column to make the tree wider than its containing object. Tree type View interfaces Has DOM nodes? Description Content tree nsITreeView, nsITreeContentView Yes This tree has treeitem elements placed within the treechildren element. In this situation, a content view (which implements the interface nsITreeContentView) which is a more specialized type of view, uses the treeitem elements and their descendants to determine the data to display in the tree. However, the treeitems are not displayed directly; they are used only as data to the content view. However, the content view will automatically update the tree if t...
...columns, contentView, currentIndex, disableKeyNavigation, disabled, editingColumn, editingRow, enableColumnDrag, firstOrdinalColumn, inputField, selType, selstyle, tabIndex, treeBoxObject, view Examples A tree with several columns <tree flex="1" rows="2"> <treecols> <treecol id="sender" label="Sender" flex="1"/> <treecol id="subject" label="Subject" flex="2"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joe@somewhere.com"/> <treecell label="Top secret plans"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="mel@whereever.com"/> <treecell label="Let's do lunch"/> </treerow> </treeitem> </treechildren> </tree> A tree with several columns and nested items <tree id="...
...And 19 more matches
Mozilla accessibility architecture
in "this" to get at the information it needs. Class Inheritence Diagram View the Class Inheritence Diagram. 3. Accessible Tree Construction and Traversal The accessible tree is constructed on demand. The first request for an accessible is usually the accessible for document in one of the open windows, and the code in widget/src/gtk2 or widget/src/windows must return this doc accessible. Even if a child accessible of the document is asked for first, the doc accessible will be created first, because it is needed to cache any accessibles created within it. When the doc accessible is asked for, an event is fired which reaches the PresShell, which then uses the accessibility service singleton (nsIAccessibilityService) to create the doc accessible and return it back to the widget code. The reason tha...
...w the assistive technology client requests the data, the accessible for a given node is only created once. We use the accessibility cache to retrieve accessibles that have already been created for a given dom node. This tree traversal is accomplished via toolkit-specific calls which end up as calls into nsIAccessible methods GetAccParent(), GetAccNextSibling(), GetAccPreviousSibling(), GetAccFirstChild(), GetAccLastChild(), GetAccChildCount() and GetChildAt(childNum). The ATK has more convenience methods than MSAA does for traversal - for example it is possible to go straight to the accessible for a specific row and column of a table, using nsIAccessibleTable::CellRefAt(). The algorithm used to calculate the number of accessible children for an accessible node is expensive. We cannot assume tha...
...etAccChildCount() and GetChildAt(childNum). The ATK has more convenience methods than MSAA does for traversal - for example it is possible to go straight to the accessible for a specific row and column of a table, using nsIAccessibleTable::CellRefAt(). The algorithm used to calculate the number of accessible children for an accessible node is expensive. We cannot assume that all of the accessible children will come from the direct children, grandchildren or even great-great-great-children of the current accessible's node. Therefore we have to iterate through the tree as if we were creating all of the accessible children, adding to the total as we go. ...
...And 19 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
**************************************/ ColorPicker.prototype.createPickingArea = function createPickingArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'picking-area'; picker.className = 'picker'; this.picking_area = area; this.color_picker = picker; setMouseTracking(area, this.updateColor.bind(this)); area.appendChild(picker); this.node.appendChild(area); }; ColorPicker.prototype.createHueArea = function createHueArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'hue'; picker.className ='slider-picker'; this.hue_area = area; this.hue_picker = picker; setMouseTracking(area, this.updateHueSlider.bind(this)); area.appendChild(pi...
...endChild(area); }; ColorPicker.prototype.createHueArea = function createHueArea() { var area = document.createElement('div'); var picker = document.createElement('div'); area.className = 'hue'; picker.className ='slider-picker'; this.hue_area = area; this.hue_picker = picker; setMouseTracking(area, this.updateHueSlider.bind(this)); area.appendChild(picker); this.node.appendChild(area); }; ColorPicker.prototype.createAlphaArea = function createAlphaArea() { var mask = document.createElement('div'); var picker = document.createElement('div'); mask.className = 'alpha'; picker.className = 'slider-picker'; this.alpha_mask = mask; this.alpha_picker = picker; setMouseTracking(mask, this.updateAlphaSlider.bind(this)); mask.appendChild(picker); this.node.a...
...); }; ColorPicker.prototype.createAlphaArea = function createAlphaArea() { var mask = document.createElement('div'); var picker = document.createElement('div'); mask.className = 'alpha'; picker.className = 'slider-picker'; this.alpha_mask = mask; this.alpha_picker = picker; setMouseTracking(mask, this.updateAlphaSlider.bind(this)); mask.appendChild(picker); this.node.appendChild(mask); }; ColorPicker.prototype.createPreviewBox = function createPreviewBox(e) { var preview_box = document.createElement('div'); var preview_color = document.createElement('div'); preview_box.className = 'preview'; preview_color.className = 'preview-color'; this.preview_color = preview_color; preview_box.appendChild(preview_color); this.node.appendChild(preview_box); }; C...
...And 19 more matches
XUL element attributes - Archive of obsolete content
<< XUL Reference home The following attributes are common to all XUL elements: align Type: one of the values below The align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children. For boxes that have horizontal orientation, it specifies how its children will be aligned vertically. For boxes that have vertical orientation, it specifies how its children will be aligned horizontally. start Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space i...
...rientation, it specifies how its children will be aligned horizontally. start Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. ...
... child elements, resulting in the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. stretch This is the default value. The child elements are stretched to fit the size of the box. For a horizontal box, the children are stretched to be the height of the box. For a vertical box, the children are stretched to be the width of the box. ...
...And 18 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
ies later. Deciding Which MSAA Features to Support MSAA Methods - Cheat Sheet for Developers The IAccessible interface is used in a tree of IAccessible's, each one representing a data node, similar to a DOM. Here are the methods supported in IAccessible - a minimal implementation would contain those marked "[important]": get_accParent: Get the parent of an IAccessible. [important] get_accChildCount: Get the number of children of an IAccessible. [important] get_accChild: Get the child of an IAccessible. [important] get_accName: Get the "name" of the IAccessible, for example the name of a button, checkbox or menu item. Try to use unique names for each item in a dialog so that voice dictation software doesn't have to deal with extra ambiguity.[important] get_accValue: Get the "value" o...
...off states, such as focused, focusable, selected, selectable, visible, protected (for passwords), checked, etc. [important] get_accHelp: Get context sensitive help for the IAccessible. get_accHelpTopic: We don't use this, it's only if the Windows help system is used. get_accKeyboardShortcut: What is the keyboard shortcut for this IAccessible (underlined alt+combo mnemonic) get_accFocus: Which child is focused? [important] get_accSelection: Which children of this item are selected? get_accDefaultAction: Get a description or name of the default action for this component, such as "jump" for links. accSelect: Select the item associated with this IAccessible. [important] accLocation: Get the x,y coordinates, and the height and width of this IAccessible node. [important] accNavigate: Navigat...
...[important, but no need to implement up/down/left/right] accHitTest: Find out what IAccessible exists and a specific coordinate. accDoDefaultAction: Perform the action described by get_accDefaultAction. put_accName: Change the name. put_accValue: Change the value. ...
...And 16 more matches
Gecko info for Windows accessibility vendors
Methods To use MSAA with Gecko, you'll need the tools and docs that come with the Active Accessibility 2.0 SDK Tools. The method AccessibleObjectFromWindow() will get you the root IAccessible corresponding to the top level window. Hold on to this root IAccessible, and use it to walk through the entire tree of IAccessible's. ...
... with Gecko, you'll need the tools and docs that come with the Active Accessibility 2.0 SDK Tools. The method AccessibleObjectFromWindow() will get you the root IAccessible corresponding to the top level window. Hold on to this root IAccessible, and use it to walk through the entire tree of IAccessible's. ...
...PUPEND are fired when XUL menus are opened or closed. EVENT_MENUSTART and EVENT_MENUEND are fired when the XUL menubar is activated or deactivated. EVENT_VALUECHANGE is fired for sliders, progress meters and other objects who's get_accValue() may change. EVENT_SHOW, EVENT_HIDE and EVENT_LOCATIONCHANGE are fired for the caret object. EVENT_REORDER is fired on an object whenever its children change. EVENT_SHOW and EVENT_HIDE may also be fired with the reorder event, for the child who's visibility changed. The show and hide events are not fired on every IAccessible when a new subtree of IAccessibles changes visibility -- only the top IAccessible. The exception is progress meters, which are guaranteed to fire EVENT_SHOW and EVENT_HIDE events when they are displayed or hidden. EV...
...And 15 more matches
Accessing the Windows Registry Using XPCOM
flags defined on the interface. ...
...the interface. You can read the interface documentation for a full explanation, but we will show only the three most commonly used modes here: ACCESS_READ -- For reading values, enumerating keys, and receiving notifications ACCESS_WRITE -- For setting values and creating sub keys ACCESS_ALL -- Access for all operations In addition to open() and create(), there are the openChild() and createChild() methods. ...
...ill show only the three most commonly used modes here: ACCESS_READ -- For reading values, enumerating keys, and receiving notifications ACCESS_WRITE -- For setting values and creating sub keys ACCESS_ALL -- Access for all operations In addition to open() and create(), there are the openChild() and createChild() methods. You can call these methods on an already-opened registry key to open a child key. Both methods take a relative path and access mode as parameters and return a new object implementing nsIWindowsRegKey. Here's the simple example again, but using openChild(): var wrk = Components.classes["@mozilla.org/windows-registry-key;1"] .createInstance(Components.interfaces.nsIWindowsRegKey); wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft", ...
...And 15 more matches
Index
Mozilla › Tech › XPCOM › Index
plemented in certain situations. Some examples are: 169 IAccessibleRelation Interfaces, NeedsContent, XPCOM, XPCOM Interface Reference Returns a localized version of the relation type. ...
...ation Interfaces, NeedsContent, XPCOM, XPCOM Interface Reference Returns a localized version of the relation type. 170 IAccessibleTable Interfaces, XPCOM, XPCOM Interface Reference Typically all accessible objects that represent cells or cell-clusters of a table will be at the same time children of the table. In this case IAccessible2.indexInParent() will return the child index which then can be used when calling rowIndex() and columnIndex(). However, in some cases that kind of implementation will not be possible. When the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. This object attribute is obtained by parsing the attribute string returne...
... cases that kind of implementation will not be possible. When the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. This object attribute is obtained by parsing the attribute string returned by IAccessible2.attributes(). The "table-cell-index" attribute can be used just like a child index of the typical case. ATs should first test for the presence of the "table-cell-index" attribute and if it is not present then IAccessible2.indexInParent() can be used as in the typical case where cells are direct children of the table. The range of valid coordinates for this interface are implementation dependent. However, that range includes at least the intervals from the from the first r...
...And 15 more matches
The building blocks of responsive design - Progressive web apps (PWAs)
card> ... </x-card> <x-card> ... </x-card> </x-deck> Note: These weird x- elements may be unfamiliar; they are part of Brick, Mozilla's UI element library for mobile web apps. We have used Brick to create the mobile layout for Snapshot, which you will read more about below. To get these sitting side-by-side we have used the following rules: x-card { width: 100%; } x-card:nth-child(1), x-card:nth-child(2) { width: 30%; float: left; padding: 2rem; } x-card:nth-child(3) { width: 40%; float: left; height: 100%; overflow: auto; padding: 2rem; } So we're giving the first two columns a width of 30%, and the third a width of 40%, floating the columns all left. This way they end up side-by-side, and their proportions remain the same as the browser window size vari...
...s 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 inside their container's widths, no matter what. However, if they aren't as wide as their containers, they will not stretch to fill them. In the snapshot example, we ended up with slightly different code: x-card:nth-child(1) video, x-card:nth-child(2) img { width: 100%; ... } This is because in our case, we do in fact want the video and image to stretch to always fill their containers no matter what -- a subtle but important difference from max-width -- and therefore always be the same size. The video always resizes dynamically, but the screen captures taken from it do not, so upon resizing the screen it wa...
...e a desktop layout, as we've already seen. This is created using the CSS rules included at the top of the stylesheet, before any media queries are encountered. Mid-width layout We also have a mid-width layout, which is aimed at working well on tablets and narrow laptop screens. This is created by all of the CSS inside the first media query: @media all and (max-width: 1024px) { x-card:nth-child(1), x-card:nth-child(2) { width: 50%; } x-card:nth-child(3) { width: 100%; clear: left; } x-card:nth-child(3) img { width: 20%; } } So here we're altering the widths of the columns and removing the float of the third column (and adding clearing to guard against any float funny business). We've also altered the width of the images inside the third container (no longer ...
...And 15 more matches
nsIDOMNode
dom/interfaces/core/nsIDOMNode.idlScriptable This interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. 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 Re...
... localName DOMString Read only. namespaceURI DOMString Read only. nextSibling nsIDOMNode Read only. nodeName DOMString Read only. nodeType unsigned short Read only. nodeValue DOMString ownerDocument nsIDOMDocument Read only. parentNode nsIDOMNode Read only. ...
... localName DOMString Read only. namespaceURI DOMString Read only. nextSibling nsIDOMNode Read only. nodeName DOMString Read only. nodeType unsigned short Read only. nodeValue DOMString ownerDocument nsIDOMDocument Read only. parentNode nsIDOMNode Read only. prefix DOMString previousSibling nsIDOMNode Read only. ...
...And 14 more matches
Node - Web APIs
Web › API › Node
ost notable are Document, Element, and DocumentFragment. In addition, every kind of DOM node is represented by an interface based on Node. These include Attr, CharacterData (which Text, Comment, and CDATASection are all based on), ProcessingInstruction, DocumentType, Notation, Entity, and EntityReference. In some cases, a particular feature of the base Node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. For example, attempting to add children to a node type that cannot have children will throw an exception. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg ...
...er text { fill: #0095DD; pointer-events: all;} Properties In addition to the properties below, Node inherits properties from its parent, EventTarget. Node.baseURIRead only Returns a DOMString representing the base URL of the document containing the Node. Node.baseURIObject Read only (Not available to web content.) The nsIURI object representing the base URI for the element. Node.childNodesRead only Returns a live NodeList containing all the children of this node. NodeList being live means that if the children of the Node change, the NodeList object is automatically updated. Node.firstChildRead only Returns a Node representing the first direct child node of the node, or null if the node has no child. Node.isConnectedRead only A boolean indicating whether or not the Node...
... Node.nextSiblingRead only Returns a Node representing the next node in the tree, or null if there isn't such node. Node.nodeNameRead only Returns a DOMString containing the name of the Node. The structure of the name will differ with the node type. ...
...And 14 more matches
Web Replay
cted by a single global lock. Note that while this could potentially be a big drag on performance during both replay and recording, many of the hottest atomics (refcounts, GC counters, and so forth) are associated with non-deterministic components and are not recorded. IPC integration Communication between the chrome process and a recording or replaying process -- hereafter referred to as the child process -- is managed via a separate middleman content process. The child process is extended so that it can communicate with the middleman, using a special bidirectional channel and messages separate from IPDL state. Middleman process The middleman is the same as a normal content process, except that it spawns and communicates with the child process, and avoids creating any documents itself. ...
...al content process, except that it spawns and communicates with the child process, and avoids creating any documents itself. Using the middleman provides the following advantages: IPDL communication is greatly simplified. The chrome and middleman processes communicate using the standard browser protocols (PContent, PBrowser, etc.) and implementations for their actors, while the middleman and child processes communicate with their own channel and messages, which is tuned to the demands of the recording/replaying process. The middleman can perform actions that would be extremely difficult to manage in a replaying process without going out of sync with the recording. ...
..., while the middleman and child processes communicate with their own channel and messages, which is tuned to the demands of the recording/replaying process. The middleman can perform actions that would be extremely difficult to manage in a replaying process without going out of sync with the recording. This mainly includes running devtools content-side scripts. The middleman can spawn multiple child processes at once, and coordinate their behavior so they run in parallel. There can be up to one recording child and two replaying children at once. ...
...And 13 more matches
Box-shadow generator - CSS: Cascading Style Sheets
================================================== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* For IE 6/7 (trigger hasLayout) */ } /* GRID COLUMN SETUP * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Slider */ .slidergroup { height: 20px; margin: 10px 0; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .slidergroup * { float: left; height: 100%; line-height: 100%; } /* Slider */ .ui-slider { height: 10px; width: 200px; margin: 4px 10px; display: block; bo...
...r topic = node.getAttribute('data-topic'); this.min = min; this.max = max > 0 ? max : 100; this.step = step === 0 ? 1 : step; this.value = value <= max && value >= min ? value : (min + max) / 2 | 0; this.snap = snap === "true" ? ...
...tener("click", function() { increment(topic); }); } } var setInputComponent = function setInputComponent(node) { var topic = node.getAttribute('data-topic'); var unit_type = node.getAttribute('data-unit'); var input = document.createElement('input'); var unit = document.createElement('span'); unit.textContent = unit_type; input.setAttribute('type', 'text'); node.appendChild(input); node.appendChild(unit); input.addEventListener('click', function(e) { this.select(); }); input.addEventListener('change', function(e) { setValue(topic, e.target.value | 0); }); subscribe(topic, function(value) { node.children[0].value = value; }); } var increment = function increment(topic) { var slider = sliders[topic]; if (slider === null || slider === u...
...And 13 more matches
nsIWindowsRegKey
0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) The interface represents a single key in the registry. This interface is highly Win32 specific. ...
...t changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0) The interface represents a single key in the registry. This interface is highly Win32 specific. ...
...id close(); void create(in unsigned long rootKey, in AString relPath, in unsigned long mode); nsIWindowsRegKey createChild(in AString relPath, in unsigned long mode); AString getChildName(in unsigned long index); AString getValueName(in unsigned long index); unsigned long getValueType(in AString name); boolean hasChanged(); boolean hasChild(in AString name); boolean hasValue(in AString name); boolean isWatching(); void open(in unsigned long rootKey, in AString relPath, in unsigned long mode); nsIWindowsRegKey openChild(in AString relPath, in unsigned long mode); ACString readBinaryValue(in AString name); unsigned long long readInt64Value(in AString name); unsigned long r...
...And 12 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
list items all on the same line in the source, which causes the whitespace nodes to not be created in the first place: <li></li><li></li><li></li><li></li><li></li> DOM traversal and whitespace When trying to do DOM manipulation in JavaScript, you can also encounter problems because of whitespace nodes. ...
... same line in the source, which causes the whitespace nodes to not be created in the first place: <li></li><li></li><li></li><li></li><li></li> DOM traversal and whitespace When trying to do DOM manipulation in JavaScript, you can also encounter problems because of whitespace nodes. For example, if you have a reference to a parent node and want to affect its first element child using Node.firstChild, if there is a rogue whitespace node just after the opening parent tag you will not get the result you are expecting. The text node would be selected instead of the element you want to affect. As another example, if you have a certain subset of elements that you want to do something to based on whether they are empty (have no child nodes) or not, you could check whether each element is empty usi...
...espace node just after the opening parent tag you will not get the result you are expecting. The text node would be selected instead of the element you want to affect. As another example, if you have a certain subset of elements that you want to do something to based on whether they are empty (have no child nodes) or not, you could check whether each element is empty using something like Node.hasChildNodes(), but again, if any target elements contain text nodes, you could end up with false results. Whitespace helper functions The JavaScript code below defines several functions that make it easier to deal with whitespace in the DOM: /** * Throughout, whitespace is defined as one of the characters * "\t" TAB \u0009 * "\n" LF \u000A * "\r" CR \u000D * " " SPC \u0020 * * This does...
...And 12 more matches
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
/ Note that 'elemNameOrArray' is: either the full element name (eg. [html:]div) or an array of elements in JSON notation function tag(elemNameOrArray, elemAttr) { // Array of elements? Parse each one... ...
...Listener elem.addEventListener(key.replace(/^on/, ""), val, false); } else { // Note that the default namespace for XML attributes is, and should be, blank (ie. ...
... elem.addEventListener(key.replace(/^on/, ""), val, false); } else { // Note that the default namespace for XML attributes is, and should be, blank (ie. ...
...And 11 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
eturns an array of elements with the specified name in the document. Traverse the DOM Mozilla supports the W3C DOM APIs for traversing the DOM tree through JavaScript (see Table 2). The APIs exist for each node in the document and allow walking the tree in any direction. Internet Explorer supports these APIs as well, but it also supports its legacy APIs for walking a DOM tree, such as the children property. Table 2. Methods used to traverse the DOM Property/Method Description childNodes Returns an array of all child nodes of the element. firstChild Returns the first child node of the element. getAttribute( aAttributeName ) Returns the value for the specified attribute. hasAttribute( aAttributeName ) Returns a boolean stating ...
... nextSibling Returns the node immediately following the current one. ...
... nextSibling Returns the node immediately following the current one. nodeName Returns the name of the current node as a string. nodeType Returns the type of the current node. ...
...And 11 more matches
Anonymous Content - Archive of obsolete content
Introduction A binding can specify an anonymous content template using the content element. This template describes a content tree that will be generated around the bound element during binding attachment. An element declared in a bound document using a single tag can then be constructed out of multiple child elements, and this implementation is hidden from the bound document. For example, the HTML file upload control appears in most browsers as a composite widget consisting of a text field and a button. A sample XBL binding for the file widget might look as follows: <binding id="fileupload"> <content> <html:input type="text"/> <html:input type="button"/> </content> </binding> Because this content is not visible to its parent element, it is said to be anonymous content...
...d and a button. A sample XBL binding for the file widget might look as follows: <binding id="fileupload"> <content> <html:input type="text"/> <html:input type="button"/> </content> </binding> Because this content is not visible to its parent element, it is said to be anonymous content. Scoping and access using the DOM When a binding is attached and certain conditions are met, the children of the binding's content element are cloned. Elements and attributes in the XBL namespace are never cloned. For content generated underneath the bound element, the topmost nodes' parentNode pointers are set to the bound element. When anonymous content elements are built above the bound element, the topmost elements' parentNode pointers are set to the bound element's parentNode. All anonymous n...
...elements' parentNode pointers are set to the bound element's parentNode. All anonymous nodes' ownerDocument pointers are set to the bound document at the time of generation. In effect the anonymous content exists in its own insulated pocket within the document. Using parentNode, anonymous content nodes can refer to their explicit parents, but explicit parents have no knowledge of their anonymous children. The anonymous content is not accessible via the childNodes list for the bound element, nor is it accessible using firstChild/nextSibling to iterate over the children of the bound element. The anonymous content is accessible only through special methods like getAnonymousNodes and getAnonymousElementByAttribute. Anonymous content introduces the concept of scope to nodes within a document. Bec...
...And 11 more matches
Elements - Archive of obsolete content
ther XBL specification. <!ELEMENT bindings ( binding* ) > Hierarchy: root element May contain: <binding> The bindings element is the root element of any XBL document. It should usually declare XBL as the default namespace (unless an XBL namespace prefix is used) and it may additionally declare other namespace prefixes used in your binding. bindings contains zero or more binding elements as children. Each binding child element defines a unique binding that can be attached to elements in other documents. An element can have only one binding attached (explicitly or inherited) at one moment. From several bindings only the last in the sequence will be used (like with any CSS rule). helloworld.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>Hello world!</title>...
...hello.xml should reside in the same directory which contains helloworld.html. Next: bindings > binding element. Notes In the current stable releases of Mozilla products (e.g. Fi...
...ault content</p> <p>Default content</p> <p id="p03">Default content</p> </body> </html> hello.xml: <?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml"> <binding id="default"> <content><html:b>Hello world! </html:b><children/></content> </binding> <binding id="hello2"> <content><html:b>Hello from my binding! </html:b><children/></content> </binding> </bindings> You can view the result by opening helloworld.html in Firefox. hello.xml should reside in the same directory which contains helloworld.html. Next: bindings > binding element. Notes In the current stable releases of Mozilla products (e.g. Firefox 2) it is impossible to attach bindings to table sub-elements (rows, cells etc.) You can attach binding onl...
...And 11 more matches
Node.insertBefore() - Web APIs
Web › API › Node › insertBefore
The Node.insertBefore() method inserts a node before a reference node as a child of a specified parent node. If the given node already exists in the document, insertBefore() moves it from its current position to the new position. (That is, it will automatically be removed from its existing parent before appending it to the specified new parent.) This means that a node cannot be in two locations of the document simultaneously. Note: The Node.cloneNode() can be used to make a copy of the node before appending it under the new parent. Note that the copies made with cloneNode() will not be automatically kept in sync. If the given child is a DocumentFragment, the entire contents of the DocumentFragment are moved into the child list of the specified parent node. Syntax let insertedNode = pa...
...the child list of the specified parent node. Syntax let insertedNode = parentNode.insertBefore(newNode, referenceNode) insertedNode The node being inserted (the same as newNode) parentNode The parent of the newly inserted node. newNode The node to be inserted. referenceNode The node before which newNode is inserted. If this is null, then newNode is inserted at the end of parentNode's child nodes. Note: referenceNode is not an optional parameter. You must explicitly pass a Node or null. Failing to provide it or passing invalid values may behave differently in different browser versions. Return value Returns the added child (unless newNode is a DocumentFragment, in which case the empty DocumentFragment is returned). Example Example 1 <div id="parentElement"> <span id="chi...
...s. Return value Returns the added child (unless newNode is a DocumentFragment, in which case the empty DocumentFragment is returned). ...
...And 11 more matches
jspage - Archive of obsolete content
lash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(a[0]||0+"."+a[1],10)||0,build:parseInt(a[2],10)||0}; })();function $exec(b){if(!b){return b;}if(window.execScript){window.execScript(b);}else{var a=document.createElement("script");a.setAttribute("type","text/javascript"); a[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=b;document.head.appendChild(a);document.head.removeChild(a);}return b;}Native.UID=1; var $uid=(Browser.Engine.trident)?function(a){return(a.uid||(a.uid=[Native.UID++]))[0];}:function(a){return a.uid||(a.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(a){$uid(a); if(!a.Element){a.Element=$empty;if(Browser.Engine.webkit){a.document.createElement("...
...Key","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"]; b=b.associate(b);Hash.extend(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.inside=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){swit...
...function(l){if(!this.hasClass(l)){this.className=(this.className+" "+l).clean(); }return this;},removeClass:function(l){this.className=this.className.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)"),"$1");return this;},toggleClass:function(l){return this.hasClass(l)?this.removeClass(l):this.addClass(l); },adopt:function(){Array.flatten(arguments).each(function(l){l=document.id(l,true);if(l){this.appendChild(l);}},this);return this;},appendText:function(m,l){return this.grab(this.getDocument().newTextNode(m),l); },grab:function(m,l){a[l||"bottom"](document.id(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,document.id(m,true));return this;},replaces:function(l){l=document.id(l,true); l.parentNode.replaceChild(this,l);return this;},wraps:function(m,l){m=document.id(m,true);return ...
...And 10 more matches
Modifying a XUL Interface - Archive of obsolete content
<< PreviousNext >> The DOM provides various functions to modify the document. Creating New Elements You can create new elements using the createElement() function of the document. It takes one argument, the tag name of the element to create. You can then set attributes of the element using the setAttribute() function and append it to the XUL document using the appendChild() function. ...
...Notice that this is NOT the same as a vbox or an hbox. ...
...ox". This is a subtle dependency between the function and the XUL element to which you should pay attention. addButton() the calls the createElement() function to create a new button. Note this button is not visible, nor is it attached to anything yet. addButton() then assigns the label 'A new Button' to the button using the setAttribute() function. Finally the appendChild() function of the particular box found by getElementbyID() is called to add the button to it. At this point, the button is attached to a visible box, so it becomes visible as well. The button with the label "Add" can be pressed multiple times and it will continue to add new buttons, each of which will have the label "A new Button", and will only be distinguishable by their p...
...And 10 more matches
Processing XML with E4X - Archive of obsolete content
s insertion into a textbox). if (languages.@type.toString() === 'agile') { ... } or, simply: if (languages.@type == 'agile') { ... } Working with XML objects XML objects provide a number of methods for inspecting and updating their contents. ...
... Objects representing XML elements provide a number of useful methods, s...
... Bob Smith alert(person['name']); // Bob Smith alert(person.likes.browser); // Firefox alert(person['likes'].browser); // Firefox If you access something with more than one matching element, you get back an XMLList: alert(person.likes.language.length()); // 2 As with the DOM, * can be used to access all child nodes: alert(person.likes.*.length()); // 4 While the . operator accesses direct children of the given node, the .. operator accesses all children no matter how deeply nested: alert(person..*.length()); // 11 The length() method here returns 11 because both elements and text nodes are included in the resulting XMLList. Objects representing XML elements provide a number of useful methods, some of which are illustrated below: TODO: Add all of the methods to the JavaScript referen...
...And 10 more matches
nsIMsgThread
The nsIMsgFolder interface is used to interact with threads in Thunderbird. ...
... The nsIMsgFolder interface is used to interact with threads in Thunderbird. ...
... The nsIMsgFolder interface is used to interact with threads in Thunderbird. ...
...And 10 more matches
nsINavBookmarksService
void getBookmarkIdsForURI(in nsIURI aURI, [optional] out unsigned long count, [array, retval, size_is(count)] out long long bookmarks); Note: Renamed from getBookmarkFolders in Gecko 1.9 void getBookmarkIdsForURITArray(in nsIURI aURI, in PRInt64Array aResult); Native code only! ...
...nsIURI item, in PRInt32 index); Obsolete since Gecko 1.9 long long insertSeparator(in long long aParentId, in long aIndex); boolean isBookmarked(in nsIURI aURI); void moveFolder(in PRInt64 folder, in PRInt64 newParent, in PRInt32 index); Obsolete since Gecko 1.9 void moveItem(in long long aItemId, in long long aNewParentId, in long aIndex); void removeChildAt(in long long aFolder, in long aIndex); Obsolete since Gecko 2.0 void removeFolder(in long long aFolder); Obsolete since Gecko 2.0 void removeFolderChildren(in long long aItemId); void removeItem(in long long aItemId); void removeObserver(in nsINavBookmarkObserver observer); void replaceItem(in PRInt64 folder, in nsIURI item, in nsIURI newItem); Obsol...
...ContractId, in long aIndex ); Parameters aParentFolder The ID of the parent folder. aName The name of the new folder. aContractId The contract ID of the service which is to manipulate this container. aIndex The index to insert at, or DEFAULT_INDEX to append to the end of the list. Return value Returns the ID of the newly-inserted folder. createFolder() This method creates a new child folder and inserts it under the given parent. long long createFolder( in long long aParentFolder, in AUTF8String name, in long index ); Parameters aParentFolder The ID of the parent folder. name The name of the new folder. index The index to insert at, or DEFAULT_INDEX to append to the end of the list. Return value Returns the ID of the newly-inserted folder. endUpda...
...And 10 more matches
nsISHEntry
nt from history. Inherits from: nsIHistoryEntry Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Implemented by: @mozilla.org/browser/session-history-entry;1. ...
...n Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3) Implemented by: @mozilla.org/browser/session-history-entry;1. ...
... / SeaMonkey 2.3) Implemented by: @mozilla.org/browser/session-history-entry;1. ...
...And 10 more matches
Border-image generator - CSS: Cascading Style Sheets
================================================== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* For IE 6/7 (trigger hasLayout) */ } /* GRID COLUMN SETUP * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Component */ .ui-input-slider { height: 20px; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider * { float: left; height: 100%; line-height: 100%; } /* Input Slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: c...
...lue; var input = new InputComponent(this); var slider_left = new SliderComponent(this, -1); var slider_right = new SliderComponent(this, 1); slider_left.className = 'ui-input-slider-left'; slider_right.className = 'ui-input-slider-right'; if (name) { var info = document.createElement('span'); info.className = 'ui-input-slider-info'; info.textContent = name; node.appendChild(info); } node.appendChild(slider_left); node.appendChild(input); node.appendChild(slider_right); this.input = input; sliders[topic] = this; setValue(topic, value); }; InputSlider.prototype.setInputValue = function setInputValue() { this.input.value = this.value.toFixed(this.precision) + this.unit; }; var setValue = function setValue(topic, value, send_notify) { var slide...
...de.getAttribute('data-topic'); var label = node.getAttribute('data-label'); var selected = node.getAttribute('data-selected') | 0; var select = document.createElement('div'); var list = document.createElement('div'); var uval = 0; var option = null; var option_value = null; list.className = 'ui-dropdown-list'; select.className = 'ui-dropdown-select'; while (node.firstElementChild !== null) { option = node.firstElementChild; option_value = option.getAttribute('data-value'); if (option_value === null) option.setAttribute('data-value', uval); list.appendChild(node.firstElementChild); uval++; } node.appendChild(select); node.appendChild(list); select.onclick = this.toggle.bind(this); list.onclick = this.updateValue.bind(this); document.addEv...
...And 10 more matches
remote/parent - Archive of obsolete content
Enables you to load modules, and privileged parts of your add-on in general, into child processes. Usage In multiprocess Firefox: the browser UI runs in one process, sometimes called the chrome process or the parent process web content runs in one or more other processes, sometimes called content processes or remote processes or child processes. By default, add-ons run in the chrome process and can't directly access web content. In the SDK, content scripts run in the child process, and, of course, can access web content. But content scripts don't have many more capabilities than untrusted web content. The sdk/remote/parent module enables you to load SDK modules into the child process to give them direct access to content frames. These SDK modules have higher privileges than content ...
... frames. Frame Every DOM page loaded as a part of the application is loaded in a content frame. This includes the content of every tab in an application like Firefox and also some other UI elements. Each frame loads in a process but sometimes the application may choose to switch from loading a tab in one process to another. In this case the frame for that tab changes. Loading modules into the child process To load a module into the child process, use remoteRequire(): const { remoteRequire } = require("sdk/remote/parent"); remoteRequire("./my-module.js", module); Inter-process communication A module loaded into a different process cannot directly communicate or share state with the module that loaded it. Instead, the two sides communicate using port objects like those used for communicat...
...ire("./my-module.js", module); Inter-process communication A module loaded into a different process cannot directly communicate or share state with the module that loaded it. Instead, the two sides communicate using port objects like those used for communication with content scripts. ...
...And 9 more matches
Microsummary XML grammar reference - Archive of obsolete content
the microsummary created by the generator. uri (optional) A valid URI uniquely identifying the generator. Only relevant for generators dynamically created by Firefox code and extensions. Generators installed from the web via nsSidebar::addMicrosummaryGenerator are identified by the remote URL from which they were downloaded, and Firefox ignores the value of this attribute for them. Child Elements: <template> (required) Defines how to transform pages into their microsummaries. <pages> (required) Identifies the set of pages that the generator is able to summarize. <update> (optional) Specifies how frequently Firefox should update the microsummaries. The <template> element The <template> element contains the XSLT stylesheet which transform...
...ow to transform pages into their microsummaries. <pages> (required) Identifies the set of pages that the generator is able to summarize. <update> (optional) Specifies how frequently Firefox should update the microsummaries. The <template> element The <template> element contains the XSLT stylesheet which transforms web pages into their microsummaries. Attributes: None. Child Elements: <stylesheet> or <transform> (required) The XSLT stylesheet which performs the transformation. Per XSLT, you may specify the stylesheet child element using either the <stylesheet> or the <transform> tag, which are interchangeable. Note: Although the <template> element must be in the microsummaries namespace (http://www.mozilla.org/microsummaries/0.1), its <stylesheet>/...
... The <pages> element The <pages> element identifies the set of pages that the generator is able to summarize. Attributes: None. ...
...And 9 more matches
Advanced Rules - Archive of obsolete content
This section describes the more advanced rule syntax. The Full Rule Syntax The rule syntax described so far is useful for some datasources but sometimes you will need to display data in more complicated ways. The simple rule syntax is really just a shortcut for the full rule syntax which is described below. Like the simple rules, full rules are placed within the rule tag. Full rules contain three child tags, a conditions tag, a bindings tag and an action tag, although the bindings tag is not always needed. The conditions element is used to specify the criteria for matching a given resource. You can specify a number of conditions, all of which must match. In the simple rule syntax, the conditions are placed directly on the rule element itself. If the conditions match for a resource, the content ...
...he rule element itself. If the conditions match for a resource, the content placed within the actions tag is generated. In the simple syntax, the content is placed directly inside the rule. Rule Conditions When a tree, menu or other element with a datasource generates content, the template builder first finds the resource referred to by the ref attribute. It then iterates over all that resource's child resources. It applies each resource to the conditions. If the conditions match for that resource, the content in the actions element is generated for that resource. If the conditions do not match, no content is generated. content element The conditions element can contain three elements. The first is the content element, which should always exist once and only once. It serves as a placeholder as ...
...ent containing the template. The syntax of the content element is as follows: <content uri="?var"/> The question mark indicates that the text following it is a variable. You can then use the variable 'var' within the remainder of the conditions. Of course, you can name the variable whatever you want. member element The next element is the member element, which is used to iterate through a set of child resources. In RDF terms, that means a container such a Seq, Bag or Alt. Let's say you have a list of cities described in the following RDF/XML fragment: <RDF:Seq about="http://www.xulplanet.com/rdf/weather/cities"> <RDF:li resource="http://www.xulplanet.com/rdf/weather/city/Paris"/> <RDF:li resource="http://www.xulplanet.com/rdf/weather/city/Manchester"/> <RDF:li resource="http://www.xulpla...
...And 9 more matches
More Tree Features - Archive of obsolete content
eviousNext >> Here, we'll see more features of trees. Hierarchical trees The tree element is also used to create hierarchical lists, like that found in a file manager or a browser's bookmarks list. The tree view has a number of functions which specify the hierarchy of the items in a tree. Each item in the tree has a level starting at 0. The topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. The tree will query the view for the level of each item in order to determine how to draw the rows. The tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. The tree will also handle drawing the rows with the right level...
...You can repeat this process to create deeply nested trees. ...
...t level of indenting. However, the view will need to make sure it keeps track of the level of the rows as necessary. This can sometimes be quite tricky, but fortunately, the built-in content tree view does all of the hard work for us. To create a set of nested rows, all we need to do is add a second treechildren element inside the parent treeitem. You can then add items inside that to specify the child rows of an item. Don't put the inner treechildren element inside the treerow as this won't work. You can repeat this process to create deeply nested trees. Essentially, a treeitem element can contain either single rows which are declared with the treerow element or a set of rows which are declared with the treechildren element. There are two other things you need to do to make sure the hierarchy ...
...And 9 more matches
XBL Example - Archive of obsolete content
, this widget might be useful for a set of images. We'll call this a slideshow element. Content of the Slideshow First, let's determine what elements need to go in the XBL content. Because we want page flipping, a deck element would be the most suitable to hold the page content. The content of the pages will be specified in the XUL file, not in XBL, but we'll need to add it inside the deck. ...
...ot in XBL, but we'll need to add it inside the deck. The children tag will need to be used. Along the bottom, we'll need a button to go the previous page, a label to display the current page number, and a button to go to the next page. Example 1 : Source <binding id="slideshow"> <content> <xul:vbox flex="1"> <xul:deck xbl:inherits="selectedIndex" selectedIndex="0" flex="1"> <children/> </xul:deck> <xul:hbox> <xul:button xbl:inherits="label=previoustext"/> <xul:label flex="1"/> <xul:button xbl:inherits="label=nexttext"/> </xul:hbox> </xul:vbox> </content> </binding> This binding creates the slideshow structure that we want. The flex attribute has been added to a number of elements so that it stretches in the right way. The l...
... </content> </binding> This binding creates the slideshow structure that we want. The flex attribute has been added to a number of elements so that it stretches in the right way. The label attributes on the two buttons inherit their values from the bound element. Here, they inherit from two custom attributes, previoustext and nexttext. This makes it easy to change the labels on the buttons. The children of the element that the XBL is bound to will be placed inside the deck. The selectedIndex is inherited by the deck, so we may set the initial page in the XUL. The following XUL file produces the result in the image. <box class="slideshow" previoustext="Previous" nexttext="Next" flex="1"> <button label="Button 1"/> <checkbox label="Checkbox 2"/> <textbox/> </box> The style sheet used ...
...And 9 more matches
Flexbox - Learn web development
tools available for creating CSS layouts were things like floats and positioning. These are fine and they work, but in some ways they are also rather limiting and frustrating. The following simple layout requirements are either difficult or impossible to achieve with such tools, in any kind of convenient, flexible way: Vertically centering a block of content inside its parent. Making all the children of a container take up an equal amount of the available width/height, regardless of how much width/height is available. Making all columns in a multiple column layout adopt the same height even if they contain a different amount of content. As you'll see in subsequent sections, flexbox makes a lot of layout tasks much easier. Let's dig in! Introducing a simple example In this article we a...
... as flexible boxes To start with, we need to select which elements are to be laid out as flexible boxes. To do this, we set a special value of display on the parent element of the elements you want to affect. In this case we want to lay out the <article> elements, so we set this on the <section>: section { display: flex; } This causes the <section> element to become a flex container, and its children to become flex items. The result of this should be something like so: So, this single declaration gives us everything we need -- incredible, right? We have our multiple column layout with equal sized columns, and the columns are all the same height. This is because the default values given to flex items (the children of the flex container) are set up to solve common problems such as this. ...
...columns, and the columns are all the same height. This is because the default values given to flex items (the children of the flex container) are set up to solve common problems such as this. To be clear, let's reiterate what is happening here. The element we've given a display value of flex to is acting like a block-level element in terms of how it interacts with the rest of the page, but its children are being laid out as flex items -- the next section will explain in more detail what this means. Note also that you can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element. The flex model When elements are laid out as flex items, they are laid out along two axes: The main axis is the axis run...
...And 9 more matches
IAccessibleTable
other-licenses/ia2/AccessibleTable.idlNot scriptable This interface gives access to a two-dimensional table. 1.0 66 Introduced Gecko 1.9 Inherits from: IUnknown Last changed in Gecko 1.9 (Firefox 3) Typically all accessible objects that represent cells or cell-clusters of a table will be at the same time children of the table. In this case IAccessible2.indexInParent() will return the child index which then can be used when calling rowIndex() and columnIndex(). However, in some cases that kind of implementation will not be possible. When the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. This object attribute is obtained by parsing the att...
... cases that kind of implementation will not be possible. When the table cells are not direct children of a table, the object representing the cell can define a "table-cell-index" object attribute identifying the 0 based table cell index. This object attribute is obtained by parsing the attribute string returned by IAccessible2.attributes(). The "table-cell-index" attribute can be used just like a child index of the typical case. ATs should first test for the presence of the "table-cell-index" attribute and if it is not present then IAccessible2.indexInParent() can be used as in the typical case where cells are direct children of the table. The range of valid coordinates for this interface are implementation dependent. However, that range includes at least the intervals from the from the first r...
...dependent. However, that range includes at least the intervals from the from the first row or column with the index 0 up to the last (but not including) used row or column as returned by nRows() and nColumns(). ...
...And 9 more matches
Block and Line Layout Cheat Sheet - Archive of obsolete content
t when the frame is being actively being reflowed. By default it is set in WillReflow(), and unset in DidReflow(). Many frames' Reflow() method verifies that the bit is set with an assertion. NS_FRAME_FIRST_REFLOW This flag is set on a newly created frame, and later cleared by the frame's Reflow() method when the frame has had its initial reflow. NS_FRAME_SYNC_FRAME_AND_VIEW NS_FRAME_OUTSIDE_CHILDREN This flag is set if the combined area of a frame's children extend past the frame's bounding box. (What is a frame's "bounding box"?) If this flag is set, then <code>mOverflowArea</code> will contain the total area of the frame, including the overflow. NS_FRAME_EXTERNAL_REFERENCE NS_FRAME_REPLACED_ELEMENT NS_FRAME_GENERATED_CONTENT NS_FRAME_HAS_LOADED_IMAGES NS_FRAME_OUT_OF_FLOW NS...
..._ELEMENT NS_FRAME_GENERATED_CONTENT NS_FRAME_HAS_LOADED_IMAGES NS_FRAME_OUT_OF_FLOW NS_FRAME_SELECTED_CONTENT NS_FRAME_IS_DIRTY NS_FRAME_IS_UNFLOWABLE An unflowable frame is an error condition; for example, due to system limitations. Currently, the only way to get an unflowable frame is to have a frame tree that is "too deep". (See nsFrame::IsFrameTreeTooDeep().) NS_FRAME_HAS_DIRTY_CHILDREN NS_FRAME_HAS_VIEW NS_FRAME_INDEPENDENT_SELECTION NS_FRAME_IS_SPECIAL nsBlockFrame mFlags These flags are the private flags that are meaningful to block frames. NS_BLOCK_SHRINK_WRAP Causes the block to "shrink-wrap" around its content. This means the block will determine its children's width and make its content area that wide. Finally, it will add padding and border to determine...
...Used in nsBlockReflowContext::ComputeCollapsedTopMargin(). ...
...And 8 more matches
Places Developer Guide
arksService.bookmarksMenuFolder - The contents of this folder are visible in the Bookmarks menu. nsINavBookmarksService.toolbarFolder - The contents of this folder are visible on the Bookmarks toolbar. nsINavBookmarksService.unfiledBookmarksFolder - Items that have been "starred", but not places in any folder. nsINavBookmarksService.tagsFolder - Subfolders of this folder are tags, and their children are URIs that have been tagged with that folder's name. Other Bookmarks APIs Note: This document covers the toolkit Places services. However, Firefox developers can take advantage of several helper APIs that are browser-specific: FUEL - A collection of wrapper APIs for easing access to a number of Firefox utilities and services nsIPlacesTransactionsService - A Firefox service for modifyi...
...en item. String getItemGUID(aItemId) Obsolete since Gecko 14.0 - Returns a globally unique identifier for the item. This is mainly for use by extensions that sync bookmark data between different profiles. For bookmarks: nsIURI getBookmarkURI(aItemId) - Returns the URI of a bookmark item String getKeywordForBookmark(aItemId) - Returns a bookmark's keyword, or null For folders: Int64 getChildFolder(aFolderId, aSubfolderTitle) - Returns the id of the first subfolder matching the given title. Int64 getIdForItemAt(aFolderId, aPosition) - Returns the id of the item at the given position (throws if there's no item there). Bool getFolderReadonly(aFolderId) Accessing Folder Contents Queries in Places are executed through the main history service. The example below shows how to enumerate...
...vHistoryService); var query = history.getNewQuery(); query.setFolders([myFolderId], 1); var result = history.executeQuery(query, history.getNewQueryOptions()); // The root property of a query result is an object representing the folder you specified above. var folderNode = result.root; // Open the folder, and iterate over its contents. ...
...And 8 more matches
Adding sidebars - Archive of obsolete content
ostly empty panels. Decks and stacks Sometimes you'll need finer grained control than the one provided by a tabbox. In these cases the << XUL Reference << and << XUL Reference << elements are probably what you're looking for. They are extremely useful, and you'll find yourself using them in many situations besides sidebars. A deck is like a tabbbox without the tabs. It only displays one of its child nodes at a time, depending on its selectedIndex value. In the following example, the second child will be displayed, not the first which would be the default. <deck selectedIndex="2"> <hbox> <!-- Content for the first child. --> </hbox> <hbox> <!-- Content for the second child. --> </hbox> </deck> Note how this is one of the few cases where an attribute of an element is na...
...The code is easier to read and maintain this way. ...
...The code is easier to read and maintain this way. A deck can be very useful when you have a large piece of XUL code that only changes in a small way depending on different circumstances. ...
...And 7 more matches
Building Trees - Archive of obsolete content
action body should be a single treeitem with its rows and cells. ...
...This template uses the simple rule syntax. The extended syntax could also be used. ...
...rce: <tree datasources="profile:messages.sqlite" ref="*" querytype="storage" flags="dont-build-content"> <treecols> <treecol id="subject" label="Subject" flex="3"/> <treecol id="sender" label="Sender" flex="2"/> <treecol id="date" label="Date" flex="1"/> </treecols> <template> <query> select subject, sender, date from messages </query> <action> <treechildren> <treeitem uri="?"> <treerow> <treecell label="?subject"/> <treecell label="?sender"/> <treecell label="?date"/> </treerow> </treeitem> </treechildren> </action> </template> </tree> Features of the Tree Builder Besides the label of a cell, there are several other cell properties you can set when using the tree...
...And 7 more matches
Anonymous Content - Archive of obsolete content
<textbox/> <button label="Browse..."/> </content> </binding> Attaching this binding to an element will cause it to contain a field for entering text, followed by a Browse button. This inner content is created anonymously and cannot be seen using the DOM. Override the Bound Element The anonymous content is created automatically whenever a binding is attached to an element. If you place child elements inside the XUL, they will override the elements provided by the binding. For example, take this XUL fragment, assuming it is bound to the scrollbar XBL earlier: <scrollbar/> <scrollbar> <button label="Overridden"/> </scrollbar> The first scroll bar, because it has no content of its own, will have its content generated from a binding definition declared in an XBL file. The second scro...
... something that isn't much of a scroll bar at all. Note that the built-in elements such as scroll bars get their XBL from the files in the bindings directory in the toolkit package. This only applies to the elements defined within the content tag. Properties, methods and other aspects of XBL are still available whether the content is from XBL or whether the XUL provides its own content. Using the Children Element There may be times when you want both the XBL content and the content provided by the XUL file to be displayed. You can do this by using the children element. The children added in the XUL are added in place of the children element. This is handy when creating custom menu widgets. For example, a simplified version of an editable menulist element, might be created as follows: XUL: <men...
...andy when creating custom menu widgets. ...
...And 7 more matches
Document Object Model - Archive of obsolete content
.hidden = false; var searchtext=document.getElementById('find-text').value; alert("Searching for \"" + searchtext + "\""); } Now, with that alert box in there, we know what should happen when we click the Find button. We could add additional code to get the selections from the drop-down boxes too. XUL Element DOM Every XUL element has a set of attributes, a set of properties and a set of children. The attributes are declared in the source, for example, flex="1", is a flex attribute set to the value 1. Properties are available in JavaScript using the dot syntax. For example, element.hidden refers to the hidden property of an element. The children are the child tags of the element and will be nested inside the element in the source. It is possible to manipulate the attributes, pro...
... It is important to note that attributes and properties are separate things. ...
...imilar to the the getAttribute() function except an additional argument may be supplied to specify an attribute in a specific namespace. Many XUL elements have their own properties that are unique to that element. Refer to the element reference for a full guide to the attributes and properties available for an element. Navigating the DOM The DOM is a tree structure with a single root node with children. You can get a reference to the root node using the document's documentElement property. The root node is always an element, but this is not the case for other nodes in the tree. An element corresponds to a tag is the XUL source, but you may also find text nodes, comment nodes and a few other types in a document tree. In the case of XUL, the root element will be the window tag in the XUL docum...
...And 7 more matches
Trees - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Trees
ing advanced features, progress meters or checkboxes also can be added to the tree) A tree consists of two parts, the set of columns, and the tree body. The set of columns is defined by a number of treecol elements, one for each column. Each column will appear as a header at the top of the tree. The second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. The tree is unique in that the body of the tree consists only of a single widget which draws all of the data in the tree. This contrasts with the listbox, where individual listitem and listcell tags are used to specify the rows in the listbox. In a tree, all of the data to be displayed is supplied by a separate object, called a tree view. When it comes time to display a cell, the tree w...
...he tree. By using this element, you can specify additional information about how the data in the columns are sorted and if the user can resize the columns. You should always place an id attribute on a column, as Mozilla uses the ids to identify the columns when rearranging and hiding them. This is no longer required in Mozilla 1.8 and later, but it is still a good idea to use ids on columns. ...
...This declares an element that is used as a table or tree. As with HTML tables, the data in a tree is always organized into rows. The columns are specified using the treecols tag. You may place as many columns as you wish in a tree. ...
...And 7 more matches
Table Reflow Internals - Archive of obsolete content
flow command with itself as the target. Content is inserted, appended, or deleted through the DOM. The container posts a dirty reflow command with itself as the target. Style changes through the DOM - javascript, browser change font (CTRL+/-), a preference changes, etc. Review of Reflow Reflow starts with pres shell Which reflows the reflow root (usually the viewport frame), Which reflows it children, etc. Ususally it starts when the pres shell processes its queue of reflow commands. The reflower Positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) Reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out) Review of Reflow The reflow state: Is a node in a tree structurally equivalent to the fram...
... size (if requested) - the minimum size it can be preferred size (if requested) - the size it would like to be given no size constraints. desired size - the size it would like to be given the avail size. This is equivalent to preferred size if the avail size is not constrained. Review of Reflow The reflowee sets various sizes in the reflow metrics after (possibly) reflowing some or all of its children which reflows it children, etc. The reflowee returns a reflow status which indicates if it is complete, and thus not have to continue (split) breaking status (in the case of some inline frames) if there is truncation (it can't fit in the space and can't split). This is just a convience mechanism. Kinds of reflows Initial - reflowee's first reflow must be of this type (reflower's responsib...
...ce mechanism. Kinds of reflows Initial - reflowee's first reflow must be of this type (reflower's responsibility). Resize - reflowee gets a change in available space only. Similar to initial, except it can reoccur. Incremental - has a reflow path (tree) where each node has a command with a target frame, reflow command types are: dirty - something changed inside a target (e.g. it gains, loses children) style changed - a target changed stylisticly (recall, size is a style property) content changed - a target's content changed (e.g. a text run) user defined - currently only used for fixed positioned frames Kinds of reflows Incremental reflow (continued) reflower not allowed to change available size of reflowee reflow commands get coalesced to streamline processing Style change a targe...
...And 7 more matches
Manipulating documents - Learn web development
ted by the DOM in browsers) is the actual page loaded into the window, and is represented in JavaScript by the Document object. You can use this object to return and manipulate information on the HTML and CSS that comprises the document, for example get a reference to an element in the DOM, change its text content, apply new styles to it, create new elements and add them to the current element as children, or even delete it altogether. In this article we'll focus mostly on manipulating the document, but we'll show a few other useful bits besides. The document object model The document currently loaded in each one of your browser tabs is represented by a document object model. This is a "tree structure" representation created by the browser that enables the HTML structure to be easily access...
...he tree -- each one is called a node. You will also encounter various terms used to describe the type of node, and their position in the tree in relation to one another: Element node: An element, as it exists in the DOM. Root node: The top node in the tree, which in the case of HTML is always the HTML node (other markup vocabularies like SVG and custom XML will have different root elements). Child node: A node directly inside another node. For example, IMG is a child of SECTION in the above example. Descendant node: A node anywhere inside another node. For example, IMG is a child of SECTION in the above example, and it is also a descendant. IMG is not a child of BODY, as it is two levels below it in the tree, but it is a descendant of BODY. Parent node: A node which has another node insi...
...es: Nodes that sit on the same level in the DOM tree. For example, IMG and P are siblings in the above example. Text node: A node containing a text string. It is useful to familiarize yourself with this terminology before working with the DOM, as a number of the code terms you'll come across make use of them. You may have also come across them if you have studied CSS (e.g. descendant selector, child selector). Active learning: Basic DOM manipulation To start learning about DOM manipulation, let's begin with a practical example. Take a local copy of the dom-example.html page and the image that goes along with it. Add a <script></script> element just above the closing </body> tag. To manipulate an element inside the DOM, you first need to select it and store a reference to it inside a v...
...And 7 more matches
Using the CSS Typed Object Model - Web APIs
We iterate through the s...
...We iterate through the style map, creating a <dt> and <dd> for each property an...
...We iterate through the style map, creating a <dt> and <dd> for each property and value respectively. In browsers that support computedStyleMap(), you'll see a list of all th...
...And 7 more matches
Notes on HTML Reflow - Archive of obsolete content
::StyleChangeReflow), and affect the entire frame tree. Other reflows are incremental and are dealt with asynchronously; for example, when content streams in from the network. Incremental reflows are queued by the presentation shell for batched dispatch. Reflow State The reflow state object, nsHTMLReflowState, is used to pass constraining information "down" from parent frames to child frames. For example, a <div> with a constrained width (e.g., set via the CSS width property) would note this in the reflow state object before flowing its children. When reflow begins, the root reflow state is initialized with information about the top-level container for the document's presentation; e.g., the width and height of the application window. This is passed as an argument to t...
...nitialized with information about the top-level container for the document's presentation; e.g., the width and height of the application window. This is passed as an argument to the Reflow method of the root frame in the frame hierarchy. Each container frame constructs a new reflow state object (based on its container's reflow state object) in which the container will reflow its children. Most of the constraints in the new reflow state are computed when the state is created; for example, the available space in the new reflow state is computed by subtracting the container frame's border and padding from the parent reflow state's available space. Reflow Reason All reflows have a reason , which is maintained in the reflow state object (and may mutate, as described below)...
...he frame's internal state (e.g., a text frame's text) has changed; instead, a top-down change in the layout constraints has occurred. StyleChange, when the entire frame hierarchy must be traversed to recover from stylistic change; for example, a change in the default font size. Dirty, when a container frame has consolidated several individual Incremental reflows that have been targeted at its child frames. Initial, incremental, resize, and style change reflows may each be performed as an immediate "global" reflow from the presentation shell: An initial reflow is performed when the presentation shell is initialized to flow the shell's initial frame hierarchy. Incremental reflows are dispatched en masse when the presentation shell's incremental reflow queue is asynchronou...
...And 6 more matches
Building accessible custom components in XUL - Archive of obsolete content
s are laid out within the grid element. If you want to navigate up one row, it is relatively easy to find the right cell; it's the previous sibling of the currently focused cell. Similarly, navigating down one row simply requires finding the next sibling of the currently focused cell. But navigating left and right is more difficult, since the cells are laid out in columns. We need to find the Nth child of the previous column. (We could have laid out the grid by rows instead of columns, but that just shifts the complexity to a different navigation command.) Here is the keyboard navigation code: <code> const KEY_UP = 38; const KEY_DOWN = 40; const KEY_LEFT = 37; const KEY_RIGHT = 39; function cell_keypress(e) { var current = e.target; switch (e.keyCode) { case KEY_UP: spreads...
...null : arSiblings[row - 1]; } function find_cell_down(current) { var row = get_index_within_parent(current)...
...current); if (next) { next.focus(); } } function get_index_within_parent(current) { var arSiblings = current.parentNode.childNodes; for (var i = 0; i < arSiblings.length; i++) { if (arSiblings[i] == current) { return i; } } return -1; } function find_cell_up(current) { var row = get_index_within_parent(current); var arSiblings = current.parentNode.childNodes; return row == 0 ? null : arSiblings[row - 1]; } function find_cell_down(current) { var row = get_index_within_parent(current); var arSiblings = current.parentNode.childNodes; return row == arSiblings.length - 1 ? null : arSiblings[row + 1]; } function find_cell_left(current) { var row = get_index_within_parent(current); var column = get_index_within_parent(current.
...And 6 more matches
Stacks and Decks - Archive of obsolete content
ates its own elements if you don't provide them. It also handles the moving of the scroll bar thumb. In the next few sections, we'll introduce some elements that are designed for holding other elements. They are all special types of boxes and allow all of the attributes of boxes on them. Stacks The stack element is a simple box. ...
...andles the moving of the scroll bar thumb. In the next few sections, we'll introduce some elements that are designed for holding other elements. They are all special types of boxes and allow all of the attributes of boxes on them. Stacks The stack element is a simple box. It works like any other box but has the special property that its children are laid out all on top of each other. ...
...next few sections, we'll introduce some elements that are designed for holding other elements. They are all special types of boxes and allow all of the attributes of boxes on them. Stacks The stack element is a simple box. It works like any other box but has the special property that its children are laid out all on top of each other. The first child of the stack is drawn underneath, the second child is drawn next, followed by the third and so on. Any number of elements may be stacked up in a stack. ...
...And 6 more matches
Pseudo-classes and pseudo-elements - Learn web development
If we wanted to make the first paragraph in an article larger and bold, we could add a class to that paragraph and then add CSS to that class, as shown in the first example below: However, this could be annoying to maintain -- what if a new paragraph got added to the top of the document? We'd need to move the class over to the new paragraph. Instead of adding the class, we could use the :first-child pseudo-class selector -- this will always target the first child element in the article, and we will no longer need to edit the HTML (this may not always be possible anyway, maybe due to it being generated by a CMS.) All pseudo-classes behave in this same kind of way. They target some bit of your document that is in a certain state, behaving as if you had added a class into your HTML. Take a l...
...arget the first child element in the article, and we will no longer need to edit the HTML (this may not always be possible anyway, maybe due to it being generated by a CMS.) All pseudo-classes behave in this same kind of way. They target some bit of your document that is in a certain state, behaving as if you had added a class into your HTML. Take a look at some other examples on MDN: :last-child :only-child :invalid Note: It is valid to write pseudo-classes and elements without any element selector preceding them. In the example above, you could write :first-child and the rule would apply to any element that is the first child of an <article> element, not just a paragraph first child -- :first-child is equivalent to *:first-child. However, usually you want more control than that, so...
...increases and decreases it will still only select the first line. It acts as if a <span> was magically wrapped around that first formatted line, and updated each time the line length changed. You can see that this selects the first line of both paragraphs. ...
...And 6 more matches
Styling tables - Learn web development
Normally, table columns tend to ...
...Normally, table columns tend to be sized according to how much content th...
...Normally, table columns tend to be sized according to how much content they contain, which produces some strange r...
...And 6 more matches
Client-side storage - Learn web development
erenced displayData() twice in our code already, so we'd probably better define it. ...
...ice in our code already, so we'd probably better define it. ...
...already, so we'd probably better define it. ...
...And 6 more matches
Working with JSON - Learn web development
th it. Populating the header Now that we've retrieved the JSON data and converted it into a JavaScript object, let's make use of it by writing the two functions we referenced above. First of all, add the following function definition below the previous code: function populateHeader(jsonObj) { const myH1 = document.createElement('h1'); myH1.textContent = jsonObj['squadName']; header.appendChild(myH1); const myPara = document.createElement('p'); myPara.textContent = 'Hometown: ' + jsonObj['homeTown'] + ' // Formed: ' + jsonObj['formed']; header.appendChild(myPara); } We named the parameter jsonObj, to remind ourselves that this JavaScript object originated from JSON. Here we first create an <h1> element with createElement(), set its textContent to equal the squadName property of ...
...We then do a very similar operation with a paragraph: create it, set its text content and append it to the header. The only difference is that its text is set to a concatenated string containing both the homeTown and formed properties of the object. ...
...This array contains multiple objects that contain the information for ea...
...And 6 more matches
Componentizing our Svelte app - Learn web development
a problem -- the todos aren't filtered. That's because the filter variable flows down from the Todos component to the FilterButton component through the prop, but changes occurring in the FilterButton component don't flow back up to its parent -- the data binding is one-way by default. Let's look at a way to solve this. ...
...m the Todos component to the FilterButton component through the prop, but changes occurring in the FilterButton component don't flow back up to its parent -- the data binding is one-way by default. Let's look at a way to solve this. Sharing data between components: passing a handler as a prop One way to let child components notify their parents of any changes is to pass a handler as a prop. The child component will execute the handler, passing the needed information as a parameter, and the handler will modify the parent's state. In our case, the FilterButton component will receive an onclick handler from its parent. Whenever the user clicks on any filter button, the child will call the onclick handler, passing the selected filter as a parameter, back up to its parent. We will just declare t...
...tton {filter} onclick={ (clicked) => filter = clicked }/> When any filter button is clicked, we just update the filter variable with the new filter. Now our FilterButton component will work again. ...
...And 6 more matches
Message manager overview
Different tabs may run in different processes. Message managers are designed to enable code in one process to communicate with code in a different process. ...
...ts are called frame scripts, and as the name suggests, they are scoped to a specific browser frame. If chrome code wants to run code in the content process so it can access web content, this is usually the sort of message manager to use. Process message managers: these correspond to process boundaries, and enable code running in the parent (chrome) process to communicate with code running in the child (content) process. From Firefox 38 onwards, they also enable code running in the parent process to load process scripts into the child process. These are like frame scripts, except they are global to the child process. Process scripts are most likely to be useful when chrome code wants to run some code only once in the content process, to access some global service: for example, to register an ob...
...er nsIMessageSender The browser message manager can be accessed as a property of the XUL <browser> element: // chrome script let browserMM = gBrowser.selectedBrowser.messageManager; Process message managers Process message managers correspond to process boundaries, and enable code running in different processes to communicate. Multiprocess Firefox has the concept of: a "parent process" "child processes" which are processes spawned by the parent process. For practical purposes, in multiprocess Firefox the parent process is the chrome process, and child processes are content processes. In each child process, there's a single child process message manager (CPMM). For each child process message manager, there's a parent process message manager (PPMM) in the parent process. There's als...
...And 6 more matches
sslfnc.html
a NULL value or a value that is out of range for any of the parameters causes the server default value to be used in the server cache. The values that you pass affect only the server cache, not the client cache. ...
... client cache. Initializing Multi-Processing with a Shared SSL Server Cache To start a multi-processing application, the initial parent process calls SSL_ConfigMPServerSIDCache, and then creates child processes, by one of these methods: Call fork and then exec (Unix) Call CreateProcess (Win32) Call PR_CreateProcess (both Unix and Win32) It is essential that the parent allow the child to inherit the file descriptors. WIN32's CreateProcess takes an argument that tells it whether or not to permit files to be inherited; this argument must be TRUE. When a new child that has been created by either CreateProcess or exec begins, it may have inherited file descriptors (FDs), but not the parent's memory. Therefore, to find out what FDs it has inherited, it must be told about them. T...
...memory. Therefore, to find out what FDs it has inherited, it must be told about them. To that end, the function SSL_ConfigMPServerSIDCache sets an environment variable named SSL_INHERITANCE. The value of the variable is a printable ASCII string, containing all the information needed to set up and use the inherited FDs. ...
...And 6 more matches
Mail and RDF
accounts:/. From this resource, you can follow a number of arcs to find servers, folders, and finally messages. Eventually we'll probably hang mail filters, annotations, etc, off of nodes in the graph. Here is an example of how this might be set up: In this tree-style representation of an RDF graph, I've made arcs italic and resources bold. ...
...annotations, etc, off of nodes in the graph. Here is an example of how this might be set up: In this tree-style representation of an RDF graph, I've made arcs italic and resources bold. ...
... | imap://alecf@imap.mywork.com | +-- http://home.netscape.com/NC-rdf#IsServer --> "true" | +-- http://home.netscape.com/NC-rdf#child --> | imap://alecf@imap.mywork.com/INBOX | +-- http://home.netscape.com/NC-rdf#TotalMessages --> "4" | +-- http://home.netscape.com/NC-rdf#IsServer --> "false" | +-- http://home.netscape.com/NC-rdf#MessageChild --> | | imap_message://alecf@imap.mywork.com/INBOX#1 | +-- http://home.netscape.com/NC-rdf#MessageChild --> | | imap_message://alecf@imap.mywork.com/INBOX#2 | +-- http://home.netscape.com/NC-rdf#MessageChild --> | | imap_message://alecf@imap.mywork.com/INBOX#3 | +-- http://home.netscape.com/NC-rdf#MessageChild --> | ...
...And 6 more matches
Adding items to the Folder Pane
Clicking on those items will display the number in the main viewing pane of Thunderbird. First, some necessary background on how the Folder Pane constructs the data it displays. The Folder Pane tracks modifications to a user's folders and accounts. ...
...a in a property called _rowMap. This property is an array of folder-tree-items. Each item in this array satisfies the following interface: id (attribute) a unique string for this object. Must persist over sessions text (attribute) the text to display in the tree level (attribute) the level in the tree to display the item at open (rw, attribute) whether or not this container is open children (attribute) an array of child items also conforming to this spec getProperties (function) a call from getRowProperties or getCellProperties for this item will be passed into this function command (function) this function will be called when the item is double-clicked For our example extension, two different types of folder-tree-items will be defined. First, our "Numbers" container lo...
... will be passed into this function command (function) this function will be called when the item is double-clicked For our example extension, two different types of folder-tree-items will be defined. ...
...And 6 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
, and a <span> is inline-level. Using the display property we can switch between block and inline. For example to make a heading inline we would use the following CSS: h1 { display: inline; } More recently we have gained CSS Grid Layout and Flexbox. To access these we also use values of the display property -- display: grid and display: flex. Only when the value of display is changed do the children become flex or grid items and begin to respond to the other properties in the grid or flexbox specifications. Changing an element's display value changes the formatting context of its direct children. What grid and flexbox demonstrate, however, is that an element has both an outer and an inner display type. The outer display type describes whether the element is block-level or inline-level. T...
...to respond to the other properties in the grid or flexbox specifications. Changing an element's display value changes the formatting context of its direct children. What grid and flexbox demonstrate, however, is that an element has both an outer and an inner display type. The outer display type describes whether the element is block-level or inline-level. The inner display type describes how the children of that box behave. As an example, when we use display: flex we create a block-level container, with flex children. The children are described as participating in a flex formatting context. You can see this if you take a <span> -- normally an inline-level element -- and apply display: flex to it. The <span> becomes a block-level element. It behaves as block-level things do in relationship to ...
...ren are described as participating in a flex formatting context. You can see this if you take a <span> -- normally an inline-level element -- and apply display: flex to it. The <span> becomes a block-level element. It behaves as block-level things do in relationship to other boxes in the layout. It's as if you had applied display: block to the span, however we also get the changed behavior of the children. The live example below has a <span> with display: flex applied. It has become a block-level box taking up all available space in the inline direction. You can now use justify-content: space-between; to put this space between the two flex items. We can create inline flex containers. If you create a flex container using the single value of inline-flex you will have an inline-level box with ...
...And 6 more matches
Object.prototype.constructor - JavaScript
g() function String() { [native code] },false,test // 'test' Changing the constructor of a function Mostly this property is used for defining a function as a function-constructor with further calling it with new and prototype-inherits chain. function Parent() { /* ... */ } Parent.prototype.parentMethod = function parentMethod() {} function Child() { Parent.call(this) // Make sure everything is initialized properly } Child.prototype = Object.create(Parent.prototype) // re-define child prototype to Parent prototype Child.prototype.constructor = Child // return original constructor to Child But when do we need to perform the last line here? Unfortunately, the answer is: it depends. Let's try to define the cases in which re-assignment ...
... this.constructor() } new CreatedConstructor().create().create() // it's pretty fine Ok, now it's pretty clear why changing the constructor can be useful. Let's consider one more case. ...
...ate() // it's pretty fine Ok, now it's pretty clear why changing the constructor can be useful. Let's consider one more case. ...
...And 6 more matches
Menus - Archive of obsolete content
which sit on a menubar or are attached to buttons. Submenus may be created by nesting one menu inside of another. No special code needs to be written to open or close a menu or submenu, and, in addition, the menus are placed on screen in the appropriate locations automatically. There are four elements that a menupopup can be attached to. In each case, the menupopup element is placed as a direct child of the element. The following is a brief summary of these elements, examples of each will be provided later. menu The menu tag is used when placing menus on a menu bar. For example, the File and Edit menus along the top of an application window (or the menubar on the top of screen). This type of menu is usually used for commands that apply to the entire application. Commands that don't apply ...
...e are five tags used in this example, described briefly here: menubar A row of menus that appears along the top of the window or screen. It should contain menu elements. menu A label of a menu on a menubar, for instance 'File' or 'Tools'. A menu can also be used as the label of a submenu. menupopup A popup containing items to appear on a menu. The menupopup in the example above is a child of the 'File' menu and will appear when the menu label is clicked. menuitem A single item to appear on a menu. When the user moves the mouse over a menuitem, it will highlight the item. The cursor keys can also be used to adjust which menuitem is the current item. A menuitem is associated with a command to carry out. menuseparator A separator between items in a menu. In the example ab...
...an do this by adding a flexible spacer. <menubar id="sample-menubar"> <menu id="file-menu" label="File"> ... </menu> <spacer flex="1"/> <image src="logo.png"/> </menubar> In this example, a logo image is placed on the end of a menubar. The menupopup element The menupopup element is the popup that displays the menu items. When used for menus on a menubar, the menupopup should be a child of the menu element. The following shows a simple Help menu. <menu label="Help"> <menupopup> <menuitem label="Contents"/> <menuitem label="Search Help"/> </menupopup> </menu> Normally, a menupopup is hidden. When the 'Help' label is pressed, the menupopup is displayed over top of the window, aligned along the bottom of the Help menu label. When a menu command is selected or the men...
...And 5 more matches
Styling a Tree - Archive of obsolete content
headers in the same way as other elements. Style added to the tree element will apply to the entire tree. Adding a style to the treecol element does not cause the style to be applied to the column but only to the header. The body of the tree must be styled in a somewhat different way than other elements. This is because the tree body is stored in a different way to other elements. The outer treechildren is the only real element in the tree body. The inner elements are just placeholders. Setting Properties Instead, you must use the properties attribute on the rows or cells to set one or more named properties. This can be used with trees with static content, RDF built content or with those with a custom view. Let's say we want a particular row to have a blue background color. This would be us...
...nread messages or labels. You can think of the properties as functioning much like style classes, although they require a somewhat more complex syntax to use in a style sheet. This is because you can specify the style for a number of parts of the cell individually. You can style not only the cell and its text, but the twisty and indentation. The following is the syntax that needs to be used: treechildren::-moz-tree-row(makeItBlue) { background-color: blue; } This style which has a complex selector is used to style the background color of rows that have the 'makeItBlue' property. This special syntax is needed because the cells themselves are not separate elements. All of the content inside the tree's body is rendered by the treechildren element. However, CSS has a concept to access parts of...
... is used to style the background color of rows that have the 'makeItBlue' property. This special syntax is needed because the cells themselves are not separate elements. All of the content inside the tree's body is rendered by the treechildren element. However, CSS has a concept to access parts of elements considering them to be pseudo-elements. This selector matches some tree rows inside the treechildren element as pseudo-elements. The style sets style rules for particular parts of what it displays. This style rule means, inside a treechildren element, set the background color to blue for all tree rows that have the 'makeItBlue' property. The text '::-moz-tree-row' specifies what content area is desired, which in this case is a row. You can also use the following values: ::-moz-tree-cell: ...
...And 5 more matches
Making asynchronous programming easier with async and await - Learn web development
ok back at a simple fetch example that we saw in the previous article: fetch('coffee.jpg') .then(response => { if (!response.ok) { throw new Error(`HTTP error! ...
...t to see how much simpler it makes things: async function myFetch() { let response = await fetch('coffee.jpg'); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } else { let myBlob = await response.blob(); let objectURL = URL.createObjectURL(myBlob); let image = document.createElement('img'); image.src = objectURL; document.body.appendChild(image); } } myFetch() .catch(e => { console.log('There has been a problem with your fetch operation: ' + e.message); }); It makes code much simpler and easier to understand -- no more .then() blocks everywhere! Since an async keyword turns a function into a promise, you could refactor your code to use a hybrid approach of promises and await, bringing the second half of the function out int...
... But how does it work? You'll note that we've wrapped the code inside 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 a...
...And 5 more matches
Third-party APIs - Learn web development
he 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 displayResults() function so the data can be displayed in our UI. Displaying the data OK, let's look at how we'll display the data. Add the following function below your fetchResults() function. ...
... variable to fetch(), convert the response body to JSON using the json() function, then pass the resulting JSON to the displayResults() function so the data can be displayed in our UI. Displaying the data OK, let's look at how we'll display the data. Add the following function below your fetchResults() function. ...
...), convert the response body to JSON using the json() function, then pass the resulting JSON to the displayResults() function so the data can be displayed in our UI. Displaying the data OK, let's look at how we'll display the data. Add the following function below your fetchResults() function. ...
...And 5 more matches
Accessible Toolkit Checklist
API or OS-theme support. In this case, adding a complete or even a partial accessibility solution is major work, and will require more than one full time person as well as cooperation from Windows assistive technology vendors when parts of your MSAA solution isn't working. Often these kinds of toolkits don't use a separate window for each control; in that case remember to generate a unique 32 bit child ID for each control so that the MSAA event system can call back for the right IAccessible for each event. The Checklist This checklist is currently only for Microsoft Windows, but should be expanded to include information about Linux and OS X. It is maintained by the Mozilla Accessibility Community. Contributions are welcome. General Dialogs/windows/general Escape key cancels dialo...
...MSAA support needs to know what label goes with what widget. MSAA support: expose window with ROLE_DIALOG, unless it's already the standard dialog window class #32770. If you don't, some screen readers won't automatically read the dialog when it receives focus. Expose status bars with ROLE_STATUSBAR, unless they already use the standard window class msctls_statusbar32. ...
...rs won't automatically read the dialog when it receives focus. Expose status bars with ROLE_STATUSBAR, unless they already use the standard window class msctls_statusbar32. Make sure that parent-child relationships are exposed correctly in each window's MSAA tree General MSAA support Focus events Handling event callbacks, which requires a unique ID for each non-windowed child of every widget that can be focused or have any other event associated with it. ...
...And 5 more matches
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
yet understand that they // are safe for chrome code to use, so we must tell it // so explicitly. ...
...s that include // children. Remember that 'null' is a valid site, // representing the root. var totals = new Map; for (let [site, count] of counts) { for(;;) { if (!totals.has(site)) totals.set(site, 0); totals.set(site, totals.get(site) + count); if (!site) break; site = site.parent; } } // Compute parent-to-child links, since saved stack frames // have only parent links. ...
...esenting the root. var totals = new Map; for (let [site, count] of counts) { for(;;) { if (!totals.has(site)) totals.set(site, 0); totals.set(site, totals.get(site) + count); if (!site) break; site = site.parent; } } // Compute parent-to-child links, since saved stack frames // have only parent links. ...
...And 5 more matches
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
e="test-target" id="test-target"></textarea> <button type="button" name="btn-clear-console" id="btn-clear-console">clear console</button> </div> <div class="flex"> <pre id="console-log"></pre> </div> </div> CSS .fx { -webkit-display: flex; display: flex; margin-left: -20px; margin-right: -20px; } .fx > div { padding-left: 20px; padding-right: 20px; } .fx > div:first-child { width: 30%; } .flex { -webkit-flex: 1; flex: 1; } #test-target { display: block; width: 100%; margin-bottom: 10px; } JavaScript let textarea = document.getElementById('test-target'), consoleLog = document.getElementById('console-log'), btnClearConsole = document.getElementById('btn-clear-console'); function logMessage(message) { document.getElementById("console-log").innerH...
... Case 1 When the shift key is pressed, a keydown event is first fired, and the ke...
... Case 1 When the shift key is pressed, a keydown event is first fired, and the key property value is set ...
...And 5 more matches
Architecture - Accessibility
hierarchy to make it easy for nsHyperTextAccessible to piece its text representation together. Everything else uses whatever nsAccessible-derived implementation that's appropriate. If it has text siblings, then it gets exposed as the unicode char for an embedded object, which is '\xfffc' within the parent nsHyperTextAccessible. In addition, nsIAccessibleHyperLink is implemented on any non-text child inside a container that also has text. This allows AT's to find its position within that text, because the hyperlink interface exposes a start and end index. In fact, the end index will always be 1 larger than the start index, because the object is always represented by a single '\xfffc' character. If you want to know that something is really a link, check to see if it is ROLE_LINK. HTML contai...
...will always be 1 larger than the start index, because the object is always represented by a single '\xfffc' character. If you want to know that something is really a link, check to see if it is ROLE_LINK. HTML containers are implemented by nsHyperTextAccessible. They support the nsIAccessibleHyperText is implemented on any container element that has both text and embedded objects for accessible children. Why HyperLink is often not a link As explained above, anything that is embedded in text implements the Hyperlink interface. While it is odd to call non-link objects a link, this was a necessary compromise in the newatk design because it is necessary to know where objects exist within their containing text. Previously the hyper link interface was really only for links, but the design could no...
...ly the hyper link interface was really only for links, but the design could not fully represent an HTML document hierarchy. Keeping the link name of the interface is unfortunate but necessary for backwards compatibility, without introducing superfluous interfaces. API comparison nsIAccessible (internal). When you have an nsIAccessibleHyperText, you can ask for its links, which is the subset of children from the nsIAccessible hierarchy that are not text or whitespace. ATK: Same as nsIAccessible, except that text and whitespace leaf nodes are not exposed. The children of any Hypertext object are an exact match to the links it exposes. The implementation simply doesn't create AtkObjects for a whitespace or text leaf nsIAccessibles. See the ATK uses of IsEmbeddedObject() for more information o...
...And 5 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
the parent having display: flex applied, the floating and clearing will no longer happen, and the item will not be taken out of normal flow in the way that floats are. If you have used the vertical-align property, as used with inline-block or table layout for alignment, this will no longer affect the item and you can use the alignment properties of flexbox instead. In this next live example the child elements have been floated, and then their container has had display: flex added. If you remove display: flex, you should see that the .box element collapses as we have no clearing applied. This demonstrates that the float is happening. Re-apply display: flex and the collapsing does not happen. This is because the items no longer have a float applied, as they have been transformed into flex items...
...into flex items. Flexbox and Grid Layout CSS Grid Layout and Flexbox generally act in the same way with regards to overwriting other methods. You might however want to use flexbox as a fallback for grid layout, as there is better support for flexbox in older browsers. This approach works very well. If a flex item becomes a grid item, then the flex properties that may have been assigned to the child elements will be ignored. You can use the Box Alignment properties across both layout methods, so using flexbox as a fallback for grid layout can work very well. Flex and grid -- what's the difference? A common question is to ask what the difference is between Flexbox and CSS Grid Layout -- why do we have two specifications that sometimes appear to be doing the same thing? The most straightfo...
...s from flex layout, and demonstrates some of the extra functionality you get when using Grid Layout such as layering of items on the grid. This may also help in your decision as to which layout method to use. ...
...And 5 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
You can see auto-placement in action in the simplest of ways by creating a grid on a set of items. If you give the items no placement information they will position themselves on the grid, one in each grid cell. ...
...The default flow is to arrange items by row. Grid will lay an item out into each cell of row 1. If you have created additional rows using the grid-template-rows property then grid will continue placing items in these rows. If the grid does not have enough rows in the explicit grid to place all of the items new implicit rows will be created. ...
...In this next example I have added to the layout by setting odd items to span two tracks both for rows and columns. I do this with the grid-column-end and grid...
...And 5 more matches
align - Archive of obsolete content
<< XUL Reference home align Type: one of the values below The align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children. For boxes that have horizontal orientation, it specifies how its children will be aligned vertically. For boxes that have vertical orientation, it specifies how its children will be aligned horizontally. start Child elements are aligned starting from the left or top edge of the box. ...
...ren. For boxes that have horizontal orientation, it specifies how its children will be aligned vertically. For boxes that have vertical orientation, it specifies how its children will be aligned horizontally. start Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. ...
...If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. ...
...And 4 more matches
Dynamically modifying XUL-based user interface - Archive of obsolete content
ingle window, when there is an <iframe>, <browser>, or a <tabbrowser> element. You must be sure to always manipulate the correct document. (Read more about this in Working with windows in chrome code.) When your script is included using a <script> tag, the document property references the DOM document that includes the script. Examples: Using DOM methods This section demonstrates the use of appendChild(), createElement(), insertBefore(), and removeChild() DOM methods. Removing all children of an element This example removes all children of an element with id=someElement from the current document, by calling removeChild() method to remove the first child, until there are no children remaining. Note, that hasChildNodes() and firstChild are also part of the DOM API. var element = document.getEleme...
...emoveChild() DOM methods. Removing all children of an element This example removes all children of an element with id=someElement from the current document, by calling removeChild() method to remove the first child, until there are no children remaining. Note, that hasChildNodes() and firstChild are also part of the DOM API. var element = document.getElementById("someElement"); while(element.hasChildNodes()){ element.removeChild(element.firstChild); } Inserting menu items to a menu This example adds two new menu items to a <menupopup>: to the start and to the end of it. It uses document.createElementNS() method to create the items, and insertBefore() with appendChild() to insert the created xml elements within the document. Note: document.createElementNS() creates an element, but ...
...u This example adds two new menu items to a <menupopup>: to the start and to the end of it. It uses document.createElementNS() method to create the items, and insertBefore() with appendChild() to insert the created xml elements within the document. Note: document.createElementNS() creates an element, but does not put it anywhere in the document. You need to use other DOM methods, such as appendChild() to insert the newly created element in the document. appendChild() appends the node after all other nodes, while insertBefore() inserts the node before the node referenced by its second parameter. function createMenuItem(aLabel) { const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var item = document.createElementNS(XUL_NS, "menuitem"); // create a new XUL me...
...And 4 more matches
ContextMenus - Archive of obsolete content
normally. Naturally, it only makes sense to have one default item per context menu. Note that the default attribute just affects how the item is displayed, it performs no other function itself. You will still need to associate code with the element to handle the default operation. Menu Separators To group menu items together for better visual clarity, use a menu separator. <menuseparator/> Child Context Menus Sometimes it may be convenient to place the menupopup for the context menu as a child of the element the menu is associated with instead of referring to the menupopup by id. This may be useful, for example, when a context menu is associated with only 1 element. It is also useful in XBL bindings, as you wouldn't want to refer to a popup by id in this case. If the context attribute ...
...es it may be convenient to place the menupopup for the context menu as a child of the element the menu is associated with instead of referring to the menupopup by id. This may be useful, for example, when a context menu is associated with only 1 element. It is also useful in XBL bindings, as you wouldn't want to refer to a popup by id in this case. If the context attribute is set to the value '_child', the context menu is found by examining the children of the element instead of looking for a menupopup with the given id. ...
... by id. This may be useful, for example, when a context menu is associated with only 1 element. It is also useful in XBL bindings, as you wouldn't want to refer to a popup by id in this case. If the context attribute is set to the value '_child', the context menu is found by examining the children of the element instead of looking for a menupopup with the given id. For example: <vbox context="_child"> <label value="Hello"/> <menupopup> <menuitem label="Cut"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </menupopup> </vbox> In this sample, the context menu is found as the child of the vbox, because the context attribute is set to '_child'. Note that this special value must begin with an underscore to distinguish it from an id of 'child'. The menupopup does not have ...
...And 4 more matches
Adding Methods to XBL-defined Elements - Archive of obsolete content
f methods is as follows: <implementation> <method name="method-name"> <parameter name="parameter-name1"/> <parameter name="parameter-name2"/> . . . <body> <-- method script goes here --> </body> </method> </implementation> A method declaration goes inside the implementation element, like the fields and properties do. The method element contains two type of child elements, parameter elements which describe the parameters to the method and body which contains the script for the method. The value of the name attribute becomes the name of the method. Similarly, the name attributes on the parameter elements become the names of each parameter. Each parameter element is used to declare one parameter for the method. For example, if the method had three paramete...
...rom a method body or elsewhere. These elements are created anonymously and are not accessible from the regular DOM functions. They are hidden so that developers do not need to know how the element is implemented to use it. However, there is a special way of getting this anonymous content. Elements with an XBL behavior attached to them have a special property which holds an array of the anonymous child elements inside it. Each element of the array stores each direct child element of the XBL-defined element. This special property cannot be accessed directly. Instead, you must call the document's getAnonymousNodes() method: var value=document.getAnonymousNodes(element); Here, 'element' should be set to a reference to the element that you want to get the anonymous content of. The function return...
...y> </method> </implementation> </binding> Two buttons added to the XUL have oncommand handlers which are used to change the visibility of the label. Each calls the 'showTitle' method. This method checks to see whether the element is being hidden or shown from the 'state' parameter that is passed in. In either case, it grabs the first element of the anonymous array. This refers to the first child in the content element, which here is the first label widget. The visibility is changed by modifying the style on the element. Accessing from Inside the Anonymous Content To go the other way, and get the bound element from inside the anonymous content, you can use the getBindingParent method of the document to get the element that the binding is bound to. You can also use the the parentNode pro...
...And 4 more matches
Trees and Templates - Archive of obsolete content
dont-build-content, as used in the example above, indicates that the tree builder should be used. If you leave the attribute out, the content builder will be used. You can see the difference by using Mozilla's DOM Inspector on a tree with and without the flag. If you do use a content builder instead, note that the content won't generally get built until it is needed. With hierarchical trees, the children don't get generated until the parent nodes have been opened by the user. In the template, there will be one treecell for each column in the tree. The cells should have a label attribute to set the label for the cell. This would normally be set to an RDF property so that the label is pulled from the datasource. Template-built Tree Example The following example demonstrates a template-built tree...
...ng example demonstrates a template-built tree, in this case for the file system. ...
...The tree should display a list of the files in the root directory. Only one rule is used, but you may add others if needed. ...
...And 4 more matches
attribute.align - Archive of obsolete content
Summary The align attribute specifies how child elements of the box are aligned, when the size of the box is larger than the total size of the children. For boxes that have horizontal orientation, it specifies how its children will be aligned vertically. For boxes that have vertical orientation, it is used to specify how its children are algined horizontally. The pack attribute is related to the alignment but is used to specify the position in the opposite direction. You can also specify the value of align using the style property -moz-box-align. Parameters start Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally ...
...ed to specify the position in the opposite direction. You can also specify the value of align using the style property -moz-box-align. Parameters start Child elements are aligned starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. ...
...If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. ...
...And 4 more matches
listbox - Archive of obsolete content
If this attribute is set, the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it do...
...If this attribute is set, the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire. In the case of form elements, it ...
...If this attribute is set, the element is disabled. ...
...And 4 more matches
Making decisions in your code — conditionals - Learn web development
(condition) code to run if condition is true else run some other code instead This is perfectly valid code, but using it is not recommended -- it is much easier to read the code and work out what is going on if you use the curly braces to delimit the blocks of code, and use multiple lines and indentation. A real example To understand this syntax better, let's consider a real example. ...
...this syntax better, let's consider a real example. Imagine a child being asked for help with a chore by their mother or father. The parent might say "Hey sweetheart! If you help me by going and doing the shopping, I'll give you some extra allowance so you can afford that toy you wanted." In JavaScript, we could represent this like so: let shoppingDone = false; if (shoppingDone === true) { let childsAllowance = 10; } else { let childsAllowance = 5; } This code as shown always results in the shoppingDone variable returning false, meaning disappointment for our poor child. It'd be up to us to provide a mechanism for the parent to set the shoppingDone variable to true if the child did the shopping. Note: You can see a more complete version of this example on GitHub (also see it running liv...
...else It is perfectly OK to put one if...else statement inside another one -- to nest them. For example, we could update our weather forecast application to sho...
...And 4 more matches
Introduction to client-side frameworks - Learn web development
one of those tasks to our user? We want to represent each task as a list item - an HTML <li> element inside of an unordered list element (a <ul>). How do we make it? That could look something like this: function buildTodoItemEl(id, name) { const item = document.createElement('li'); const span = document.createElement('span'); const textContent = document.createTextNode(name); span.appendChild(textContent) item.id = id; item.appendChild(span); item.appendChild(buildDeleteButtonEl(id)); return item; } Here, we use the document.createElement() method to make our <li>, and several more lines of code to create the properties and children it needs. The tenth line of this snippet references another build function: buildDeleteButtonEl(). It follows a similar pattern to the one we ...
...perties and children it needs. The tenth line of this snippet references another build function: buildDeleteButtonEl(). It follows a similar pattern to the one we used to build a list item element: function buildDeleteButtonEl(id) { const button = document.createElement('button'); const textContent = document.createTextNode('Delete'); button.setAttribute('type', 'button'); button.appendChild(textContent); return button; } This button doesn't do anything yet, but it will later once we decide to implement our delete feature. The code that will render our items on the page might read something like this: function renderTodoList() { const frag = document.createDocumentFragment(); state.tasks.forEach(task => { const item = buildTodoItemEl(task.id, task.name); frag.appendC...
...ton doesn't do anything yet, but it will later once we decide to implement our delete feature. ...
...And 4 more matches
Accessibility API cross-reference
command A supporting section of the document, designed to be complementary to the main content at a similar level in the DOM hierarchy, but remains meaningful when separated from the main content. complementary <aside> n/a but <Div> or even <p> have been suggested for this purpose A widget that may contain navigable descendants or owned children. composite (abstract role) A large perceivable region that contains information about the parent document such as copyright, authors' names etc. contentinfo <footer> Page footers are often tagged as an Artifact (not "real" content) with the 'contentinfo' provided as document level XMP metadata instead The mouse point...
...a Graphic that indicates something, such as an arrow INDICATOR n/a n/a n/a Abstract role - A generic type of widget that allows user input. ...
...allows user input. input n/a Hypertext link that can be on image or text LINK n/a link <a> <Link> According to the PDF 1.7 spec, a <Link> must not be a direct child of a <TOCI> (table of contents item). In such a case, they should be wrapped in a <Reference> Pragmatically however, user agents should expect to find <Link> tags as direct children of <TOCI> Abstract role - A perceivable section containing content that is relevant to a specific, author-specified purpose and sufficiently important that users will likely want to be able to navigate to the section easily and to have it listed in a summary of the page. Such a page summary could be generated dynamically by a user agent or assistive technology. ...
...And 4 more matches
Introduction to Layout in Mozilla
notifications Passes these to the style set object, who in turn passes to the frame constructor Fr...
...notifications Passes these to the style set object, who in turn passes to the frame constructor Frame constructor...
...notifications Passes these to the style set object, who in turn passes to the frame constructor Frame constructor creates frames...
...And 4 more matches
nsIAccessible
ible.getState() to get states of the accessibe nsIAccessible.name, nsIAccessible.value to get the name and the value of the accessible Tree navigation You can navigate through the accessible tree by the following methods and attributes. nsIAccessible.parent to get the parent accessible nsIAccessible.nextSibling, nsIAccessible.previousSibling to get sibling accessibles nsIAccessible.firstChild, nsIAccessible.lastChild to get first and last child nsIAccessible.children, nsIAccessible.getChildAt(), nsIAccessible.childCount to navigate through the children by index Accessible position You can use nsIAccessible.indexInParent to get accessible index in its parent. Use nsIAccessible.groupPosition() to get information about this accessible in its group. Relations Many accessibles are linke...
...r accessible (for example, html:label and html control) then these accessibles are related, please refer to relations documentation for more information. You can get related accessibles by methods nsIAccessible.getAccessibleRelated() nsIAccessible.getRelations() nsIAccessible.getRelation() and nsIAccessible.relationsCount. Focus and selection In order to focus an accessible or get focused child accessible use nsIAccessible.takeFocus() and nsIAccessible.focusedChild. To select an accessible you can use nsIAccessible.setSelected(), nsIAccessible.takeSelection() and nsIAccessible.extendSelection(). Actions You can prepare actions on some accessibles (for example on button accessible). The following methods are intended for this nsIAccessible.actionCount, nsIAccessible.getActionName(), nsIA...
...a map of attributes. Keyboard shortcuts Some actions on accessibles can be performed by keyboard shortcuts. Following methods are used to get them nsIAccessible.defaultKeyBinding(), nsIAccessible.getKeyBindings(), nsIAccessible.keyboardShortcut. Size and screen position You can use nsIAccessible.getBounds() to get size and coordinates of the accessible. ...
...And 4 more matches
nsIDocShell
loadStream(in nsIInputStream aStream, in nsIURI aURI, in ACString aContentType, in ACString aContentCharset, in nsIDocShellLoadInfo aLoadInfo); Native code only! void loadURI(in nsIURI uri, in nsIDocShellLoadInfo loadInfo, in unsigned long aLoadFlags, in boolean firstParty); Native code only! void prepareForNewContentModel(); void resumeRefreshURIs(); void setChildOffset(in unsigned long offset); Native code only! void setCurrentURI(in nsIURI aURI); void suspendRefreshURIs(); void tabToTreeOwner(in boolean forward, out boolean tookFocus); Attributes Attribute Type Description allowAuth boolean Certain dochshells (like the message pane) should not throw up auth dialogs because it can act as a p...
...ng to the event loop. void beginRestore( in nsIContentViewer viewer, in boolean top ); Parameters viewer The content viewer whose document we are starting to load. If null, it defaults to the docshell's current content viewer, creating one if necessary. top Should be true for the toplevel docshell that is being restored; it will be set to false when this method is called for child docshells. createAboutBlankContentViewer() Create a new about:blank document and content viewer. void createAboutBlankContentViewer( in nsIPrincipal aPrincipal ); Parameters aPrincipal The principal to use for the new document. createLoadInfo() Creates a DocShellLoadInfo object that you can manipulate and then pass to loadURI(). void createLoadInfo( out nsIDocShellLoadInfo loadInf...
...ry entry. This should be called only during page transitions. void DetachEditorFromWindow(); Parameters None. finishRestore() Finish firing WebProgressListener notifications and DOM events for restoring a page presentation. This should only be called via beginRestore(). void finishRestore(); Parameters None. Native code only!firePageHideNotification Notify the associated content viewer and all child docshells that they are about to be hidden. If isUnload is true, then the document is being unloaded as well. void firePageHideNotification( in boolean isUnload ); Parameters isUnload If true, fire the unload event in addition to the pagehide event. Native code only!fireUnloadNotification Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)This feature is obsole...
...And 4 more matches
nsIMsgFolder
; nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey); boolean shouldStoreMsgOffline(in nsMsgKey msgKey); boolean hasMsgOffline(in nsMsgKey msgKey); nsIInputStream getOfflineFileStream(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size); void DownloadMessagesForOffline(in nsISupportsArray messages, in nsIMsgWindow window); nsIMsgFolder getChildWithURI(in ACString uri, in boolean deep, in boolean caseInsensitive); void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window); void enableNotifications(in long notificationType, in boolean enable, in boolean dbBatching); boolean isCommandEnabled(in ACString command); boolean matchOrChangeFilterDestination(in nsIMsgFolder folder,in boolean...
...(in nsIMsgFolder msgFolder); [noscript] void getSortKey(out octet_ptr key, out unsigned long length); boolean callFilterPlugins(in nsIMsgWindow aMsgWindow); ACString getStringProperty(in string propertyName); void setStringProperty(in string propertyName, in ACString propertyValue); boolean isAncestorOf(in nsIMsgFolder folder); boolean containsChildNamed(in AString name); nsIMsgFolder getChildNamed(in AString aName); nsIMsgFolder findSubFolder(in ACString escapedSubFolderName); void AddFolderListener(in nsIFolderListener listener); void RemoveFolderListener(in nsIFolderListener listener); void NotifyPropertyChanged(in nsIAtom property, in ACString oldValue, in ACString newValue); void Not...
..., in unsigned long newValue); void NotifyUnicharPropertyChanged(in nsIAtom property, in AString oldValue, in AString newValue); void NotifyItemAdded(in nsISupports item); void NotifyItemRemoved(in nsISupports item); void NotifyFolderEvent(in nsIAtom event); void ListDescendents(in nsISupportsArray descendents); void Shutdown(in boolean shutdownChildren); void setInVFEditSearchScope(in boolean aSearchThisFolder, in boolean aSetOnSubFolders); void copyDataToOutputStreamForAppend(in nsIInputStream aIStream, in long aLength, in nsIOutputStream outputStream); void copyDataDone(); void setJunkScoreForMessages(in nsISupportsArray aMessages, in ACString aJunkScore); void applyRetentionSettings(); ...
...And 4 more matches
nsINavHistoryContainerResultNode
any kind of grouping, including bookmark folders). 1.0 66 Introduced Gecko 1.9 Inherits from: nsINavHistoryResultNode Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview nsINavHistoryResultNode findNodeByDetails(in AUTF8String aURIString, in PRTime aTime, in long long aItemId, in boolean aRecursive); nsINavHistoryResultNode getChild(in unsigned long aIndex); unsigned long getChildIndex(in nsINavHistoryResultNode aNode); Attributes Attribute Type Description childCount unsigned long The number of child nodes; accessing this throws an NS_ERROR_NOT_AVAILABLE exception of containerOpen is false. Read only. childrenReadOnly boolean false if the node's list of children can be modified (by adding or removing children, o...
...Read-only. This is false for bookmark folder nodes unless the setFolderReadOnly() method has been called to specifically make the folder read-only. It's true for non-folder nodes. If this container is a remote container, this flag may be redefined by the remote container provider. Read-only. ...
...y. This is false for bookmark folder nodes unless the setFolderReadOnly() method has been called to specifically make the folder read-only. It's true for non-folder nodes. If this container is a remote container, this flag may be redefined by the remote container provider. Read-only. containerOpen boolean Set this to true to allow descent into this container. When closed, attempting to call getChild() or access childCount results in an error. When you're done reading the container's children, set this to false. For HOST and DAY groupings, doing this has no performance cost since the children have already been computed. For queries and bookmark folders, however, being open means they must keep themselves up-to-date by listening for updates and re-querying as needed. dynamicContainerType AU...
...And 4 more matches
Element - Web APIs
Web › API › Element
5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent interface, Node, and by extension that interface's parent, EventTarget. It implements the properties of ParentNode, ChildNode, NonDocumentTypeChildNode, and Animatable. Element.attributes Read only Returns a NamedNodeMap object containing the assigned attributes of the corresponding HTML element. Element.classList Read only Returns a DOMTokenList containing the list of class attributes. Element.className Is a DOMString representing the class of the element. Element.clientHeight Read only Returns a Numbe...
...alName Read only A DOMString representing the local part of the qualified name of the element. Element.namespaceURI Read only The namespace URI of the element, or null if it is no namespace. Note: In Firefox 3.5 and earlier, HTML elements are in no namespace. In later versions, HTML elements are in the http://www.w3.org/1999/xhtml namespace in both HTML and XML trees. NonDocumentTypeChildNode.nextElementSibling Read only Is an Element, the element immediately following the given one in the tree, or null if there's no sibling node. Element.outerHTML Is a DOMString representing the markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string. Element.part Represents the part identifier(s) of the element (i.e. ...
...markup of the element including its content. When used as a setter, replaces the element with nodes parsed from the given string. Element.part Represents the part identifier(s) of the element (i.e. set using the part attribute), returned as a DOMTokenList. Element.prefix Read only A DOMString representing the namespace prefix of the element, or null if no prefix is specified. NonDocumentTypeChildNode.previousElementSibling Read only Is a Element, the element immediately preceding the given one in the tree, or null if there is no sibling element. Element.scrollHeight Read only Returns a Number representing the scroll view height of an element. Element.scrollLeft Is a Number representing the left scroll offset of the element. Element.scrollLeftMax Read only Returns a Number repr...
...And 4 more matches
HTMLTableElement - Web APIs
" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLTableElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement. HTMLTableElement.caption Is a HTMLTableCaptionElement representing the first <caption> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <caption>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is given, it is inserted in the tree as the first child of this element and the first <caption> that is a child of this element is removed from the tree, if any. HTMLTableElement.tHead Is a HTMLTableSectionElement repr...
...ound. When set, if the object doesn't represent a <caption>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is given, it is inserted in the tree as the first child of this element and the first <caption> that is a child of this element is removed from the tree, if any. HTMLTableElement.tHead Is a HTMLTableSectionElement representing the first <thead> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <thead>, a DOMException with the HierarchyRequestError name is thrown. ...
...ent.tHead Is a HTMLTableSectionElement representing the first <thead> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <thead>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is given, it is inserted in the tree immediately before the first element that is neither a <caption>, nor a <colgroup>, or as the last child if there is no such element, and the first <thead> that is a child of this element is removed from the tree, if any. HTMLTableElement.tFoot Is a HTMLTableSectionElement representing the first <tfoot> that is a child of the element, or null if none is found. When set, if the object doesn't represent a <tfoot>, a DOMException with the HierarchyRequestError name is thrown. If a correct object is g...
...And 4 more matches
Timing element visibility with the Intersection Observer API - Web APIs
nt. The following style is applied to that: main { grid-column: 2; grid-row: 2; margin: 0; margin-left: 16px; font-size: 16px; } The primary feature here is that the grid position is set to place the body content in column 2, row 2. Articles Each article is contained in an <article> element, styled like this: article { background-color: white; padding: 6px; } article:not(:last-child) { margin-bottom: 8px; } article h2 { margin-top: 0; } This creates article boxes with a white background which float atop the blue background, with a small margin around the article. Every article which isn't the last item in the container has an 8px bottom margin to space things apart. Ads Finally, the ads have the following initial styling. Individual ads may customize the style somewh...
...und, with a small margin around the article. Every article which isn't the last item in the container has an 8px bottom margin to space things apart. Ads Finally, the ads have the following initial styling. Individual ads may customize the style somewhat, as we'll see later. .ad { height: 96px; padding: 6px; border-color: #555; border-style: solid; border-width: 1px; } .ad:not(:last-child) { margin-bottom: 8px; } .ad h2 { margin-top: 0; } .ad div { position: relative; float: right; padding: 0 4px; height: 20px; width: 120px; font-size: 14px; bottom: 30px; border: 1px solid black; background-color: rgba(255, 255, 255, 0.5); } There's nothing magic in here. It's fairly basic CSS. Tying it together with JavaScript That brings us to the JavaScript code which...
...incidunt" + " egestas. Morbi eu lorem vel est sodales auctor hendrerit placerat" + " risus. Etiam rutrum faucibus sem, vitae mattis ipsum ullamcorper" + " eu. Donec nec imperdiet nibh, nec vehicula libero. Phasellus vel" + " malesuada nulla. Aliquam sed magna aliquam, vestibulum nisi at," + " cursus nunc.</p>"; function buildContents() { for (let i=0; i<5; i++) { contentBox.appendChild(createArticle(loremIpsum)); if (!(i % 2)) { loadRandomAd(); } } } The variable loremIpsum contains the text we'll use for the body of all of our articles. Obviously in the real world, you'd have some code to pull articles from a database or the like, but this does the job for our purposes. Every article uses the same text; you could of course change that easily enough. buildCo...
...And 4 more matches
display - CSS: Cascading Style Sheets
Web › CSS › display
Some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the CSS Flexible Box Model specification. See the table at the end of this document for all of the individual specifications. ...
...Some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the CSS Flexible Box Model specification. See the table at the end of this document for all of the individual specifications. ...
...s the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Inside <display-inside> 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-inside> values: flow The element lays out its contents using flow layout (block-and-inline l...
...And 4 more matches
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
ytes). Generate a thumbnail preview of the image by calling URL.createObjectURL(curFiles[i]). Then, insert the image into the list item too by creating a new <img> and setting its src to the thumbnail. If the file type is invalid, we display a message inside a list item telling the user that they need to select a different file type. ...
...ail preview of the image by calling URL.createObjectURL(curFiles[i]). Then, insert the image into the list item too by creating a new <img> and setting its src to the thumbnail. If the file type is invalid, we display a message inside a list item telling the user that they need to select a different file type. ...
...image by calling URL.createObjectURL(curFiles[i]). Then, insert the image into the list item too by creating a new <img> and setting its src to the thumbnail. If the file type is invalid, we display a message inside a list item telling the user that they need to select a different file type. ...
...And 4 more matches
JavaScript Daemons Management - Archive of obsolete content
t this.textContent = ""; aLetters.length = 0; for (var oSpan, oLetter, nLetter = 0, nLen = sText.length; nLetter < nLen; nLetter++) { oSpan = document.createElement("span"); oSpan.textContent = sText[nLetter]; oLetter = { "elem": oSpan, "parent": this }; aLetters.push(oLetter); oLetter.pos = Math.random() * 50; oLetter.elem.style.position = "relative"; this.appendChild(oSpan); } } var nMaxDist = 25, aLetters = [], sText = "Do you feel lucky, punk?", oRecompose = new Daemon(document.createElement("p"), perform, 33, 30, prepare); onload = function () { oRecompose.owner.id = "perform-me"; document.body.appendChild(oRecompose.owner); oRecompose.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #D...
....length; nLetter < nLen; nLetter++) { oSpan = document.createElement("span"); oSpan.textContent = sText[nLetter]; oLetter = { "elem": oSpan, "parent": this.target }; this.letters.push(oLetter); oLetter.index = this.numletters; oLetter.elem.style.position = "relative"; oLetter.val = oLetter.elem.textContent; this.numletters++; this.target.appendChild(oSpan); } }, "perform": function (nIndex, nLength, bBackw) { for (var oLetter, nLetter = 0; nLetter < this.letters.length; nLetter++) { oLetter = this.letters[nLetter]; if (nLength < nIndex && this.clock + this.delta < this.interval) { clock += this.delta; return; } this.clock = 0; oLetter.elem.textContent = nIndex / nLength - oLetter.inde...
....clock + this.delta < this.interval) { clock += this.delta; return; } this.clock = 0; oLetter.elem.textContent = nIndex / nLength - oLetter.index / this.numletters >= 0 ? ...
...And 3 more matches
Interaction between privileged and non-privileged pages - Archive of obsolete content
ta from the web page (unprivileged code) will be the values of attribute1 and attribute2. To trigger the alert() in the listener and pass the data from the web page, write code such as this in the web page: var element = document.createElement("MyExtensionDataElement"); element.setAttribute("attribute1", "foobar"); element.setAttribute("attribute2", "hello world"); document.documentElement.appendChild(element); var evt = document.createEvent("Events"); evt.initEvent("MyExtensionEvent", true, false); element.dispatchEvent(evt); This code creates an arbitrary element -- <MyExtensionDataElement/> -- and inserts it into the web page's DOM. Values are set for two arbitrary attributes on the element. These can also be named anything you like, but we've chosen attribute1 and attribute2. Finally, t...
... var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.in...
...essage from unprivileged code to privileged code, adding 'true' to the end of your event listener in your privileged chrome code will allow the message to be received. document.addEventListener("message", function(e) { yourFunction(e); }, false, true); Sending data from chrome to unprivileged document To "answer" the web page (e.g., return code), your extension can set an attribute or attach child elements on the event target element (<MyExtensionDataElement/> in this example). You can optionally clean up the created element, or create it once when the web page loads then re-use it each time. Another option is to send a return event from the extension to the web page. This can be done using the same principle as the above example. There is only one extension, but there can be many activ...
...And 3 more matches
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
ame someattribute="somevalue"> content </elementname> As shown in Listing 1, XML uses elements, which consist of an opening tag, a closing tag, and content. Note: Elements that take no content can be expressed in compact form as <elementname/>. An element can include other elements as well as text in its content, and all information is structured as a tree. As in all trees, elements can have children (elements contained within them) and parents (elements that contain them). Attributes can also be added to opening tags, each with a value. As the "extensible" part of XML implies, elements from various XML-based languages such as XHTML and SVG can be interspersed in one another as a means to extend the language. All elements can carry a "namespace URI" identifier, which is unique for each la...
...roperty, so if it weren't for the DOM, dynamic processing would be impossible. There are a number of levels to the DOM with different levels of functionality. Gecko supports nearly all of DOM Level 2 and some of DOM Level 3. With the DOM, the contents of an XML document are handled as a "DOM tree," a collection of element nodes and other nodes. ...
... example that deletes the second child element of the element with the "toolbar" id, adds a new button element as a substitute, and sets a label attribute. ...
...And 3 more matches
The Box Model - Archive of obsolete content
at all (divs may have some default styling, though). Their behavior is similar. However, one of the fundamental differences between XUL and HTML has been the fact that XUL boxes can be oriented vertically or horizontally (this behavior is being introduced into HTML standards). There are 3 basic box elements in XUL: hbox, vbox and box. ...
... differences between XUL and HTML has been the fact that XUL boxes can be oriented vertically or horizontally (this behavior is being introduced into HTML standards). There are 3 basic box elements in XUL: hbox, vbox and box. An hbox is oriented horizontally by default, meaning that its child nodes are displayed next to each other from left to right. A vbox is oriented vertically by default, its child nodes displayed one below the other from top to bottom. ...
...that its child nodes are displayed next to each other from left to right. A vbox is oriented vertically by default, its child nodes displayed one below the other from top to bottom. A box is a generic version that you can orient as you please, but its default is horizontal orientation, so it's pretty much equivalent to an hbox and it is seldom used. ...
...And 3 more matches
MenuModification - Archive of obsolete content
unction is called when the button is pressed. This function appends a new item to the menu's popup with the label Insert. The first argument to appendItem is the label of the menuitem, and the second argument is a value to associate with the item. This value be set as the menuitem's value attribute and can be used for whatever purpose is desired. Note how in this example, the menu does not have a child menupopup. The appendItem method will create a menupopup element if it doesn't already exist. If the menu already has a menupopup, the new menuitem will be appended to this existing one. While the appendItem method always adds the new item to the end of the menu, the insertItemAt method may be used in a similar fashion to insert an item into the menu elsewhere. menu.insertItemAt(0, "Delete", "d...
...it, for instance to add an access key, as in the following example: var item = menu.appendItem("Insert", "insert"); item.accessKey = "I"; Appending Submenus There is no built-in method to append submenus to a menu. To do this, we instead need to use the inherited node modification methods available for all elements. ...
...thod to append submenus to a menu. To do this, we instead need to use the inherited node modification methods available for all elements. First, we need to retrieve the menupopup for the menu, and then use the appendChild method to append a new item. <script> function addSubMenu() { var popup = document.getElementById("file-popup"); var newmenu = document.createElement("menu"); popup.appendChild(newmenu); newmenu.label = "New"; newmenu.appendItem("Document", "doc"); newmenu.appendItem("Image", "image"); } </script> <menu label="File" onpopupshowing="addSubMenu()"> <menupopup id="file-popup"/> </menu>. Comment: appendItem not working in TB 52.7.0. Workaround: add menupopup to menu. Then add menuitem to menupopup (all with appendChild to their parentelement). Also, need replace ...
...And 3 more matches
Building Hierarchical Trees - Archive of obsolete content
ilder will mark the right rows as containers, so that they can be opened and closed with the small icon twisties on the left of the column. Remember to make the left column the primary column for these to appear. To be able to do this, the tree builder must know that an item is a container. With an RDF datasource, this would usually be an RDF container such as a Seq and the tree would display its children. For an XML datasource, the tree might display a node's children as the children in the tree, making the tree display a hierarchy similar to that in the XML document. Or, with more complex XPath expressions, a template could display a tree where the hierarchy wasn't directly like the XML document. If a node is a container, the tree item becomes a container, and the user may open the row by dou...
...mplate-guide-streets.rdf" ref="http://www.xulplanet.com/rdf/myneighbourhood" flags="dont-build-content" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <treecols> <treecol id="address" primary="true" label="Address" flex="1"/> <treecol id="floors" label="Floors" flex="1"/> </treecols> <template> <rule rdf:type="http://www.xulplanet.com/rdf/House"> <treechildren> <treeitem uri="rdf:*"> <treerow> <treecell label="rdf:http://www.xulplanet.com/rdf/address"/> <treecell label="rdf:http://www.xulplanet.com/rdf/floors"/> </treerow> </treeitem> </treechildren> </rule> <rule> <treechildren> <treeitem uri="rdf:*"> <treerow> <treecell label="rdf:http://p...
...df:http://www.xulplanet.com/rdf/address"/> <treecell label="rdf:http://www.xulplanet.com/rdf/floors"/> </treerow> </treeitem> </treechildren> </rule> <rule> <treechildren> <treeitem uri="rdf:*"> <treerow> <treecell label="rdf:http://purl.org/dc/elements/1.1/title"/> </treerow> </treeitem> </treechildren> </rule> </template> </tree> The first rule is for the houses as indicated by the rule's condition and the second rule is for the streets. As shown in the snippet of the data below, the street is a Seq, so it will become a container. The houses are not containers, so they will not have children in the tree. <rdf:Bag rdf:about="http://www.xulplanet.com/rdf/myneighbourhood"> <rdf:li> ...
...And 3 more matches
box - Archive of obsolete content
Archive › Mozilla › XUL › box
Child elements do not overlap. The default orientation is horizontal. More information is available in the XUL tutorial. ...
...Child elements do not overlap. The default orientation is horizontal. More information is available in the XUL tutorial. ...
...Child elements do not overlap. The default orientation is horizontal. More information is available in the XUL tutorial. ...
...And 3 more matches
member - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Used within a rule's conditions element to match elements that are containers or are contained within another element. Both the container and child attributes may use variables. More information is available in the XUL tutorial. ...
... << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] Used within a rule's conditions element to match elements that are containers or are contained within another element. Both the container and child attributes may use variables. More information is available in the XUL tutorial. ...
... container Type: ? A variable reference to a node that is expected to be a container. If the variable is the same as the uri attribute on the content element, the resource must be a container element in order to match. Inherited Properties al...
...And 3 more matches
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
This element is also used to create submenus. More information is available in the XUL tutorial. ...
...s value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed. ...
...access or affect the contents displayed to the user. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. control Type: menu element Returns the enclosing menu that the item is inside, if any, or null if there is no enclosing menu. itemCount Type: integer Read only property holding the number of child items. menupopup Type: menupopup element A reference to the menupopup used by the menu or menulist. This property is read-only. open Type: boolean This property will be set to true when the menu is open. The menu may be opened by setting the open property to true and closed by setting it to false. parentContainer Type: menu element Read only property that ret...
...And 3 more matches
toolbar - Archive of obsolete content
ence home [ Examples | Attributes | Properties | Methods | Related ] A container which typically contains a row of buttons. It is a type of box that defaults to horizontal orientation. It can be collapsed with a grippy when the toolbar is placed inside a toolbox. The toolbar should always have an id attribute. Note: Gecko 2.0 adds support for external toolbars. These are toolbars that are not children of a toolbox element. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The chromeclass-toolbar class may be used to create a toolbar where its visibility depends on the toolbar flag when opening the window with the window interface's open() method loads the specified resource into the browsing con...
...ems not already in the toolbar. This introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...he toolbar. This introduces a potential compatibility problem for extensions that depend on being able to identify all possible toolbar items by looking in the toolbarpalette. ...
...And 3 more matches
treecol - Archive of obsolete content
mnpicker, label, primary, sort, sortActive, sortDirection, src, type, width Properties accessibleType Style classes treecol-image Examples This example shows a checkbox in the first column, requires the style below. ...
...On Firefox 2.x and 3.x, all operating systems other than Mac OS X already use these styles by default. ...
...le on some platforms, the following styles need to be added to the stylesheet (see treecol.type). On Firefox 2.x and 3.x, all operating systems other than Mac OS X already use these styles by default. If targeting Firefox for Mac OS X, be sure to use these styles but include your own checkbox image. However, chrome://global/skin/checkbox/cbox-check.gif is available in SeaMonkey on Mac OS X.. treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. This style MUST come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked){ /* css for checked cells. cbox-check.gif isn't available in Firefox 1, 2, and 3 on Mac OS X, so you should specify a URL to an image in your extension or ...
...And 3 more matches
XForms Custom Controls Examples - Archive of obsolete content
"nsIXFormsUIWidget"> <method name="refresh"> <body> var img = document.getAnonymousElementByAttribute(this, "anonid", "content"); img.setAttribute("src", this.stringValue); return true; </body> </method> </implementation> </binding> Output Showing XHTML <binding id="output-xhtml" extends="chrome://xforms/content/xforms-xhtml.xml#xformswidget-output"> <content> <children includes="label"/> <xhtml:div class="xf-value" anonid="content"></xhtml:div> <children/> </content> <implementation implements="nsIXFormsUIWidget"> <field name="_domparser">null</field> <property name="domparser" readonly="true"> <getter> if (!this._domparser) this._domparser = new DOMParser(); return this._domparser; </getter> </property> <method...
... <property name="domparser" readonly="true"> <getter> if (!this._domparser) this._domparser = new DOMParser(); return this._domparser; </getter> </property> <method name="refresh"> <body> // Get new value, parse, and import it. ...
... </property> <method name="refresh"> <body> // Get new value, parse, and import it. ...
...And 3 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
pting, Glossary, Web, l10n:priority CSS (Cascading Style Sheets) is a declarative language that controls how webpages look in the browser. 56 CSS Object Model (CSSOM) CSS, CSSOM, DOM, Glossary, Web Performance The CSS Object Model (CSSOM) is a map of all CSS selectors and relevant properties for each selector in the form of a tree, with a root node, sibling, descendant, child, and other relationship. The CSSOM is very similar to the Document Object Model (DOM). Both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. 57 CSS pixel CSS, CSS Pixel, Glossary, height, length, pixel, size, unit, width The CSS pixel--denoted in CSS with the suffix px--is a unit of length which roughly ...
... element is a part of a webpage. In XML and HTML, an element may contain a data item or a chunk of text or an image, or perhaps nothing. A typical element includes an opening tag with some attributes, enclosed text content, and a closing tag. 128 Empty element CodingScripting, Glossary, Intermediate An empty element is an element from HTML, SVG, or MathML that cannot have any child nodes (i.e., nested elements or text nodes). 129 Encapsulation CodingScripting, Glossary Encapsulation is the packing of data and functions into one component (for example, a class) and then controlling access to that component to make a "blackbox" out of the object. Because of this, a user of that class only needs to know its interface (that is, the data and functions expose...
... For example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable. 153 Flex CSS, Flex, Glossary, flexbox flex is a new value added to the CSS display property. Along with inline-flex it causes the element that it applies to to become a flex container, and the element's children to each become a flex item. The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout Module may be applied. 154 Flex Container CSS, Glossary, flex container, flexbox A flexbox layout is defined using the flex or inline-flex values of the display property on the parent item. This element then becomes a flex container, and e...
...And 3 more matches
Choosing the right approach - Learn web development
"callback hell"). Failure callbacks need to be called once for each level of nesting, whereas with promises you can just use a single .catch() block to handle the errors for the entire chain. Async callbacks just aren't very graceful. Promise callbacks are always cal...
...If you nest a number of promises, you can end up with similar troubles to callback hell. For example: remotedb.allDocs({ include_docs: true, attachments: true }).then(function (result) { let docs = result.rows; docs.fo...
...You need to chec...
...And 3 more matches
Build your own function - Learn web development
et of parentheses, and a set of curly braces. Any parameters we want to give to our function go inside the parentheses, and the code that runs when we call the function goes inside the curly braces. Finally, add the following code inside 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. The first ...
...r container of our message box. We then use yet another DOM API function called Element.setAttribute() to set a class attribute on our panel with a value of msgBox. This is to make it easier to style the element -- if you look at the CSS on the page, you'll see that we are using a .msgBox class selector to style the message box and its contents. Finally, we call a DOM function called Node.appendChild() on the html constant we stored earlier, which nests one element inside the other as a child of it. We specify the panel <div> as the child we want to append inside the <html> element. We need to do this as the element we created won't just appear on the page on its own -- we need to specify where to put it. const panel = document.createElement('div'); panel.setAttribute('class', 'msgBox'); htm...
...e html constant we stored earlier, which nests one element inside the other as a child of it. We specify the panel <div> as the child we want to append inside the <html> element. We need to do this as the element we created won't just appear on the page on its own -- we need to specify where to put it. const panel = document.createElement('div'); panel.setAttribute('class', 'msgBox'); html.appendChild(panel); The next two sections make use of the same createElement() and appendChild() functions we've already seen to create two new elements -- a <p> and a <button> -- and insert them in the page as children of the panel <div>. We use their Node.textContent property -- which represents the text content of an element -- to insert a message inside the paragraph, and an 'x' inside the button. This ...
...And 3 more matches
Useful string methods - Learn web development
'You\'re all I want for Christmas', 'Get well soon']; for (let i = 0; i < greetings.length; i++) { let input = greetings[i]; // Your conditional test needs to go inside the parentheses // in the line below, replacing what's currently there if (greetings[i]) { let listItem = document.createElement('li'); listItem.textContent = input; list.appendChild(listItem); } } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="Reset"> <input id="solution" type="button" value="Show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = docu...
...n \'You\\\'re all I want for Christmas\',' + '\n \'Get well soon\'];' + '\n' + '\nfor (let i = 0; i < greetings.length; i++) {' + '\n let input = greetings[i];' + '\n if (greetings[i].indexOf(\'Christmas\') !== -1) {' + '\n let result = input;' + '\n let listItem = document.createElement(\'li\');' + '\n listItem.textContent = result;' + '\n list.appendChild(listItem);' + '\n }' + '\n}'; let solutionEntry = jsSolution; textarea.addEventListener('input', updateCode); window.addEventListener('load', updateCode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { ...
...code" style="height: 250px; width: 95%"> const list = document.querySelector('.output ul'); list.innerHTML = ''; let cities = ['lonDon', 'ManCHESTer', 'BiRmiNGHAM', 'liVERpoOL']; for (let i = 0; i < cities.length; i++) { let input = cities[i]; // write your code just below here let result = input; let listItem = document.createElement('li'); listItem.textContent = result; list.appendChild(listItem); } </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="Reset"> <input id="solution" type="button" value="Show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document...
...And 3 more matches
PBackground
This article outlines what PBackground is, and how it works. IPDL recap IPDL is a language used to define "protocols" -- essentially formalized versions of how two things can communicate. ...
...ler automatically generates a large amount of C++ glue code from the IPDL files. IPDL protocols are used to specify how the chrome and content processes talk to each other and verify that a content process is "following the rules". Note: If you want more detailed information on IPDL, start out by reading the IPDL tutorial. When used at run time, every protocol has two actors -- a parent and a child. These actors can live in different processes due to IPDL, which automatically serializes calls on one side and transmits them to the other. This is the foundation of how chrome and content processes talk to each other in e10s. The actor tree All live actors exist in a tree. The root of the tree is known as the top-level actor, an instance of one of a small number of top-level protocols. All ac...
...other in e10s. The actor tree All live actors exist in a tree. The root of the tree is known as the top-level actor, an instance of one of a small number of top-level protocols. All actors in a tree "live" on the same thread, and can only be used safely from that thread. The top-level actor for most things is PContent, which connects the main thread of the chrome process to the main thread of a child process. For most purposes this is great, because the DOM is already bound to the main thread. But in some cases we don't necessarily want to talk to the main thread. What if I want to talk to a different thread? Not every communication between the chrome and content processes necessarily wants to go through the main threads of both (or even either) processes. For example, when we are uploadi...
...And 3 more matches
XUL Accessibility
Introduction This article shows how XUL control elements are mapped to accessibility API. It is much in progress. AT API General rules This section holds some rules applied to generating accessible name and description. ...
... Introduction This article shows how XUL control elements are mapped to accessibility API. It is much in progress. AT API General rules This section holds some rules applied to generating accessible name and description. ...
...ements are mapped to accessibility API. It is much in progress. AT API General rules This section holds some rules applied to generating accessible name and description. ...
...And 3 more matches
Retrieving part of the bookmarks tree
ryService.executeQuery(query, options); Get the results When you are querying for exactly one folder grouped by folder with no fancy query parameters such as keywords or date ranges (as in this example), the root of the result will be an nsINavHistoryContainerResultNode corresponding to your folder. If you have a complex query the root will be a nsINavHistoryQueryResultNode. Before accessing the children of any result container, you must first open it, and then you can iterate the children. As long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date. When you're done, be sure to close the container to free up the resources. Otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var ...
...dren. As long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date. When you're done, be sure to close the container to free up the resources. Otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var rootNode = result.root; rootNode.containerOpen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootNode.childCount; i ++) { var node = rootNode.getChild(i); dump("Child: " + node.title + "\n"); } // close a container after using it! rootNode.containerOpen = false; If you encounter a node with a type of RESULT_TYPE_FOLDER or another type of container, you can open these folders and descend into the hierarchy. You will want to r...
...rootNode.containerOpen = false; ...
...And 3 more matches
IAccessibleText
alue E_INVALIDARG if bad [in] passed, [out] values are 0s and null respectively. S_FALSE if there is nothing to return, [out] values are 0s and null respectively. S_OK. caretOffset() Returns the position of the caret. Returns the 0-based offset of the caret within the text(). ...
...re 0s and null respectively. S_FALSE if there is nothing to return, [out] values are 0s and null respectively. S_OK. caretOffset() Returns the position of the caret. Returns the 0-based offset of the caret within the text(). ...
...caretOffset() Returns the position of the caret. Returns the 0-based offset of the caret within the text(). If the text() is implemented as a tree of text() objects with embed characters in higher levels representing substrings of child text() objects and the caret is in one of the child text() objects, then the offset in the higher level text() object would be at the embed character representing child text() object that contains the caret. ...
...And 3 more matches
nsIAccessibleRole
or caret. ROLE_ALERT 8 Represents an alert or a condition that a user should be notified about. Assistive Technologies typically respond to the role by reading the entire on screen contents of containers advertising this role. Should be used for warning dialogs, etc. The role is used by xul:browsermessage, role="alert", xforms:message. ROLE_WINDOW 9 Represents the window frame, which contains child objects such as a title bar, client, and other objects contained in a window. The role is supported automatically by MS Windows. ROLE_INTERNAL_FRAME 10 A sub-document or iframe. ROLE_MENUPOPUP 11 Represents a menu, which presents a list of options from which the user can make a selection to perform an action. It is used for role="menu". ROLE_MENUITEM 12 Represents a menu item, which is an e...
... within an application window. It is used for role="document". ROLE_PANE 16 Represents a pane within a frame or document window. Users can navigate between panes and within the contents of the current pane, but cannot navigate between items in different panes. Thus, panes represent a level of grouping lower than frame windows or documents, but above individual controls. It is used for the first child of a or iframe. ROLE_CHART 17 Represents a graphical image used to represent data. ROLE_DIALOG 18 Represents a dialog box or message box. It is used for xul:dialog, role="dialog". ROLE_BORDER 19 Represents a window border. ROLE_GROUPING 20 Logically groups other objects. There is not always a parent-child relationship between the grouping object and the objects it contains. It is used for...
...ts an item in a list. See also ROLE_LIST. ROLE_OUTLINE 35 Represents an outline or tree structure, such as a tree view control, that displays a hierarchical list and allows the user to expand and collapse branches. Is is used for role="tree". ROLE_OUTLINEITEM 36 Represents an item in an outline or tree structure. It is used for role="treeitem". ROLE_PAGETAB 37 Represents a page tab, it is a child of a page tab list. It is used for xul:tab, role="treeitem". Also refer to ROLE_PAGETABLIST. ROLE_PROPERTYPAGE 38 Represents a property sheet. It is used for xul:tabpanel, role="tabpanel". ROLE_INDICATOR 39 Represents an indicator, such as a pointer graphic, that points to the current item. ROLE_GRAPHIC 40 Represents a picture. Is is used for xul:image, html:img. ROLE_STATICTEXT 41 Repres...
...And 3 more matches
Component; nsIPrefBranch
refName); void deleteBranch(in string aStartingAt); boolean getBoolPref(in string aPrefName, Requires Gecko 54 [optional] in boolean aDefaultValue); string getCharPref(in string aPrefName,Requires Gecko 54 [optional] in string aDefaultValue); Requires Gecko 58 utf8tring getStringPref(in string aPrefName, [optional] in utf8string aDefaultValue); void getChildList(in string aStartingAt, [optional] out unsigned long aCount, [array, size_is(aCount), retval] out string aChildArray); void getComplexValue(in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue); long getIntPref(in string aPrefName,Requires Gecko 54 [optional] in long aDefaultValue); long getPrefType(in string aPrefName); void...
...an individual UTF-8 string preference. utf8string getStringPref( in string aPrefName, [optional] in utf8string aDefaultValue ); Parameters aPrefName The string preference to retrieve. aDefaultValue Optional - a default value to use if the preference does not exist (instead of throwing an exception). Return value Returns utf8tring - The value of the requested string preference. ...
...ngPref( in string aPrefName, [optional] in utf8string aDefaultValue ); Parameters aPrefName The string preference to retrieve. aDefaultValue Optional - a default value to use if the preference does not exist (instead of throwing an exception). Return value Returns utf8tring - The value of the requested string preference. ...
...And 3 more matches
nsIXULWindow
ticle. Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) An nsIXULWindow is created as part of the creation of a top-level chrome window. When the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service. This signals the application in case it needs to quit. ...
...upports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) An nsIXULWindow is created as part of the creation of a top-level chrome window. When the window is destroyed, it will fire a "xul-window-destroyed" notification through the global observer service. This signals the application in case it needs to quit. ...
... contextFlags PRUint32 contextFlags are from nsIWindowCreator2. docShell nsIDocShell The docshell owning the XUL for this window. Read only. ...
...And 3 more matches
Examine and edit HTML - Firefox Developer Tools
derneath it. Moving the mouse over a node in the tree highlights that element in the page. Nodes that are not visible are shown faded/desaturated. This can happen for different reasons such as using display: none or that the element doesn't have any dimensions. There is an ellipsis shown between the opening and closing tag of an element when the node is collapsed if it has larger contents. Now children are indicated in the tree with this icon: At the right side of some nodes there are markers shown indicating different pieces of information related to it: event The element has one or several event listeners attached to it. Clicking the marker opens a tooltip listing the event listeners and allows you for each listener to switch to the line of JavaScript code in the Debugger wh...
... Context menu reference Edit as HTML Edit the element's HTML. ...
... Context menu reference Edit as HTML Edit the element's HTML. (Copy) In...
...And 3 more matches
Compositing example - Web APIs
o the hard parts. ...
...as.style.border = "1px solid #000"; canvas.style.margin = "5px"; canvas.width = width/2; canvas.height = height/2; return canvas; } function runComposite() { var dl = document.createElement("dl"); document.body.appendChild(dl); while(gco.length) { var pop = gco.pop(); var dt = document.createElement("dt"); dt.textContent = pop; dl.appendChild(dt); var dd = document.createElement("dd"); var p = document.createElement("p"); p.textContent = gcoText.pop(); dd.appendChild(p); var canvasToDrawOn = createCanvas(); var canvasToDrawFrom = createCanvas(); var canvasToDrawResult = createCanvas(); var ctx = canvasToDrawResult.getContext('2d'); ctx.clearRect(0, 0, width, hei...
... var lightMix = function() { var ctx = canvas2.getContext("2d"); ctx.save(); ctx.globalCompositeOperation = "lighter"; ctx.beginPath(); ctx.fillStyle = "rgba(255,0,...
...And 3 more matches
Element: overflow event - Web APIs
fired when an element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible). It is a proprietary event specific to Gecko (Firefox). ...
...x). ...
...id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> Overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getElementById("wrapper"), child = document.getElementById("child"), toggle = document.getElementById("toggle"); wrapper.addEventListener("overflow", function( event ) { console.log( event ); }, false); wrapper.addEventListener("underflow", function( event ) { console.log( event ); }, false); toggle.addEventListener("change", function( event ) { if ( event.target.checked ) { child.s...
...And 3 more matches
Element: underflow event - Web APIs
ch is specific to Firefox, is fired when an element is no longer overflowed by its content. This only works for elements for which overflow is not set to visible. The counterpart overflow event is fired when overflow occurs. ...
...rs. ...
...id="child"></div> </div> <br/> <label><input type="checkbox" id="toggle" checked/> Overflow</label> <style> #wrapper { width: 20px; height: 20px; background: #000; padding: 5px; overflow: hidden; } #child { width: 40px; height: 40px; border: 2px solid grey; background: #ccc; } </style> <script> var wrapper = document.getElementById("wrapper"), child = document.getElementById("child"), toggle = document.getElementById("toggle"); wrapper.addEventListener("overflow", function( event ) { console.log( event ); }, false); wrapper.addEventListener("underflow", function( event ) { console.log( event ); }, false); toggle.addEventListener("change", function( event ) { if ( event.target.checked ) { child.s...
...And 3 more matches
Using files from web applications - Web APIs
your input element or drop zone as discussed previously and have them call a function such as the handleFiles() function below. function handleFiles(files) { for (let i = 0; i < files.length; i++) { const file = files[i]; if (!file.type.startsWith('image/')){ continue } const img = document.createElement("img"); img.classList.add("obj"); img.file = file; preview.appendChild(img); // Assuming that "preview" is the div output where the content will be displayed. const reader = new FileReader(); reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img); reader.readAsDataURL(file); } } Here our loop handling the user-selected files looks at each file's type attribute to see if its MIME type begins with the string "ima...
...ate a new img element. CSS can be used to establish any pretty borders or shadows and to specify the size of the image, so that doesn't need to be done here. Each image has the CSS class obj added to it, making it easy to find in the DOM tree. We also add a file attribute to each image specifying the File for the image; this will let us fetch the images for actual upload later. We use Node.appendChild() to add the new thumbnail to the preview area of our document. Next, we establish the FileReader to handle asynchronously loading the image and attaching it to the img element. After creating the new FileReader object, we set up its onload function and then call readAsDataURL() to start the read operation in the background. When the entire contents of the image file are loaded, they are convert...
...lick", function (e) { if (fileElem) { fileElem.click(); } e.preventDefault(); // prevent navigation to "#" }, false); fileElem.addEventListener("change", handleFiles, false); function handleFiles() { if (!this.files.length) { fileList.innerHTML = "<p>No files selected!</p>"; } else { fileList.innerHTML = ""; const list = document.createElement("ul"); fileList.appendChild(list); for (let i = 0; i < this.files.length; i++) { const li = document.createElement("li"); list.appendChild(li); const img = document.createElement("img"); img.src = URL.createObjectURL(this.files[i]); img.height = 60; img.onload = function() { URL.revokeObjectURL(this.src); } li.appendChild(img); const info = document.createEl...
...And 3 more matches
Node.getRootNode() - Web APIs
Web › API › Node › getRootNode
The first simple example returns a reference to the HTML/document node: rootNode = node.getRootNode(); This more complex example shows the difference between returning a normal root, and a root incuding the shadow root. ...
... returning a normal root, and a root incuding the shadow root. ...
... incuding the shadow root. ...
...And 3 more matches
ParentNode.append() - Web APIs
Web › API › ParentNode › append
DOMString objects are inserted as equivalent Text nodes. Differences from Node.appendChild(): ParentNode.append() allows you to also append DOMString objects, whereas Node.appendChild() only accepts Node objects. ParentNode.append() has no return value, whereas Node.appendChild() returns the appended Node object. ParentNode.append() can append several nodes and strings, whereas Node.appendChild() can only append one node. ...
... Syntax // [Throws, Unscopable] ParentNode.append(...nodesOrDOMStrings) // returns undefined Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...ws, Unscopable] ParentNode.append(...nodesOrDOMStrings) // returns undefined Parameters nodes A set of Node or DOMString objects to insert. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...And 3 more matches
ParentNode.prepend() - Web APIs
Each node can be specified as either a Node object or as a string; strings are inserted as new Text nodes. Return value undefined. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...Each node can be specified as either a Node object or as a string; strings are inserted as new Text nodes. Return value undefined. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
... a string; strings are inserted as new Text nodes. Return value undefined. Exceptions HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy. ...
...And 3 more matches
ParentNode - Web APIs
The ParentNode mixin contains methods and properties that are common to all types of Node objects that can have children. It's implemented by Element, Document, and DocumentFragment objects. See Locating DOM elements using selectors to learn how to use CSS selectors to find nodes or elements of interest. Properties ParentNode.childElementCount Read only Returns the number of children of this ParentNode which are elements. ParentNode.children Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ParentNode.lastElementChild Read onl...
...hildren Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ParentNode.lastElementChild Read only Returns the last node which is both a child of this ParentNode and is an Element, or null if there is none. Methods ParentNode.append() Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes. ParentNode.prepend() Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as...
... child of the ParentNode. DOMString objects are inserted as equivalent Text nodes. ParentNode.querySelector() Returns the first Element with the current element as root that matches the specified group of selectors. ParentNode.querySelectorAll() Returns a NodeList representing a list of elements with the current element as root that matches the specified group of selectors. ...
...And 3 more matches
Signaling and video calling - Web APIs
ebSockets for signaling, but it is a common solution. You should, of course, select a mechanism for exchanging signaling information that is appropriate for your application. Let's update the chat client to support video calling. Updating the HTML The HTML for our client needs a location for video to be presented. This requires video elements, and a button to hang up the call: <div class="flexChild" id="camera-container"> <div class="camera-box"> <video id="received_video" autoplay></video> <video id="local_video" autoplay muted></video> <button id="hangup-button" onclick="hangUpCall();" disabled> Hang Up </button> </div> </div> The page structure defined here is using <div> elements, giving us full control over the page layout by enabling the use of CSS. We'll sk...
...age calls handleUserlistMsg(). Here we set up the handler for each connected user in the user list displayed to the left of the chat panel. This function receives a message object whose users property is an array of strings specifying the user names of every connected user. ...
...). Here we set up the handler for each connected user in the user list displayed to the left of the chat panel. This function receives a message object whose users property is an array of strings specifying the user names of every connected user. ...
...And 3 more matches
justify-self - CSS: Cascading Style Sheets
r similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start. start The item is packed flush to each other toward the start edge of the alignment container in the appropriate axis. end The item is packed flush to each other toward the end edge of the alignment container in the appropriate axis. flex-start For items that are not children of a flex container, this value is treated like start. flex-end For items that are not children of a flex container, this value is treated like end. self-start The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis. self-end The item is packed flush to the edge of the alignment container of the end side of the item, in the a...
...ch causes the grid items to stretch across the entire width of their cells. The second, third, and fourth grid items are then given different values of justify-self, to show how these override the justify-items value. These values cause the grid items to span only as wide as their content width, and align in different positions across their cells. ...
...stretch across the entire width of their cells. The second, third, and fourth grid items are then given different values of justify-self, to show how these override the justify-items value. These values cause the grid items to span only as wide as their content width, and align in different positions across their cells. ...
...And 3 more matches
Adding captions and subtitles to HTML5 video - Developer guides
with it. This menu is built dynamically, so that languages can be added or removed later by simply editing the <track> elements within the video's markup. ...
...the <track> elements within the video's markup. ...
...First of all an option is added to allow the user to switch all subtitles off, and then buttons are added for each te...
...And 3 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
if(month === 'January' || month === 'March' || month === 'May' || month === 'July' || month === 'August' || month === 'October' || month === 'December') { dayNum = 31; } else if(month === 'April' || month === 'June' || month === 'September' |...
... if(month === 'January' || month === 'March' || month === 'May' || month === 'July' || month === 'August' || month === 'October' || month === 'December') { dayNum = 31; } else if(month === 'April' || month === 'June' || month === 'September' || month === 'November') { ...
... if(month === 'January' || month === 'March' || month === 'May' || month === 'July' || month === 'August' || month === 'October' || month === 'December') { dayNum = 31; } else if(month === 'April' || month === 'June' || month === 'September' || month === 'November') { dayNum = 30; } el...
...And 3 more matches
<template>: The Content Template element - HTML: Hypertext Markup Language
Web › HTML › Element › template
are not rendered, however. Content categories Metadata content, flow content, phrasing content, script-supporting element Permitted content No restrictions Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts metadata content, phrasing content, or script-supporting elements. Also allowed as a child of a <colgroup> element that does not have a span attribute. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLTemplateElement Attributes This element only includes the global attributes. However, the HTMLTemplateElement has a content property, which is a read-only DocumentFragment containing the DOM subt...
...} The re...
...true); var td = clone.querySelectorAll("td"); td[0].textContent = "1235646565"; td[1].textContent = "Stuff"; tbody.appendChild(clone); // Clone the new row and insert it into the table var clone2 = template.content.cloneNode(true); td = clone2.querySelectorAll("td"); td[0].textContent = "0384928528"; td[1].textContent = "Acme Kidney Beans 2"; tbody.appendChild(clone2); } else { // Find another way to add the rows to the table because // the HTML template element is not supported. } The result is the original HTML table, with two new rows appended to it via JavaScript: table { background: #000; } table td { background: #fff; } Avoiding DocumentFragment pitfall A DocumentFragment is not a valid target for various events, as such it is o...
...And 3 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
SVG, SVG Attribute The requiredFeatures attribute takes a list of feature strings, with the individual strings separated by white space. It determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element and its children are skipped and thus will not be rendered. This provides a way to design SVG that gracefully falls back when features aren't available. 178 restart SVG, SVG Attribute The restart attribute specifies whether or not an animation can restart. 179 result NeedsCompatTable, SVG, SVG Attribute The result attribute defines the assigned name for this filter pri...
...the glyph size can also be adjusted if you change lengthAdjust. 222 to NeedsCompatTable, SVG, SVG Attribute The to attribute indicates the final value of the attribute that will be modified during the animation. 223 transform SVG, SVG Attribute The transform attribute defines a list of transform definitions that are applied to an element and the element's children. 224 transform-origin SVG, SVG Attribute The transform-origin SVG attribute sets the origin for an item's transformations. 225 type NeedsCompatTable, NeedsExample, SVG, SVG Attribute, filter The type attribute is a generic attribute and it has different meaning based on the context in which it's used. 226 u1 Deprecated, SVG, SVG Attribut...
... Element, Reference, SVG, SVG Container The <a> SVG element creates a hyperlink to other web pages, files, locations in the same page, email addresses, or any other URL. It is very similar to HTML's <a> element. 295 <altGlyph> Deprecated, Element, Reference, SVG, SVG Text Content The <altGlyph> SVG element allows sophisticated selection of the glyphs used to render its child character data. 296 <altGlyphDef> Deprecated, Element, NeedsExample, Reference, SVG, SVG Text Content The <altGlyphDef> SVG element defines a substitution representation for glyphs. 297 <altGlyphItem> Deprecated, Element, NeedsExample, Reference, SVG, SVG Text Content The <altGlyphItem> element provides a set of candidates for glyph substitution by the <a...
...And 3 more matches
Using templates and slots - Web Components
e referenced using JavaScript. Let's look at a trivial quick example: <template id="my-paragraph"> <p>My paragraph</p> </template> This won't appear in your page until you grab a reference to it with JavaScript and then append it to the DOM, using something like the following: let template = document.getElementById('my-paragraph'); let templateContent = template.content; document.body.appendChild(templateContent); Although trivial, you can already start to see how this could be useful. Using templates with web components Templates are useful on their own, but they work even better with web components. Let's define a web component that uses our template as the content of its shadow DOM. We'll call it <my-paragraph>: customElements.define('my-paragraph', class extends HTMLElement { ...
...'s define a web component that uses our template as the content of its shadow DOM. We'll call it <my-paragraph>: customElements.define('my-paragraph', class extends HTMLElement { constructor() { super(); let template = document.getElementById('my-paragraph'); let templateContent = template.content; const shadowRoot = this.attachShadow({mode: 'open'}) .appendChild(templateContent.cloneNode(true)); } } ); The key point to note here is that we append a clone of the template content to the shadow root, created using the Node.cloneNode() method. And because we are appending its contents to a shadow DOM, we can include some styling information inside the template in a <style> element, which is then encapsulated inside the custom element. This wouldn't w...
...ferent text!</span> </my-paragraph> or <my-paragraph> <ul slot="my-text"> <li>Let's have some different text!</li> <li>In a list!</li> </ul> </my-paragraph> Note: Elements that can be inserted into slots are known as Slotable; when an element has been inserted in a slot, it is said to be slotted. Note: An unnamed <slot> will be filled with all of the custom element's top-level child nodes that do not have the slot attribute. This includes text nodes. And that's it for our trivial example. If you want to play with it some more, you can find it on GitHub (see it running live also). A more involved example To finish off the article, let's look at something a little less trivial. The following set of code snippets show how to use <slot> together with <template> and some Jav...
...And 3 more matches
Forms related code snippets - Archive of obsolete content
Month.id = sPrefs + "-decr-month-" + nId; oIncrMonth.id = sPrefs + "-incr-month-" + nId; oIncrYear.id = sPrefs + "-incr-year-" + nId; oDecrYear.onmousedown = oIncrYear.onmousedown = oDecrMonth.onmousedown = oIncrMonth.onmousedown = onHeadClick; for (var nThId = 0; nThId < 7; nThId++) { oTH = document.createElement("th"); oTH.innerHTML = sDays[nThId]; oHRow.appendChild(oTH); } oTHead.appendChild(oHRow); oCapt.appendChild(oDecrYear); oCapt.appendChild(oDecrMonth); oCapt.appendChild(oIncrYear); oCapt.appendChild(oIncrMonth); oCapt.appendChild(this.display); this.container.appendChild(oCapt); this.container.appendChild(oTHead); this.current.setDate(1); this.writeDays(); oTarget.onclick = function () { if (oTable.parentNode) { ...
...Child(oHRow); oCapt.appendChild(oDecrYear); oCapt.appendChild(oDecrMonth); oCapt.appendChild(oIncrYear); oCapt.appendChild(oIncrMonth); oCapt.appendChild(this.display); this.container.appendChild(oCapt); this.container.appendChild(oTHead); this.current.setDate(1); this.writeDays(); oTarget.onclick = function () { if (oTable.parentNode) { oTable.parentNode.removeChild(oTable); return; } oTable.style.zIndex = nZIndex++; oTable.style.position = "absolute"; oTable.style.left = oTarget.offsetLeft + "px"; oTable.style.top = (oTarget.offsetTop + oTarget.offsetHeight) + "px"; oTarget.parentNode.insertBefore(oTable, oTarget); }; aInstances.push(this); } DatePicker.prototype.writeDays = function () { const...
...Target.parentNode.insertBefore(oTable, oTarget); }; aInstances.push(this); } DatePicker.prototype.writeDays = function () { const nEndBlanks = (this.current.getDay() + bZeroIsMonday * 6) % 7, nEnd = aMonthLengths[this.current.getMonth()] + nEndBlanks, nTotal = nEnd + ((7 - nEnd % 7) % 7); var oTD, oTR; if (this.oTBody) { this.container.removeChild(this.oTBody); } this.oTBody = document.createElement("tbody"); for (var nDay, oDay, nIter = 0; nIter < nTotal; nIter++) { if (nIter % 7 === 0) { oTR = document.createElement("tr"); this.oTBody.appendChild(oTR); } nDay = nIter - nEndBlanks + 1; oTD = document.createElement("td"); if (nIter + 1 > nEndBlanks && nIter < nEnd) { oTD.class...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
http://mozilla.org/"/> Listing 10: The oncommand event handler Because the Gecko engine implements DOM Level 2 event handlers, you can define dynamic event listeners such as the one in Listing 11. var item = document.getElementById('menu-item-custom'); function handleCommandEvent(aEvent) { alert('OK'); item.removeEventListener('command', handleCommandEvent, false); item.parentNode.removeChild(item); } item.addEventListener('command', handleCommandEvent, false); Listing 11: Additions and deletions using a dynamic event listener Special menu items Much like input elements in HTML, menuitem elements can operate like checkboxes and radio buttons by setting their type attributes. checkbox Adding type="checkbox" to a menuitem element will check that when it is selected, and uncheck i...
...e radio buttons in HTML. For an example of this kind of menu item, see the Character Encoding submenu of the View menu in Firefox. The selected radio button has the selected="true" attribute set. Contextual menus The context attribute is used to display a contextual menu or shortcut menu, that is, a custom menu that will appear when right-clicking on an element. Earlier we placed the menupopup child element inside a menu element; here, we use it outside the menu element. Instead, the menupopup element is a direct child of the root element and we invoke it using its id attribute, which we set as the value for the context attribute on any other XUL element. When we right-click on that XUL element, we reference that menupopup element by its id, and display its contents as a contextual menu. Lis...
...ting 13 - Checkbox-type toolbar buttons Specifying type="checkbox" results in a button that stays depressed when clicked, and pops up when clicked again. The button in its depressed state has checked="true" set. This is the kind of button used for the History and Bookmark buttons that can be used to customize the toolbar. - Menu-type toolbar buttons Specifying type="menu" and adding a menupop child element (In Firefox 3, you can also use the panel element), or setting the popup attribute to reference a popup menu located elsewhere by its id, will display a popup menu when the button is pressed. Here, the button-click itself is not taken as the input; instead, a command event is issued only when a popup menu item is selected. This is the type of button used for the List All Tabs button at th...
...And 2 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
ld be able to get the gist of how XPCOM is used by looking at the sample code. You can paste almost all the sample code in this chapter into your existing test.xul file to try it out. Feel free to fill in blank spots as you see fit. Make sure to change file paths to match your own environment. You can download the source code used in this chapter. Get window While you can use JavaScript to get child windows opened from the parent window, you cannot get dialogs or windows that have no relation to that window. To overcome this limitation, nsIWindowMediator makes it possible to access all of Firefox's windows. Get active window One thing that nsIWindowMediator is often used for is to get the active window. Listing 4 shows how to get the active browser window and the number of open tabs. Pass...
... directory Use the directoryEntries property to perform operations on all the files or folders in a given folder. This property returns a nsISimpleEnumerator-type object similar to the window overview, so you can get each element using similar techniques. Listing 9 shows how to list the contents of a folder. ...
...roperty to perform operations on all the files or folders in a given folder. This property returns a nsISimpleEnumerator-type object similar to the window overview, so you can get each element using similar techniques. Listing 9 shows how to list the contents of a folder. ...
...And 2 more matches
Monitoring downloads - Archive of obsolete content
executeStep()) { var row = document.createElement('listitem'); // Add the cells to the row var cell = document.createElement('listcell'); var sourceStr = statement.getString(0); row.setAttribute("tooltiptext", sourceStr); sourceStr = sourceStr.slice(sourceStr.lastIndexOf("/")+1); cell.setAttribute("label", sourceStr); // Source row.appendChild(cell); cell = document.createElement('listcell'); cell.setAttribute("label", (statement.getInt64(1) / 1024).toFixed(1) + "KB"); // Size cell.setAttribute("style", "text-align:right"); row.appendChild(cell); var theDate = new Date(statement.getInt64(2) / 1000); // Start time cell = document.createElement('listcell'); var dateStr = theDat...
...te("label", (statement.getInt64(1) / 1024).toFixed(1) + "KB"); // Size cell.setAttribute("style", "text-align:right"); row.appendChild(cell); var theDate = new Date(statement.getInt64(2) / 1000); // Start time cell = document.createElement('listcell'); var dateStr = theDate.toLocaleString(); cell.setAttribute("label", dateStr); row.appendChild(cell); theDate = new Date(statement.getInt64(3)); // End time cell = document.createElement('listcell'); dateStr = theDate.toLocaleString(); cell.setAttribute("label", dateStr); row.appendChild(cell); var speed = statement.getDouble(4) / 1024.0; cell = document.createElement('listcell'); cell.setAttribute("label", speed.toFixed(...
... cell = document.createElement('listcell'); dateStr = theDate.toLocaleString(); cell.setAttribute("label", dateStr); row.appendChild(cell); var speed = statement.getDouble(4) / 1024.0; cell = document.createElement('listcell'); cell.setAttribute("label", speed.toFixed(1) + "KB/sec"); cell.setAttribute("style", "text-align:right"); row.appendChild(cell); var status = statement.getInt32(5); var style = "color:black"; cell = document.createElement('listcell'); var statusStr; switch(status) { case 0: statusStr = "Downloading"; break; case 1: statusStr = "Complete"; style = "color:green"; break; case 2: statusStr =...
...And 2 more matches
Additional Navigation - Archive of obsolete content
bject attribute may be a resource URI or a literal value. Using a literal as the object of a triple is a common way to filter out specific items. For instance, if items were identified with a type, the data could be filtered to include only items of a particular type. Here is an example triple that we could use in the photos example: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="Canal"/> </query> This new triple has a static value for the object attribute instead of a variable reference. You might be able to guess that it will cause a match for only one of the photos, the Canal photo. The others won't be able to match when evaluating the triple. To look cl...
...r both. You can't have a triple with no variables. That's not an issue though, since it wouldn't be particularly useful. Also, you cannot use a variable in the predicate. Only the subject and object attributes may have variables. Another thing that you cannot have is a triple where both variables would be unknown as in the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?category" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> In this case when the template builder gets to the triple, neither the ?category nor the ?title variables can be filled in so the builder doesn't know what to generate. The builder won't generate any output in this situation. The member tag must have variable...
...="?category" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> In this case when the template builder gets to the triple, neither the ?category nor the ?title variables can be filled in so the builder doesn't know what to generate. The builder won't generate any output in this situation. The member tag must have variables for both the container and child attributes. It wouldn't be very common to filter for a specific child anyway. Source Navigation Triples may also be used to navigate up the graph as well as downwards, following the graph arrows in the reverse direction. For instance, in the original example, we could start at node D and navigate upwards to A and C. The syntax for the triple is the same except that the known variable should be ...
...And 2 more matches
Containment Properties - Archive of obsolete content
This allows you to iterate over a non-container. To do this, use the containment attribute on the root node, set to the predicate to iterate over. Let's look back at the very first example again. It doesn't have any containers, but we may want to iterate over the relatedItem predicate using the simple query syntax. We can add the containment attribute to do this. ...
...nt attribute as an indicator that an element is a container. If the starting node (or ref) has that predicate as one of its triples in the RDF data, the builder will use it in addition to checking if it is a container. Note the distinction here. The containment attribute doesn't replace the existing container checking. If the resource 'http://www.xulplanet.com/rdf/A' was also an RDF Seq with some children, then those children would also be added to the results. This next example demonstrates this. The only difference between this and the previous example is a a couple of additional lines added to the RDF/XML: <rdf:Seq rdf:about="http://www.xulplanet.com/rdf/A"> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/E"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/F"/> </rdf:Seq> The eff...
... lines added to the RDF/XML: <rdf:Seq rdf:about="http://www.xulplanet.com/rdf/A"> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/E"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/F"/> </rdf:Seq> The effect is that there are five results instead of three. ...
...And 2 more matches
Rule Compilation - Archive of obsolete content
inside hidden areas of the UI? No, you can still do that. Changing the hidden state of an element isn't the only way to cause content to be generated. Calling a DOM API which needs to get at the generated content will cause the template builder to generate output. For example, just calling the code like the following on the hidden vbox above will start off the template builder. var length = vbox.childNodes.length; This request to return the number of children of the vbox will make the template builder process the query and output content. Once done, the correct length can be returned. All of this is transparent to the XUL developer. When the template builder decides to start generation is determined automatically, and you don't need to do anything special to get this to happen. However, there...
...x will make the template builder process the query and output content. Once done, the correct length can be returned. All of this is transparent to the XUL developer. When the template builder decides to start generation is determined automatically, and you don't need to do anything special to get this to happen. However, there are two cases where content is not generated automatically: menus and child tree items. Content inside a menu is not generated until the menu is opened. This makes sense since the user can't see the contents of the menu until it is open. However, it also means that the DOM API usage, such as an attempt to get the number of child nodes as above, will also not include generated items until the menu is opened. This is an important distinction. That means that you will not b...
...Lazy generation comes in handy for menus and trees especially when dealing with recursive items. ...
...And 2 more matches
Simple Example - Archive of obsolete content
rdf:RDF> In this example, we have three images, which can be identified by urls. The resource uris correspond to their actual urls although this isn't necessary. Each image also has one property, the image's title. A template which displays this information is very simple to create. Unlike previous examples where we iterated over a property to navigate the graph, here we want to iterate over the children of an RDF container. The container, an RDF Seq, has the uri 'http://www.xulplanet.com/rdf/myphotos'. This will be the starting point of the navigation. We want the endpoints to be the three images. First, we set the datasources and ref attributes as needed: <vbox datasources="template-guide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> This time, we need to use a new statement,...
...is will be the starting point of the navigation. We want the endpoints to be the three images. First, we set the datasources and ref attributes as needed: <vbox datasources="template-guide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> This time, we need to use a new statement, the member condition as well as a triple. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> The seed is set in a similar manner as the previous examples, effectively creating a single result with the ?start variable set to the reference resource 'http://www.xulplanet.com/rdf/myphotos'. The same starting variable is used in this example, but you can of c...
...ery> The seed is set in a similar manner as the previous examples, effectively creating a single result with the ?start variable set to the reference resource 'http://www.xulplanet.com/rdf/myphotos'. The same starting variable is used in this example, but you can of course use any variable you wish. ...
...And 2 more matches
Simple Query Syntax - Archive of obsolete content
<< PreviousNext >> When iterating over the children of an RDF container, there is a simpler query syntax which may used. It may also be used when iterating over only one predicate. Simple RDF graph navigation such as this is common, so the simpler syntax is usually used in this situation since it avoids extra tags, although the simple syntax is not more or less efficient, at least when a single query is involved. A simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of triples from the child node. ...
...avoids extra tags, although the simple syntax is not more or less efficient, at least when a single query is involved. A simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of triples from the child node. At its simplest, the simple query syntax is equivalent to the following: <query> <content uri="?start"/> <member container="?start" child="?photo"/> </query> The template builder uses the simple query syntax whenever a template does not have a <query> element. ...
...Here is what it might look like: <template> <vbox class="box-padded" uri="rdf:*"> <image src="rdf:*"/> <label value="rdf:http://purl.org/dc/elements/1.1/title"/> </vbox> </template> There is no <query> or <action> element used. ...
...And 2 more matches
Special Condition Tests - Archive of obsolete content
accomplishes the same effect except that it using the parent matching mechanism. Note the parent attribute on the rule element, set to the value vbox. This causes the rule to match only content that would be inserted in a vbox element. As the outer element is a vbox, this will match for all results in the first iteration of the template. However, for the next iteration, that is, the next level of children, the content would instead be inserted into the groupbox generated from the previous iteration. This does not match the first rule, so the content from the second rule is generated instead. The end effect is the same output, however, the source code is simpler. This technique is useful when you know that the content will be different at each level. If this is not the case, you will still need ...
...rst rule will not match in this case, but the second rule will match and a label will be created. The result can be seen if you try the example. ...
...l="rdf:http://www.xulplanet.com/rdf/address"/> </menupopup> </rule> </template> </button> The only difference in the code in this example is that the order of the rules has been switched around, the condition check for house has been removed and the iscontainer attribute has been added. Since the iscontainer attribute is set to true, the rule will match as long as the member value or child of the starting node is an RDF container. We could also have left the rules in the original order and set the iscontainer on the first rule to false. The only thing we need to make sure is that the rules are in the proper order, so that the right data will be matched by the right rule. Remember, the more specific rules should go before less specific rules. Note that leaving out the iscontainer at...
...And 2 more matches
Element Positioning - Archive of obsolete content
point but the button will stop growing in size. The box the button is inside will also continue to grow, unless you set a maximum height on the box also. If two buttons are equally flexible, normally both will share the amount of extra space. If one button has a maximum width, the second will still continue to grow and take all of the remaining space. If a box has a maximum width or height, the children cannot grow larger than that maximum size. If a box has a minimum width or height, the children cannot shrink smaller than that minimum size. Examples of setting widths and heights <button label="1" style="width: 100px;"/> <button label="2" style="width: 100em; height: 10px;"/> <button label="3" flex="1" style="min-width: 50px;"/> <button label="4" flex="1" style="min-height: 2ex; max-width:...
..., a minimum width of 15 ems has been set so that the text box will always show at least 15 characters. If the user resizes the dialog to be very small, the text input will not shrink past 15 ems. It will be drawn as if it extends past the edge of the window. Notice in the image that the text input has grown to extend to the full size of the window. Box Packing Let's say you have a box with two child elements, both of which are not flexible, but the box is flexible. For example: Example 3: Source View <box flex="1"> <button label="Happy"/> <button label="Sad"/> </box> If you resize the window, the box will stretch to fit the window size. The buttons are not flexible, so they will not change their widths. The result is extra space that will appear on the right side of the window, insid...
...ght side of the window, inside the box. You may wish, however, for the extra space to appear on the left side instead, so that the buttons stay right aligned in the window. You could accomplish this by placing a spacer inside the box, but that gets messy when you have to do it numerous times. A better way is to use an additional attribute pack on the box. This attribute indicates how to pack the child elements inside the box. For horizontally oriented boxes, it controls the horizonal positioning of the children. For vertically oriented boxes, it controls the vertical positioning of the children. You can use the following values: start This positions elements at the left edge for horizontal boxes and at the top edge for vertical boxes. This is the default value. center This centers the ch...
...And 2 more matches
Stack Positioning - Archive of obsolete content
However, you may also place the children at specific coordinates. For example, if a stack has two buttons as children, one may be placed 20 pixels from the left edge and 50 pixels from the top edge. The second button can be placed at 100 pixels from the left edge and 5 pixels from the top edge. The position of a child element may be specified by placing two attributes on the element. ...
...ldren Normally, the child elements of a stack stretch to fit the size of the stack. However, you may also place the children at specific coordinates. For example, if a stack has two buttons as children, one may be placed 20 pixels from the left edge and 50 pixels from the top edge. The second button can be placed at 100 pixels from the left edge and 5 pixels from the top edge. The position of a child element may be specified by placing two attributes on the element. For the horizontal position, use the left attribute and for the vertical position, use the top attribute. If you don't put these attributes on a child of a stack, the child will stretch to fit the size of the stack. Example 1 : Source View <stack> <button label="Goblins" left="5" top="5"/> <button label="Trolls" left="60" ...
...tributes on a child of a stack, the child will stretch to fit the size of the stack. Example 1 : Source View <stack> <button label="Goblins" left="5" top="5"/> <button label="Trolls" left="60" top="20"/> <button label="Vampires" left="10" top="60"/> </stack> The stack here contains three elements, each positioned at the coordinates given by the left and top attributes. Here, all three children are buttons, but the elements do not have to be same type. They may be any element, including boxes and other stacks. The size of a stack is determined by the positions of the child elements. It is always sized so that all of the child elements are visible (excluding any children with -moz-stack-sizing: ignore). So if you set a left attribute to 400, the stack will have a width around 400 pix...
...And 2 more matches
Tree Box Objects - Archive of obsolete content
ript> function doScroll(){ var value = document.getElementById("tbox").value; var tree = document.getElementById("thetree"); var boxobject = tree.boxObject; boxobject.QueryInterface(Components.interfaces.nsITreeBoxObject); boxobject.scrollToRow(value); } </script> <tree id="thetree" rows="4"> <treecols> <treecol id="row" label="Row" primary="true" flex="1"/> </treecols> <treechildren> <treeitem label="Row 0"/> <treeitem label="Row 1"/> <treeitem label="Row 2"/> <treeitem label="Row 3"/> <treeitem label="Row 4"/> <treeitem label="Row 5"/> <treeitem label="Row 6"/> <treeitem label="Row 7"/> <treeitem label="Row 8"/> <treeitem label="Row 9"/> </treechildren> </tree> <hbox align="center"> <label value="Scroll to row:"/> <textbox i...
...ue.id; document.getElementById("row").value = row.value; document.getElementById("column").value = column.value; document.getElementById("part").value = part.value; } </script> <tree id="thetree" flex="1" onmousemove="updateFields(event);"> <treecols> <treecol id="utensil" label="Utensil" primary="true" flex="1"/> <treecol id="count" label="Count" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="Fork"/> <treecell label="5"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="Knife"/> <treecell label="2"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="Spoon"/> <treecell label="8"/> </treerow> </treeitem> </treechi...
...An out parameter is used since the function needs to return more that one value. You will see a number of interfaces that use out parameters in the XULPlanet object reference (FIXME: deadLink). These are indicated by the word 'out' before the argument. For these, you w...
...And 2 more matches
The Implementation of the Application Object Model - Archive of obsolete content
a pluggable data source. Just in case you still aren't convinced that all content nodes should be the same kind of element, consider another problem: how to implement aggregation. Suppose that a bookmarks folder contains a mailbox folder, a composer page template, and a bookmark. ...
...till aren't convinced that all content nodes should be the same kind of element, consider another problem: how to implement aggregation. Suppose that a bookmarks folder contains a mailbox folder, a composer page template, and a bookmark. In order to achieve aggregation of data, a content node implementation cannot make any assumptions about what kind of children it holds. It can only refer to its child nodes through the various content tree interfaces. What we run into now is the problem of how one local content node knows how to instantiate other kinds of content nodes. The only way that one content node would know how to instantiate a content node of a completely different type is if it had additional information stored for every child content node that it contained. It would have to consult ...
...If all content nodes are of the same type this problem can be solved in a cleaner fashion. ...
...And 2 more matches
prefwindow - Archive of obsolete content
isclosure" button is pressed. ondialoghelp Type: script code The code in this attribute is called when the "help" button is pressed. prefwindow.onload Type: script code When a window finishes loading, it calls this event handler on the prefwindow element. title Type: string The text to appear in the title bar of the window. type Type: string Set this attribute to child for preference dialogs that are child dialogs of a main preferences window. This ensures that the preferences are only saved when the main dialog is closed, if this is the appropriate behaviour for the platform. Properties buttons Type: comma-separated list of the values below A comma-separated list of buttons to appear on the dialog box. The buttons will be placed in suitable l...
... lastSelected Type: string Set this to the id of the last selected pane. It will be opened by default the next time the preferences dialog is opened. preferencePanes Type: DOM NodeList Holds a list of all the prefpane elements in the window. type Type: string Gets and sets the value of the type attribute. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData acceptDialog...
...And 2 more matches
radiogroup - Archive of obsolete content
Place the radiogroup inside a groupbox if you would like a border or caption for the group. The radiogroup defaults to vertical orientation. More information is available in the XUL tutorial. ...
...ect for the element. disabled Type: boolean Gets and sets the value of the disabled attribute. focusedItem Type: radio element Holds the currently focused item in the radiogroup, which may or may not be the same as the selected item. You can change the focused item by setting this property. itemCount Type: integer Read only property holding the number of child items. selectedIndex Type: integer Returns the index of the currently selected item. You may select an item by assigning its index to this property. By assigning -1 to this property, all items will be deselected. Returns -1 if no items are selected selectedItem Type: element Holds the currently selected item. If no item is currently selected, this ...
...er. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...And 2 more matches
treeitem - Archive of obsolete content
The treeitem can be clicked by the user to select the row of the tree. The treeitem contains a single row and all of what appear to the user as that row's descendants. In a template condition, you should use a treeitem instead of a content element when the dont-build-content flag is specified. Set the uri attribute to the variable name to bind to a content node during matching. More information is available in the XUL tutorial. ...
...ad of a content element when the dont-build-content flag is specified. Set the uri attribute to the variable name to bind to a content node during matching. More information is available in the XUL tutorial. Attributes container, empty, label, open, uri Examples (example needed) Attributes container Type: boolean Set to true if the element is to act as a container which can have child elements. This would be used for folders. This will be set by the template builder as needed. empty Type: boolean Set to true if the element is a container that contains no children. This will be set by the template builder as needed. label Tipo: string (concatenacion de caracteres) Para un arbol tree con columnas simples, la etiqueta puede ser colocada directamnete sobre el el...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...And 2 more matches
Building up a basic demo with the PlayCanvas engine - Game development
W); app.setCanvasResolution(pc.RESOLUTION_AUTO); Camera Now when the setup code is in place we need to think about implementing the standard scene components: camera, lights and objects. Let's start with the camera -- add these lines to your code, below the previous ones. var camera = new pc.Entity(); camera.addComponent("camera", { clearColor: new pc.Color(0.8, 0.8, 0.8) }); app.root.addChild(camera); camera.setPosition(0, 0, 7); The code above will create a new Entity. Note: An Entity is any object used in the scene -- it can be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. Then it adds a camera component to it with the light gray clearColor -- the color will be visible as the background. Next, the camera object is added to the root...
...le line of code. There are cubes, spheres, cylinders and more complicated shapes available. Drawing everything for given shape is taken care of by the engine, so we can focus on the high level coding. Let's start by defining the geometry for a cube shape -- add the following new code below your previous additions: var box = new pc.Entity(); box.addComponent("model", { type: "box" }); app.root.addChild(box); box.rotate(10, 15, 0); It will create an Entity with the box model component and add it to the root of the application, our scene. We also rotate the box a bit to show that it's actually a 3D cube and not a square. The cube is visible, but it is completely. To make it look better we need to shine some light onto it. Lights The basic light types in PlayCanvas are directional and ambient...
...some light onto it. Lights The basic light types in PlayCanvas are directional and ambient. The first type is a directional light placed somewhere on the scene while the scond one reflects the light from the first type, so it looks more natural; this can be set globally. Again, add the new code below your previous additions. var light = new pc.Entity(); light.addComponent('light'); app.root.addChild(light); light.rotate(45, 0, 0); It will create a light Entity component and add it to the scene. We can rotate the light on the x axis to make it shine on more than one side of the cube. It's time to add the ambient light: app.scene.ambientLight = new pc.Color(0.2, 0.2, 0.2); The code above assign a dark grey ambient light for the whole scene. The box look better now, but it could get some c...
...And 2 more matches
Cascade and inheritance - Learn web development
colored red -- the class selector gives its rule a higher specificity, and so it will be applied even though the rule with the element selector appears further down in the source order. We'll explain specificity scoring and other such things later on. Inheritance Inheritance also needs to be understood in this context -- some CSS property values set on parent elements are inherited by their child elements, and some aren't. For example, if you set a color and font-family on an element, every element inside it will also be styled with that color and font, unless you've applied different color and font values directly to them. Some properties do not inherit -- for example if you set a width of 50% on an element, all of its descendants do not get a width of 50% of their parent's width. I...
...rs don't remember all the details. The below video shows how you can use the Firefox DevTools to inspect a page's cascade, specificity, and more: Understanding inheritance We'll start with inheritance. In the example below we have a <ul>, with two levels of unordered lists nested inside it. We have given the outer <ul> a border, padding, and a font color. ...
...s. The below video shows how you can use the Firefox DevTools to inspect a page's cascade, specificity, and more: Understanding inheritance We'll start with inheritance. In the example below we have a <ul>, with two levels of unordered lists nested inside it. We have given the outer <ul> a border, padding, and a font color. ...
...And 2 more matches
Graceful asynchronous programming with Promises - Learn web development
ody in curly braces this time (otherwise it'll throw an error). Add the following to the end of your code: let promise3 = promise2.then(myBlob => { }) Now let's fill in the body of the executor function. Add the following lines inside the curly braces: let objectURL = URL.createObjectURL(myBlob); let image = document.createElement('img'); image.src = objectURL; document.body.appendChild(image); Here we are running the URL.createObjectURL() method, passing it as a parameter the Blob returned when the second promise fulfills. This will return a URL pointing to the object. Then we create an <img> element, set its src attribute to equal the object URL and append it to the DOM, so the image will display on the page! If you save the HTML file you've just created and load it in ...
... Note: .then()/.catch() blocks in promises are basically the async equivalent of a try...catch block in sync code. Bear in mind that synchronous try.
... The code we provided here for displaying the items is fairly rudimentary but works as an explai...
...And 2 more matches
Displaying Places information using views
he built-in tree view to display bookmarks whose titles or URLs contain "mozilla". Remember that, because XUL is XML, any ampersands in query URIs must be written as entity reference &amp; and not simply &. <tree type="places" place="place:terms=mozilla&amp;onlyBookmarked=1&amp;queryType=1"> <treecols> <treecol id="title" label="My Bookmarks" flex="1" primary="true" /> </treecols> <treechildren /> </tree> The next example does the same as the last but uses JavaScript to set the tree's place attribute: var histServ = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); var query = histServ.getNewQuery(); query.searchTerms = "mozilla"; query.onlyBookmarked = true; var opts = histServ.getNewQueryOptions(); opts.queryType = opts.QUERY_TYPE_BOOKM...
...fically has changed, it notifies its view by calling an appropriate method of nsINavHistoryResultViewer. Once notified, the view is responsible for updating itself. Note: Starting in Gecko 2.0, nsINavHistoryResultViewer has been replaced by the more powerful nsINavHistoryResultObserver. Tree view Create a built-in tree view by setting the type attribute to "places" on a tree element. The treechildren element should be empty: <tree type="places"> <treecols> <treecol id="title" flex="1" primary="true" /> <treecol id="url" flex="1" /> </treecols> <treechildren /> </tree> The tree view is implemented in browser/components/places/content/tree.xml. See the tree reference and Trees tutorial for general information about trees. If you would like your tree view to be styled in the...
...ou. If, on the other hand, you are writing a custom tree view, you will need to write similar code at some point. Menu view You can display Places information in a popup menu. In Firefox 3.6 and earlier Requires Gecko 1.9.2(Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Create a built-in menu view by setting the type attribute to "places" on an empty menupopup element (which would be a child of some parent menu element): <menu> <menupopup type="places" /> </menu> The place attribute or property should be set on the menupopup as well. In Firefox 4 and later Requires Gecko 2.0(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) You can add Places information to a popup like this: <menu id="bookmarksMenu"> <menupopup placespopup="true"> onpopupshowing="if (!document.get...
...And 2 more matches
Gecko Roles
he system mouse pointer. ROLE_CARET Represents the system caret. ROLE_ALERT Represents an alert or a condition that a user should be notified about. Assistive Technologies typically respond to the role by reading the entire onscreen contents of containers advertising this role. Should be used for warning dialogs, etc. ROLE_WINDOW Represents the window frame, which contains child objects such as a title bar, client, and other objects contained in a window. The role is supported automatically by Microsoft Windows. ROLE_INTERNAL_FRAME A sub-document. ROLE_MENUPOPUP Represents a menu, which presents a list of options from which the user can make a selection to perform an action. ROLE_MENUITEM Represents a menu item, which is an entry in a menu that a ...
...ng the user to select one or more items. ROLE_LISTITEM Represents an item in a list. ROLE_OUTLINE Represents an outline or tree structure, such as a tree view control, that displays a hierarchical list and allows the user to expand and collapse branches. ROLE_OUTLINEITEM Represents an item in an outline or tree structure. ROLE_PAGETAB Represents a page tab, it is a child of a page tab list. ROLE_PROPERTYPAGE Represents a property sheet. ROLE_INDICATOR Represents an indicator, such as a pointer graphic, that points to the current item. ROLE_GRAPHIC Represents a picture. ROLE_STATICTEXT Represents read-only text, such as labels for other controls or instructions in a dialog box. Static text cannot be modified or selected. ROLE_TE...
... a component that lets the user pick various attributes for fonts. ROLE_CHROME_WINDOW Frame role. A top level window with a title bar, border, menu bar, etc. It is often used as the primary window for an application. ROLE_GLASS_PANE A glass pane. A pane that is guaranteed to be painted on top of all panes beneath it. ROLE_HTML_CONTAINER A document container for HTML, whose children represent the document content. ROLE_ICON A small fixed size picture, typically used to decorate components. ROLE_LABEL Presents an icon or short string in an interface. ROLE_LAYERED_PANE A layered pane. A specialized pane that allows its children to be drawn in layers, providing a form of stacking order. This is usually the pane that holds the menu bar as well as the p...
...And 2 more matches
nsIAccessNode
rits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The nsIAccessNode implementations are instantiated lazily. The nsIAccessNode tree for a given DOM window has a one to one relationship to the DOM tree. If the DOM node for this access node is "accessible", then a QueryInterface to nsIAccessible will succeed. ...
...ts Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) The nsIAccessNode implementations are instantiated lazily. The nsIAccessNode tree for a given DOM window has a one to one relationship to the DOM tree. If the DOM node for this access node is "accessible", then a QueryInterface to nsIAccessible will succeed. ...
...s unattached from the accessible tree will result in an exception - NS_ERROR_FAILURE. Attribute Type Description document nsIAccessibleDocument The document accessible that this access node resides in. Read only. Note: Renamed from accessibleDocument in Gecko 2.0 DOMNode Node The DOM node this nsIAccessNode is associated with. Read only. firstChildNode nsIAccessNode The first nsIAccessNode child. Read only. Obsolete since Gecko 2.0 innerHTML DOMString The innerHTML for the DOM node This is a text string of all the markup inside the DOM node, not including the start and end tag for the node. Read only. language DOMString The language for the current DOM node, for example en, de, and so on. Read only. ...
...And 2 more matches
NextSibling
<< nsIAccessible Page Summary Returns next sibling in accessible tree. ...
... << nsIAccessible Page Summary Returns next sibling in accessible tree. ...
... << nsIAccessible Page Summary Returns next sibling in accessible tree. ...
...And 2 more matches
PreviousSibling
<< nsIAccessible Page Summary Returns previous node in accessible tree. ...
... << nsIAccessible Page Summary Returns previous node in accessible tree. ...
... << nsIAccessible Page Summary Returns previous node in accessible tree. ...
...And 2 more matches
nsIAccessibleSelectable
accessible/public/nsIAccessibleSelectable.idlScriptable An interface for the accessibility module and in-process accessibility clients for dealing with getting and changing the selection of accessible nodes. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview void addChildToSelection(in long index); void clearSelection(); nsIArray GetSelectedChildren(); boolean isChildSelected(in long index); nsIAccessible refSelection(in long index); void removeChildFromSelection(in long index); boolean selectAllSelection(); Attributes Attribute Type Description selectionCount long The number of accessible children currently selected. Read only. Constants Constant Value Description eSelection_Add 0 eSelection_Remove 1 eSelection_GetState ...
...n long index); nsIAccessible refSelection(in long index); void removeChildFromSelection(in long index); boolean selectAllSelection(); Attributes Attribute Type Description selectionCount long The number of accessible children currently selected. Read only. Constants Constant Value Description eSelection_Add 0 eSelection_Remove 1 eSelection_GetState 2 Methods addChildToSelection() Adds the specified accessible child of the object to the object's selection. If the specified object is already selected, then it does nothing. void addChildToSelection( in long index ); Parameters index The zero-based accessible child index. Exceptions thrown NS_ERROR_FAILURE If the specified object is not selectable. clearSelection() Clears the selection in the object so tha...
...ection() Adds the specified accessible child of the object to the object's selection. If the specified object is already selected, then it does nothing. void addChildToSelection( in long index ); Parameters index The zero-based accessible child index. Exceptions thrown NS_ERROR_FAILURE If the specified object is not selectable. clearSelection() Clears the selection in the object so that no children in the object are selected. void clearSelection(); Parameters None. GetSelectedChildren() Returns an nsIArray of the selected nsIAccessible children. nsIArray GetSelectedChildren(); Parameters None. Return value An nsIArray. isChildSelected() Determines if the current child of this object is selected. boolean isChildSelected( in long index ); Parameters index The zero-based accessible ch...
...And 2 more matches
nsIFocusManager
ed(in nsIDOMWindow aWindow); Native code only! void windowShown(in nsIDOMWindow aWindow, in PRBool aNeedsFocus); Native code only! Attributes Attribute Type Description activeWindow nsIDOMWindow The most active (frontmost) window, or null if no window that is part of the application is active. ...
...t child window's current element, if any. Setting this to null or to a non-top-level window throws an NS_ERROR_INVALID_ARG exception. focusedElement nsIDOMElement The element that is currently focused. This will always be an element within the document loaded in focusedWindow or null if no element in that document is focused. Read only. focusedWindow nsIDOMWindow The child window within the activeWindow that is focused. This will always be activeWindow, a child window of activeWindow or null if no child window is focused. Setting the focusedWindow changes the focused window and raises the toplevel window it is in. ...
...This process repeats downwards until a non-frame element is found. Constants Constant Value Description FLAG_RAISE 1 FLAG_NOSCROLL 2 Do not scroll the element to focus into view. ...
...And 2 more matches
nsIProcessScriptLoader
IDL file: mozilla-central/source/dom/base/nsIMessageManager.idl Inherits from: nsISupports This interface is used by parent process message managers to load scripts into a child process. The scripts run only once per process. The global object for process scripts is a ContentProcessMessageManager. Methods void loadProcessScript(in AString aURL, in boolean aAllowDelayedLoad) void removeDelayedProcessScript(in AString aURL); jsval getDelayedProcessScripts(); loadProcessScript() Load a script in the child process. Process scripts are loaded as soon as loadProcessScript() is called. If this function is called on a ChromeMessageBroadcaster, : it will load the process script into all child processes. if aAllowD...
...ipt(in AString aURL); jsval getDelayedProcessScripts(); loadProcessScript() Load a script in the child process. Process scripts are loaded as soon as loadProcessScript() is called. If this function is called on a ChromeMessageBroadcaster, : it will load the process script into all child processes. if aAllowDelayedLoad is true, then the script will also be loaded into any new child processes created after the loadProcessScript() call. Otherwise it will only be loaded into child processes that exist at the time of the call. ...
...e process script into all child processes. if aAllowDelayedLoad is true, then the script will also be loaded into any new child processes created after the loadProcessScript() call. Otherwise it will only be loaded into child processes that exist at the time of the call. If this function is called on a ChromeMessageSender: it will load the process script only into this ChromeMessageSender's child process aAllowDelayedLoad should always be true. It's possible that the child process for this ChromeMessageSender is not yet available at the time of the loadProcessScript() call, and if you pass false in this situation, your process script won't be loaded. For example: let ppmm = Services.ppmm.getChildAt(1); ppmm.loadProcessScript('data:,dump("foo\n");', true); Parameters Name ...
...And 2 more matches
AbstractRange - Web APIs
ts of an element, keep in mind that the element itself is a node, but so is any text inside it. In order to set a range endpoint within the text of an element, be sure to find the text node inside 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. The end point is set to be the middle of the first child of the span, and then the range is used to copy the contents of the range. Ranges and the hierarchy of ...
...lect the entire contents of the <p> element, including its descendants, this works perfectly. If we wish to instead copy the text "An interesting thing..." from the <section>'s heading (an <h2> element) through the end of the letters "ve" in the <em> within the paragraph below it, the following code would work: let r = document.createRange(); let startNode = document.querySelector("section h2").childNodes[0]; r.setStart(startNode, 11); let endNode = document.querySelector("#entry1 p em").childNodes[0]; r.setEnd(endNode, 2); let fragment = r.cloneContents(); Here an interesting problem arises--we are capturing content from multiple nodes located at different levels of the DOM hierarchy, and then only part of one of them. What should the result look like? As it turns out, the DOM specifica...
...most nodes within it. The parent <section> is not needed to replicate the cloned content, so it is isn't included. Example Consider this simple HTML fragment of HTML. <p><strong>This</strong> is a paragraph.</p> Imagine using a Range to extract the word "paragraph" from this. ...
...And 2 more matches
Attr - Web APIs
Web › API › Attr
Note: DOM Level 3 defined namespaceURI, localName and prefix on the Node interface. In DOM4 they were moved to Attr. This change is implemented in Chrome since version 46.0 and Firefox since version 48.0. Deprecated properties and methods The following properties have been deprecated. Where available, the appropriate replacement is noted. attributes This property now always returns NULL. childNodes Obsolete since Gecko 14 This property now always returns an empty NodeList. firstChild Obsolete since Gecko 14 This property now always returns NULL. isId Read only Indicates whether the attribute is an "ID attribute". An "ID attribute" being an attribute which value is expected to be unique across a DOM Document. In HTML DOM, "id" is the only ID attribute, but XML documents could defi...
...cko 14 This property now always returns NULL. isId Read only Indicates whether the attribute is an "ID attribute". An "ID attribute" being an attribute which value is expected to be unique across a DOM Document. In HTML DOM, "id" is the only ID attribute, but XML documents could define others. Whether or not an attribute is unique is often determined by a DTD or other schema description. lastChild Obsolete since Gecko 14 This property now always returns NULL. nextSibling This property now always returns NULL. nodeName Use Attr.name instead. nodeType This property now always returns 2 (ATTRIBUTE_NODE). nodeValue Use Attr.value instead. ownerDocument You shouldn't have been using this in the first place, so you probably don't care that this is going away. parentNode This propert...
...type information associated with this attribute. While the type information contained in this attribute is guaranteed to be correct after loading the document or invoking Document.normalizeDocument, this property may not be reliable if the node was moved. specified This property now always returns true. textContent Use Attr.value instead. The following methods have been deprecated: appendChild() Obsolete since Gecko 14 Modify the value of Attr.value instead. cloneNode() You shouldn't have been using this in the first place, so you probably don't care that this is going away. createAttribute() Use Element.setAttribute() instead. createAttributeNS() Use Element.setAttributeNS() instead. getAttributeNode() Use Element.getAttribute() instead. getAttributeNodeNS() Use Element.get...
...And 2 more matches
DocumentFragment - Web APIs
" text-anchor="middle" alignment-baseline="middle">DocumentFragment</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor DocumentFragment() Creates and returns a new DocumentFragment object. Properties This interface has no specific properties, but inherits those of its parent, Node, and implements those of the ParentNode interface. ...
...er text { fill: #0095DD; pointer-events: all;} Constructor DocumentFragment() Creates and returns a new DocumentFragment object. Properties This interface has no specific properties, but inherits those of its parent, Node, and implements those of the ParentNode interface. ParentNode.children Read only Returns a live HTMLCollection containing all objects of type Element that are children of the DocumentFragment object. ...
... DocumentFragment() Creates and returns a new DocumentFragment object. Properties This interface has no specific properties, but inherits those of its parent, Node, and implements those of the ParentNode interface. ParentNode.children Read only Returns a live HTMLCollection containing all objects of type Element that are children of the DocumentFragment object. ParentNode.firstElementChild Read only Returns the Element that is the first child of the DocumentFragment object, or null if there is none. ParentNode.lastElementChild Read only Returns the Element that is the last child of the DocumentFragment object, or null if there is none. ParentNode.childElementCount Read only Returns an unsigned long giving the amount of children that the DocumentFragment has. Methods T...
...And 2 more matches
Element.shadowRoot - Web APIs
console.log('Custom square element attributes changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...lement attributes changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...s changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...And 2 more matches
Selection - Web APIs
Web › API › Selection
election begins. Can return null if selection never existed in the document (e.g., an iframe that was never clicked on). Selection.anchorOffsetRead only Returns a number representing the offset of the selection's anchor within the anchorNode. If anchorNode is a text node, this is the number of characters within anchorNode preceding the anchor. If anchorNode is an element, this is the number of child nodes of the anchorNode preceding the anchor. Selection.focusNodeRead only Returns the Node in which the selection ends. Can return null if selection never existed in the document (for example, in an iframe that was never clicked on). Selection.focusOffsetRead only Returns a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is t...
...ection ends. Can return null if selection never existed in the document (for example, in an iframe that was never clicked on). Selection.focusOffsetRead only Returns a number representing the offset of the selection's anchor within the focusNode. If focusNode is a text node, this is the number of characters within focusNode preceding the focus. If focusNode is an element, this is the number of child nodes of the focusNode preceding the focus. Selection.isCollapsedRead only Returns a Boolean indicating whether the selection's start and end points are at the same position. Selection.rangeCountRead only Returns the number of ranges in the selection. Selection.typeRead only Returns a DOMString describing the type of the current selection. Methods Selection.addRange() A Range objec...
...() for more details. Selection.extend() Moves the focus of the selection to a specified point. Selection.getRangeAt() Returns a Range object representing one of the ranges currently selected. Selection.modify() Changes the current selection. Selection.removeRange() Removes a range from the selection. Selection.removeAllRanges() Removes all ranges from the selection. Selection.selectAllChildren() Adds all the children of the specified node to the selection. Selection.setBaseAndExtent() Sets the selection to be a range including all or parts of two specified DOM nodes, and any content located between them. Selection.setPosition() Collapses the current selection to a single point. This is an alias for collapse() -- See Selection.collapse() for more details. Selection.toString() ...
...And 2 more matches
ShadowRoot - Web APIs
e) { console.log('Custom square element attributes changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...Custom square element attributes changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...changed.'); updateStyle(this); } In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. ...
...And 2 more matches
Text.wholeText - Web APIs
Web › API › Text › wholeText
One for the first sentence, and one for ...
...So you try this: para.firstChild.data = "Thru-hiking is great, but "; All set, right? Wrong! What happened was you removed the strong element, but the removed sentence's element separated two text nodes. One for the first sentence, and one for the first w...
...id election coverage!</strong> However, <a href="http://en.wikipedia.org/wiki/Absentee_ballot">casting a ballot</a> is tricky.</p> You decide you don't like the middle sentence, so you remove it: para.removeChild(para.childNodes[1]); Later, you decide to rephrase things to, "Thru-hiking is great, but casting a ballot is tricky." while preserving the hyperlink. So you try this: para.firstChild.data = "Thru-hiking is great, but "; All set, right? Wrong! What happened was you removed the strong element, but the removed sentence's element separated two text nodes. One for the first sentence, and one for the first word of the last. Instead, you now effectively have this: <p>Thru-hiking is great, but However, <a href="http://en.wikipedia.org/wiki/Absentee_ballot">casting a ballot</a>...
...And 2 more matches
ARIA: switch role - Accessibility
switch role. Adding the switch role in ARIA This simple example just creates a widget and assigns the ARIA switch role to it. The button is styled with an appearance reminiscent of an on/off power switch. HTML The HTML is fairly simple here. The switch is implemented as a <button> element which is initially checked courtesy of its aria-checked attribute being set to "true". The switch has two child elements containing the "off" and "on" labels and is followed by a <label> identifying the switch. <button role="switch" aria-checked="true" id="speakerPower" class="switch"> <span>off</span> <span>on</span> </button> <label for="speakerPower" class="switch">Speaker power</label> JavaScript This JavaScript code defines and applies a function to handle click events on switch widgets.
... power switch paradigm. ...
... 0; padding: 0; width: 70px; height: 26px; border: 2px solid black; display: inline-block; margin-right: 0.25em; line-height: 20px; vertical-align: middle; text-align: center; font: 12px "Open Sans", "Arial", serif; } button.switch span { padding: 0 4px; pointer-events: none; } [role="switch"][aria-checked="false"] :first-child, [role="switch"][aria-checked="true"] :last-child { background: #262; color: #eef; } [role="switch"][aria-checked="false"] :last-child, [role="switch"][aria-checked="true"] :first-child { color: #bbd; } label.switch { font: 16px "Open Sans", "Arial", sans-serif; line-height: 20px; user-select: none; vertical-align: middle; -moz-user-select: none; -ms-user-select: none; -webkit-user-select: none; -o-user-select: none; } T...
...And 2 more matches
Border-radius generator - CSS: Cascading Style Sheets
================================================== */ .group:before, .group:after { content: ""; display: table; } .group:after { clear:both; } .group { zoom: 1; /* For IE 6/7 (trigger hasLayout) */ } /* GRID COLUMN SETUP * ========================================================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Component */ .ui-input-slider-container { height: 20px; margin: 10px 0; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider-container * { float: left; height: 100%; line-height: 100%; } /* Input Slider */ .ui-input-slider > input { margin: 0; padd...
...: 5; var input = new InputComponent(this); var slider_left = new SliderComponent(this, -1); var slider_right = new SliderComponent(this, 1); slider_left.className = 'ui-input-slider-left'; slider_right.className = 'ui-input-slider-right'; if (name) { var info = document.createElement('span'); info.className = 'ui-input-slider-info'; info.textContent = name; node.appendChild(info); } node.appendChild(slider_left); node.appendChild(input); node.appendChild(slider_right); node.className = 'ui-input-slider ui-input-slider-container'; this.input = input; sliders[topic] = this; setValue(topic, value); } var setValue = function setValue(topic, value, send_notify) { var slider = sliders[topic]; if (slider === undefined) return; if (value > sli...
...; var checkbox = document.createElement("input"); var label = document.createElement("label"); var id = 'checkbox-' + topic; checkbox.id = id; checkbox.setAttribute('type', 'checkbox'); checkbox.checked = state; label.setAttribute('for', id); if (name) { label.className = 'text'; if (align) label.className += ' ' + align; label.textContent = name; } node.appendChild(checkbox); node.appendChild(label); this.node = node; this.topic = topic; this.checkbox = checkbox; checkbox.addEventListener('change', function(e) { notify.call(this); }.bind(this)); buttons[topic] = this; } var getNode = function getNode(topic) { return buttons[topic].node; } var setValue = function setValue(topic, value) { try { buttons[topic].checkbox.checked...
...And 2 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
the z-index property. Grid is a powerful specification that, when combined with other parts of CSS such as flexbox, can help you create layouts that were previously impossible to build in CSS. It all starts by creating a grid in your grid container. The Grid container We create a grid container by declaring display: grid or display: inline-grid on an element. As soon as we do this, all direct children of that element become grid items. In this example, I have a containing div with a class of wrapper and, inside are five child elements. <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> I make the .wrapper a grid container. .wrapper { display: grid; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f767...
...</div> <div>Four</div> <div>Five</div> </div> I make the .wrapper a grid container. .wrapper { display: grid; } * {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; } All the direct children are now grid items. In a web browser, you won't see any difference to how these items are displayed before turning them into a grid, as grid has created a single column grid for the items. At this point, you may find it useful to work with the Grid Inspector, available as part of Firefox's Developer Tools. If you view this example in Firefox and inspect the grid, you will see a small icon next...
...te-rows properties. These define grid tracks. A grid track is the space between any two lines on the grid. In the below image you can see a track highlighted - this is the first row track in our grid. I can add to our earlier example by adding the grid-template-columns property, then defining the size of the column tracks. I have now created a grid with three 200-pixel-wide column tracks. The child items will be laid out on this grid one in each grid cell. <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> .wrapper { display: grid; grid-template-columns: 200px 200px 200px; } * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { ...
...And 2 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
he same time. The two specifications share some common features, however, and if you have already learned how to use flexbox, the similarities should help you get to grips with Grid. One-dimensional vs. two-dimensional layout A simple example can demonstrate the difference between one- and two-dimensional layouts. In this first example, I am using flexbox to lay out a set of boxes. I have five child items in my container, and I have given the flex properties values so that they can grow and shrink from a flex-basis of 150 pixels. I have also set the flex-wrap property to wrap, so that if the space in the container becomes too narrow to maintain the flex basis, items will wrap onto a new row. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; back...
...n property to the container with a value of relative, just as you would make a containing block for any other absolutely positioned items. Once you have done this, if you give a grid item position: absolute it will take as its containing block the grid container or, if the item also has a grid position, the area of the grid it is placed into. In the below example I have a wrapper containing four child items. Item three is absolutely positioned and also placed on the grid using line-based placement. The grid container has position: relative and so becomes the positioning context of this item. * {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...
...t has been taken out of flow as is usual for absolutely positioned items and so the auto-placement rules now place items into the same space. The item also doesn't cause the additional row to be created to span to row line 3. If we remove position: absolute from the rules for .box3 you can see how it would display without the positioning. A grid container as parent If the absolutely positioned child has a grid container as a parent but that container does not create a new positioning context, then it is taken out of flow as in the previous example. The positioning context will be whatever element creates a positioning context as is common to other layout methods. In our case, if we remove position: relative from the wrapper above, positioning context is from the viewport, as shown in this im...
...And 2 more matches
Pseudo-classes - CSS: Cascading Style Sheets
ses, pseudo-elements can be used to style a specific part of an element. Syntax selector:pseudo-class { property: value; } Like regular classes, you can chain together as many pseudo-classes as you want in a selector. ...
... want in a selector. ...
...ve :any-link :blank :checked :current :default :defined :dir() :disabled :drop :empty :enabled :first :first-child :first-of-type :fullscreen :future :focus :focus-visible :focus-within :has() :host :host() :host-context() :hover :indeterminate :in-range :invalid :is() :lang() :last-child :last-of-type :left :link :local-link :not() :nth-child() :nth-col() :nth-last-child() :nth-last-col() :nth-last-of-type() :nth-of-type() :only-child :only-of-type :optional :out-of-range :past :placeholder-shown :read-only :read-write :required :right :root :scope :state() :target :target-within :user-invalid :valid :visited :where() Specifications Specification Status Comment Fu...
...And 2 more matches
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
counter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue-regioncursor<custom-ident>D:defaultdeg<dimension>:dirdirection:disableddisplay<display-box><display-inside><display-internal><display-legacy><display-listitem><display-outside>dpcmdpidppxdrop-shadow()Eelement()ellipse()em:emptyempty-cells:enabledenv()exFfallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloat:focusfont@font-facefont-familyfont-family (@font-face)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-sizefont-size-adjustfont-stretchfont-stretch (@font-...
...eightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensI<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert()isolationJjustify-contentjustify-itemsjustify-selfKkHz@keyframesL:lang:last-child:last-of-typeleader():leftleft@left-bottom<length><length-percentage>letter-spacingline-breakline-heightlinear-gradient():linklist-stylelist-style-imagelist-style-positionlist-style-typelocal()Mmarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-top::markermarks (@page)maskmask-bordermask-border-modemask-bo...
...emask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typematrix()matrix3d()max()max-block-sizemax-heightmax-height (@viewport)max-inline-sizemax-widthmax-width (@viewport)max-zoom (@viewport)@mediamin()min-block-sizemin-heightmin-height (@viewport)min-inline-sizemin-widthmin-width (@viewport)min-zoom (@viewport)minmax()mix-blend-modemmmsN@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<number>Oobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-rotate:only-child:only-of-typeopacityopacity():optionalorderorientation (@viewport)@ornamentsornaments()orphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-inlineoverflow-wrapoverflow-xoverflow-yo...
...And 2 more matches
Visual formatting model - CSS: Cascading Style Sheets
he principal box When an element generates one or more boxes, one of them is the principal box, which contains its descendant boxes and generated content in the box tree, and is also the box involved in any positioning scheme. Some elements may generate additional boxes in addition to the principal box, for example display: list-item generates more than one box (e.g. a principal block box and a child marker box). And some values (such as none or contents) cause the element and/or its descendants to not generate any boxes at all. Anonymous boxes An anonymous box is created when there is not an HTML element to use for the box. This situation happens when, for example, you declare display: flex on a parent element, and directly inside there is a run of text not contained in another element. In...
... three boxes in the box tree. The part of the string before the paragraph element is wrapped in an anonymous box, then we have the <p>, which generates a box, and then another anonymous box. Something to consider about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box. In my examples, I am using a direct child selector to target the children of the container. This does not change the anonymous boxes, as they are not a child of the parent block. Inline anonymous boxes are created when a string is split by an inline element, for example, a sentence that includes a section wrapped with <em></em>. This splits the sentence into three inline boxes -- an anonymous inline box before the emphasized section, th...
... or is the root element. An element is called in-flow if it is not out of the flow. Read about CSS Positioned Layout. Formatting contexts and the display property Boxes can be described as having an outer display type, which is block or inline. This outer display type refers to how the box behaves alongside other elements on the page. Boxes also have an inner display type, dictating how their children behave. For normal block and inline layout, or normal flow, this display type is flow. This means that the child elements will also be either block or inline. However, the inner display type might be something like grid or flex, in which case the direct children will display as a grid, or flex items. In such a case the element is described as creating a grid or flex formatting context. In man...
...And 2 more matches
justify-items - CSS: Cascading Style Sheets
r similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start. start The item is packed flush to each other toward the start edge of the alignment container in the appropriate axis. end The item is packed flush to each other toward the end edge of the alignment container in the appropriate axis. flex-start For items that are not children of a flex container, this value is treated like start. flex-end For items that are not children of a flex container, this value is treated like end. self-start The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis. self-end The item is packed flush to the edge of the alignment container of the end side of the item, in the a...
... justify-items value of stretch (the default), which causes the grid items to stretch across the entire width of their cells. If you hover or tab onto the grid container however, it is given a justify-items value of center, which causes the grid items to span only as wide as their content width, and align in the center of their cells. ...
...tch (the default), which causes the grid items to stretch across the entire width of their cells. If you hover or tab onto the grid container however, it is given a justify-items value of center, which causes the grid items to span only as wide as their content width, and align in the center of their cells. ...
...And 2 more matches
WAI ARIA Live Regions/API Support - Developer guides
or pages where the author did not add any additional markup. Please read the ARIA spec or the live region report to learn about ARIA live region markup. As always, we're open to questions and suggestions for changes in community forums. ...
...IA spec or the live region report to learn about ARIA live region markup. As always, we're open to questions and suggestions for changes in community forums. ...
...red for web page mutations What changed in document? ...
...And 2 more matches
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
if(month === 'January' | month === 'March' | month === 'May' | month === 'July' | month === 'August' | month === 'October' | month === 'December') { dayNum = 31; } else if(month === 'April' | month === 'June' | month === 'September' | month =...
... if(month === 'January' | month === 'March' | month === 'May' | month === 'July' | month === 'August' | month === 'October' | month === 'December') { dayNum = 31; } else if(month === 'April' | month === 'June' | month === 'September' | month === 'November') { dayNum ...
... if(month === 'January' | month === 'March' | month === 'May' | month === 'July' | month === 'August' | month === 'October' | month === 'December') { dayNum = 31; } else if(month === 'April' | month === 'June' | month === 'September' | month === 'November') { dayNum = 30; } else { //...
...And 2 more matches
Using custom elements - Web Components
the element's internal shadow DOM structure -- which is then attached to the shadow root -- and finally attach some CSS to the shadow root to style it. ...
...achShadow({mode: 'open'}); // sets and returns 'this.shadowRoot' // Create (nested) span elements const wrapper = document.createElement('span'); wrapper.setAttribute('class','wrapper'); const icon = wrapper.appendChild(document.createElement('span')); icon.setAttribute('class','icon'); icon.setAttribute('tabindex', 0); // Insert icon from defined attribute or default icon const img = icon.appendChild(document.createElement('img')); img.src = this.hasAttribute('img') ? ...
...apper.setAttribute('class','wrapper'); const icon = wrapper.appendChild(document.createElement('span')); icon.setAttribute('class','icon'); icon.setAttribute('tabindex', 0); // Insert icon from defined attribute or default icon const img = icon.appendChild(document.createElement('img')); img.src = this.hasAttribute('img') ? ...
...And 2 more matches
Using shadow DOM - Web Components
DOM terminology to be aware of: Shadow host: The regular DOM node that the shadow DOM is attached to. Shadow tree: The DOM tree inside the shadow DOM. Shadow boundary: the place where the shadow DOM ends, and the regular DOM begins. Shadow root: The root node of the shadow tree. 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 inside a <style> element. The difference is that none of the code inside a shadow DOM can affect anything outside it, allowing for handy encapsulation. Note that the shadow DOM is not a new thing by any means -- browsers have used it for a long time to encapsulate the inner s...
... Working through a simple example Now let's walk through a simple example to demonstrate the shadow DOM in action inside a custom element -- <popup-info> (see a live example also). This takes an image icon and a text string, and embeds the icon into the page. When the icon is focused, it displays the text in a pop up information box to provide further in-context information. To be...
...cument.createElement('span'); info.setAttribute('class', 'info'); // Take attribute content and put it inside the info span let text = this.getAttribute('data-text'); info.textContent = text; // Insert icon let imgUrl; if(this.hasAttribute('img')) { imgUrl = this.getAttribute('img'); } else { imgUrl = 'img/default.png'; } let img = document.createElement('img'); img.src = imgUrl; icon.appendChild(img); Styling the shadow DOM After that we create a <style> element and populate it with some CSS to style it: // Create some CSS to apply to the shadow dom let style = document.createElement('style'); style.textContent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white;...
...And 2 more matches
Index - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Index
sing the Mozilla JavaScript interface to XSL Transformations XSLT This document describes the JavaScript interface in Mozilla 1.2 and up to the XSLT Processing Engine (TransforMiiX). 19 XSLT elements reference Element, Overview, Reference, XSLT There are two types of elements discussed here: top-level elements and instructions. A top-level element must appear as the child of either <xsl:stylesheet> or <xsl:transform>. An instruction, on the other hand, is associated with a template. A stylesheet may include several templates. A third type of element, not discussed here, is the literal result element (LRE). An LRE also appears in a template. It consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element i...
...ent, Reference, XSLT, copy-of The <xsl:copy-of> element makes a deep copy (including descendant nodes) of whatever the select attribute specifies to the output document. 28 <xsl:copy> Element, Reference, XSLT, copy The <xsl:copy> element transfers a shallow copy (the node and any associated namespace node) of the current node to the output document. It does not copy any children or attributes of the current node. 29 <xsl:decimal-format> Element, Reference, XSLT, decimal-format The <xsl:decimal-format> element defines the characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function. 30 <xsl:element> Element, Reference, XSLT The <xsl:element> element creates an element in the o...
... template to use if a given extension (or, eventually, newer version) element is not supported. 32 <xsl:for-each> Element, Reference, XSLT, for, for-each The <xsl:for-each> element selects a set of nodes and processes each of them in the same way. It is often used to iterate through a set of nodes or to change the current node. If one or more <xsl:sort> elements appear as the children of this element, sorting occurs before processing. Otherwise, nodes are processed in document order. 33 <xsl:if> Element, Reference, XSLT, if The <xsl:if> element contains a test attribute and a template. If the test evaluates to true, the template is processed. In this it is similar to an if statement in other languages. To achieve the functionality of an if-then-else sta...
...And 2 more matches
HTML to DOM - Archive of obsolete content
e tags like <script>, <style>, <head>, <body>, <title>, and <iframe>. It will also remove all JavaScript, including element attributes that contain JavaScript. function HTMLParser(aHTMLString){ var html = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null), body = document.createElementNS("http://www.w3.org/1999/xhtml", "body"); html.documentElement.appendChild(body); body.appendChild(Components.classes["@mozilla.org/feed-unescapehtml;1"] .getService(Components.interfaces.nsIScriptableUnescapeHTML) .parseFragment(aHTMLString, false, null, body)); return body; } It works by creating a content-level (this is safer than chrome-level) <div> in the current page, then parsing the HTML fragment and attaching that fragment to the <div>. The <div...
...so forth. ...
...e"); if (!frame) { // create frame frame = document.createElement("iframe"); // iframe (or browser on older Firefox) frame.setAttribute("id", "sample-frame"); frame.setAttribute("name", "sample-frame"); frame.setAttribute("type", "content"); frame.setAttribute("collapsed", "true"); document.getElementById("main-window").appendChild(frame); // or // document.documentElement.appendChild(frame); // set restrictions as needed frame.webNavigation.allowAuth = false; frame.webNavigation.allowImages = false; frame.webNavigation.allowJavascript = false; frame.webNavigation.allowMetaRedirects = true; frame.webNavigation.allowPlugins = false; frame.webNavigation.allowSubframes = false; // listen for load frame.addEventListener("load", function (event) { // the docum...
...about:blank" || doc.defaultView.frameElement) return; // do something with the DOM of doc alert(doc.location.href); // when done remove frame or set location "about:blank" setTimeout(function (){ var frame = document.getElementById("sample-frame"); // remove frame // frame.destroy(); // if using browser element instead of iframe frame.parentNode.removeChild(frame); // or set location "about:blank" // frame.contentDocument.location.href = "about:blank"; },10); }, true); } // load a page frame.contentDocument.location.href = "http://www.mozilla.org/"; // or // frame.webNavigation.loadURI("http://www.mozilla.org/",Components.interfaces.nsIWebNavigation,null,null,null); If you are starting with an HTML string, you can convert ...
Preferences - Archive of obsolete content
nces-service;1"] .getService(Components.interfaces.nsIPrefService); var branch = prefs.getBranch("acce"); var enablesound = branch.getBoolPref("ssibility.typeaheadfind.enablesound"); This is the reason why you should usually pass strings ending with a dot to getBranch(), like prefs.getBranch("accessibility."). ...
...tBoolPref("ssibility.typeaheadfind.enablesound"); This is the reason why you should usually pass strings ending with a dot to getBranch(), like prefs.getBranch("accessibility."). Another caveat you should be aware of is that nsIPrefBranch.getChildList("",{}) returns an array of preference names that start with that branch's root, for example var branch = prefs.getBranch("accessibility."); var children = branch.getChildList("", {}); will return these items (for the example tree above): "typeaheadfind.autostart", "typeaheadfind.enablesound", and "usebrailledisplay", not just direct children ("typeaheadfind" and "usebrailledisplay"), as you might have expected. Using preference observers Changes a user makes to your extension's preferences, such as through an options dialog, may not take e...
...re is a straightforward example: var myPrefObserver = { register: function() { // First we'll need the preference services to look for preferences. var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); // For this.branch we ask for the preferences for extensions.myextension. and children this.branch = prefService.getBranch("extensions.myextension."); // Now we queue the interface called nsIPrefBranch2. This interface is described as: // "nsIPrefBranch2 allows clients to observe changes to pref values." // This is only necessary prior to Gecko 13 if (!("addObserver" in this.branch)) this.branch.QueryInterface(Components.interfaces.nsIPrefBranch2); ...
...tion(subject, topic, data) { if (topic == 'nsPref:changed') this._callback(this._branch, data); }; /** * @param {boolean=} trigger if true triggers the registered function * on registration, that is, when this method is called. */ PrefListener.prototype.register = function(trigger) { this._branch.addObserver('', this, false); if (trigger) { let that = this; this._branch.getChildList('', {}). forEach(function (pref_leaf_name) { that._callback(that._branch, pref_leaf_name); }); } }; PrefListener.prototype.unregister = function() { if (this._branch) this._branch.removeObserver('', this); }; var myListener = new PrefListener( "extensions.myextension.", function(branch, name) { switch (name) { case "pref1": // extensions.myextensi...
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
item elements that were dynamically generated the last time the submenu opened, and which are still left over. Next, it dynamically generates menuitem elements based on the names of all the files in the session-storage directory, and inserts them into the menu. ...
...ubmenu opened, and which are still left over. Next, it dynamically generates menuitem elements based on the names of all the files in the session-storage directory, and inserts them into the menu. ...
...uitem elements based on the names of all the files in the session-storage directory, and inserts them into the menu. ...
...Open a new window and make sure that all three functions--saving a session, restoring a session, and deleting sessions--all work correctly. Phase 3: Creating a preference panel You don't need to use ini files, registries, or anything like that to give users options they can set through a pre...
Connecting to Remote Content - Archive of obsolete content
There are a couple of tools you can use to process these documents more efficiently: Using XPath XPath stands for XML Path ...
...There are a couple of tools you can use to process these documents more efficiently: Using XPath XPath stands for XML Path Language, it uses a non-XML syntax that provides a flexible way of...
...cument); Finally, you can either use nsIXSLTProcessor.transformToDocument() or nsIXSLTProcessor.transformToFragment() methods to transform the XML document. The nsIXSLTProcessor.transformToDocument() method returns a DOM Document with the results of the transformation, whereas, the nsIXSLTProcessor.transformToFragment() method returns a DOM DocumentFragment node. In this example code, the first child of the XUL document is appended to a XUL element after the transformation. request.onload = function(aEvent) { let responseXML = aEvent.target.responseXML; let xulNode; // transform the XML document to a XUL document xulDocument = xsltProcessor.transformToDocument(responseXML); // append the XUL node to a XUL element xulNode = document.adoptNode(xulDocument.firstChild); document.
...nded to a XUL element after the transformation. request.onload = function(aEvent) { let responseXML = aEvent.target.responseXML; let xulNode; // transform the XML document to a XUL document xulDocument = xsltProcessor.transformToDocument(responseXML); // append the XUL node to a XUL element xulNode = document.adoptNode(xulDocument.firstChild); document.getElementById("foo").appendChild(xulNode); }; We effectively transformed the XML file into XUL and integrated it into the UI. Note: Security should be your number one priority when handling remote content. Do not allow event handlers or any other kinds of code to be passed through your parsers. If you need your generated XUL to have JS code in it, all of it should be added locally, never from the remote source. Here are a co...
Using microformats - Archive of obsolete content
s = Microformats.count(name, rootElement, options); Parameters name The name of the microformat to count. rootElement Required. The DOM element at which to begin the search. If you want to search the entire document, specify content.document. options Optional. If provided, this is a JavaScript object that contains zero or more of the following flags: recurseExternalFrames If true, child frames are included in the search. The default is true. showHidden If true, hidden microformats are added; otherwise they're left out. The default is false. debug Specify true if debug mode is in use; otherwise, specify false. The default is false. Return value An integer value indicating the number of microformats that match the specified criteria. debug() Returns a string that describ...
...ormats.get(name, rootElement, options, targetArray); Parameters name The name of the microformat to find. rootElement Required. The DOM element at which to begin the search. If you want to search the entire document, specify content.document. options Optional. If provided, this is a JavaScript object that contains zero or more of the following flags: recurseExternalFrames If true, child frames that reference external content are included in the search. The default is true. showHidden If true, hidden microformats are added; otherwise they're left out. The default is false. debug Specify true if debug mode is in use; otherwise, specify false. The default is false. targetArray Optional. If provided, this is an array of microformat objects to which the search results are a...
...croformats.getNamesFromNode(node); Parameters node The node for which to retrieve a list of microformat names. Return value If the specified node is a microformat, the result is a space-delineated string listing all the microformat names that correspond to the node. If the node isn't a microformat, nothing is returned. getParent() Returns the parent node of the specified microformat or child of a microformat. var parentNode = Microformats.getParent(node); Parameters node The node whose parent you wish to retrieve. Return value The parent of the specified node. Returns nothing if the specified node isn't a microformat or the child of a microformat. isMicroformat() Determines whether or not the specified DOM node is a microformat. var flag = Microformats.isMicroformat(node...
... the specified node isn't a microformat or the child of a microformat. isMicroformat() Determines whether or not the specified DOM node is a microformat. var flag = Microformats.isMicroformat(node); Parameters node The DOM node to check to see if it's a microformat. Return value true if the node is a microformat, otherwise false. Note: This method doesnot return true if the node is a child of a microformat. See also Microformats.org ...
DOM Interfaces - Archive of obsolete content
This means that, depending on the details regarding the insertion points of the binding, it's possibl...
... 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. Parameters elt - The element to retrieve anonymous children for. Return Value NodeList - The return value of getAnonymousNodes is a NodeList that represents the children of an element after insertion points from its own binding have been applied. This means that, depending on the details regarding the insertion points of the binding, it's possible that some non-anonymous nodes appear in the list. See "Not so anonymous nodes" on mozilla.dev.
...of the binding, it's possible that some non-anonymous nodes appear in the list. See "Not so anonymous nodes" on mozilla.dev.platform for some discussion about this. getAnonymousElementByAttribute The getAnonymousElementByAttribute methods retrieves an anonymous descendant with a specified attribute value. Typically used with an (arbitrary) anonid attribute to retrieve a specific anonymous child in an XBL binding. Parameters elt - The element to retrieve anonymous children for. attrName - The attribute name to look up. attrValue - The attribute value to match. Return Value Element - The return value of getAnonymousElementByAttribute is an anonymous descendant of the given element with matching attribute name and value. getBindingParent The getBindingPa...
...ent method was invoked). The binding document can then be modified programmatically using the DOM. Any subsequent bindings that are attached to elements within the document will be constructed from the modified binding document. Parameters documentURL of type DOMString - The URL of a binding document. No Return Value Example The following snippet checks to see if any anonymous child of "element" is itself an 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; ...
Multiple Queries - Archive of obsolete content
ed first and output generated for it, followed by the results and output for the second query, and so forth for all of the queries. ...
...The second query doesn't contain such a triple and will match all three of the photos. ...
... the previous example. You can also mix simple and extended queries in one template, although you may prefer to use the same style in all queries for consistency. However, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. This is because all simple queries will iterate over the same data, usually the children of an RDF container. So the builder only performs this step once and filters the data for each query. When using the extended query syntax, the manner in which the graph is navigated may be different for every query, so no optimization can be done. The builder needs to process every condition of every query. If, for example, you have six queries, each with a <member> condition, the builder wil...
... So the builder only performs this step once and filters the data for each query. When using the extended query syntax, the manner in which the graph is navigated may be different for every query, so no optimization can be done. The builder needs to process every condition of every query. If, for example, you have six queries, each with a <member> condition, the builder will need to construct the children six times. You probably won't notice any difference for small amounts of data such as the photos example we've been using, but you might for large datasets. Thus, you will want to use the simple query syntax when possible. If you are only going to be using one query, it doesn't matter, of course. Speaking of using a single query, the simple query syntax allows a slight shorthand. You can remov...
Template Logging - Archive of obsolete content
other words, this error occurs because either the <content> element was missing or was placed after a <member> or <triple> element. <member> requires a variable for its container attribute The container attribute on a <member> element has to be variable (a value beginning with a question mark). This error can also occur if the container attribute was not set. <member> requires a variable for its child attribute The child attribute on a <member> element has to be variable (a value beginning with a question mark). This error can also occur if the child attribute was not set. <triple> should have at least one variable as a subject or object Both the subject and object attributes of a <triple> element have been set to a non-variable. This will have no effect so an error is output indicating this. ...
...icate The predicate attribute on a <triple> element has either not been set or has been set to a variable. Instead, it has to be set to a resource predicate. <triple> requires a variable for its object attribute The object attribute on a <triple> element has to be variable (a value beginning with a question mark). This error can also occur if the object attribute was not set. neither container or child variables of <member> has a value This indicates that a <member> was being checked and yet neither the variables specified for the container or the child have a value for a result. This error will occur while processing a result and will often repeat for each result. This error generally indicates an error in the logic of the template. Common errors are misspelled variable names or <member> and <...
...An example is given below this list of errors. neither subject or object variables of <triple> has a value Similar to the previous error but for the <triple> element. Either the subject or object variables could never be set to a value for a result. ...
...uld not be parsed </assign> For XML datasources, an <assign> element has an XPath expression that is not valid. XPath expression in <binding> could not be parsed For XML datasources, a <binding> element has an XPath expression that is not valid. The two errors where neither variable of either a <member> or <triple> have a value deserve some examples. <content uri="?uri"> <member container="?uri" child="?person"> <triple subject="?person" predicate="http://example.com/name" object="?name"/> <content uri="?uri"> <member container="?uri" child="?human"> <triple subject="?person" predicate="http://example.com/name" object="?name"/> Note that subtle difference in these examples. The child attribute on the <member> element is different. The first example generates no error and is a common template...
Using Recursive Templates - Archive of obsolete content
we could display one level for the two groups, and use another level for each person. ...
...pbox type="menu" datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="*"/> <action> <vbox uri="?" class="indent"> <label value="?name"/> </vbox> </action> </template> </groupbox> In this simplified example, the XPath expression just gets the list of child elements of the reference node. For the outermost iteration, a vbox is created with a child label. Since the initial reference node is the root of the XML source document, the results are two elements, one for each group element. However, a further step is done to retrieve an additional level of nodes. As each group has children itself, each result (in this case, each group) becomes the reference point for a futher iteration. The same query is executed again but using the groups generat...
..."/> <vbox id="row7" class="indent"><label value="Cleopatra"/></vbox> <vbox id="row8" class="indent"><label value="Laura Secord"/></vbox> </vbox> </groupbox> Note how similar content corresponding to the action body is created for both the groups as well as the people. The template builder has also added container and empty attributes to the groups. This is done with all nodes that have children to indicate that the node contains generated children as well as whether the node is empty. These hints are used for trees, but they can also be used in a stylesheet to provide a different appearance for containers with children, empty containers, as well as non-containers. In this example, both the parent groups and child people are displayed the same. You could use multiple rules as well, in...
...o where conditions, so this matches all remaining results. The output for groups is a groupbox with a caption containing the name. The output for non-groups is a label. You could further expand this process for other levels. Disabling Recursion The recursion on a template occurs automatically. In fact, it has occured with all of the examples so far. However, in most cases, there either aren't any children or the next iteration of the query doesn't return any results, so no output is generated. Sometimes, you will not want a template generate recursive content. You can do this by adding a flag. <vbox datasources="people.xml" ref="*" querytype="xml" flags="dont-recurse"> Here, the flags attribute is set to dont-recurse. This disables the recursion and only generates one level of results. <<...
Box Objects - Archive of obsolete content
nAndSize();"/> <label id="thelabel" value="I am a label"/> Note that if you hide and collapse the label, it will be treated as hidden. You will then have to unhide and uncollapse the label for it to appear again. XUL Element Ordering The box object may also be used to determine the display order of elements, which may not be the same as the order in the source. Recall that DOM properties such as childNodes, firstChild, and nextSibling may be used to navigate the document tree. The box object also allows navigation in a similar means but retrieves the elements in display order. The box object provides several properties, firstChild, lastChild, nextSibling, previousSibling, and parentBox. Their function should be self explanatory from their names. These properties return elements, for example, t...
...There is no corresponding childNodes property for box navigation; instead you must navigate by sibling using the nextSibling or previousSibling properties. Unlike with navigating the DOM tree, hidden elements are not included when navigating by box objects. ...
...avigate the document tree. The box object also allows navigation in a similar means but retrieves the elements in display order. The box object provides several properties, firstChild, lastChild, nextSibling, previousSibling, and parentBox. Their function should be self explanatory from their names. These properties return elements, for example, the firstChild property returns the first displayed child element. There is no corresponding childNodes property for box navigation; instead you must navigate by sibling using the nextSibling or previousSibling properties. Unlike with navigating the DOM tree, hidden elements are not included when navigating by box objects. That means that for a box with six children where the first two are hidden, the firstChild property will return the third element. H...
...er as in the source. If you then press the button labeled One again, its ordinal will increase to 3 and will move to the end. Finally, pressing the button labeled Three will increase its ordinal to 2 and it will appear in between the other two buttons. dir attribute The final box ordering attribute is the dir attribute, or the -moz-box-direction CSS property. If this is set to reverse, all of the children in the box are displayed in reverse order. In a horizontal box, the elements will be displayed from right to left; in a vertical box, the elements will be displayed from bottom to top. Here is an example: Example 5 : Source View <hbox dir="reverse"> <button label="Left"/> <button label="Center"/> <button label="Right"/> </hbox> Navigation through the nodes using the box object ordering ...
RDF Datasources - Archive of obsolete content
playing the history list. We'll display the history in a tree with three columns, the Name, the URL and the Date. ...
...You can use any of the resources that you want. Bookmarks (rdf:bookmarks) The bookmarks are generated from the user's bookmark list. ...
...The ref attribute has been set to the ...
...The ref attribute has been set to the root element in the RDF file, which is the top-level Seq. This will give us a complete list of animals. ...
button - Archive of obsolete content
splayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child elements of the element are placed. normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the elements are placed left to right or top to bottom in the order they appear in the XUL code. reverse For scales, the scale's values are ordered from right to left (for horizontal scales) or f...
...o text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. open Type: boolean For the menu type buttons, the open attribute is set to true when the menu is open. The open attribute is not present if the menu is closed. orient Type: one of the values below Used to specify whether the children of the element are oriented horizontally or vertically. The default value depends on the element. You can also use the -moz-box-orient style property. horizontal Child elements of the element are placed next to each other in a row in the order that they appear in the XUL source. vertical Child elements of the element are placed under each other in a column in the order that they appe...
...lean Gets and sets the value of the open attribute. orient Type: string Gets and sets the value of the orient attribute. tabIndex Type: integer Gets and sets the value of the tabindex attribute. type Type: string Gets and sets the value of the type attribute. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
column - Archive of obsolete content
It is common to use columns only to define width and flexibility for the grid column and not place elements directly inside the column. More information is available in the XUL tutorial. Example See grid for an example. ...
... It is common to use columns only to define width and flexibility for the grid column and not place elements directly inside the column. More information is available in the XUL tutorial. Example See grid for an example. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
deck - Archive of obsolete content
Archive › Mozilla › XUL › deck
More information is available in the XUL tutorial. ...
... More information is available in the XUL tutorial. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related stack ...
iframe - Archive of obsolete content
Currently, XUL iframes running in remote processes are not supported. If you want to run content in a remote process, use a XUL browser element. ...
...Default is false. src Type: URI The URI of the content to appear in the element. type Type: one of the values below. The type of browser, which...
...object for the document. webNavigation Type: nsIWebNavigation This read-only property contains the nsIWebNavigation object for the document. Most of its methods are callable directly on the element itself, such as goBack and goForward. It also contains the load constants used by reloadWithFlags and loadURIWithFlags. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related nsIAcces...
menulist - Archive of obsolete content
rence to the nsIEditor for editable text. This property is read only. image Type: image URL The image associated with the currently selected item. inputField Type: textbox element A reference to the textbox element used for editable menu lists. This property is read only and applies to editable menulists only. itemCount Type: integer Read only property holding the number of child items. label Type: string Gets and sets the value of the label attribute. menuBoxObject Type: nsIMenuBoxObject A reference to the nsIMenuBoxObject which implements the menu. menupopup Type: menupopup element A reference to the menupopup used by the menu or menulist. This property is read-only. open Type: boolean Gets and sets the value o...
...user. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendItem( label,...
...specified index. insertItemAt( index, label, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. removeAllItems() Return type: no return value Removes all of the items in the menu. removeItemAt( index ) Return type: element Removes the child item in the element at the specified index. The method returns the removed item. select() Return type: no return value Select all the text in the menulist's textbox. This method applies to editable menulists only. Related Elements menu, menubar, menuitem, menupopup, menuseparator Interfaces nsIAccessibleProvider, nsIDOMXULMenuListElement ...
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
be opened via a script using the openPopup method. The panel is closed when the user clicks outside the panel, presses Escape or when the panel's hidePopup method is called. Warning: For Firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. Some features may work, but only on some platforms. For those versions of Firefox, it is best to avoid child frames in a panel, if possible. This limitation was resolved as of Firefox 4.0. Attributes backdrag, close, consumeoutsideclicks, fade, flip, ignorekeys, label, left, level, noautofocus, noautohide, norestorefocus, onpopuphidden, onpopuphiding, onpopupshowing, onpopupshown, position, titlebar, top, type Properties accessibleType, label, popupBoxObject, popup, state Methods hidePopu...
...this attribute should not be set, otherwise IME or on-screen keyboard popups will appear incorrectly. For these reasons, you should avoid setting the level if not needed. top The panel is shown in front of all other normal windows, including those of other applications. parent The panel is shown just above the window the panel is in, but behind other windows above it. If anchored, the child window maintains its relative position to its parent window. floating The panel floats above the window the panel is in. On Mac, the panel is only visible when the application is active. noautofocus Type: boolean If false, the default value, the currently focused element will be unfocused whenever the popup is opened or closed. If true, the focus is not adjusted. noautohid...
...: The popup is closed and not visible. open: The popup is open and visible on screen. showing: A request has been made to open the popup, but it has not yet been shown. This state will occur during the popupshowing event. hiding: The popup is about to be hidden. This state will occur during the popuphiding event. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData hidePopup()...
richlistbox - Archive of obsolete content
tem element Returns the currently focused item in the list box, which is only useful in a multiple selection list box. disabled Type: boolean Gets and sets the value of the disabled attribute. disableKeyNavigation Type: boolean Gets or sets the value of the disableKeyNavigation attribute. itemCount Type: integer Read only property holding the number of child items. scrollBoxObject Type: nsIScrollBoxObject The scroll box object implements the nsIScrollBoxObject interface, which may be used to retrieve and adjust the scroll position of the list box. selectedCount Type: integer Returns the number of items that are currently selected. selectedIndex Type: integer Returns the index of the currently selected item. You ...
...te. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addItemToSelecti...
...justs the focused item backward by that many items. If isSelecting is true, then the selection is also adjusted. If isSelectingRange is also true, then the new item is selected in addition to any currently selected items. If isSelectingRange is false, any existing selection is cleared. Items that are hidden are skipped. removeItemAt( index ) Return type: element Removes the child item in the element at the specified index. The method returns the removed item. removeItemFromSelection( item ) Return type: no return value Deselects the specified item without deselecting other items. scrollToIndex( index ) Return type: no return value Scrolls the element to the specified index. This is different than ensureIndexIsVisible because the view is always scrolled. ...
row - Archive of obsolete content
Archive › Mozilla › XUL › row
More information is available in the XUL tutorial. Example See grid for an example. ...
... More information is available in the XUL tutorial. Example See grid for an example. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
rule - Archive of obsolete content
Archive › Mozilla › XUL › rule
A rule may contain where, binding and/or action elements. A condition is defined used a where element. For each result that matches all of the conditions, content within the rule's action body is generated. The bindings element is optional and may specify additional variable bindings to be used. ...
... regardless of whether a node is a container or not. true: The rule will only match nodes that are marked as containers. This would apply to nodes that represent folders. false: The rule will only match nodes that are not marked as containers. isempty Type: boolean Indicates whether rules match based on emptyness. If not specified, the rule may match regardless of whether a node has children or not. true: The rule will only match nodes that contain no child elements. false: The rule will only match nodes that contain one or more child elements. parent Type: element tag name If set, the rule will only match the corresponding tag. This may be used to have separate rules for leaf and container nodes with different tags. parsetype Type: string If this attribute ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
splitter - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The ...
...ible, however, the columns may still be resized. <tree id="tree1" flex="1" height="300" enableColumnDrag="true"> <treecols> <treecol id="name" label="Name" flex="1"/> <splitter class="tree-splitter"/> <treecol id="id" label="ID" flex="1"/> <splitter class="tree-splitter"/> <treecol id="date" label="Date" flex="1"/> <splitter class="tree-splitter"/> </treecols> <treechildren/> </tree> Splitter resizing and overflow The degree to which a splitter will resize a box, and what happens during the resize and after the limit is reached, depends on the height (or width) specified for the box as an attribute or in CSS, the min-height (or min-width), the intrinsic height of the box contents, and the presence or absence of a collapse attribute on the splitter. For: <vbo...
...tribute). For: <vbox/> <splitter/> <vbox height="500" minheight="200"> <vbox height="100"/> </vbox> ...the splitter can be dragged down to the 200px minheight, where it will stop or collapse. For: <vbox/> <splitter/> <vbox height="500" style="min-height: 50"> <vbox height="100"/> </vbox> ...the splitter can be dragged down below the 100px intrinsic height of the lower box, causing the child box to overflow, until reaching the min-height, at which point it will stop or collapse. That should also work with a minheight attribute specifying a value less than the intrinsic height. (However, because of bug 513597, only specifying both minheight and minwidth attributes, or specifying min-height or min-width in CSS, actually works to allow overflow.) ...
tabpanels - Archive of obsolete content
In most cases you would use a vbox, but they can be any element, although some people like to use tabpanel elements. By clicking the first tab, the first panel will be displayed. ...
...In most cases you would use a vbox, but they can be any element, although some people like to use tabpanel elements. By clicking the first tab, the first panel will be displayed. ...
... assigning -1 to this property, all items will be deselected. Returns -1 if no items are selected selectedPanel Type: element Holds a reference to the currently selected panel within a <tabbox> element. Assigning a value to this property will modify the selected panel. A select event will be sent when the selected panel is changed. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
ppears in the tooltip when the user moves the mouse over the new button in the tab row. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. disabled Type: boolean Gets and sets the value of the disabled attribute. itemCount Type: integer Read only property holding the number of child items. selectedIndex Type: integer Returns the index of the currently selected item. You may select an item by assigning its index to this property. By assigning -1 to this property, all items will be deselected. Returns -1 if no items are selected selectedItem Type: element Holds the currently selected item. If no item is currently selected, this ...
...bs. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData advanceSelectedTa...
... getItemAtIndex( index ) Return type: element Returns the element that is at the specified index. insertItemAt( index, label, value ) Return type: element This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned. removeItemAt( index ) Return type: element Removes the child item in the element at the specified index. The method returns the removed item. Related Elements tabbox, tab, tabpanels, tabpanel. Interfaces nsIAccessibleProvider, nsIDOMXULSelectControlElement ...
toolbarbutton - Archive of obsolete content
isplayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none: menupopup > menuitem, menupopup > menu { max-width: none; } dir Type: one of the values below The direction in which the child elements of the element are placed. normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the elements are placed left to right or top to bottom in the order they appear in the XUL code. reverse For scales, the scale's values are ordered from right to left (for horizontal scales) or f...
...s event handler is called when the command is activated. This occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. open Type: boolean For the menu type buttons, the open attribute is set to true when the menu is open. The open attribute is not present if the menu is closed. orient Type: one of the values below Used to specify whether the children of the element are oriented horizontally or vertically. The default value depends on the element. You can also use the -moz-box-orient style property. horizontal Child elements of the element are placed next to each other in a row in the order that they appear in the XUL source. vertical Child elements of the element are placed under each other in a column in the order that they appe...
...: boolean Gets and sets the value of the open attribute. orient Type: string Gets and sets the value of the orient attribute. tabIndex Type: integer Gets and sets the value of the tabindex attribute. type Type: string Gets and sets the value of the type attribute. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Element...
treerow - Archive of obsolete content
If child rows are necessary, they should be placed in a treechildren element inside the parent treeitem. More information is available in the XUL tutorial. Attributes properties Examples (example needed) Attributes properties Type: space-separated list of property names Sets the properties of the element, which can be used to style the element. For more information, see Styling a Tree. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
... ...
window - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData See also: DOM windo...
...If this code is placed between window tags it messes up all other controls on the window. If it is placed between box tags, window controls are rendered fine, but still there is this error message. The problem can be solved as follows: <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png" style="display:none"/> or <h...
...If this code is placed between window tags it messes up all other controls on the window. If it is placed between box tags, window controls are rendered fine, but still there is this error message. The problem can be solved as follows: <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png" style="display:none"/> or <html:head> <html:link ...
wizardpage - Archive of obsolete content
s can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Properties next Type: string wizardpage id Set to the pageid of the next page after this one. When set, the page with this pageID is displayed when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: string wizardpag...
...reate wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: string wizardpage id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipT...
...ssName, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related wi...
Using the W3C DOM - Archive of obsolete content
It then tests for support for textContent, then innerText and uses which ever is supported. If neither is supported, it assumes support for basic DOM 1 methods and uses those. It should be clear that tran...
...It then tests for support for textContent, then innerText and uses which ever is supported. If neither is supported, it assumes support for basic DOM 1 methods and uses those. It should be clear that translating scripts to modify ...
...It then tests for support for textContent, then innerText and uses which ever is supported. If neither is supported, it assumes support for basic DOM 1 methods and uses those. It should be clear that translating scripts to modify document content i...
...It then tests for support for textContent, then innerText and uses which ever is supported. If neither is supported, it assumes support for basic DOM 1 methods and uses those. It should be clear that translating scripts to modify document content is not a trivial undertaking...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
application/xml or matches text/*+xml or application/*+xml" before encoding (then UTF-8) var accept = xinclude.getAttribute('accept'); // header "Accept: "+x var acceptLanguage = xinclude.getAttribute('accept-language'); // "Accept-Language: "+x var xiFallback = xinclude.getElementsByTagNameNS('http://www.w3.org/2001/XInclude', 'fallback')[0]; // Only one such child is allowed if (href === '' || href === null) { // Points to same document if empty (null is equivalent to empty string) href = null; // Set for uniformity in testing below if (parse === 'xml' && xpointer === null) { alert('There must be an XPointer attribute present if "href" is empty an parse is "xml"'); return f...
...rray so can be treated the same way as the above } // PREPEND ANY NODE(S) (AS XML) THEN REMOVE XINCLUDE for (j=0; j < responseNodes.length ; j++) { xincludeParent.insertBefore(responseNodes[j], xinclude); } xincludeParent.removeChild(xinclude); } else if (responseType === 'responseText') { if (encName) { var encodingType = response.match(pattern); if (encodingType) { encodingType = encodingType[2]; } ...
...he'); request2.send(null); response = request2[responseType]; // Update the response for processing } // REPLACE XINCLUDE WITH THE RESPONSE AS TEXT var textNode = docu.createTextNode(response); xincludeParent.replaceChild(textNode, xinclude); } // replace xinclude in doc with response now (as plain text or XML) } } } catch (e) { // Use xi:fallback if XInclude retrieval above failed var xiFallbackChildren = xiFallback.childNodes; // PREPEND ANY NODE(S) THEN REMOVE XINCLUDE ...
... } // replace xinclude in doc with response now (as plain text or XML) } } } catch (e) { // Use xi:fallback if XInclude retrieval above failed var xiFallbackChildren = xiFallback.childNodes; // PREPEND ANY NODE(S) THEN REMOVE XINCLUDE for (j=0; j < xiFallbackChildren.length ; j++) { xincludeParent.insertBefore(xiFallbackChildren[j], xinclude); } xincludeParent.removeChild(xinclude); } } } return docu; } ...
Introduction to CSS layout - Learn web development
ies. The two values most important for our purposes when discussing layout are display: flex and display: grid. Flexbox Flexbox is the short name for the Flexible Box Layout Module, designed to make it easy for us to lay things out in one dimension -- either as a row or as a column. To use flexbox, you apply display: flex to the parent element of the elements you want to lay out; all its direct children then become flex items. We can see this in a simple example. The HTML markup below gives us a containing element, with a class of wrapper, inside which are three <div> elements. By default these would display as block elements, below one another, in our English language document. However, if we add display: flex to the parent, the three items now arrange themselves into columns. This is due ...
...iv class="box3">Three</div> </div> In addition to the above properties that can be applied to the flex container, there are properties that can be applied to the flex items. These properties, among other things, can change the way that the items flex, enabling them to expand and contract to fit into the available space. As a simple example of this, we can add the flex property to all of our child items, with a value of 1. This will cause all of the items to grow and fill the container, rather than leaving space at the end. If there is more space then the items will become wider; if there is less space they will become narrower. In addition, if you add another element to the markup the items will all become smaller to make space for it -- they will adjust size to take up the same amount of...
... is possible in Flexbox, to find out more, see our Flexbox article. Grid Layout While flexbox is designed for one-dimensional layout, Grid Layout is designed for two dimensions -- lining things up in rows and columns. Once again, you can switch on Grid Layout with a specific value of display -- display: grid. The below example uses similar markup to the flex example, with a container and some child elements. In addition to using display: grid, we are also defining some row and column tracks on the parent using the grid-template-rows and grid-template-columns properties respectively. We've defined three columns each of 1fr and two rows of 100px. I don't need to put any rules on the child elements; they are automatically placed into the cells our grid has created. Grid example 1 * {bo...
...">One</div> <div class="box2">Two</div> <div class="box3">Three</div> <div class="box4">Four</div> <div class="box5">Five</div> <div class="box6">Six</div> </div> Once you have a grid, you can explicitly place your items on it, rather than relying on the auto-placement behavior seen above. In the second example below we have defined the same grid, but this time with three child items. We've set the start and end line of each item using the grid-column and grid-row properties. This causes the items to span multiple tracks. Grid example 2 * {box-sizing: border-box;} .wrapper > div { border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } .wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; ...
Introducing asynchronous JavaScript - Learn web development
chronous -- you run some code, and the result is returned as soon as the browser can do so. Let's look at a simple example (see it live here, and see the source): const btn = document.querySelector('button'); btn.addEventListener('click', () => { alert('You clicked me!'); let pElem = document.createElement('p'); pElem.textContent = 'This is a newly-added paragraph.'; document.body.appendChild(pElem); }); In this block, the lines are executed one after the other: We grab a reference to a <button> element that is already available in the DOM. We add a click event listener to it so that when the button is clicked: An alert() message appears. Once the alert is dismissed, we create a <p> element. We then give it some text content. Finally, we append the paragraph to th...
... now, but you'll still see them in use in a number of older-but-still-commonly-used APIs. An example of an async callback is the second parameter of the addEventListener() method (as we saw in action above): btn.addEventListener('click', () => { alert('You clicked me!'); let pElem = document.createElement('p'); pElem.textContent = 'This is a newly-added paragraph.'; document.body.appendChild(pElem); }); The first parameter is the type of event to be listened for, and the second parameter is a callback function that is invoked when the event is fired. When we pass a callback function as an argument to another function, we are only passing the function's reference as an argument, i.e, the callback function is not executed immediately. It is "called back" (hence the name) asynchronous...
...However, we then create a loadAsset() function that takes a callback as a parameter, along with a URL to fetch and a content type. It uses XMLHttpRequest ...
... number of console.log() statements to illustrate an order that you might think the code would execute in. console.log ('Starting'); let image; fetch('coffee.jpg').then((response) => { console.log('It worked :)') return response.blob(); }).then((myBlob) => { let objectURL = URL.createObjectURL(myBlob); image = document.createElement('img'); image.src = objectURL; document.body.appendChild(image); }).catch((error) => { console.log('There has been a problem with your fetch operation: ' + error.message); }); console.log ('All done!'); The browser will begin executing the code, see the first console.log() statement (Starting) and execute it, and then create the image variable. It will then move to the next line and begin executing the fetch() block but, because fetch() executes a...
Arrays - Learn web development
lBox.textContent = ''; // number 1 'Underpants:6.99' 'Socks:5.99' 'T-shirt:14.99' 'Trousers:31.99' 'Shoes:23.99'; for (let i = 0; i <= 0; i++) { // number 2 // number 3 // number 4 // number 5 let itemText = 0; const listItem = document.createElement('li'); listItem.textContent = itemText; list.appendChild(listItem); } totalBox.textContent = 'Total: $' + total.toFixed(2); </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="Reset"> <input id="solution" type="button" value="Show solution"> </div> const textarea = document.getElementById('code'); const reset = document.getElementById('reset'); const solution = document.getElementById('solution'); let code = textar...
...\'Socks:5.99\',\n \'T-shirt:14.99\',\n \'Trousers:31.99\',\n \'Shoes:23.99\'];\n\nfor(let i = 0; i < products.length; i++) {\n let subArray = products[i].split(\':\');\n let name = subArray[0];\n let price = Number(subArray[1]);\n total += price;\n let itemText = name + \' -- $\' + price;\n\n let listItem = document.createElement(\'li\');\n listItem.textContent = itemText;\n list.appendChild(listItem);\n}\n\ntotalBox.textContent = \'Total: $\' + total.toFixed(2);'; let solutionEntry = jsSolution; textarea.addEventListener('input', updateCode); window.addEventListener('load', updateCode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCare...
...at we don't display duplicate entries // the display is regenerated every time a search term is entered. ...
...ment.querySelector(\'.output button\');\n\nlist.innerHTML = \'\';\n\nlet myHistory= [];\n\nsearchBtn.onclick = function() {\n if(searchInput.value !== \'\') {\n myHistory.unshift(searchInput.value);\n\n list.innerHTML = \'\';\n\n for(let i = 0; i < myHistory.length; i++) {\n itemText = myHistory[i];\n const listItem = document.createElement(\'li\');\n listItem.textContent = itemText;\n list.appendChild(listItem);\n }\n\n if(myHistory.length >= 5) {\n myHistory.pop();\n }\n\n searchInput.value = \'\';\n searchInput.focus();\n }\n}'; let solutionEntry = jsSolution; textarea.addEventListener('input', updateCode); window.addEventListener('load', updateCode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.
What is JavaScript? - Learn web development
Note: If your example doesn't seem to work, go through the steps again an...
... it script.js -- make sure it has that .js filename extension, as that's how it is recognized as JavaScript. Replace your current <script> element with the following: <script src="script.js" defer></script> Inside script.js, add the following script: function createParagraph() { let para = document.createElement('p'); para.textContent = 'You clicked the button!'; document.body.appendChild(para); } const buttons = document.querySelectorAll('button'); for(let i = 0; i < buttons.length ; i++) { buttons[i].addEventListener('click', createParagraph); } Save and refresh your browser, and you should see the same thing! It works just the same, but now we've got our JavaScript in an external file. This is generally a good thing in terms of organizing your code and making it reusable...
...You can see this version on GitHub as apply-javascript-external.html and script.js (see it live too). Inline JavaScript handlers Note that sometimes you'll come across bits of actual JavaScript code living inside HTML. It might look something like this: function createParagraph() { let para = document.createElement('p'); para.textContent = 'You clicked the button!'; document.body.appendChild(para); } <button onclick="createParagraph()">Click me!</button> You can try this version of our demo below. This demo has exactly the same functionality as in the previous two sections, except that the <button> element includes an inline onclick handler to make the function run when the button is pressed. Please don't do this, however. It is bad practice to pollute your HTML with JavaScrip...
...mment is written between the strings /* and */, e.g. /* I am also a comment */ So for example, we could annotate our last demo's JavaScript with comments like so: // Function: creates a new paragraph and appends it to the bottom of the HTML body. function createParagraph() { let para = document.createElement('p'); para.textContent = 'You clicked the button!'; document.body.appendChild(para); } /* 1. Get references to all the buttons on the page in an array format. 2. Loop through all the buttons and add a click event listener to each one. When any button is pressed, the createParagraph() function will be run. */ const buttons = document.querySelectorAll('button'); for (let i = 0; i < buttons.length ; i++) { buttons[i].addEventListener('click', createParagraph); } ...
Implementing feature detection - Learn web development
on whether a CSS feature is supported. For example, we could rewrite our previous example to use @supports -- see supports-feature-detect.html and supports-styling.css. If you look at the latter, you'll see a couple of @supports blocks, for example: @supports (flex-flow: row) and (flex: 1) { main { display: flex; } main div { padding-right: 4%; flex: 1; } main div:last-child { padding-right: 0; } } This at-rule block applies the CSS rule within only if the current browser supports both the flex-flow: row and flex: 1 declarations. For each condition to work, you need to include a complete declaration (not just a property name) and NOT include the semi-colon on the end. @supports also has OR and NOT logic available -- the other block applies the float layout i...
...ist of what all the class names mean -- see Features detected by Modernizr. Moving on, let's update our CSS to use Modernizr rather than @supports. ...
...So here we're applying the top set of rules only to browsers that do support flexbox, and the bottom set of rules only to browsers that don't (no-fle...
...If it is, we run some code that gets your device's current location, and plots it on a Google Map. Summary This article covered feature detection in a reasonable amount of detail, going through the main concepts and showing you how to both implement you...
Performance
cs. Performance best practices Declaring stateless functions once per process BAD: // addon.js Services.mm.loadFrameScript("framescript.js", true) // framescript.js const precomputedConstants = // ... function helper(window, action) { // ... do some work on the window } function doSomething(message) { result = helper(content, message.data) sendAsyncMessage("my-addon:response-from-child", {something: result}) } addMessageListener("my-addon:request-from-parent", doSomething) Why is this bad? Because declared functions are also objects. And since frame scripts get evaluated for each tab this means new function objects get instantiated, new constants get computed, block scopes must be set up etc. While it may seem fairly innocencous in this toy example, real scripts often hav...
...urce://my-addon/processModule.jsm", {}).addFrame(this) // processModule.jsm const EXPORTED_SYMBOLS = ['addFrame']; const precomputedConstants = // ... function helper(window, action) { // ... do some work on the window } function doSomething(message) { frameGlobal = message.target result = helper(frameGlobal.content, message.data) frameGlobal.sendAsyncMessage("my-addon:response-from-child", {something: result}) } function addFrame(frameGlobal) { frameGlobal.addMessageListener("my-addon:request-from-parent", doSomething) } Javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks. But care must be taken to not leak references to the frame script global when it is passed into a JSM. A...
...Since the code calls to the parent process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests. BETTER: Instead of only keeping the state in the parent an addon can employ a master-slave architecture where the parent has the authoritative state and replicates it to the ...
... process to either allow or deny the request. Since the code calls to the parent process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests. BETTER: Instead of only keeping the state in the parent an addon can employ a master-slave architecture where the parent has the authoritative state and replicates it to the child processes in advance so they can act based on their local copy. See the previous chapter on how to efficiently replicate addon state to each process. Clean up on addon unload BAD: All the previous examples, *even the "better" ones* If your addon is restartless or uses the SDK then updates or the user turning it off and on will load to unload/reload events. Not handling those properly c...
Performance best practices for Firefox front-end engineers
light Saving Time), so let that information guide your timing when you ask questions in the gfx room . Adding nodes using DocumentFragments Sometimes you need to add several DOM nodes as part of an existing DOM tree. For example, when using XUL <xul:menupopup>s, you often have script which dynamically inserts <xul:menuitem>s. Inserting items into the DOM has a cost. If you're adding a number of children to a DOM node in a loop, it's often more efficient to batch them into a single insertion by creating a DocumentFragment, adding the new nodes to that, then inserting the DocumentFragment as a child of the desired node. A DocumentFragment is maintained in memory outside the DOM itself, so changes don't cause reflow. The API is straightforward: Create the DocumentFragment by calling Document...
...more efficient to batch them into a single insertion by creating a DocumentFragment, adding the new nodes to that, then inserting the DocumentFragment as a child of the desired node. A DocumentFragment is maintained in memory outside the DOM itself, so changes don't cause reflow. The API is straightforward: Create the DocumentFragment by calling Document.createDocumentFragment(). Create each child element (by calling Document.createElement() for example), and add each one to the fragment by calling DocumentFragment.appendChild(). Once the fragment is populated, append the fragment to the DOM by calling appendChild() on the parent element for the new elements. This example has been cribbed from davidwalsh's blog post: // Create the fragment var frag = document.createDocumentFragment();...
... The Gecko profiler add-on is your friend The Gecko profiler is your best friend when diagnosing performance problems and looking for bottlenecks. ...
...or the new elements. This example has been cribbed from davidwalsh's blog post: // Create the fragment var frag = document.createDocumentFragment(); // Create numerous list items, add to fragment for(var x = 0; x < 10; x++) { var li = document.createElement("li"); li.innerHTML = "List item " + x; frag.appendChild(li); } // Mass-add the fragment nodes to the list listNode.appendChild(frag); The above is strictly cheaper than individually adding each node to the DOM. The Gecko profiler add-on is your friend The Gecko profiler is your best friend when diagnosing performance problems and looking for bottlenecks. There's plenty of excellent documentation on MDN about the Gecko profiler: Basic instructions for gathering and sharing a performance profile Advanced profile an...
IME handling guide
dler and focused editor. Unfortunately, it's not allowed to use syncronous communication from chrome process to a remote process. This means that chrome process (and also native IME and our native IME handler) cannot query the focused editor contents directly. For fixing this issue, we have ContentCache classes around process boundary. mozilla::ContentCache This is a base class of ContentCacheInChild and ContentCacheInParent and IPC-aware. This has common members of them including all cache data: mText Whole text in focused editor. This may be too big but IME may request all text in the editor. If we can separate editor contents per paragraph, moving selection between paragraphs generates pseudo focus move, we can reduce this size and runtime cost of ContentEventHandler. However, we've n...
...ction isn't collappsed. mCaret::mRect Caret rect at mCaret::mOffset. If caret isn't actually exists, it's computed with a character rect at the offset. mTextRectArray::mStart If there is composition, mStart is same as mCompositionStart. Otherwise, UINT32_MAX. mTextRectArray::mRects Each character rects of composition string. mEditorRect The rect of editor element. mozilla::ContentCacheInChild This exists only in remote processes. This is created as a member of PuppetWidget. When PuppetWidget receives notifications to IME from IMEContentObserver in the remote process, it makes this class modify its cached content. Then, this class do that with WidgetQueryContentEvents. Finally, PuppetWidget sends the notification and ContentCacheInParent instance as ContentCache to its parent process.
...te management". When IMEStateManager::StopIMEStateManagement() is called in the remote process by this, the IMEStateManager forgets all focus information (i.e., that indicates nobody has focus). When IMEStateManager in parent process is notified of pseudo focus move from or to menubar while a remote process has focus, it notifies the remote process of "Menu keyboard listener installed". Then, TabChild calls IMEStateManager::OnInstalledMenuKeyboardListener() in the remote process. Style of each clause The style of each IME selection is managed by LookAndFeel class per platform. Therefore, it can be overridden by prefs. Background color, foreground color (text color) and underline color can be specified with following prefs. The values must be string of "#rrggbb" format. ui.IMERawInputBack...
...utHandlerBase is the most base class. mozilla::widget::PluginTextInputHandler inherits TextInputHandlerBase and handles key events and IME events on focused plugin. mozilla::widget::IMEInputHandler inherits TextInputHandlerBase and handles IME related events. mozilla::widget::TextInputHandler inherits TextInputHandlerBase and implements NSTextInput protocol of Cocoa. The instance is created per nsChildView instance. GTK mozilla::widget::IMContextWrapper handles IME. The instance is created per top level window. Android nsWindow::GeckoViewSupport handles native IME events and just dispatches Widget*Event. ...
Investigating leaks using DMD heap scan mode
uring shutdown. Creating this log during shutdown is nice because there are less things unrelated to the leak in the log, and various cycle collector optimizations are disabled. A garbage collector log will also be created, which you may not need. MOZ_DISABLE_CONTENT_SANDBOX=t: This disables the content process sandbox, which is needed because the DMD and CC log files are created directly by the child processes. MOZ_CC_LOG_DIRECTORY=$logdir: This selects the location for cycle collector logs to be saved. MOZ_CC_LOG_PROCESS=content MOZ_CC_LOG_THREAD=main: These options specify that we only want CC logs for the main thread of content processes, to make shutdown less slow. If your leak is happening in a different process or thread, change the options, which are listed in xpcom/base/nsCycleColle...
...EventListenerManager] --[mListeners event=onload listenerType=3 [i]]--> 0x7f0882ff8f80 [CallbackObject] --[mIncumbentGlobal]--> 0x7f0897082c00 [nsGlobalWindowInner # 2147483662 inner https://www.example.com] Root 0x7f0882fe3230 is a ref counted object with 1 unknown edge(s). known edges: 0x7f08975a24c0 [FragmentOrElement (xhtml) head https://www.example.com] --[mAttrsAndChildren[i]]--> 0x7f0882fe3230 0x7f08967e7b20 [JS Object (HTMLScriptElement)] --[UnwrapDOMObject(obj)]--> 0x7f0882fe3230 The first two lines mean that the script element 0x7f0882fe3230 contains a strong reference to the EventListenerManager 0x7f0899b4e550. "[via hash] mListenerManager" is a description of that strong reference. Together, these lines show a chain of strong references from an obj...
...splay generic frames related to the allocator. Caveat: I think block_analyzer.py does not attempt to clamp the address you pass into it, so if it is an offset from the start of the block, it won't find it. block_analyzer.py will return a series of entries that look like this (with the [...] indicating where I have removed things): 0x7f089306b000 size = 4096 bytes at byte offset 2168 nsAttrAndChildArray::GrowBy[...] nsAttrAndChildArray::InsertChildAt[...] [...] 0x7f089306b000 is the address of the block that contains $leakaddr. 144 bytes is the size of that block. That can be useful for confirming your guess about what class the block actually is. The byte offset tells you were in the block the pointer is. This is mostly useful for larger objects, and you can potentially combine this w...
...gs in it as there are unknown references to the leaking object, and then you have your leaker. To place an entry into one of the categories, you must look at the code locations given in the stack trace, and see if you can tell what the object is based on that, then compare that to what find_roots.py told you. For instance, one of the strong references in the CC log is from a head element to its child via mAttrsAndChildren, and that sounds a lot like this, so we can mark it as being a strong known reference. This is an iterative process, where you first go through and mark off the things that are easily categorizable, and repeat until you have a small list of things to analyze. Example analysis of block_analyzer.py results In one debugging session where I was investigating the leak from bug...
Anonymous Shared Memory
This chapter describes the NSPR API for anonymous shared memory. Anonymous Memory Protocol Anonymous Shared Memory Functions Anonymous Memory Protocol NSPR provides an anonymous shared memory based on NSPR's PRFileMap type. The anonymous file-mapped shared memory provides an inheritable shared memory, as in: the child process inherits the shared memory. Compare the file-mapped anonymous shared memory to to a named shared memory described in prshm.h. The intent is to provide a shared memory that is accessbile only by parent and child processes. ... It's a security thing. Depending on the underlying platform, the file-mapped shared memory may be backed by a file. ... surprise! ... On some platforms, no real file backs the shared memory. On platforms where the shared memory is backed by a...
...f the file, hopefully a very short time. This restricts processes that do not inherit the shared memory from opening the file and reading or writing its contents. Further, when all processes using an anonymous shared memory terminate, the backing file is deleted. ... If you are not paranoid, you're not paying attention. The file-mapped shared memory requires a protocol for the parent process and child process to share the memory. NSPR provides two protocols. Use one or the other; don't mix and match. In the first protocol, the job of passing the inheritable shared memory is done via helper-functions with PR_CreateProcess. In the second protocol, the parent process is responsible for creating the child process; the parent and child are mutually responsible for passing a FileMap string. NSPR pr...
...In the examples, the server creates the file-mapped shared memory, the client attaches to it. First protocol Server: fm = PR_OpenAnonFileMap(dirName, size, FilemapProt); addr = PR_MemMap(fm); attr = PR_NewProcessAttr(); PR_ProcessAttrSetInheritableFileMap( attr, fm, shmname ); PR_CreateProcess(Client); PR_DestroyProcessAttr(attr); ... ...
...dr ); PR_CloseFileMap(fm); Client: ... started by server via PR_CreateProcess() fm = PR_GetInheritedFileMap( shmname ); addr = PR_MemMap(fm); ... yadda ... PR_MemUnmap(addr); PR_CloseFileMap(fm); Second protocol Server: fm = PR_OpenAnonFileMap(dirName, size, FilemapProt); fmstring = PR_ExportFileMapAsString( fm ); addr = PR_MemMap(fm); ... application specific technique to pass fmstring to child ... yadda ... Server uses his own magic to create child PR_MemUnmap( addr ); PR_CloseFileMap(fm); Client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = PR_ImportFileMapFromString( fmstring ) addr = PR_MemMap(fm); ... yadda ... PR_MemUnmap(addr); PR_CloseFileMap(fm); Anonymous Shared Memory Functions PR_OpenAnonFileMap PR_Proc...
inIDOMUtils
.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 a...
... Methods getBindingURLs() Returns an array of nsIURI objects representing the current XML binding for the specified element. nsIArray getBindingURLs( in nsIDOMElement aElement ); Parameters aElement A DOM Element to retrieve the bindings of. Return value An array of nsIURI objects representing the current XBL binding (if any) for the element and its hierarchy of base bindings. getChildrenForNode() Returns a list of DOM nodes that are children of the specified node. nsIDOMNodeList getChildrenForNode( in nsIDOMNode aNode, in boolean aShowingAnonymousContent ); Parameters aNode A DOM Node for which to retrieve the style nodes. aShowingAnonymousContent Whether you are interested in the XBL flattened tree. Return value A DOM NodeList of the child nodes. If you have ...
... getContentState() A bit mask of the supported content state flags, which are listed in Content state flags. ...
... getContentState() A bit mask of the supported content state flags, which are listed in Content state flags. unsigned long long getContentState( in nsIDOMElement aElement ); Parameters aElement A DOM Element to retrieve the content states of. ...
Parent
ible Page Summary Returns parent node in accessible tree. ...
...s parent node in accessible tree. ...
...essible tree. ...
...e nsIAccessible parent; Exceptions thrown NS_ERROR_FAILURE Indicates that the accessible is unattached from the accessible tree. Remarks Every accessible in the tree has accessible parent excepting application accessible (top level accessible). See Also nsIAccessible.nextSibling nsIAccessible.previousSibling nsIAccessible.firstChild nsIAccessible.lastChild nsIAccessible.children nsIAccessible.childCount nsIAccessible.getChildAt() ...
nsIHTMLEditor
t Return value checkSelectionStateForAnonymousButtons() Checks if the anonymous nodes created by the HTML editor have to be refreshed or hidden depending on a possible new state of the selection. void checkSelectionStateForAnonymousButtons( in nsISelection aSelection ); Parameters aSelection A selection. createAnonymousElement() Returns an anonymous nsDOMElement of type aTag, child of aParentNode. If aIsCreatedHidden is true, the class "hidden" is added to the created element. If aAnonClass is not the empty string, it becomes the value of the attribute "_moz_anonclass" nsIDOMElement createAnonymousElement( in AString aTag, in nsIDOMNode aParentNode, in AString aAnonClass, in boolean aIsCreatedHidden ); Parameters aTag A string representing the desired type of...
... aMixed ); Parameters aMixed true if there is more than one format. Return value Name of block tag. "" is returned for none. getSelectedElement() Return an element only if it is the only node selected, such as an image, horizontal rule, and so on. The exception is a link, which is more like a text attribute: The Anchor tag is returned if the selection is within the textnode(s) that are children of the "A" node. This could be a collapsed selection, that is, a caret within the link text. nsIDOMElement getSelectedElement( in AString aTagName ); Parameters aTagName The HTML tagname or and empty string to get any element (but only if it is the only element selected). Special input values for Links: Use "href" to get a link node (an "A" tag with the "href" attribute set). Return...
...aseFontSize() Increase font size for text in selection by 1 HTML unit All existing text is scanned for existing <FONT SIZE> attributes so they will be incremented instead of inserting new <FONT> tag. void increaseFontSize(); Parameters None. indent() Document me! void indent( in AString aIndent ); Parameters aIndent insertElementAtSelection() Insert an element, which may have child nodes, at the selection Used primarily to insert a new element for various insert element dialogs, but it enforces the HTML 4.0 DTD "CanContain" rules, so it should be useful for other elements. void insertElementAtSelection( in nsIDOMElement aElement, in boolean aDeleteSelection ); Parameters aElement The element to insert. aDeleteSelection Delete the selection before inserting If a...
...o be removed from the selection. removeInsertionListener() Remove listener for insertion override. void removeInsertionListener( in nsIContentFilter inFilter ); Parameters inFilter Function which callers do not want called during insertion. removeList() Document me! void removeList( in AString aListType ); Parameters aListType replaceHeadContentsWithHTML() Replace all children of <HEAD> with string of HTML source. void replaceHeadContentsWithHTML( in AString aSourceToInsert ); Parameters aSourceToInsert selectElement() Set the selection at the suppled element. void selectElement( in nsIDOMElement aElement ); Parameters aElement An element in the document. setBackgroundColor() Set the value of the "bgcolor" attribute on the document's <body>...
nsITransactionList
editor/txmgr/idl/nsITransactionList.idlScriptable Please add a summary to this article. Inherits from: nsISupports Last changed in Gecko 1.7 Method overview nsITransactionList getChildListForItem(in long aIndex); nsITransaction getItem(in long aIndex); long getNumChildrenForItem(in long aIndex); boolean itemIsBatch(in long aIndex); Attributes Attribute Type Description numItems long The number of transactions contained in this list. Read only. Methods getChildListForItem() Returns the list of children associated with the item at aIndex. ...
...ex); nsITransaction getItem(in long aIndex); long getNumChildrenForItem(in long aIndex); boolean itemIsBatch(in long aIndex); Attributes Attribute Type Description numItems long The number of transactions contained in this list. Read only. Methods getChildListForItem() Returns the list of children associated with the item at aIndex. Implementations may return null if there are no children, or an empty list. The list returned is AddRef'd so it is up to the caller to Release the transaction when it is done. nsITransactionList getChildListForItem( in long aIndex ); Parameters aIndex The index of the item in the list. Return value The nsITransactionList of children associated with the item at aIndex. getItem() Returns the transaction at the given index in the list. Note that a...
... with the item at aIndex. getItem() Returns the transaction at the given index in the list. Note that a null can be returned here if the item is a batch. The transaction returned is AddRef'd so it is up to the caller to Release the transaction when it is done. nsITransaction getItem( in long aIndex ); Parameters aIndex The index of the item in the list. Return value Missing Description getNumChildrenForItem() Returns the number of child (auto-aggreated) transactions the item at aIndex has. long getNumChildrenForItem( in long aIndex ); Parameters aIndex The index of the item in the list. Return value The number of child (auto-aggreated) transactions the item at aIndex has. itemIsBatch() Returns true if the item at aIndex is a batch. Note that currently there is no requirement for a Tra...
...ransactions the item at aIndex has. itemIsBatch() Returns true if the item at aIndex is a batch. Note that currently there is no requirement for a TransactionManager implementation to associate a toplevel nsITransaction with a batch so it is possible for itemIsBatch to return true and getItem() to return null. However, you can still access the transactions contained in the batch with a call to getChildListForItem(). boolean itemIsBatch( in long aIndex ); Parameters aIndex The index of the item in the list. Return value true if the item at aIndex is a batch. See also nsITransaction nsITransactionListener nsITransactionManager ...
nsITreeView
arameters row The index of the row. orientation The position around the given row. Defined in constants. dataTransfer This parameter, added in Gecko 1.9.2, provides the data that has been dropped. getCellProperties() An atomized list of properties for a given cell. Each property, x, that the view gives back will cause the CSS ::moz-tree-cell-*(x) pseudoelement to be matched on the treechildren element. See getRowProperties() for an example. AString getCellProperties( in long row, in nsITreeColumn col, in nsISupportsArray properties ); Parameters row The index of the row. col The current column. properties An array of the cell's current properties. Obsolete since Gecko 22 Return value A string of space-separated property names. getCellText() The text for a giv...
...TreeColumn col ); Parameters row The index of the row. col The column of the cell. (Note that this is not the column index.) Return value The value of the cell. getColumnProperties() Called to get properties to paint a column background. For shading the sort column, and so on. Each property, x, that the view gives back will cause the CSS ::moz-tree-column(x) to be matched on the treechildren element. See getRowProperties() for an example. void getColumnProperties( in nsITreeColumn col, in nsISupportsArray properties ); Parameters col The current column. properties An array of the column's current properties. Obsolete since Gecko 22 Return value A string of space-separated property names. getImageSrc() The image path for a given cell. For defining an icon for a ...
...ction for possible modes. long getProgressMode( in long row, in nsITreeColumn col ); Parameters row The index of the row. col The index of the column. Return value The progress mode for the cell. getRowProperties() An atomized list of properties for a given row. Each property, x, that the view gives back will cause the CSS ::moz-tree-row(x) pseudoelement to be matched on the treechildren element. void getRowProperties( in long index, in nsISupportsArray properties ); Parameters index The index of the row. properties An array of the row's current properties. Obsolete since Gecko 22 Return value A string of space-separated property names. Example Your function will not be provided with a properties array. (This is one way of detecting the version at run-time)...
...s does not determine whether a twisty is actually drawn; that's left up to isContainerEmpty. For very simple tree views, such as those without multi-level data, you might want to consider using something simpler than a tree view, such as a listbox. For tree views with multi-level data, it's advisable to distinguish between a row which is an empty container (i.e., a row with the potential to hold children but that currently has none), and a non-empty container (i.e., a row that positively does currently have children). The tree frame code that handles drag and drop, for example, uses this method to determine how to interpret the drop position. Note: nsITreeView implementations must be prepared to handle a call to toggleOpenState for any row index which returns true for a call to isContainer, e...
Drawing and Event Handling - Plugins
splay) or the application's context (NPNVxtAppContext). For MS Windows, the value is the native window on which the plug-in drawing occurs (NPNVnetscapeWindow). The value parameter contains the name of the plug-in. You can also use NPN_GetValue to help create a menu or dialog box for a windowless plug-in. Windowed Plug-ins The browser gives each windowed plug-in its own native window, often a child window of the the browser window itself, to draw into. The plug-in has complete control over drawing and event handling within that window. On Mac OS, the browser does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. Instead, the windowed plug-in draws into the graphics port associated with the browser window, at the offset that the browser...
...On Mac OS, the application uses NPP_SetWindow to dedicate a rectangular part of its graphics port to each instance. ...
...ng and user interface events for a windowed plug-in instance are handled according to the windowing system of its native platform. The Plug-in API provides a native window handle within which an instance does its drawing through the API call NPP_SetWindow. NPP_SetWindow passes the instance an NPWindow object containing the native window handle. On Windows and Unix, each instance receives its own child window within the browser window hierarchy, and imaging and event processing are relative to this window. Mac OS does not support child windows. The native window is shared between the instance and the browser. The instance must restrict its drawing to a specified area of the shared window, and it must always save the current settings, set up the drawing environment, and restore the shared drawin...
...nce parameter represents the current plug-in. The variable parameter contains the information the call is requesting, in this case NPNVnetscapeWindow (the native window in which plug-in drawing occurs). Windows The requested information, a value of type HWND, is returned from NPN_GetValue in the value parameter. In many cases, a plug-in may still have to create its own window (a transparent child window of the the browser window) to act as the owner window for pop-up menus and modal dialog boxes. You can give this transparent child window its own WindowProc process. The plug-in can use this to deal with WM_COMMAND messages sent to it as a result of tracking the pop-up menu or modal dialog box. Unix/X11 The value parameter for NPN_GetValue must point to an Xlib Window. On successful r...
CharacterData - Web APIs
="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="331" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CharacterData</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, Node, and implements the ChildNode and NonDocumentTypeChildNode interface. CharacterData.data Is a DOMString representing the textual data contained in this object. CharacterData.length Read only Returns an unsigned long representing the size of the string contained in CharacterData.data. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediately following the specified one in its parent's ...
...Node and NonDocumentTypeChildNode interface. CharacterData.data Is a DOMString representing the textual data contained in this object. CharacterData.length Read only Returns an unsigned long representing the size of the string contained in CharacterData.data. NonDocumentTypeChildNode.nextElementSibling Read only Returns the Element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. NonDocumentTypeChildNode.previousElementSibling Read only Returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. Methods Inherits methods from its parent, Node, and implements the ChildNode and NonDocumentTypeChildNode inter...
...ing. CharacterData.deleteData() Removes the specified amount of characters, starting at the specified offset, from the CharacterData.data string; when this method returns, data contains the shortened DOMString. CharacterData.insertData() Inserts the specified characters, at the specified offset, in the CharacterData.data string; when this method returns, data contains the modified DOMString. ChildNode.remove() Removes the object from its parent children list. CharacterData.replaceData() Replaces the specified amount of characters, starting at the specified offset, with the specified DOMString; when this method returns, data contains the modified DOMString. CharacterData.substringData() Returns a DOMString containing the part of CharacterData.data of the specified length and starting...
... when this method returns, data contains the modified DOMString. CharacterData.substringData() Returns a DOMString containing the part of CharacterData.data of the specified length and starting at the specified offset. Specifications Specification Status Comment DOMThe definition of 'CharacterData' in that specification. Living Standard Added implemention of the ChildNode and NonDocumentTypeChildNode interface. Document Object Model (DOM) Level 3 Core SpecificationThe definition of 'CharacterData' in that specification. Obsolete No change from Document Object Model (DOM) Level 2 Core Specification. Document Object Model (DOM) Level 2 Core SpecificationThe definition of 'CharacterData' in that specification. Obsolete No change from...
Document - Web APIs
Web › API › Document
ed by the document. Document.compatMode Read only Indicates whether the document is rendered in quirks or strict mode. Document.contentType Read only Returns the Content-Type from the MIME Header of the current document. Document.doctypeRead only Returns the Document Type Definition (DTD) of the current document. Document.documentElementRead only Returns the Element that is a direct child of the document. For HTML documents, this is normally the HTMLHtmlElement object representing the document's <html> element. Document.documentURIRead only Returns the document location as a string. Document.embedsRead only Returns a list of the embedded <embed> elements within the current document. Document.fonts Returns the FontFaceSet interface of the current document. Document.formsRe...
...eRead only Returns timeline as a special instance of DocumentTimeline that is automatically created on page load. Document.undoManager Read only ... Document.visibilityStateRead only Returns a string denoting the visibility state of the document. Possible values are visible, hidden, prerender, and unloaded. ...
...of DocumentTimeline that is automatically created on page load. Document.undoManager Read only ... Document.visibilityStateRead only Returns a string denoting the visibility state of the document. Possible values are visible, hidden, prerender, and unloaded. The Document interface is extended with the ParentNode interface: ParentNode.childElementCount Read only Returns the number of children of this ParentNode which are elements. ParentNode.children Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ParentNode.lastElement...
...ren of this ParentNode which are elements. ParentNode.children Read only Returns a live HTMLCollection containing all of the Element objects that are children of this ParentNode, omitting all of its non-element nodes. ParentNode.firstElementChild Read only Returns the first node which is both a child of this ParentNode and is also an Element, or null if there is none. ParentNode.lastElementChild Read only Returns the last node which is both a child of this ParentNode and is an Element, or null if there is none. Extensions for HTMLDocument The Document interface for HTML documents inherits from the HTMLDocument interface or, since HTML5, is extended for such documents. Document.cookie Returns a semicolon-separated list of the cookies for that document or sets a single cookie. Do...
Examples of web and XML development using the DOM - Web APIs
lang="en"> <head> <meta charset="utf-8"/> <title>Show Event properties</title> <style> table { border-collapse: collapse; } thead { font-weight: bold; } td { padding: 2px 10px 2px 10px; } .odd { background-color: #efdfef; } .even { background-color: #ffffff; } </style> <script> function showEventProperties(e) { function addCell(row, text) { var cell = row.insertCell(-1); cell.appendChild(document.createTextNode(text)); } var e = e || window.event; document.getElementById('eventType').innerHTML = e.type; var table = document.createElement('table'); var thead = table.createTHead(); var row = thead.insertRow(-1); var lableList = ['#', 'Property', 'Value']; var len = lableList.length; for (var i=0; i<len; i++) { addCell(row, lableList[i]); } var tbody = ...
... e || window.event; document.getElementById('eventType').innerHTML = e.type; var table = document.createElement('table'); var thead = table.createTHead(); var row = thead.insertRow(-1); var lableList = ['#', 'Property', 'Value']; var len = lableList.length; for (var i=0; i<len; i++) { addCell(row, lableList[i]); } var tbody = document.createElement('tbody'); table.appendChild(tbody); for (var p in e) { row = tbody.insertRow(-1); row.className = (row.rowIndex % 2)? 'odd':'even'; addCell(row, row.rowIndex); addCell(row, p); addCell(row, e[p]); } document.body.appendChild(table); } window.onload = function(event){ showEventProperties(event); } </script> </head> <body> <h1>Properties of the DOM <span id="eventType"></span> Event Object</h1>...
...tRow and tableRow.insertCell. ...
...cell, text; for (var i = 0; i < 2; i++) { cell = row.insertCell(-1); text = 'Row ' + row.rowIndex + ' Cell ' + i; cell.appendChild(document.createTextNode(text)); } </script> Notes A table's innerHTML property should never be used to modify a table, although you can use it to write an entire table or the content of a cell. If DOM Core methods document.createElement and Node.appendChild are used to create rows and cells, IE requires that they are appended to a tbody element, whereas other browsers will allow appending to a table element (the rows will be added to the last tbody element). There are a number of other convenience methods belonging to the table interface that can be used for creating and modifying tables. ...
Introduction to the DOM - Web APIs
try to avoid in this documentation), but every web browser uses some document object model to make web pages accessible via JavaScript. When you create a script-whether it's inline in a <script> element or included in the web page by means of a script loading instruction-you can immediately begin using the API for the document or window elements to manipulate the document itself or to get at the children of that document, which are the various elements in the web page. Your DOM programming may be something as simple as the following, which displays an alert message by using the alert() function from the window object, or it may use more sophisticated DOM methods to actually create new content, as in the longer example below. This following JavaScript will display an alert when the document is...
...But there are a number of different data types being passed around the API that you should be aware of. Note: Because the vast majority of code that uses the DOM revolves a...
...But there are a number of different data types being passed around the API that you should be aware of. Note: Because the vast majority of code that uses the DOM revolves around manipulating HTML documents, it's common to ...
... you use on individual elements. These elements may also have specific interfaces for dealing with the kind of data those elements hold, as in the table object example in the previous section. The following is a brief list of common APIs in web and XML page scripting using the DOM. document.getElementById(id) document.getElementsByTagName(name) document.createElement(name) parentNode.appendChild(node) element.innerHTML element.style.left element.setAttribute() element.getAttribute() element.addEventListener() window.content window.onload window.scrollTo() Testing the DOM API This document provides samples for every interface that you can use in your own web development. In some cases, the samples are complete HTML pages, with the DOM access in a <script> element, the interface...
Element.computedStyleMap() - Web APIs
In other browsers you'll just see a link. Did you realize how many default...
...In other browsers you'll just see a link. Did you realize how many default CSS properties a link had? Update the 'a' to the 'p', a...
...In other browsers you'll just see a link. Did you realize how many default CSS properties a link had? Update the 'a' to the 'p', and you'll notice a difference in the margin-top and margin-bottom default computed values. Sp...
...In other browsers you'll just see a link. ...
Using the Gamepad API - Web APIs
ng demo and look at the full source code on Github. ...
...= 'ongamepadconnected' in window; var controllers = {}; function connecthandler(e) { addgamepad(e.gamepad); } function addgamepad(gamepad) { controllers[gamepad.index] = gamepad; var d = document.createElement("div"); d.setAttribute("id", "controller" + gamepad.index); var t = document.createElement("h1"); t.appendChild(document.createTextNode("gamepad: " + gamepad.id)); d.appendChild(t); var b = document.createElement("div"); b.className = "buttons"; for (var i = 0; i < gamepad.buttons.length; i++) { var e = document.createElement("span"); e.className = "button"; //e.id = "b" + i; e.innerHTML = i; b.appendChild(e); } d.appendChild(b); var a = document.createElement("div"); a.className = "axes"; for (var i = 0; i < gamepad.axes.length; i...
... //e.id = "b" + i; e.innerHTML = i; b.appendChild(e); } d.appendChild(b); var a = document.createElement("div"); a.className = "axes"; for (var i = 0; i < gamepad.axes.length; i++) { var p = document.createElement("progress"); p.className = "axis"; //p.id = "a" + i; p.setAttribute("max", "2"); p.setAttribute("value", "1"); p.innerHTML = i; a.appendChild(p); } d.appendChild(a); // See https://github.com/luser/gamepadtest/blob/master/index.html var start = document.getElementById("start"); if (start) { start.style.display = "none"; } document.body.appendChild(d); requestAnimationFrame(updateStatus); } function disconnecthandler(e) { removegamepad(e.gamepad); } function removegamepad(gamepad) { var d = document.getEleme...
...user/gamepadtest/blob/master/index.html var start = document.getElementById("start"); if (start) { start.style.display = "none"; } document.body.appendChild(d); requestAnimationFrame(updateStatus); } function disconnecthandler(e) { removegamepad(e.gamepad); } function removegamepad(gamepad) { var d = document.getElementById("controller" + gamepad.index); document.body.removeChild(d); delete controllers[gamepad.index]; } function updateStatus() { if (!haveEvents) { scangamepads(); } var i = 0; var j; for (j in controllers) { var controller = controllers[j]; var d = document.getElementById("controller" + j); var buttons = d.getElementsByClassName("button"); for (i = 0; i < controller.buttons.length; i++) { var b = buttons[i]; ...
Ajax navigation example - Web APIs
existing.php">Unexisting page</a> ] </p> include/header.php: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="js/ajax_nav.js"></script> <link rel="stylesheet" href="css/style.css" /> js/ajax_nav.js: "use strict"; const ajaxRequest = new (function () { function closeReq () { oLoadingBox.parentNode && document.body.removeChild(oLoadingBox); bIsLoading = false; } function abortReq () { if (!bIsLoading) { return; } oReq.abort(); closeReq(); } function ajaxError () { alert("Unknown error."); } function ajaxLoad () { var vMsg, nStatus = this.status; switch (nStatus) { case 200: vMsg = JSON.parse(this.responseText)...
... function getPage (sPage) { if (bIsLoading) { return; } oReq = new XMLHttpRequest(); bIsLoading = true; oReq.onload = ajaxLoad; oReq.onerror = ajaxError; if (sPage) { oPageInfo.url = filterURL(sPage, null); } oReq.open("get", filterURL(oPageInfo.url, "json"), true); oReq.send(); oLoadingBox.parentNode || document.body.appendChild(oLoadingBox); } function requestPage (sURL) { if (history.pushState) { bUpdateURL = true; getPage(sURL); } else { /* Ajax navigation is not supported */ location.assign(sURL); } } function processLink () { if (this.className === sAjaxClass) { requestPage(this.href); return fal...
...addEventListener("load", init, false) : window.attachEvent ? attachEvent("onload", init) : (onload = init); // Public methods t...
...addEventListener("load", init, false) : window.attachEvent ? attachEvent("onload", init) : (onload = init); // Public methods this.open = requestPage; this.stop = ab...
MutationObserver.MutationObserver() - Web APIs
An array of MutationRecord objects, describing each change that occurred; and the MutationObserver which invoked the callback. See the example below for more details. Return value A new MutationObserver object, configured to call the specified callback when DOM mutations occur. Example This example simply creates a new MutationObserver configured to watch a node and all of its children for additions and removals of elements to the tree, as well as any changes to attributes on any of the elements in the tree. The callback function function callback(mutationList, observer) { mutationList.forEach( (mutation) => { switch(mutation.type) { case 'childList': /* One or more children have been added to and/or removed from the tree. (See mut...
... The attribute name is in mutation.attributeName, and its previous value is in mutation.oldValue. */ break; } }); } The callback() function is invoked when the observer sees changes matching the configuration of the observation request specified when calling observe() to begin watching the DOM. ...
...t specified when calling observe() to begin watching the DOM. The kind of change that took place (either a change to the list of children, or a change to an attribute) is detected by looking at the mutation.type property. Creating and starting the observer This code actually sets up the observation process. const targetNode = document.querySelector("#someElement"); const observerOptions = { childList: true, attributes: true, // Omit (or set to false) to observe only changes to the parent node subtree: true } const observer = new MutationObserver(callback); observer.observe(targetNode, observerOptions); The desired subtree is located by finding an element with the ID someElement. A set of options for the observer is also established in the observerOptions record. In it, we specify...
... true, // Omit (or set to false) to observe only changes to the parent node subtree: true } const observer = new MutationObserver(callback); observer.observe(targetNode, observerOptions); The desired subtree is located by finding an element with the ID someElement. A set of options for the observer is also established in the observerOptions record. In it, we specify values of true for both childList and attributes, so we get the information we want. Then the observer is instantiated, specifying the callback() function. We begin observing the DOM nodes of interest by calling observe(), specifying the target node and the options object. From this point until disconnect() is called, callback() will be called each time an element is added to or removed from the DOM tree rooted at targetNod...
NodeList.entries() - Web APIs
Web › API › NodeList › entries
The NodeList.entries() method returns an iterator allowing to go through all key/value pairs contained in this object. The values are Node objects. Syntax list.entries(); Return value Returns an iterator. ...
... method returns an iterator allowing to go through all key/value pairs contained in this object. The values are Node objects. Syntax list.entries(); Return value Returns an iterator. ...
...tor allowing to go through all key/value pairs contained in this object. The values are Node objects. Syntax list.entries(); Return value Returns an iterator. ...
... key/value pairs contained in this object. The values are Node objects. Syntax list.entries(); Return value Returns an iterator. ...
NodeList.prototype.forEach() - Web APIs
Web › API › NodeList › forEach
tValue being processed in someNodeList. listObj Optional The someNodeList that forEach() is being applied to. thisArg Optional Value to use as this when executing callback. Return value undefined. ...
...n someNodeList. listObj Optional The someNodeList that forEach() is being applied to. thisArg Optional Value to use as this when executing callback. Return value undefined. ...
...j Optional The someNodeList that forEach() is being applied to. thisArg Optional Value to use as this when executing callback. Return value undefined. ...
...that forEach() is being applied to. thisArg Optional Value to use as this when executing callback. Return value undefined. ...
NodeList.keys() - Web APIs
Web › API › NodeList › keys
The NodeList.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are unsigned integer. ...
....keys() method returns an iterator allowing to go through all keys contained in this object. The keys are unsigned integer. Syntax nodeList.keys(); Return value Returns an iterator. ...
...n iterator allowing to go through all keys contained in this object. The keys are unsigned integer. Syntax nodeList.keys(); Return value Returns an iterator. ...
...ugh all keys contained in this object. The keys are unsigned integer. ...
NodeList.values() - Web APIs
Web › API › NodeList › values
The NodeList.values() method returns an iterator allowing to go through all values contained in this object. The values are Node objects. Syntax nodeList.values(); Return value Returns an iterator. ...
...ues() method returns an iterator allowing to go through all values contained in this object. The values are Node objects. Syntax nodeList.values(); Return value Returns an iterator. ...
...iterator allowing to go through all values contained in this object. The values are Node objects. Syntax nodeList.values(); Return value Returns an iterator. ...
...h all values contained in this object. The values are Node objects. Syntax nodeList.values(); Return value Returns an iterator. ...
StylePropertyMapReadOnly - Web APIs
Working Draft ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
... Working Draft Initial definition. ...
TreeWalker - Web APIs
cument.createTreeWalker() method. Properties This interface doesn't inherit any property. TreeWalker.root Read only Returns a Node representing the root node as specified when the TreeWalker was created. TreeWalker.whatToShow Read only Returns an unsigned long being a bitmask made of constants describing the types of Node that must be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are: Constant Numerical value Description NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a TreeWalker with an Attr node as its root. In this case, it...
... NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a TreeWalker with an Attr node as its root. In this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION 8 Shows CDATASection nodes. NodeFilter.SHOW_COMMENT 128 Shows Comment nodes. NodeFilter.SHOW_DOCUMENT 256 Shows Document nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT 1024 Shows DocumentFragment nodes. ...
...ot the node is visible on the screen is irrelevant.) TreeWalker.parentNode() Moves the current Node to the first visible ancestor node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, or if it is before that the root node defined at the object construction, returns null and the current node is not changed. TreeWalker.firstChild() Moves the current Node to the first visible child of the current node, and returns the found child. It also moves the current node to this child. If no such child exists, returns null and the current node is not changed. TreeWalker.lastChild() Moves the current Node to the last visible child of the current node, and returns the found child. It also moves the current node to this child. If no...
... TreeWalker.previousSibling() Moves the current Node to its previous sibling, if any, and returns the found sibling. If there is no such node, return null and the current node is not changed. ...
HTML To MSAA - Accessibility
YSTEM_ LINK n/a value of @href attribute STATE_SYSTEM_ SELECTABLE if @name attribute is presented STATE_SYSTEM_ LINKED if @href attribute is presented or click event listener is registered STATE_SYSTEM_ TRAVERSED if link is traversed n/a "jump" if @href is valid n/a br ROLE_SYSTEM_ WHITESPACE '\n' (new line char) STATE_SYSTEM_ READONLY n/a n/a n/a button ROLE_SYSTEM_ PUSHBUTTON from child nodes n/a STATE_SYSTEM_ FOCUSABLE STATE_SYSTEM_ DEFAULT if @type attribute has value "submit" n/a "press" n/a caption BSTR role n/a n/a n/a description_for (0x100f), points to table element div BSTR role n/a n/a n/a n/a n/a n/a fieldset ROLE_SYSTEM_ GROUPING text equivalent from child legend element n/a n/a labelled_by (1003), points to legend element n/a n/a hr ROLE_SYSTE...
...by (1003), points to legend element n/a n/a hr ROLE_SYSTEM_ SEPARATOR n/a n/a n/a n/a n/a n/a img, input @type=image ROLE_SYSTEM_ GRAPHIC from @alt attribute, empty @alt attribute means name can't be calculated at all n/a STATE_SYSTEM_ ANIMATED if image has more than one frame n/a "showlongdesc" if @longdesc attribute is presented n/a if @usemap attribute is used then image accessible has children for each map item input @type=button, submit, reset ROLE_SYSTEM_ PUSHBUTTON from @value attribute, @alt attribute, default label, @src attribute, @data attribute n/a STATE_SYSTEM_ DEFAULT if @type attribute has value "submit" n/a "press" n/a input @type=text, textarea ROLE_SYSTEM_ TEXT n/a value property of input DOM element STATE_SYSTEM_ READONLY if @readonly attribute is used n/a "act...
...f DOM element returns true n/a "check"/"uncheck"/"cycle" depending on state EVENT_OBJECT_ STATECHANGE when state is changed input type="radio" ROLE_SYSTEM_ RADIOBUTTON n/a n/a STATE_SYSTEM_ MARQUEED used as state checkable STATE_SYSTEM_ CHECKED if checked property of DOM element returns true n/a "select" EVENT_OBJECT_ STATECHANGE when state is changed label ROLE_SYSTEM_ STATICTEXT from child nodes n/a n/a n/a n/a n/a legend ROLE_SYSTEM_ STATICTEXT n/a n/a n/a label_for (0x1002), points to caption element n/a n/a li and others ROLE_SYSTEM_ LISTITEM n/a n/a STATE_SYSTEM_ READONLY n/a n/a n/a contains child accessible for list bullet ol, ul and others ROLE_SYSTEM_ LIST n/a n/a STATE_SYSTEM_ READONLY n/a n/a n/a optgroup BSTR role n/a n/a n/a n/a n/a n/a option ROLE_SYS...
..._SYSTEM_ STATICTEXT n/a n/a n/a label_for (0x1002), points to caption element n/a n/a li and others ROLE_SYSTEM_ LISTITEM n/a n/a STATE_SYSTEM_ READONLY n/a n/a n/a contains child accessible for list bullet ol, ul and others ROLE_SYSTEM_ LIST n/a n/a STATE_SYSTEM_ READONLY n/a n/a n/a optgroup BSTR role n/a n/a n/a n/a n/a n/a option ROLE_SYSTEM_ LISTITEM from @label attribute, from child text nodes n/a STATE_SYSTEM_ SELECTED if option is selected n/a "select" EVENT_OBJECT_ SELECTIONWITHIN EVENT_OBJECT_ SELECTIONADD if selected EVENT_OBJECT_ SELECTIONREMOVE if unselected select @size > 1 ROLE_SYSTEM_ LIST n/a n/a STATE_SYSTEM_ MULTISELECTABLE if multiselectable n/a n/a n/a select @size = 1 ROLE_SYSTEM_ COMBOBOX n/a name of focused option STATE_SYSTEM_ EXPANDED if combob...
The stacking context - CSS: Cascading Style Sheets
es which cause them to form a stacking context. A stacking context is formed, anywhere in the document, by any element in the following scenarios: Root element of the document (<html>). Element with a position value absolute or relative and z-index value other than auto. Element with a position value fixed or sticky (sticky for all mobile browsers, but not older desktop). Element that is a child of a flex (flexbox) container, with z-index value other than auto. Element that is a child of a grid (grid) container, with z-index value other than auto. Element with a opacity value less than 1 (See the specification for opacity). Element with a mix-blend-mode value other than normal. Element with any of the following properties with value other than none: transform filter persp...
...lement with a isolation value isolate. Element with a -webkit-overflow-scrolling value touch. Element with a will-change value specifying any property that would create a stacking context on non-initial value (see this post). Element with a contain value of layout, or paint, or a composite value that includes either of them (i.e. contain: strict, contain: content). Within a stacking context, child elements are stacked according to the same rules previously explained. Importantly, the z-index values of its child stacking contexts only have meaning in this parent. Stacking contexts are treated atomically as a single unit in the parent stacking context. In summary: Stacking contexts can be contained in other stacking contexts, and together create a hierarchy of stacking contexts. Each st...
...similated by the parent stacking context. The example In this example, every positioned element creates its own stacking context, because of their positioning and z-index values. The hierarchy of stacking contexts is organized as follows: Root DIV #1 DIV #2 DIV #3 DIV #4 DIV #5 DIV #6 It is important to note that DIV #4, DIV #5 and DIV #6 are children of DIV #3, so stacking of those elements is completely resolved within DIV#3. Once stacking and rendering within DIV #3 is completed, the whole DIV #3 element is passed for stacking in the root element with respect to its sibling's DIV. Notes: DIV #4 is rendered under DIV #1 because DIV #1's z-index (5) is valid within the stacking context of the root element, while DIV #4's z-index (6) i...
...ex 2) is rendered under DIV#5 (z-index 1) because DIV #5 belongs to DIV #3, which has an higher z-index value. DIV #3's z-index is 4, but this value is independent from z-index of DIV #4, DIV #5 and DIV #6, because it belongs to a different stacking context. An easy way to figure out the rendering order of stacked elements along the Z axis is to think of it as a "version number" of sorts, where child elements are minor version numbers underneath their parent's major version numbers. This way we can easily see how an element with a z-index of 1 (DIV #5) is stacked above an element with a z-index of 2 (DIV #2), and how an element with a z-index of 6 (DIV #4) is stacked below an element with a z-index of 5 (DIV #1). In our example (sorted according to the final rendering order): Root ...
box-flex-group - CSS: Cascading Style Sheets
/* <integer> values */ box-flex-group: 1; box-flex-group: 5; /* Global values */ box-flex-group: inherit; box-flex-group: initial; box-flex-group: unset; For flexible elements assigned to flex groups, the first flex group is 1 and higher values specify subsequent flex groups. The initial value is 1. ...
... group is 1 and higher values specify subsequent flex groups. The initial value is 1. When dividing up the box's extra space, the browser first considers all elements within the first flex group. Each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibility of other elements within the same flex group. If the space of all flexible children within the group has been increased to the maximum, the process repeats for the children within the next flex group, using any space left over from the previous flex group. Once there are no more flex groups, and there is still space remaining, the extra space is divided within the containing box according to the box-pack property. If the box would overflow after the preferred space of the ch...
... then space is removed from flexible elements in a manner similar to that used when adding extra space. Each flex group is examined in turn and space is removed according to the ratio of the flexibility of each element. Elements do not shrink below their minimum widths. Syntax The box-flex-group property is specified as any positive <integer>. ...
...t. Elements do not shrink below their minimum widths. Syntax The box-flex-group property is specified as any positive <integer>. Formal definition Initial value1Applies toin-flow children of box elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <integer> Examples Simple usage example In the original Flexbox spec, box-flex-group could be used to assign flex children to different groups to distribute flexible space between: article:nth-child(1) { -webkit-box-flex-group: 1; } article:nth-child(2) { -webkit-box-flex-group: 2; } This was only ever supported in WebKit-based browsers, with a prefix, and in subsequent versions of the spec this functionality does not have an equivalent. Instead, distribution of space inside the flex container is now handle...
box-lines - CSS: Cascading Style Sheets
Web › CSS › box-lines
information about the current standard. The box-lines CSS property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). /* Keyword values */ box-lines: single; box-lines: multiple; /* Global values */ box-lines: inherit; box-lines: initial; box-lines: unset; By default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. This behavior can be changed using the box-lines property. The default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. If a value of multiple is specified, however, then the box is allowed to expand to mu...
.... This behavior can be changed using the box-lines property. The default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. If a value of multiple is specified, however, then the box is allowed to expand to multiple lines (that is, multiple rows or columns) in order to accommodate all of its children. The box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. If the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on the previous line fit. This process can repeat to an ...
...he elements remaining on the previous line fit. This process can repeat to an arbitrary number of lines. If a line contains only a single element that doesn't fit, then the element should stay on that line and overflow out of the box. The later lines are placed below the earlier lines in normal direction boxes and above in reverse direction boxes. The height of a line is the height of the largest child in that line. No additional space appears between the lines apart from the margins on the largest elements in each line. For calculating the height of a line, margins with a computed value of auto should be treated as having a value of 0. A similar process occurs for children in a vertical box. Later lines in normal direction boxes are placed to the right of earlier lines and to the left in reve...
...lements lay out in a single row or column. multiple Box elements layout in multiple rows or columns. Formal definition Initial valuesingleApplies tobox elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax single | multiple Examples Simple usage example In the original version of the spec, box-lines allowed you to specify that you wanted your flex container's children to wrap onto multiple lines. This was only supported in WebKit-based browsers, with a prefix. div { display: box; box-orient: horizontal; box-lines: multiple; } The modern flexbox equivalent is flex-wrap. Specifications Not part of any standard. ...
margin-trim - CSS: Cascading Style Sheets
Syntax none Margins are not trimmed by the container. in-flow For in-flow boxes contained by this box, block-axis margins adjacent to the box's edges are truncated to zero. It also truncates any margins collapsed with such a margin. all Trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. Formal definition Initial valuenoneApplies toBlock containers and multi-column containers. ...
...ent edge. Formal definition Initial valuenoneApplies toBlock containers and multi-column containers. ...
...lies toBlock containers and multi-column containers. ...
...Instead, margin-trim could fix it: article { margin-trim: in-flow; ... } Specifications Specification Status CSS Box Model Module Level 4The definition of 'margin-trim' in that specification. Editor's Draft ...
Audio and Video Delivery - Developer guides
n implemented by Gecko, and it can only be used when specifying the source for media elements, and not in the address bar. Error handling Starting in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), error handling has been revised to match the latest version of the HTML5 specification. Instead of the error event being dispatched to the media element itself, it now gets delivered to the child <source> elements corresponding to the sources resulting in the error. This lets you detect which sources failed to load, which may be useful. Consider 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="...
... Showing fallback content when no source could...
...ivery Internet Archive -- Free transcoding and storage Detecting when no sources have loaded To detect that all child <source> elements have failed to load, check the value of the media element's networkState attribute. If this is HTMLMediaElement.NETWORK_NO_SOURCE, you know that all the sources failed to load. If at that point you add another source, by inserting a new <source> element as a child of the media element, Gecko attempts to load the specified resource. Showing fallback content when no source could be decoded Another way to show the fallback content of a video, when none of the sources could be decoded in the current browser, is to add an error handler on the last source element. Then you can replace the video with its fallback content: <video controls> <source src="dynami...
...The most popular libraries allow you to choose a consistent player design over all browsers and provide a fallback for browsers that don't support audio and video natively. Fallbacks often use Adobe Flash or Microsoft Silverlight plugins. Other functionality such as the track element for s...
Object.getOwnPropertyNames() - JavaScript
["foo", "getFoo"] If you want only the enumerable properties, see Object.keys() or use a for...in loop (note that this will also return enumerable properties found along the prototype chain for the object unless the latter is filtered with hasOwnProperty()). ...
...see Object.keys() or use a for...in loop (note that this will also return enumerable properties found along the prototype chain for the object unless the latter is filtered with hasOwnProperty()). ...
... (note that this will also return enumerable properties found along the prototype chain for the object unless the latter is filtered with hasOwnProperty()). ...
...ess the latter is filtered with hasOwnProperty()). Items on the prototype chain are not listed: function ParentClass() {} ParentClass.prototype.inheritedMethod = function() {}; function ChildClass() { this.prop = 5; this.method = function() {}; } ChildClass.prototype = new ParentClass; ChildClass.prototype.prototypeMethod = function() {}; console.log( Object.getOwnPropertyNames( new ChildClass() // ["prop", "method"] ) ); Get non-enumerable properties only This uses the Array.prototype.filter() function to remove the enumerable keys (obtained with Object.keys()) from a list of all keys (obtained with Object.getOwnPropertyNames()) thus giving only the non-enumerable keys as output. var target = myObject; var enum_and_nonenum = Object.getOwnPropertyNames(target); var enum_only...
Namespaces crash course - SVG: Scalable Vector Graphics
ch dialect the element names belong to by giving them explicit "namespace declarations". Declaring namespaces So what do these namespace declarations look like, and where do they go? Here is a short example. <svg xmlns="http://www.w3.org/2000/svg"> <!-- more tags here --> </svg> The namespace declaration is provided by the xmlns parameter. This parameter says that the <svg> element and its child elements belong to whichever XML dialect has the namespace name 'http://www.w3.org/2000/svg' which is, of course, SVG. Note that the namespace declaration only needs to be provided once on a root element. The declaration defines the default namespace, so the user agent knows that all the <svg> element's descendants also belong to the same namespace. User agents check to see if they recognize the ...
...le. <html xmlns="http://www.w3.org/1999/xhtml"> <body> <!-- some XHTML tags here --> <svg xmlns="http://www.w3.org/2000/svg" width="300px" height="200px"> <!-- some SVG tags here --> </svg> <!-- some XHTML tags here --> </body> </html> In this example the xmlns parameter on the root <html> element declares the default namespace to be XHTML. As a result, it and all its child elements are interpreted by the user agent as belonging to XHTML, except for the <svg> element. The <svg> element has its own xmlns parameter, and by redeclaring the default namespace, this tells the user agent that the <svg> element and its descendants (unless they also redeclare the default namespace) belong to SVG. See, namespaces really aren't that hard. Declaring namespace prefixes XML di...
...l for the xlink:href parameter to not cause an error. This XLink parameter is also frequently used in SVG on the <a>, <use> and <image> elements among others, so it's a good idea to always include the XLink declaration in your documents. As an aside, it's useful to know that namespace prefixes can also be used for element names. This tells the user agent that that particular element (but not its children this time!) belongs to the namespace assigned to the prefix. Knowing this will save you some confusion if you come across markup like in the following example: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <body> <h1>SVG embedded inline in XHTML</h1> <svg:svg width="300px" height="200px"> <svg:circle cx="150" cy="100" r="50" fill="#ff...
...In general though it is better to redeclare the default namespace rather than prefix lots of elements in this way. Scripting in namespaced XML Namespaces affect not only markup, but also scripting. If you write scripts for namespaced XML such as SVG, read on. The DOM Level 1 recommendation was created before the original Nam...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
LinkStyle on SVGStyleElement Implemented (bug 1239128 (Firefox 46.0 / Thunderbird 46.0 / SeaMonkey 2.43)) Inner <svg>s and <foreignObjects>s not overflow: hidden; in UA style sheet Implementation status unknown overflow: hidden; on <hatch> in UA style sheet Implementation status unknown 0 0 as default value of transform-origin except root <svg> and <svg> children of <foreign> Implementation status unknown Use of white-space instead of deprecated xml:space attribute in UA style sheet Implementation status unknown @font-face, ::first-letter and ::first-line on <text> Implementation status unknown SVG and HTML style sheets in HTML document with inline SVG applying to whole document content Implementation status unkno...
...atus unknown Painting Change Notes paint-order Implemented (bug 828805) will-change instead of buffered-rendering Implementation status unknown context-fill and context-stroke paint values Implemented (bug 719286 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15) and bug 798843 (Firefox 26.0 / Thunderbird 26.0 / SeaMonkey 2.23)) child keyword for <paint> values and marker properties Implementation status unknown vector-effect property Only none and non-scaling-stroke values are supported (bug 528332 (Firefox 15 / Thunderbird 15 / SeaMonkey 2.12), bug 1318208) arcs value for stroke-linejoin Not implemented (bug 1239142) auto-start-reverse value for <marker>'s orient attribute Implemented (...
... 15 / SeaMonkey 2.12), bug 1318208) arcs value for stroke-linejoin Not implemented (bug 1239142) auto-start-reverse value for <marker>'s orient attribute Implemented (bug 879659) SVGPaint removed Implementation status unknown fill and stroke taking multiple paints Implementation status unknown z-index Not implemented (bug 360148 child(<integer>) paint value Implementation status unknown Display of zero-length subpaths depends on stroke-linecap attribute Implementation status unknown Markers on all shapes Implementation status unknown <marker> element display defined in UA style sheet Implementation status unknown Only single paints for fills and strokes Implementation status u...
... Linking Change Notes Link SVG resources with fragment identifiers Implementation status unknown xlink:type, xlink:role, xlink:arcrole, xlink:show, and xlink:actuate attributes removed Implementation status unknown xlink:href attribute deprecated in favor of href Implemented (bug 1245751) xlink:title attribute deprecated in favor of child <title> Implementation status unknown Spaces in SVG view fragments Implementation status unknown pixel: and percent: spatial media fragments Implementation status unknown Linking to <view> elements does not cause implicit box transformation to show nearest ancestor <svg> element Implementation status unknown Unspecified SVG view fragment parameters ...
places/bookmarks - Archive of obsolete content
This will be saved implicitly. save(bookmarks).on("data", function (saved, input) { // A data event is called once for each item saved, as well // as implicit items, like `group` console.log(input === group || ~bookmarks.indexOf(input)); // true }).on("end", function (saves, inputs) { // like the previous example, the "end" event returns an // array of all of our upda...
...st snapshot from the // host, so this is a new instance of the bookmark item, // where `item !== myBookmark`. To match it with the input item, // use the second argument, so `inputItem === myBookmark` // All explicitly saved items have data events called, as // well as implicitly saved items. In this case, // `myGroup` has to be saved before `myBookmark`, since // `myBookmark` is a child of `myGroup`. `myGroup` will // also have a `data` event called for it. }).on("end", function (items, inputItems) { // The `end` event returns all items that are explicitly // saved. So `myGroup` will not be in this array, // but `myBookmark` will be. // `inputItems` matches the initial input as an array, // so `inputItems[0] === myBookmark` }); // Saving multiple bookmarks, as duck-...
...hereas end events are emitted as the aggregate of an operation, passing an array of objects into the handler. Events data The data event is emitted when a bookmark item that was passed into the save method has been saved to the platform. This includes implicit saves that are dependencies of the explicit items saved. For example, when creating a new bookmark group with two bookmark items as its children, and explicitly saving the two bookmark children, the unsaved parent group will also emit a data event. let { Bookmark, Group, save } = require("sdk/places/bookmarks"); let group = Group({ title: "my group" }); let bookmarks = [ Bookmark({ title: "mozilla", url: "http://mozilla.com", group: group }), Bookmark({ title: "w3", url: "http://w3.org", group: group }) ]; save(bookmarks).on("da...
Low-Level APIs - Archive of obsolete content
aces/bookmarks Create, modify, and retrieve bookmarks. places/favicon Helper functions for working with favicons. places/history Access the user's browsing history. platform/xpcom Implement XPCOM objects, factories, and services. preferences/event-target Listen to changes to the Preferences system in Firefox. preferences/service Access the Preferences system in Firefox. remote/child Enables an SDK module loaded into a child process to access web content in the child process and communicate with modules in the main process. remote/parent Enables you to load modules, and privileged parts of your add-on in general, into child processes. stylesheet/style Modify styles using stylesheet files or CSS rules. stylesheet/utils Helper functions for working with stylesheets. sys...
... system/environment Access, set and clear environment variables. system/events API for working with the application observer service. system/runtime Access to information about Firefox's runtime environment. system/unload Register callbacks that are called when a module is unloaded. ...
... system/environment Access, set and clear environment variables. system/events API for working with the application observer service. system/runtime Access to information about Firefox's runtime environment. system/unload Register callbacks that are called when a module is unloaded. ...
Finding window handles - Archive of obsolete content
string. When working on Windows platforms, many APIs and frameworks require a window handle (HWND type). Since Mozilla tries to be as cross-platform as possible, it can be difficult to get the handle you need. Note: Starting in Gecko 2.0, only the top level browser window has an HWND. Web content windows (in tabs) do not have their own HWNDs. Typically the top level browser window HWND has no children, although if there are windowed plugins (such as Flash) visible in the window, they will have HWNDs whose parent is the top level browser window HWND. Here is some simple code that can get access to Mozilla window handles. This code can be used from external application or from an XPCOM component within an extension. Finding the content window handle HWND hContent = 0; // first we need ...
...nt window handle HWND hContent = 0; // first we need to find the main browser window HWND hFF = ::FindWindowEx(0, 0, "MozillaUIWindowClass", 0); if (hFF) { // next we step down through a fixed structure HWND hTemp; hTemp = ::FindWindowEx(hFF, 0, "MozillaWindowClass", 0); hTemp = ::FindWindowEx(hTemp, 0, "MozillaWindowClass", 0); // assume only 1 window at this level has children // and the 1 with children is the one we want HWND hChild = ::GetWindow(hTemp, GW_CHILD); while (hTemp && !hChild) { hTemp = ::GetWindow(hTemp, GW_HWNDNEXT); hChild = ::GetWindow(hTemp, GW_CHILD); } // did we find a window with children? // that child is hopefully the content window if (hTemp) { hTemp = ::GetWindow(hTemp, GW_CHILD); hContent...
...of this code will get the the parent window handle of the nsIBaseWindow you give as a param. That means if you use the top level nsIBaseWindow as a param, NULL will be returned in the chain and cause crash of Firefox, that's a bug of firefox.(https://bugzilla.mozilla.org/show_bug.cgi?id=489045) Now, let's move forward. First, in JavaScript, the code gets the nsIBaseWindow we want, it's a direct child of the top nsIBaseWindow. var baseWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .treeOwner .QueryInterface(Components.interfaces.nsIInterfaceRequestor)...
Tabbox - Archive of obsolete content
Examples: .tabs-closebutton { list-style-i...
... Examples: .tabs-closebutton { list-style-image: url(http:/...
...ox"); var currentIndex = tabbox.selectedIndex; if(currentIndex>=0){ var tabs=document.getElementById("tabs"); var tabpanels=document.getElementById("tabpanels"); tabpanels.removeChild(tabpanels.childNodes[currentIndex]); tabs.removeItemAt(currentIndex); /*Work around If last tab is removed, widget fails to advance to next tab*/ if(-1 == tabbox.selectedIndex && tabs.childNodes.length>0){ tabbox.selectedIndex=0; } } Creating a close tab button To have a tab close button, you must configure the style. Examples: .tabs-closebutton { list-style-image: url(http://mozilla.org/favicon.ico); } .tabs-closebutton { list-style-image: url("chrome://global/skin/icons/Close.gif"); } ...
Tree - Archive of obsolete content
tead, you can add the event handler to the <tree> element. You can then use the event and some utility methods to find the <treecell>. ...
...nt. You can then use the event and some utility methods to find the <treecell>. ...
...treecell>. ...
Adding menus and submenus - Archive of obsolete content
m. Adding a New Menu We already saw how to add menus in overlays and, as you may have imagined, you can nest submenus as deep as you want. You should avoid having deep menus or too many options, since they are confusing for most users. If your extension requires custom XUL windows, you may also need to have menus on those windows. You can do this with a menubar. The menubar element should be a child of a toolbox element because it is treated like another toolbar on systems other than Mac OS X. Mac OS X treats menus in a very different way than other systems. If your extension involves menus in any way, you should test it on Mac OS X to make sure everything works adequately. The toolbox should be positioned near the top of the XUL document, and the code should be similar to this: <toolbo...
...simple menu with options for 3 different types of greetings, a menuseparator, and finally an option to show a custom greeting. The separator is usually displayed as a horizontal line that creates a logical division between different types of menuitem elements, keeping everything more organized. A menubar can hold one or more menu elements. ...
... </menu> <menuitem label="&xulschoolhello.greet.custom.label;" oncommand="XULSchoolChrome.GreetingDialog.greetingCustom(event);" /> </menupopup> </menu> </menubar> </toolbox> In this case we grouped the 3 greeting items into a submenu. It doesn't make much sense to do that in this case because we end up with only two menu items, one of them being a menu with 3 child items. You can also have menus that are filled dynamically. Instead of setting the menupopup directly in the XUL, you can use the onpopupshowing event to fill the children when the popup is about to be displayed. DOM functions like createElement and appendChild can be used to accomplish this. If you have nothing to show on a menu, you should follow the standard used in Firefox: show a single d...
Custom XUL Elements with XBL - Archive of obsolete content
g. In this case we're adding the "Persons" dynamically, so you'll have to look into the JS file to see how xshelloperson elements are created and added to the DOM just like any other. addPerson : function(aEvent) { // ... let person = document.createElement("xshelloperson"); // ... person.setAttribute("name", name); person.setAttribute("greeting", greeting); // ... personList.appendChild(person); // ... }, This is where the advantage of XBL is obvious: we only need to create a single node and set some attributes. We didn't need to create a whole XUL structure that would require around 7 nodes every time a "Person" is created. XBL provides the encapsulation we needed to manage these nodes as a unit. As a bonus, you should look into the usage of nsIFilePicker to open a "Open...
.... The oncommand attribute of the button has some code you've probably never seen before: document.getBindingParent(this). This code gets the DOM object that corresponds to the xshelloperson tag, allowing you access to its methods and properties. In this case we're calling the remove method, which we will discuss later on. If you need to create a container element, or any other element that has child nodes, you can use the XBL children tag in your content to indicate the place where the child nodes will be inserted. The includes attribute gives you a little more flexibility with children, but it's rarely needed. One important thing to take into account is that you shouldn't use the id attribute in any content nodes. These nodes are part of the XUL DOM just like any other, and having an id at...
...the node will be lost. This means that all your properties and fields will be reset. If you want some value to be preserved after such DOM operations, you must set it as an attribute and not an internal value. Methods Our "Person" binding has a single method that removes the item from the list: <method name="remove"> <parameter name="aEvent" /> <body><![CDATA[ this.parentNode.removeChild(this); ]]></body> </method> As you can see, it's very easy to define a method and the parameters it takes. You can also have a return value using the return keyword, just like on regular JS code. The method uses the parent node to remove the Person node. Simple enough. You can do almost anything from XBL code, including using XPCOM components, JS Code Modules and available chrome scripts. T...
XPCOM Objects - Archive of obsolete content
otice is that both paratemers have the in keyword. This specifies that these are input parameters, values that the method will use to perform its actions. When is a parameter not an in parameter? In some methods the out keyword is used for parameters that are return values in reality. This is done for certain value types that are not valid as return values in IDL, such as typed arrays. void getChildList(in string aStartingAt, out unsigned long aCount,[array, size_is(aCount), retval] out string aChildArray); This method returns an array of strings. The first parameter is an input that tells the method where to start looking. The second one will hold the length of the return array, and the third parameter will hold the array itself. Note the metadata included in the square brackets, indicat...
...ray of strings. The first parameter is an input that tells the method where to start looking. The second one will hold the length of the return array, and the third parameter will hold the array itself. Note the metadata included in the square brackets, indicating that the parameter is an array, and that its size is determined by the aCount parameter. Here's one way to invoke this method: let childArrayObj = new Object(); let childArray; this._prefService.getChildList("", {}, childArrayObj); // .value holds the actual array. childArray = childArrayObj.value; The general rule for out parameters is that you can pass an empty object, and then you can get the result by accessing the value attribute in this object after the method call. The method will set value for you. Also, since JS arra...
...; } }; The instructions on how to build an IDL file are included in the section Setting up a Development Environment. C++ XPCOM Components C++ XPCOM components are no longer supported in Firefox extensions. They are only available to code built into Firefox itself. If you are writing an extension and need to interact with 3rd-party binary code, the best way to do that is to use the system/child_process IPC layer from the Addon SDK. The c-types module is also available as a bridge to load and use shared libraries from extension code. << PreviousNext >> This tutorial was kindly donated to Mozilla by Appcoast. ...
Drag and Drop Example - Archive of obsolete content
ppropriate type. var boardObserver = { getSupportedFlavours : function () { var flavours = new FlavourSet(); flavours.appendFlavour("text/unicode"); return flavours; }, onDragOver: function (event, flavour, session) {}, onDrop: function (event, dropdata, session) { if (dropdata.data != "") { var elem = document.createElement(dropdata.data); event.target.appendChild(elem); elem.setAttribute("left", "" + event.pageX); elem.setAttribute("top", "" + event.pageY); elem.setAttribute("label", dropdata.data); } } } The getSupportedFlavours function needs only to return a list of flavours that the stack can accept to be dropped on it. In this case, it only accepts text. We don't need to do anything special for the onDragOver function, so no ...
... } } } The getSupportedFlavours function needs only to return a list of flavours that the stack can accept to be dropped on it. In this case, it only accepts text. We don't need to do anything special for the onDragOver function, so no code is added in its body. The onDrop handler first uses the createElement function to create a new element of the type stored in the drag session. Next, appendChild is called to add the new element to the stack, which is the target of the event. Finally, we set some attributes on the new element. The position of elements in a stack is determined by the left and top attributes. The values of the pageX and pageY properties store the mouse pointer coordinates on the window where the drop occured. This allows us to place the new element at the position where the...
...", txt); } }; var boardObserver = { getSupportedFlavours : function () { var flavours = new FlavourSet(); flavours.appendFlavour("text/unicode"); return flavours; }, onDragOver: function (event, flavour, session) {}, onDrop: function (event, dropdata, session) { if (dropdata.data != "") { var elem = document.createElement(dropdata.data); event.target.appendChild(elem); elem.setAttribute("left", "" + event.pageX); elem.setAttribute("top", "" + event.pageY); elem.setAttribute("label", dropdata.data); } } }; << Previous Original Document Information Author(s): Neil Deakin Original Document: http://xulplanet.com/tutorials/mozsdk/dragex.php Copyright Information: Copyright (C) Neil Deakin ...
Layout System Overview - Archive of obsolete content
s responsible for resolving style values for content elements and creating the appropriate frames corresponding to that element. In addition to managing the creation of frames, the Frame Constructor is responsible for managing changes to the frames. Frame Construction is generally achieved by the use of stateless methods, but in some cases there is the need to provide context to frames created as children of a container. The Frame Manager uses the Frame Constructor State class to manage the important information about the container of a frame being created (and lots of other state-stuff too - need to describe more fully). Frame The Frame is the most fundamental layout object. The class nsFrame is the base class for all frames, and it inherits from the base class nsIFrame (note: nsIFrame is NOT ...
... NOT an interface, it is an abstract base class. It was once an interface but was changed to be a base class when the Style System was modified - the name was not changed to reflect that it is not an interface). The Frame provides generic functionality that can be used by subclasses but cannot itself be instantiated. nsFrame: The Frame provides a mechanism to navigate to a parent frame as well as child frames. All frames have a parent except for the root frame. The Frame is able to provide a reference to its parent and to its children upon request. The basic data that all frames maintain include: a rectangle describing the dimensions of the frame, a pointer to the content that the frame is representing, the style context representing all of the stylistic data corresponding to the frame, a paren...
...e is representing, the style context representing all of the stylistic data corresponding to the frame, a parent frame pointer, a sibling frame pointer, and a series of state bits. Frames are chained primarily by the sibling links. Given a frame, one can walk the sibling of that frame, and can also navigate back up to the parent frame. Specializations of the frame also allow for the management of child frames; this functionality is provided by the Container Frame. Container Frames: The Container Frame is a specialization of the base frame class that introduces the ability to manage a list of child frames. All frames that need to manage child frames (e.g. frames that are not themselves leaf frames) derive from Container Frame. Block Frame Reflow State Reflow Metrics Space Manager StyleSet StyleC...
Space Manager High Level Design - Archive of obsolete content
lients of the Space Manager also play an important part in the management of he available and used space. The primary classes that interact with the Space Manager are: nsBlockReflowState nsBlockFrame nsBoxToBlockAdaptor The general interaction model is to create a Space Manager for a block frame in the context of a Reflow, and to associate it with the BlockReflowState so it is passed down to child frames' reflow methods. After reflow, the Space Manager is destroyed. During reflow, the space manager stores the space taken up by floats (UpdateSpaceManager in nsBlockFrame) and provides information about the space available for other elements (GetAvailableSpace in nsBlockReflowState). Additionally, there is a need to manage impacts to lines caused by changes to floated elements. This is referr...
...BlockFrame::UpdateSpaceManager). The general algorithm in nsBlockReflowState::RecoverFloats is: For each line in the block, see if it has floated blocks If floats are in the line, iterate over the floats and add each one to the Space Manager via the AddRectRegion method. The actual rect for the frame is cached in an nsFloatCache so it does not have to be recomputed. If the block has any block children, then translate the Space Manager to the child block's origin and update the space manager in the context for the child block, recursively. When done with the child, restore the Space Managers coordinates by translating by the negative of the child block's origin. The general algorithm in nsBlockReflowState::FlowAndPlaceFloat is: The region that the float currently occupies is recorded. Th...
...The block frame uses a helper method on the nsBlockReflowState class to do the actual computation of available space based on the data in the Space Manager. Here is how it works for reflowing an inline frame within a block (this also occurs for reflowing a block frame and, partially, for preparing for a resize reflow). nsBlockFrame first frees all float information f...
Example Sticky Notes - Archive of obsolete content
url(notes.xml#default) This ID is local within the binding file (not visible in the target document DOM tree). --> <resources> <!-- Obtaining the stylesheet we'll use to (re)style the bound element. --> <stylesheet src="notes.css"/> </resources> <content> <!-- This SVG graphics will be added automatically around each bound element. The position of the original content is indicated by <children/> tag. --> <svg:svg width="60px" height="60px"> <svg:g fill-opacity="0.6" stroke="#FFFFFF" stroke-width="1px"> <svg:circle cx="25px" cy="12px" r="12" fill="#FF0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#00FF00" transform="translate(7,12)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#0000FF" transform="translate(-7,12)"/> </svg:g> </svg:svg...
...> tag. --> <svg:svg width="60px" height="60px"> <svg:g fill-opacity="0.6" stroke="#FFFFFF" stroke-width="1px"> <svg:circle cx="25px" cy="12px" r="12" fill="#FF0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#00FF00" transform="translate(7,12)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#0000FF" transform="translate(-7,12)"/> </svg:g> </svg:svg> <children/> </content> <implementation> <!-- Here and futher CDATA wrappers around JavaScript code are not mandatory but recommended. This way you protect yourselve from < and > signs breaking your XML layout. It also speeds up the parsing as the engine doesn't go through CDATA sections but simply skip on them. --> <constructor><![CDATA[ /** * The code below will be called one time only afte...
... also may define any amount of named arguments using <parameter name="argumentName"/> --> <parameter name="arg"/> <body><![CDATA[ this.style.border = arg; ]]></body> </method> </implementation> <handlers> <!-- Event handlers. Mouse events sent to bindings are refactored, so event.target / event.relatedTarget always points to the bound element, even if it was originated to/from a child. --> <handler event="click"><![CDATA[ if (this.priority == 'normal') { this.priority = 'high'; this.setBorder('2px solid red'); } else { this.priority = 'normal'; this.setBorder('2px solid blue'); } var str = this.innerText + '\n\n'; str+= ('On ' + event.type + ' priority set to: ' + this.priority); window.alert(str); ]]></handler> <handler event="mouseover"><![CDATA[ this.$...
A XUL Bestiary - Archive of obsolete content
f documents and also to different proprietary notions about what in a document should be exposed programmatically. The W3C has standardized on a particular DOM and already has a candidate recommendation for an updated version. This is the DOM that is reflected in XUL and in the Mozilla browser. At the highest level in the tree of nodes that is the DOM sits the window object itself. The window has child nodes like the document itself, a history object which records the pages a user has seen, frame nodes, and so on, all of which are accessible programmatically. With the dramatic improvements in the object model and the power of the W3C DOM Level 2, the concept of the DOM is displacing that of the more abstract DHTML. Since any dynamic web development is dependent upon programmatic access to the ...
... parlance, the element is analogous to the object itself while the attribute is like a property. The attribute has a value associated with it (such as the string "file" for the id attribute in the example above). Note that the menu element includes both the opening tag at the top and the closing tag at the bottom of the example. In a way, the menu element comprises the menu element itself and its children, the popup and menuitems. Events Events are also a source of confusion for many less-hardened developers. In fact, I'm not sure I understand them adequately myself, but here goes a simple explanation of events and of how they are used, basically, in a event-based interface like those created in XUL. Events are messages that are sent from an object when that object performs some action. For e...
... it. To create an event handler, simple place the code you want executed within the appropriate event listener: <menuitem value="Click Me" onclick="alert('Event Handled.')" /> It follows from the description above that event handlers can be written for events that are fired somewhere below them in the hierarchy. A menubar in XUL, for instance, can contain event handlers for events fired by its child menuitems. Mozilla XPArchitecture Mozilla is obviously a lot more than simply an interface. It's cross-platform, and standards-based, and yet in some way, the event handlers written once in JavaScript and living in the XUL interface are getting very serious things done down in the application core. Things like socket interfaces, editing, mail/news, security. The technologies that make this poss...
Property - Archive of obsolete content
<< XUL Reference accessible accessibleType accessKey align allNotifications allowEvents alwaysOpenPopup amIndicator appLocale autoCheck autoFill autoFillAfterMatch boxObject browsers builder builderView buttons canAdvance canGoBack canGoForward canRewind checked checkState child children className clickSelectsAll clientHeight clientWidth collapsed color columns command commandManager completeDefaultIndex container contentDocument contentPrincipal contentTitle contentView contentViewerEdit contentViewerFile contentWindow contextMenu control controller controllers crop current currentIndex currentItem currentNotification currentPage currentPane currentSet currentURI customT...
...Places decimalSymbol defaultButton defaultValue description dir disableAutocomplete disableAutoComplete disableautoselect disabled disableKeyNavigation dlgType docShell documentCharsetInfo editable editingColumn editingRow editingSession editor editortype emptyText Deprecated since Gecko 2 enableColumnDrag eventNode firstOrdinalColumn firstPermanentChild flex focused focusedItem forceComplete group handleCtrlPageUpDown handleCtrlTab hasUserValue height hidden hideSeconds highlightNonMatches homePage hour hourLeadingZero id ignoreBlurWhileSearching image increment inputField inverted is24HourClock isPM isSearching isWaiting itemCount label labelElement lastPermanentChild lastSelected l...
...crolling tabpanels tag textLength textValue timeout title toolbarName toolbarset tooltip tooltipText top treeBoxObject type uri userAction value valueNumber view webBrowsereFind webNavigation webProgress width wizardPages wrapAround year yearLeadingZero Related DOM element properties DOM:element.attributes DOM:element.baseURI DOM:element.childElementCount DOM:element.childNodes DOM:element.children DOM:element.clientHeight DOM:element.clientLeft DOM:element.clientTop DOM:element.clientWidth DOM:element.cloneNode DOM:element.firstChild DOM:element.firstElementChild DOM:element.lastChild DOM:element.lastElementChild DOM:element.localName DOM:element.namespaceURI DOM:element.nextElementSibling DOM:element.nex...
Things I've tried to do with XUL - Archive of obsolete content
ing property, all of that from c++ instead of JS. Multi-column listboxes When adding items to multi-column listboxes, you can't use the appendItem API: // Auto-create and attach 1st cell var row = myListBox.appendItem( label, value ); // Create and attach 2nd cell var cell = document.createElement('listcell'); cell.setAttribute('label', label2 ); cell.setAttribute('value', value2 ); row.appendChild( cell ); // etc // ... While this works at first, after a number of rows have been added it breaks and stops displaying the first cell (the one specified by the appendItem call). Instead, you must build up your own listitem full of listcells, and then add that listitem to the listbox, using generic DOM calls: var row = document.createElement('listitem'); // Create and attach 1st cell var cell =...
...ng the first cell (the one specified by the appendItem call). ...
...ng generic DOM calls: var row = document.createElement('listitem'); // Create and attach 1st cell var cell = document.createElement('listcell'); cell.setAttribute('label', label ); cell.setAttribute('value', value ); row.appendChild( cell ); // Create and attach 2nd cell cell = document.createElement('listcell'); cell.setAttribute('label', label2 ); cell.setAttribute('value', value2 ); row.appendChild( cell ); // etc // ... // Attach row myListBox.appendChild( row ); ...
Tree Widget Changes - Archive of obsolete content
clear the checkbox for a particular cell in that column by setting the value attribute to true, or leaving out the attribute. Note that it's the value attribute you use, not the label attribute. <treecell/> <treecell value="true"/> You need to specify the checkbox image with CSS for the checkbox to display. (Do NOT set id of the column to be 'checked' it will cause problems with the CSS) treechildren::-moz-tree-checkbox(checked) { /* css for checked cells */ list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif"); } In addition, checkmark columns support editing: <tree editable="true"> <treecols> <treecol type="checkbox" editable="true"> ... </treecol> </treecols> </tree> If the column is editable, the user can click the cell to change the state...
...ipt for other types of cells. For instance: var col = tree.columns.getPrimaryColumn(); treecell.setCellText(5, col, "Banana"); This will change the label of the cell in row 5 and the primary column to Banana. However, this paves the way in the future for more general tree editing features. Style improvements You can now specify the cursor to use for a cell using the CSS cursor property. ...
...ure for more general tree editing features. Style improvements You can now specify the cursor to use for a cell using the CSS cursor property. treechildren::-moz-tree-cell-text { cursor: pointer; } This allows you to create separate cursors for cells. The :-moz-tree-separator pseudo has been improved to make it a proper box type and now has additional styling capabilities. ...
Custom Tree Views - Archive of obsolete content
e an object which implements the nsITreeView interface. You can create these objects in JavaScript, but you will need a separate object for each tree. Naturally, since a custom tree view is being used, the content tree view will not be used, so the treeitem, treerow, and treecell elements will have no purpose since the custom view will get its data from elsewhere. ...
...w will not be used, so the treeitem, treerow, and treecell elements will have no purpose since the custom view will get its data from elsewhere. Thus, you can just leave the treechildren element empty. The following example shows this: <tree id="my-tree" flex="1"> <treecols> <treecol id="namecol" label="Name" flex="1"/> <treecol id="datecol" label="Date" flex="1"/> </treecols> <treechildren/> </tree> To assign data to be displayed in the tree, the view object needs to be created which is used to indicate the value of each cell, the total number of rows plus other optional information. The tree will call methods of the view to get the information that it needs to display. In general, although the tree view has thirty or so functions that may be implemented, you only need to imp...
...The setView() function has been called in the onload() handler for the window, but you could also set the view later if you wish. You can change the view at any time. One thing to note is that the getCellText() function is only called when necessary to display the contents. In t...
XUL Questions and Answers - Archive of obsolete content
enu and you generate the XUL on client by applying an XSLT transform.) Can I change a XUL tree cell/row/item background color with JavaScript? To set the background color you need to set the property for the cell/row and not for the item. ...
...OM in order to clean "target" attributes on links, and so on. */ How do I create XUL elements dynamically in JavaScript? Use the following snippet of code to add a new element under an existing element: var elem = document.getElementById(XUL_ELEMENT_ID); var node = document.createElement(XUL_ELEMENT_NAME); node.setAttribute(ATTRIBUTE, VALUE); node.setAttribute(ATTRIBUTE, VALUE); elem.appendChild(node); How do I access XUL elements in a sidebar from the context menu JavaScript? The sidebar's content is a separate document, so you should use document.getElementById("sidebar").contentDocument.getElementById(...) This is something you could see using the DOMi. See also http://developer.mozilla.org/en/docs...in_chrome_code How can I include a .js document from inside a JavaScript do...
... You can send documents using send(document), so you should be able to insert the fragment into an empty document. How can I manage scrolling outside the browser? This problem can be solved by capturing the focus events and giving the focus to another xul element or capturing and canceling the keypress events. How to display addressbook RDF and MenuList on the same list? Mailing lists are children of directories. As such, you cannot use a template to display them in the same list. The best you can do is a cascading menu along the lines of the move/copy menus, but then of course you lose the ability to easily select from the list. Instead of <menulist id="abPopup"> <menupopup id="abPopup-menupopup" ref="moz-abdirectory://" datasources="rdf:addressdirectory" sortActive="tr...
Accessibility/XUL Accessibility Reference - Archive of obsolete content
abbrowser. See browser element for more info. ...
... See tabbox textbox <label control="inputId"> <!--First name:--> </label> <textbox id='inputId'> tree <tree hidecolumnpicker="true" > <treecols> <treecol label="Cats" primary="true"/> </treecols> <treechildren> <treeitem container="true" open="true"> <treerow> <treecell label="<!--Male-->" /> </treerow> <treechildren> <treeitem> <treerow> <treecell label="<!--Aramis-->" /> </treerow> </treeitem> <treeitem> <treerow> <treecell label="<!--Fergus-->" /> </treerow> </treeitem> </treechildren> </treeitem> </treechildren> </tree> There is no keyboard access to the column picker (the widge...
... in the main menu, e.g. the Manage Bookmarks window in Firefox 2 or the Places window in Firefox 3). JAWS 7.10 can not read the column headers. The main tree is accessible like a regular tree control. ...
caption - Archive of obsolete content
More information is available in the XUL tutorial. ...
...ring Gets and sets the value of the crop attribute. image Type: image URL Gets and sets the value of the image attribute. label Type: string Gets and sets the value of the label attribute. tabIndex Type: integer Gets and sets the value of the tabindex attribute. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elem...
columns - Archive of obsolete content
The columns element may be nested inside another columns element. Other elements placed inside a columns element occupy the full height of the grid and are placed in their corresponding positions between the columns. More information about columns is available in the XUL tutorial. Example See grid for an example. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
content - Archive of obsolete content
-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width Propiedades tag Type: tag name This may be set to a tag name. If set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. For example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. Thus, nested elements will not match because they are directly inside a treeitem. This attribute is useful to provide different rules for outer and inner elements. uri Type: ? Used to specify the variable name for the content. When a rule is evaluated, it scans through each resource...
... Type: ? Used to specify the variable name for the content. When a rule is evaluated, it scans through each resource in the RDF datasource looking for a match. Each resource is placed in the variable specified in the uri attribute in turn. Then, the other rules are evaluated for a match. This attribute should always be present. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Relacionados TBD ...
description - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used to create a block of text. The text can be set either with the value attribute or by placing text inside the open and close description tags. The value attribute is used to set text that appears in a single line. If text appears as a child of the description, it will wrap to multiple lines. It may contain arbitrary markup, which can be styled as needed. More information is available in the XUL tutorial. Attributes crop, disabled, tabindex value Properties accessibleType, crop, disabled, tabIndex, value Style classes header, indent, monospace, plain, small-margin Examples This is a long section of text that will word wrap when displayed <description> This i...
...e. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes he...
grid - Archive of obsolete content
Archive › Mozilla › XUL › grid
Note: This page is about Grids in Mozilla's XUL Technology. If you are looking for information on CSS Grids, you should go to our CSS Grid Layout page instead. << XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A grid is a layout type that arranges elements in rows and columns. The grid is expected to contain both a columns element as a child which defines the structure of the columns and a rows element as child to define the rows. The size and attributes defined on columns and rows will affect the size and placement of elements in each cell. Elements placed within both the columns and rows will be displayed, although usually only elements will be placed inside one of these. It is most common to place elements within the rows and use the colu...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
hbox - Archive of obsolete content
Archive › Mozilla › XUL › hbox
This is equivalent to the box element, except it defaults to horizontal orientation. More information is available in the XUL tutorial. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
key - Archive of obsolete content
Archive › Mozilla › XUL › key
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Details on key, key...
...o change one of the <key>'s attributes, such as the modifiers attribute, the keyset element has to be re-added to its parent node; otherwise the new attributes won't be applied. For example: // modify some attributes let key = document.getElementById(KEY_ID); key.setAttribute("modifiers", "alt shift"); // apply the changes let keyset = document.getElementById(KEYSET_ID); keyset.parentNode.appendChild(keyset); ...
listcell - Archive of obsolete content
e position of the image is determined by the dir and orient attributes. label Type: string The label that will appear on the element. If this is left out, no text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. type Type: string This attribute is reserved for use by anonymous children of listitem; do not use. Properties disabled Type: boolean Gets and sets the value of the disabled attribute. Inherited Properties align, , allowEvents, , boxObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , ,...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes li...
menuitem - Archive of obsolete content
s value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. autocheck Type: boolean If this attribute is true or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false, the checked state must be adjusted manually. When autocheck is true, the button type should be "checkbox" or "radio". checked Type: boolea...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes me...
menuseparator - Archive of obsolete content
value is set, it overrides an assigned key set in the key attribute. This attribute does not apply to menus directly on the menubar. accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. allowevents Type: boolean If true, events are passed to children of the element. Otherwise, events are passed to the element only. command Type: id Set to the id of a command element that is being observed by the element. crop Type: one of the values below If the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in...
... 3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
notificationbox - Archive of obsolete content
e an element. Typically the element will be a browser, but any element may be used. The notification element is used for each notification, and will be created automatically for each item. Each notification will slide in and out as needed. This element is used, for example, to implement the yellow information bar in various Firefox windows. The notification box is a vertical box which may have children. The notifications appear at the top of the box. The notifications may be placed at the bottom by setting the dir attribute to reverse. Finding the current notification box Within a Firefox extension, you can retrieve the current notification box for a specific tab by calling the global function getNotificationBox(): notifyBox = chromeWin.getNotificationBox(notifyWindow) notifyBox = getNoti...
... Type: nodeList NodeList of all notifications. This property is read-only. notificationsHidden Type: boolean Indicating whether the notification area should be hidden. Events AlertActive Type: Event Fired when a notification element is shown. AlertClose Type: Event Fired when a notification element is closed. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendNotificatio...
param - Archive of obsolete content
Archive › Mozilla › XUL › param
For more information, see Query_Parameters. Attributes index, name, type Attributes index Type: integer The index within the SQL statement of the parameter. name Type: string The name of a parameter within the SQL statement. This name should appear within the query preceded by a colon. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
preferences - Archive of obsolete content
<preferences> element should contain one or more <preference> elements. Note: it's not clear which of the following methods and properties are public. Examples <preferences> <preference id="pref_one" name="extensions.myextension.one" type="bool"/> <preference id="pref_two" name="extensions.myextension.two" type="string"/> ... etc ... ...
...OMElement preference); Creates and dispatches a changed (non-bubbling) event to the specified preference element. Also executes code specified in onchanged attribute of the element. See also the description of change event of <preference>. void observe(in nsISupports aSubject, in string aTopic, in wstring aData); nsIObserver method used internally to react to changes to preferences listed as children of this element. Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTa...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Preferen...
prefpane - Archive of obsolete content
ies | Methods | Related ] A single preference panel in a prefwindow. A prefpane is made up of two parts, the preferences descriptions, which specify the set of preferences that will be modified, and the user interface for adjusting those preferences. The former is specified using a preferences element while the latter may be specified using other XUL elements. Both may be specified directly as children of the prefpane element, or the src attribute may be used to put a pane in a separate file. In this latter case, the separate file should use an overlay tag as its root tag since it will be loaded as an overlay to the main preferences window. More information is available in the Preferences System article. Attributes helpURI, image, label, onpaneload, selected, src Proper...
...ause the preference's value to change. (1) an example of a widget that has state changes tracked for it includes the checkbox element, whose state is tracked automatically when the "command" event fires. void writePreferences(in boolean flushToDisk); Writes all changes in this pane to preferences, optionally flushes to disk. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Events panel...
richlistitem - Archive of obsolete content
the user. Properties accessible Type: nsIAccessible Returns the accessibility object for the element. control Type: element id Gets and sets the value of the control attribute. disabled Type: boolean Gets and sets the value of the disabled attribute. label Type: string Gets the concatentation of text from any child label elements. Does not support setting label values. Use the child elements directly to set label text. searchLabel Type: string Gets and sets the value of the searchlabel attribute. selected Type: boolean This property's value is true if this element is selected, or false if it is not. This property is read only. This property is available for menuitem and menus...
... 3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
rows - Archive of obsolete content
Archive › Mozilla › XUL › rows
Each child of a rows element should be a row element. The rows element may be nested inside another rows element. The children of these nested rows are counted as normal rows as if they were part of the parent. However, nesting rows elements allows groups of rows to have a separate appearance such as a different border, or separate scrolling may be defined for these rows. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
scale - Archive of obsolete content
Archive › Mozilla › XUL › scale
normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the elements are placed left to right or top to bottom in the order they appear in the XUL code. reverse For scales, the scale's values are ordered from right to left (for horizontal scales) or f...
...te. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData decrease() ...
scrollbox - Archive of obsolete content
vbox to get smaller and sprout its scroll bars instead. Note that this example doesn't use a scrollbox tag; you only need that tag if you want to programmatically scroll in addition to the automatic scroll bars. Note: avoid nested scroll boxes; it's maddening for the experienced user and confusing for the less experienced user. Instead, figure out some other way to lay things out. Scrolling a child element into view See element.scrollIntoView. Prior to Gecko 19, scrollIntoView() didn't exist in XUL. Do this instead: var xpcomInterface =scrollbox_element.boxObject.QueryInterface( Components.interfaces.nsIScrollBoxObject); xpcomInterface.ensureElementIsVisible(child_element_to_make_visible); See the nsIScrollBoxObject API for other scroll-related methods. Attributes ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
stack - Archive of obsolete content
Archive › Mozilla › XUL › stack
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An element that renders its children on top of each other. The first element is placed on the bottom and each successive child is placed above the previous. All elements are displayed at once. Child elements may also be placed at absolute positions within the stack. The top, right, bottom, and left attributes on a child of the stack specify the position of that element. The bottom and right attributes can also be used in conjunction with top and left to set the width and/or height of the children of the stack. Note that bottom and right attributes, unlike rect, are relative to the bottom and right of the stack. When using these attributes to set width or height, both attributes for the give...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related deck ...
tabbox - Archive of obsolete content
More information is available in the XUL tutorial. ...
...ence to the currently selected tab, which will always be one of the tab elements in the tabs element. Assign a value to this property to modify the currently selected tab. tabs Type: tabs element The tabs element contained within the tabbox. tabpanels Type: tabpanels element The tabpanels element contained within the tabbox. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
toolbarpalette - Archive of obsolete content
Do not add the various spacing items, as those are added automatically. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
toolbox - Archive of obsolete content
placed inside a toolbox, a grippy is displayed on its left or upper edge. The user may click the grippy to collapse the toolbar. If multiple toolbars are placed in the same toolbox, they will all collapse into the same row. The Firefox browser does not have grippies so toolbars cannot be collapsed and expanded. Note: Gecko 2.0 adds support for external toolbars. These are toolbars that are not children of a toolbox. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's externalToolbars property. More information is available in the XUL tutorial. If you'd like to detect when toolbars in a too...
...e: nsIAccessible Returns the accessibility object for the element. customToolbarCount Firefox only Type: integer The number of custom toolbars currently within the toolbox. externalToolbars Type: array of elements An array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox. palette Firefox only Type: element The toolbarpalette within the toolbox. toolbarset Firefox only Type: element The toolbarset within the toolbox. Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAt...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData appendCustomToolb...
treecell - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
... ...
treecols - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
... Interfaces nsIAccessibleProvider ...
treeseparator - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
... ...
triple - Archive of obsolete content
lement. It is used to check for an assertion within a graph. If such an assertion exists, the rule may match, assuming that all the conditions match. If the assertion does not exist, the rule will not match. Both the subject and object attributes may be variables. The subject of a triple is an RDF resource. In an RDF file this would usually be an RDF Description element. The predicate would be a child element or property. For example, for a bookmark resource, the name and URL would be predicates. They should be specified in their full URI form. The object is the value of the RDF property. More information is available in the XUL tutorial. Attributes object, predicate, subject Examples (example needed) Attributes object Type: string The object of the element. It can be a variab...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
vbox - Archive of obsolete content
Archive › Mozilla › XUL › vbox
This is equivalent to the box element, except it defaults to vertical orientation. More information is available in the XUL tutorial. ...
...bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
Implementation Status - Archive of obsolete content
292333; 3.4 Extension Module unsupported 300760; ...
...n Title Status Notes Bugs 6.1.1 type partial limited to types mentioned above 6.1.2 readonly supported 6.1.3 required supported 6.1.4 relevant partial relevancy applied via a bind to an element fails to apply to child attributes 342319; 6.1.5 calculate supported 6.1.6 constraint supported 6.1.7 p3ptype unsupported 279049; 6.2.1 Atomic Datatype partial We will support simpleType's using length, minlength, maxlength, pattern, maxinclusive, minin...
... supported 10.18 Iteration of XForms Actions supported 11. XForms Submission Model Section Title Status Notes Bugs 11.1 submission partial From 1.1 we do not yet support @mode, @indent, @replace='text', @separator, @serialize, @target, header or method child elements 11.2 xforms-submit partial We currently limit (for security reasons) submission only back to the server that served the document. But the user can choose to remove this restriction on a site by site basis via a preference. Click for more details. 330557; 11.3 xforms-submit-serialize supported ...
Bounding volume collision detection with THREE.js - Game development
erty takes the Geometry itself as reference, and not the Mesh. So any transformations such as scale, position, etc. applied to the Mesh will be ignored while computing the calculating box. A more simple alternative that fixes the previous issue is to set those boundaries later on with Box3.setFromObject, which will compute the dimensions taking into account a 3D entity's transformations and any child meshes as well. var knot = new THREE.Mesh( new THREE.TorusKnotGeometry(0.5, 0.1), new MeshNormalMaterial({})); var knotBBox = new Box3(new THREE.Vector3(), new THREE.Vector3()); knotBBox.setFromObject(knot); Instantiating spheres Instantiating Sphere objects is similar. We need to provide the sphere's center and radius, which can be added to the boundingSphere property available in Geomet...
...urce code to examine. Point vs. Box and Sphere Box vs. Box and Sphere Sphere vs. Box and Sphere Using BoxHelper As an alternative to using raw Box3 and Sphere objects, Three.js has a useful object to make handling bounding boxes easier: BoxHelper (previously BoundingBoxHelper, which has been deprecated). This helper takes a Mesh and calculates a bounding box volume for it (including its child meshes). This results in a new box Mesh representing the bounding box, which shows the bounding box's shape, and can passed to the previously seen setFromObject method in order to have a bounding box matching the Mesh. BoxHelper is the recommended way to handle 3D collisions with bounding volumes in Three.js. You will miss sphere tests, but the tradeoffs are well worth it. The advantages of u...
... box matching the Mesh. BoxHelper is the recommended way to handle 3D collisions with bounding volumes in Three.js. You will miss sphere tests, but the tradeoffs are well worth it. The advantages of using this helper are: It has an update() method that will resize its bounding box Mesh if the linked Mesh rotates or changes its dimensions, and update its position. It takes into account the child meshes when computing the size of the bounding box, so the original mesh and all its children are wrapped. We can easily debug collisions by rendering the Meshes that BoxHelper creates. By default they are created with a LineBasicMaterial material (a three.js material for drawing wireframe-style geometries). The main disadvantage is that it only creates box bounding volumes, so if you need sph...
Async scripts for asm.js - Game development
in Firefox 28). To see the difference, toggle javascript.options.parallel_parsing in about:config. ...
...js"; document.body.appendChild(script); (Scripts created from script default to async.) The default HTML shell Emscripten generates produces the latter. When is async not async? Two common situations in which a script is *not* async (as defined by the HTML spec) are: <script async>code</script> and var script = document.createElement('script'); script.innerHTML = "code"; document.body.appendChild(script); Both are counted as 'inline' scripts and get compiled and then run immediately. What if your code is in a JS string? Instead of using eval or innerHTML, both of which trigger synchronous compilation, you should use a Blob with an object URL: var blob = new Blob([codeString]); var script = document.createElement('script'); var url = URL.createObjectURL(blob); script.onload = script.one...
...ly. What if your code is in a JS string? Instead of using eval or innerHTML, both of which trigger synchronous compilation, you should use a Blob with an object URL: var blob = new Blob([codeString]); var script = document.createElement('script'); var url = URL.createObjectURL(blob); script.onload = script.onerror = function() { URL.revokeObjectURL(url); }; script.src = url; document.body.appendChild(script); The setting of src rather than innerHTML is what makes this script async. ...
Combinators - Learn web development
electors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. body article p In the example below, we are matching only the <p> element which is inside an element with a class of .box. Child combinator The child combinator (>) is placed between two CSS selectors. It matches only those elements matched by the second selector that are the direct children of elements matched by the first. Descendent elements further down the hierarchy don't match. For example, to select only <p> elements that are direct children of <article> elements: article > p In this next example, we have an unor...
...ors. It matches only those elements matched by the second selector that are the direct children of elements matched by the first. Descendent elements further down the hierarchy don't match. 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 inside of which is an ordered list. I am using the child combinator to select only the <li> elements which are a direct child of a <ul>, and have given them a top border. If you remove the > that designates this as a child combinator, you end up with a descendant selector and all <li> elements will get a red border. Adjacent sibling combinator The adjacent sibling selector (+) is used to select something if it is right next to another element at t...
...we are selecting all <p> elements that come after the <h1>, and even though there is a <div> in the document as well, the <p> that comes after it is selected. Using combinators You can combine any of the selectors that we discovered in previous lessons with combinators in order to pick out part of your document. For example if we want to select list items with a class of "a", which are direct children of a <ul>, I could use the following. ul > li[class="a"] { } Take care however when creating big lists of selectors that select very specific parts of your document. It will be hard to reuse the CSS rules as you have made the selector very specific to the location of that element in the markup. It is often better to create a simple class and apply that to the element in question. That sai...
Type, class, and ID selectors - Learn web development
ps out all of the browser styling. Since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. Using the universal selector to make your selectors easier to read One use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. ...
...fic situations such as the one outlined below. Using the universal selector to make your selectors easier to read One use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. For example, if I wanted to select the first child of any descendant element of <article> , no matter what element it was, and make it bold, I could use the :first-child selector, which we will learn more about in the lesson on pseudo-classes and pseudo-elements, as a descendant selector along with the <article> element selector: article :first-child { } This could be confused however with article:first-child, which will select any <article> element that is the first child of another element. To avoid this confusion we can add the universal selector to the :...
...tor, which we will learn more about in the lesson on pseudo-classes and pseudo-elements, as a descendant selector along with the <article> element selector: article :first-child { } This could be confused however with article:first-child, which will select any <article> element that is the first child of another element. To avoid this confusion we can add the universal selector to the :first-child selector, so it is obvious what the selector is doing. It is selecting any element which is the first-child of any descendant element of <article>: article *:first-child { } Although both do the same thing, the readability is significantly improved. Class selectors The class selector starts with a full stop (.) character and will select everything in the document with that class applied to ...
CSS selectors - Learn web development
itself. For example, ::first-line always selects the first line of text inside an element (a <p> in the below case), acting as if a <span> was wrapped around the first formatted line and then selected. p::first-line { } Combinators The final group of selectors combine other selectors in order to target elements within our documents. The following for example selects paragraphs that are direct children of <article> elements using the child combinator (>): article > p { } Next steps You can take a look at the reference table of selectors below for direct links to the various types of selectors in this Learn section or on MDN in general, or continue on to start your journey by finding out about type, class, and ID selectors. Previous Overview: Building blocks Next Reference table ...
...nerally. ...
... Class selector .box { } Class selectors id selector #unique { } ID selectors Attribute selector a[title] { } Attribute selectors Pseudo-class selectors p:first-child { } Pseudo-classes Pseudo-element selectors p::first-line { } Pseudo-elements Descendant combinator article p Descendant combinator Child combinator article > p Child combinator Adjacent sibling combinator h1 + p Adjacent sibling General sibling combinator h1 ~ p General sibling In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute selectors Pseudo-classes and pseudo-elements Combinators The box model Backgrounds and borders ...
Test your skills: Grid Layout - Learn web development
covered. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Grid Layout One In this task you should create a grid into which the four child elements will auto-place. The grid should have three columns sharing the available space equally, and a 20-pixel gap between the column and row tracks. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Two In this example we a...
...ring the available space equally, and a 20-pixel gap between the column and row tracks. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Two In this example we already have a grid defined. By editing the CSS rules for the two child elements, cause them to span over several grid tracks each; the second item should overlay the first as in the image below. Try updating the live code below to recreate the finished example: Additional questions: Can you now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, download the starting point for...
...in the image below. Try updating the live code below to recreate the finished example: Additional questions: Can you now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Three There are four direct children in this grid; the starting point has them displayed using auto-placement. Use the grid-area and grid-template-areas properties to lay the items out as shown in the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid and Flex L...
How CSS works - Learn web development
isual display of the page is shown on the screen (this stage is called painting). The following diagram also offers a simple view of the process. About the DOM A DOM has a tree-like structure. Each element, attribute, and piece of text in the markup language becomes a DOM node in the tree structure. The nodes are defined by their relationship to other DOM nodes. Some elements are parents of child nodes, and child nodes have siblings. Understanding the DOM helps you design, debug and maintain your CSS because the DOM is where your CSS and the document's content meet up. When you start working with browser DevTools you will be navigating the DOM as you select items in order to see which rules apply. A real DOM representation Rather than a long, boring explanation, let's look at an exampl...
... as you select items in order to see which rules apply. A real DOM representation Rather than a long, boring explanation, let's look at an example to see how a real HTML snippet is converted into a DOM. Take the following HTML code: <p> Let's use: <span>Cascading</span> <span>Style</span> <span>Sheets</span> </p> In the DOM, the node corresponding to our <p> element is a parent. ...
...example to see how a real HTML snippet is converted into a DOM. Take the following HTML code: <p> Let's use: <span>Cascading</span> <span>Style</span> <span>Sheets</span> </p> In the DOM, the node corresponding to our <p> element is a parent. Its children are a text node and the three nodes corresponding to our <span> elements. The SPAN nodes are also parents, with text nodes as their children: P +- "Let's use:" +- SPAN | +- "Cascading" +- SPAN | +- "Style" +- SPAN +- "Sheets" This is how a browser interprets the previous HTML snippet --it renders the above DOM tree and then outputs it in the browser like so: p {margin:0;} Applying CSS to the DOM Let's say we added some CSS to our document, to style it. Again, the HTML is as follows: <p> Let's use: <span>Cascadin...
Looping code - Learn web development
provided you with an initializer -- let i = 10;. For each iteration, create a new paragraph and append it to the output <div>, which we've selected using const output = document.querySelector('.output');. In comments, we've provided you with three code lines that need to be used somewhere inside the loop: const para = document.createElement('p'); -- creates a new paragraph. output.appendChild(para); -- appends the paragraph to the output <div>. para.textContent = -- makes the text inside the paragraph equal to whatever you put on the right-hand side, after the equals sign. Different iteration numbers require different text to be put in the paragraph for that iteration (you'll need a conditional statement and multiple para.textContent = lines): If the number is 10, print...
...flow: auto;"> </div> <h2>Editable code</h2> <p class="a11y-label">Press Esc to move focus away from the code area (Tab inserts a tab character).</p> <textarea id="code" class="playable-code" style="height: 300px;width: 95%"> let output = document.querySelector('.output'); output.innerHTML = ''; // let i = 10; // const para = document.createElement('p'); // para.textContent = ; // output.appendChild(para); </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="Reset"> <input id="solution" type="button" value="Show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; background: #f5f9fa; } const textarea = document.g...
....value = 'Show solution'; } updateCode(); }); let jsSolution = 'const output = document.querySelector(\'.output\');\noutput.innerHTML = \'\';\n\nlet i = 10;\n\nwhile(i >= 0) {\n let para = document.createElement(\'p\');\n if(i === 10) {\n para.textContent = \'Countdown \' + i;\n } else if(i === 0) {\n para.textContent = \'Blast off!\';\n } else {\n para.textContent = i;\n }\n\n output.appendChild(para);\n\n i--;\n}'; let solutionEntry = jsSolution; textarea.addEventListener('input', updateCode); window.addEventListener('load', updateCode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keyCode === 9) { e.preventDefault(); insertAtCaret('\t'); } if (e.keyCode === 27) { textarea.b...
Debugging on Mac OS X
mended. See "Having a profile for debugging purposes" below. Select the "Arguments" tab in the scheme editor, and click the '+' below the "Arguments passed on launch" field. Add "-P profilename", where profilename is the name of a profile you created previously. Repeat that to also add the argument "-no-remote". Also in the "Arguments" panel, you may want to add an environment variable MOZ_DEBUG_CHILD_PROCESS set to the value 1 to help with debugging e10s. Select "Build" from the left of the scheme editor window, and check that there is nothing listed under Targets (otherwise it may cause problems when you try to run the executable for debugging since you will get build errors). Click "Close" to close the scheme editor. At this point you can run the application from Xcode, and when you pau...
...oint-strategy always in your $HOME/.lldbinit as recommended on Debugging Mozilla with lldb. Using Mozilla-specific lldb commands If you included the .lldbinit when Setting up lldb, you can use Mozilla-specific lldb commands in the console, located in the Debug area of XCode. For example, type js to see the JavaScript stack. For more information, see Debugging Mozilla with lldb. Debugging e10s child processes Using XCode to debug child processes created by an e10s-enabled browser is a little trickier than debugging a single-process browser, but it can be done. These directions were written using XCode 6.3.1 Complete all the steps above under "Creating the Project" From the "Product" menu, ensure the scheme you created is selected under "Scheme", then choose "Scheme > Edit Scheme" In th...
... be launched" On the "Arguments" tab, remove all arguments passed on launch. Now you're ready to start debugging: From the "Product" menu, ensure the scheme you created above is selected under "Scheme" Click the "Run" button. The information area at the top of the window will show "Waiting for plugin-container to launch" From a command line, run your build of Firefox. When that launches a child process (for example, when you start to load a webpage), XCode will notice and attach to that child process. You can then debug the child process like you would any other process. When you are done debugging, click the "Stop" button and quit the instance of Firefox that you were debugging in the normal way. For some help on using lldb see Debugging Mozilla with lldb. Other resources Apple ha...
Process scripts
once, then you will get multiple notifications for that event. The solution in these cases is to use a process script instead of a frame script. You can load a process script by accessing a parent process message manager and calling its loadProcessScript() function. ...
...he global parent process message manager, which will load the script into the the chrome process and any child processes: // chrome code let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"] .getService(Ci.nsIProcessScriptLoader); ppmm.loadProcessScript("chrome://whatever/process-script.js", true); ppmm.addMessageListener("Hello", function(msg) { ... ...
...aded until their host process is closed. the environment for process scripts is similar to that for frame scripts. However, you don't get access to web content or DOM events from a process script. Retrieving the content frame message manager for a content window When an observer notification in a process script contains a content document or window it can be useful to not use talk through the child/parent process message managers but through the window's content frame message manager, e.g. if responses should be processed by a frame script instead of the process script. 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.nsI...
How to get a stacktrace with WinDbg
t.com/download/symbols .symfix+ c:\symbols .reload /f Now wait for the symbols to download. This may take some time depending on your connection speed; the total size of the Mozilla and Microsoft symbols download is around 1.4GB. WinDbg will show "Busy" at the bottom of the application window until the download is complete. ...
...e application window until the download is complete. Once the download is complete, you need to configure WinDbg to examine child processes, ignore a specific event caused by Flash Player, and record a log of loaded modules. You will also want to open a log file to save data you collect. To do this, enter these four commands, pressing enter after each one. .logopen /t c:\temp\firefox-debug.log .childdbg 1 .tlist sxn gp lm If you see firefox.exe listed in the output from .tlist more than once, then you are already running the application and need to close the running instance first before you start debugging, otherwise you won't get useful results. Now run Firefox by opening the Debug menu and clicking Go. While Firefox is running, you will not be able to type any commands into the debugger...
...version of Windows, you need to replace "ntdll" in these commands with "ntdll32". Q: The first four frames of my stack trace look like this: 0012fe20 7c90e89a ntdll!KiFastSystemCallRet 0012fe24 7c81cd96 ntdll!ZwTerminateProcess+0xc 0012ff20 7c81cdee kernel32!_ExitProcess+0x62 0012ff34 6000179e kernel32!ExitProcess+0x14 This looks wrong to me?! A: You ran the application without the "Debug child processes also" check box being checked. You need to detach the debugger and open the application again, this time with the check box being checked. Q: WinDbg tells me that it is unable to verify checksum for firefox.exe. Is this normal? A: Yes, this is normal and can be ignored. Q: Should I click yes or no when WinDbg asks me to "Save information for workspace?" A: Click yes and WinDbg will ...
IPDL Best Practices
an IPDL interface, but it also outlives it (case in point: reference-counted). Is there any chance that an IPDL function could be called after the protocol itself has been destroyed, or before it has been created? Don't let it happen - that is a guaranteed crash right there. Use a flag and the generated ActorDestroy function to control when IPDL functions can be called; see PHttpChannelParent/Child for an example. When to run code Here's a rundown on appropriate places to run certain kinds of code: Manager::AllocPProtocol - allocation Manager::RecvPProtocolConstructor - initialization, protocol deletion (the TypeAheadFind protocol uses one-shot protocols like this) Actor::Recv__delete__ - cleanup, IPDL calls still valid but ill-advised Actor::ActorDestroy - non-IPDL cleanup Manag...
...igger protocol deletion a second time. While this can be worked around with ActorDestroy, being explicit about deleting the protocol with Send__delete__ is easier to maintain, with symmetric Alloc/DeallocPProtocol functions also being easier to reason about. Minimize overall use of messages Reducing IPC traffic is a righteous goal. Consider the following protocol: async protocol PAsyncQuerier { child: PAsyncQuery(); } async protocol PAsyncQuery { child: KickOffQuery(nsString query); parent: ReturnResult(nsString result); __delete__(); } In this situation, there is a guaranteed sequence of messages that will be sent. Following actor construction, the parent will send a KickOffQuery message and presumably ignore the actor until it receives ReturnResult, at which point it will be del...
... of messages that will be sent. ...
CustomizableUI.jsm
ntainer, a toolbar, anymore. onWindowOpened(aWindow) Fired when a new customizable (ie browser) window is opened. onWindowClosed(aWindow) Fired when a customizable (ie browser) window is closed. ...
...ts you have fixed content in a toolbar (e.g. the panel menu item in the navbar) and have all the customizable widgets use the customization target. Using this API yourself is discouraged; you should generally not need to be asking for the DOM container node used for a particular area. In particular, if you're wanting to check it in relation to a widget's node, your DOM node might not be a direct child of the customize target in a window if, for instance, the window is in customization mode, or if this is an overflowable toolbar and the widget has been overflowed. Parameters aArea the ID of the area whose customize target you want to have aWindow the window where you want to fetch the DOM node. Return value The customize target DOM node for aArea in aWindow reset() Reset the customi...
...The code is more advanced. It can be found summarized at this gist: https://gist.github.com/Noitidart/10902...
Profiling with the Firefox Profiler
several rows of tracing markers (colored segments) which indicate interesting events. Hover over them to see more information. Below the tracing markers are rows corresponding with activity on a variety of threads. Tip: Threads that are annotated with "[default]" are in the parent (aka "UI", aka "browser chrome", aka "main") process and those annotated with "[tab]" are in the Web content (aka "child") processes. Tip: Long-running tasks in the parent process will block all input or drawing with the browser UI (aka "UI jank") whereas long-running tasks in the content process will block interactivity with the page but still allowing the user to pan and zoom around thanks to APZ. Tracing markers Red: These indicate that the event loop is being unresponsive. Note that high priority events...
...per into the call tree by holding down your right arrow key. Alternatively, expand an entire tree segment by holding Alt and clicking on the arrow to the left of the collapsed tree segment. As we progress into a more specific part of the tree, you'll notice that the 'Running time' decreases. This happens when a function has 2 or more non-trivial calls: the running time will be split between its children. Tip: Focus on one section of the tree by clicking on the "arrow-in-a-circle" icon that appears to the right of the tree element as you hover over it. A "tree breadcrumb" will appear similar to the range breadcrumbs noted above. Clicking the "JavaScript only" option will only show JavaScript code in the Call Tree. You could compare the time with this option checked and the total time to ge...
...ame things you are seeing. Tips Understanding profiles can be difficult. If you're unfamiliar with Gecko's internals, you can click the JavaScript only button to see where your JavaScript code is slow. Each entry in the Call Tree shows a call stack and how much time is spent in that call stack. For example:In the results above we can see that we're spending ~287 milliseconds in Startup::XRE_InitChildProcess, 194 ms of which are spent in PVsync::Msg_Notify and all child functions that it calls. It is useful to scan down the "Running Time" column and look for when the time changes. While looking for performance problems, you're looking for the processes that are taking the most time; then you can figure out how to optimize them. Common Performance Bugs in Firefox Inefficient code that is on t...
Gecko states
<< AT APIs Support Page Introduction Below you will find a list of supported states by Gecko. State constants are defined in nsIAccessibleStates. States List STATE_UNAVAILABLE The object is unavailable, i.e. disabled. Applied to: all roles. STATE_SELECTED The object is selected, i.e. indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. Applied to: ROLE_MENUITEM, ROLE_CELL, ROLE_OUTLINEITEM, XXX: continue Events: EVENT_STATE_CHANGE ?oncomitant state: STATE_SELECTABLE STATE_FOCUSED The object is focused Applied to: Events: Concomitant state: STATE_FOCUSABLE STATE_PRESSED The object is pressed. STATE_CHECKED The object is checked STATE_MIXED Indicates tha...
...eck box is neither checked nor unchecked and is therefore in the third or mixed state. STATE_READONLY The object is designated read-only. STATE_HOTTRACKED The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Isn't used STATE_DEFAULT This state represents the default button in a window. STATE_EXPANDED Children of this object that have the ROLE_OUTLINEITEM role are displayed. STATE_COLLAPSED Children of this object that have the ROLE_OUTLINEITEM role are hidden. STATE_BUSY The control cannot accept input at this time. STATE_FLOATING Children "owned" not "contained" by parent STATE_CHECKABLE Indicates scrolling or moving text or graphics. STATE_ANIMATED The object's appearance changes rapidl...
... the list to users. STATE_OFFSCREEN Scrolled off STATE_SIZEABLE The object can be resized. For example, a user could change the size of a window by clicking the border with a mouse and dragging the mouse. STATE_MOVEABLE Indicates that the object can be moved. For example, a user can click on the titlebar for the object and drag the object to a new location. STATE_SELFVOICING The object or child uses text-to-speech (TTS) technology for description purposes. A speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information. Isn't used STATE_FOCUSABLE The object can be focused. Applied to: Events: Concomitant state: STATE_FOCUSED STATE_SELECTABLE The object can be selected. Ap...
XForms Accessibility
use xhtml1.x use tabindex. If you use Xhtml2 use nextfocus. Therefore since Mozilla XForms works in XHTML (1.x) or XUL documents only then we use tabindex instead. Note, we support -moz-user-focus style neither for XHTML or XUL. AT API Accessible properties This section describes common rules how accessibility properties are formed for forms control elements. name It is formed from value of child XForms label element if the element doesn't have labelledby attribute. description It is formed from value of child XForms hint element if the element doesn't have describedby attribute. state It is formed as well from model item properties (MIPs) of instance node that XForms element is bound to as from valid/invalid or in-range/out-of-range states of instance node. Instance node states are m...
...e states are mapped to accessibility state constants declared in nsIAccessibleStates interface like it shown below: relevant - STATE_UNAVAILABLE readonly - STATE_READONLY required - STATE_REQUIRED invalid - STATE_INVALID out of range - STATE_INVALID attributes Redefines datatype ARIA attribute. Its value is XML Schema builit-in datatype of instance node that XForms element is bound to. children Mozilla XForms implementation allows form control elements to have child elements. Therefore accessible children are formed from any accessible child elements of form control element and from elements that are introduced by its presentation. Forms Controls Module Some of form control elements may be represented in few ways by different widgets. This section lists accessible presentations fo...
...se one or multiple values from a list of pre-defined values (see the spec, the docs). It can have the following representations: listbox checkboxes group select1 Allows the user to choose a single value from a list of pre-defined values (see the spec, the docs). It can have the following representations: combobox listbox radio group Additional Elements These elements may be used as child elements to the form controls described above. Some of these elements are not accessible itself but they makes accessibility properties for XForms elements that hold them. label Specifies the label for the xforms control (see the spec, the docs). Every form control other than the output element must contain a label element. The value of label element is used as name of accessible object. help ...
Querying Places
, title, and other general info. nsINavHistoryVisitResultNode: Derived from nsINavHistoryResultNode, contains session information. nsINavHistoryFullVisitResultNode: Derived from nsINavHistoryVisitResultNode, contains information about how the user navigated to this page. Note: currently unimplemented, see bug 320831. nsINavHistoryContainerResultNode: General container node giving access to its children. Derived from nsINavHistoryResultNode. Bookmark folders are of this type. nsINavHistoryQueryResultNode: A type of container representing a query of the history system. It allows you to get the query options and parameters. Example of detecting the type of a node switch(node.type) { case node.RESULT_TYPE_URI: dump("URI result " + node.uri + "\n"); break; case node.RESULT_TYPE_VI...
...uri, title, time, icon...) // see : https://developer.mozilla.org/en/nsINavHistoryResultNode dump(node.title+ "\n"); } // Close container when done // see : https://developer.mozilla.org/en/nsINavHistoryContainerResultNode cont.containerOpen = false; See also Places query URIs ...
...uri, title, time, icon...) // see : https://developer.mozilla.org/en/nsINavHistoryResultNode dump(node.title+ "\n"); } // Close container when done // see : https://developer.mozilla.org/en/nsINavHistoryContainerResultNode cont.containerOpen = false; See also Places query URIs Displaying Places information using views ...
Avoiding leaks in JavaScript XPCOM components
The _filterRadioGroup object is a JavaScript function that is wrapped so that XPCOM code can use it. The reason closures matter here is that the _filterRadioGroup function has access to the iterator vari...
...The _filterRadioGroup object is a JavaScript function that is wrapped so that XPCOM code can use it. The reason closures matter here is that the _filterRadioGroup function has access to the iterator variable. (var declarations inside JavaScript functions are function-sc...
...The _filterRadioGroup object is a JavaScript function that is wrapped so that XPCOM code can use it. The reason closures matter here is that the _filterRadioGroup function has access to the iterator variable. (var declarations inside JavaScript functions are function-scope, including t...
nsIAccessibleStates
pports Last changed in Gecko 1.9 (Firefox 3) Prior to Gecko 1.9, these constants were implemented in nsIAccessible. Constants State constants MSAA State flags - used for bitfield. More than 1 allowed. Constant Value Description STATE_UNAVAILABLE 0x00000001 The object is unavailable, that is disabled. STATE_SELECTED 0x00000002 The object is selected, That is it indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. STATE_FOCUSED 0x00000004 The object is focused. STATE_PRESSED 0x00000008 The object is pressed. STATE_CHECKED 0x00000010 The object is checked. STATE_MIXED 0x00000020 Indicates that the state of a three-state check box or toolbar button is not determined. The check box...
... therefore in the third or mixed state. STATE_READONLY 0x00000040 The object is designated read-only. STATE_HOTTRACKED 0x00000080 The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Currently unused. STATE_DEFAULT 0x00000100 This state represents the default button in a window. STATE_EXPANDED 0x00000200 Children of this object that have the ROLE_OUTLINEITEM role are displayed. (See nsIAccessibleRole.Constants). STATE_COLLAPSED 0x00000400 Children of this object that have the ROLE_OUTLINEITEM role are hidden. (See nsIAccessibleRole.Constants). STATE_BUSY 0x00000800 The control cannot accept input at this time. STATE_FLOATING 0x00001000 Children "owned" not "contained" by parent. STATE_MARQUEED ...
...FSCREEN 0x00010000 Scrolled off. STATE_SIZEABLE 0x00020000 The object can be resized. For example, a user could change the size of a window by clicking the border with a mouse and dragging the mouse. STATE_MOVEABLE 0x00040000 The object can be moved. For example, a user can click on the titlebar for the object and drag the object to a new location. STATE_SELFVOICING 0x00080000 The object or child uses text-to-speech (TTS) technology for description purposes. A speech-based accessibility aid does not announce information when an object with this state has the focus because the object automatically announces information. Currently unused. STATE_FOCUSABLE 0x00100000 The object can be focused. STATE_SELECTABLE 0x00200000 The object can be selected. STATE_LINKED 0x00400000 The object is ...
nsIFile
0x80000000 Optional parameter used by openNSPRFileDesc Methods append() This function is used for constructing a descendant of the current nsIFile. Note: This method does not return a new nsIFile; it modifies the object it was called on. If the old nsIFile should be retained, use clone(). void append( in AString node ); Parameters node A string which is intended to be a child node of the nsIFile. This string must not contain a path separator character. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. Native code only! appendNative This method is used for constructing a descendant of the current nsIFile. [native character encoding variant] void appendNative( in ACString node ); P...
...path separator character. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. Native code only! appendNative This method is used for constructing a descendant of the current nsIFile. [native character encoding variant] void appendNative( in ACString node ); Parameters node A string that is intended to be a child node of the current nsIFile. This string must not contain a path separator character. This string must be encoded using the native character encoding. Exceptions thrown NS_ERROR_FILE_UNRECOGNIZED_PATH Indicates that aNode incorrectly contains a path separator character. clone() This method creates a clone of the nsIFile. (It does NOT clone the file itself; see the copy methods.) nsIFile...
...path represented by the specified nsIFile instance is a descendant of the path represented by this nsIFile. This nsIFile should point to a directory, while the specified argument can point to a file or directory. boolean contains( in nsIFile inFile ); Parameters inFile The nsIFile to test. Return value true if inFile is a descendant of this nsIFile. inFile does not need to be a direct child of this nsIFile to be considered a descendant. copyTo() This method copies a source file to a new location if it does not already exist. This method will NOT resolve aliases/shortcuts during the copy. void copyTo( in nsIFile newParentDir, in AString newName ); Parameters newParentDir This parameter specifies the parent directory to copy the file into. If this parameter is null, then...
nsINavHistoryQueryResultNode
vHistoryService.idlScriptable Used for Places queries and as a base class for bookmark folders. 1.0 66 Introduced Gecko 1.8 Inherits from: nsINavHistoryContainerResultNode Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Note: If you request that places not be expanded in the options that generated the node, the node will report that it has no children and will never try to populate itself. Method overview void getQueries([optional] out unsigned long queryCount, [retval,array,size_is(queryCount)] out nsINavHistoryQuery queries); Attributes Attribute Type Description folderItemId long long For both simple folder nodes and simple-folder-query nodes, this is set to the concrete itemId of the folder. Otherwise, this is set to -1. Read...
...onal] out unsigned long queryCount, [retval,array,size_is(queryCount)] out nsINavHistoryQuery queries); Attributes Attribute Type Description folderItemId long long For both simple folder nodes and simple-folder-query nodes, this is set to the concrete itemId of the folder. Otherwise, this is set to -1. Read only. queryOptions nsINavHistoryQueryOptions The options that group the node's children; only valid for RESULT_TYPE_QUERY nodes. Read only. Methods getQueries() Returns the queries that build the node's children; only valid for RESULT_TYPE_QUERY nodes. void getQueries( out unsigned long queryCount, Optional from Gecko 2.0 [retval,array,size_is(queryCount)] out nsINavHistoryQuery queries ); Parameters queryCount Optional from Gecko 2.0 The number of queries in the quer...
...There are queryCount elements in the array. ...
nsINavHistoryResultNode
es history result nodes, containing the URI, title, and other general information. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Attributes Attribute Type Description accessCount unsigned long Total number of times the URI has been accessed. For hosts, this is the total number of the children under it, rather than the total number of times the host has been accessed (getting that information would require an additional query, so for performance reasons that information isn't given by default). Read only. bookmarkIndex long When this item is in a bookmark folder (its parent is of type folder), this is the index into that folder at which this node resides. These indices start at 0 ...
...ion URI that will query the favicon service. If the entry doesn't have a favicon, this is the chrome URI of the default favicon. If the favicon originally lived in chrome, this will be the original chrome URI of the icon. Read only. Note: Prior to Gecko 1.9.2, this was an nsIURI. indentLevel long This is the number of levels between this node and the top of the hierarchy. The members of result.children have an indentLevel value of zero, their children have an indentLevel of 1, and so forth. The indent level of the root node is set to -1. Read only. itemId long long If the node is an item (bookmark, folder, or separator), this value is the row ID of that bookmark in the database. For other nodes, this value is set to -1. Read only. lastModified PRTime If the node is an item (bookmark, fo...
...is an empty string. Read only. time PRTime The time at which the user accessed the page. Read only. For visits, this is the exact time at which the page visit occurred. For URIs, this is the most recent time at which the URI was visited. Even if you ask for all URIs for a given date range long ago, this might contain today's date if the URI was visited today. For hosts, or other node types with children, this is the most recent access time for any of the children. For days, this is midnight on the morning of the day in question in UTC. title AUTF8String Title of the web page or of the node's grouping (day, host, folder, and so on.). Read only. type unsigned long Identifies the type of node. You can use QueryInterface to access the corresponding specialized result node interface. Read onl...
nsITreeBoxObject
alidateRow(in long index); void invalidateCell(in long row, in nsITreeColumn col); void invalidateRange(in long startIndex, in long endIndex); void invalidateColumnRange(in long startIndex, in long endIndex, in nsITreeColumn col); long getRowAt(in long x, in long y); void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); void getCoordsForCellItem(in long row, in nsITreeColumn col, in ACString element, out long x, out long y, out long width, out long height); boolean isCellCropped(in long row, in nsITreeColumn col); void rowCountChanged(in long index, in long count); void beginUpdateBatch(); void endUpdateBatch(); void clearStyleAndImageCaches(); Att...
... nsITreeView The view that backs the tree and that supplies it with its data. It is dynamically settable, either using a view attribute on the tree tag or by setting this attribute to a new value. focused boolean Whether or not we are currently focused. treeBody nsIDOMElement Readonly: Obtain the treebody content node. This is a node that corresponds to the treechildren tag. rowHeight long Readonly: Obtain the height of a row. rowWidth long Readonly: Obtain the width of a row. horizontalPosition long Readonly: Get the pixel position of the horizontal scrollbar. selectionRegion nsIScriptableRegion Readonly: Return the region for the visible parts of the selection, in device pixels. Methods getFi...
...g y); Parameters x The x coordinate y The y coordinate getCellAt() A hit test that can tell you what cell the mouse is over. Returns -1 for invalid mouse coordinates. The coordinate system is the client coordinate system for the document this boxObject lives in, and the units are CSS pixels. void getCellAt(in long x, in long y, out long row, out nsITreeColumn col, out ACString childElt); Parameters x The x coordinate y The y coordinate Returns row The row index at the coordinates col The nsITreeColumn hit. ChildElt The pseudoelement hit: this can have values of "cell", "twisty", "image", and "text". getCoordsForCellItem() Find the coordinates of an element within a specific cell. void getCoordsForCellItem(in long row, in nsITreeC...
nsIWebProgressListener
uriloader/base/nsIWebProgressListener.idlScriptable This interface is implemented by clients wishing to listen in on the progress associated with the loading of asynchronous requests in the context of a nsIWebProgress instance as well as any child nsIWebProgress instances. Inherits from: nsISupports Last changed in Gecko 15 (Firefox 15 / Thunderbird 15 / SeaMonkey 2.12) nsIWebProgress describes the parent-child relationship of nsIWebProgress instances. Method overview void onLocationChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation, [optional] in unsigned long aFlags); void onProgressChange(in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in lon...
...g indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags. Unlike STATE_IS_WINDOW, this flag is only set when activity within the nsIWebProgress instance being observed starts or stops. If activity only occurs in a child nsIWebProgress instance, then this flag will be set to indicate the start and stop of that activity. For example, in the case of navigation within a single frame of a HTML frameset, a nsIWebProgressListener instance attached to the nsIWebProgress of the frameset window will receive onStateChange() calls with the STATE_IS_NETWORK flag set to indicate the start and stop of said navigation. In o...
... For example, in the case of navigation within a single frame of a HTML frameset, a nsIWebProgressListener instance attached to the nsIWebProgress of the frameset window will receive onStateChange() calls with the STATE_IS_NETWORK flag set to indicate the start and stop of said navigation. In other words, an observer of an outer window can determine when activity, that may be constrained to a child window or set of child windows, starts and stops. STATE_IS_WINDOW 0x00080000 This flag indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags. This flag is similar to STATE_IS_DOCUMENT. However,...
nsIXULTemplateBuilder
d a reference point, generates a list of results from the input, and copies part of the template for each result. Templates may generate content recursively, using the same template, but with the previous iteration's results as the reference point. As an example, for an XML data source the initial reference point would be a specific node in the DOM tree and a template might generate a list of all child nodes. For the next iteration, those children would be used to generate output for their child nodes and so forth. A template builder is attached to a single DOM node; this node is called the root node and is expected to contain a XUL template element as a direct child. Different template builders may be specialized in the manner in which they generate and display the resulting content from the t...
... root node is used to identify the source of data to be used. The ref attribute is used to specify the reference point for the query. The <queryset> element contains a single query and one or more <rule> elements. There may be more than one <queryset> if multiple queries are desired, and this element is optional if only one query is needed -- in that case the <query> and <rule>s are allowed to be children of the <template> node. The contents of the query are processed by a separate component called a query processor. This query processor is expected to use this query to generate results when asked by the template builder. The template builder then generates output for each result based on the <rule> elements. This allows the query processor to be specific to a particular kind of input data or q...
...lled to initialize a XUL content builder on a particular root element. This element presumably has a datasources attribute, which the builder will parse to set up the template builder's data sources. [noscript] void init( in nsIContent aElement ); Parameters aElement The root element from which to derive the data. Native code only!createContents Invoked lazily by a XUL element that needs its child content built. [noscript] void createContents( in nsIContent aElement, in boolean aForceCreation ); Parameters aElement The element whose contents need to be built. aForceCreation If true, the contents of the element are generated even if the element is closed; this behavior is used with menus. If false, the element's contents are only generated if it's open. addListener() Adds a listener t...
Break on DOM mutation - Firefox Developer Tools
DOM node on which you have set the breakpoint is modified. You set a DOM Mutation Breakpoint in the Page Inspector. Navigate to the DOM node in which you are interested and use the context menu to set the breakpoint. There are three choices: Subtree Modification Execution pauses if any of the element's descendant nodes are modified. That means, the script execution is stopped whenever a child node or descendant node deeper in the DOM structure is added to or removed from the element the option is set on. Examples for when this breakpoint is triggered are calling Node.appendChild() and Node.removeChild(), calling ChildNode.remove() or setting Element.innerHTML on one of the subnodes. Attribute Modification Execution pauses when any of the elements' attributes are modified. That m...
...n is set on or the value of one of its attributes is changed. Examples for when this breakpoint is triggered are calling Element.setAttribute(), Element.removeAttribute(), and Element.classList.add(), or setting Element.id. Node Removal Execution pauses if the element the option is set on is removed. Examples for when this breakpoint is triggered are calling Element.remove() or Node.removeChild() on its parent node. Once you set the breakpoint, go to the Debugger. You can see the breakpoint listed in the right-most panel under DOM Mutation Breakpoints. Click on the icon following the node name to go back to the Page Inspector with the node selected. When you execute the code, the debugger will pause execution when the DOM mutation occurs. In the following example, the selected nod...
...t, go to the Debugger. You can see the breakpoint listed in the right-most panel under DOM Mutation Breakpoints. Click on the icon following the node name to go back to the Page Inspector with the node selected. When you execute the code, the debugger will pause execution when the DOM mutation occurs. In the following example, the selected node (the unordered list) is modified by adding a new child node. The panel on the right shows that execution is "Paused on DOM mutation" and you, as with any other breakpoint, you can see the call stack and view any Watch expressions you may have set up. Inline variable preview New in Firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. See Set a breakpoint > Inline variable previ...
Background Tasks API - Web APIs
We'll use that to determine if we should update the scroll position to ensure that the log stays at the e...
...umber of tasks processed so far; if progressBarElem.value is different from the task number currently being processed (currentTaskNumber), then we update the displayed value of the currently-being-processed task and the current value of the progress bar. Then, if there's text waiting to be added to the log (that is, if logFragment isn't null), we append it to the log element using Element.appendChild() and set logFragment to null so we don't add it again. If the log was scrolled to the end when we started, we make sure it still is. Then we set statusRefreshScheduled to false to indicate that we've handled the refresh and that it's safe to request a new one. Adding text to the log The log() function adds the specified text to the log. Since we don't know at the time log() is called whether ...
... will cache the log text until it's safe to update. Above, in the code for updateDisplay(), you can find the code that actually adds the logged text to the log element when the animation frame is being updated. function log(text) { if (!logFragment) { logFragment = document.createDocumentFragment(); } let el = document.createElement("div"); el.innerHTML = text; logFragment.appendChild(el); } First, we create a DocumentFragment object named logFragment if one doesn't currently exist. This element is a pseudo-DOM into which we can insert elements without immediately changing the main DOM itself. We then create a new <div> element and set its contents to match the input text. Then we append the new element to the end of the pseudo-DOM in logFragment. logFragment will accumulat...
CustomElementRegistry.define() - Web APIs
e('class','info'); // Take attribute content and put it inside 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 var style = document.createElement('style'); style.textContent = '.wrapper {' + 'position: relative;' + '}' + '.info {' + 'font-size: 0.8rem;' + 'width: 200px;' + 'display:...
... 'z-index: 3;' + '}' + 'img {' + 'width: 1.2rem' + '}' + '.icon:hover + .info, .icon:focus + .info {' + 'opacity: 1;' + '}'; // attach the created elements to the shadow dom shadow.appendChild(style); shadow.appendChild(wrapper); wrapper.appendChild(icon); wrapper.appendChild(info); } } // Define the new element customElements.define('popup-info', PopUpInfo); <popup-info img="img/alt.png" text="Your card validation code (CVC) is an extra security feature -- it is the last 3 or 4 numbers on the back...
...ext = node.innerText || node.textContent return text.split(/\s+/g).length; } var count = 'Words: ' + countWords(wcParent); // Create a shadow root var shadow = this.attachShadow({mode: 'open'}); // Create text node and add word count to it var text = document.createElement('span'); text.textContent = count; // Append it to the shadow root shadow.appendChild(text); // Update count when element content changes setInterval(function() { var count = 'Words: ' + countWords(wcParent); text.textContent = count; }, 200) } } // Define the new element customElements.define('word-count', WordCount, { extends: 'p' }); <p is="word-count"></p> Specifications Specification Status Comment HTML Living StandardT...
Document.createElementNS() - Web APIs
This particular example is actually an XUL document with embedded XHTML, however,...
...This particular example is actually an XUL document with embedded XHTML, however, the recommendation still ...
...This particular example is actually an XUL document with embedded XHTML, however, the recommendation still applies. Specifications ...
Document.importNode() - Web APIs
Unlike document.adoptNode(), the original node is not removed from its original document. The imported node is a clone of the original. ...
...eep]); Parameters externalNode The external Node or DocumentFragment to import into the current document. deep Optional A Boolean which controls whether to include the entire DOM subtree of the externalNode in the import. If deep is set to true, then externalNode and all of its descendants are copied. If deep is set to false, then only externalNode is imported -- the new node has no children. Note: In the DOM4 specification, deep was an optional argument with a default value of true. This default has changed in the latest spec! The new default value is false. Best Practice: Though it's still an optional argument, you should always provide the deep argument for backward and forward compatibility. With Gecko 28.0 (Firefox 28 / Thunderbird 28 / SeaMonkey 2.25 / Firefox...
... The copied importedNode in the scope of the importing document. Note: importedNode's Node.parentNode is null, since it has not yet been inserted into the document tree! Example const iframe = document.querySelector("iframe"); const oldNode = iframe.contentWindow.document.getElementById("myNode"); const newNode = document.importNode(oldNode, true); document.getElementById("container").appendChild(newNode); Notes Before they can be inserted into the current document, nodes from external documents should either be: cloned using document.importNode(); or adopted using document.adoptNode(). Best Practice: Although Firefox doesn't currently enforce this rule, we encourage you to follow this rule for improved future compatibility. For more on the Node.ownerDocument issues, see the W...
How to create a DOM tree - Web APIs
); personElem1.setAttribute("first-name", "eric"); personElem1.setAttribute("middle-initial", "h"); personElem1.setAttribute("last-name", "jung"); var addressElem1 = doc.createElement("address"); addressElem1.setAttribute("street", "321 south st"); addressElem1.setAttribute("city", "denver"); addressElem1.setAttribute("state", "co"); addressElem1.setAttribute("country", "usa"); personElem1.appendChild(addressElem1); var addressElem2 = doc.createElement("address"); addressElem2.setAttribute("street", "123 main st"); addressElem2.setAttribute("city", "arlington"); addressElem2.setAttribute("state", "ma"); addressElem2.setAttribute("country", "usa"); personElem1.appendChild(addressElem2); var personElem2 = doc.createElement("person"); personElem2.setAttribute("first-name", "jed"); personElem2.s...
...); var personElem2 = doc.createElement("person"); personElem2.setAttribute("first-name", "jed"); personElem2.setAttribute("last-name", "brown"); var addressElem3 = doc.createElement("address"); addressElem3.setAttribute("street", "321 north st"); addressElem3.setAttribute("city", "atlanta"); addressElem3.setAttribute("state", "ga"); addressElem3.setAttribute("country", "usa"); personElem2.appendChild(addressElem3); var addressElem4 = doc.createElement("address"); addressElem4.setAttribute("street", "123 west st"); addressElem4.setAttribute("city", "seattle"); addressElem4.setAttribute("state", "wa"); addressElem4.setAttribute("country", "usa"); personElem2.appendChild(addressElem4); var addressElem5 = doc.createElement("address"); addressElem5.setAttribute("street", "321 south avenue"); add...
...ty", "seattle"); addressElem4.setAttribute("state", "wa"); addressElem4.setAttribute("country", "usa"); personElem2.appendChild(addressElem4); var addressElem5 = doc.createElement("address"); addressElem5.setAttribute("street", "321 south avenue"); addressElem5.setAttribute("city", "denver"); addressElem5.setAttribute("state", "co"); addressElem5.setAttribute("country", "usa"); personElem2.appendChild(addressElem5); peopleElem.appendChild(personElem1); peopleElem.appendChild(personElem2); doc.appendChild(peopleElem); See also the DOM chapter of the XUL Tutorial. You can automate the creation of a DOM tree using a JXON reverse algorithm in association with the following JSON representation: { "people": { "person": [{ "address": [{ "@street": "321 south st", "@c...
Example - Web APIs
<html> <head> <title>My Document</title> <script type="text/javascript"> function change() { // document.getElementsByTagName("H1") returns a NodeList of the h1 // elements in the document, and the first is number 0: var header = document.getElementsByTagName("H1").item(0); // the firstChild of the header is a Text node: header.firstChild.data = "A dynamic document"; // now the header is "A dynamic document". ...
...ntsByTagName("H1") returns a NodeList of the h1 // elements in the document, and the first is number 0: var header = document.getElementsByTagName("H1").item(0); // the firstChild of the header is a Text node: header.firstChild.data = "A dynamic document"; // now the header is "A dynamic document". ...
...ment.getElementsByTagName("P").item(0); para.firstChild.data = "This is the first paragraph."; // create a new Text node for the second paragraph var newText = document.createTextNode("This is the second paragraph."); // create a new Element to be the second paragraph var newElement = document.createElement("P"); // put the text in the paragraph newElement.appendChild(newText); // and put the paragraph on the end of the document by appending it to // the BODY (which is the parent of para) para.parentNode.appendChild(newElement); } </script> </head> <body> <input type="button" value="Change this document." onclick="change()"> <h1>Header</h1> <p>Paragraph</p> </body> </head> ...
Element: mouseout event - Web APIs
Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmouseout Examples The following examples show the use of the mouseout event. ...
... Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmouseout Examples The following examples show the use of the mouseout event. ...
... Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmouseout Examples The following examples show the use of the mouseout event. ...
Element.outerHTML - Web APIs
Web › API › Element › outerHTML
rialization of the element and its descendants. Setting the value of outerHTML replaces the element and all of its descendants with a new DOM tree constructed by parsing the specified htmlString. Exceptions SyntaxError An attempt was made to set outerHTML using an HTML string which is not valid. NoModificationAllowedError An attempt was made to set outerHTML on an element which is a direct child of a Document, such as Document.documentElement. Examples Getting the value of an element's outerHTML property: HTML <div id="d"> <p>Content</p> <p>Further Elaborated</p> </div> Javascript var d = document.getElementById("d"); console.log(d.outerHTML); // The string '<div id="d"><p>Content</p><p>Further Elaborated</p></div>' // is written to the console window Replacing a node by se...
... Notes If the element has no parent element, setting its outerHTML property will not change it or its descendants. Many browsers will also throw an exception. ...
...e console window Replacing a node by setting the outerHTML property: HTML <div id="container"> <div id="d">This is a div.</div> </div> Javascript var container = document.getElementById("container"); var d = document.getElementById("d"); console.log(container.firstChild.nodeName); // logs "DIV" d.outerHTML = "<p>This paragraph replaced the original div.</p>"; console.log(container.firstChild.nodeName); // logs "P" // The #d div is no longer part of the document tree, // the new paragraph replaced it. Notes If the element has no parent element, setting its outerHTML property will not change it or its descendants. Many browsers will also throw an exception. For example: var div = document.createElement("div"); div.outerHTML = "<div class=\"test\">test</div>"; console.log(div.outer...
Element.part - Web APIs
Web › API › Element › part
e parts of a shadow DOM, via the ::part pseudo-element. Syntax let elementPartList = element.part Examples The following excerpt is from our shadow-part example. Here the part attribute is used to find the shadow parts, and the part property is then used to change the part identifiers of each tab so the correct styling is applied to the active tab when tabs are clicked. ...
...a the ::part pseudo-element. Syntax let elementPartList = element.part Examples The following excerpt is from our shadow-part example. Here the part attribute is used to find the shadow parts, and the part property is then used to change the part identifiers of each tab so the correct styling is applied to the active tab when tabs are clicked. ...
.... Syntax let elementPartList = element.part Examples The following excerpt is from our shadow-part example. Here the part attribute is used to find the shadow parts, and the part property is then used to change the part identifiers of each tab so the correct styling is applied to the active tab when tabs are clicked. ...
Event.target - Web APIs
Web › API › Event › target
bject onto which the event was dispatched. It is different from Event.currentTarget when the event handler is called during the bubbling or capturing phase of the event. Syntax const theTarget = someEvent.target; Value EventTarget Example The event.target property can be used in order to implement event delegation. ...
...r is called during the bubbling or capturing phase of the event. Syntax const theTarget = someEvent.target; Value EventTarget Example The event.target property can be used in order to implement event delegation. ...
...e bubbling or capturing phase of the event. Syntax const theTarget = someEvent.target; Value EventTarget Example The event.target property can be used in order to implement event delegation. ...
EventTarget.addEventListener() - Web APIs
Web Incubator Community Group. Examples Add a simple listener This example demonstrates how to use addEventListener() to watch for mouse clicks on an element. HTML <table id="outside"> <tr><td id="t1">one</td></tr> <tr><td id="t2">two</td></tr> </table> JavaScript // Function to change the content of t2 function modifyText() { const t2 = document.getElementById("t2"); if (t2.firstChild.nodeValue == "three") { t2.firstChild.nodeValue = "two"; } else { t2.firstChild.nodeValue = "three"; } } // Add event listener to table const el = document.getElementById("outside"); el.addEventListener("click", modifyText, false); In this code, modifyText() is a listener for click events registered using addEventListener(). A click anywhere in the table bubbles up to the handler a...
...t(). Result Event listener with anonymous function Here, we'll take a look at how to use an anonymous function to pass parameters into the event listener. HTML <table id="outside"> <tr><td id="t1">one</td></tr> <tr><td id="t2">two</td></tr> </table> JavaScript // Function to change the content of t2 function modifyText(new_text) { const t2 = document.getElementById("t2"); t2.firstChild.nodeValue = new_text; } // Function to add event listener to table const el = document.getElementById("outside"); el.addEventListener("click", function(){modifyText("four")}, false); Notice that the listener is an anonymous function that encapsulates code that is then, in turn, able to send parameters to the modifyText() function, which is responsible for actually responding to the event. Res...
...g to the event. Result Event listener with an arrow function This example demonstrates a simple event listener implemented using arrow function notation. HTML <table id="outside"> <tr><td id="t1">one</td></tr> <tr><td id="t2">two</td></tr> </table> JavaScript // Function to change the content of t2 function modifyText(new_text) { const t2 = document.getElementById("t2"); t2.firstChild.nodeValue = new_text; } // Add event listener to table with an arrow function const el = document.getElementById("outside"); el.addEventListener("click", () => { modifyText("four"); }, false); Result Please note that while anonymous and arrow functions are similar, they have different this bindings. While anonymous (and all traditional JavaScript functions) create their own this bindings, a...
FileSystemEntrySync - Web APIs
. Moving a file over an existing file replaces that existing file. Moving a directory over an existing empty directory replaces that directory. [todo: What if the directory is not empty? ] [todo: Verify ] This is the same method for renaming files. You can keep it in the same location and then define the newName parameter. You cannot do the following: Move a directory inside itself or to any child at any depth Move an entry into its parent if a name different from its current one isn't provided Move a file to a path occupied by a directory or move a directory to a path occupied by a file Move any element to a path occupied by a directory that is not empty. FileSystemEntrySync moveTo ( in DirectoryEntrySync parent, optional DOMString newName ) raises (FileException); Parameters p...
...se at least one of the characters is reserved or illegal. Examples include a backslash (\), dot (.), and two dots (..). NOT_FOUND_ERR The target directory does not exist. INVALID_MODIFICATION_ERR You tried one of the following disallowed operations: Moving an entry into its parent without changing its name Moving a parent directory into one of its child directories. [todo: verify ] NO_MODIFICATION_ALLOWED_ERR One of the following is not writable: the source entry, its parent directory, and the target directory. copyTo() Copy an entry to a different location on the file system. You cannot copy an entry inside itself if it is a directory, nor can you copy it into its parent without providing a new name. Directory copie...
...se at least one of the characters is reserved or illegal. Examples include a backslash (\), dot (.), and two dots (..). NOT_FOUND_ERR The target directory does not exist. INVALID_MODIFICATION_ERR You tried one of the following disallowed operations: Moving an entry into its parent without changing its name Moving a parent directory into one of its child directories. NO_MODIFICATION_ALLOWED_ERR One of the following is not writable: the source entry, its parent directory, and the target directory. QUOTA_EXCEEDED_ERR The operation would cause the application to exceed its storage quota. You can ask for a larger persistent storage, which your user must explicitly grant. For more information, see the article on basic...
HTMLFormElement - Web APIs
ated. Named inputs are added to their owner form instance as properties, and can overwrite native properties if they share the same name (e.g. a form with an input named action will have its action property return that input instead of the form's action HTML attribute). Methods This interface also inherits methods from its parent, HTMLElement. checkValidity() Returns true if the element's child controls are subject to constraint validation and satisfy those contraints; returns false if some controls do not satisfy their constraints. Fires an event named invalid at any control that does not satisfy its constraints; such controls are considered invalid if the event is not canceled. It is up to the programmer to decide how to respond to false. reportValidity() Returns true if the element...
...ntrols are subject to constraint validation and satisfy those contraints; returns false if some controls do not satisfy their constraints. Fires an event named invalid at any control that does not satisfy its constraints; such controls are considered invalid if the event is not canceled. It is up to the programmer to decide how to respond to false. reportValidity() Returns true if the element's child controls satisfy their validation constraints. When false is returned, cancelable invalid events are fired for each invalid child and validation problems are reported to the user. requestSubmit() Requests that the form be submitted using the specified submit button and its corresponding configuration. reset() Resets the form to its initial state. submit() Submits the form to the server. D...
...omitted for historical reasons) <object> <output> <select> <textarea> No other elements are included in the list returned by elements, which makes it an excellent way to get at the elements most important when processing forms. ...
HTMLTableRowElement.insertCell() - Web APIs
You can not use insertCell() to create a new <th> element though. ...
... defaults to -1. Return value newCell is an HTMLTableCellElement that references the new cell. Example This example uses HTMLTableElement.insertRow() to append a new row to a table. We then use insertCell(0) to insert a new cell in the new row. (To be valid HTML, a <tr> must have at least one <td> element.) Finally, we add some text to the cell using Document.createTextNode() and Node.appendChild(). HTML <table id="my-table"> <tr><td>Row 1</td></tr> <tr><td>Row 2</td></tr> <tr><td>Row 3</td></tr> </table> JavaScript function addRow(tableID) { // Get a reference to the table let tableRef = document.getElementById(tableID); // Insert a row at the end of the table let newRow = tableRef.insertRow(-1); // Insert a cell in the row at index 0 let newCell = newRow.insertCe...
... Living Standard Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLTableRowElement.insertCell()' in that sp...
MediaDevices.ondevicechange - Web APIs
The fulfillment handler is called when t...
...The fulfillment handler is called when the device list is ready. The list is passed into the fulfillment handler a...
...dia type and the direction the media flows, such as "audioinput" or "videooutput". This line, then, pulls out the type ("audio" or "video") and direction ("input" or "output") so they can be used to construct the string displayed in the list. Once the string is assembled, containing the device's name in bold and the direction in parentheses, it's appended to the appropriate list by calling appendChild() on either audioList or videoList, as appropriate based on the device type. Handling device list changes We call updateDeviceList() in two places. The first is in the getUserMedia() promise's fulfillment handler, to initially fill out the list when the stream is opened. The second is in the event handler for devicechange: navigator.mediaDevices.ondevicechange = function(event) { updateDevic...
Node.normalize() - Web APIs
Web › API › Node › normalize
The Node.normalize() method puts the specified node and all of its sub-tree into a "normalized" form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes. ...
... The Node.normalize() method puts the specified node and all of its sub-tree into a "normalized" form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes. ...
...pecified node and all of its sub-tree into a "normalized" form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes. Syntax element.normalize(); Example let wrapper = document.createElement("div"); wrapper.appendChild( document.createTextNode("Part 1 ") ); wrapper.appendChild( document.createTextNode("Part 2 ") ); // At this point, wrapper.childNodes.length === 2 // wrapper.childNodes[0].textContent === "Part 1 " // wrapper.childNodes[1].textContent === "Part 2 " wrapper.normalize(); // Now, wrapper.childNodes.length === 1 // wrapper.childNodes[0].textContent === "Part 1 Part 2 " Specifications Specification Status Comment DOMThe definition of 'Node: normalize' in that specification. Living Standard ...
NodeFilter.acceptNode() - Web APIs
ation algorithm. This method is expected to be written by the user of a NodeFilter. Possible return values are: Constant Description NodeFilter.FILTER_ACCEPT Value returned by the NodeFilter.acceptNode() method when a node should be accepted. NodeFilter.FILTER_REJECT Value to be returned by the NodeFilter.acceptNode() method when a node should be rejected. ...
...ription NodeFilter.FILTER_ACCEPT Value returned by the NodeFilter.acceptNode() method when a node should be accepted. NodeFilter.FILTER_REJECT Value to be returned by the NodeFilter.acceptNode() method when a node should be rejected. The children of rejected nodes are not visited by the NodeIterator or TreeWalker object; this value is treated as "skip this node and all its children". NodeFilter.FILTER_SKIP Value to be returned by NodeFilter.acceptNode() for nodes to be skipped by the NodeIterator or TreeWalker object. The children of skipped nodes are still considered. This is treated as "skip this node but not its children". The function should return NodeFilter.FILTER_ACCEPT, which causes the TreeWalker to return the node, NodeFilter.FILTER_REJECT, w...
... Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range Specification Document Object Model (DOM) Level 2 Traversal and Range Specif...
Range.setStart() - Web APIs
Web › API › Range › setStart
Setting the start point below (lower in the document) the end point will result in a collapsed range with the start and end points both set to the specified start position. ...
...ted using Range.surroundContents(). The address contains nine nodes: five text nodes, and four <br> elements. HTML <p id="address">Wyatt Earp<br> 101 E. Main St.<br> Dodge City, KS<br> 67801<br> USA</p> <hr> <p>Nodes in the original address:</p> <ol id="log"></ol> JavaScript const address = document.getElementById('address'); const log = document.getElementById('log'); // Log info address.childNodes.forEach(node => { const li = document.createElement('li'); li.textContent = `${node.nodeName}, ${node.nodeValue}`; log.appendChild(li); }); // Highlight the street and city const startOffset = 2; // Start at third node: 101 E. Main St. const endOffset = 5; // End at fifth node: Dodge City, KS const range = document.createRange(); range.setStart(address, startOffset); range.setEnd(...
...e.surroundContents(mark); Result Get characters from a text node This example uses the Range.setStart() and Range.setEnd() methods to define the contents of a range. The resulting range contains the first through fifth characters within a text node. HTML <p id="content">0123456789</p> <p id="log"></p> JavaScript const element = document.getElementById('content'); const textNode = element.childNodes[0]; const range = document.createRange(); range.setStart(textNode, 0); // Start at first character range.setEnd(textNode, 5); // End at fifth character document.getElementById('log').textContent = range; Result Specifications Specification Status Comment DOMThe definition of 'Range.setStart()' in that specification. Living Standard No change. D...
Selection.setBaseAndExtent() - Web APIs
The setBaseAndExtent() method of the Selection interface sets the selection to be a range including all or parts of two specified DOM nodes, and any content located between them. Syntax sel.setBaseAndExtent(anchorNode,anchorOffset,focusNode,focusOffset) Parameters anchorNode The node at the start of the selection. anchorOffset The number of child nodes from the start of the anchor node that should be excluded from the selection. So for example, if the value is 0 the whole node is included. If the value is 1, the whole node minus the first child node is included. And so on. focusNode The node at the end of the selection. focusOffset The number of child nodes from the start of the focus node that should be included in the selection. So for example, if the value is 0 the w...
...And so on. Note: If the focus position appears before the anchor position in the document, the direction of the selection is reversed -- the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow. ...
...before the anchor position in the document, the direction of the selection is reversed -- the caret is placed at the beginning of the text rather the end, which matters for any keyboard command that might follow. For example, Shift + ? would cause the selection to narrow from the beginning rather than grow at the end. Return Value Void. Exceptions If anchorOffset is larger than the number of child nodes inside anchorNode, or if focusOffset is larger than the number of child nodes inside focusNode, an IndexSizeError exception is thrown. Examples In this example, we have two paragraphs containing spans, each one containing a single word. The first one is set as the anchorNode and the second is set as the focusNode. We also have an additional paragraph that sits in between the two nodes. N...
Example and tutorial: Simple synth keyboard - Web APIs
kip any that are sharp or flat; for // our purposes we don't need them. Each octave is inserted // into a <div> of class "octave". ...
...ach octave is inserted // into a <div> of class "octave". ...
...ents we care about. ...
Window: unload event - Web APIs
The unload event is fired when the document or a child resource is being unloaded. Bubbles No Cancelable No Interface Event Event handler property onunload It is fired after: beforeunload (cancelable event) pagehide The document is in the following state: All the resources still exist (img, iframe etc.) Nothing is visible anymore to the end user UI interactions are ineffective (window.open, alert, confirm, etc.) An error won't stop the unloading workflow Please note that the unload event also follows the document tree: parent frame unload will happen before child frame unload (see example below). Examples <!DOCTYPE html> <html> <head> <title>Parent Frame</title> <script> window.addEventListener('beforeunloa...
...d frame unload (see example below). ...
... <head> <title>Parent Frame</title> <script> window.addEventListener('beforeunload', function(event) { console.log('I am the 1st one.'); }); window.addEventListener('unload', function(event) { console.log('I am the 3rd one.'); }); </script> </head> <body> <iframe src="child-frame.html"></iframe> </body> </html> Below, the content of child-frame.html: <!DOCTYPE html> <html> <head> <title>Child Frame</title> <script> window.addEventListener('beforeunload', function(event) { console.log('I am the 2nd one.'); }); window.addEventListener('unload', function(event) { console.log('I am the 4th and last one...'); }); </script> </head> <body> :) </body> </html> When the par...
Using the aria-activedescendant attribute - Accessibility
This article describes the aria-activedescendant property. Description The aria-activedescendant attribute contains the ID of the currently active child object that is part of a composite widget within the Document Object Model. It makes do with the overhead of having all or more than one child focusable. As the name specifies, it helps in managing the current active child of the composite widget. ...
... Note: Opinions may differ on how assistive technology should handle this technique. The information provided below is one of those opinions and therefore not normative. ...
... Note: Opinions may differ on how assistive technology should handle this technique. The information provided below is one of those opinions and therefore not normative. ...
ARIA Test Cases - Accessibility
Orca - - - - Img Tiled image Expected AT Behavior: Screen readers should announce the image is a single graphic element along with its associated label, even though it is built from numerous sub-images. Markup used: role="img" Notes: If the screen reader does not provide the required behavior, then most likely it is a browser issue, for not respecting "Children Presentational: true" for that role. The accessible hierarchy should contain no children for the img. Results: AT Firefox IE Opera Safari JAWS 9 - - n/a n/a JAWS 10 - - - - VoiceOver (Leopard) n/a n/a - fail Window-Eyes - - - - NVDA - n/a - - Zoom (Leopard) ...
...ole and position of the slider. When not in a virtual buffer mode, the user can control the slider using keys such as the arrow keys, home and end. In virtual buffer mode, the slider exists in the virtual buffer as a single entity, and any images or text that create the sliders appearance are not presented to the user separately. ...
...n not in a virtual buffer mode, the user can control the slider using keys such as the arrow keys, home and end. In virtual buffer mode, the slider exists in the virtual buffer as a single entity, and any images or text that create the sliders appearance are not presented to the user separately. ...
ARIA: row role - Accessibility
nheaders, or rowheaders within a static tabular structure. Using native HTML <tr> elements, whenever possible, is strongly encouraged. To create an ARIA row, add role="row" to the container element. That row should be nested within a grid, table or treegrid. A group of rows can be nested within a grid, table or treegrid directly, or within a rowgroup in one of those containers. Each row contains child cells. These cells can be of different types, depending on whether they are column or row headers, or grid or regular cells. A row can contain a number of attributes clarifying the row's role, including aria-colindex, aria-level, aria-rowindex, and aria-selected. If the row is within a treegrid, rows can include the aria-expanded attribute, using the attribute to indicate the present status. Th...
...ia-selected attribute can take one of three values, or be omitted: aria-selected="true: Row is currently selected aria-selected="false": Row is not currently selected. aria-selected="undefined" or the attribute is missing: The row is not selectable. aria-colindex attribute The aria-colindex attribute is only needed if columns are hidden from the DOM. It is generally placed on row children, rather than on the row itself. If the columns displayed are contiguous, then it can be placed on the row. The attribute takes as its value an integer between 1 and the total number of columns within the table, grid or treegrid. When placed on the row, the aria-colindex defines an element's column index or position with respect to the total number of columns within a row. For example, in ...
...defines an element's column index or position with respect to the total number of columns within a row. For example, in a table with 15 columns, and columns 4, 5, and 6 are in the DOM, aria-colindex="4" could be set on every row. If the set of columns which is present in the DOM is not contiguous, or if there are cells spanning more than one row or column, put the aria-colindex on all of the children of each row instead of on the row itself. If all the columns are in the DOM, this attribute is not necessary. aria-rowindex attribute The aria-rowindex attribute is only needed if rows are hidden from the DOM, to indicate which row, in the list of total rows, is being read. The attribute, placed with a unique value on each row, takes as its value an integer between 1 and the total numb...
ARIA: listbox role - Accessibility
The listbox role is used for lists from which a user may select one or more items which are static and, unlike HTML <select> elements, may contain images. Description The listbox role is used to identify an element that creates a list from which a user may select one or more static items, similar to the HTML <select> element. Unlike <select>, a listbox can contain images. Each child of a listbox should have a role of option. It is highly recommended to use the HTML select element, or a group of radio buttons if only one item can be selected, or a group of checkboxes if multiple items can be selected, because there is a lot of keyboard interactivity to manage focus for all the descendants, and native HTML elements provide this functionality for you for free. Elements with the role lis...
... of the most recently interacted with option, regardless of whether that option has an aria-selected value of true or not. Takes the value of only one id, even in a multiselectable listbox. If the id does not refer to a DOM descendant of the listbox, then that id must be included among the IDs in the aria-owns attrubute. aria-owns This is a space-separated list of element IDs which are not DOM child elements of the listbox. IDs listed here cannot also be listed in aria-owns attributes of any other elements. aria-multiselectable Include and set to true if the user can select more than one option. If set to true, every selectable option should have an aria-selected attribute included and set to true or false. Options which are not selectable should not have the aria-selected attribute. If...
... To be keyboard accessible, authors should manage focus of all descendants of this role. It is recommended that authors use different styling for the selection when the list is not focused, e.g. a non-active selection is often shown with a lighter background colour. If the listbox is not part of another widget, it should have the aria-labelledby property set. If one or more entries are not DOM children of listbox, additional aria-* properties will need to be set (see ARIA Best Practices). If there is a valid reason to expand the listbox, the combobox role may be more appropriate. Specifications Specification Status Accessible Rich Internet Applications (WAI-ARIA) 1.1The definition of 'ARIA listbox role' in that specification. Recommendation WAI-ARIA Autho...
:-moz-last-node - CSS: Cascading Style Sheets
Note: Any whitespace at the end of an element is ignored for the determination of :-moz-last-node. ...
... Note: Any whitespace at the end of an element is ignored for the determination of :-moz-last-node. ...
... Note: Any whitespace at the end of an element is ignored for the determination of :-moz-last-node. ...
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
ample</context-span></a></h1> Inside 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(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ...
...eds to be set to true). ...
...om.webcomponents.shadowdom.enabled preference (needs to be set to true). ...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
gin property considers 5% 5% valid: @supports (transform-origin: 5% 5%) {} Function syntax The second basic supports condition is a supports function, the syntax for these is supported by all browsers, but the functions themselves are still being standardized. selector() Tests if the browser supports the tested selector syntax. The following example returns true if the browser supports the child combinator: @supports selector(A > B) {} The not operator The not operator can precede any expression to create a new expression, resulting in the negation of the original one. The following example returns true if the browser's transform-origin property doesn't consider 10em 10em 10em valid: @supports not (transform-origin: 10em 10em 10em) {} As with any operator, the not operator can be ap...
... of a selector (eg. :is()) /* This rule won't be applied in browsers which don't support :is() */ :is(ul, ol) > li { ... /* CSS applied when the :is(...) selector is supported */ } @supports not selector(:is(a, b)) { /* Fallback for when :is() is unsupported */ ul > li, ol > li { ... ...
.../ } @supports not selector(:is(a, b)) { /* Fallback for when :is() is unsupported */ ul > li, ol > li { ... /* The above expanded for browsers which don't support :is(...) */ } } @supports selector(:nth-child(1n of a, b)) { /* This rule needs to be inside the @supports block, otherwise it will be partially applied in browsers which don't support the `of` argument of :nth-child(...) is supported */ :is(:nth-child(1n of ul, ol) a, details > summary) { ... /* CSS applied when the :is(...) selector and the `of` argument of :nth-child(...) are both supported */ } } Specifications Specification Status Comment CSS Conditional Rules Module Level 4The definition of '@supports' in that specification. Editor's Draft Adds the...
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
This means that you can set the property individually, by using align-self on a grid item. In this next example, I am using th...
...This means that you can set the property individually, by using align-self on a grid item. In this next example, I am using the align-self property, to demonstrate the different alignment values. ...
... items which have an intrinsic aspect ratio, in this case they behave as start. The reason for this, is that if items with an aspect ratio are set to stretch, this default would distort them. This behavior has now been clarified in the specification, with browsers yet to implement the correct behavior. Until that happens, you can ensure that items do not stretch, such as images, which are direct children of the grid, by setting align-self and justify-self to start. This will mimic the correct behavior once implemented. Justifying Items on the Inline Axis As align-items and align-self deal with the alignment of items on the block axis, justify-items and justify-self do the same job on the inline axis. The values you can choose from are the same as for align-self. auto normal start end ...
Subgrid - CSS: Cascading Style Sheets
fication includes a subgrid value for grid-template-columns and grid-template-rows. This guide details what subgrid does, and gives some use cases and design patterns that are solved by the feature. Important: This feature is shipped in Firefox 71, which is currently the only browser to implement subgrid. Introduction to subgrid When you add display: grid to a grid container, only the direct children become grid items and can then be placed on the grid that you have created. The children of these items display in normal flow. You can "nest" grids by making a grid item a grid container. These grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. This makes it difficult to line nested grid items up with the...
...omponent that may be placed in different positions on the main grid, knowing that the line numbers on the component will always be the same. Subgrid for rows The next example is the same setup, however we are using subgrid as the value of grid-template-rows and defining explicit column tracks. So the column tracks behave as a regular nested grid, but the rows are tied to the two tracks that the child spans. A subgrid in both dimensions You can of course define both rows and columns as a subgrid, as in the example below. This means that your subgrid is tied in both dimensions to the number of tracks on the parent. No implicit grid in a subgridded dimension If you need to autoplace items, and do not know how many items you will have, take care when creating a subgrid, as it will prevent...
...ple below. This means that your subgrid is tied in both dimensions to the number of tracks on the parent. No implicit grid in a subgridded dimension If you need to autoplace items, and do not know how many items you will have, take care when creating a subgrid, as it will prevent additional rows being created to hold those items. Take a look at the next example -- it uses the same parent and child grid as in the example above, however inside the subgrid I have twelve items trying to autoplace into ten grid cells. As the subgrid is on both dimensions there is nowhere for the extra two items to go and so they go into the last track of the grid, as defined in the specification. If we remove the grid-template-rows value we enable regular creation of implicit tracks and, although these won't...
CSS selectors - CSS: Cascading Style Sheets
Basic selectors Universal selector Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces. Syntax: * ns|* *|* Example: * will match all the elements of the document. Type selector Selects all elements that have the given node name. Syntax: elementname Example: input will match any <input> element. Class selector Selects all elements that have the given class attribute. ...
.... Grouping selectors Selector list The , is a grouping method, it selects all the matching nodes. Syntax: A, B Example: div, span will match both <span> and <div> elements. Combinators Descendant combinator The (space) combinator selects nodes that are descendants of the first element. Syntax: A B Example: div span will match all <span> elements that are inside a <div> element. Child combinator The > combinator selects nodes that are direct children of the first element. Syntax: A > B Example: ul > li will match all <li> elements that are nested directly inside a <ul> element. General sibling combinator The ~ combinator selects siblings. This means that the second element follows the first (though not necessarily immediately), and both share the same parent. Syntax: A ~...
... state, linguistic and UI pseudo-classes, modifier for ASCII case-sensitive and case-insensitive attribute value selection. Selectors Level 3 Recommendation Added the ~ general sibling combinator and tree-structural pseudo-classes. Made pseudo-elements use a :: double-colon prefix. Additional attribute selectors CSS Level 2 (Revision 1) Recommendation Added the > child and + adjacent sibling combinators. Added the universal and attribute selectors. CSS Level 1 Recommendation Initial definition. See the pseudo-class and pseudo-element specification tables for details on those. ...
box-ordinal-group - CSS: Cascading Style Sheets
This is a property of the original CSS Flexible Box Layout Module draft, and has been replaced by a newer standard. See flexbox for information about the current standard. The box-ordinal-group CSS property assigns the flexbox's child elements to an ordinal group. /* <integer> values */ box-ordinal-group: 1; box-ordinal-group: 5; /* Global values */ box-ordinal-group: inherit; box-ordinal-group: initial; box-ordinal-group: unset; Ordinal groups may be used in conjunction with the box-direction property to control the order in which the direct children of a box appear. When the computed box-direction is normal, a box will display its elements starting from the lowest numbered ordinal group and ensure that those elements appear to the left (for horizontal boxes) or at the top (f...
...boxes) or at the top (for vertical boxes) of the container. Elements with the same ordinal group are flowed in the order they appear in the source document tree. In the reverse direction, the ordinal groups are examined in the same order, except the elements appear reversed. Syntax The box-ordinal-group property is specified as any positive <integer>. ...
...nts appear reversed. Syntax The box-ordinal-group property is specified as any positive <integer>. Formal definition Initial value1Applies tochildren of box elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <integer> Examples Basic usage example In an older version of the spec, box-ordinal-group was included to allow you to change the display order of flex children inside a flex container: article:nth-child(1) { -webkit-box-ordinal-group: 2 -moz-box-ordinal-group: 2 box-ordinal-group: 2 } article:nth-child(2) { -webkit-box-ordinal-group: 1 -moz-box-ordinal-group: 1 box-ordinal-group: 1 } The modern flexbox equivalent is order. Specifications Not part of any standard. ...
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
property is specified as one of the keyword values listed below. Values start The box packs contents at the start, leaving any extra space at the end. center The box packs contents in the center, dividing any extra space equally between the start and the end. end The box packs contents at the end, leaving any extra space at the start. justify The space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. If there is only one child, treat the value as if it were start. Notes The edge of the box designated the start for packing purposes depends on the box's orientation and direction: Normal Reverse Horizontal left right Vertical top bottom The edge opposite t...
...efinition Initial valuestartApplies toelements with a CSS display value of -moz-box, -moz-inline-box, -webkit-box or -webkit-inline-boxInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax start | center | end | justify Examples div.example { border-style: solid; display: -moz-box; /* Mozilla */ display: -webkit-box; /* WebKit */ /* Make this box taller than the children, so there is room for the box-pack */ height: 300px; /* Make this box wide enough to show the contents are centered horizontally */ width: 300px; /* Children should be oriented vertically */ -moz-box-orient: vertical; /* Mozilla */ -webkit-box-orient: vertical; /* WebKit */ /* Align children to the horizontal center of this box */ -moz-box-align: center; /* Mozilla ...
... 300px; /* Make this box wide enough to show the contents are centered horizontally */ width: 300px; /* Children should be oriented vertically */ -moz-box-orient: vertical; /* Mozilla */ -webkit-box-orient: vertical; /* WebKit */ /* Align children to the horizontal center of this box */ -moz-box-align: center; /* Mozilla */ -webkit-box-align: center; /* WebKit */ /* Pack children to the bottom of this box */ -moz-box-pack: end; /* Mozilla */ -webkit-box-pack: end; /* WebKit */ } div.example p { /* Make children narrower than their parent, so there is room for the box-align */ width: 200px; } <div class="example"> <p>I will be second from the bottom of div.example, centered horizontally.</p> <p>I will be on the bottom of div.exam...
offset-rotate - CSS: Cascading Style Sheets
Working Draft Initial definition ...
... Working Draft Initial definition ...
... Working Draft Initial definition ...
pointer-events - CSS: Cascading Style Sheets
element is not the target of pointer events, the value none instructs the pointer event to go "through" the element and target whatever is "underneath" that element instead. Note that preventing an element from being the target of pointer events by using pointer-events does not necessarily mean that pointer event listeners on that element cannot or will not be triggered. ...
...one instructs the pointer event to go "through" the element and target whatever is "underneath" that element instead. Note that preventing an element from being the target of pointer events by using pointer-events does not necessarily mean that pointer event listeners on that element cannot or will not be triggered. ...
...atever is "underneath" that element instead. Note that preventing an element from being the target of pointer events by using pointer-events does not necessarily mean that pointer event listeners on that element cannot or will not be triggered. If one of the element's children has pointer-events explicitly set to allow that child to be the target of pointer events, then any events targeting that child will pass through the parent as the event travels along the parent chain, and trigger event listeners on the parent as appropriate. Of course any pointer activity at a point on the screen that is covered by the parent but not by the child will not be caught by either the child or the parent (it will go "through" the parent and target whatever is underneath). Elements with pointer-events: none wi...
scroll-margin-inline-end - CSS: Cascading Style Sheets
flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } The main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
...ates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. The child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. ...
...; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-end: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-end: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. Result Try it for yourself: Specifications ...
scroll-margin-inline-start - CSS: Cascading Style Sheets
flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } The main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
...es that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. The child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points. ...
...ustify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-start: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-start: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline start edge of the second <div>, and 2rems outside the inline start edge of the third <div>. Result Try it for yourself: Specifica...
scroll-margin-inline - CSS: Cascading Style Sheets
flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } The main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
...ates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. The child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. ...
...; justify-content: center; scroll-snap-align: end; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. Note: Here we are setting scroll-margin on the start and...
scroll-margin - CSS: Cascading Style Sheets
flex; box-sizing: border-box; border: 1px solid #000; scroll-snap-type: x mandatory; } The main parts relevant to the scroll snapping are overflow-x: scroll, which makes sure the contents will scroll and not be hidden, and scroll-snap-type: x mandatory, which dictates that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. ...
...es that scroll snapping must occur along the horizontal axis, and the scrolling will always come to rest on a snap point. The child elements are styled as follows: .scroller > div { flex: 0 0 250px; width: 250px; background-color: #663399; color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points. ...
...ustify-content: center; scroll-snap-align: start; } .scroller > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin: 1rem; } .scroller > div:nth-child(3) { scroll-margin: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the left edge of the second <div>, and 2rems outside the left edge of the third <div>. Note: Here we are setting scroll-margin on all sides at once, but only the start e...
scroll-snap-coordinate - CSS: Cascading Style Sheets
<div> <p>At coordinate (25, 0)</p> <div class="scrollContainer coordinate25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (50, 0)</p> <div class="scrollContainer coordinate50"> <div>1</div> <div>2</div> <div>3</div> </div> </div> </div> CSS #container { display: flex; } #container > div:nth-child(-n+2) { margin-right: 20px; } .scrollContainer { width: 100px; overflow: auto; white-space: nowrap; scroll-snap-type: mandatory; font-size: 0; } .scrollContainer > div { width: 100px; height: 100px; display: inline-block; line-height: 100px; text-align: center; font-size: 50px; } .coordinate0 > div { scroll-snap-coordinate: 0 0; } .coordinate25 > div { scroll-snap-...
... ...
... ...
scroll-snap-destination - CSS: Cascading Style Sheets
<div> <p>At coordinate (25, 0)</p> <div class="scrollContainer destination25"> <div>1</div> <div>2</div> <div>3</div> </div> </div> <div> <p>At coordinate (50, 0)</p> <div class="scrollContainer destination50"> <div>1</div> <div>2</div> <div>3</div> </div> </div> </div> CSS #container { display: flex; } #container > div:nth-child(-n+2) { margin-right: 20px; } .scrollContainer { width: 100px; overflow: auto; white-space: nowrap; scroll-snap-points-x: repeat(100%); scroll-snap-type: mandatory; scroll-snap-destination: 20px 0; font-size: 0; } .destination0 { scroll-snap-destination: 0 0; } .destination25 { scroll-snap-destination: 25px 0; } .destination50 { scroll-snap-destination: 50px 0; } .scrol...
... ...
... ...
scroll-snap-stop - CSS: Cascading Style Sheets
LTR </div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container x proximity-scroll-sn...
...LTR </div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container x proximity-scroll-snapping" dir="ltr"> <div>X Proximity LTR</div> <div>2</div> <div>3</div> <div>4<...
...} .x.container > div { line-height: 128px; font-size: 64px; width: 100%; height: 128px; } .y.container > div { line-height: 256px; font-size: 128px; width: 256px; height: 256px; } /* appearance fixes */ .y.container > div:first-child { line-height: 1.3; font-size: 64px; } /* coloration */ .container > div:nth-child(even) { background-color: #87EA87; } .container > div:nth-child(odd) { background-color: #87CCEA; } HTML <div class="container x mandatory-scroll-snapping" dir="ltr"> <div>X Mand. LTR </div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container x proximity-scroll-snapping" dir="ltr"> <div>X Proximity LTR</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container y mandatory-scro...
scroll-snap-type - CSS: Cascading Style Sheets
Candidate Recommendation ...
... Candidate Recommendation Initial definition ...
... Candidate Recommendation Initial definition ...
Event reference
A pointing device is moved onto the element that has the listener attached. mouseleave A pointing device is moved off the element that has the listener attached. mousemove A pointing device is moved over an element (fired continuously as the mouse moves). mouseover A pointing device is moved onto the element that has the listener attached or onto one of its children. mouseout A pointing device is moved off the element that has the listener attached or off one of its children. mouseup A pointing device button is released over an element. pointerlockchange The pointer was locked or released. pointerlockerror It was impossible to lock the pointer for technical reasons or because the permission was denied. ...
...eEvent DOM L3 Removed The name of an element changed (use mutation observers instead). DOMFocusIn FocusEvent DOM L3 An element has received focus (use focus or focusin instead). DOMFocusOut FocusEvent DOM L3 An element has lost focus (use blur or focusout instead). DOMNodeInserted MutationEvent DOM L3 A node has been added as a child of another node (use mutation observers instead). DOMNodeInsertedIntoDocument MutationEvent DOM L3 A node has been inserted into the document (use mutation observers instead). DOMNodeRemoved MutationEvent DOM L3 A node has been removed from its parent node (use mutation observers instead). DOMNodeRemovedFromDocument MutationEvent DOM L3 ...
...d onto the element that has the listener attached. mouseleave MouseEvent DOM L3 A pointing device is moved off the element that has the listener attached. mousemove MouseEvent DOM L3 A pointing device is moved over an element. mouseout MouseEvent DOM L3 A pointing device is moved off the element that has the listener attached or off one of its children. mouseover MouseEvent DOM L3 A pointing device is moved onto the element that has the listener attached or onto one of its children. mouseup MouseEvent DOM L3 A pointing device button is released over an element. nomatch SpeechRecognitionEvent Web Speech API The speech recognition service returns a final result with no significant recogni...
Block formatting context - Developer guides
y created by the elements with display: table, table-row, table-row-group, table-header-group, table-footer-group (which is the default for HTML tables, table rows, table bodies, table headers, and table footers, respectively), or inline-table. Block elements where overflow has a value other than visible. display: flow-root. Elements with contain: layout, content, or paint. Flex items (direct children of the element with display: flex or inline-flex) if they are neither flex nor grid nor table containers themselves. Grid items (direct children of the element with display: grid or inline-grid) if they are neither flex nor grid nor table containers themselves. Multicol containers (elements where column-count or column-width isn't auto, including elements with column-count: 1). column-span:...
... floats rather than changing the layout, because an element that establishes a new block formatting context will: contain internal floats. exclude external floats. suppress margin collapsing. Note: a Flex/Grid container(display: flex/grid/inline-flex/inline-grid) establishes a new Flex/Grid formatting context, which is similar to block formatting context except layout. There's no floating children avaliable inside a flex/grid container, but exclude external floats and suppress margin collapsing still works. Examples Contain internal floats Make float content and alongside content the same height. Let's have a look at a couple of these in order to see the effect creating a new BFC. In the following example, we have a floated element inside a <div> with a border applied. The conten...
...oat. As explained in the guide to in-flow and out of flow elements, the float has been taken out of flow so the background and border of the <div> only contain the content and not the float. using overflow: auto Setting overflow: auto or set other values than the initial value of overflow: visible created a new BFC containing the float. Our <div> now becomes a mini-layout inside our layout. Any child element will be contained inside it. The problem with using overflow to create a new BFC is that the overflow property is meant for telling the browser how you want to deal with overflowing content. There are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a BFC. In addition, it is potentially not readable for a fut...
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
ctive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content If the span attribute is present: none, it is an empty element. If the attribute is not present: zero or more <col> element Tag omission The start tag may be omitted, if it has a <col> element as its first child and if it is not preceded by a <colgroup> whose end tag has been omitted. The end tag may be omitted, if it is not followed by a space or a comment. Permitted parents A <table> element. The <colgroup> must appear after any optional <caption> element but before any <thead>, <th>, <tbody>, <tfoot> and <tr> element. Implicit ARIA role No corresponding role Permit...
... If this attribute is not set, the left value is assumed. The descendant <col> elements may override this value using their own align attribute. Note: Do not try to set the text-align property on a selector giving a <colgroup> element. Because <td> elements are not descendant of the <colgroup> element, they won't inherit it. If the table doesn't use a colspan attribute, use one td:nth-child(an+b) CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of this column in the table. Only after this selector the text-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The bac...
...ble; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not try to set the vertical-align property on a selector giving a <colgroup> element. Because <td> elements are not descendant of the <colgroup> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector per column, where a is the total number of the columns in the table and b is the ordinal position of the column in the table. Only after this selector the vertical-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. Examples Please...
<source>: The Media or Image Source element - HTML: Hypertext Markup Language
Web › HTML › Element › source
media condition-length pairs. This information is used by the browser to determine, before laying the page out, which image defined in srcset to use. Please note that sizes will have its effect only if width dimension descriptors are provided with srcset instead of pixel ratio values (200w instead of 2x for example). The sizes attribute has an effect only when the <source> element is the direct child of a <picture> element. src Required for <audio> and <video>, address of the media resource. The value of this attribute is ignored when the <source> element is placed inside a <picture> element. srcset A list of one or more strings separated by commas indicating a set of possible images represented by the source for the browser to use. Each string is composed of: One URL specifying ...
...s 1x. Each string in the list must have at least a width descriptor or a pixel density descriptor to be valid. Among the list, there must be only one string containing the same tuple of width descriptor and pixel density descriptor. The browser chooses the most adequate image to display at a given point of time. The srcset attribute has an effect only when the <source> element is the direct child of a <picture> element. type The MIME media type of the resource, optionally with a codecs parameter. If the type attribute isn't specified, the media's type is retrieved from the server and checked to see if the user agent can handle it; if it can't be rendered, the next <source> is checked. If the type attribute is specified, it's compared against the types the user agent can present, and...
...t be rendered, the next <source> is checked. If the type attribute is specified, it's compared against the types the user agent can present, and if it's not recognized, the server doesn't even get queried; instead, the next <source> element is checked at once. When used in the context of a <picture> element, the browser will fall back to using the image specified by the <picture> element's <img> child if it is unable to find a suitable image to use after examing every provided <source>. Usage notes The <source> element is an empty element (or void element), which means that it not only has no content but also has no closing tag. That is, you never use "</source>" in your HTML. For information about image formats supported by web browsers and guidance on selecting appropriate formats to use,...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
Web › HTML › Element › summary
e <details> element. Implicit ARIA role button Permitted ARIA roles No role permitted DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes The <summary> element's contents can be any heading content, plain text, or HTML that can be used within a paragraph. ...
... Default style Per the HTML specification, the default style for <summary> elements includes display: list-item. ...
...ding elements in <summary>, like this: <details open> <summary><h4>Overview</h4></summary> <ol> <li>Cash on hand: $500.00</li> <li>Current invoice: $75.30</li> <li>Due date: 5/6/19</li> </ol> </details> This currently has some spacing issues that could be addressed using CSS. Warning: Because the <summary> element has a default role of button (which strips all roles from child elements), this example will not work for users of assistive technologies such as screen readers. The <h4> will have its role removed and thus will not be treated as a heading for these users. HTML in summaries This example adds some semantics to the <summary> element to indicate the label as important: <details open> <summary><strong>Overview</strong></summary> <ol> <li>Cash on hand:...
Object - JavaScript
s, name); this.title = title; }; Employee.prototype = Object.create(Person.prototype); Employee.prototype.constructor = Employee; //If you don't set Object.prototype.constructor to Employee, //it will take prototype.constructor of Person (parent). //To avoid that, we set the prototype.constructor to Employee (child). Employee.prototype.greet = function() { if (this.canTalk) { console.log('Hi, I am ' + this.name + ', the ' + this.title); } }; var Customer = function(name) { Person.call(this, name); }; Customer.prototype = Object.create(Person.prototype); Customer.prototype.constructor = Customer; //If you don't set Object.prototype.constructor to Customer, ...
...e) { Person.call(this, name); }; Customer.prototype = Object.create(Person.prototype); Customer.prototype.constructor = Customer; //If you don't set Object.prototype.constructor to Customer, //it will take prototype.constructor of Person (parent). //To avoid that, we set the prototype.constructor to Customer (child). var Mime = function(name) { Person.call(this, name); this.canTalk = false; }; Mime.prototype = Object.create(Person.prototype); Mime.prototype.constructor = Mime; //If you don't set Object.prototype.constructor to Mime, //it will take prototype.constructor of Person (parent). //To avoid that, we set the prototype.const...
...function(name) { Person.call(this, name); this.canTalk = false; }; Mime.prototype = Object.create(Person.prototype); Mime.prototype.constructor = Mime; //If you don't set Object.prototype.constructor to Mime, //it will take prototype.constructor of Person (parent). //To avoid that, we set the prototype.constructor to Mime (child). var bob = new Employee('Bob', 'Builder'); var joe = new Customer('Joe'); var rg = new Employee('Red Green', 'Handyman'); var mike = new Customer('Mike'); var mime = new Mime('Mime'); bob.greet(); // Hi, I am Bob, the Builder joe.greet(); // Hi, I am Joe rg.greet(); // Hi, I am Red Green, the Handyman mike.greet(); // Hi, I am Mike mime.greet(); Specifications Specification ...
MathML attribute reference - MathML
spacing <mtable> A length value specifing the minimum space between a label and the adjacent cell in the row. minsize <mo> The minimum size of the operator. movablelimits <mo> Specifies whether attached under- and overscripts move to sub- and superscript positions. notation <menclose> A list of notations, separated by white space, to apply to the child elements. numalign <mfrac> The alignment of the numerator over the fraction. open <mfenced> A string for the opening delimiter. Unimplemented overflow <math> If an expression is too long to fit in the allowed width, this attribute sets the preferred handling. Unimplemented position <msgroup>, <msrow>, <mscarries>, <msline> ro...
... scriptlevel <mstyle> Controls mostly the font-size. The higher the scriptlevel, the smaller the font size. scriptminsize <mstyle> Specifies a minimum font size allowed due to changes in scriptlevel. scriptsizemultiplier <mstyle> Specifies the multiplier to be used to adjust font size due to changes in scriptlevel. selection <maction> The child element which is addressed by the action. separator <mo> There is no visual effect for this attribute, but it specifies whether the operator is a separator (such as commas). separators <mfenced> A sequence of zero or more characters to be used for different separators. Unimplemented shift <msgroup> Unimplemented side <mtable> Specifies ...
...supscriptshift <mmultiscripts>, <msup>, <msubsup> The minimum space by which to shift the superscript above the baseline of the expression. symmetric <mo> If stretchy is true, this attribute specifies whether the operator should be vertically symmetric around the imaginary math axis (centered fraction line). voffset <mpadded> Sets the vertical position of the child content. width <mglyph>, <mpadded>, <mspace>, <mtable> Specifies the desired width. See lengths for possible values. xlink:href All Can be used to set a hyperlink to a specfied URI. However, authors are encouraged to use the href attribute instead. xmlns <math> Specifies the URI for the MathML namespace (http://www.w3.org/1998/Math/MathML) ...
<semantics> - MathML
e semantic mathematical meaning and to make expressions understandable to computer algebra systems. The MathML elements <semantics>, <annotation> and <annotation-xml> are used to combine presentation and content markup and to provide both, layout information and semantic meaning of mathematical expressions. ...
...e <semantics> element acts as a container element associating annotations and must have child elements (it will raise an invalid markup error otherwise). The <annotation> element is the container element containing semantic information in a non-XML format, whereas the <annotation-xml> element contains content in an XML format, e.g. Content MathML or OpenMath. The rules of determining the visible child in a <semantics> element are the following: If no rule other rule applies: By default only the first child is rendered, which is supposed to be presentation markup. If the first child is a presentation MathML element other than <annotation> or <annotation-xml>, render the first child. ...
... Beware that <annotation-xml> elements are only recognized, if the encoding attribute is set to one of the following: "application/mathml-presentation+xml" "MathML-Presentation" "SVG1.1" "text/html" "image/svg+xml" "application/xml". ...
MathML documentation index - MathML
Web › MathML › Index
ference, MathML:Element, MathML:Enlivening Expressions The following example uses the "toggle" actiontype: 11 <math> MathML, MathML Reference, MathML:Element The top-level element in MathML is <math>. Every valid MathML instance must be wrapped in <math> tags. In addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it. 12 <menclose> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <menclose> element renders its content inside an enclosing notation specified by the notation attribute. 13 <merror> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <merror> element is used to display conten...
...an identifier such as function names, variables or symbolic constants. You can also have arbitrary text in it to mark up terms. 18 <mlabeledtr> MathML, MathML Reference, MathML:Element, MathML:Tabular Math The MathML <mlabeledtr> element is used to represent a label in a row either on the left or on the right side (determined using the side attribute on the <mtable> element). Child elements of <mlabeledtr> must be <mtd> elements. The first child is the label whereas all other children are representing row contents and are treated identically to children of <mtr> elements. 19 <mmultiscripts> MathML, MathML Reference, MathML:Element, MathML:Script and Limit Schemata The MathML <mmultiscripts> element allows you to create tensor-like objects. In a descript...
...:Element, MathML:General Layout Schemata The MathML <msqrt> element is used to display square roots (no index is displayed). The square root accepts only one argument, which leads to the following syntax: <msqrt> base </msqrt>. 30 <mstyle> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mstyle> element is used change the style of its children. It accepts all attributes of all MathML presentation elements with some exceptions and additional attributes listed below. 31 <msub> MathML, MathML Reference, MathML:Element, MathML:Script and Limit Schemata The MathML <msub> element is used to attach a subscript to an expression. 32 <msubsup> MathML, MathML Reference, MathML:Element, MathML:Script and Limi...
Populating the page: how browsers work - Web Performance
alues. If the document is well-formed, parsing it is straightforward and faster. The parser parses tokenized input into the document, building up the document tree. The DOM tree describes the content of the document. The <html> element is the first tag and root node of the document tree. The tree reflects the relationships and hierarchies between different tags. Tags nested within other tags are child nodes. The greater the number of DOM nodes, the longer it takes to construct the DOM tree. When the parser finds non-blocking resources, such as an image, the browser will request those resources and continue parsing. Parsing can continue when a CSS file is encountered, but <script> tags--particularly those without an async or defer attribute--block rendering, and pause the parsing of HTML. Th...
... the CSSOM The second step in the critical rendering path is processing CSS and building the CSSOM tree. The CSS object model is similar to the DOM. The DOM and CSSOM are both trees. They are independent data structures. The browser converts the CSS rules into a map of styles it can understand and work with. The browser goes through each rule set in the CSS, creating a tree of nodes with parent, child, and sibling relationships based on the CSS selectors. As with HTML, the browser needs to convert the received CSS rules into something it can work with. Hence, it repeats the HTML-to-object process, but for the CSS. The CSSOM tree includes styles from the user agent style sheet. The browser begins with the most general rule applicable to a node and recursively refines the computed styles by ap...
...ng performance by painting portions of the screen on the GPU instead of the CPU, freeing up the main thread. Style The third step in the critical rendering path is combining the DOM and CSSOM into a render tree.The computed style tree, or render tree, construction starts with the root of the DOM tree, traversing each visible node. Tags that aren't going to be displayed, like the <head> and its children and any nodes with display: none, such as the script { display: none; } you will find in user agent stylesheets, are not included in the render tree as they will not appear in the rendered output. Nodes with visibility: hidden applied are included in the render tree, as they do take up space. As we have not given any directives to override the user agent default, the script node in our code ex...
Mobile first - Progressive web apps (PWAs)
ing at the source code in app.css. Particular bits of interest to point out are as follows. article { display: table; } nav { display: table-caption; caption-side: bottom; } This is a rather nice hacky bit of CSS you can use to make the navigation menu display at the bottom, even though it is at the top in the source order. And it works in IE8+. display: table makes the <article> and its children display in a table layout, without abusing table markup. display: table-caption makes the <nav> element think it's the caption of the table, and caption-side: bottom makes it jump down to the bottom of the table. One word of warning about this technique though - positioning doesn't work as expected on elements with display: table set on them. I have included two links in my markup: <a id="to...
... work as expected on elements with display: table set on them. I have included two links in my markup: <a id="top" href="#bottom">Jump to menu</a> ... <a id="bottom" href="#top">Back to top</a> The first one is to jump down from the top of the article to the navigation menu, and the second one is to jump back up to the top of the article again. ...
...top, I put in the following media queries: @media (min-width: 480px) { #bottom, #top { display: none; } article, nav { display: block; } nav ul { text-align: center; } nav li { display: inline; } nav li a { border-right: 1px solid #AD66D5; border-bottom: none; display: inline-block; padding: 0 5px; font-size: 1.6em; } nav li:last-child a { border-right: none; } } @media (min-width: 600px) { html { background: #eee; height: 100%; } body { width: 600px; height: inherit; margin: 0 auto; background: url(../img/firefox-os.png) bottom left no-repeat, linear-gradient(to bottom, #fff, #eee); } .main > p { background: rgba(255,255,255,0.3); } nav li a { padding: 0 10px; font...
Index - XPath
Web › XPath › Index
ncestor Axe, XPath No summary! 4 ancestor-or-self Axe, XPath The ancestor-or-self axis indicates the context node and all of its ancestors, including the root node. 5 attribute Axe, XPath The attribute axis indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (@). ...
... summary! 4 ancestor-or-self Axe, XPath The ancestor-or-self axis indicates the context node and all of its ancestors, including the root node. 5 attribute Axe, XPath The attribute axis indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (@). 6 child Axe, XPath The child axis indicates the children of the context node. If an XPath expression does not specify an axis, the child axis is understood by default. Since only the root node or element nodes have children, any other use will select nothing. 7 descendant Axe, XPath The descendant axis indicates all of the children of the context node, and all of their children, and so forth. Attribute a...
...stood by default. Since only the root node or element nodes have children, any other use will select nothing. 7 descendant Axe, XPath The descendant axis indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents. 8 descendant-or-self Axe, XPath The descendant-or-self axis indicates the context node and all of its descendants. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents. 9 following Axe, XPath The following axis indicates all the n...
window/utils - Archive of obsolete content
for the given nsIDOMWindow: var { Ci } = require('chrome'); var utils = require('sdk/window/utils'); var active = utils.getMostRecentBrowserWindow(); active instanceof Ci.nsIBaseWindow // => false utils.getBaseWindow(active) instanceof Ci.nsIBaseWindow // => true Parameters window : nsIDOMWindow Returns nsIBaseWindow getToplevelWindow(window) Returns the toplevel nsIDOMWindow for the given child nsIDOMWindow: var { Ci } = require('chrome'); var utils = require('sdk/window/utils'); var browserWindow = utils.getMostRecentBrowserWindow(); var window = browserWindow.content; // `window` object for the current webpage utils.getToplevelWindow(window) == browserWindow // => true Parameters window : nsIDOMWindow Returns nsIDOMWindow getWindowDocShell(window) Returns the nsIDocShell for th...
...e://browser/content/browser.xul". Parameters window : nsIDOMWindow Returns boolean getWindowTitle(window) Get the title of the document hosted by the given window Parameters window: nsIDOMWindow Returns string: this document's title. isXULBrowser(window) Returns true if the given window is a XUL window. Parameters window : nsIDOMWindow Returns boolean getFocusedWindow() Gets the child window within the topmost browser window that is focused. See nsIFocusManager for more details. Returns nsIDOMWindow getFocusedElement() Get the element that is currently focused. This will always be an element within the document loaded in the focused window, or null if no element in that document is focused. Returns nsIDOMElement getFrames(window) Get the frames contained by the given w...
Canvas code snippets - Archive of obsolete content
illRect', 'fillText', 'lineTo', 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate']; var getterMethods = ['createPattern', 'drawFocusRing', 'isPointInPath', 'measureText', // drawFocusRing not currently supported // The following might instead be wrapped to be able to chain their child objects 'createImageData', 'createLinearGradient', 'createRadialGradient', 'getImageData', 'putImageData' ]; var props = ['canvas', 'fillStyle', 'font', 'globalAlpha', 'globalCompositeOperation', 'lineCap', 'lineJoin', 'lineWidth', 'miterLimit', 'shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'shadowColor', 'strokeStyle', 'textAlign', 'textBaseline']; for (let m of methods...
...iframe'); iframe.id = 'test-iframe'; iframe.height = '10px'; iframe.width = windowWidth + 'px'; iframe.style.visibility = 'hidden'; iframe.src = this.url; // Here is where the magic happens... ...
StringView - Archive of obsolete content
executed the callback function. characterOffset Optional A number expressing (in codepoints) the location at which to begin executing the callback function. charactersLength Optional A number expressing (in codepoints) the number of invocations of the callback function. ...
... function. charactersLength Optional A number expressing (in codepoints) the number of invocations of the callback function. Examples function myCallback (charCode, characterOffset, rawOffset /*, rawDataArray */) { this.appendChild(document.createTextNode("char #" + characterOffset + ", raw index: " + rawOffset + ", character: " + String.fromCharCode(charCode))); this.appendChild(document.createElement("br")); } (new StringView("\u4367\uD889\uDE54\u4343\u5431")).forEachChar(myCallback, document.body); Note: stringView.forEachChar() executes a complete cycle through all characters in the stringView between characterOffset and characterOffset + charactersLength. If you want to build a custom cycle through a variable-length-encoded stringView (UTF-8, UTF-16), you c...
Displaying web content in an extension without security issues - Archive of obsolete content
cloneNode() always creates a copy and textContent only manipulates text. So there is no chance of accidentally adding new elements or attributes. But what if you have to display HTML rather than only text, e.g. an RSS feed entry? Extension authors will often come up with flawed attem...
...ptableUnescapeHTML.parseFragment() method should be used that is meant for just that scenario: var target = entry.getElementsByClassName("description")[0]; var fragment = Components.classes["@mozilla.org/feed-unescapehtml;1"] .getService(Components.interfaces.nsIScriptableUnescapeHTML) .parseFragment(description, false, null, target); target.appendChild(fragment); This will add the HTML code to the specified node -- minus all the potentially dangerous content. ...
Adding Events and Commands - Archive of obsolete content
xtension needs to disable or enable a series of controls when the user logs in or out of a service, or when Firefox detects it's online or offline. It's common that you need to change several elements at the same time, and this can be difficult to manage through JavaScript. The broadcaster element can help you out in these cases. First you need to add a broadcaster element to your XUL code, as a child of a broadcasterset element. <broadcasterset id="xulschoolhello-broadcasterset"> <broadcaster id="xulschoolhello-online-broadcaster" /> </broadcasterset> These elements are completely invisible, so you can put them anywhere. It is recommended that you have them at the top of the XUL code, along with script declarations and other invisible elements with as popupset and commandset. Then you n...
... it will automatically have those attribute values set or removed as well. You can override pre-existing values, such as the label attribute value in the example. let onlineBroadcaster = document.getElementById("xulschoolhello-online-broadcaster"); onlineBroadcaster.setAttribute("label", "Something"); You can also have finer-grained control to this behavior by adding the observes element as a child to your observer node. This allows you to choose which attributes you want it to observe. Broadcasters allow you to easily maintain consistency among numerous elements without having to add much code. They also save you the trouble of having to know if a given element is present in the DOM or not. For example, if you have a customizable toolbar, you can't be sure if a given button is present or ...
Appendix F: Monitoring DOM changes - Archive of obsolete content
Content code // should make do without weak references. style = Components.utils.getWeakReference(style); return function unwatch() { if (style.get()) { style.get().ownerDocument.removeEventListener('animationstart', listener, false); style.get().parentNode.remov...
...style); // This will only work in chrome privileged code. Content code // should make do without weak references. ...
The Essentials of an Extension - Archive of obsolete content
-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> The root element in the file is an overlay. Other XUL documents use the window or dialog tag. The element has a unique id, which you should have on most elements in your XUL. The second attribute is the namespace, which is something you should always define in your XUL root element. It says that this node and all child nodes are XUL. You only need to change namespace declarations when you mix different types of content in the same document, such as XUL with HTML or SVG. You may have noticed the naming we use on several places, such as the id xulschoolhello-browser-overlay. This is the namespacing standard that we use to avoid conflicts with Firefox and other extensions, as well as making some development tas...
...nt, which is the reason why we overlay the stringbundleset that is in browser.xul, hence the very generic id. We don't include the insertbefore or insertafter attributes because the ordering of string bundles doesn't make a difference. The element is completely invisible. If you don't include any of those ordering attributes in an overlay element, Firefox will just append your element as the last child of the parent element. All you need for the string bundle is an id (to be able to fetch the element later) and the chrome path to the properties file. And, of course, you need the properties file: xulschoolhello.greeting.label = Hi! How are you? The whitespace around the equals sign is ignored. Just like in install.rdf, comments can be added using the # character at the beginning of the li...
Tabbed browser - Archive of obsolete content
er = browserWin.gBrowser; // Check each tab of this browser instance var numTabs = tabbrowser.browsers.length; for (var index = 0; index < numTabs; index++) { var currentBrowser = tabbrowser.getBrowserAtIndex(index); if (url == currentBrowser.currentURI.spec) { // The URL is already opened. Select this tab. tabbrowser.selectedTab = tabbrowser.tabContainer.childNodes[index]; // Focus *this* browser-window browserWin.focus(); found = true; break; } } } // Our URL isn't open. Open it now. if (!found) { var recentWindow = wm.getMostRecentWindow("navigator:browser"); if (recentWindow) { // Use an existing browser window recentWindow.delayedOpenTab(url, null, null, null, null); } e...
...we create a new tab with our custom attribute. function openAndReuseOneTabPerAttribute(attrName, url) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); for (var found = false, index = 0, tabbrowser = wm.getEnumerator('navigator:browser').getNext().gBrowser; index < tabbrowser.tabContainer.childNodes.length && !found; index++) { // Get the next tab var currentTab = tabbrowser.tabContainer.childNodes[index]; // Does this tab contain our custom attribute? if (currentTab.hasAttribute(attrName)) { // Yes--select and focus it. tabbrowser.selectedTab = currentTab; // Focus *this* browser window in case another one is currently focused tabbrows...
XUL user interfaces - Archive of obsolete content
Copy and pas...
...atus(null) if (d != "") { try { var a = d.split("/") var theDate = new Date(a[2], a[0] - 1, a[1]) showStatus(theDate) } catch (ex) {} } setDay(theDate) } // internal function setDay(aDate) { if (currentDay) currentDay.setAttribute("disabled", "true") if (aDate == null) currentDay = null else { var d = aDate.getDay() currentDay = dayBox.firstChild while (d-- > 0) currentDay = currentDay.nextSibling currentDay.removeAttribute("disabled") } dateBox.focus(); } function showStatus(aDate) { if (aDate == null) { status.removeAttribute("warning") status.setAttribute("label", "") } else if (aDate === false || isNaN(aDate.getTime())) { status.setAttribute("warning", "true") status.setAttribute("label", "Date...
Index of archived content - Archive of obsolete content
io/text-streams lang/functional lang/type loader/cuddlefish loader/sandbox net/url net/xhr places/bookmarks places/favicon places/history platform/xpcom preferences/event-target preferences/service remote/child remote/parent stylesheet/style stylesheet/utils system/child_process system/environment system/events system/runtime system/unload system/xul-app tabs/utils test/assert test/harness test/httpd test/runne...
... Archived open Web documentation Browser Detection and Cross Browser Support Browser Feature Detection Displaying notifications (deprecated) E4X E4X for templating Processing XML with E4X E4X Tutorial Accessing XML children Descendants and Filters Introduction Namespaces The global XML object Iterator LiveConnect LiveConnect Overview LiveConnect Reference JSException JSObject ...
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
pies the markup into the container element, which is a DIV element. The following code snippet shows a simplified version of the logic that happens in the actual sample: // doc is the DOM to the document returned articles=doc.getElementsByTagName("article"); for(i=0;i<articles.length;i++) { // acquiring the data from the DOM... articleTitle=article.getElementsByTagName("article").item(0).firstChild.nodeValue; // inserting the content into the container.. document.getElementById("container").innerHTML+=articleTitle+"<br />"; } Source code for the sample <html> <head> <title>Inner-browsing example, with XMLHTTPRequest and DOM</title> <script type="text/javascript" language="javascript" src="xmlrequest.js"></script> <script> /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * Th...
...=""; if(doc!=null) { tagname="article"; // ie fix if(document.all) tagname="nde:"+tagname; articles=doc.getElementsByTagName(tagname); for(i=0;i<articles.length;i++) { article=articles.item(i); tagname="title"; // ie fix if(document.all) tagname="nde:"+tagname; valuee=article.getElementsByTagName(tagname).item(0).firstChild.nodeValue; tagname="summary"; // ie fix if(document.all) tagname="nde:"+tagname; paraa=article.getElementsByTagName(tagname).item(0).firstChild.nodeValue; linkk=article.getAttribute("url"); strvalue="<div class='nde-blurb'><h3><a href='"+linkk+"'>"+valuee+"</a></h3><p>"+paraa+"</p></div>"; document.getElementById("...
List of Mozilla-Based Applications - Archive of obsolete content
c is not Firefox, it's a completely different application FindThatFont! ...
...ource side of the EasyNeuf project, "A Free Software Computer, Easy and Preinstalled" Open Mashups development tool OpenOffice.org office suite Uses NSS Openswan implementation of IPsec for Linux Uses NSS Orca Browser web browser Gecko-based version of Avant browser Pale Moon web browser Optimized browser developed by Moonchild Productions for GNU/Linux & Windows platforms, originally forked from Firefox Palo Suite Excel extension Uses Prism PartyGaming online gaming product Uses Gecko Pencil tool for making diagrams and GUI prototyping Available as a firefox extension or a standalone app Pentaho BI Suite commercial open source business intelligence Uses XUL an...
Making it into a static overlay - Archive of obsolete content
hat element is the script reference we previously added to navigator.xul. Then there is a statusbar element containing a statusbarpanel element. The value of the id attribute of the statusbar element in our overlay matches the value of the id attribute of the statusbar element in navigator.xul. When navigator.xul is rendering into the browser's application interface, this causes any attributes or child elements of the statusbar element in the overlay file to be added to the interface's DOM and thus show up in the interface as if they were defined on the same element in navigator.xul. Note that we've added a new attribute to the statusbarpanel element: insertbefore. This attribute identifies another statusbarpanel element within statusbar before which our element should appear. Thus it allows us...
...gator.xul. Note that we've added a new attribute to the statusbarpanel element: insertbefore. This attribute identifies another statusbarpanel element within statusbar before which our element should appear. Thus it allows us to define the exact position of our element relative to the other statusbarpanel elements within statusbar. If insertbefore is omitted, the element will be added as the last child of statusbar, usually before the resizer grippy. We could instead have used an insertafter attribute to place the element after another. To use this overlay instead of our changes to navigator.xul we need to remove our changes, then add a reference to the overlay to the top of navigator.xul: ... <?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?> <?xml-stylesheet href="chrom...
Style System Overview - Archive of obsolete content
. Style data cached in style context tree If a style struct for a context depends on the data in the parent context, we will cache that struct in the style context tree. This happens when properties are inherited or when percentage units are used in a way that is handled by the style code (rather than reflow). If the data are exactly the same as those of the parent, we copy the struct to the child style context and set a bit saying that it doesn't own the struct. (The context tree can be deep.) Each rule node has a per-struct set of "none bits" that say that the rule node's set of rules (the rules on the path to the root) specify nothing non-inherited for the struct. Style data cached in rule tree If the data struct doesn't depend on the parent style context in any ways (inheritance,...
...solveStyleContextFor: For elements. ResolvePseudoStyleContextFor: for pseudo-elements (:first-letter, :before, etc.) ResolveStyleContextForNonElement: skips rule matching and uses root rule node (text frame optimization) Managing style contexts Style context resolving functions will walk the rule processors in StyleSetImpl::FileRules, find the correct rule node, and find a current child of the parent ("sibling sharing") or create a new child. Style context doesn't hold pointer to content, just rule node. Dynamic changes to content FrameManager::ReResolveStyleContext destroys and recreates style contexts for existing frames (rule node pointer immutable). ReResolveStyleContext is messy because it needs to create and parent style contexts correctly (sibling sharing may not b...
RDF Datasource How-To - Archive of obsolete content
t illustrates how to instantiate a tree control whose body is "rooted" to a resource (http://foo.bar.com/) that your datasource describes: <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#" xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul"> <tree datasources="rdf:my-datasource" ref="http://foo.bar.com/"> <template> <treechildren> <treeitem uri="..."> <treerow> <treecell> <text value="rdf:http://home.netscape.com/NC-rdf#Name" /> </treecell> <treecell> <text value="rdf:http://home.netscape.com/NC-rdf#URL" /> </treecell> </treerow> </treeitem> </treechildren> </template> <treehead> <treeite...
...e.netscape.com/NC-rdf#Name" /> </treecell> <treecell> <text value="rdf:http://home.netscape.com/NC-rdf#URL" /> </treecell> </treerow> </treeitem> </treechildren> </template> <treehead> <treeitem> <treecell>Name</treecell> <treecell>URL</treecell> </treeitem> </treehead> <!-- treechildren built _here_ --> </tree> </window> The important "magic attributes" have been called out in bold, above: datasources="rdf:my-datasource". This is a space-separated list that may include internal XPCOM datasource "identifiers" (as described above) and URIs for local or remote RDF/XML documents. Each datasource that is listed will be loaded, and the assertions contained in the datasource w...
Binding Implementations - Archive of obsolete content
mentation tag. A binding implementation provides a new set of methods and properties that can be invoked directly from the bound element. The methods and properties of an implementation can be defined declaratively using method and property tags in XML, or an external implementation (e.g., a binary implementation) can be specified using the src attribute. When the src attribute is specified, any children of the implementation element are ignored. Methods Methods are defined using the method element. The name given on the tag using the name attribute is the name that can be used to invoke the method on the element. A method with parameters specifies those parameters and their names with parameter elements declared underneath the method element. The implementation of the method is contained i...
...ent using property tags. There are two basic types of properties. The first type of property is a raw value that is set directly on the element itself. The second type of property is one that defines functions that are invoked when the property is either retrieved or set. These functions are called getters and setters in XBL. For properties with raw values, an initial value can be specified as a child of the property tag. The script is evaluated at the time of binding attachment and the resulting value is stored on the element. It can be assumed that the anonymous content of the binding has been fully constructed, although the bindingattached event will not have fired. Property initialization always takes place after content generation but before the firing of a binding attachment event, since...
XBL 1.0 Reference - Archive of obsolete content
ound element. There are numerous adjustments in the current implementation in comparison of earlier XBL proposals, and not all of them are reflected yet in this document. The documentation process is still in progress: please keep it in your mind while using the provided information. XBL Elements XBL 1.0 elements are in the http://www.mozilla.org/xbl namespace. ...
... 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 Selectors and Scopes Binding Stylesheets Binding Implementations Introduction Methods Properties Inheritance of Implementations Event Handlers Example - Sticky Notes Updated and adjuste...
allowevents - Archive of obsolete content
This means that elements placed inside a listitem do not respond to events, and instead clicking the mouse simply selects that item within the list. By setting the allowevents attribute to true, this special behavior is disabled, and the events are targeted the same as other elements. ...
...to true on a descendant instead. This does the same thing in that it allows events to be targeted normally, but allows this to be different for each descendant. This behavior is used for menus, for instance, to allow a menu button to behave as a menu when clicking on it, yet have part of the menu behave as a button. For the latter, the allowevents attribute is set to true to have a click on the child button receive events instead of targeting all events at the menu. ...
context - Archive of obsolete content
...
... ...
orient - Archive of obsolete content
The default value depends on the element. You can also use the -moz-box-orient style property. horizontal Child elements of the element are placed next to each other in a row in the order that they appear in the XUL source. ...
... << XUL Reference home orient Type: one of the values below Used to specify whether the children of the element are oriented horizontally or vertically. The default value depends on the element. You can also use the -moz-box-orient style property. horizontal Child elements of the element are placed next to each other in a row in the order that they appear in the XUL source. vertical Child elements of the element are placed under each other in a column in the order that they appear in the XUL source. See also separator.orient ...
pack - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › pack
<< XUL Reference home pack Type: one of the values below The pack attribute specifies where child elements of the box are placed when the box is larger that the size of the children. For boxes with horizontal orientation, it is used to indicate the position of children horizontally. For boxes with vertical orientation, it is used to indicate the position of children vertically. The align attribute is used to specify the position in the opposite direction. You can also specify the value of pack using the style property -moz-box-pack. start Child elements are placed starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side...
... is used to specify the position in the opposite direction. You can also specify the value of pack using the style property -moz-box-pack. start Child elements are placed starting from the left or top edge of the box. If the box is larger than the total size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. See also More on box packing in the XUL Tutorial ...
tooltip - Archive of obsolete content
...
... ...
treecol.type - Archive of obsolete content
olumns are checkboxes. progressmeter The content of the columns are a progress meters. This is used in Mozilla's download manager window. text The content of the columns is text. If you are using type="checkbox", then the tree and each treecol must be editable. You need to apply CSS to make the checkbox toggle. Here is an example CSS style using the current theme's checkboxes: treechildren::-moz-tree-checkbox { /* unchecked checkbox treecells. This style MUST come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */ list-style-image: none; } treechildren::-moz-tree-checkbox(checked) { /* checked checkbox treecells. cbox-check.gif isn't available in Firefox 1, 2, and 3 in Mac OS X so you should specify a URL to an image in your exten...
...cbox-check.gif isn't available in Firefox 1, 2, and 3 in Mac OS X, so you should specify a URL to an image in your extension or elsewhere. ...
findbar - Archive of obsolete content
, , , , statusText, style, ,, tooltip, tooltipText, top, width browser Type: browser element Lets you set and get the browser in which the findbar is located. findMode Type: integer Read only. The find mode in use. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData close() Return ty...
Methods - Archive of obsolete content
tifications replaceGroup reset rewind scrollByIndex scrollByPixels scrollToIndex select selectAll selectItem selectItemRange selectTabAtIndex setSelectionRange showPane showPopup sizeTo startEditing stop stopEditing swapDocShells syncSessions timedSelect toggleItemSelection Related DOM element methods DOM:element.addEventListener DOM:element.appendChild DOM:element.compareDocumentPosition DOM:element.dispatchEvent DOM:element.getAttribute DOM:element.getAttributeNode DOM:element.getAttributeNodeNS DOM:element.getAttributeNS DOM:element.getElementsByTagName DOM:element.getElementsByTagNameNS DOM:element.getFeature FIXME: brokenLink DOM:element.getUserData DOM:element.hasAttribute DOM:element.hasAttributeNS DOM:element.ha...
...tPosition DOM:element.dispatchEvent DOM:element.getAttribute DOM:element.getAttributeNode DOM:element.getAttributeNodeNS DOM:element.getAttributeNS DOM:element.getElementsByTagName DOM:element.getElementsByTagNameNS DOM:element.getFeature FIXME: brokenLink DOM:element.getUserData DOM:element.hasAttribute DOM:element.hasAttributeNS DOM:element.hasAttributes DOM:element.hasChildNodes DOM:element.insertBefore DOM:element.isEqualNode DOM:element.isSameNode DOM:element.isSupported DOM:element.lookupNamespaceURI DOM:element.lookupPrefix DOM:element.normalize DOM:element.removeAttribute DOM:element.removeAttributeNode DOM:element.removeAttributeNS DOM:element.removeChild DOM:element.removeEventListener DOM:element.replaceChild DOM:element.setAttrib...
OpenClose - Archive of obsolete content
th other ways of opening a menu, the popupshowing event will be fired to provide an opportunity to customize the commands that appear on the menu. There are several situations when opening a menu is not allowed. These are: if the menu is already open, or already in the process of being opened. Naturally, attempting to open a menu that is already open doesn't have any effect. if the menu is a child of another menu and the parent menu is not open. In this case, the parent menu must be opened first. If you do want to open a submenu, open the parent menu first, and then open the child menu in a popupshown event listener. See The popupshown event for an example of how to do this. a menu in an unprivileged content window (such as a web page) can only open a popup while its window is focused, an...
...parent menus will close as well. A menu may be closed by a script by setting the open property to false, the reverse of what would be done to open the menu. The open property applies to the menu or button, not to the menupopup. somemenu.open = false; This command will close only a single level of menus, so any parent menus will need to be closed with a similar command if desired. However, any child menus of 'somemenu' in the example will be closed, as 'somemenu' will no longer be open. For instance, let's say that a File menu has a submenu containing a list of recent files. If both menus are open and the open property on the submenu is set to false, the submenu will close, yet the parent File menu will remain open. On the other hand, if the open property on the File menu is set to false, bo...
Sorting and filtering a custom tree view - Archive of obsolete content
this is useful if this is an editable table //to prevent the user from ...
...this is useful if this is an editable table //to prevent the user from losing the row the...
Building Menus With Templates - Archive of obsolete content
to be created until the user needs to use the menu. It is very simple to create a menu using a template. Here is an example using an XML source: <button type="menu" datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"/> <action> <menupopup> <menuitem uri="?" label="?name"/> </menupopup> </action> </template> </button> <button label="Children" oncommand="alert(this.previousSibling.childNodes.length);"/> In this example, the datasources attribute has been placed on a menu-type button. The query generates a list of the person tags within the datasource and outputs the action body for each one. The uri attribute has not been placed on the menupopup element which is the direct child of the action element but has instead been placed on...
...ment which is the direct child of the action element but has instead been placed on the menuitem element. This causes the menupopup to only be created once. The menuitem elements however will be repeated for each result from the query. This makes sense, as we only want one menupopup to be created but multiple menuitem elements. The second button in the example displays an alert with the number of children the template-driven button has. If you press this button before opening the menu, there will be one child (the template itself). However, after the menu has been opened, there will be two children, one is the template and the other is the generated menupopup. Note that the generated content does not get removed again when the menu is closed again; this extra feature of menus is only intended t...
Filtering - Archive of obsolete content
If this is set, we add a filter, otherwise we remove it. The code is fairly straightforward. A new <triple> element is created and the object attribute is set to the value to filter by. F...
...If this is set, we add a filter, otherwise we remove it. The code is fairly straightforward. A new <triple> element is created and the object attribute is set to the value to filter by. For example, the resulting triple for the Netherlands mi...
Multiple Rule Example - Archive of obsolete content
n a different manner. This is useful if you wish to hide any content that would be needed to display the description. The next example shows how we can do this. ...
... <label value="?title"/> <image src="?photo"/> </vbox> <groupbox> <caption label="Photo Details"/> <label value="?description"/> <label value="Date: ?date"/> </groupbox> </hbox> </action> </rule> <rule> <conditions> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?phototitle"/> </conditions> <action> <vbox uri="?photo" class="box-padded"> <label value="?phototitle"/> <image src="?photo"/> </vbox> </action> </rule> </template> </vbox> In this example, the first rul...
Result Generation - Archive of obsolete content
t at D and follow two arrows back (and only following arrows backwards). This will get one result, A. Look at the graph to see if you can see why one result would be generated in this case. In XUL template terminology, the starting point is called the container or reference point and the endpoint is called the member. It is so called because it is most common to gather the list of the members, or children, of a container. But this doesn't have to be the case. Any starting point and ending points will do. Nodes in RDF are identified by a string value. There are two types of nodes in RDF, resources which usually represent 'things', and literals which are values like the names, dates or sizes of those things, and so on. A literal's value is, for example, the name of the thing, such as 'Fred'. A re...
...ng point using the 'ref' attribute. Here is an example: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/A" flex="1"> This is an indicator that we want to construct a XUL template using the reference point with the URI 'http://www.xulplanet.com/rdf/A'. Query Processing A query for an RDF datasource consists of a number of statements, placed as children of the query element. During query processing, the template builder builds up a network of information such as: possible results that are available where content should be generated information that indicates what to do when the RDF datasource changes This network of information remains for the lifetime of the template, or until it is rebuilt. The template builder uses a method based o...
Using Multiple Queries to Generate More Results - Archive of obsolete content
use two queries to generate results from different parts of the datasource. The first query will match the streets as before, but the second query will generate a result for each person. A header class is used to distinguish the content, although you could use exactly the same content if you wish. ...
... Multiple Queries with XML Sources You can also use more than query when using an XML source. Here is an example which gener...
XML Assignments - Archive of obsolete content
It allows us to declare additional variables that may be used in the action body. The expr attribute specifies the XPath expression and the var attribute specifies the variable to assign to. Note that while the query expression uses the root node (or reference node) as the XPath context, the expressions for the assign element are evaluated using each result node as the co...
...iable will be assigned the length of the name attribute on the result node, and the ?siblings variable will be assigned the number of sibling nodes the result has. (In this case, the number of XML node siblings in the document, not the number of real siblings the people have, clearly the people in the datasource aren't actually siblings). Naturally, the number of siblings will be the same for all children, but you could imagine a more complex query expression that generated nodes where this wasn't actually the case. The two variable assignments may then be used in the action body to replace attributes in the generated content. If a variable is used in the action that doesn't correspond to one declared in an assign element, the default behaviour is to take the corresponding attribute on the resu...
textbox (Toolkit autocomplete) - Archive of obsolete content
ut attribute. type Type: string Set to the value autocomplete to have an autocomplete textbox. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData getSearchAt( inde...
Textbox (XPFE autocomplete) - Archive of obsolete content
he type attribute. userAction Type: string Gets and sets the value of the userAction attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addSession( sessi...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
Watch for a snippet that you can copy and paste into Scratchpad, and then run on Gists@GitHub here: _ff-addon-snippet-AddToolbarButtonToPalette.js . It is based on the code from the repo above. Here are some discussions at Mozillazine about adding a toolbar bu...
...ste into Scratchpad, and then run on Gists@GitHub here: _ff-addon-snippet-AddToolbarButtonToPalette.js . It is based on the code from the repo above. Here are some discussions at Mozillazine about adding a toolbar button in a Bootstrap addon: Programmatically add a button to toolbar palette? The advantage to adding the toolbar button to the palette rather than creating an element and then appendChild to the toolbar (document.getElementById('nav-bar')) or appendChild to the addon bar (document.getElementById('addon-bar')) is that once in the toolbar palette, users can configure it through the customize menu. They can drag it to the addon bar or to the toolbar. Styling the button Most toolbar buttons have icons. To attach an image to the button we use standard Mozilla skinning facilities. If ...
Adding Properties to XBL-defined Elements - Archive of obsolete content
get or set the additional properties and call the methods on it. There are three types of items you can add. Fields are used to hold a simple value. Properties can also be used to hold a value but may have code execute when an attempt is made to retrieve or modify the value. Methods are functions which may be executed. All three are defined within an implementation element, which should be a child of the binding element. Within the implementation, you define individual field, property, and method elements, one for each one that you want. The general syntax is as follows: <binding id="element-name"> <content> -- content goes here -- </content> <implementation> <field name="field-name-1"/> <field name="field-name-2"/> <field name="field-name-3"/> <property name="pr...
... Whenever a script attempts to set the value of a property, it is set as an attribute on the element. This is convenient because then you can modify the property or the attribute and both will have the same value. Getter Element and Setter Element You can use an alternate syntax for the onget and onset attributes that is useful if the scripts are longer. You can replace the onget attribute with a child element called getter. Similarly, you can replace the onset attribute with a setter element. The example below shows this: <property name="number"> <getter> return this.getAttribute('number'); </getter> <setter> var v = parseInt(val,10); if (!isNaN(v)) { this.setAttribute('number', '' + v); } </setter> </property> The property in this example will only be able to ho...
Box Model Details - Archive of obsolete content
st interface is one that can be displayed at various sizes without problems. The box model may be difficult to understand without trying various various things out for yourself. The following is an outline of both types of boxes: Horizontal boxes Lay out their elements next to each other horizontally. Flexible elements are flexed horizontally. Packing controls their horizontal placement of child elements. Alignment controls how the row of elements are aligned vertically. Vertical boxes Lay out their elements vertically in a column. Flexible elements are flexed vertically. Packing controls the vertical placement of child elements. Alignment controls how the column of child elements are aligned horizontally. You can put boxes anywhere in a XUL file, including inside an HTML el...
... textbox also enforces a minimum width of 100 pixels. The check box appears in the right box along with its label. Just below the check box is a spacer. The spacer will grow and shrink but not exceed 30 pixels. The result is that the check box and the Find button will be spaced apart from each other by some space of no more than 30 pixels. The second box has an alignment of start. This causes the child elements to be aligned on the left edge. If this was not specified, the default would be stretch, which would make the child elements stretch horizontally. Because we don't want the Find button to change size, we need to set an alignment. Next, we will learn about a more specialized type of box, the groupbox. << PreviousNext >> ...
Content Panels - Archive of obsolete content
Sometimes, you will want to change part of the window. A good example is a step-by-step wizard that guides you through a number of screens, asking a set of questions. Each time the user clicks the Next button, the next screen of the wizard is displayed. You could create a wizard interface by opening a different window for each screen. There are three problems with this approach. ...
...specified using the type attribute. The first type is the default and is used if you don't specify a type. In this case, the content loaded inside the browser is treated as if it was part of the same application and has access to the outer window. That means that when a script loaded inside the browser tries to get the topmost window, it will get the outer XUL window. This would be suitable for a child XUL panel that is part of your application, but this isn't what you want for a browser that loads a web page. Instead, you would want to restrict the web page to only getting access to the web page content. You might note that a Mozilla browser window has XUL content for the toolbars and statusbar and so forth with a tabbrowser forming the main area. This inner area displays a web page, but the w...
Creating a Skin - Archive of obsolete content
ong the bottom of the window. Four elements, the menubar, the menupopup, the toolbar and the tabpanels appear in light blue. The border around these four elements has been changed to give a heavier 3D appearance. You can see this if you look closely. The background color of the caption has also been changed to match the background. The first rule above (for 'window > box') specifies that the child box of the window has a different color. This probably isn't the best way to do this. We should really change this to use a style class. Let's do this. That way, we can modify the XUL without needing to keep the box as the first child of the window. CSS: .findfilesbox { background-color: #0088CC; } XUL: <vbox class="findfilesbox" orient="vertical" flex="100%"> <toolbox> Rounding on the Tabs...
...s to use a style class. Let's do this. That way, we can modify the XUL without needing to keep the box as the first child of the window. CSS: .findfilesbox { background-color: #0088CC; } XUL: <vbox class="findfilesbox" orient="vertical" flex="100%"> <toolbox> Rounding on the Tabs Next, let's modify the tabs. We will make the selected tab bold and change the rounding on the tabs. tab:first-child { -moz-border-radius: 4px 0px 0px 0px; } tab:last-child { -moz-border-radius: 0px 4px 0px 0px; } tab[selected="true"] { color: #000066; font-weight: bold; text-decoration: underline; } Two rules change the normal tab appearance, the first sets the rounding on the first tab and the second sets the rounding on the last tab. Used here is a special Mozilla style rule, -moz-border-radi...
Groupboxes - Archive of obsolete content
ned according to the XUL box rules. However, there are several differences between groupboxes and regular boxes: The groupbox can be labeled using the caption element. The groupbox is displayed in a special way--usually with a beveled border and a caption, although you can change the appearance using CSS. You can create a caption for your groupbox by inserting a caption element as the first child. Groupboxes are box elements, so you can use the box attributes, such as orient and flex. A simple groupbox example The example below shows a simple groupbox: Example 1 : Source View <groupbox> <caption label="Answer"/> <description value="Banana"/> <description value="Tangerine"/> <description value="Phone Booth"/> <description value="Kiwi"/> </groupbox> This will cause four piece...
...n value="Banana"/> <description value="Tangerine"/> <description value="Phone Booth"/> <description value="Kiwi"/> </groupbox> This will cause four pieces of text to be displayed surrounded by a box with the label Answer. Note that the groupbox has a vertical orientation by default which is necessary to have the text elements stack in a single column. More complex captions You can also add child elements inside the caption element to create a more complex caption. For example, Mozilla's Font preferences panel uses a drop-down menu as a caption. Although any content can be used, usually you would use a checkbox or dropdown menu. Example 2 : Source View <groupbox flex="1"> <caption> <checkbox label="Enable Backups"/> </caption> <hbox> <label control="dir" value="Directory...
Skinning XUL Files by Hand - Archive of obsolete content
The parent-child relationship...
...la development community (again, refer to the skinning guidelines in Writing Skinnable XUL and CSS for more info); CSS2 also provides some new ways to group elements for styling, which we summarize briefly here, because they appear in Mozilla with some frequency, but reserve for another article: Pseudo-class Parent-Child element:pseudo-class { attribute: value; } parent > child { attribute: value; } button:hover { border: 1px; } menu#file > menuitem { font-weight: bold; } Pseudo-classes reflect states of the element: when the mouse moves over a button, for example, the appropriate pseudo-class stylesheet rules are applied. The parent-child relationship is more economical than the aforementioned contextual subgrouping, wh...
Templates - Archive of obsolete content
hould place the template element inside a tree element. Simple Template Example This is better explained with an example. Let's take a simple example where we want to create a button for each top-level bookmark. Mozilla provides a bookmarks datasource so it can be used to get the data. This example will only get the top-level bookmarks (or bookmark folders) as we're going to create buttons. For child bookmarks, we would need to use an element that displays a hierarchy such as a tree or menu. This example and any others that reference internal RDF datasources will only work if you load them from a chrome URL. For security reasons, Mozilla doesn't allow access to them from other sources. To view this example, you will need to create a chrome package and load the file from there (you can do ...
... There are two different types of builders. The first is a content builder and is used in most situations, and the other is a tree builder which is used only for trees. Content Builder The content builder takes the content inside the template element and duplicates it for each row. For instance, if the user had ten bookmarks in the example above, ten label elements would be created and added as children of the vbox element. If you were to use DOM functions to traverse the tree, you will find these elements there and can query their properties. These elements get displayed, but the template itself is not displayed, although it still exists in the document tree. In addition, the id of each of the labels will be set to the RDF resource for that row. The content builder always starts at the plac...
XUL Reference - Archive of obsolete content
stringbundleset tab tabbrowser (Firefox-only starting with Firefox 3/Gecko 1.9) tabbox tabpanel tabpanels tabs template textnode textbox textbox (Firefox autocomplete) textbox (Mozilla autocomplete) timepicker titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip tree treecell treechildren treecol treecols treeitem treerow treeseparator triple vbox where window wizard wizardpage Categorical list of all XUL elements << XUL Reference << Windows window wizard wizardpage titlebar Window structure --- Menus and popups --- Toolbars toolbar toolbarbutton toolbargrippy toolbaritem toolbarpallete toolbarseperator toolbarspring Tabs and...
...s tab tabpanels tabpanel groupbox caption separator spacer button checkbox colorpicker datepicker menulist progressmeter radio radiogroup scale splitter textbox textbox (Firefox autocomplete) textbox (Mozilla autocomplete) timepicker description label image listbox listitem listcell listcol listcols listhead listheader richlistbox richlistitem tree treecell treechildren treecol treecols treeitem treerow treeseparator box hbox vbox bbox deck stack grid columns column rows row scrollbox action assign binding bindings conditions content member param query queryset rule template textnode triple where script commandset command broadcaster broadcasterset observes key keyset stringbundle stringbundleset arrowscrollbox drop...
XUL controls - Archive of obsolete content
</menupopup> </toolbarbutton> More information about this type of menu toolbarbutton element. Toolbarbutton Reference Related Elements: menupopup menuitem toolbar <tree> A tree displays a hierarchy of items in multiple columns. <tree> <treecols> <treecol label="Name" flex="1"/> <treecol label="Size" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="Popcorn"/> <treecell label="Large"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="Root Beer"/> <treecell label="Small"/> </treerow> </treeitem> </treechildren> </tree> More information about the tree element. Tree Reference Related Elements: tre...
...treeitem> <treerow> <treecell label="Popcorn"/> <treecell label="Large"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="Root Beer"/> <treecell label="Small"/> </treerow> </treeitem> </treechildren> </tree> More information about the tree element. Tree Reference Related Elements: treecell treechildren treecol treecols treeitem treerow ...
action - Archive of obsolete content
Object, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
arrowscrollbox - Archive of obsolete content
lines, or a negative value to scroll backward that many lines. scrollByPixels( pixels ) Return type: no return value Scrolls the contents of the arrowscrollbox by a certain number of pixels. Use a positive value as the pixels argument to scroll forward that many pixels, or a negative value to scroll backward that many pixels. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
assign - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
bbox - Archive of obsolete content
Archive › Mozilla › XUL › bbox
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
binding - Archive of obsolete content
xObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related TBD ...
bindings - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related TBD ...
broadcaster - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
broadcasterset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
browser - Archive of obsolete content
methods are callable directly on the element itself, such as goBack and goForward. It also contains the load constants used by reloadWithFlags and loadURIWithFlags. webProgress Type: nsIWebProgress This read-only property contains an nsIWebProgress object which is used to monitor the progress of a document loading. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addProgres...
checkbox - Archive of obsolete content
led Type: boolean Gets and sets the value of the disabled attribute. src Type: URL Gets and sets the value of the src attribute. label Type: string Gets and sets the value of the label attribute. tabIndex Type: integer Gets and sets the value of the tabindex attribute. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
colorpicker - Archive of obsolete content
value of the disabled attribute. open Type: boolean Returns true if the popup for a button-type colorpicker is open. Set this property to true to open the popup or false to close the popup. tabIndex Type: integer Gets and sets the value of the tabindex attribute. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
command - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related XUL:List...
commandset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
conditions - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
datepicker - Archive of obsolete content
property to change the selected date. year Type: integer The currently selected year from 1 to 9999. Set this property to change the selected year. yearLeadingZero Type: boolean A read only value indicating whether a leading zero should be displayed before the year when it is less than 1000. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
dialog - Archive of obsolete content
ttribute. defaultButton Type: string Normally this attribute should not be set, but if it is, it specifies the default button in the dialog. Typically, this means that the button will be activated when the Enter key is pressed. This should be set to one of the same values as those for the buttons attribute. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData acceptDialo...
dialogheader - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
dropmarker - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
editor - Archive of obsolete content
indow ) Return type: nsIHTMLEditor Returns the HTML editing interface for the editor which contains methods for manipulating an HTML document. Pass the editor's contentWindow as the argument. makeEditable( editortype, waitForLoad ) Return type: no return value This function enables editing for an editor. Specify text or html as the editortype. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
grippy - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
groupbox - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
image - Archive of obsolete content
Archive › Mozilla › XUL › image
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes ...
keyset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
label - Archive of obsolete content
Archive › Mozilla › XUL › label
e. disabled Type: boolean Gets and sets the value of the disabled attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The fo...
listcol - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
listcols - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
listhead - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
listheader - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
listitem - Archive of obsolete content
ox 3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The ...
menubar - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
menupopup - Archive of obsolete content
This state will occur during the popupshowing event. hiding: The popup is about to be hidden. This state will occur during the popuphiding event. triggerNode Type: nsIDOMNode This read-only property holds the DOM node that generated the event triggering the opening of the popup. The value is null if the popup isn't open. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData hidePopup()...
notification - Archive of obsolete content
attribute. type Type: string Gets and sets the value of the type attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData close() Return t...
observes - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
page - Archive of obsolete content
Archive › Mozilla › XUL › page
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
popupset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
preference - Archive of obsolete content
boolean isElementEditable(in DOMElement element) Returns true, if the given element is "editable" (see below). void setElementValue(in DOMElement element); Initializes the supplied element from the value stored in the preference. This function calls onsyncfrompreference. void updateElements(); Update all elements that observe this preference. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Events change W...
progressmeter - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
query - Archive of obsolete content
Archive › Mozilla › XUL › query
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
queryset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
radio - Archive of obsolete content
Archive › Mozilla › XUL › radio
3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
resizer - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
script - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scrollbar - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
scrollcorner - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
separator - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The ...
spacer - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
spinbuttons - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
statusbar - Archive of obsolete content
xObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements ...
<statusbarpanel> - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The ...
stringbundle - Archive of obsolete content
vely, numbered indices of the format %n$S (e.g. %1$S, %2$S, etc.) can be used to specify the position of the corresponding parameter explicitly. If you need to handle substitutions involving plurals, take a look at Localization and Plurals. getString( key ) Return type: string Returns the string with the given key name from the string bundle. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related XUL Prop...
stringbundleset - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
tab - Archive of obsolete content
Archive › Mozilla › XUL › tab
3. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string Gets and sets the value of the value attribute. For textbox and user editable menulist elements, the contents, as visible to the user, are read and set using the Textbox.value and Menulist.value syntax. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Notes Note: Prior...
tabbrowser - Archive of obsolete content
methods are callable directly on the element itself, such as goBack and goForward. It also contains the load constants used by reloadWithFlags and loadURIWithFlags. webProgress Type: nsIWebProgress This read-only property contains an nsIWebProgress object which is used to monitor the progress of a document loading. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData addProgressL...
tabpanel - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
template - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
textbox - Archive of obsolete content
start, end ) Return type: no return value Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Style classes The ...
textnode - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
timepicker - Archive of obsolete content
read only value indicating whether a leading zero should be displayed before the second when it is less than 10. tabIndex Type: integer Gets and sets the value of the tabindex attribute. value Type: string The currently entered time of the form HH:MM:SS. Set this property to change the time. ...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Interfac...
titlebar - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
toolbargrippy - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
toolbaritem - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
toolbarseparator - Archive of obsolete content
xObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elem...
toolbarset - Archive of obsolete content
xObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elem...
toolbarspacer - Archive of obsolete content
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elements...
toolbarspring - Archive of obsolete content
xObject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData Related Elem...
tooltip - Archive of obsolete content
ed: The popup is closed and not visible. open: The popup is open and visible on screen. showing: A request has been made to open the popup, but it has not yet been shown. This state will occur during the popupshowing event. hiding: The popup is about to be hidden. This state will occur during the popuphiding event. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData hidePopup() ...
where - Archive of obsolete content
Archive › Mozilla › XUL › where
bject, builder, , , , className, , , , , collapsed, contextMenu, controllers, database, datasources, dir, , , flex, height, hidden, id, , , left, , maxHeight, maxWidth, menu, minHeight, minWidth, , , , , , , observes, ordinal, orient, , pack, , persist, , , , ref, resource, , , , , statusText, style, ,, tooltip, tooltipText, top, width Methods Inherited Methods addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAtt...
...k, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature, getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData ...
wizard - Archive of obsolete content
se pages are not necessarily navigated in order. title Type: string The title that appears at the top of the wizard. This is overridden by the label attribute on the individual pages. wizardPages Type: DOM NodeList of wizardpage elements This property holds the list of wizardpage elements in the wizard. ...
..., blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData << XUL Refere...
Using SSH to connect to CVS - Archive of obsolete content
atch file to set things up, just add the commands below to the end of your file. POSIX shell eval `ssh-agent -s` ssh-add ~/.ssh/id_dsa $SHELL ssh-agent -k exit X Windows In "~/.xinitrc" add "ssh-add". This will bring up a graphic box just after login, and before the desktop loads, asking for your passphrase. The passphrase will be held for the length of the x session, and be passed on to all child shells. MS-DOS command prompt Cygwin for /f "tokens=1,2,3* delims=; " %%a in ('ssh-agent -c') do if "%%a"=="setenv" set %%b=%%c set HOME=/cygdrive/c/path/to/your/cygwin/home/directory ssh-add ~/.ssh/id_dsa start /b /wait cmd.exe ssh-agent -k exit Essentially both sets of commands do the same thing. First ssh-agent is called and its output is evaluated in the current environment. This sets en...
... same thing. First ssh-agent is called and its output is evaluated in the current environment. This sets environment variables that let cvs know how to find and use the agent. Your private key is then added to ssh-agent using ssh-add at which point you will be prompted for the key's passphrase. Since it's important that you kill the agent when you're finished with it, the last three lines start a child environment that, when exited, will result in the agent's process being killed. The environment you will actually use to build is the child environment. There are a few things to note about the commands for the MS-DOS Command Prompt. First of all they will only work in versions of Windows based on NT (NT/2000/XP). If you're building on Win9x/WinME you'll need to find an alternative solution. If ...
-moz-stack-sizing - Archive of obsolete content
-moz-stack-sizing is an extended CSS property. Normally, a <xul:stack> will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible. /* Keyword values */ -moz-stack-sizing: auto; -moz-stack-sizing: ignore; /* Global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; If you wish to prevent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. The property is set not on the stack itself, but on the stack's children. This lets you ignore certain children, but not others. Note: In previous versions of Gecko it was possible to work around the pro...
... set -moz-stack-sizing to ignore on the child element. The property is set not on the stack itself, but on the stack's children. This lets you ignore certain children, but not others. Note: In previous versions of Gecko it was possible to work around the problem by setting very large negative bottom and right margins on the stack element and equally large positive bottom and right margins on the children whose size you didn't want to ignore. (The problem does not affect children moved above or to the left of the stack.) Initial valuestretch-to-fitApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values stretch-to-fit The child will influence the stack's size. ignore The stack won't consider this child when calculating its size. Formal syntax ...
display-outside - Archive of obsolete content
e layout-specific internal types. ruby-base, ruby-text, ruby-base-container, ruby-text-container The element is an internal ruby element, and participates in a ruby layout context. ruby-base and ruby-text are layout-specific leaf types; ruby-base-container and ruby-text-container are layout-specific internal types. layout-specific internal types These display types require their parent and children to be of particular display types. For example, a table-row box requires its parent to be a table row group box and its children to be table-cell boxes. layout-specific leaf types These display types require their parent to be of a particular display type, but can accept any display-inside value. For example, a table-caption box must have a table parent, but can establish any kind of formatt...
...lar display types. For example, a table-row box requires its parent to be a table row group box and its children to be table-cell boxes. layout-specific leaf types These display types require their parent to be of a particular display type, but can accept any display-inside value. For example, a table-caption box must have a table parent, but can establish any kind of formatting context for its children. Formal syntax Syntax not found in DB! Specifications Specification Status Comment CSS Display Module Level 3The definition of 'display-outside' in that specification. Candidate Recommendation Initial definition ...
Displaying notifications (deprecated) - Archive of obsolete content
whether by being clicked or by some other means). Note: If the notification is dismissed by the user clicking on it, both events will get fired. ...
...append a little HTML to our document when these events fire: notification.onclick = function() { var e = document.createElement("p"); e.innerHTML = "<strong>The notification was clicked.</strong>"; document.body.appendChild(e); }; notification.onclose = function() { var e = document.createElement("p"); e.innerHTML = "<strong>The notification was closed.</strong>"; document.body.appendChild(e); }; Displaying the notification Once the notification is configured the way you want it to be, call its show() method to display the notification: notification.show(); On Android, for example, the resulting notification panel looks like this: When the user taps on the "Hey, check this out!" notification here, the resulting changes to the document look like this: If you're using Fire...
E4X for templating - Archive of obsolete content
low) ++it; } } else { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(k, arr[k], it, lev); ++it; } } return ret; } The following real case example iterates over an array of the lines in an E4X child element to produce an XMLList of multiple vbox's representing each line: <vbox> {foreach(e(someEl.someChild[0]).split('\n'), function (line) <description>{line}</description> )} </vbox> The following example shows iteration over an E4X object itself: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem}</row> <row><image src="chrome://myExt/skin/images/FillerRow.jpg" /></ro...
...LList of multiple vbox's representing each line: <vbox> {foreach(e(someEl.someChild[0]).split('\n'), function (line) <description>{line}</description> )} </vbox> The following example shows iteration over an E4X object itself: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem}</row> <row><image src="chrome://myExt/skin/images/FillerRow.jpg" /></row> </>)} or if the E4X child element had its own children and text: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem.text()} {elem.someChild}</row> <row><image src="chrome://myExt/skin/images/FillerRow.jpg" /></row> </>)} Sorting /* @param {XMLList} xmllist The XMLList to sort @param {Function} h The sorting handler */ function sort (xmllist, h) { var k, arr=[], ret = <></>; for (k in xmllist) ...
Introduction - Archive of obsolete content
of the normal attributes on elements that you would normally include in an XML document. var element3 = <foo baz="1"/>; Manipulating Elements The goal of E4X was to provide an easier way for JavaScript programmers to manipulate an XML document, without going through the DOM interfaces. However, many of the same functions that you would use in the DOM can be used in E4X. The most basic is appendChild var element1 = <foo/>; var element2 = <bar/>; element1.appendChild(element2); which produces exactly the XML document you'd expect <foo> <bar/> </foo> Javascript Variables The true power of E4X only begins to come to light, however, when the XML document can interact closely with other JavaScript. With special syntax, we can assign the value of a JavaScript variable to be the value of an ...
...= a.toUpperCase(); var d = 5 * 5; return c + d;}()}</bar>; where the above produces: <bar>FOO25</bar>. See E4X for templating for more discussion on this usage. Serializing One of the most powerful tools of E4X is its ability to serialize an entire XML document (or portion thereof) into a string with one simple call to .toXMLString() var element1 = <foo/>; var element2 = <bar/>; element1.appendChild(element2); element1.toXMLString(); This will print <foo> <bar/> </foo> Calling toString() will achieve the same effect in this case, though calling toString() on an element with only text content will product the text content (e.g., <foo>abc</foo>.toString(); will simply provide 'abc'). << PreviousNext >> ...
Mozilla XForms User Interface - Archive of obsolete content
esentation checkbox group - used when appearance = 'full' select1 Combobox control. Allows the user to choose a single value from a list of pre-defined values (see the spec). It can have the following representations: combobox - default representation listbox - used when appearance = 'compact' radio group - used when appearance = 'full' Additional Elements These elements may be used as child elements to the form controls described above. label Specifies the label for the xforms control (see the spec). Every form control other than the output element must contain a label element. It is valid for a form control to have an empty label element. help Specifies contextual help for the containing form control (see the spec). The help will be displayed if the F1 key is pressed while the cont...
... the specified range of selectable values (see the spec). message Used in combination with event listeners to display a message to the user when the specified event occurs (see the spec). XForms User Interface These elements are mainly used to organize and manage the form's markup. They can be bound to instance nodes to define context for the xforms controls that they contain, should any of their child nodes happen to use relative xpath expressions. Binding these elements to instance data is also a way to apply Model Item Properties (for example, relevancy) to the elements. Elements in this section do not have any behaviors that are dependent on the host language. group This element is used to logically group xforms elements together (see the spec). switch This element is used in conjunction wi...
Building up a basic demo with A-Frame - Game development
After that it's all about setting the proper attributes: color, height, radius and position. The last line adds the newly created cylinder to the scene. That's it -- you've created three different shapes with A-Frame! Here's how it looks right now: It is impressive to be...
...such a scene with just a few lines of HTML and JavaScript. Animation We've already used rotation and position to move the shapes on the scene, and we can also scale them. These attributes can be manipulated to create the illusion of animation. Rotation There's a special <a-animation> entity that can help us animate elements. Add the <a-animation> element seen below to the <a-box> element as a child, as shown: <a-box color="#0095DD" rotation="20 40 0" position="0 1 0"> <a-animation attribute="rotation" from="20 0 0" to="20 360 0" direction="alternate" dur="4000" repeat="indefinite" easing="ease"> </a-animation> </a-box> As with any other entities, you can define key properties for the animation. We'll be animating the rotation attribute from 20 0 0 to...
Positioning - Learn web development
se properties can take any units you'd logically expect -- pixels, mm, rems, %, etc. If you now save and refresh, you'll get a result something like this: <h1>Relative positioning</h1> <p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p> <p class="positioned">By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overfl...
...s. Let's try changing the position declaration in your code as follows: position: absolute; If you now save and refresh, you should see something like so: <h1>Absolute positioning</h1> <p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p> <p class="positioned">By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overfl...
Styling links - Learn web development
rySelector(".html-input"); var cssInput = document.querySelector(".css-input"); var reset = document.getElementById("reset"); var htmlCode = htmlInput.value; var cssCode = cssInput.value; var output = document.querySelector(".output"); var solution = document.getElementById("solution"); var styleElem = document.createElement('style'); var headElem = document.querySelector('head'); headElem.appendChild(styleElem); function drawOutput() { output.innerHTML = htmlInput.value; styleElem.textContent = cssInput.value; } reset.addEventListener("click", function() { htmlInput.value = htmlCode; cssInput.value = cssCode; drawOutput(); }); solution.addEventListener("click", function() { htmlInput.value = htmlCode; cssInput.value = 'p {\n font-size: 1.2rem;\n font-family: sans-serif;\n ...
...usic</a></li><li><a href="#">Wombats</a></li><li><a href="#">Finland</a></li> </ul> And now our CSS: body,html { margin: 0; font-family: sans-serif; } ul { padding: 0; width: 100%; } li { display: inline; } a { outline: none; text-decoration: none; display: inline-block; width: 19.5%; margin-right: 0.625%; text-align: center; line-height: 3; color: black; } li:last-child a { margin-right: 0; } a:link, a:visited, a:focus { background: yellow; } a:hover { background: orange; } a:active { background: red; color: white; } This gives us the following result: Let's explain what's going on here, focusing on the most interesting parts: Our second rule removes the default padding from the <ul> element, and sets its width to span 100% of the outer conta...
Styling lists - Learn web development
10px; } h2 { font-size: 2rem; } ul,ol,dl,p { font-size: 1.5rem; } li, p { line-height: 1.5; } /* Description list styles */ dd, dt { line-height: 1.5; } dt { font-weight: bold; } The first rule sets a sitewide font and a baseline font size of 10px. These are inherited by everything on the page. Rules 2 and 3 set relative font sizes for the headings, different list types (the children of the list elements inherit these), and paragraphs. This means that each paragraph and list will have the same font size and top and bottom spacing, helping to keep the vertical rhythm consistent. Rule 4 sets the same line-height on the paragraphs and list items -- so the paragraphs and each individual list item will have the same spacing between lines. This will also help to keep the vertic...
...rySelector(".html-input"); var cssInput = document.querySelector(".css-input"); var reset = document.getElementById("reset"); var htmlCode = htmlInput.value; var cssCode = cssInput.value; var output = document.querySelector(".output"); var solution = document.getElementById("solution"); var styleElem = document.createElement('style'); var headElem = document.querySelector('head'); headElem.appendChild(styleElem); function drawOutput() { output.innerHTML = htmlInput.value; styleElem.textContent = cssInput.value; } reset.addEventListener("click", function() { htmlInput.value = htmlCode; cssInput.value = cssCode; drawOutput(); }); solution.addEventListener("click", function() { htmlInput.value = htmlCode; cssInput.value = 'ul {\n list-style-type: square;\n}\n\nul li, ol li {\n ...
What are browser developer tools? - Learn web development
alert('hello!); document.cheeseSelector('html').style.backgroundColor = 'purple'; const myWordmark = document.createElement('img'); myBanana.setAttribute('src','https://blog.mozilla.org/press/wp-content/themes/OneMozilla/img/mozilla-wordmark.png'); document.querySelector('h1').ap...
...ordmark); Now try entering the following incorrect versions of the code and see what you get. alert('hello!); document.cheeseSelector('html').style.backgroundColor = 'purple'; const myWordmark = document.createElement('img'); myBanana.setAttribute('src','https://blog.mozilla.org/press/wp-content/themes/OneMozilla/img/mozilla-wordmark.png'); document.querySelector('h1').appendChild(myWordmark); You'll start to see the kind of errors that the browser returns. Often these errors are fairly cryptic, but it should be pretty simple to figure these problems out! Find out more Find more out about the JavaScript console in different browsers: Firefox Web Console IE JavaScript console Chrome JavaScript Console (Opera's inspector works the same as this) Safari Console ...
Other form controls - Learn web development
x, and the autocomplete box. In both cases the interaction is the same -- once the control is activated, the browser displays a list of values the user can select between. Note: You can find examples of all the drop-down box types on GitHub at drop-down-content.html (see it live also). Select box A simple select box is created with a <select> element with one or more <option> elements as its children, each of which specifies one of its possible values. <select id="simple" name="simple"> <option>Banana</option> <option selected>Cherry</option> <option>Lemon</option> </select> If required, the default value for the select box can be set using the selected attribute on the desired <option> element -- this option is then preselected when the page loads. The <option> elements can b...
...x no longer displays the values as drop-down content -- instead, all values are displayed at once in a list, with the optional size attribute determining the height of the widget. Note: All browsers that support the <select> element also support the multiple attribute. Autocomplete box You can provide suggested, automatically-completed values for form widgets using the <datalist> element with child <option> elements to specify the values to display. The <datalist> needs to be given an id. The data list is then bound to an <input> element (e.g. a text or email input type) using the list attribute, the value of which is the id of the data list to bind. Once a data list is affiliated with a form widget, its options are used to auto-complete text entered by the user; typically, this is prese...
UI pseudo-classes - Learn web development
Then we give the generated content the content "required", which is what we wanted our label to say, and style and position it as we want. The result is seen below. Styling controls based on whether their data is valid The other really important, fundamental concept in form validation is whether a form control's data i...
...r other) focus. The :placeholder-shown pseudo-class matches <input> and <textarea> elements that have their placeholder showing (i.e. the contents of the placeholder attribute) because the value of the element is empty. The following are also interesting, but as yet not well-supported in browsers: The :blank pseudo-class selects empty form controls. :empty also matches elements that have no children, like <input>, but it is more general -- it also matches other empty elements like <br> and <hr>. :empty has reasonable browser support; the :blank pseudo-class's specification is not yet finished, so it not yet supported in any browser. The :user-invalid pseudo-class, when supported, will be similar to :invalid, but with better user experience. If the value is valid when the input receives f...
A first splash into JavaScript - Learn web development
Let's imagine your boss has giv...
...hat when it is clicked, a function called resetGame() is run. Now we need to define this function too! Add the following code, again to the bottom of your JavaScript: function resetGame() { guessCount = 1; const resetParas = document.querySelectorAll('.resultParas p'); for (let i = 0 ; i < resetParas.length ; i++) { resetParas[i].textContent = ''; } resetButton.parentNode.removeChild(resetButton); guessField.disabled = false; guessSubmit.disabled = false; guessField.value = ''; guessField.focus(); lastResult.style.backgroundColor = 'white'; randomNumber = Math.floor(Math.random() * 100) + 1; } This rather long block of code completely resets everything to how it was at the start of the game, so the player can have another go. It: Puts the guessCount back do...
Object-oriented JavaScript for beginners - Learn web development
class's constructor function is run to create it. This process of creating an object instance from a class is called instantiation -- the object instance is instantiated from the class. Specialist classes In this case we don't want generic people -- we want teachers and students, which are both more specific types of people. In OOP, we can create new classes based on other classes -- these new child classes can be made to inherit the data and code features of their parent class, so you can reuse functionality common to all the object types rather than having to duplicate it. Where functionality differs between classes, you can define specialized features directly on them as needed. This is really useful -- teachers and students share many common features such as name, gender, and age, so...
...e.g Yo, I'm Sam), whereas a teacher might use something more formal, such as "Hello, my name is [Prefix] [lastName], and I teach [Subject]." (e.g Hello, My name is Mr Griffiths, and I teach Chemistry). Note: The fancy word for the ability of multiple object types to implement the same functionality is polymorphism. Just in case you were wondering. You can now create object instances from your child classes. For example: In the rest of the article, we'll start to look at how OOP theory can be put into practice in JavaScript. Constructors and object instances JavaScript uses special functions called constructor functions to define and initialize objects and their features. They are useful because you'll often come across situations in which you don't know how many objects you will be cre...
React interactivity: Events and state - Learn web development
one component: events that happen in one component will affect other parts of the app. When we start giving ourselves the power to make new tasks, things that happen in the <Form /> component will affect the list rendered in <App />. We want our handleSubmit() function to ultimately help us create a new task, so we need a way to pass information from <Form /> to <App />. We can't pass data from child to parent in the same way as we pass data from parent to child using standard props. Instead, we can write a function in <App /> that will expect some data from our form as an input, then pass that function to <Form /> as a prop. This function-as-a-prop is called a callback prop. Once we have our callback prop, we can call it inside <Form /> to send the right data to <App />. Handling form submi...
...to the form and click "Add" (or press the Enter key) and you'll see your new todo item appear in the UI! However, we have another problem: our addTask() function is giving each task the same id. This is bad for accessibility, and makes it impossible for React to tell future tasks apart with the key prop. In fact, React will give you a warning in your DevTools console -- "Warning: Encountered two children with the same key..." We need to fix this. Making unique identifiers is a hard problem - one for which the JavaScript community has written some helpful libraries. We'll use nanoid because it's tiny, and it works. Make sure you're in the root directory of your application and run the following terminal command: npm install nanoid Note: If you're using yarn, you'll need the following inste...
React resources - Learn web development
see all of the components that make up our application, including some unique keys for the things that are rendered from arrays. On the right, we see the props and hooks that our App component utilizes. Notice, too, that the Form, FilterButton, and Todo components are indented to the right - this indicates that App is their parent. In more complex apps, this view is great for understanding parent/child relationships at a glance. React DevTools is available in a number of forms: A Chrome browser extension. A Firefox browser extension. A Chromium Edge browser extension (available soon). A stand-alone application you can install with NPM or Yarn. Try installing one of these, then using it to inspect the app you've just built! You can read more about React DevTools on the React blog. The...
...extension. A Chromium Edge browser extension (available soon). A stand-alone application you can install with NPM or Yarn. Try installing one of these, then using it to inspect the app you've just built! You can read more about React DevTools on the React blog. The Context API The application that we built in this tutorial utilized component props to pass data from its App component to the child components that needed it. Most of the time, props are an appropriate method for sharing data; for complex, deeply nested applications, however, they're not always best. React provides the Context API as a way to provide data to components that need it without passing props down the component tree. There's also a useContext hook that facilitates this. If you'd like to try this API for yourself,...
Working with Svelte stores - Learn web development
e of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn how to use Svelte stores Using stores we will create an Alert component that shows notifications on screen, which can receive messages from any component. In this case, the Alert component is independent from the rest -- it is not a parent or child of any other -- so the messages don't fit into the component hierarchy. We will also see how to develop our own custom store to persist the todo information to web storage, allowing our todos to persist over page reloads. Code along with us Git Clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git Then to get to the current...
... npm run dev to start your app in development mode. REPL To code along with us using the REPL, start at https://svelte.dev/repl/d1fa84a5a4494366b179c87395940039?version=3.23.2 Dealing with our app state We have already seen how our components can communicate with each other using props, two-way data binding, and events. In all these cases we were dealing with communication between parent and child components. But not all application state belongs inside your application's component hierarchy. For example, information about the logged in user, or whether the dark theme is selected or not. Sometimes, your app state will need to be accessed by multiple components that are not hierarchically related, or by a regular JavaScript module. Moreover, when your app becomes complicated and your com...
Focus management with Vue refs - Learn web development
Next We are nearly done with Vue. The last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. We'll look at using Vue refs to handle this -- an advanced feature that allows you to have direct access to the underlying DOM nodes below the virtual DOM, or direct access from one component to the internal DOM structure of a child component. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like ...
...ou often should not edit your HTML elements directly through native browser APIs (like Document.getElementById) when using frameworks, because it results in the VDOM and real DOM going out of sync. Instead, if you need to access the underlying DOM nodes (like when setting focus), you can use Vue refs. For custom Vue components, you can also use refs to directly access the internal structure of a child component, however this should be done with caution as it can make code harder to reason about and understand. To use a ref in a component, you add a ref attribute to the element that you want to access, with a string identifier for the value of the attribute. It's important to note that a ref needs to be unique within a component. No two elements rendered at the same time should have the same r...
Styling Vue components with CSS - Learn web development
ur app. While adding these files directly to the reset.css stylesheet would work, we'll instead add them to the <style> tags in App.vue to demonstrate how this can be used. There are already some styles present in the file. Let's remove those and replace them with the styles below. These styles do a few things -- adding some styling to buttons and inputs, and customizing the #app element and its children. Update your App.vue file's <style> element so it looks like so: <style> /* Global styles */ .btn { padding: 0.8rem 1rem 0.7rem; border: 0.2rem solid #4d4d4d; cursor: pointer; text-transform: capitalize; } .btn__danger { color: #fff; background-color: #ca3c3c; border-color: #bd2130; } .btn__filter { border-color: lightgrey; } .btn__danger:focus { outline-color: #c82333; } .
...: #c82333; } .btn__primary { color: #fff; background-color: #000; } .btn-group { display: flex; justify-content: space-between; } .btn-group > * { flex: 1 1 auto; } .btn-group > * + * { margin-left: 0.8rem; } .label-wrapper { margin: 0; flex: 0 0 100%; text-align: center; } [class*="__lg"] { display: inline-block; width: 100%; font-size: 1.9rem; } [class*="__lg"]:not(:last-child) { margin-bottom: 1rem; } @media screen and (min-width: 620px) { [class*="__lg"] { font-size: 2.4rem; } } .visually-hidden { position: absolute; height: 1px; width: 1px; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); clip-path: rect(1px, 1px, 1px, 1px); white-space: nowrap; } [class*="stack"] > * { margin-top: 0; margin-bottom: 0; } .s...
Handling common HTML and CSS problems - Learn web development
kes sense compared to it. 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 inside the <form>; you'd be better off using a general descendant selector instead of a child selector). However, another issue that appears in versions of IE older than 9 is that none of the newer selectors (mainly pseudo-classes and pseudo-elements like :nth-of-type, :not, ::selection, etc.) work. If you want to use these in your CSS and you need to support older IE versions, a good move is to use Keith Clark's Selectivizr library -- this is a small JavaScript library that works on top...
...rsions, a good move is to use Keith Clark's Selectivizr library -- this is a small JavaScript library that works on top of an existing JavaScript library like jQuery or MooTools. To try this example, make a local copy of selectivizr-example-start.html. If you look at this running live, you'll see that it contains two paragraphs, one of which is styled. We've selected the paragraph with p:first-child, which won't work in old versions of IE. Now download MooTools and Selectivizr, and save them in the same directory as your sample HTML. Put the following code into the head of your HTML document, just before the opening <style> tag: <script type="text/javascript" src="MooTools-Core-1.6.0.js"></script> <!--[if (gte IE 6)&(lte IE 8)]> <script type="text/javascript" src="selectivizr-m...
Accessibility/LiveRegionDevGuide
method will be explained in detail below. Event Types The table for web page mutation event types lists the two major event types associated with live regions, namely text-changed and object changed events. Both will be discussed in detail below. Object Changed The object changed events are slightly different in AT-SPI and IAccessible2. In AT-SPI, the object changed event are called object:children-changed events because the event is triggered on the parent of the object. The actual object that change can then be found in the event.any_data field. In IAccessible2, the EVENT_OBJECT_* events are triggered on the actual object that changed. The object changed events can be further subdivided into object addition and removal events. In AT-SPI, this is accomplished by appending ":add" or ":re...
... AT-SPI, this is accomplished by appending ":add" or ":remove" to the event string. In IAccessible2, there are two separate event types, namely EVENT_OBJECT_SHOW and EVENT_OBJECT_HIDE. Text Changed The text changed events are quite similar in AT-SPI and IAccessible2 with both having an insert and delete or removal events. The text changed event type in AT-SPI has a similar scheme as the object:children-changed events. In this case, the root event string is object:text-changed with ":delete" and ":insert" being appended to complete the event type. In IAccessible2, there are two distinct event types - IA2_EVENT_TEXT_REMOVED and IA2_EVENT_TEXT_INSERTED. The text associated with an AT-SPI text changed event is directly in the event object. The event.any_data field holds the entire text string wh...
Multiprocess on Windows
...
...nd know how to wrap a COM interface with an interceptor, we need to discuss how these things fit into the a11y tree. In general, the only COM objects which should need to be explicitly wrapped are the IAccessibles for top-level documents in the content process. As mentioned previously, the interceptor will automatically wrap outparams. When a wrapped COM object is queried for its children, those children are provided as outparams, and will themselves be wrapped. ...
Debugging Frame Reflow
ble width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). Below this is a line that reads: tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 Here the UC shows that on initial reflow the available height for the outer table frame is unconstrained. The table cell requires its children to compute the MES. It is reported back from the block as: block 02D7BCF8 d=300,300 me=300 The block max. element size is 300 twips. The second table reflow is started at rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879 where the previous information is used. The block has been required to compute the max. element size only once and it reports now: block 02D7BCF8 d=1410,300 The block shows the sa...
...from the block as: block 02D7BCF8 d=300,300 me=300 The block max. element size is 300 twips. The second table reflow is started at rowG 00B984A4 r=2 a=1500,UC c=1500,UC cnt=879 where the previous information is used. The block has been required to compute the max. element size only once and it reports now: block 02D7BCF8 d=1410,300 The block shows the same address as the previous one. Frames with children that overflow the parent have the NS_FRAME_OUTSIDE_CHILDREN flag set. For these frames the overflow area is displayed as block 025ED8F0 d=8940,1020 o=(0,0) 9180 x 1020. The overflow area is specified as (x,y) origin and width x height. The reflow finishes at the same level where it started. Advanced reflow debugging The previously described technique dumps the data for every frame. Sometimes t...
Debugging on Windows
is document explains how to debug Mozilla-derived applications such as Firefox, Thunderbird, and SeaMonkey on Windows using the Visual C++ IDE. If VC++ and your Mozilla application hang shortly after you launch the application under the debugger, see Problems Loading Debug Symbols. Ways to start the debugger First of all, it's necessary to install a Visual Studio extension to be able to follow child processes as they are created. Firefox, in general, and even in non-e10s mode, does not start the main process directly, it starts it via a Launcher Process. This means that Visual Studio will only attach to the first process it finds, and will not hit any break-point (and even notifies you that it cannot find their location). Microsoft Child Process Debugging Power Tool allows automatically atta...
...s as they are created. Firefox, in general, and even in non-e10s mode, does not start the main process directly, it starts it via a Launcher Process. This means that Visual Studio will only attach to the first process it finds, and will not hit any break-point (and even notifies you that it cannot find their location). Microsoft Child Process Debugging Power Tool allows automatically attaching to child processes, such as Web Content process, GPU process, etc. Enable it by going its configuration menu in "Debug > Other debugging targets > Child process debugging settings", and ticking the box. If you have followed the steps in Building Firefox for Windows and have a local debug build, you can execute ./mach run --debug from the same command line. It would open Visual Studio with Firefox's run o...
How Mozilla's build system works
This is when header files are installed, C++ files are compiled, files are preprocessed, and so on. Recursive Make Backend The recursive make backend is the tried-and-true backend used to build the tree. It's what's been used since the dawn of Mozilla. Essentially, there are makefiles in each directory. make starts processing the makefile in the root directory and then recursively descends into child directories until it's done. But there's more to the process than that. The recursive make backend divides the source tree into tiers. A tier is a grouping of related directories containing makefiles of their own. For example, there is a tier for the Netscape Portable Runtime (nspr), one for the JavaScript engine, one for the core Gecko platform, one for the XUL app being built, and so on. The ...
...res are the classes defined in data.py. Each class defines a specific aspect of the build system, such as directories to traverse, C++ files to compile, and so on. The TreeMetadataEmitter output is a stream of instances of these classes. The build system stream describing class instances emitted from TreeMetadataEmitter is then fed into a build backend. A build backend is simply an instance of a child class of a BuildBackend from base.py (in the mozbuild.backend package now, not mozbuild.frontend). The child class implements methods for processing individual class instances as well as common hook points, such as processing has finished. See recursivemake.py for an implementation of a BuildBackend. Although we call the base class BuildBackend, the class doesn't need to be focused with building...
Gecko Logging
at the application level to control what's actually printed via RUST_LOG. You can set an overall logging level, though it could be quite verbose: set RUST_LOG="debug" You can also target individual modules by path: set RUST_LOG="style::style_resolver=debug" For Linux/MacOS users, you need to use export rather than set. If you're only interested in the content process you can use RUST_LOG_CHILD rather than RUST_LOG. The log crate lists the available log levels: Log Level Purpose Rust Logging Levels error Designates very serious errors. warn Designates hazardous situations. info Designates useful information. debug Designates lower priority information. trace Designates very low priority, often extremely verbo...
...o Designates useful information. debug Designates lower priority information. trace Designates very low priority, often extremely verbose, information. It is common for debug and trace to be disabled at compile time in release builds, so you may need a debug build if you want logs from those levels. Check the env_logger docs for more details on logging options. Child Processes / e10s Sometimes it can be useful to only log child processes and ignore the parent process. In Firefox 57 and later, you can use RUST_LOG_CHILD to specify log settings that will only apply to child processes. ...
Limitations of chrome scripts
the content process. With the shim The shim enables you to add content policies in the chrome process. It transparently registers an nsIContentPolicy in the content process, whose shouldLoad just forwards to the chrome process. The content to check is forwarded as a CPOW. The chrome process then checks the content against the policy supplied by the add-on, and forwards the response back to the child to be enforced. To make the shim unnecessary: define and register nsIContentPolicy in the content process. If you need to ensure that the policy is only registered once, use a process script to register the policy. nsIWebProgressListener This API will work in the chrome process. There is a shim that gives you access to the DOMWindow property of the nsIWebProgress object passed into onStateChan...
...cesses. If an add-on wants to use a JSM to share state in this way, it's best to load the JSM in the chrome process, and have frame scripts store and access the JSM's state by sending messages to the chrome process using the message manager. nsIProtocolHandler In multiprocess Firefox, code which registers a custom protocol using nsIProtocolHandler must register the custom protocol in the child content process. If the custom protocol is registered only in the chrome process, no iframes or tabs will be able to load any resource from the custom procotol. The solution is to register the custom protocol in the content process. You can do this by loading a frame script or, with the Add-on SDK, you can use remoteRequire() in the "remote/parent" module. ...
Services.jsm
ache nsICacheService Cache service cache2 nsICacheStorageService Cache storage 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 nsIDroppedLinkHan...
...dManager Thread Manager service uriFixup nsIURIFixup URI Fixup service urlFormatter nsIURLFormatter URL Formatter service vc nsIVersionComparator Version comparator service wm nsIWindowMediator Window mediator service ww nsIWindowWatcher Window watcher service 1 Mobile only 2 Windows only 3 Main process only 4 Child process only ...
BloatView
cumulative) LEAK AND BLOAT STATISTICS, tab process 1862 |<----------------Class--------------->|<-----Bytes------>|<----Objects---->| | | Per-Inst Leaked| Total Rem| 0 |TOTAL | 17 2484|253953338 38| 17 |AsyncTransactionTrackersHolder | 40 40| 10594 1| 78 |CompositorChild | 472 472| 1 1| 79 |CondVar | 24 48| 3086 2| 279 |MessagePump | 8 8| 30 1| 285 |Mutex | 20 60| 89987 3| 302 |PCompositorChild | 412 412| 1 1| 308 |PImag...
... Here's how you interpret the columns. The first, numerical column is the index of the leaking class. Class - The name of the class in question (truncated to 20 characters). Bytes Per-Inst - The number of bytes returned if you were to write size...
powermetrics
nd. Quick start powermetrics provides a vast number of measurements. The following command encompasses the most useful ones: sudo powermetrics --samplers tasks --show-process-coalition --show-process-gpu -n 1 -i 5000 --samplers tasks tells it to just do per-process measurements. --show-process-coalition tells it to group coalitions of related processes, e.g. the Firefox parent process and child processes. --show-process-gpu tells it to show per-process GPU measurements. -n 1 tells it to take one sample and then stop. -i 5000 tells it to use a sample length of 5 seconds (5000 ms). Change this number to get shorter or longer samples. The following is example output from such an invocation: *** Sampled system activity (Fri Sep 4 17:15:14 2015 +1000) (5009.63ms elapsed) *** *** Runn...
...9.18 10.58 5.59 124.55 63.48 0.00 This sample was taken while the following programs were running: Firefox Beta (single process, invoked from the Mac OS dock, shown in the org.mozilla.firefox coalition.) Firefox Nightly (multi-process, invoked from the command line, shown in the com.apple.Terminal coalition.) Google Chrome. Safari. The grouping of parent and child processes (in coalitions) is obvious. The meaning of the columns is as follows. Name: Coalition/process name. Process names within coalitions are indented. ID: Coalition/process ID number. CPU ms/s: CPU time used by the coalition/process, per second, during the sample period. The sum of the process values typically exceeds the coalition value slightly, for unknown reasons. User%: Percentage...
SavedFrame
captured, allocated, and live within the compartment that is being observed or debugged. Usually this is a content compartment. Capturing SavedFrame Stacks From C++ Use JS::CaptureCurrentStack declared in jsapi.h. From JS Use saveStack, accessible via Components.utils.getJSTestingFunction(). Including and Excluding Chrome Frames Consider the following SavedFrame stack. Arrows represent links from child to parent frame, content.js is from a compartment with content principals, and chrome.js is from a compartment with chrome principals. function A from content.js | V function B from chrome.js | V function C from content.js The content compartment will ever have one view of this stack: A -> C. However, a chrome compartment has a choice: it can either...
...ack frame, as a string. line The line number for this stack frame. column The column number for this stack frame. functionDisplayName Either SpiderMonkeyaEUR(TM)s inferred name for this stack frameaEUR(TM)s function, or null. asyncCause If this stack frame is the asyncParent of other stack frames, then this is a string representing the type of asynchronous call by which this frame invoked its children. For example, if this frameaEUR(TM)s children are calls to handlers for a promise this frame created, this frameaEUR(TM)s asyncCause would be "Promise". If the asynchronous call was started in a descendant frame to which the requester of the property does not have access, this will be the generic string "Async". If this is not an asynchronous call point, this will be null. asyncParent If this...
Gecko events
a layout occurance and is thus asynchronous Is Supported: yes EVENT_ASYNCH_SIGNIFICANT_CHANGE An object had a significant layout change which could affect the type of accessible object -- this is a layout occurance and is thus asynchronous Is Supported: yes EVENT_ACTIVE_DECENDENT_CHANGED The active descendant of a component has changed. The active descendant is used in objects with transient children. Is Supported: no EVENT_FOCUS An object has received the keyboard focus. Is Supported: yes EVENT_STATE_CHANGE An object's state has changed. Is Supported: yes States: STATE_FOCUSED, STATE_BUSY, XXX: EVENT_LOCATION_CHANGE An object has changed location, shape, or size. Is Supported: no EVENT_NAME_CHANGE An object's Name property has changed. Is Supported: yes Targets: TABLE_CELL - th...
...NT_HYPERTEXT_NLINKS_CHANGED The number of hyperlinks associated with a hypertext object changed. EVENT_OBJECT_ATTRIBUTE_CHANGED An object's attributes changed. Also see EVENT_TEXT_ATTRIBUTE_CHANGED. EVENT_PAGE_CHANGED A slide changed in a presentation document or a page boundary was crossed in a word processing document. EVENT_INTERNAL_LOAD Used internally in Gecko. EVENT_REORDER An object's children have changed ...
Building the WebLock UI
nippet introduces a couple of new general layout widgets in XUL. The separator that appears at the top of this snippet creates a little divider between widgets like the kind you see in menus that divide sets of functionality available there. The parent of the textbox that users enter an URL into is something called an <hbox/>, which is a layout widget - often invisible - that controls the way its child elements are rendered. In this case the <hbox/> centers the textbox and the button children, and it orients them horizontally (in contrast to the <vbox/>, which orients its children vertically). Notice also that when it's clicked, the button executes a JavaScript function called addThisSite(), which we've already defined in the weblock.js file in Client Code Overview above. weblock.xul <?xml v...
...ock();" status="none"/> </statusbar> </overlay> Note that the root element for this file is not a <window/> but an <overlay/>. In overlays the ordinarily unique id attributes that XUL elements use to distinguish themselves are purposely made redundant with UI in the existing browser with which they should be merged. In this case, the weblock <statusbarpanel/> appears as a child of the <statusbar/> element with id "status-bar". This id is the same one used by the <statusbar/> in navigator.xul, which means that the overlay mechanism will merge the new UI here (i.e., the weblock statusbarpanel) and the UI already defined within that browser <statusbar/> at runtime. Other Resources This chapter describes the remaining files that must be added to and packaged up with the W...
Interfacing with the XPCOM cycle collector
N, for nonzero N). Periodically the collector wakes up and examines any suspicious pointers that have been sitting in its buffer for a while. This is the scanning stage of the collector's operation. In this stage the collector repeatedly asks each candidate for a singleton cycle-collection helper class, and if that helper exists, the collector asks the helper to describe the candidate's (owned) children. This way the collector builds a picture of the ownership subgraph reachable from suspicious objects. 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 considers that group cyclical garbage, which it then attempts to free. This is the unlinking stage o...
...' reference counts are all accounted for by internal pointers within the group, it considers that group cyclical garbage, which it then attempts to free. This is the unlinking stage of the collectors operation. In this stage the collector walks through the garbage objects it has found, again consulting with their helper objects, asking the helper objects to "unlink" each object from its immediate children. Note that the collector also knows how to walk through the JS heap, and can locate ownership cycles that pass in and out of it. How the collector can fail The cycle collector is a conservative device. There are situations in which it will fail to collect a garbage cycle. It does not suspect any pointers by default; objects must suspect themselves, typically by using an nsCycleCollecting...
IAccessible2
ll the objects at the same group level. Return value S_FALSE if no values are valid. S_OK if at least one value is valid. indexInParent() Returns the index of this object in its parent object. [propget] HRESULT indexInParent( [out] long indexInParent ); Parameters indexInParent 0 based; -1 indicates there is no parent; the upper bound is the value returned by the parent's IAccessible::get_accChildCount. Return value S_FALSE if no parent, [out] value is -1. S_OK. locale() Returns the IA2Locale of the accessible object. [propget] HRESULT locale( [out] IA2Locale locale ); Parameters locale Return value S_OK. localizedExtendedRole() Returns the localized extended role. [propget] HRESULT localizedExtendedRole( [out] BSTR localizedExtendedRole ); Parameters localizedExtendedRole Ret...
...tes( [out] AccessibleStates states ); Parameters states Return value S_OK. uniqueID() Returns the unique ID. The uniqueID is an identifier for this object, is unique within the current window, and remains the same for the lifetime of the accessible object. The uniqueID is not related to: The MSAA objectID which is used by the server to disambiguate between IAccessibles per HWND or The MSAA childID which is used to disambiguate between children being managed by an IAccessible. This value is provided so the AT can have access to a unique runtime persistent identifier even when not handling an event for the object. An example of when this value is useful is if the AT wants to build a cache. The AT could cache the uniqueIDs in addition to other data being cached. When an event is fired the A...
nsIDOMWindow
dom/interfaces/base/nsIDOMWindow.idlScriptable This interface is the primary interface for a window object. It represents a single window object that may contain child windows if the document in the window contains an HTML frameset document, or if the document contains iframe elements. 66 Introduced Gecko 1.0 Deprecated Gecko 44 Inherits from: nsISupports Last changed in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) Starting with Firefox 44, this file is empty as its features were either no longer used or are only available from C++ code; see dom/base/nsPIDOMWindow.h for those. While this interface is not officially defined by any standard bodies, it originates from the de-facto DOM Level 0 standard. Starting in Firefox 3, DOM windows...
...izeToContent(); Attributes Attribute Type Description applicationCache nsIDOMOfflineResourceList Get the application cache object for this window. Read only. Note: Prior to Gecko 7.0 this attribute was part of nsIDOMWindow2. document nsIDOMDocument The document contained in the window. Read only. frames nsIDOMWindowCollection The child windows for this window. Read only. Native code only! globalStorage nsIDOMStorageList Global storage, accessible by domain. Read only. Note: Prior to Gecko 8.0 this attribute was part of nsIDOMStorageWindow. localStorage nsIDOMStorage Local storage for the current browsing context. Data stored in local storage may only be accessed from the same origin that inserted t...
nsIEditor
DOMNode 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 AString formatType, in unsigned long flags); Example: // flags are declared in base/public/nsIDocumentEncoder.idl // OutputSelectionOnly = 1, OutputFormatted = 2, // OutputRaw = 4, Outp...
...// tag name are in lower case with <br>. editorAPI.outputToString('text/html', 8); // XML: all in xml with _moz_dirty="" in new tags, HTML tags are in upper case // application/xhtml+xml format do the same editorAPI.outputToString('text/xml', 2); // the body is not recognized, everything is printed void outputToStream(in nsIOutputStream aStream, ...
nsIMacDockSupport
/there.is.only.xul', 'menuitem'); macMenuItem.setAttribute('label', 'Show Most Recent Window'); macMenuItem.setAttribute('id', 'myMacMenuItem'); macMenuItem.addEventListener('command', function(){ var dockSupport = Cc['@mozilla.org/widget/macdocksupport;1'].getService(Ci.nsIMacDockSupport); dockSupport.activateApplication(true); Services.wm.getMostRecentWindow(null).focus() }) macMenu.appendChild(macMenuItem); var mainPopupSet = win.document.getElementById('mainPopupSet'); mainPopupSet.appendChild(macMenu); let dockMenuElement = macMenu; //document.getElementById("menu_mac_dockmenu");66 let nativeMenu = Cc["@mozilla.org/widget/standalonenativemenu;1"].createInstance(Ci.nsIStandaloneNativeMenu); console.log('dockMenuElement:', dockMenuElement); nativeMenu.init(dockMenuElement); dockSupp...
...Two types of elements: menu (if you would like to have sub menu items, make sure to set a label on the "menu" element) menuitem (like in example above) Elements can be hidden by adding the hidden attribute to the menu or menuitem and setting it to true . ...
nsIMenuBoxObject
openedWithKey boolean true if the menubar was opened using the keyboard; otherwise false. Note: For Gecko 2.0, the openedWithKey attribute exists on the nsIMenuBoxObject_MOZILLA_2_0_BRANCH interface. Subsequent Gecko versions will have the attribute on the nsIMenuBoxObject interface. Methods h...
... openedWithKey boolean true if the menubar was opened using the keyboard; otherwise false. Note: For Gecko 2.0, the openedWithKey attribute exists on the nsIMenuBoxObject_MOZILLA_2_0_BRANCH interface. Subsequent Gecko versions will have the attribute on the nsIMenuBoxObject interface. Methods handleKeyPress() boolean handleKeyPress( in nsIDOMKeyEvent keyE...
nsIMessageBroadcaster
e message to all frame message managers within its window. See Message Manager interfaces for more details on the distinction between message senders and message broadcasters. Methods void broadcastAsyncMessage([optional] in AString messageName, [optional] in jsval obj, [optional] in jsval objects); nsIMessageListenerManager getChildAt(in unsigned long aIndex); broadcastAsyncMessage() Like sendAsyncMessage(), but also broadcasts this message to all "child" message managers of this message manager. See nsIMessageListener::receiveMessage() for the format of the data delivered to listeners. WARNING: broadcasting messages can be very expensive and leak sensitive data. Use with extreme caution. Throws NS_ERROR_NOT_INITIA...
...eceived message. obj Object. The message payload. A structured clone of this becomes the data property of the received message. objects Object. An object each of whose properties is an object. This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it. getChildAt() Return a single subordinate message manager. Parameters Name Type Description aIndex Number The index of the subordinate message manager to retrieve. Returns nsIMessageListenerManager: the message manager at the given index. Attributes childCount Number: the number of subordinate message managers. Read only. ...
nsISelection
Read only. anchorOffset long The offset within the (text) node where the selection begins. Read only. focusNode...
...irection Can be one of { "forward", "backward", "left", "right" } granularity Can be one of { "character", "word", "line", "lineboundary" } removeAllRanges() Removes all nsIDOMRanges from the current selection. void removeAllRanges(); Parameters None removeRange() Removes a range from the current selection. void removeRange( in nsIDOMRange range ); Parameters range selectAllChildren() Adds all children of the specified node to the selection. void selectAllChildren( in nsIDOMNode parentNode ); Parameters parentNode The parent of the children to be added to the selection. selectionLanguageChange() Modifies the cursor Bidi level after a change in keyboard direction. void selectionLanguageChange( in boolean langRTL ); Parameters langRTL Is PR_TRUE if ...
nsIWebProgress
The nsIWebProgress interface is used to add or remove nsIWebProgressListener instances to observe the loading of asynchronous requests (usually in the context of a DOM window). nsIWebProgress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective DOM windows. However, in some cases a nsIWebProgress instance may not have an associated DOM window. ...
... used to add or remove nsIWebProgressListener instances to observe the loading of asynchronous requests (usually in the context of a DOM window). nsIWebProgress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective DOM windows. However, in some cases a nsIWebProgress instance may not have an associated DOM window. The parent-child relationship of nsIWebProgress instances is not made explicit by this interface, but the relationship may exist in some implementations. A nsIWebProgressListener instance receives notifications for the nsIWebProgress instance to which it added itself, and it may also receive notifications from any nsIWebProgress instances that are children of that nsIWebProgress instance. uriloader/base/nsIWebPr...
nsIXULTemplateResult
AString ID of the result. The DOM element created for this result, if any, will have its id attribute set to this value. The id must be unique for a query. isContainer boolean true if the result represents a container. Read only. isEmpty boolean true if the result represents an empty container. Read only. mayProcessChildren boolean true if the template builder may use this result as the reference point for additional recursive processing of the template. The template builder will reprocess the template using this result as the reference point and generate output content that is expected to be inserted as children of the output generated for this result. If false, child content is not processed. This p...
...meters None. ruleMatched() Indicate that a particular rule of a query has matched and that output will be generated for it. Both the query as compiled by the query processor's nsIXULTemplateQueryProcessor.compileQuery() method and the XUL <rule> element are supplied. The query must always be one that was compiled by the query processor that created this result. The <rule> element must always be a child of the <query> element that was used to compile the query. void ruleMatched( in nsISupports aQuery, in nsIDOMNode aRuleNode ); Parameters aQuery The query that matched. aRuleNode The rule node that matched. See also nsIXULTemplateQueryProcessor ...
nsMsgFolderFlagType
ost = 0x00000002; /// This folder is a mail folder. const nsMsgFolderFlagType Mail = 0x00000004; /** @} */ /** Whether this is a directory: NewsHosts are always directories; * NewsGroups can be directories if we are in ``show all groups'' mode; * Mail folders will have this bit if they are really directories, not files. * (Note that directories may have zero children.) */ const nsMsgFolderFlagType Directory = 0x00000008; /** Whether the children of this folder are currently hidden in the listing. * This will only be present if the nsMsgFolderFlags::Directory bit is on. */ const nsMsgFolderFlagType Elided = 0x00000010; /// Whether this is a virtual search folder const nsMsgFolderFlagType Virtual = 0x00000020; /*...
... = 0x00400000; /// This folder is one of your personal folders that is shared with other users const nsMsgFolderFlagType PersonalShared = 0x00800000; /// This folder is an IMAP \\Noselect folder const nsMsgFolderFlagType ImapNoselect = 0x01000000; /// This folder created offline const nsMsgFolderFlagType CreatedOffline = 0x02000000; /// This imap folder cannot have children :-( const nsMsgFolderFlagType ImapNoinferiors = 0x04000000; /// This folder configured for offline use const nsMsgFolderFlagType Offline = 0x08000000; /// This folder has offline events to play back const nsMsgFolderFlagType OfflineEvents = 0x10000000; /// This folder is checked for new messages const nsMsgFolderFlagType CheckNew = 0x20000000; /// This ...
Working with windows in chrome code
ocument in the sidebar Firefox has a sidebar, which is implemented as a <browser> element with id="sidebar". To access the elements and variables inside the sidebar, you need to use document.getElementById("sidebar").contentDocument or .contentWindow, like when Accessing content documents. For more sidebar tips, see Code snippets:Sidebar. Accessing the elements of the top-level document from a child window The opposite case is when you want to access the chrome document from a privileged script loaded in a <browser> or an <iframe>. A typical case when this can be useful is when your code runs in the sidebar in the main Firefox window and you want to access the elements in the main browser window. The DOM tree, as shown by the DOM Inspector, can look like this: #document window ...
...wser> or an <iframe>. A typical case when this can be useful is when your code runs in the sidebar in the main Firefox window and you want to access the elements in the main browser window. The DOM tree, as shown by the DOM Inspector, can look like this: #document window main-window ... browser #document window myExtensionWindow where the child window is where your code runs in. Your task is to access elements above your chrome document, i.e. to break out of your chrome window and access the ancestors. This can be done using the following statement: var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterf...
Plug-in Basics - Plugins
ed in pages - object elements can be nested to support different plug-in implementations. See the Mozilla ActiveX project page in the Plug-in References section below for more information about embedding ActiveX controls in plug-ins or embedding plug-ins in ActiveX applications. The following examples demonstrate this use of nested object elements with markup more congenial to Gecko included as children of the parent object element. Example 1: Nesting object Elements <html> <head> <title>Example 1: Nesting object Elements</title> <style type="text/css"> .myPlugin { width: 470px; height: 231px; } </style> </head> <body><p> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5...
...al with that MIME type (i.e., by loading a plug-in that's been registered for it), then it does so. If the browser cannot handle the MIME type, it looks in the element for a pointer to a plug-in that can be used to handle that MIME type. The browser downloads the requested plug-in. If the MIME type is unknown and there is no reference to a plug-in that can be used, the browser descends into the child element, where these rules for handling MIME types are repeated. The rest of this section is a brief introduction to this HTML element. For more information on the object element and other elements used for plug-in display, see W3C HTML 4.01 specification. To embed a variety of object types in an HTML page, use the object element. <object classid="classFile" data="dataLocation" codebase...
Accessibility Inspector - Firefox Developer Tools
guration Editor to set the preference devtools.accessibility.enabled to False. If you do this, the ways listed above for activating the Accessibility Inspector do nothing. Features of the Accessibility panel The enabled accessibility panel looks like so: On the left-hand side, there is a tree diagram representing all the items in the accessibility tree for the current page. Items with nested children have arrows that can be clicked to reveal the children, so you can move deeper into the hierarchy. Each item has two properties listed: Role -- the role this item has on the page (e.g., pushbutton, or footer). This can be either a default role provided by the browser, or a role given to it via a WAI-ARIA role attribute. Name -- the name this item has on the page. The name depends on the el...
...the Page Inspector. Hovering over the "target" icon highlights the DOM node in the page content. description -- any further description provided on the element, usually by the content of a title attribute. keyboardShortcut -- any keyboard shortcut that is available to activate the element, as specified in an accessKey attribute. Note that this works correctly as of Firefox 62 (bug 1467381). childCount -- the number of child items the current item has in the accessibility tree hierarchy. indexInParent -- an index value indicating what number child the item is, inside its parent. If the item is the first item inside its parent, it has a value of 0. If it is the second, it has a value of 1. And so on. states -- a list of the different accessibility-relevant states that can apply to the cur...
Browser Console - Firefox Developer Tools
he browser's user interface. ...
... tea?"); parent.appendChild(makeTheTea); On macOS, this similar code will add a new item to the "Tools" menu: var parent = window.document.getElementById("menu_ToolsPopup"); var makeTheTea = gBrowser.ownerDocument.defaultView.document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem"); makeTheTea.setAttribute("label", "A nice cup of tea?"); parent.appendChild(makeTheTea); ...
UI Tour - Firefox Developer Tools
ored, it has a small eye icon next to it in place of its regular icon. Download file opens a file dialog so you can save the file locally. For folders and groups, the following context menu options are available: Collapse all collapses all subfolders of the item. Expand all expands all subfolders of the item. ...
... Ignore files outside this directory causes all files other than those within the selected directory to be skipped by the debugger. ...
Call Tree - Firefox Developer Tools
nto the part of the recording that shows a long JavaScript marker: The Call Tree presents the results in a table. Each row represents a function in which at least one sample was taken, and the rows are ordered by the number of samples taken while in that function, highest to lowest. Samples is the number of samples that were taken when we were executing this particular function, including its children (the other functions called by this particular function). Total Time is that number translated into milliseconds, based on the total amount of time covered by the selected portion of the recording. These numbers should roughly be the same as the number of samples. Total Cost is that number as a percentage of the total number of samples in the selected portion of the recording. Self Time is ...
...e is that number translated into milliseconds, based on the total amount of time covered by the selected portion of the recording. These numbers should roughly be the same as the number of samples. Total Cost is that number as a percentage of the total number of samples in the selected portion of the recording. Self Time is calculated as the time spent in that particular function, excluding its children. This comes from the captured stacks where this function is the leafmost function. Self Cost is calculated from Self Time as a percentage of the total number of samples in the selected portion of the recording. In the current version of the Call Tree, these are the most important columns. Functions with a relatively high Self Cost are good candidates for optimization, either because they tak...
Storage Inspector - Firefox Developer Tools
Table Widget Th...
... Table Widget The table widget displays a list of all the items corresponding to the selected tree item (be it an origin, or database) are listed. ...
Body.json() - Web APIs
Web › API › Body › json
read values out of the resulting objects as you'd expect and insert them into list items to display our product data. ...
... fetch(myRequest) .then(response => response.json()) .then(data => { for (const product of data.products) { let listItem = document.createElement('li'); listItem.appendChild( document.createElement('strong') ).textContent = product.Name; listItem.append( ` can be found in ${ product.Location }. Cost: ` ); listItem.appendChild( document.createElement('strong') ).textContent = `GBP${product.Price}`; myList.appendChild(listItem); } }) .catch(console.error); Specifications Specification Status Comment FetchThe definition of 'Body.json()' in that specification. Living Standard Initial definition ...
DataTransferItem.webkitGetAsEntry() - Web APIs
, readEntries needs to be called repeatedly until it returns an empty array. In Chromium-based browsers, the following example will only return a max of 100 entries. ...
...The container is always a l...
DeprecationReportBody - Web APIs
nside the ReportingObserver() constructor, we can now click the button to display the report details. ...
...ter as its parameter: function displayReports(reports) { const outputElem = document.querySelector('.output'); const list = document.createElement('ul'); outputElem.appendChild(list); for(let i = 0; i < reports.length; i++) { let listItem = document.createElement('li'); let textNode = document.createTextNode('Report ' + (i + 1) + ', type: ' + reports[i].type); listItem.appendChild(textNode); let innerList = document.createElement('ul'); listItem.appendChild(innerList); list.appendChild(listItem); for (let key in reports[i].body) { let innerListItem = document.createElement('li'); let keyValue = reports[i].body[key]; innerListItem.textContent = key + ': ' + keyValue; innerList.appendChild(innerListItem); } } } The reports para...
Document.createDocumentFragment() - Web APIs
ly created, empty, DocumentFragment object, which is ready to have nodes inserted into it. Usage notes DocumentFragments are DOM Node objects which are never part of the main DOM tree. The usual use case is to create the document fragment, append elements to the document fragment and then append the document fragment to the DOM tree. In the DOM tree, the document fragment is replaced by all its children. Since the document fragment is in memory and not part of the main DOM tree, appending children to it does not cause page reflow (computation of element's position and geometry). Historically, using document fragments could result in better performance. You can also use the DocumentFragment constructor to create a new fragment: let fragment = new DocumentFragment(); Example This example c...
... the document to be displayed. HTML <ul id="ul"> </ul> JavaScript var element = document.getElementById('ul'); // assuming ul exists var fragment = document.createDocumentFragment(); var browsers = ['Firefox', 'Chrome', 'Opera', 'Safari', 'Internet Explorer']; browsers.forEach(function(browser) { var li = document.createElement('li'); li.textContent = browser; fragment.appendChild(li); }); element.appendChild(fragment); Result Specifications Specification Status Comment DOMThe definition of 'Document.createDocumentFragment()' in that specification. Living Standard Initial definition in the DOM 1 specification. ...
Document.createNodeIterator() - Web APIs
NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a TreeWalker with an Attr node as its root. In this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION 8 Shows CDATASection nodes. NodeFilter.SHOW_COMMENT 128 Shows Comment nodes. NodeFilter.SHOW_DOCUMENT 256 Shows Document nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT 1024 Shows DocumentFragment nodes. ...
...method should return one of NodeFilter.FILTER_ACCEPT, NodeFilter.FILTER_REJECT, or NodeFilter.FILTER_SKIP. See the Example. Note: Prior to Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9), this method accepted an optional fourth parameter (entityReferenceExpansion) that is not part of the DOM4 specification, and has therefore been removed. This parameter indicated whether or not the children of entity reference nodes were visible to the iterator. Since such nodes were never created in browsers, this paramater had no effect. Example const nodeIterator = document.createNodeIterator( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode(node) { return node.nodeName.toLowerCase() === 'p' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; } } );...
Document: drag event - Web APIs
Living Standard ...
... Living Standard ...
Document.getElementsByTagNameNS() - Web APIs
Note: Currently parameters in this method are case-sensitive, but they were case-insensitive in Firefox 3.5 and before. See the note in Browser compatibility section in Element.getElementsByTagNameNS for details. Example In the following example getElementsByTagNameNS starts from a particular parent element, and searches topdown recursively through the DOM from that parent element, looking for child elements matching the tag name parameter. Note that when the node on which getElementsByTagName is invoked is not the document node, in fact the element.getElementsByTagNameNS method is used. To use the following example, just copy/paste it into a new file saved with the .xhtml extension. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>getElementsByTagNameNS example</title> <script...
...(To accommodate Explorer, one could call an XPath wrapper instead of the XPath in the function below (as Explorer supports XPath with a different API), such as this wrapper class.) function getElementsByTagNameNSWrapper (ns, elName, doc, context) { ...
DocumentType - Web APIs
DocumentType.entities Read only A NamedNodeMap of entities declared in the DTD. Every node in this map implements the Entity interface. DocumentType.internalSubset Read only A DOMString of the internal subset, or null if there is none. Eg "<!ELEMENT foo (bar)>". DocumentType.name Read only A DOMString, eg "html" for <!DOCTYPE HTML>. DocumentType.notations Read only ...
... A NamedNodeMap with notations declared in the DTD. Every node in this map implements the Notation interface. DocumentType.publicId Read only A DOMString, eg "-//W3C//DTD HTML 4.01//EN", empty string for HTML5. DocumentType.systemId Read only A DOMString, eg "http://www.w3.org/TR/html4/strict.dtd", empty string for HTML5. Methods Inherits methods from its parent, Node, and implements the ChildNode interface. ChildNode.remove() Removes the object from its parent children list. Specifications Specification Status Comment DOMThe definition of 'DocumentType' in that specification. Living Standard Added implemention of the ChildNode interface. Removed the internalSubset, entities, and notation properties. Document Object Model (DOM) Level 3...
Using the W3C DOM Level 1 Core - Web APIs
the job: HTML Content <body> <input type="button" value="Change this document." onclick="change()"> <h2>Header</h2> <p>Paragraph</p> </body> JavaScript Content function change() { // document.getElementsByTagName("H2") returns a NodeList of the <h2> // elements in the document, and the first is number 0: var header = document.getElementsByTagName("H2").item(0); // the firstChild of the header is a Text node: header.firstChild.data = "A dynamic document"; // now the header is "A dynamic document". var para = document.getElementsByTagName("P").item(0); para.firstChild.data = "This is the first paragraph."; // create a new Text node for the second paragraph var newText = document.createTextNode("This is the second paragraph."); // create a new ...
...= document.getElementsByTagName("P").item(0); para.firstChild.data = "This is the first paragraph."; // create a new Text node for the second paragraph var newText = document.createTextNode("This is the second paragraph."); // create a new Element to be the second paragraph var newElement = document.createElement("P"); // put the text in the paragraph newElement.appendChild(newText); // and put the paragraph on the end of the document by appending it to // the BODY (which is the parent of para) para.parentNode.appendChild(newElement); } You can see this script as a complete example. How can I learn more? Now that you are familiar with the basic concepts of the DOM, you may want to learn about the DOM Level 1 fundamental methods. See also the DOM ...
Document Object Model (DOM) - Web APIs
ethods allow programmatic access to the tree. With them, you can change the document's structure, style, or content. Nodes can also have event handlers attached to them. Once an event is triggered, the event handlers get executed. To learn more about what the DOM is and how it represents documents, see our article Introduction to the DOM. ...
...ction to the DOM. DOM interfaces Attr CDATASection CharacterData ChildNode Comment CustomEvent Document DocumentFragment DocumentType DOMError DOMException DOMImplementation DOMString DOMTimeStamp DOMStringList DOMTokenList Element Event EventTarget HTMLCollection MutationObserver MutationRecord NamedNodeMap Node NodeFilter NodeIterator NodeList NonDocumentTypeChildNode ParentNode ProcessingInstruction Selection Range Text TextDecoder TextEncoder TimeRanges TreeWalker URL Window Worker XMLDocument Obsolete DOM interfaces The Document Object Model has been highly simplified. To achieve this, the following interfaces present in the different DOM level 3 or earlier specifications have been removed. It is uncertain whether some may be re...
Element.getClientRects() - Web APIs
ons are the same. But for a block element, Mozilla will return only a single rectangle. Firefox 3.5 note Firefox 3.5 adds width and height properties to the TextRectangle object. The amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the rectangles. The returned rectangles do not include the bounds of any child elements that might happen to overflow. For HTML <area> elements, SVG elements that do not render anything themselves, display:none elements, and generally any elements that are not directly rendered, an empty list is returned. Rectangles are returned even for CSS boxes that have empty border-boxes. The left, top, right, and bottom coordinates can still be meaningful. Fractional pixel offsets ...
...leRectDiv.style.margin = tableRectDiv.style.padding = '0'; tableRectDiv.style.top = (rect.top + scrollTop) + 'px'; tableRectDiv.style.left = (rect.left + scrollLeft) + 'px'; // We want rect.width to be the border width, so content width is 2px less. ...
Element: mouseenter event - Web APIs
Working Draft Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'mouseenter' in that specification. Obsolete ...
... Working Draft Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'mouseenter' in that specification. Obsolete ...
Element: mouseleave event - Web APIs
Working Draft Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'mouseleave' in that specification. Obsolete ...
... Working Draft Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'mouseleave' in that specification. Obsolete ...
FileSystemDirectoryReader.readEntries() - Web APIs
, readEntries needs to be called repeatedly until it returns an empty array. In Chromium-based browsers, the following example will only return a max of 100 entries. ...
...The container is always a l...
HTMLCanvasElement.toBlob() - Web APIs
he document, whose source image is the one created using the canvas. var canvas = document.getElementById('canvas'); canvas.toBlob(function(blob) { var newImg = document.createElement('img'), url = URL.createObjectURL(blob); newImg.onload = function() { // no longer need to read the blob so it's revoked URL.revokeObjectURL(url); }; newImg.src = url; document.body.appendChild(newImg); }); Note that here we're creating a PNG image; if you add a second parameter to the toBlob() call, you can specify the image type. For example, to get the image in JPEG format: canvas.toBlob(function(blob){...}, 'image/jpeg', 0.95); // JPEG at 95% quality A way to convert a canvas to an ico (Mozilla only) This uses -moz-parse to convert the canvas to ico. Windows XP doesn't suppor...
...e file name. ...
HTMLImageElement - Web APIs
that prevents it from being loaded. The specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. The specified image is in a format not supported by the user agent. ...
...imensions were specified in the <img> element's attributes. The specified image is in a format not supported by the user agent. Example var img1 = new Image(); // Image constructor img1.src = 'image1.png'; img1.alt = 'alt'; document.body.appendChild(img1); var img2 = document.createElement('img'); // Use DOM HTMLImageElement img2.src = 'image2.jpg'; img2.alt = 'alt text'; document.body.appendChild(img2); // using first image in the document alert(document.images[0].src); Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Extensions to HTMLImageElement' in that specification. Working Draft Added the x and y properties. HTML Living StandardThe definition of 'HTMLImageElement' in that specification. ...
HTMLScriptElement - Web APIs
function loadError(oError) { throw new URIError("The script " + oError.target.src + " didn't load correctly."); } function affixScriptToHead(url, onloadFunction) { var newScript = document.createElement("script"); newScript.onerror = loadError; if (onloadFunction) { newScript.onload = onloadFunction; } document.head.appendChild(newScript); newScript.src = url; ...
...rentScript element, appends them as children of the <head> tag. function loadError(oError) { throw new URIError("The script " + oError.target.src + " didn't load correctly."); } function affixScriptToHead(url, onloadFunction) { var newScript = document.createElement("script"); newScript.onerror = loadError; if (onloadFunction) { newScript.onload = onloadFunction; } document.head.appendChild(newScript); newScript.src = url; } Sample usage: affixScriptToHead("myScript1.js"); affixScriptToHead("myScript2.js", function () { alert("The script \"myScript2.js\" has been correctly loaded."); }); Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLScriptElement' in that specification. Living Standard HTML 5.1Th...
HTMLTableElement.insertRow() - Web APIs
defaults to -1. Return value newRow is an HTMLTableRowElement that references the new row. Example This example uses insertRow(-1) to append a new row to a table. We then use HTMLTableRowElement.insertCell() to insert a new cell in the new row. (To be valid HTML, a <tr> must have at least one <td> element.) Finally, we add some text to the cell using Document.createTextNode() and Node.appendChild(). HTML <table id="my-table"> <tr><td>Row 1</td></tr> <tr><td>Row 2</td></tr> <tr><td>Row 3</td></tr> </table> JavaScript function addRow(tableID) { // Get a reference to the table let tableRef = document.getElementById(tableID); // Insert a row at the end of the table let newRow = tableRef.insertRow(-1); // Insert a cell in the row at index 0 let newCell = newRow.insertCe...
... Living Standard Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLTableElement.insertRow()' in that specification...
HTML Drag and Drop API - Web APIs
ing example shows how to use those attributes, and includes basic event handlers for each attribute. <script> function dragover_handler(ev) { ev.preventDefault(); ev.dataTransfer.dropEffect = "move"; } function drop_handler(ev) { ev.preventDefault(); // Get the id of the target and add the moved element to the target's DOM const data = ev.dataTransfer.getData("text/plain"); ev.target.appendChild(document.getElementById(data)); } </script> <p id="target" ondrop="drop_handler(event)" ondragover="dragover_handler(event)">Drop Zone</p> Note that each handler calls preventDefault() to prevent additional event processing for this event (such as touch events or pointer events). For more information, see: Specifying Drop Targets Handle the drop effect The handler for the drop event is ...
...t ev.dataTransfer.setData("application/my-app", ev.target.id); ev.dataTransfer.dropEffect = "move"; } function dragover_handler(ev) { ev.preventDefault(); ev.dataTransfer.dropEffect = "move" } function drop_handler(ev) { ev.preventDefault(); // Get the id of the target and add the moved element to the target's DOM const data = ev.dataTransfer.getData("application/my-app"); ev.target.appendChild(document.getElementById(data)); } </script> <p id="p1" draggable="true" ondragstart="dragstart_handler(event)">This element is draggable.</p> <div id="target" ondrop="drop_handler(event)" ondragover="dragover_handler(event)">Drop Zone</div> For more information, see: Performing a Drop Drag end At the end of a drag operation, the dragend event fires at the source element -- the element th...
InstallEvent - Web APIs
This interface inherits from the ExtendableEvent interface. ...
... ...
MediaRecorder - Web APIs
Container = document.createElement('article'); var clipLabel = document.createElement('p'); var audio = document.createElement('audio'); var deleteButton = document.createElement('button'); clipContainer.classList.add('clip'); audio.setAttribute('controls', ''); deleteButton.innerHTML = "Delete"; clipLabel.innerHTML = clipName; clipContainer.appendChild(audio); clipContainer.appendChild(clipLabel); clipContainer.appendChild(deleteButton); soundClips.appendChild(clipContainer); audio.controls = true; var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); chunks = []; var audioURL = URL.createObjectURL(blob); audio.src = audioURL; console.log("recorder stopped"); deleteButt...
...Some lines have been omitted for brevity; refer to the source for the complete code. ...
Using the MediaStream Recording API - Web APIs
ound clip'); const clipContainer = document.createElement('article'); const clipLabel = document.createElement('p'); const audio = document.createElement('audio'); const deleteButton = document.createElement('button'); clipContainer.classList.add('clip'); audio.setAttribute('controls', ''); deleteButton.innerHTML = "Delete"; clipLabel.innerHTML = clipName; clipContainer.appendChild(audio); clipContainer.appendChild(clipLabel); clipContainer.appendChild(deleteButton); soundClips.appendChild(clipContainer); const blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' }); chunks = []; const audioURL = window.URL.createObjectURL(blob); audio.src = audioURL; deleteButton.onclick = function(e) { let evtTgt = e.target; evtTgt.parentNode.parentNode.re...
... First, we display a prompt asking the user to name their clip. Next, we create an HTML structure like the following, inserting it into our clip container, which is an <article> element. ...
MediaStream Recording API - Web APIs
ion handleDataAvailable(event) { console.log("data-available"); if (event.data.size > 0) { recordedChunks.push(event.data); console.log(recordedChunks); download(); } else { // ... ...
...o a <select> element representing an input source picker. navigator.mediaDevices.enumerateDevices() .then(function(devices) { devices.forEach(function(device) { let menu = document.getElementById("inputdevices"); if (device.kind == "audioinput") { let item = document.createElement("option"); item.innerHTML = device.label; item.value = device.deviceId; menu.appendChild(item); } }); }); Code similar to this can be used to let the user restrict the set of devices they wish to use. For more information To learn more about using the MediaStream Recording API, see Using the MediaStream Recording API, which shows how to use the API to record audio clips. A second article, Recording a media element, describes how to receive a stream from an <audio> or <video>...
Using the Media Capabilities API - Web APIs
mcv.contentType + ' at ' + mcv.framerate + 'fps and ' + mcv.bitrate + ' bps video ' + (result.supported ? ' IS ' : 'IS NOT ') + ' supported, ' + (result.smooth ? ' IS ' : ' is NOT ') + ' smooth, and' + (result.powerEfficient ? ...
... ? ...
Microdata DOM API - Web APIs
f the property names used in that item. ...
...ar items = document.getItems(); for (var item = 0; item < items.length; item += 1) { var itemLi = document.createElement('li'); var inner = document.createElement('ul'); for (var name = 0; name < items[item].properties.names.length; name += 1) { var propLi = document.createElement('li'); propLi.appendChild(document.createTextNode(items[item].properties.names[name])); inner.appendChild(propLi); } itemLi.appendChild(inner); outer.appendChild(itemLi); } document.body.appendChild(outer); If faced with the following from an earlier example: <section itemscope itemtype="http://example.org/animals#cat"> <h1 itemprop="name http://example.com/fn">Hedral</h1> <p itemprop="desc">Hedral is a male american domestic shorthair, with a fluffy <span itemprop="http://example.com/color">...
MutationObserver.observe() - Web APIs
t of a subtree of nodes to be watched. options A MutationObserverInit object providing options that describe which DOM mutations should be reported to mutationObserver's callback. Return value undefined. Exceptions TypeError Thrown in any of the following circumstances: The options are configured such that nothing will actually be monitored. (For example, if MutationObserverInit.childList, MutationObserverInit.attributes, and MutationObserverInit.characterData are all false.) The value of options.attributes is false (indicating that attribute changes are not to be monitored), but attributeOldValue is true and/or attributeFilter is present. The characterDataOldValue option is true but MutationObserverInit.characterData is false (indicating that character changes are not to ...
... Living Standard ...
MutationObserver - Web APIs
of MutationRecord objects. Mutation Observer & customize resize event listener & demo https://codepen.io/webgeeker/full/YjrZgg/ Example The following example was adapted from this blog post. ...
...ode = document.getElementById('some-id'); // Options for the observer (which mutations to observe) const config = { attributes: true, childList: true, subtree: true }; // Callback function to execute when mutations are observed const callback = function(mutationsList, observer) { // Use traditional 'for loops' for IE 11 for(let mutation of mutationsList) { if (mutation.type === 'childList') { console.log('A child node has been added or removed.'); } else if (mutation.type === 'attributes') { console.log('The ' + mutation.attributeName + ' attribute was modified.'); } } }; // Create an observer instance linked to the callback function const observer = new MutationObserver(callback); // Start observing the target node for con...
MutationObserverInit - Web APIs
The MutationObserverInit dictionary describes the configuration of a mutation observer. As such, it's primarily used as the type of the options parameter on the MutationObserver.observe() method. Properties At a minimum, one of childList, attributes, and/or characterData must be true when you call observe(). Otherwise, a TypeError exception will be thrown. subtree Optional Set to true to extend monitoring to the entire subtree of nodes rooted at target. ...
...ttributes, and/or characterData must be true when you call observe(). Otherwise, a TypeError exception will be thrown. subtree Optional Set to true to extend monitoring to the entire subtree of nodes rooted at target. All of the other MutationObserverInit properties are then extended to all of the nodes in the subtree instead of applying solely to the target node. The default value is false. childList Optional Set to true to monitor the target node (and, if subtree is true, its descendants) for the addition of new child nodes or removal of existing child nodes. The default value is false. attributes Optional Set to true to watch for changes to the value of attributes on the node or nodes being monitored. The default value is true if either of attributeFilter or attributeOldValue is spec...
MutationRecord - Web APIs
A MutationRecord represents an individual DOM mutation. It is the object that is passed to MutationObserver's callback. Properties Property Type Description MutationRecord.type String Returns "attributes" if the mutation was an attribute mutation, "characterData" if it was a mutation to a CharacterData node, and "childList" if it was a mutation to the tree of nodes. MutationRecord.target Node Returns the node the mutation affected, depending on the MutationRecord.type. For attributes, it is the element whose attribute changed. For characterData, it is the CharacterData node. For childList, it is the node whose children changed. MutationRecord.addedNodes NodeList Return the nodes added. Will be an empty NodeList i...
...bute, or null. MutationRecord.attributeNamespace String Returns the namespace of the changed attribute, or null. MutationRecord.oldValue String The return value depends on the MutationRecord.type. For attributes, it is the value of the changed attribute before the change. For characterData, it is the data of the changed node before the change. For childList, it is null. Note that for this to work as expected, attributeOldValue or characterDataOldValue must be set to true in the corresponding MutationObserverInit parameter of the MutationObserver observe method Specifications Specification Status Comment DOMThe definition of 'MutationRecord' in that specification. Living Standard ...
Node.isConnected - Web APIs
Web › API › Node › isConnected
se of the normal DOM, or the ShadowRoot in the case of a shadow DOM. Syntax var isItConnected = nodeObjectInstance.isConnected Return value A Boolean that is true if the node is connected to its relevant context object, and false if not. ...
... * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. */ if (!('isConnected' in Node.prototype)) { Object.definePrope...
Node.nodeType - Web APIs
Web › API › Node › nodeType
ION ...> node. Removed in DOM4. ...
...mentFragment().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 inside the document element is a comment, and displays a message if not. var node = document.documentElement.firstChild; if (node.nodeType !== Node.COMMENT_NODE) { console.warn("You should comment your code!"); } Specifications Specification Status Comment DOMThe definition of 'Node.nodeType' in that specification. Living Standard Deprecated ATTRIBUTE_NODE, ENTITY_REFERENCE_NODE and NOTATION_NODE types. Document Object Model (DOM) Level 3 Core SpecificationThe defini...
Node.previousSibling - Web APIs
Syntax previousNode = node.previousSibling; Example <img id="b0"> <img id="b1"> <img id="b2"> console.log(document.getElementById("b1").previousSibling); // <img id="b0"> console.log(document.getElementById("b2").previousSibling.id); // "b1" Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. ...
...usNode = node.previousSibling; Example <img id="b0"> <img id="b1"> <img id="b2"> console.log(document.getElementById("b1").previousSibling); // <img id="b0"> console.log(document.getElementById("b2").previousSibling.id); // "b1" Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may refer to a whitespace text node rather than the actual element the author intended to get. See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. To navigate the opposite way through the child nodes list use Node.nextSibling. Specifications Specification Status Comment DOMThe definition of 'Nod...
Node.textContent - Web APIs
Web › API › Node › textContent
octype, textContent returns null. Note: To get all of the text and CDATA data for the whole document, one could use document.documentElement.textContent. If the node is a CDATA section, comment, processing instruction, or text node, textContent returns the text inside the node, i.e., the Node.nodeValue. For other node types, textContent returns the concatenation of the textContent of every child node, excluding comments and processing instructions. (This is an empty string if the node has no children.) Setting textContent on a node removes all of the node's children and replaces them with a single text node with the given string value. Differences from innerText Don't get confused by the differences between Node.textContent and HTMLElement.innerText. Although the names seem similar, ...
...s aware of styling and won't return the text of "hidden" elements. Moreover, since innerText takes CSS styles into account, reading the value of innerText triggers a reflow to ensure up-to-date computed styles. (Reflows can be computationally expensive, and thus should be avoided when possible.) Unlike textContent, altering innerText in Internet Explorer (version 11 and below) removes child nodes from the element and permanently destroys all descendant text nodes. It is impossible to insert the nodes again into any other element or into the same element after doing so. Differences from innerHTML Element.innerHTML returns HTML, as its name indicates. Sometimes people use innerHTML to retrieve or write text inside an element, but textContent has better performance because its value...
NodeFilter - Web APIs
This method is expected to be written by the user of a NodeFilter. Possible return values are: Constant Description FILTER_ACCEPT Value returned by the NodeFilter.acceptNode() method when a node should be accepted. FILTER_REJECT Value to be returned by the NodeFilter.acceptNode() method when a node should be rejected. For TreeWalker, child nodes are also rejected. For NodeIterator, this flag is synonymous with FILTER_SKIP. FILTER_SKIP Value to be returned by NodeFilter.acceptNode() for nodes to be skipped by the NodeIterator or TreeWalker object. The children of skipped nodes are still considered. This is treated as "skip this node but not its children". Example const nodeItera...
... Living Standard Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'NodeFilter' in that specification. Obsolete Initial defini...
NodeIterator.expandEntityReferences - Web APIs
This takes precedence over the value of the NodeIterator.whatToShow method and the associated filter. ...
...This takes precedence over the value of the NodeIterator.whatToShow method and the associated filter. ...
NodeIterator - Web APIs
, whatToShow, filter); Properties This interface doesn't inherit any property. NodeIterator.root Read only Returns a Node representing the root node as specified when the NodeIterator was created. NodeIterator.whatToShow Read only Returns an unsigned long being a bitmask made of constants describing the types of Node that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are: Constant Numerical value Description NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a NodeIterator with an Attr node as its root; in this cas...
... NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a NodeIterator with an Attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION 8 Shows CDATASection nodes. NodeFilter.SHOW_COMMENT 128 Shows Comment nodes. NodeFilter.SHOW_DOCUMENT 256 Shows Document nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT 1024 Shows DocumentFragment nodes. ...
NodeList - Web APIs
Web › API › NodeList
NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll(). Although NodeList is not an Array, it is possible to iterate over it with forEach(). It can also be converted to a real Array using Array.from(). However, some older browsers have not implemented NodeList.forEach() nor Array.from(). This can be circumvented by using Array.prototype.forEach() -- see this document's Example. Live vs. Static NodeLists Although they are both considered NodeLists, there are 2 varieties of NodeList: live and static. ...
...odeList.forEach() nor Array.from(). This can be circumvented by using Array.prototype.forEach() -- see this document's Example. Live vs. Static NodeLists Although they are both considered NodeLists, there are 2 varieties of NodeList: live and static. Live NodeLists In some cases, the NodeList is live, which means that changes in the DOM automatically update the collection. For example, Node.childNodes is live: const parent = document.getElementById('parent'); let child_nodes = parent.childNodes; console.log(child_nodes.length); // let's assume "2" parent.appendChild(document.createElement('div')); console.log(child_nodes.length); // outputs "3" Static NodeLists In other cases, the NodeList is static, where any changes in the DOM does not affect the content of the collection. The ubiqu...
RTCDataChannel: message event - Web APIs
d for a peer connection using its createDataChannel() method, this code sets up a handler for incoming messages and acts on them by adding the data contained within the message to the current document as a new <p> (paragraph) element. dc.addEventListener("message", ev => { let newParagraph = document.createElement("p"); let textNode = document.createTextNode(event.data); newParagraph.appendChild(textNode); document.body.appendChild(newParagraph); }, false); Lines 2-4 create the new paragraph element and add the message data to it as a new text node. Line 6 appends the new paragraph to the end of the document's body. You can also use an RTCDataChannel object's onmessage event handler property to set the event handler: dc.onmessage = ev => { let newParagraph = document.createEleme...
...e the new paragraph element and add the message data to it as a new text node. Line 6 appends the new paragraph to the end of the document's body. You can also use an RTCDataChannel object's onmessage event handler property to set the event handler: dc.onmessage = ev => { let newParagraph = document.createElement("p"); let textNode = document.createTextNode(event.data); newParagraph.appendChild(textNode); document.body.appendChild(newParagraph); } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'the <code>message</code> event' in that specification. Candidate Recommendation ...
Range.extractContents() - Web APIs
s extracted and appended to the document. Partially selected nodes are cloned to include the parent tags necessary to make the document fragment valid. Syntax documentFragment = range.extractContents(); Example Basic example var range = document.createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment = range.extractContents(); document.body.appendChild(documentFragment); Moving items between containers This example lets you move items between two containers. Select one or more item, and then click "swap" to move them to the opposite container. HTML <p id="list1">123456</p> <button id="swap">Swap selected item(s)</button> <p id="list2">abcdef</p> CSS body { pointer-events: none; } p { border: 1px solid; font-size: 2em; padding: .
...ton = document.getElementById('swap'); button.addEventListener('click', e => { selection = window.getSelection(); for (let i = 0; i < selection.rangeCount; i++) { const range = selection.getRangeAt(i); if (range.commonAncestorContainer === list1 || range.commonAncestorContainer.parentNode === list1) { const documentFragment = range.extractContents(); list2.appendChild(documentFragment); } else if (range.commonAncestorContainer === list2 || range.commonAncestorContainer.parentNode === list2) { const documentFragment = range.extractContents(); list1.appendChild(documentFragment); } } }); Result Specifications Specification Status Comment DOMThe definition of 'Range.extractContents()' in that specificatio...
Report - Web APIs
Web › API › Report
nside the ReportingObserver() constructor, we can now click the button to display the report details. ...
...ter as its parameter: function displayReports(reports) { const outputElem = document.querySelector('.output'); const list = document.createElement('ul'); outputElem.appendChild(list); for(let i = 0; i < reports.length; i++) { let listItem = document.createElement('li'); let textNode = document.createTextNode('Report ' + (i + 1) + ', type: ' + reports[i].type); listItem.appendChild(textNode); let innerList = document.createElement('ul'); listItem.appendChild(innerList); list.appendChild(listItem); for (let key in reports[i].body) { let innerListItem = document.createElement('li'); let keyValue = reports[i].body[key]; innerListItem.textContent = key + ': ' + keyValue; innerList.appendChild(innerListItem); } } } The reports para...
SVGAnimationElement: endEvent event - Web APIs
#ddd; overflow-y: scroll; padding: 10px 30px; } let svgElem = document.querySelector('svg'); let animateElem = document.querySelector('animateMotion'); let list = document.querySelector('ul'); let btn = document.querySelector('button'); animateElem.addEventListener('beginEvent', () => { let listItem = document.createElement('li'); listItem.textContent = 'beginEvent fired'; list.appendChild(listItem); }) animateElem.addEventListener('endEvent', () => { let listItem = document.createElement('li'); listItem.textContent = 'endEvent fired'; list.appendChild(listItem); }) animateElem.addEventListener('repeatEvent', (e) => { let listItem = document.createElement('li'); let msg = 'repeatEvent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listItem.tex...
...ddEventListener('endEvent', () => { let listItem = document.createElement('li'); listItem.textContent = 'endEvent fired'; list.appendChild(listItem); }) animateElem.addEventListener('repeatEvent', (e) => { let listItem = document.createElement('li'); let msg = 'repeatEvent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listItem.textContent = msg; list.appendChild(listItem); }) btn.addEventListener('click', () => { btn.disabled = true; animateElem.setAttribute('repeatCount', '1'); }) Event handler property equivalent Note that you can also create an event listener for the end event using the onend event handler property: animateElem.onend = () => { console.log('endEvent fired'); } Specifications Specification Status Comment ...
Selection API - Web APIs
e. Once your selection is in a variable, you perform a variety of operations on it, for example copying the selection to a text string using Selection.toString(), adding a range (as represented by a standard Range object) to the selection (or removing one) with Selection.addRange()/Selection.removeRange(), or changing the selection to be the entire contents of a DOM node using Selection.selectAllChildren(). You can run code in response to the selection being changed, or a new selection being started, using the GlobalEventHandlers.onselectionchange and GlobalEventHandlers.onselectstart event handlers. Selection API interfaces Selection Represents the range of text selected by the user or the current position of the caret. Extensions to other interfaces Window.getSelection(), Docum...
... 58Chrome Android Full support 58Firefox Android Full support YesOpera Android Full support 43Safari iOS No support NoSamsung Internet Android Full support 7.0selectAllChildren ExperimentalChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support ...
Using server-sent events - Web APIs
You can also listen for events with addEventListener(): evtSource.addEventListener("ping", function(event) { const newElement = document.createElement("li"); const time = JSON.parse(event.data).time...
...is, notices from the server that do not have an event field on them) and appends the message text to a list in the document's HTML. You can also listen for events with addEventListener(): evtSource.addEventListener("ping", function(event) { const newElement = document.createElement("li"); const time = JSON.parse(event.data).time; newElement.innerHTML = "ping at " + time; eventList.appendChild(newElement); }); This code is similar, except that it will be called automatically whenever the server sends a message with the event field set to "ping"; it then parses the JSON in the data field and outputs that information. When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the l...
SpeechSynthesis: voiceschanged event - Web APIs
ow.speechSynthesis; synth.addEventListener('voiceschanged', function() { var voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } }); Or use the onvoiceschanged event handler property: synth.onvoiceschanged = function() { var voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voice...
... Draft ...
Using readable streams - Web APIs
lso close the stream, as we've stopped enqueuing chunks to it. ...
...ta. // value - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Read ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Closing and cancelling streams We've already shown examples of using ReadableStreamDefaultController.close() to close a reader. As we said before, any previously enqueued chunks will still be read, but no more can be enqueued because it is closed. If you wan...
Text.splitText() - Web APIs
Web › API › Text › splitText
greater than the number of 16-bit units in the node's text; a DOMException with a value of NO_MODIFICATION_ALLOWED_ERR is thrown if the node is read-only. Example In this example, the text of a <p> is split into two text nodes, and a <u> is inserted between them. ...
...des, and a <u> is inserted between them. HTML <p>foobar</p> JavaScript const p = document.querySelector('p'); // Get contents of <p> as a text node const foobar = p.firstChild; // Split 'foobar' into two text nodes, 'foo' and 'bar', // and save 'bar' as a const const bar = foobar.splitText(3); // Create a <u> element containing ' new content ' const u = document.createElement('u'); u.appendChild(document.createTextNode(' new content ')); // Add <u> before 'bar' p.insertBefore(u, bar); // The result is: <p>foo<u> new content </u>bar</p> Result Specifications Specification Status Comment DOMThe definition of 'Text.splitText' in that specification. Living Standard No change from Document Object Model (DOM) Level 3 Core Specification. Documen...
Text - Web APIs
Web › API › Text
New documents have a single Text node for each block of text. Over time, more Text nodes may be created as the document's content changes. The Node.normalize() method merges adjacent Text objects back into a single node for each block of text. ...
... New documents have a single Text node for each block of text. Over time, more Text nodes may be created as the document's content changes. The Node.normalize() method merges adjacent Text objects back into a single node for each block of text. ...
TreeWalker.expandEntityReferences - Web APIs
This takes precedence over the value of the TreeWalker.whatToShow method and the associated filter. ...
...This takes precedence over the value of the TreeWalker.whatToShow method and the associated filter. ...
Using the Web Speech API - Web APIs
function populateVoiceList() { voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute...
...This is because Firefox doesn't support SpeechSynthesis.onvoiceschanged, and will just return a list of voices when SpeechSynthesis.getVoices() is fired. With Chrome however, you have to wait for the event to fire before populating the list, hence the if statement seen below. populateVoiceList(); if (speechSynthesis.onvoicesc...
Using Web Workers - Web APIs
Listener].apply(instance, event.data.queryMethodArguments); } else { this.defaultListener.call(instance, event.data); } } } // your custom "queryable" worker var myTask = new QueryableWorker('my_task.js'); // your custom "listeners" myTask.addListener('printStuff', function (result) { document.getElementById('firstLink').parentNode.appendChild(document.createTextNode('The difference is ' + result + '!')); }); myTask.addListener('doAlert', function (time, unit) { alert('Worker waited for ' + time + ' ' + unit + ' :-)'); }); </script> </head> <body> <ul> <li><a id="firstLink" href="javascript:myTask.sendQuery('getDifference', 5, 3);">What is the difference between 5 and 3?</a></li> <li><a href="javascript:myT...
... because its MIME type is text/js-worker. var myVar = 'Hello World!'; // Rest of your worker code goes here. </script> <script type="text/javascript"> // This script WILL be parsed by JS engines because its MIME type is text/javascript. function pageLog(sMsg) { // Use a fragment: browser will only render/reflow once. var oFragm = document.createDocumentFragment(); oFragm.appendChild(document.createTextNode(sMsg)); oFragm.appendChild(document.createElement('br')); document.querySelector('#logDisplay').appendChild(oFragm); } </script> <script type="text/js-worker"> // This script WON'T be parsed by JS engines because its MIME type is text/js-worker. onmessage = function(oEvent) { postMessage(myVar); }; // Rest of your worker code goes here. </script> <scr...
Window.open() - Web APIs
Web › API › Window › open
with same name will access the previously created window. Google Chrome (55.0.2883.87 m ) on the other hand will do it only from the same parent (as if the window was created dependent, which is the "opener"). This is a wide limitation and generates unbelievable complexity of development. Firefox (51.) gets the handle but cannot run any Element.focus() while Chrome can run focus() from opener to child but not between siblings nor, reverse, from child to opener. This function is the lonely key to get back the handle on a window if the developer has access only to its name (the name can be saved with cookies or local storage but not the window object handle). For now 10/01/2017 the differencies of behavior found recently have not still been tested for others Browsers. Window features windowFe...
...fer him more choices, more ways to open links and more power to the tool he's using (a browser). Glossary Opener window, parent window, main window, first window Terms often used to describe or to identify the same window. It is the window from which a new window will be created. It is the window on which the user clicked a link that leads to the creation of another, new window. Sub-window, child window, secondary window, second window Terms often used to describe or to identify the same window. It is the new window that was created. Unrequested popup windows Script-initiated windows opening automatically without the user's consent. Specification Specification Status Comment HTML Living StandardThe definition of 'Window.open()' in that specification. L...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
while (aMap[nPos] < oSheet.parts.length) { oRel = oSheet.parts[aMap[nPos]]; scroll(oRel, nPos + 1, bEraseAndStop) ? ...
...eet.ref.appendChild(oRel.ref); if (bExit) { return false; } } aMap.length--; return true; } function typewrite () { if (sPart.length === 0 && scroll(aSheets[nIdx], 0, true) && nIdx++ === aSheets.length - 1) { clean(); return; } oCurrent.nodeValue += sPart.charAt(0); sPart = sPart.slice(1); } function Sheet (oNode) { this.ref = oNode; if (!oNode.hasChildNodes()) { return; } this.parts = Array.prototype.slice.call(oNode.childNodes); for (var nChild = 0; nChild < this.parts.length; nChild++) { oNode.removeChild(this.parts[nChild]); this.parts[nChild] = new Sheet(this.parts[nChild]); } } var nIntervId, oCurrent = null, bTyping = false, bStart = true, nIdx = 0, sPart = "", aSheets = [], aMap = []; this.rate = ...
Web APIs
Web › API
SSPseudoElement CSSRule CSSRuleList CSSStyleDeclaration CSSStyleRule CSSStyleSheet CSSStyleValue CSSSupportsRule CSSUnitValue CSSUnparsedValue CSSValue CSSValueList CSSVariableReferenceValue Cache CacheStorage CanvasCaptureMediaStreamTrack CanvasGradient CanvasImageSource CanvasPattern CanvasRenderingContext2D CaretPosition ChannelMergerNode ChannelSplitterNode CharacterData ChildNode Client Clients Clipboard ClipboardEvent ClipboardItem CloseEvent Comment CompositionEvent ConstantSourceNode ConstrainBoolean ConstrainDOMString ConstrainDouble ConstrainULong ContentIndex ContentIndexEvent ConvolverNode CountQueuingStrategy CrashReportBody Credential CredentialsContainer Crypto CryptoKey CryptoKeyPair CustomElementRegistry CustomEvent D DOMConfiguration ...
...nt MouseWheelEvent MutationEvent MutationObserver MutationObserverInit MutationRecord N NDEFMessage NDEFReader NDEFReadingEvent NDEFRecord NDEFWriter NameList NamedNodeMap NavigationPreloadManager Navigator NavigatorConcurrentHardware NavigatorID NavigatorLanguage NavigatorOnLine NavigatorPlugins NavigatorStorage NetworkInformation Node NodeFilter NodeIterator NodeList NonDocumentTypeChildNode Notation Notification NotificationAction NotificationEvent NotifyAudioAvailableEvent O OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 OfflineAudioCompletionEvent OfflineAudioContext OffscreenCanvas OrientationSensor Oscillator...
Using the alert role - Accessibility
of 3 validation errors.</h2> Example 2: Dynamically adding an element with the alert role This snippet dynamically creates an element with an alert role and adds it to the document structure. ...
... Dynamically adding an element with the alert role This snippet dynamically creates an element with an alert role and adds it to the document structure. ...
Using the aria-hidden attribute - Accessibility
This technique demonstrates how to use the aria-hidden attribute. The aria-hidden attribute can either expose or hide non-interactive content from the accessibility API. Description Adding aria-hidden="true" to an element removes that element and all of its children from the accessibility tree. This can improve the experience for assistive technology users by hiding: purely decorative content, such as icons or images duplicated content, such as repeated text offscreen or collapsed content, such as menus According to the fourth rule of ARIA, aria-hidden="true" should not be used on a focusable element. Additionally, since this attribute is inherited by an element's children, it should not be added onto the parent or ancestor of a focusable element. Using aria-hidden="false" will ...
...essibility API. true The element is not exposed to the accessibility API. undefined (default) The user agent determines if the element is exposed to or hidden from the accessibility API. Examples In the example below, the paragraph is not exposed to the accessibility API (e.g. would not be read aloud by a screen reader). <p aria-hidden="true"> Some things are better left unsaid. ...
ARIA: feed role - Accessibility
include an RSS feed, news feeds, social media feeds like Facebook, Instagram or Twitter, or even a list of related products on an eCommerce page. These streams can be limited or infinite, loading more content as the user scrolls. Implementing the feed pattern allows a screen reader to reliably read and trigger the loading of feed content while in reading mode. A feed is a container element whose children are <article>s or have role article. Each article within a feed should be focusable, with tabindex of 0 or -1. An article should be scrolled into view when it, or a descendant element, receives focus. If the addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not...
...when articles are being added or removed from the feed, set aria-busy="true" during the update operation. Make sure it's reset to false when the operation is complete or the changes may not become visible. article Each section of content in a feed should be contained in an <article> or element with role article. Each article should have an aria-labelledby referring to the article title or other child that can serve as a distinguishing label. Each article should preferably have aria-describedby referring to one or more elements inside the article that serve as the primary content of the article. Each article element has aria-posinset set to a value that represents its position in the feed and an aria-setsize set to a value that represents either the total number of articles that have been load...
ARIA: List role - Accessibility
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 inside it can be identified to assistive technologies using the list and listitem containers respectively. A list must have one or more listitem children, or, alternatively, have one or more groups as children, with each group having one or more listitems as children. There are no hard and fast rules about which elements you should use to markup the list and list items, but you should make sure that the list items make sense in the context of a list, e.g. a shopping list, recipe steps, driving directions. Warning: If at all possible in your ...
...t item 2</li> <li>List item 3</li> </ul> or use an ordered list if the order of the list items matters: <ol> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ol> Note: The ARIA list/listitem roles don't distinguish between ordered and unordered lists. As an aside, note that if you are using the semantic HTML elements of ol or ul and apply a role of presentation, each child li element inherits the presentation role because ARIA requires the listitem elements to have the parent list element. So, the li elements are not exposed to assistive technologies, but elements contained inside of those li elements, including nested lists, are visible to assistive technologies. Note: If you are marking up a list of items that will function as a tabbed interface, you should ins...
ARIA: tab role - Accessibility
id">Tab label</button> Description An element with the tab role controls the visibility of an associated element with the tabpanel role. The common user experience pattern is a group of visual tabs above, or to the side of, a content area, and selecting a different tab changes the content and makes the selected tab more prominent than the other tabs. Elements with the role tab must either be a child of an element with the tablist role, or have their id part of the aria-owns property of a tablist. This combination identifies to assistive technology that the element is part of a group of related elements. Some assistive technology will provide a count of the number of tab role elements inside a tablist, and inform users of which tab they currently have targeted. They should contain the aria-co...
...dentifies to assistive technology that the element is part of a group of related elements. Some assistive technology will provide a count of the number of tab role elements inside a tablist, and inform users of which tab they currently have targeted. They should contain the aria-controls property identifying an element with the tabpanel role. When an element with the tabpanel role has focus, or a child of it has focus, that indicates that the connected element with the tab role is the active tab in a tablist. When working with elements with the tab role, when they are selected or active, they should have their aria-selected attribute set to true, otherwise it should be set to false. When a tab is selected or active, its controlled tabpanel should have its aria-expanded and hidden attributes se...
ARIA: table role - Accessibility
ual cells of the table can be interactive. Using a native HTML table element whenever possible is strongly encouraged. If a table maintains a selection state, has two-dimensional navigation, or allows the user to rearrange cell order use grid or treegrid instead. To create an ARIA table, add role="table" to the container element. Within that container, each row has role="row" set and contains child cells. Each cell has a role of either columnheader, rowheader, or simply cell. Rows can be children of the table or within a rowgroup. The table caption can be defined via aria-labelledby or aria-label. All other semantic table elements, such as <tbody>, <thead>, <tr>, <th>, and <td> need to be added via associated roles, such as rowgroup, row, columnheader, and cell. If the table contains sor...
...ells, if left to right and top to bottom navigation is provided, or if the user interface allows the rearranging of cell order or otherwise changing individual cell order such as through drag and drop, use grid or treegrid instead. Note: Using a native HTML table element whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties role="rowgroup" An optional child of the table, the row group encapsulates a group of rows, similar to thead, tbody, and tfoot. role="row" A row within the table, and optionally within a rowgroup, that is a container for one or more cells, columnheaders, or rowheaders. aria-describedby attribute Takes as its value the id of the element that serves as a description for the table. aria-label attribute The aria-label provides ...
Alerts - Accessibility
but allows for them continue modifying the form without losing focus (caused by the "onblur" handler in JavaScript's default 'alert' function). ...
...pt"> function removeOldAlert() { var oldAlert = document.getElementById("alert"); if (oldAlert){ document.body.removeChild(oldAlert); } } function addAlert(aMsg) { removeOldAlert(); var newAlert = document.createElement("div"); newAlert.setAttribute("role", "alert"); newAlert.setAttribute("id", "alert"); var msg = document.createTextNode(aMsg); newAlert.appendChild(msg); document.body.appendChild(newAlert); } function checkValidity(aID, aSearchTerm, aMsg) { var elem = document.getElementById(aID); var invalid = (elem.value.indexOf(aSearchTerm) < 0); if (invalid) { elem.setAttribute("aria-invalid", "true"); addAlert(aMsg); } else { elem.setAttribute("aria-invalid", "false"); removeOldAlert(); } } </script> The ch...
::slotted() - CSS: Cascading Style Sheets
Web › CSS › ::slotted
This allows them to stand out better next to the slots that haven't been successfully filled. The element looks like this when inserted into the page: <person-details> ...
...This allows them to stand out better next to the slots that haven't been successfully filled. The element looks like this when inserted into the page: <person-details> <p slot="person-name">Dr. Shazaam</p...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
mn-width. The column-count property The column-count property specifies the number of columns that you would like the content to be displayed as. The browser will then assign the correct amount of space to each column box to create the requested number of columns. In the below example we use the column-count property to create three columns on the .container element. ...
... The column-width property The column-width property is used to set the optimal width for every column box. If you declare a column-width, the browser will work out how many columns of that width will fit into the multicol container and distribute any extra space equally between the columns. ...
CSS Containment - CSS: Cascading Style Sheets
e). Another advantage is that if the containing box is offscreen, the browser does not need to paint its contained elements -- these must also be offscreen as they are contained completely by that box. Size containment article { contain: size; } Size containment does not offer much in the way of performance optimizations when used on its own. However, it means that the size of the element's children cannot affect the size of the element itself -- its size is computed as if it had no children. If you turn on contain: size you need to also specify the size of the element you have applied this to. It will end up being zero-sized in most cases, if you don't manually give it a size. Style containment article { contain: style; } Despite the name, style containment does not provide scoped ...
...pecial values There are two special values of contain: content strict We encountered the first in the example above. Using contain: content turns on layout and paint containment. The specification describes this value as being "reasonably safe to apply widely". It does not apply size containment, so you would not be at risk of a box ending up zero-sized due to a reliance on the size of its children. To gain as much containment as possible use contain: strict, which behaves the same as contain: size layout paint, or perhaps the following to also add style containment in browsers that support it: contain: strict; contain: strict style; Reference CSS Properties contain External resources An Introduction to CSS Containment ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
c will ultimately supersede the properties as defined in Flexbox Level One. The Cross Axis The align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column. We are making use of cross-axis alignment in the most simple flex example. If we add display: flex to a container, the child items all become flex items arranged in a row. They will all stretch to be as tall as the tallest item, as that item is defining the height of the items on the cross axis. If your flex container has a height set, then the items will stretch to that height, regardless of how much content is in the item. The reason the items become the same height is that the initial value of align-items, the ...
...gn-self property to target a single item. The align-self property accepts all of the same values as align-items plus a value of auto, which will reset the value to that which is defined on the flex container. In this next live example, the flex container has align-items: flex-start, which means the items are all aligned to the start of the cross axis. I have targeted the first item using a first-child selector and set that item to align-self: stretch; another item has been selected using its class of selected and given align-self: center. You can change the value of align-items or change the values of align-self on the individual items to see how this works. Changing the main axis So far we have looked at the behaviour when our flex-direction is row, and while working in a language written...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
flex container behaves like a block element: it displays on a new line and takes up all of the space it can in the inline direction. This is the outer display type of block. The flex items however are participating in a flex formatting context, because their parent is the element with display: flex, which has an inner display type of flex, establishing the flex formatting context for the direct children. Therefore you can think of every box in CSS working in this way. The box itself has an outer display type, so it knows how to behave alongside other boxes. It then has an inner display type which changes the way its children behave. Those children then have an outer and inner display type too. The flex items in the previous example become flex level boxes, so their outer display type is di...
...Items nested inside our flex item lay themselves out as block and inline elements unless something changes their display type. ...
Introduction to formatting contexts - CSS: Cascading Style Sheets
xts, of which there are several types, including block formatting contexts, inline formatting contexts, and flex formatting contexts. The basics of how they behave and how you can make use of these behaviors are also introduced. Everything on a page is part of a formatting context, or an area which has been defined to lay out content in a particular way. A block formatting context (BFC) will lay child elements out according to block layout rules, a flex formatting context will lay its children out as flex items, etc. Each formatting context has specific rules about how layout behaves when in that context. Block formatting contexts The outermost element in a document that uses block layout rules establishes the first, or initial block formatting context. This means that every element inside t...
...ut of flow so the background and border of the div only contain the content and not the float. Creating a new BFC would contain the float. A typical way to do this in the past has been to set overflow: auto or set other values than the initial value of overflow: visible. Setting overflow: auto created a new BFC containing the float. Our <div> now becomes a mini-layout inside our layout. Any child element will be contained inside it. The problem with using overflow to create a new BFC is that the overflow property is meant for telling the browser how you wish to deal with overflowing content. There are some occasions in which you will find you get unwanted scrollbars or clipped shadows when you use this property purely to create a BFC. In addition, it is potentially not very readable for ...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
ayouts at different breakpoints. However the onus is on us as developers to remember to go back to our source and update it to maintain logical order. Grid and the danger of markup flattening Another issue to be aware of in CSS Grid Layout and to a lesser extent in CSS Flexbox, is the temptation to flatten markup. As we have discovered, for an item to become a grid item it needs to be a direct child of the grid container. Therefore, where you have a <ul> element inside a grid container, that ul becomes a grid item - the child <li> elements do not. If the subgrid value of display becomes implemented, it would be possible to make these children of a grid item participate in the overall grid layout by declaring the ul element a subgrid. Currently the only way to do this is to use display: cont...
...s limited and we do not yet have subgrids, there is a definite temptation when developing a site using CSS Grid Layout to flatten out the markup, to remove semantic elements in order to make it simpler to create a layout. An example would be where some content was semantically marked up as a list but you decide to use a set of <div> elements instead as then you can have the element to be a direct child of a container set to display: grid. Be aware of this temptation and find ways to develop your design without stripping out the markup. Starting out with a well-structured document is a very good way to avoid the problem, as you will be aware that you are removing semantic elements in order to make the layout work if you actually have to go into the document and do so! Further reading There is ...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
This can be helpful in creating a more app-like experience on mobile or even on the desktop for some types of applications. Basics of Scroll Snap The key properties of the Scroll Snap specification are scroll-snap-type and scroll-snap-align. The scroll-snap-type property is used on the scroll container to state the type and direction of scrolling. The scroll-snap-align property must be used on child elements in order to set the position that scrolling will snap to. The below example demonstrates scroll snapping along the y axis, with scroll-snap-align used on the section element to dictate the point the scrolling should stop. Using scroll-snap-type The scroll-snap-type property needs to know the direction in which scroll snapping happens. This could be x or y, or the logical mappings blo...
...istance. This is potentially useful if you have a fixed element, for example a navigation bar, which could end up overlapping scrolled content. By using scroll-padding you can reserve a space for it as in the example below where my <h1> remains on screen as the content scrolls beneath it. Without padding, the heading would overlap some of the content when snapping happens. Margins on scroll children The scroll-margin property can be set set on child elements, essentially defining an outset from the defined box. This allows for different amounts of space for different child elements, and can be used in conjunction with scroll-padding on the parent. Try this in the example below. The scroll-snap-stop property The scroll-snap-stop property tells the browser whether it should snap to eac...
Class selectors - CSS: Cascading Style Sheets
Recommendation Initial definition ...
... Status Comment Selectors Level 4The definition of 'class selectors' in that specification. Working Draft No changes Selectors Level 3The definition of 'class selectors' in that specification. Recommendation CSS Level 2 (Revision 1)The definition of 'child selectors' in that specification. Recommendation CSS Level 1The definition of 'child selectors' in that specification. Recommendation Initial definition ...
Column layouts - CSS: Cascading Style Sheets
text to display in newspaper-like columns. You have a set of small items you want to break into columns. You do not need to target individual column boxes for styling. A single row of items with equal heights -- flexbox Flexbox can be used to break content into columns by setting flex-direction to row, however flexbox targets the elements inside the flex container and will place each direct child into a new column. This is a different behavior to what you saw with multicol. There is currently no way to add a rule between flex items, and browser support for the column-gap and row-gap properties is limited. Therefore to create gaps between items use a margin. Download this example Flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-...
...ems. When you want to do alignment on the cross axis after laying out your items. When you are happy for wrapped items to share out space along their line only and not line up with items in other lines. Lining items up in rows and columns -- grid layout If what you want is a layout where items line up in rows and columns then you should choose CSS Grid Layout. Grid Layout works on the direct children of the grid container in a similar way to the manner in which flexbox works on the direct children of the flex container, however with CSS Grid you can line your items up in rows and columns -- it is described as two-dimensional. Download this example Use Grid: For multiple rows or columns of items. When you want to be able to align the items on the block and inline axes. When you w...
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
s specifiedAnimation typediscrete Formal syntax start | center | end | baseline | stretch Examples Setting box alignment <!DOCTYPE html> <html> <head> <title>CSS box-align example</title> <style> div.example { display: box; /* As specified */ display: -moz-box; /* Mozilla */ display: -webkit-box; /* WebKit */ /* Make this box taller than the children, so there is room for the box-pack */ height: 400px; /* Make this box wider than the children so there is room for the box-align */ width: 300px; /* Children should be oriented vertically */ box-orient: vertical; /* As specified */ -moz-box-orient: vertical; /* Mozilla */ -webkit-box-orient: vertical; /* WebKit */ /* Align children to the horizont...
...ould be oriented vertically */ box-orient: vertical; /* As specified */ -moz-box-orient: vertical; /* Mozilla */ -webkit-box-orient: vertical; /* WebKit */ /* Align children to the horizontal center of this box */ box-align: center; /* As specified */ -moz-box-align: center; /* Mozilla */ -webkit-box-align: center; /* WebKit */ /* Pack children to the bottom of this box */ box-pack: end; /* As specified */ -moz-box-pack: end; /* Mozilla */ -webkit-box-pack: end; /* WebKit */ } div.example > p { /* Make children narrower than their parent, so there is room for the box-align */ width: 200px; } </style> </head> <body> <div class="example"> <p>I will be second from the bottom of...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
same size, set the containing box's equalsize attribute to the value always. This attribute does not have a corresponding CSS property. A trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). ...
...or -webkit-box or -webkit-inline-boxInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <number> Examples Setting box-flex <!DOCTYPE html> <html> <head> <title>-moz-box-flex example</title> <style> div.example { display: -moz-box; display: -webkit-box; border: 1px solid black; width: 100%; } div.example > p:nth-child(1) { -moz-box-flex: 1; /* Mozilla */ -webkit-box-flex: 1; /* WebKit */ border: 1px solid black; } div.example > p:nth-child(2) { -moz-box-flex: 0; /* Mozilla */ -webkit-box-flex: 0; /* WebKit */ border: 1px solid black; } </style> </head> <body> <div class="example"> <p>I will expand to fill extr...
box-orient - CSS: Cascading Style Sheets
rient: vertical; box-orient: inline-axis; box-orient: block-axis; /* Global values */ box-orient: inherit; box-orient: initial; box-orient: unset; Syntax The box-orient property is specified as one of the keyword values listed below. Values horizontal The box lays out its contents horizontally. vertical The box lays out its contents vertically. inline-axis (HTML) The box displays its children along the inline axis. block-axis (HTML) The box displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. Description HTML DOM elements lay out their contents along the inline-axis by default. This CSS property will only apply to HTML elements with a CSS display value of b...
...t property will cause the two <p> sections in the example to display in the same line. HTML <div class="example"> <p>I will be to the left of my sibling.</p> <p>I will be to the right of my sibling.</p> </div> CSS div.example { display: -moz-box; /* Mozilla */ display: -webkit-box; /* WebKit */ display: box; /* As specified */ /* Children should be oriented vertically */ -moz-box-orient: horizontal; /* Mozilla */ -webkit-box-orient: horizontal; /* WebKit */ box-orient: horizontal; /* As specified */ } Result Specifications Not part of any standard. ...
<display-box> - CSS: Cascading Style Sheets
Please note that the CSS Display Level 3 spec defines how the contents value should affect "unusual elements" -- elements that aren't rendered purely by CSS box concepts such as replaced elements. See Appendix B: Effects of display: contents on Unusual Elements for more details. ...
... any content is now not rendered. display: none HTML <p>Visible text</p> <p class="secret">Invisible text</p> CSS p.secret { display: none; } Result display: contents In this example the outer <div> has a 2-pixel red border and a width of 300px. However it also has display: contents specified therefore this <div> will not be rendered, the border and width will no longer apply, and the child element will be displayed as if the parent had never existed. HTML <div class="outer"> <div>Inner div.</div> </div> CSS .outer { border: 2px solid red; width: 300px; display: contents; } .outer > div { border: 1px solid green; } Result Specifications Specification Status CSS Display Module Level 3The definition of 'display-box' in that specification.
font - CSS: Cascading Style Sheets
Web › CSS › font
Candidate Recommendation Added support for font-stretch values. CSS Lev...
... Candidate Recommendation Added support for font-stretch values. CSS Level 2 (Revision 1)The definition of 'font-weight' in that specification. Recommendation Added support for keywords. CSS Level 1The ...
order - CSS: Cascading Style Sheets
Web › CSS › order
important, then screen reader users will not have access to the correct reading order. Flexbox & the keyboard navigation disconnect -- Tink Source Order Matters | Adrian Roselli MDN Understanding WCAG, Guideline 1.3 explanations Understanding Success Criterion 1.3.2 | W3C Understanding WCAG 2.0 Formal definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer Formal syntax <integer> Examples Ordering items in a flex container This example uses CSS to create a classic two-sidebar layout surrounding a content block. The Flexible Box Layout Module automatically creates blocks of equal vertical size and uses as much horizontal space as available. HTML <header>...</header> <main> <art...
... order: 2; } main > nav { width: 200px; order: 1; } main > aside { width: 200px; order: 3; } Result Specifications Specification Status Comment CSS Flexible Box Layout ModuleThe definition of 'order' in that specification. Candidate Recommendation Initial definition Initial value0Applies toflex items and absolutely-positioned flex container childrenInheritednoComputed valueas specifiedAnimation typean integer ...
place-self - CSS: Cascading Style Sheets
lock and inline directions. ...
...container"> <span>First</span> <span>Second</span> <span>Third</span> <span>Fourth</span> </article> CSS html { font-family: helvetica, arial, sans-serif; letter-spacing: 1px; } article { background-color: red; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 80px; grid-gap: 10px; width: 300px; } span:nth-child(2) { place-self: start center; } span:nth-child(3) { place-self: center start; } span:nth-child(4) { place-self: end; } article span { background-color: black; color: white; margin: 1px; text-align: center; } article, span { padding: 10px; border-radius: 7px; } article { margin: 20px; } Result Specifications Specification Status Comment CSS Box Alignment Module Level 3The definition of 'pl...
position - CSS: Cascading Style Sheets
Web › CSS › position
positioned relative to the ICB (initial containing block -- see also the W3C definition), which is the containing block of the document's root element. HTML <h1>Absolute positioning</h1> <p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p> <p class="positioned">By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overfl...
...ollapse 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 Full support 52Edge Full support 12Firefox Full support 52IE Full support 10Opera Full support 39Safari Full support 11W...
scroll-snap-points-x - CSS: Cascading Style Sheets
...
... ...
scroll-snap-points-y - CSS: Cascading Style Sheets
...
... ...
transform-style - CSS: Cascading Style Sheets
The transform-style CSS property sets whether children of an element are positioned in the 3D space or are flattened in the plane of the element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If flattened, the element's children will not exist on their own in the 3D-space. As this property is not inherited, it must be set for all non-leaf descendants of the element. ...
...st. If flattened, the element's children will not exist on their own in the 3D-space. As this property is not inherited, it must be set for all non-leaf descendants of the element. Syntax /* Keyword values */ transform-style: flat; transform-style: preserve-3d; /* Global values */ transform-style: inherit; transform-style: initial; transform-style: unset; Values flat Indicates that the children of the element are lying in the plane of the element itself. preserve-3d Indicates that the children of the element should be positioned in the 3D-space. Formal definition Initial valueflatApplies totransformable elementsInheritednoComputed valueas specifiedAnimation typediscreteCreates stacking contextyes Formal syntax flat | preserve-3d Examples Transform style demonstration In thi...
Video player styling basics - Developer guides
A value for margin-left is also set, but the first element (in this case the play/pause button) has this property overridden by the va...
...idth of nearly 4% (again the actual value was calculated based on the required dimensions of the buttons), and a height of 100%. A value for margin-left is also set, but the first element (in this case the play/pause button) has this property overridden by the value 0. The <div> container for the <progress> element also requires some specific settings; it is set to be much wider than the other child elements and its cursor value is set to be pointer: .controls .progress { cursor:pointer; width:75.390625%; } Buttons The first major styling task to tackle is to make the video control's buttons actually look like and act like real buttons. Each button has some basic styling: .controls button { border:none; cursor:pointer; background:transparent; background-size:contain; ...
Printing - Developer guides
e a hidden <iframe> (see: HTMLIFrameElement), automatically removing it after the user prints its contents. ...
... ...
HTML attribute reference - HTML: Hypertext Markup Language
<embed>, <iframe>, <img>, <input>, <object>, <video> Specifies the height of elements listed here. For all other elements, use the CSS height property. Note: In some instances, such as <div>, this is a legacy attribute, in which case the CSS height property should be used instead. hidden Global attribute Prevents rendering of given element, while keeping child elements, e.g. script elements, active. high <meter> Indicates the lower bound of the upper range. href <a>, <area>, <base>, <link> The URL of a linked resource. hreflang <a>, <area>, <link> Specifies the language of the linked resource. http-equiv <meta> Defines a pragma directive. icon <command> Specifies a picture which...
...rea>, <base>, <form> Specifies where to open the linked document (in the case of an <a> element) or where to display the response recieved (in the case of a <form> element) title Global attribute Text to be displayed in a tooltip when hovering over the element. translate Global attribute Specify whether an element's attribute values and the values of its Text node children are to be translated when the page is localized, or whether to leave them unchanged. type <button>, <input>, <command>, <embed>, <object>, <script>, <source>, <style>, <menu> Defines the type of the element. usemap <img>, <input>, <object> value <button>, <data>, <input>, <li>, <meter>, <option>, <progress>, <param> Defines a default value which wi...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
<col> element belongs too. If there are none, the left value is assumed. Note: To achieve the same effect as the left, center, right or justify values: Do not try to set the text-align property on a selector giving a <col> element. Because <td> elements are not descendant of the <col> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector. Set a to zero and b to the position of the column in the table, e.g. td:nth-child(2) { text-align: right; } to right-align the second column. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. bgcolor The background color of the table. It is a 6...
...it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. Note: Do not try to set the vertical-align property on a selector giving a <col> element. Because <td> elements are not descendant of the <col> element, they won't inherit it. If the table doesn't use a colspan attribute, use the td:nth-child(an+b) CSS selector where a is the total number of the columns in the table and b is the ordinal position of the column in the table. Only after this selector the vertical-align property can be used. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. width This attribute speci...
<hgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › hgroup
3C) specification provides advice on how to mark up Subheadings, subtitles, alternative titles and taglines without using <hgroup>. The <hgroup> element allows the primary heading for a document section to be grouped with any secondary headings--such as subheadings or alternative titles--to form a multi-level heading. ...
...group> element allows the primary heading for a document section to be grouped with any secondary headings--such as subheadings or alternative titles--to form a multi-level heading. In other words, the <hgroup> element prevents any of its secondary <h1>-<h6> children from creating separate sections of their own in the outline--as those <h1>-<h6> elements otherwise normally would if they were not children of any <hgroup>. So in the abstract outline produced by the HTML outline algorithm defined in the HTML specification, the <hgroup> as a whole forms a single logical heading, with the entire set of <h1>-<h6> children of the <hgroup> going into the outline as one multi-level unit, to comprise that single logical heading in the abstract outline. To produce any (non-abstract) rendered view of su...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
The HTML <menu> element represents a group of commands that a user can perform or activate. This includes both list menus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked. Content categories Flow content. If the element's children include at least one <li> element: Palpable content. Permitted content If the element is in the list menu state: flow content, or alternatively, zero or more occurrences of <li>, <script>, and <template>. (list menu is the default state, unless the parent element is a <menu> in the context menu state.) If the element is in the context menu state: zero or more occurrences, in any order, of <menu> (context menu state only)...
...ent, or as context menu for an element with a contextmenu attribute. This value is the default if the attribute is missing and the parent element is also a <menu> element. toolbar: Indicates the toolbar state, which represents a toolbar consisting of a series of commands for user interaction. This might be in the form of an unordered list of <li> elements, or, if the element has no <li> element children, flow content describing available commands. This value is the default if the attribute is missing. Usage notes The <menu> and <ul> elements both represent an unordered list of items. The key difference is that <ul> primarily contains items for display, whilst <menu> is intended for interactive items, to act on. An HTML menu can be used to create context menus (typically activated by r...
<picture>: The Picture element - HTML: Hypertext Markup Language
Web › HTML › Element › picture
If no matches are found--or the browser doesn't support the <picture> element--the URL of the <img> element's src attribute is selected. The selected image is then presented in the space occupied by the <img> element. The source for this interactive example is stored in a GitHub repository. ...
... Permitted ARIA roles No role permitted DOM interface HTMLPictureElement Attributes This element includes only global attributes. Usage notes You can use the object-position property to adjust the positioning of the image within the element's frame, and the object-fit property to control how the image is resized to fit within the frame. Note: Use these properties on the child <img> element, not the <picture> element. Examples These examples demonstrate how different attributes of the <source> element change the selection of the image inside <picture>. The media attribute The media attribute specifies a media condition (similar to a media query) that the user agent will evaluate for each <source> element. If the <source>'s media condition evaluates to false, the ...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
-examples and send us a pull request. The <tbody> element, along with its cousins <thead> and <tfoot>, provide useful semantic information that can be used when rendering for either screen or printer as well as for accessibility purposes. Content categories None. Permitted content Zero or more <tr> elements. Tag omission The <tbody> element is not a required child element for a parent <table> element to graphically render. However, it must not be present, if its parent <table> element has a <tr> element as a child. Permitted parents Within the required parent <table> element, the <tbody> element can be added after a <caption>, <colgroup>, and a <thead> element. Implicit ARIA role rowgroup Permitted ARIA roles Any ...
...n the cell; and top, which will put the text as close to the top of the cell as it is possible. As this attribute is deprecated, use the CSS vertical-align property instead. Usage notes If the table includes a <thead> block (to semantically identify header rows), the <tbody> block must come after it. If you use <tbody>, you can't also have table rows (<tr> elements) which are direct children of the <table> but not included inside the <tbody>. All non-header and non-footer rows must be inside the <tbody> if one is used. When printing a document, the <thead> and <tfoot> elements specify information that may be the same--or at least very similar--on every page of a multi-page table, while the <tbody> element's contents generally will differ from page to page. When a table is presen...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
Web › HTML › Element › track
It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. The tracks are formatted in WebVTT format (.vtt files) -- Web Video Text Tracks. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None Permitted content None, it is an empty element. Tag omission As it is a void element, the start tag must be present and the end tag must not be present. ...
...A media element cannot have more than one track with the same kind, srclang, and label. Detecting cue changes The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element. If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement. let textTrackElem = document.getElementById("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; }); In addition, you can use the oncuechange event handler: let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechan...
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
Global attributes, HTML, Reference, Title The title global attribute contains text representing advisory information related to the element it belongs to. 33 translate Experimental, Global attributes, HTML, Reference The translate global attribute is an enumerated attribute that is used to specify whether an element's translateable attribute values and its Text node children should be translated when the page is localized, or whether to leave them unchanged. 34 x-ms-acceleratorkey Attribute, HTML, HTML:Microsoft Extensions, Non-standard, Reference, x-ms-acceleratorkey The x-ms-acceleratorkey attribute accessibly declares that an accelerator key has been assigned to an element: the element is activated via JavaScript when the key(s) are pressed...
...g, tr, tr tag The HTML <tr> element defines a row of cells in a table. The row's cells can then be established using a mix of <td> (data cell) and <th> (header cell) elements. 213 <track>: The Embed Text Track element Accessibility, Cues, Element, HTML, HTML embedded content, HTML5, Multimedia, Reference, TextTrack, Web, a11y, track The HTML <track> element is used as a child of the media elements, <audio> and <video>. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. 214 <tt>: The Teletype Text element (obsolete) Element, HTML, Monospace, Monotype, Non-proportional Type, Obsolete, Reference, Teletype, Teletype Text, Web, font-family, tt The obsolete HTML Teletype Text element (<tt>) creates...
Content-Security-Policy - HTTP
Content Security Policy (CSP). Header type Response header Forbidden header name no Syntax Content-Security-Policy: <policy-directive>; <policy-directive> where <policy-directive> consists of: <directive> <value> with no internal punctuation. Directives Fetch directives Fetch directives control the locations from which certain resource types may be loaded. child-src Defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. Instead of child-src, if you want to regulate nested browsing contexts and workers, you should use the frame-src and worker-src directives, respectively. connect-src Restricts the URLs which can be loaded using script interfaces default-src Serves as a fall...
...deprecates frame-src. Deprecates report-uri in favor if report-to. Mixed Content Candidate Recommendation Adds block-all-mixed-content. Subresource Integrity Recommendation Adds require-sri-for. Upgrade Insecure Requests Candidate Recommendation Adds upgrade-insecure-requests. Content Security Policy Level 2 Recommendation Adds base-uri, child-src, form-action, frame-ancestors, plugin-types, referrer, and report-uri. Deprecates frame-src. Content Security Policy 1.0 Obsolete Defines connect-src, default-src, font-src, frame-src, img-src, media-src, object-src, report-uri, sandbox, script-src, and style-src. ...
Feature-Policy: fullscreen - HTTP
This directive allows or prevents cross-origin frames from using fullscreen mode. This includes same-origin frames. If both this directive (i.e. ...
...l example SecureCorp Inc. wants to disable the Fullscreen API within all browsing contexts except for its own origin and those whose origin is https://example.com. It can do so by delivering the following HTTP response header to define a feature policy: Feature-Policy: fullscreen 'self' https://example.com With an <iframe> element FastCorp Inc. wants to disable fullscreen for all cross-origin child frames, except for a specific <iframe>. It can do so by delivering the following HTTP response header to define a feature policy: Feature-Policy: fullscreen 'self' Then include an allow attribute on the <iframe> element: <iframe src="https://other.com/videoplayer" allow="fullscreen"></iframe> iframe attributes can selectively enable features in certain frames, and not in others, even if those...
Feature-Policy: geolocation - HTTP
Feature-Policy header geolocation directive controls whether the current document is allowed to use the Geolocation Interface. When this policy is enabled, calls to getCurrentPosition() and watchPosition() will cause those functions' callbacks to be invoked with a PositionError code of PERMISSION_DENIED. By default, the Geolocation API can be used within top-level documents and their same-origin child frames. This directive allows or prevents cross-origin frames from accessing geolocation. This includes same-origin frames. Syntax Feature-Policy: geolocation <allowlist>; <allowlist> An allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: The feature will be allowed in this document, and all nested browsing contexts (iframes) regardless ...
...xample SecureCorp Inc. wants to disable the Geolocation API within all browsing contexts except for its own origin and those whose origin is https://example.com. It can do so by delivering the following HTTP response header to define a feature policy: Feature-Policy: geolocation 'self' https://example.com With an <iframe> element FastCorp Inc. wants to disable geolocation for all cross-origin child frames, except for a specific <iframe>. It can do so by delivering the following HTTP response header to define a feature policy: Feature-Policy: geolocation 'self' Then include an allow attribute on the <iframe> element: <iframe src="https://other.com/map" allow="geolocation"></iframe> iframe attributes can selectively enable features in certain frames, and not in others, even if those frame...
A re-introduction to JavaScript (JS tutorial) - JavaScript
block scope in C: var a = 1; var b = 2; (function() { var b = 3; a += b; })(); a; // 4 b; // 2 JavaScript allows you to call functions recursively. This is particularly useful for dealing with tree structures, such as those found in the browser DOM. function countChars(elm) { if (elm.nodeType == 3) { // TEXT_NODE return elm.nodeValue.length; } var count = 0; for (var i = 0, child; child = elm.childNodes[i]; i++) { count += countChars(child); } return count; } This highlights a potential problem with anonymous functions: how do you call them recursively if they don't have a name? JavaScript lets you name function expressions for this. You can use named IIFEs (Immediately Invoked Function Expressions) as shown below: var charsInBody = (function counter(elm) { i...
... potential problem with anonymous functions: how do you call them recursively if they don't have a name? JavaScript lets you name function expressions for this. You can use named IIFEs (Immediately Invoked Function Expressions) as shown below: var charsInBody = (function counter(elm) { if (elm.nodeType == 3) { // TEXT_NODE return elm.nodeValue.length; } var count = 0; for (var i = 0, child; child = elm.childNodes[i]; i++) { count += counter(child); } return count; })(document.body); The name provided to a function expression as above is only available to the function's own scope. This allows more optimizations to be done by the engine and results in more readable code. The name also shows up in the debugger and some stack traces, which can save you time when debugging. N...
Classes - JavaScript
nd on internals, which may change version to version. Private fields can only be declared up-front in a field declaration. Private fields cannot be created later through assigning to them, the way that normal properties can. For more information, see private class fields. Sub classing with extends The extends keyword is used in class declarations or class expressions to create a class as a child of another class. class Animal { constructor(name) { this.name = name; } speak() { console.log(`${this.name} makes a noise.`); } } class Dog extends Animal { constructor(name) { super(name); // call the super class constructor and pass in the name parameter } speak() { console.log(`${this.name} barks.`); } } let d = new Dog('Mitzie'); d.speak(); // Mitzie bark...
...call super() before using "this". One may also extend traditional function-based "classes": function Animal (name) { this.name = name; } Animal.prototype.speak = function () { console.log(`${this.name} makes a noise.`); } class Dog extends Animal { speak() { console.log(`${this.name} barks.`); } } let d = new Dog('Mitzie'); d.speak(); // Mitzie barks. // For similar methods, the child's method takes precedence over parent's method Note that classes cannot extend regular (non-constructible) objects. If you want to inherit from a regular object, you can instead use Object.setPrototypeOf(): const Animal = { speak() { console.log(`${this.name} makes a noise.`); } }; class Dog { constructor(name) { this.name = name; } } // If you do not do this you will get a Ty...
export - JavaScript
ingle value or to have a fallback value for your module, you could use a default export: // module "my-module.js" export default function cube(x) { return x * x * x; } Then, in another script, it is straightforward to import the default export: import cube from './my-module.js'; console.log(cube(3)); // 27 Using export from Let's take an example where we have the following hierarchy: childModule1.js: exporting myFunction and myVariable childModule2.js: exporting myClass parentModule.js: acting as an aggregator (and doing nothing else) top level module: consuming the exports of parentModule.js This is what it would look like using code snippets: // In childModule1.js let myFunction = ...; // assign something useful to myFunction let myVariable = ...; // assign something useful...
...dule2.js: exporting myClass parentModule.js: acting as an aggregator (and doing nothing else) top level module: consuming the exports of parentModule.js This is what it would look like using code snippets: // In childModule1.js let myFunction = ...; // assign something useful to myFunction let myVariable = ...; // assign something useful to myVariable export {myFunction, myVariable}; // In childModule2.js let myClass = ...; // assign something useful to myClass export myClass; // In parentModule.js // Only aggregating the exports from childModule1 and childModule2 // to re-export them export { myFunction, myVariable } from 'childModule1.js'; export { myClass } from 'childModule2.js'; // In top-level module // We can consume the exports from a single module since parentModule // "coll...
<maction> - MathML
Attributes actiontype The action which specifies what happens for this element. Possible values are: statusline: If there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. ...
... The syntax is: <maction actiontype="tooltip"> expression message </maction>. class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. selection The child element which is addressed by the action. The default value is 1, which is the first child element. Examples The following example uses the "toggle" actiontype: <math> <maction actiontype="toggle"> <mfrac> <mn>6</mn> <mn>8</mn> </mfrac> <mfrac> <mrow> <mn>3</mn> <mo>&sdot;</mo> <mn>2</mn> </mrow> <mrow> <mn>4</mn> <mo>&sdot;</mo> ...
display - SVG: Scalable Vector Graphics
Web › SVG › Attribute › display
The display attribute lets you control the rendering of graphical or container elements. A value of display="none" indicates that the given element and its children will not be rendered. Any value other than none or inherit indicates that the given element will be rendered by the browser. When applied to a container element, setting display to none causes the container and all of its children to be invisible; thus, it acts on groups of elements as a group. This means that any child of an element with display="none" will never be rendered even if the child has a value for display other than none. When the display attribute is set to none, then the given element does not become part of the rendering tree. It has implications for the <tspan>, <tref>, and <altGlyph> elements, event processing, ...
...vent that element from getting rendered directly onto the canvas, but the <path> element can still be referenced by a <textPath> element; furthermore, its geometry will be used in text-on-a-path processing even if the <path> has a display value of none. This attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. Thus, setting display="none" on a child of a <mask> will prevent the given child element from being rendered as part of the mask. Similarly, setting display="none" on a child of a <clipPath> element will prevent the given child element from contributing to the clipping path. Note: As a presentation attribute, display can be used as a CSS property. See css display for further information. As a presentation attribute, it can be applied...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
It can also group multiple elements to be referenced later with the <use> element. ...
...It can also group multiple elements to be referenced later with the <use> element. ...
<switch> - SVG: Scalable Vector Graphics
Web › SVG › Element › switch
The <switch> SVG element evaluates any requiredFeatures, requiredExtensions and systemLanguage attributes on its direct child elements in order, and then renders the first child where these attributes evaluate to true. Other direct children will be bypassed and therefore not rendered. If a child element is a container element, like <g>, then its subtree is also processed/rendered or bypassed/not rendered. The display and visibility properties have no effect on <switch> element processing. In particular, setting display:none on a child has no effect on the true/false testing for <switch> processing. Usage context CategoriesContainer elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elements<a>, <foreignObject>, <g>, <imag...
...itional processing attributes Core attributes Graphical event attributes Presentation attributes class style externalResourcesRequired transform DOM Interface This element implements the SVGSwitchElement interface. SVG <switch> example This example demonstrates showing different text content depending on the browser's language settings. The switch element will display the first of its child elements whose systemLanguage attribute matches the user's language, or the fallback element with no systemLanguage attribute if none of them match. HTML Content <svg viewBox="0 -20 100 50"> <switch> <text systemLanguage="ar">?????</text> <text systemLanguage="de,nl">Hallo!</text> <text systemLanguage="en-us">Howdy!</text> <text systemLanguage="en-gb">Wotcha!</text> ...
Axes - XPath
Web › XPath › Axes
section in the xpath spec. ancestor Indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node. ancestor-or-self Indicates the context node and all of its ancestors, including the root node. attribute Indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (@). child Indicates the children of the context node. If an XPath expression does not specify an axis, this is understood by default. Since only the root node or element nodes have children, any other use will select nothing. descendant Indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute n...
...h expression does not specify an axis, this is understood by default. Since only the root node or element nodes have children, any other use will select nothing. descendant Indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents. descendant-or-self Indicates the context node and all of its descendants. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents. following Indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes. following-sibl...
Comparison of CSS Selectors and XPath - XPath
e: XSLT elements, EXSLT functions, XPath functions, XPath axes This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. ...
...ts, EXSLT functions, XPath functions, XPath axes This article seeks to document the difference between CSS Selectors and XPath for web developers to be able to better choose the right tool for the right job. ...
Introduction to using XPath in JavaScript - XPath
will be given below. var xpathResult = document.evaluate( xpathExpression, contextNode, namespaceResolver, resultType, result ); Parameters The evaluate function takes a total of five parameters: xpathExpression: A string containing the XPath expression to be evaluated. contextNode: A node in the document against which the xpathExpression should be evaluated, including any and all of its child nodes. The document node is the most commonly used. namespaceResolver: A function that will be passed any namespace prefixes contained within xpathExpression which returns a string representing the namespace URI associated with that prefix. This enables conversion between the prefixes used in the XPath expressions and the possibly different prefixes used in the document. The function can be eith...
...or;1"].createInstance(Components.interfaces.nsIDOMXPathEvaluator) Appendix Implementing a User Defined Namespace Resolver This is an example for illustration only. This function will need to take namespace prefixes from the xpathExpression and return the URI that corresponds to that prefix. For example, the expression: '//xhtml:td/mathml:math' will select all MathML expressions that are the children of (X)HTML table data cell elements. In order to associate the 'mathml:' prefix with the namespace URI 'http://www.w3.org/1998/Math/MathML' and 'xhtml:' with the URI 'http://www.w3.org/1999/xhtml' we provide a function: function nsResolver(prefix) { var ns = { 'xhtml' : 'http://www.w3.org/1999/xhtml', 'mathml': 'http://www.w3.org/1998/Math/MathML' }; return ns[prefix] || null; ...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
Fragments are therefore useful for moving nodes around and storing them without the overhead of a full document object. XSLT...
...Fragments are therefore useful for moving nodes around and storing them without the overhead of a full document object. ...
Advanced Example - XSLT: Extensible Stylesheet Language Transformations
xmlRef = document.implementation.createDocument("", "", null); // we want to move a part of the DOM from an HTML document to an XML document. ...
...ter(null, "myOrder", "ascending"); else xsltProcessor.setParameter(null, "myOrder", "descending"); // initiate the transformation var fragment = xsltProcessor.transformToFragment(xmlRef, document); // clear the contents document.getElementById("example").innerHTML = ""; myDOM = fragment; // add the new content from the transformation document.getElementById("example").appendChild(fragment) } // XSL Stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes" /> <xsl:param name="myOrder" /> <xsl:template match="/"> <xsl:apply-templates select="/div//div"> <xsl:sort se...
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
ocument's Document.importNode() method. Document.importNode() allows transferring a DOM fragment between documents, in this case from an HTML document to an XML document. The first parameter references the DOM node to clone. By making the second parameter "true", it will clone all descendants as well (a deep clone). The cloned DOM can then be easily inserted into the XML document using Node.appendChild(), as shown in figure 2. Figure 2 : Creating an XML document based on part of a document's DOM // create a new XML document in memory var xmlRef = document.implementation.createDocument("", "", null); // we want to move a part of the DOM from an HTML document to an XML document. // importNode is used to clone the nodes we want to process via XSLT - true makes it do a deep clone var m...
...ment.implementation.createDocument("", "", null); // we want to move a part of the DOM from an HTML document to an XML document. // importNode is used to clone the nodes we want to process via XSLT - true makes it do a deep clone var myNode = document.getElementById("example"); var clonedNode = xmlRef.importNode(myNode, true); // add the cloned DOM into the XML document xmlRef.appendChild(clonedNode); Once the stylesheet has been imported, XSLTProcessor has to perform two methods for the actual transformation, namely XSLTProcessor.transformToDocument() and XSLTProcessor.transformToFragment(). XSLTProcessor.transformToDocument() returns a full XML document while XSLTProcessor.transformToFragment() returns a document fragment that can be easily added to an existing document. Both ...
XUL Migration Guide - Archive of obsolete content
hrome windows, including the browser's chrome window. Here's a really simple example add-on that modifies the browser chrome using window/utils: function removeForwardButton() { var window = require("sdk/window/utils").getMostRecentBrowserWindow(); var forward = window.document.getElementById('forward-button'); var parent = window.document.getElementById('urlbar-container'); parent.removeChild(forward); } require("sdk/ui/button/action").ActionButton({ id: "remove-forward-button", label: "Remove Forward Button", icon: "./icon-16.png", onClick: removeForwardButton }); There are more useful examples of this technique in the Jetpack Wiki's collection of third party modules. Accessing tabbrowser This example uses the action button API, which is only available from Firefox 29 o...
context-menu - Archive of obsolete content
a is the data property of the menu item that was clicked. Note that when you have a hierarchy of menu items the click event will be sent to the content script of the item clicked and all ancestors so be sure to verify that the data value passed matches the item you expect. ...
l10n - Archive of obsolete content
ion: if you do, the placeholders will be ignored. Parameters identifier : string A identifier for the localization of a particular string in the current locale. count : integer Optional parameter. If you're supplying different localizations for a string for singular or plural forms, this parameter is the number of items there are in this case. var _ = require("sdk/l10n").get; console.log(_("child_id", 1)); console.log(_("child_id", 2)); See the tutorial on plural support for more information. Note that if you use this parameter, you can't supply any placeholders. placeholder1...n : string Optional parameters. If you do not include the count parameter, you can supply one or more placeholder strings that are to be inserted into the translated string at locations defined by the translato...
core/namespace - Archive of obsolete content
e = ns(); aNamespace(publicAPI).secret = secret; One namespace may be used with multiple objects: let { ns } = require('sdk/core/namespace'); let dom = ns(); function View(element) { let view = Object.create(View.prototype); dom(view).element = element; // .... } View.prototype.destroy = function destroy() { let { element } = dom(this); element.parentNode.removeChild(element); // ... }; // ... exports.View = View; // ... Also, multiple namespaces can be used with one object: // ./widget.js let { Cu } = require('chrome'); let { ns } = require('sdk/core/namespace'); let { View } = require('./view'); // Note this is completely independent from View's internal Namespace object. let sandboxes = ns(); function Widget(options) { le...
preferences/service - Archive of obsolete content
(name) Parameters name : string Preference name. Returns boolean : Returns whether or not the application preference name exists. defaultValue Example: var name = "extensions.checkCompatibility.nightly"; if (require("sdk/preferences/service").has(name)) { // ... } keys(root) Parameters root : string Preference root name. Returns array : Returns an array of strings representing the child preferences of the root of this branch. isSet(name) Parameters name : string Preference name. Returns boolean : Returns whether or not the application preference name both exists and has been set to a non-default value by the user (or a program acting on the user's behalf). Example: var name = "extensions.checkCompatibility.nightly"; if (require("sdk/preferences/service").isSet(name)) { ...
Release notes - Archive of obsolete content
irefox 30 and Firefox 31. This will not include any uplifts made after this release entered Aurora. Bugs fixed between Firefox 30 and Firefox 31. This will not include any uplifts made after this release entered Aurora. Firefox 30 Highlights Added the ability to anchor panels to buttons. Changes in the way content scripts share objects with page scripts. Documentation and blog post. Added child_process, an implementation of the node.js child_process API. Content scripts in page-mod get detach events when the add-on is disabled or removed. throttle() and debounce() functions added to lang/functional. getTabForId() function added to tabs/utils. Details GitHub commits made between Firefox 29 and Firefox 30. This will not include any uplifts made after this release entered Aurora. Bu...
HTML in XUL for rich tooltips - Archive of obsolete content
}, onMouseTooltip: function(event) { //get the HTML tooltip string assigned to the element that the mouse is over (which will soon launch the tooltip) var txt = event.target.getAttribute("tooltipHTML"); // get the HTML div element that is inside the custom XUL tooltip var div = document.getElementById("myHTMLTipDiv"); //clear the HTML div element of any prior shown custom HTML while(div.firstChild) div.removeChild(div.firstChild); //safely convert HTML string to a simple DOM object, stripping it of JavaScript and more complex tags var injectHTML = Components.classes["@mozilla.org/feed-unescapehtml;1"] .getService(Components.interfaces.nsIScriptableUnescapeHTML) .parseFragment(txt, false, null, div); //attach the DOM object to the HTML div element div.appendChild(injectHTML); } } wind...
Label and description - Archive of obsolete content
The default style for these XUL elements includes white-space: wrap;. This reduces all whitespace chunks (including newlines) to single spaces. Text is permitted to wrap. <description>I am your father's brother's nephew's cousin's former roommate. ...
QuerySelector - Archive of obsolete content
alert(document.$('label')); // [object XULElement] ]]></script> Document.prototype.$ = function (selector) { // Only for plain XML return this.querySelector(selector); }; var foo = document.implementation.createDocument('someNS', 'foo', null); // Create an XML document <foo xmlns="someNS"/> var bar = foo.createElementNS('someNS', 'bar'); // add <bar xmlns="someNS"/> foo.documentElement.appendChild(bar); alert(foo.$('bar').nodeName); // gives 'bar' Element.prototype.$ = function (selector) { // Works for HTML, XUL, and plain XML return this.querySelector(selector); }; HTML example: <h1><a>Test!<a/></h1> <script> Element.prototype.$ = function (selector) { return this.querySelector(selector); }; alert(document.getElementsByTagName('h1')[0].$('a').nodeName); // 'A' XUL example: <hb...
Rosetta - Archive of obsolete content
has been automatically translated from \"" + sMimeType + "\" to \"text/ecmascript\". ...
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.nsIDocShel...
Windows - Archive of obsolete content
Requestor).getInterface(Components.interfaces.nsIDOMWindowUtils); var windowID = util.currentInnerWindowID; Programatically modifying HTML When attempting to modify HTML elements, it is important to specify the namespace. For example, the following code will add a horizontal rule. var hr = document.createElementNS("http://www.w3.org/1999/xhtml", "html:hr"); document.getElementById("id1").appendChild(hr); ...
How to convert an overlay extension to restartless - Archive of obsolete content
LABEL({'control': 'coord-x', 'value': 'X:'}), TEXTBOX({'id': 'coord-x', 'class': 'coord-box', 'placeholder' : '0'}), LABEL({'control': 'coord-y', 'value': 'Y:'}), TEXTBOX({'id': 'coord-y', 'class': 'coord-box', 'placeholder': '0'}) ... That way you build elements hierarchy with not much interaction with DOM, plus you can see tag properties and it children in a nice, structured way, just like in overlay.xul. You can find working example here. It involves using of firebug.sdk xul.js with few modifications. Step 7: Manually handle global CSS Stylesheets Any Global CSS style sheets which you are using will need to be registered upon load and unregistered when your extension is unloaded. Any CSS files used in any of your own XUL files will functio...
Inline options - Archive of obsolete content
string menulist menulist dependent on the menu item values radio radio buttons dependent on the radio values control button no pref stored The pref attribute should have the full name of the preference to be stored. The title attribute is used as a label for the controls. To set a description, either use the desc attribute, or a text node as a child of the <setting> tag. Settings are tied to actual preferences, except the button setting, which is designed more for actions. Some examples: <!-- Boolean examples --> <setting pref="extensions.myaddon.bool1" type="bool" title="Boolean 1"/> <setting pref="extensions.myaddon.bool2" type="bool" title="Boolean 2"> Description of Boolean 2 </setting> <!-- Boolean stored as an integer --> <settin...
Jetpack Processes - Archive of obsolete content
preventing it from being passed as a message argument, or it can unroot the handle, allowing it to be passed as a message argument until all references to it are removed, at which point it is garbage collected. Handles have the following native methods and properties: invalidate() Invalidates the handle. Either process may invalidate a handle when it is no longer useful. createHandle() Creates a child handle which becomes invalid when its parent does. This is useful for associating handles to the lifetime of a particular window, context menu, or other element, and helping ensure that they do not leak. parent The parent handle of the object, if any. Read-only. isValid Whether the handle is still valid or not. Read-only. isRooted Whether the handle is GC rooted or not. Read-write. onInvalidate A...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
The toolbox is the collection of toolbars in Firefox, including the main menu bar. Let's look at the attributes we used: The toolbarname is the name that will appear on the View > Toolbars menulist. This menu allows hiding and showing any toolbar. The customizable attribute determines if the user can customize the toolbar. You should normally...
Handling Preferences - Archive of obsolete content
ant. The tabs at the top of the window will need icons, and just like with toolbar buttons there are subtle differences between operating systems. The prefwindow allows you to use the preferences and preference elements, which facilitate preference handling. The preferences element is just a container, and you should have one per window, or one per prefpane if you have those. The element and its children are completely invisible, and their purpose is to list the preferences to be used in the window/pane. <preferences> <preference id="xulschoolhello-message-count-pref" name="extensions.xulschoolhello.message.count" type="int" /> <!-- More preference elements. --> </preferences> After you define the preferences you need, you associate them with the form elements in your window or ...
Creating reusable content with CSS and XBL - Archive of obsolete content
n="1.0"?> <!DOCTYPE bindings> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> <binding id="square"> <resources> <stylesheet src="bind6.css"/> </resources> <content> <html:div anonid="square"/> <xul:button anonid="button" type="button"> <children/> </xul:button> </content> <implementation> <field name="square"><![CDATA[ document.getAnonymousElementByAttribute(this, "anonid", "square") ]]></field> <field name="button"><![CDATA[ document.getAnonymousElementByAttribute(this, "anonid", "button") ]]></field> <method name="doDemo"> <body><![CDATA[ this.square.style.backgroundC...
CSS3 - Archive of obsolete content
S qualified name, using the ' | ' syntax and adding the @namespace CSS at-rule. Selectors Level 3 Recommendation since September 29th, 2011 Adds: Substring matching attribute selectors, E[attribute^="value"], E[attribute$="value"], E[attribute*="value"] . New pseudo-classes: :target, :enabled and :disabled, :checked, :indeterminate, :root, :nth-child and :nth-last-child, :nth-of-type and :nth-last-of-type, :last-child, :first-of-type and :last-of-type, :only-child and :only-of-type,:empty, and :not. Pseudo-elements are now characterized by two colons rather than one: :after becomes ::after, :before becomes ::before, :first-letter becomes ::first-letter, and :first-line becomes ::first-line. The new general sibling combinator ( h1~pr...
toolbarBindings.xml - Archive of obsolete content
e that file as "toolbarBindings.xml": <bindings id="toolbarBindings"> <binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar-primary"> <content> <xul:hbox class="toolbar-holder toolbar-primary-holder" flex="1" xbl:inherits="orient=tborient,buttonstyle"> <xul:hbox class="toolbar-button-box" flex="1"> <children/> </xul:hbox> <xul:image class="toolbar-primary-icon" xbl:inherits="buttonstyle"/> </xul:hbox> </content> </binding> </bindings> ...
Layout FAQ - Archive of obsolete content
ilable at Jprof Readme On more recent linux versions sysprof can also be used. also lists some profiles. How do you find out if there are any reflows that are pending and wait to show the view until afterwards, but if none are pending, show the view immediately? What is the best way to determine whether there are any pending changes? On the reflow branch you could check the DIRTY and DIRTY_CHILDREN framestate flags. That won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. What are the lowercase items called "line"? Block(body)(1)@035FF490 {120,120,8820,600} [state=00000010] sc=035FF264(i=2,b=0)< line 035FFC18: count=1 state=inline,clean,prevmarginclean,not impacted,not wrapped,before:nobr,after:linebr[0x510...
Creating a Help Content Pack - Archive of obsolete content
t" 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. This attribute marks the start point in the RDF graph described by the file, and the Help Viewer searches for this element in order to query for further information (stored in child elements) about the content pack being parsed. nc:title is where you specify the title (e.g., "Mozilla Firefox Help") for the Help Window. This attribute is required. nc:defaulttopic will hold the rdf:ID of the topic you want displayed when the viewer first loads if none has been specified. This attribute also specifies what topic is loaded when the user hits the Home button in the viewer. We'l...
Jetpack Snippets - Archive of obsolete content
> <p>some slidbar you want to debug</p> <a href="javascript:console.log('hello!')">test</a> <script><![CDATA[ //firebug lite bookmarklet code: var firebug=document.createElement('script'); firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'); document.body.appendChild(firebug); (function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug); ]]></script> </body></html>, width: 800, //wide enough to use firebug onSelect: function(slide) { slide.slide(800, true); }}); Calling into a slidebar from the global jetpack scope jetpack.slideBar.append({ onReady: fun...
Clipboard Test - Archive of obsolete content
<style></style> <style>.description{ display: block; font-size: 13pt; color: #444; font-style: italic; margin-bottom: 7px; } .method>.returns{display: none;} .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param>.name:after{content: " as "; font-weight: normal; } .method>.params{display: block; color:#555;} .method>.params>.param{display: block; margin-bottom:5px;} .method>.params>.param>.name{font-weight:bold; margin-right:.5em; min-width:80px; display:inline-block;} .method>.params>.param>.description{display:inline-block; width:300px; vertical-align:top;margin-right:30px} .method>.params>.param>.type{display:inline-block; width:100px; vertical-align:top;font-weight...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
are called during a context menu's invocation. They may then modify the menu. Individual menus are drawn from the set using on(): on(selector) Returns a new ContextMenuSet whose context menus are those that arise from nodes that match the given CSS selector(s). The selector must be a true CSS selector, not a jQuery or other type of pseudo-selector. Note: Selectors don't automatically include the children of nodes they match. For example, jetpack.menu.context.page.on("a[href]") does not match images contained in links. To match links and all elements contained in links, use jetpack.menu.context.page.on("a[href], a[href] *"). A future version of Jetpack may change this behavior; see bug 527924. What do you think? Leave a comment on that bug or send a message to the mailing list. Parameters ...
PyDOM - Archive of obsolete content
citly specified - the globals are the window itself. The event handler could also have used getElementById - the point is that both the event handler and top-level script share the same namespace. Using Python Ideally, you just tell Mozilla you are using Python, and magically you can use Python instead of JavaScript. Once you set the script type for a node, it is the default for that node and all children. This means that if you set the script-type to Python for the window, Python is the default script type for all child elements in the window. XUL Use a script-type attribute on your elements. For example, <window script-type="application/x-python" .../> HTML <meta http-equiv="Content-Script-Type" content="application/x-python" /> should work (but possibly doesn't - see bug 100924). But addEv...
The life of an HTML HTTP request - Archive of obsolete content
in wich case it waits until it gets unblocked before parsing the cached data it has receieved while being blocked. (6) The contentsink then builds up nsIContent nodes that describe the document. These content nodes are created by calling functions like NS_NewHTMLXxxxElement(). These element nodes implement the nsIHTMLContent interface as well as their respective DOM interfaces. nsIContent::AppendChild() is used to build the content tree but AppendChild takes a "aNotify" argument that marks if it should notify the document about the content model changes or not. This argument is always PR_FALSE when the content sink calls AppendChild. The content sink tells the document about content model changes (NotifyBody()) in places like nsHTMLContentSink::WillInterrupt() and nsHTMLContentSink::DidBuildMo...
Event Handlers - Archive of obsolete content
g the event attribute. The handler contains script that is executed when an event flows to the object the handler is attached to and if that event matches all of the criteria specified by the handler. The most basic handler specifies the event to listen for and an action to take when the handler fires. This action can be specified either using an action attribute or by specifying the script as a child of the handler element. If both are specified, the attribute wins. In both cases the JavaScript body is compiled just before execution; code that does not depend on the context of the event should be factored into normal Javascript file. (Note that there is a possibility that this may change in the future.) Handlers are attached to the bound element, and they are registered by default for bubbli...
Mozilla E4X - Archive of obsolete content
Presentation View Online Download Summary "ECMAScript for XML" (ECMA-357), a new standard for writing and processing XML directly in JavaScript (ECMA-262, ISO-16262). E4X marries XML and JavaScript syntax, and extends JavaScript to include namespaces, qualified names, and XML elements and lists. E4X also adds new JavaScript operators for filtering XML lists, and for enumerating XML children and descendants. Another E4X feature: the ability to bind a W3C DOM document to a new XML object, reflecting the DOM in E4X terms so that updates to either the DOM or the E4X object hierarchy show up in the other. Questions and Discussion Mozilla E4X - Discussion ...
XTech 2005 Presentations - Archive of obsolete content
ing Keynote, Mike Shaver Mozilla E4X - Brendan Eich "ECMAScript for XML" (ECMA-357), a new standard for writing and processing XML directly in JavaScript (ECMA-262, ISO-16262). E4X marries XML and JavaScript syntax, and extends JavaScript to include namespaces, qualified names, and XML elements and lists. E4X also adds new JavaScript operators for filtering XML lists, and for enumerating XML children and descendants. Another E4X feature: the ability to bind a W3C DOM document to a new XML object, reflecting the DOM in E4X terms so that updates to either the DOM or the E4X object hierarchy show up in the other. Directions of the Mozilla RDF engine: website scripting, standards conformance and perfomance - Axel Hecht This presentation showed new developments in the Mozilla RDF engine. T...
container - Archive of obsolete content
This would be used for folders. This will be set by the template builder as needed. ...
containment - Archive of obsolete content
<< XUL Reference home containment Type: URI This attribute specifies RDF properties (an RDF predicate) that indicate that a resource is a container. When generating content from a template this is used to determine which resources from the datasource are containers and thus can have child nodes and which ones are not containers. This attribute should be placed on the same element that the datasources and the ref attribute is on. It may be set to a space-separated list of RDF properties or resources. ...
datasources - Archive of obsolete content
rces Type: space separated list of datasource URIs A space-separated list of datasources that an element's template will use for content generation. These can be either internal datasources such as rdf:bookmarks or a URL. The datasources attribute may be placed on most elements, although it will usually be found on trees and menu related elements. The element should have a template element as a child. For RDF templates, the specified datasources are combined into a single composite datasource which holds the data from all of the datasources. This composite datasource is accesssible via a script through the database property. For XML datasources, only one source is used, either the URL of an XML file or an anchor reference to another element within the same document. For instance, the refere...
dir - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › dir
normal For scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) For other elements, the elements are placed left to right or top to bottom in the order they appear in the XUL code. reverse For scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). For other elements, they are placed right to left or bottom to top. ...
empty - Archive of obsolete content
This will be set by the template builder as needed. ...
equalsize - Archive of obsolete content
<< XUL Reference home equalsize Type: one of the values below This attribute can be used to make the children of the element equal in size. always For a horizontally oriented element, this will make all of its children have the width of the widest child. For a vertically oriented element, this will make its children all have the height of the tallest child. never All of the children are displayed at the size required by the content or as specified by the width and height attributes or the CSS width and height properties. ...
flex - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › flex
Flexible elements grow and shrink to fit their given space. Elements with larger flex values will be made larger than elements with lower flex values, at the ratio determined by the two elements. The actual value is not relevant unless there are other flexible elements within the same container. ...
isempty - Archive of obsolete content
<< XUL Reference home isempty Type: boolean Indicates whether rules match based on emptyness. If not specified, the rule may match regardless of whether a node has children or not. true: The rule will only match nodes that contain no child elements. false: The rule will only match nodes that contain one or more child elements. ...
listcell.type - Archive of obsolete content
...
mousethrough - Archive of obsolete content
below Determines whether mouse events are passed to the element or not. If this attribute is not specified, the value is inherited from the parent of the element. If no ancestor has the mousethrough attribute set, the default value is never. always Mouse events are transparent to the element. This means that the element will not receive any mouse events due to either clicking or movement. Child elements may override this if they specify mousethrough="never". never Mouse events are passed to the element as normal. The mousethrough attribute is typically used in conjunction with a stack to allow elements to be stacked above other elements yet allow mouse events to be sent to lower elements. In the following example, the image appears above the button, yet the mousethrough attri...
pageid - Archive of obsolete content
...
panel.level - Archive of obsolete content
this attribute should not be set, otherwise IME or on-screen keyboard popups will appear incorrectly. For these reasons, you should avoid setting the level if not needed. top The panel is shown in front of all other normal windows, including those of other applications. parent The panel is shown just above the window the panel is in, but behind other windows above it. If anchored, the child window maintains its relative position to its parent window. floating The panel floats above the window the panel is in. On Mac, the panel is only visible when the application is active. ...
position - Archive of obsolete content
<< XUL Reference home position Type: string (representing an integer) When an element is in an overlay, the position is an index where the child is inserted. The position is one-based, so use a value of 1 to place the element at the beginning. This attribute is ignored if either an insertbefore or insertafter attribute matches an element. ...
prefwindow.type - Archive of obsolete content
<< XUL Reference home type Type: string Set this attribute to child for preference dialogs that are child dialogs of a main preferences window. This ensures that the preferences are only saved when the main dialog is closed, if this is the appropriate behaviour for the platform. ...
Deprecated and defunct markup - Archive of obsolete content
nts sliding box in center of scrolbar) <title> (to add a caption on a <titledbox> <titledbox> (box with a frame) <titledbutton> (attempt to combine text and images before <button>) <toolbarpaletteitem> Required to embed non-buttons in customisable toolbars --Neil 03 March 2011 <treebody> (old/experimental and unsupported XUL tags) Lives on as the internal name for the ancestor <treechildren> element --Neil 03 March 2011 <treecaption> (old/experimental and unsupported XUL tags) <treecolgroup> (former name for <treecols> <treecolpicker> (internal use only; part of XBL for <tree>) <treefoot> (old/experimental and unsupported XUL tags) <treeindentation> (old/experimental and unsupported XUL tags) Was a part of the old <tree> that predated <outliner> that was not conver...
XUL Events - Archive of obsolete content
of its attributes is modified. In the event handler, you can retrieve the attribute that was modified using the event's attrName property, and you can retrieve the old and new values of the attribute using the event's prevValue and newValue properties. DOMNodeInserted This event is sent when a node is added as a child of a element. If you capture this event at the document level, you can be notified of document changes. DOMNodeRemoved This event is sent when a node is removed from an element. If you capture this event at the document level, you can be notified of document changes ...
How to implement a custom XUL query processor component - Archive of obsolete content
from the beginning of the name var name = aVar.toString().slice(1); return this._data[name]; }, // return an object instead of a string for convenient comparison purposes // o...
getElementsByAttribute - Archive of obsolete content
If the second argument is '*', the method will match the given attribute set to any value. ...
getElementsByAttributeNS - Archive of obsolete content
If the namespace (first argument) is set to '*', elements with any attribute namespace will be retrieved. ...
openSubDialog - Archive of obsolete content
<< XUL Reference home openSubDialog( url, features, params ) Return type: window Opens a child modal dialog. Usually this method would be used to allow the user to configure advanced options. The arguments are similar to the window's openDialog method except that the window name does not need to be supplied. The url should be a XUL file. If the child dialog is also a prefwindow, set its type attribute to child so that preferences will be saved properly when the main dialog is closed. ...
openWindow - Archive of obsolete content
The windowtype is a string specifying a window type. If a window with that type is already open, this method will just switch that window to the front and focus it instead of opening another window. ...
removeItemAt - Archive of obsolete content
The method returns the removed item. ...
Node - Archive of obsolete content
Archive › Mozilla › XUL › Node
mation on this interface please see DOM-Level-2-Core short ELEMENT_NODE 1 short ATTRIBUTE_NODE 2 short TEXT_NODE 3 short CDATA_SECTION_NODE 4 short ENTITY_REFERENCE_NODE 5 short ENTITY_NODE 6 short PROCESSING_INSTRUCTION_NODE 7 short COMMENT_NODE 8 short DOCUMENT_NODE 9 short DOCUMENT_TYPE_NODE 10 short DOCUMENT_FRAGMENT_NODE 11 short NOTATION_NODE 12 Methods Node appendChild ( Node newChild ) Node cloneNode ( boolean deep ) boolean hasAttributes ( ) boolean hasChildNodes ( ) Node insertBefore ( Node newChild , Node refChild ) boolean isSupported ( String feature , String version ) void normalize ( ) Node removeChild ( Node oldChild ) Node replaceChild ( Node newChild , Node oldChild ) ...
MenuButtons - Archive of obsolete content
open a menu when pressed. An arrow appears on the button next to the label or image indicating to the user that a menu is present. A button or toolbarbutton with a type attribute set to 'menu-button' creates a button that can be pressed normally. However a segment of the button displays an arrow which, when pressed, opens a menu. In either case, a menupopup element should be placed as a direct child of the button. The 'menu' button The 'menu' type of button is used when pressing the button alone should just open the menu and not execute a command directly. This works similarly to the menu tag, and would be used to present a set of commands to execute. To create a button of this type, set the type attribute of the button to 'menu'. For instance, in the following example, pressing the 'View...
MenuItems - Archive of obsolete content
class instead. <menuitem id="bookmark" class="menu-iconic" label="Bookmarks" image="bookmarks.png"/> Menu icon animation In order to animate the menu item icon on hover a -moz-image-region rule can be applied. In this example we use an image that is 16px wide and 32px high. the top 16px square is the icon in normal state the bottom part in hovered state. Note that the image element is on a child level underneath the menu or menuitem, and it will have the class menu-iconic-icon. Hence, -moz-image-region is not applied to the menu itself, but one level lower: <menuitem id="add-bookmark" class="menuitem-iconic" label="Add Bookmark" image="addbookmark.png"/> #add-bookmark { list-style-image: url('addbookmark.png'); } #add-bookmark .menu-iconic-icon { -moz-image-region: rect(0px, 16px, 16...
Panels - Archive of obsolete content
For example, the following panel displays a textbox for entering a name. Note that the panel is not placed in a separate file and is instead placed inside another window. ...
PopupEvents - Archive of obsolete content
ng event, you can append to or modify the menu as needed before it is displayed. For examples of the use of the popupshowing event when used with context menus, see Hiding and Showing Menu Items based on Context. However, this technique can be applied to any type of popup. In this example, a label within a panel is initialized with the current time. <panel id="time-panel" onpopupshowing="this.lastChild.value = (new Date()).toLocaleFormat('%T')"> <label value="Time:"/> <label id="time"/> </panel> <toolbarbutton label="Show Time" popup="time-panel"/> You can prevent a menu or popup from appearing by calling the preventDefault method of the event from within a popupshowing listener. The default operation of the popupshowing event is to continue showing the popup. The preventDefault method w...
Tooltips - Archive of obsolete content
d 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. This can be accomplished by using a popupshowing event listener and adjusting the tooltip as needed. The popupshowing event will be fired on the tooltip element just before the tooltip appears. For example: <tooltip id="iconic" onpopupshowing="this.lastChild.value = document.tooltipNode.label;"/> The document.tooltipNode property of the document holds the element that the mouse is hovering over. In this example, this property is examined to retrieve the label of the element that the mouse is over. This label is then set as the value of the last child of the tooltip. In the earlier example, the last child of the tooltip is a label. The effect is tha...
currentIndex - Archive of obsolete content
eeRowClicked(){ var tree = document.getElementById("my-tree"); var selection = tree.view.selection; var cellText = tree.view.getCellText(tree.currentIndex, tree.columns.getColumnAt(0)); alert(cellText); } </script> <tree id="my-tree" seltype="single" onselect="treeRowClicked()"> <treecols> <treecol label="Title" flex="1"/><treecol label="URL" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joe@somewhere.com"/> <treecell label="Top secret plans"/> </treerow> </treeitem> <treeitem> <treerow> <treecell label="mel@whereever.com"/> <treecell label="Let's do lunch"/> </treerow> </treeitem> </treechildren> </tree> See also listbox.currentIndex ...
externalToolbars - Archive of obsolete content
...
itemCount - Archive of obsolete content
<< XUL Reference itemCount Type: integer Read only property holding the number of child items. Example var bucket = document.getElementById("attachmentBucket"); if(bucket.itemCount == 0) { dump("\n\n No attachments \n\n"); } else { dump("\n\n Attachment Exists \n\n"); } ...
pageid - Archive of obsolete content
...
richlistitem.label - Archive of obsolete content
<< XUL Reference label Type: string Gets the concatentation of text from any child label elements. Does not support setting label values. Use the child elements directly to set label text. ...
tag - Archive of obsolete content
Archive › Mozilla › XUL › Property › tag
<< XUL Reference tag Type: tag name This may be set to a tag name. If set, the conditions will only match if the template builder is parsing content for an element directly inside this tag. For example, by using a value of treechildren, the condition will only match when placing elements directly inside a treechildren tag. Thus, nested elements will not match because they are directly inside a treeitem. This attribute is useful to provide different rules for outer and inner elements. ...
Actions - Archive of obsolete content
The content to generate goes directly inside the action element. This content will be copied for each matching result (though see below for an exception) and inserted into the document. Let's look at a simple example first. ...
Additional Template Attributes - Archive of obsolete content
ace a template attribute on the root element set to the id of a template. <listbox datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" template="photoTemplate"/> ... <template id="photoTemplate"> ... </template> This template will be shared with any other element that references the id 'photoTemplate'. The listbox here does not have any children, although it may do. If you did add children, they act just like the static content as if the template was present. However, it is possible to use different static content for each usage, even though the template is shared. The datasources and ref attributes also differ for each usage, so it is possible to use a shared template to display the same structure multiple times but with different st...
Bindings - Archive of obsolete content
<< PreviousNext >> We can add more triples to the previous example to show more information. For example, a description could be added to a photo. To do this all we need to do is add the necessary data to the RDF datasource and add another <triple> element to the template's statements. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> It works similarly to the previous triple. The ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for the...
Introduction - Archive of obsolete content
the template builder generates results and creates content. For example: <listbox datasources="http://www.xulplanet.com/ds/sample.xml" querytype="xml"> <template> <listitem label="?name"/> </template> </listbox> This template uses an XML datasource to generate a listbox. Although we'll look at the details of this later, the simple result here is that a listitem will be generated for each child node in the XML data, setting the label to the name attribute for each XML node. For SQLite datasources, the datasources attribute specifies the URI of a database file. Only local files are supported, so a file URL should be used. If the datasource type supports it, the template builder can also use multiple datasources which are all combined into a single datasource as if they were all in one da...
Multiple Rules - Archive of obsolete content
ique where the last rule in a template has no conditions, allowing all remaining results that didn't match earlier rules to match this last rule. ...
RDF Modifications - Archive of obsolete content
If the output would change, the builder will need to adjust the output, either by adding a new result, removing an old result, or by changing the value of some part of the result. The builder is smart enough to only change what needs to be changed and leave the remaining parts alone. Let's assume we have single query with as follows: <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> These query statements will cause any photos with both a title and a description to be displayed. Assuming that the 'obelisk...
RDF Query Syntax - Archive of obsolete content
<vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/A"> <template> <query> <content uri="?start"/> <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relatedItem" object="?relateditem"/> </query> <rule> ... </rule> </template> </vbox> This query has two statements, each specified with a different tag. ...
Recursive Generation - Archive of obsolete content
"/> </hbox> <hbox id="http://www.xulplanet.com/rdf/D"> <button label="http://www.xulplanet.com/rdf/A"/> <button label="http://www.xulplanet.com/rdf/D"/> </hbox> </vbox> For the next iteration, the insertion point will be the three <hbox> elements. However, since C is the only element that will end up having any additional content, only the second <hbox> element will have additional children added to it. For a nested item, the builder processes the query in the same way as usual, however instead of using the ref attribute as the seed starting point, the end point or member is used instead. This will correspond to the id on the appropriate element in the generated content above. To begin, B is evaluated and seeded with the right value: (?start = http://www.xulplanet.com/rdf/B) The...
SQLite Templates - Archive of obsolete content
e values. This is especially important when you are taking values that were entered by the user. The solution is to use query parameters, using the param element. <query> select name, email from myfriends where gender = :wantedgender <param name="wantedgender">male</param> </query> In this example, a parameter 'wantedgender' is used. This is a param element which should be used as a direct child of the query element. The name attribute is used to specify the parameter name, and the contents of the param element specify the value to use. When the name appears in the query, preceded by a colon, as ':wantedgender' does in the example above, the value of that parameter will be filled in to the query. The resulting query that gets used will be: select name, email from myfriends where gende...
Sorting Results - Archive of obsolete content
results are in that container, however, the template builder orders the results in the order the items appear in the Seq. For instance, the photos are listed in the same order in this example as they appear in the Seq in the datasource. This method of sorting a Seq works best for the simple query syntax since it is obvious how the starting ref relates to the end member results (they are just the children), or for extended syntax queries that follow a similar pattern. For more complex queries, this natural sorting will not work, because the sort service assumes that the starting ref resource is the container and the end results are the children. In this case, the natural order of the results will just be the order that the template builder generates the results. For ascending or descending sort...
Static Content - Archive of obsolete content
e become important when dealing with recursive content and multiple rules. What's going on here is that the XUL parser first creates the outer menulist element. The static content outside the template will also be created. The result will be a XUL display that looks just like the code above, except that the template and its content is hidden. At this point, the menulist will have a menupopup as a child, and the menupopup will in turn have one menuitem child. Next, the template is examined and two results are generated. Remember that only the content at the uri attribute or below inside the action are copied for each result. When processing the action body, the builder looks at the first element inside the action, in this case, the menupopup. This element doesn't have a uri attribute, so the bui...
Template and Tree Listeners - Archive of obsolete content
s addObserver method. You can add more than one observer if needed, and can remove them again with the builder's removeObserver method. The observer is always invoked before the appropriate operation is performed. For instance, the onToggleOpenState method of any observers will be called before the tree item is opened. After the observers have finished, the tree builder opens the row and adds any child rows inside. Note that you cannot cancel the operation from within the observer. Some useful functions of the observer are the drag and drop related callbacks to handle when an item is dragged onto the tree. This makes handling dragging onto a tree fairly simple. All you need to do is implement three methods, canDropOn, canDropBeforeAfter and onDrop. The tree observer receives drag related events...
XML Templates - Archive of obsolete content
e> </listbox> The expr attribute is a very simple XPath expression which simply retrieves the person elements from within the datasource. As there are five in the XML document, five results will be generated. The action element defines the content to generate for each result. The content of the action element will be generated and repeated for each result, which in this case, is a listitem. The child of the action element has to have a uri attribute, although it does not have to be a direct child. The element with the uri attribute and its children will be copied once for each result. Any elements between the action element and this element are only copied once. This is useful when recursive generation or multiple rules are used, and we'll see examples of why this is useful later. For an RDF ...
Toolbar customization events - Archive of obsolete content
ge This event is delivered when the user makes a change to a toolbar while editing the toolbars, either by dragging an item to the toolbar or by dragging an item out of it. aftercustomization This event is delivered when the user closes the toolbar customization panel. In all cases, the event.target is the toolbox being customized. You can look at the contents of that element and its children to determine what changes were made. Example In this example, we watch for toolbar changes. window.addEventListener("beforecustomization", customizeStart, false); window.addEventListener("aftercustomization", customizeEnd, false); window.addEventListener("customizationchange", customizeChange, false); function customizeStart(e) { let theToolbox = e.target; /* now we know the user has star...
Broadcasters and Observers - Archive of obsolete content
casters for state. In fact, any element can act as broadcaster, as long as you observe it using the observes attribute. The Observes Element There is also a way to be more specific about which attribute of the broadcaster to observe. This involves an observes element. Like its attribute counterpart, it allows you to define an element to be an observer. The observes element should be placed as a child of the element that is to be the observer. An example is shown below: Example 2 : Source View <broadcasterset> <broadcaster id="isOffline" label="Offline" accesskey="f"/> </broadcasterset> <button id="offline_button"> <observes element="isOffline" attribute="label"/> </button> Two attributes have been added to the observes element. The first, element, specifies the id of the broadcaster ...
Creating a Window - Archive of obsolete content
the window. You may also use the value vertical, which means that the items are placed in a column. This is the default value, so you may leave the attribute off entirely if you wish to have vertical orientation. xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> This line declares the namespace for XUL, which you should put on the window element to indicate that all of its children are XUL. Note that this URL is never actually downloaded. Mozilla will recognize this URL internally. <!-- Other elements go here --> Replace this comment block with other elements (the buttons, menus and other user interface components) to appear in the window. We'll add some of these in the next set of sections. </window> And finally, we need to close the window tag at the end of the f...
Cross Package Overlays - Archive of obsolete content
. To add this overlay to the manifest file, we need to add two resources. First, we add one for each window that we are applying an overlay to. The code below should be added into contents.rdf just before the closing RDF tag. <RDF:Seq about="urn:mozilla:overlays"> <RDF:li resource="chrome://navigator/content/navigator.xul"/> </RDF:Seq> This declares that we are adding a overlay window, a child of the root overlay node (urn:mozilla:overlays). You can add additional nodes for any other windows that you want to apply overlays to by adding additional li nodes. Next, we add a node for each overlay to apply to the window. In this case, we only have one, but we could apply others also. Add these lines just after the previous lines. <RDF:Seq about="chrome://navigator/content/navigator.xul"...
Grids - Archive of obsolete content
Archive › Mozilla › XUL › Tutorial › Grids
or in columns. It is most common to use rows, as with a table. However, you can still use columns to specify the size and appearance of the columns in a grid. Alternatively, you can put content inside the columns, and use the rows to specify the appearance. We'll look at the case of organizing elements by row first. Declaring a grid To declare a set of rows, use the rows tag, which should be a child element of grid. Inside that you should add row elements, which are used for each row. Inside the row element, you should place the content that you want inside that row. Similarly, the columns are declared with the columns element, which should be placed as a child element of the grid. Inside that go individual column elements, one for each column you want in the grid. This should be easier to...
Introduction to XBL - Archive of obsolete content
indfile/content/findfile.xml'. The '#binding1' syntax is used to point to a specific binding, much like how you would point to an anchor in an HTML file. You will usually put all of your bindings in a single file. The result in this example, is that all scrollbar elements will have their behavior described by the binding 'binding1'. A binding has five types of things that it declares: Content: child elements that are added to the element that the binding is bound to. Properties: properties added to the element. They can be accessed through a script. Methods: methods added to the element. They can be called from a script. Events: events, such as mouse clicks and keypresses that the element will respond to. The binding can add scripts to provide default handling. In addition new events c...
Localization - Archive of obsolete content
l="&casesensitive;"/> <checkbox id="wordscheck" label="&matchfilename;"/> </tabpanel> </tabpanels> </tabbox> <tree id="results" style="display: none;" flex="1"> <treecols> <treecol id="name" label="&results.filename;" flex="1"/> <treecol id="location" label="&results.location;" flex="2"/> <treecol id="size" label="&results.size;" flex="1"/> </treecols> <treechildren> <treeitem> <treerow> <treecell label="mozilla"/> <treecell label="/usr/local"/> <treecell label="&bytes.before;2520&bytes.after;"/> </treerow> </treeitem> </treechildren> </tree> <splitter id="splitbar" resizeafter="grow" style="display: none;"/> <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style=...
Manipulating Lists - Archive of obsolete content
lement provides numerous methods to retrieve and manipulate its items. Although listboxes may be manipulated using the standard DOM functions as well, it is recommended that the specialized listbox functions be used instead when possible. These functions are bit simpler and will do the right thing. The appendItem() function is used to append a new item to the end a list. Similar to the DOM appendChild() function except that it takes a string label, and you do not have to worry about where to add it in the list structure. Here is an example: Example 1 : Source View <script> function addItem(){ document.getElementById('thelist').appendItem("Thursday", "thu"); } </script> <listbox id="thelist"/> <button label="Add" oncommand="addItem();"/> The appendItem() takes two arguments, the label, ...
Popup Menus - Archive of obsolete content
clipmenu"> <menuitem label="Cut"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </menupopup> </popupset> <box context="clipmenu"> <label value="Context click for menu"/> </box> Here, the menupopup has been associated with a box. Whenever you context-click (right-click) anywhere inside the box, the popup menu will appear. The popup will also appear even if you click on the children of the box, so it will work if you click on the label element also. The context attribute has been used to associate the box with a menupopup with the same id. In this case, the menupopup clipmenu will appear. This way, you can have a number of popups and associate them with different elements. You could associate multiple popups with the same element by putting more attributes of different t...
Tabboxes - Archive of obsolete content
is the row of tabs. tab A specific tab. Clicking on the tab brings the tab page to the front. tabpanels The container for the pages. tabpanel The body of a single page. You would place the content for a page within this element. The first tabpanel corresponds to the first tab, the second tabpanel corresponds to the second tab and so on. The tabbox is the outer element. It consists of two children, a tabs element which contains the row of tabs and a tabpanels elements which contains the tabbed pages. Shown below is the general syntax of a tabbox: <tabbox id="tablist"> <tabs> <!-- tab elements go here --> </tabs> <tabpanels> <!-- tabpanel elements go here --> </tabpanels> </tabbox> The tab elements are placed inside a tabs element, which is much like a regular box. Th...
The Box Model - Archive of obsolete content
e 'Box Model'. This model allows you to divide a window into a series of boxes. Elements inside of a box will orient themselves horizontally or vertically. By combining a series of boxes, spacers and elements with flex and pack attributes, you can control the layout of a window. Although a box is the fundamental part of XUL element layout, it follows a few very simple rules. A box can lay out its children in one of two orientations, either horizontally or vertically. A horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. You can think of a box as one row or one column from an HTML table. Various attributes placed on the child elements in addition to some CSS style properties control the exact position and size of the children. Box elements The ba...
Tree Selection - Archive of obsolete content
mance improvement. This also means that the highlight will appear on several items even though the select event is never fired for those items. The syntax of the onselect() event handler is shown below. <tree id="treeset" onselect="alert('You selected something!');"> Tree Indices The tree has a property currentIndex, which can be used to get the currently selected item, where the first row is 0. Child items are included in the count just after their parents. This means that if there are 3 top-level items and each has two child items, there will be a total of 9 items. The first item (at index 0) will be the first top-level item. The next item at index 1 will be its first child. The second child will be at index 2 and the second parent item will be at position 3 and so on. In the image, ther...
Using Spacers - Archive of obsolete content
The values of the flex element are a ratio. If one element has a flex of 1 and the next one has a flex of 2, the second one will grow at twice the rate of the first one. In effect, a flex of 2 says that this element has a flex that is two times the elements that have a flex of one. The flex attribute isn't used to specify an actual size. Instead, it specifies how empty space it divided among the children of a container box. We'll look at boxes in the next section. Once the default sizes of the children of a box are determined, the flexibility values are used to divide up the remaining empty space in the box. For example, if a box is 200 pixels wide and contains two flexible buttons, the first 50 pixels and the other 90 pixels, there will be 60 pixels of space left over. If both buttons have a ...
XBL Inheritance - Archive of obsolete content
at how to extend existing XBL definitions. Inheritance Sometimes you may want to create an XBL widget that is similar to an existing one. For example, let's say you want to create an XBL button with a popup. One way to create this is to duplicate the existing XBL code for buttons. However, it would be better to simply extend the existing button code. Any binding can be extended with another. The child binding can add properties, methods and event handlers. The child binding will have all the features it defines in addition to the features from the binding it inherits from (and any that binding inherits from and so on up the tree). To extend an existing binding, add an extends attribute on to the binding tag. For example, the following binding creates a textbox which adds the text 'http://www' ...
Urlbar-icons - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] The location of UI elements like the bookmarks, feed and go buttons. Create new image or button child elements to add your own items. (The URL bar is also known as the Address bar and the Navigation bar.) Example The default contents of browser.xul: <hbox id="urlbar-icons"> <button be="" chromedir="ltr" class="urlbar-icon" click="" for="" id="safebrowsing-urlbar-icon" img="" level="safe" might="" onclick="goDoCommand('safebrowsing-show-warning');" page="" style="-moz-user-focus:" tooltiptext="This" type="menu"> <img class="urlbar-icon" id="star-button" onclick="PlacesStarButton.onClick(event);" /> <img address="" chromedir="ltr" class="urlbar-icon" id="go-button" in="" location="" ...
Using Remote XUL - Archive of obsolete content
iframe element so we can reference it from our function, and we add an oncommand event listener to the menubar element that calls the function every time the user clicks a button or selects a menu item. The oncommand event listener is a generic listener that fires whenever the user manipulates an element in some conclusive way. 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 inside the menu bar, so we don't have to add it to each menu item and button. Source | Rendered Conclusion It works! Basic global web site navigation. What we've built is just a start, however. There are many more enhancements we could add, including: hierarchical menus for more comprehensive navigation; (Since...
Writing Skinnable XUL and CSS - Archive of obsolete content
reehead treerow treecell { BAD! EVIL! YUCK! ... } This evil rule caused the style system, for every treecell that wasn't in a treehead (which is practically every treecell in a typical tree), to crawl up the whole parent chain to the root of the document in order to determine that the style rule wasn't a match. I'm usually seeing this rule misused by people who really wanted to use the child selector instead. That was my mistake with the above rule. I should have used treehead > treerow > treecell. After all, that's what I meant anyway. Never use an attribute selector rule for the class attribute. This is inefficient and you should just use the class notation (the dot notation) instead. Writing Skinnable XUL A XUL file that describes a window always imports the master skin fi...
XUL Template Primer - Bindings - Archive of obsolete content
" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" align="vertical"> <vbox datasources="friends.rdf" ref="urn:root"> <template> <rule> <conditions> <content uri="?uri"/> <triple subject="?uri" predicate="http://home.netscape.com/NC-rdf#friends" object="?friends"/> <member container="?friends" child="?friend"/> <triple subject="?friend" predicate="http://home.netscape.com/NC-rdf#name" object="?name"/> </conditions> <bindings> <binding subject="?friend" predicate="http://home.netscape.com/NC-rdf#address" object="?addr"/> <binding subject="?addr" predicate="htt...
XUL Event Propagation - Archive of obsolete content
ancestor before it is heard in the target itself or any of the intervening nodes. In the diagram above, the alert dialog invoked by the menuitem itself is not displayed, since the root window element has used event capture to handle the event itself. In another example, an onload event handler for a XUL window can register a box element to capture all the click events that are raised from its child elements: var bbox = document.getElementById("bigbox"); if (bbox) bbox.addEventListener("click", function() { alert('captured'); }, true); ... <box id="bigbox"> <menu value="File"> <menupopup> <menuitem value="New" onclick="alert('not captured')" /> ... <menupopup> </menu> </box> Adding an Event Listener In order to take advantage of event capturing (or event bub...
elements - Archive of obsolete content
crollcorner separator spacer splitter stack statusbar statusbarpanel stringbundle stringbundleset T tab tabbrowser tabbox tabpanel tabpanels tabs template textnode textbox titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip tree treecell treechildren treecol treecols treeitem treerow treeseparator triple V vbox W window wizard wizardpage ...
How to enable locale switching in a XULRunner application - Archive of obsolete content
Code to update the locale user preference and restart the application Mozilla XULRunner doesn't allow runtime switching of the locale, therefore the application must be restarted to activate the new choice. Here is an example event handler which is fired when the u...
Using SOAP in XULRunner 1.9 - Archive of obsolete content
PClient.js saXMLUtils.js Making a SOAP call var url = 'http://example.com/soap/'; var ns = 'http://example.com/soap/namespace'; var method = 'foo'; var params = { 'foo': 'bar', 'baz': 'bang' }; var callback = function(obj) { Components.utils.reportError(obj.toSource()); }; SOAPClient.Proxy = url; var body = new SOAPObject(method); body.ns = ns; for (var k in params) { body.appendChild(new SOAPObject(k).val(params[k])); } var req = new SOAPRequest(url, body); req.Action = ns + '#' + method; SOAPClient.SendRequest(req, callback); Diff between jqSOAPClient.js and saSOAPClient.js 42c42 < var jsOut = $.xmlToJSON(xData.responseXML); --- > var jsOut = XMLObjectifier.xmlToJSON(xData.responseXML); 46,60c46,62 < $.ajax({ < type: "POST", < url: SOAPClient.Proxy, < ...
Mozprocess - Archive of obsolete content
documentation is no longer maintained. For more information about mozprocess as part of the mozbase project, please see the mozbase project page. mozprocess provides python process management via an operating system and platform transparent interface to Mozilla platforms of interest. Mozprocess aims to provide the ability to robustly terminate a process (by timeout or otherwise), along with any child processes, on Windows, OS X, and Linux. Mozprocess utilizes and extends subprocess.Popen to these ends. API mozprocess.processhandler:ProcessHandler is the central exposed API for mozprocess. ProcessHandler utilizes a contained subclass of subprocess.Popen, Process, which does the brunt of the process management. Basic usage: process = ProcessHandler(['command', '-line', 'arguments'], ...
reftest opportunities files - Archive of obsolete content
ng6 http://dbaron.org/css/test/sec040102 http://dbaron.org/css/test/casesens http://dbaron.org/css/test/xmltypesel http://dbaron.org/css/test/unitless http://dbaron.org/css/test/exunit http://dbaron.org/css/test/emunit http://dbaron.org/css/test/sec040310 http://dbaron.org/css/test/parsing3 http://dbaron.org/css/test/selector_confusion http://dbaron.org/css/test/univsel http://dbaron.org/css/test/childsel http://dbaron.org/css/test/sibsel http://dbaron.org/css/test/attrsel http://dbaron.org/css/test/twoclass http://dbaron.org/css/test/xmlid http://dbaron.org/css/test/pseudos http://dbaron.org/css/test/pseudos2 http://dbaron.org/css/test/pseudos3 http://dbaron.org/css/test/firstchild http://dbaron.org/css/test/sec051103 http://dbaron.org/css/test/sec051103b http://dbaron.org/css/test/order http:...
Archived Mozilla and build documentation - Archive of obsolete content
h expertise in the particular laws and regulations that apply in your jurisdiction. Mozprocess mozprocess provides python process management via an operating system and platform transparent interface to Mozilla platforms of interest. Mozprocess aims to provide the ability to robustly terminate a process (by timeout or otherwise), along with any child processes, on Windows, OS X, and Linux. Mozprocess utilizes and extends subprocess.Popen to these ends. Nanojit Nanojit is a small, cross-platform C++ library that emits machine code. Both the Tamarin JIT and the SpiderMonkey JIT (a.k.a. TraceMonkey) use Nanojit as their back end. New Skin Notes Devmo has a new skin that is ready for testing. If y...
Extentsions FAQ - Archive of obsolete content
<http://webdesigns.ms11.net/chromeditp.html> Asking for help with getting an extension to process Windows messages. use WM_COPYDATA How to creating an extension that can replace HTML code on a specific page that does not use Greasemonkey? var newNode = document.createElement(" ... html content here ... ...
2006-11-17 - Archive of obsolete content
application on Linux with 512Mb, and there is the appearance of a significant memory leak. Win2XUL asks for any quick pointers, opinions, experience, suggestions or Ideas on where xulrunner might leak memory Bug 319654 was fixed on trunk recently. Nickolay Ponomarev lets us know that Processing instructions are now added to XUL document's DOM This also means, you can no longer use document.firstChild in XUL scripts to get the root element of a XUL document and the xml-stylesheet and xul-overlay processing instructions outside the prolog no longer have any effect peter.sei...@gmail.com runs into some difficulties Deploying XULRunner 1.8 on OS X? Please see mozilla.dev.platform FAQ for solution. Peter Naulls makes the suggestion in Use and maintenance of xlib code that he become the nominal m...
2006-09-29 - Archive of obsolete content
nscoord aBorder, nscoord aPadding, PRBool aShrinkWrap) = 0; Details can be located at refactoring some of nsHTMLReflowState. Discussion on how to determine whether there is pending layout changes or reflows when using a popup. It was concluded that a frame model change is utilized within a popup, not a layout change. On the reflow branch, check the DIRTY and DIRTY_CHILDREN framestate flags. That won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. Details can be located at frame reflow Issues related to the ongoing implementation of MathML-in-HTML into Mozilla, which include: Exposing the MathML implementation to tag soup. CSS Matching rules. Details can be located at MathML-in-HTML5 Mee...
2006-11-17 - Archive of obsolete content
For a summary of the changes and workarounds, read Nickolay's post in the mozilla.dev.tech.xul newsgroup. Discussions None during this week. Meetings None during this week. ...
NPN_GetValue - Archive of obsolete content
g up popup menus and modal dialogs, a plug-in needs a parent window. A windowless plug-in does not receive its own native window. Instead, it draws directly into the drawable given to it. Use the NPNVnetscapeWindow value to get the native window on which plug-in drawing occurs. The method returns a value of type HWND. In many cases, a plug-in may still have to create its own window (a transparent child window of the browser window) to act as the owner window for popup menus and modal dialogs. This transparent child window can have its own WindowProc within which the plug-in can deal with WM_COMMAND messages sent to it a result of tracking the popup menu or modal dialog. See also NPN_SetValue, NPP_GetValue ...
NPP_HandleEvent - Archive of obsolete content
tell the plug-in when events take place in the plug-in's window or drawable area. The plug-in either handles or ignores the event, depending on the value given in the event parameter of this function. For a list of event types the application is responsible for delivering to the plug-in, see the NPEvent structure. MS Windows The browser gives each windowed plug-in its own native window, often a child window of the browser window, to draw into. The plug-in has complete control over drawing and event handling within that window. Mac OS The browser does not give a windowed plug-in a native window, because the Mac OS platform does not support child windows. Instead, the windowed plug-in draws into the graphics port associated with the the browser window, at the offset that the browser specifies...
XEmbed Extension for Mozilla Plugins - Archive of obsolete content
NPP_GetValue(void *future, NPPVariable variable, void *value) { NPError err = NPERR_NO_ERROR; switch (variable) { case NPPVpluginNeedsXEmbed: *((PRBool *)value) = PR_TRUE; break; default: err = NPERR_GENERIC_ERROR; } return err; } Once you have set those variables, it should be relatively easy to set up a plugin. Just create a GtkPlug that is the child of the XID passed in and it's just like using a standard Gtk widget. Other Toolkits and Out of Process Plugins It should be possible to use this interface to build a plugin that would run out of process as well as using other toolkits like Qt to build plugins. Since XEmbed was designed for cross-toolkit and out of process applications, it should work. In fact, version 1.5 of the Java Plugin will ...
title - Archive of obsolete content
<title>Why can I not get any tang?!</title> <link>http://www.advogato.org/article/10101.html</link> <description>Seriously. Why can't I get any tang?</description> </item> </channel> </rss> Attributes none Sub-elements none Parent Elements The table below shows a list of RSS elements that this element can be a child of. <tr> <th>Name</td> <th>Tag</td> <th>0.90</td> <th>N 0.91 R1</td> <th>N 0.91 R3</td> <th>U 0.91</td> <th>0.92</td> <th>0.93</td> <th>0.94</td> <th>1.0</td> <th>2.0</td> </tr> <tr> <td>RSS Channel Element</td> <td><channel></td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> <td>?</td> </tr> <tr> <td>RSS Image Element</td> <td><image></td> <td>?</td> <t...
Theme changes in Firefox 2 - Archive of obsolete content
dth .safebrowsing-palm-paragraph .safebrowsing-palm-smalltext The following styles are used to display, in the URL bar, an indicator of whether or not the site is safe: #safebrowsing-urlbar-icon #safebrowsing-urlbar-icon[level="safe"] #safebrowsing-urlbar-icon[level="warn"] engineManager.css The following style needs to be implemented. This file is new in Firefox 2. #engineList treechildren::-moz-tree-image(engineName) Changes in global about.css This is a new file for Firefox 2. It skins the Firefox about box, and needs to provide at least the following styles: #aboutLogoContainer #aboutPageContainer #version The default theme also skins the following styles: body, html, img, ul, and ul > li. browser.css The following styles that were used in Firefox 1.5 are no long...
Theme changes in Firefox 3.5 - Archive of obsolete content
example. Supporting 3.5 Features Video/Audio player: controlBar has to be styled (chrome://global/skin/media/videocontrols.css) Shadow effect for disabled text using text-shadow. Greying menus of inactive windows: active windows get attribute 'active="true"'. To do this only for 3.5 use a CSS selector that is only supported in 3.5, like so: window:not([active="true"]) menubar>menu:nth-child(1n) { color:threedshadow } Private browsing: show private browsing state by coloring the URL bar, or by adding an icon to the toolbox/tabbrowserbar. See Private browsing for theme designers for details. Native hyperlink color: use -moz-nativehyperlinktext, to select the computer's native hyperlink color. All known changes For a list of all the known changes see: MozillaZine's Forum: Theme c...
Theme changes in Firefox 4 - Archive of obsolete content
For toolbars in the upper part of the window, the counter-reset property can be set using a CSS rule that is applied depending on the user preference in the toolbar customization palette. To do this, use a CSS rule that depends on the iconsize attribute on the #navigator-toolbox element. Note: A rule that depends on the user preference cannot be applied to the Add-on Bar because it is not a child of the #navigator-toolbox element. However, the theme can force large icons in the Add-on Bar regardless of the user preference. Examples The default Windows theme wants to force small icons on the navigation bar regardless of the user preference. Thus, it includes this rule in browser.css: #nav-bar { counter-reset: smallicons; } To use large icons for add-on buttons in the Bookmarks tool...
CSS - Archive of obsolete content
Archive › Web › CSS
t-colorsIn Mozilla applications like Firefox, the -moz-border-right-colors CSS property sets a list of colors for the right border.-moz-border-top-colorsIn Mozilla applications like Firefox, the -moz-border-top-colors CSS property sets a list of colors for the top border.-moz-stack-sizing-moz-stack-sizing is an extended CSS property. Normally, a <xul:stack> will change its size so that all of its child elements are completely visible. For example, moving a child of the stack far to the right will widen the stack so the child remains visible.-moz-text-blinkThe -moz-text-blink non-standard Mozilla CSS extension specifies the blink mode.-moz-window-shadowThe -moz-window-shadow CSS property specifies whether a window will have a shadow. It only works on Mac OS X.-ms-acceleratorThe -ms-accelerator C...
Descendants and Filters - Archive of obsolete content
Instead, it may be nested several levels down. You can access nodes at any depth using the .. operator, or by using the descendants property. For instance var element = <pets> <dogs> <fido color="red"/> <spike color="blue"/> </dogs> </pets>; element..fido.@color = "green"; element..spike.@color = "purple"; changes the colors of both of our pet dogs. The same rules that apply to the . operator apply to the .. operator. ...
Namespaces - Archive of obsolete content
ects by placing the statement: default xml namespace = "http://www.w3.org/1999/xhtml"; within the same scope as your E4X. You can also change namespaces at any time, by repeating the statement. default xml namespace = "http://www.w3.org/1999/xhtml"; var a = <p>Some text</p>; default xml namespace = "http://www.mozilla.org/keymaster/gat...re.is.only.xul"; var b = <label>More text</label>; a.appendChild(b); gives <p xmlns="http://www.w3.org/1999/xhtml"> Some text <label xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul">More text</label> </p> name() Using name() on an XML object returns a QName object (Qualified Name). QName is a global constructor available in JavaScript implementations supporting E4X. QName objects have two properties of particular relevance. The localName pr...
E4X Tutorial - Archive of obsolete content
lt for content in Firefox 16, disabled by default for chrome in Firefox 17, and removed in Firefox 18. ...
Object.prototype.__noSuchMethod__ - Archive of obsolete content
n below. // Example base class 1 function NamedThing(name) { this.name = name; } NamedThing.prototype = { getName: function() { return this.name; }, setName: function(newName) { this.name = newName; } } // Example base class 2 function AgedThing(age) { this.age = age; } AgedThing.prototype = { getAge: function() { return this.age; }, setAge: function(age) { this.age = age; } } // Child class. inherits from NamedThing and AgedThing // as well as defining address function Person(name, age, address){ addParent(this, NamedThing.prototype); NamedThing.call(this, name); addParent(this, AgedThing.prototype); AgedThing.call(this, age); this.address = address; } Person.prototype = { getAddr: function() { return this.address; }, setAddr: function(addr) { this.address = add...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
more comments ... </comments> Now that we've created this simple XML feed, we can now also consume it using the code from Listing 11. Listing 11 - Consuming the XML feed <script runat="server"> v...
Writing JavaScript for XHTML - Archive of obsolete content
s you keep the namespace problem in focus (e.g., there is a document.createElementNS method). Of course, you can still use strings like in document.write(), but it takes a little more effort. For example: var string = '<div xmlns="http://www.w3.org/999/xhtml"><h1>Hello World!</h1></div>'; var parser = new DOMParser(); var documentFragment = parser.parseFromString(string, "text/xml"); body.appendChild(documentFragment); // assuming 'body' is the body element But be aware that if your string is not well-formed XML (e.g., you have an & where it should not be), then this method will crash, leaving you with a parser error. Problem: I want to remain forward compatible! Given the direction away from formatting attributes and the possibility of XHTML becoming eventually more prominent (or at leas...
XForms Repeat Element - Archive of obsolete content
When using XForms within host languages like XHTML, it is often necessary to create repeating structures within constructs such as html:table. Thus, one might wish to use element repeat within a table to create the rows of a table, where each row of the table binds to a distinct member of a homogeneous collection. Since html:table doesn't (and probably never will) allow xforms:repeat elements as children, another syntax is needed. To accommodate this, XForms 1.0 defines an alternative syntax that is functionally equivalent to the repeat element, using the following attributes: repeat-model repeat-bind repeat-nodeset repeat-startindex repeat-number Additionally, when using XForms Action setindex, its repeat attribute (which contains an IDREF) can point to any element carrying these repeat att...
XForms Upload Element - Archive of obsolete content
t a file (see the spec) from the file system. A filter can be specified to limit the types of files that the user can select from. Visually, the upload control is shown as a file picker dialog that hides disallowed (filtered) file types. The XForms author can set the filter by using the mediatype attribute directly on the upload element or by placing a mediatype element (see the spec) as a direct child of the upload element. Attributes UI Common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special mediatype - supported. incremental - isn't supported. Type restrictions The upload element can be bound to a node of type xsd:anyURI, xsd:base64Binary or xsd:hexBinary or any type derived from one of the...
Using XForms and PHP - Archive of obsolete content
...
RDF in Mozilla FAQ - Archive of obsolete content
// Use the component manager to get the bookmarks service var bookmarks = Components. classes["@mozilla.org/rdf/datasource;1?name=bookmarks"]. getService(Components.interfaces.nsIRDFDataSource); // Now do something interesting with it... if (bookmarks.HasAssertion( RDF.GetResource("http://home.netscape.com/NC-rdf#BookmarksRoot"), RDF.GetResource("http://home.netscape.com/NC-rdf#child"), RDF.GetResource("http://home.netscape.com/NC-rdf#PersonalToolbarFolder"), true) { // ... } Alternatively, some datasources have "special" RDF-friendly ContractIDs that make it easy to instantiate the datasource using either the nsIRDFSerivce's GetDataSource() method or the datasources attribute on a XUL template. These ContractIDs are of the form @mozilla.org/rdf/datasource;1?na...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
ints to a location that houses the CAB file containing the ActiveX control. In this context, the codebase attribute is used as an obtainment mechanism -- that is to say, a way to obtain a control if it isn't present. If the Flash ActiveX control is not installed, IE will then go to the URL referenced by the codebase attribute and retrieve the ActiveX control. Additional param elements (which are "children" of the above object element) specify configuration parameters for the Flash plugin. For instance, the param name="movie" tells the Flash plugin the location of the SWF file to start playing. With the release of Netscape 7.1, this kind of ActiveX use of the object element is supported for use with the Microsoft(R) Windows Media Player. Only the Windows Media Player is supported as an ActiveX ...
Common causes of memory leaks in extensions - Extensions
u put a reference to anything within this compartment into a long-lived window object (such as browser.xul), JavaScript module or XPCOM component, the bootstrap.js compartment will become a zombie. For example, the following code snippets -- part of a bootstrap.js -- will leak: function leakref() {} function modifyDocument(document) { var a = document.createElement("a"); document.body.appendChild(a); // The new DOM node holding a reference to leakref will prevent // that function object from being garbage collected and hence // will leak the whole bootstrap compartment. a.someProperty = leakref; } function modifyDocument2(document) { // The "body" DOM node holding a reference to leakref will prevent // that function object from being garbage collected and hence // will lea...
Building up a basic demo with PlayCanvas editor - Game development
e scene to make it look more interesting. Adding more shapes To make way for more shapes, move the box to the left to make some room for the next shape. You can do this by giving it an X position value of -2. Adding other shapes involves a very similar process to adding the box. Click on the Root folder in the hierarchy panel (to make sure that the new shape appears in the root, and not as a child of the Box) then Click on the big Add Entity (plus) button and select cylinder from the dropdown list -- it will add a new cylinder shape to the scene. Now follow the same steps as we did before when coloring the cube: Create a new material using the Add Asset (plus) button. Make sure the New Material in the Assets panel is selected, to bring up the entity inspector. Give the material a new...
Building up a basic demo with Three.js - Game development
will implement differently than the CSS one. Despite the variety of ways they achieve the goal, the experience will look the same for the user. Thanks to this approach, a fallback can be used, if a desired technology is not supported by the browser. var renderer = new THREE.WebGLRenderer({antialias:true}); renderer.setSize(WIDTH, HEIGHT); renderer.setClearColor(0xDDDDDD, 1); document.body.appendChild(renderer.domElement); We are creating a new WebGL renderer, setting its size to fit the whole available space on the screen, and appending the DOM structure to the page. You might have noticed the antialias parameter in the first line -- this renders the edges of shapes more smoothly. The setClearColor() method sets our background to a light gray colour, instead of the default black one. Add t...
GLSL Shaders - Game development
script> <script id="fragmentShader" type="x-shader/x-fragment"> void main() { gl_FragColor = vec4(0.0, 0.58, 0.86, 1.0); } </script> JavaScript var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var renderer = new THREE.WebGLRenderer({antialias:true}); renderer.setSize(WIDTH, HEIGHT); renderer.setClearColor(0xDDDDDD, 1); document.body.appendChild(renderer.domElement); var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(70, WIDTH/HEIGHT); camera.position.z = 50; scene.add(camera); var boxGeometry = new THREE.BoxGeometry(10, 10, 10); var shaderMaterial = new THREE.ShaderMaterial( { vertexShader: document.getElementById( 'vertexShader' ).textContent, fragmentShader: document.get...
Audio for Web games - Game development
.destination) if (offset == 0) { trackSource.start(); offset = audioCtx.currentTime; } else { trackSource.start(0, audioCtx.currentTime - offset); } return trackSource; } Finally, let's loop over our <li> elements, grab the correct file for each one and then allow playback by hiding the "loading" text and displaying the play button: trackEls.forEach((el, i) => { // get children const anchor = el.querySelector('a'); const loadText = el.querySelector('p'); const playButton = el.querySelector('button'); // load file loadFile(anchor.href).then((track) => { // set loading to false el.dataset.loading = 'false'; // hide loading text loadText.style.display = 'none'; // show button playButton.style.display = 'inline-block'; // allow ...
Win the game - Game development
at Gamedev-Phaser-Content-Kit/demos/lesson12.html. Implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. How to win? Add the following new code into your ballHitBrick() function: function ballHitBrick(ball, brick) { brick.kill(); score += 10; scoreText.setText('Points: '+score); var count_alive = 0; for (i = 0; i < bricks.children.length; i++) { if (bricks.children[i].alive == true) { count_alive++; } } if (count_alive == 0) { alert('You won the game, congratulations!'); location.reload(); } } We loop through the bricks in the group using bricks.children, checking for the aliveness of each with each brick's .alive() method. If there are no more bricks left alive, then we sho...
CSS Object Model (CSSOM) - MDN Web Docs Glossary: Definitions of Web-related terms
The CSSOM is very similar to the Document Object Model (DOM). Both of them are part of the critical rendering path which is a series of steps that must happen to properly render a website. The CSSOM, together with the DOM, to build the render tree, which is in turn used by the browser to layout and paint the web page. CSSOM API The CSS Object Model is also a set of APIs allowing the manipulation of CSS from JavaScript. ...
Empty element - MDN Web Docs Glossary: Definitions of Web-related terms
The HTML, SVG, and MathML specifications define very precisely what each element can contain. Many combinations have no semantic meaning, for example an <audio> element nested inside an <hr> element. In HTML, using a closing tag on an empty element is usually invalid. For example, <input type="text"></input> is invalid HTML. ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout Module may be applied. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
Flex Container - MDN Web Docs Glossary: Definitions of Web-related terms
A value of flex causes the element to become a block level flex container, and inline-flex an inline level flex container. These values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. ...
Flex Item - MDN Web Docs Glossary: Definitions of Web-related terms
Continuous runs of text inside flex containers will also become flex items. ...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
Additional row or column tracks will be created to create enough cells to hold all items. In the example we have created a three column track grid. ...
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
Using the value grid or inline-grid on an element turns it into a grid container using CSS Grid Layout, and any direct children of this element become grid items. When an element becomes a grid container it establishes a grid formatting context. The direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. Learn more Property reference grid-template-columns grid-template-rows grid-auto-columns grid-auto-rows grid grid-template Further reading CSS Grid Layout guide: Basic concepts of grid layout ...
Scope - MDN Web Docs Glossary: Definitions of Web-related terms
The current context of execution. The context in which values and expressions are "visible" or can be referenced. If a variable or other expression is not "in the current scope," then it is unavailable for use. Scopes can also be layered in a hierarchy, so that child scopes have access to parent scopes, but not vice versa. A function serves as a closure in JavaScript, and thus creates a scope, so that (for example) a variable defined exclusively within the function cannot be accessed from outside the function or within other functions. For instance, the following is invalid: function exampleFunction() { var x = "declared inside function"; // x can only be used in exampleFunction console.log("Inside function"); console.log(x); } console.log(x); // Causes error However, ...
CSS and JavaScript accessibility best practices - Learn web development
a link and insert it in the errorList. function createLink(testItem) { const listItem = document.createElement('li'); const anchor = document.createElement('a'); anchor.textContent = testItem.input.name + ' field is empty: fill in your ' + testItem.input.name + '.'; anchor.href = '#' + testItem.input.name; anchor.onclick = function() { testItem.input.focus(); }; listItem.appendChild(anchor); errorList.appendChild(listItem); } Each link serves a dual purpose -- it tells you what the error is, plus you can click on it/activate it to jump straight to the input element in question and correct your entry. Note: The focus() part of this example is a bit tricky. Chrome and Edge (and newer versions of IE) will focus the element when the link is clicked, without needing the oncl...
Advanced styling effects - Learn web development
No mix blend mode <div> </div> <div> </div> </article> <article> Multiply mix <div class="multiply-mix"> </div> <div> </div> </article> Here's the CSS we'll style this with: article { width: 280px; height: 180px; margin: 10px; position: relative; display: inline-block; } div { width: 250px; height: 130px; padding: 10px; margin: 10px; } article div:first-child { position: absolute; top: 10px; left: 0; background: url(https://mdn.mozillademos.org/files/13090/colorful-heart.png) no-repeat center 20px; background-color: green; } article div:last-child { background-color: purple; position: absolute; bottom: -10px; right: 0; z-index: -1; } .multiply-mix { mix-blend-mode: multiply; } This gives us the following results: You can se...
Test your skills: Selectors - Learn web development
ting the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Selectors Four In this task try the following: Make any paragraph that directly follows an h2 element red. Remove the bullets and add a 1px grey bottom border only to list items that are a direct child of the ul with a class of list. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Selectors Five In this final task add CSS using attribute selectors to do the following: Target the <a> element with a title attribute and make the bord...
Sizing items in CSS - Learn web development
ents with lengths or percentages is something we need to do very carefully on the web. Using percentages In many ways, percentages act like length units, and as we discussed in the lesson on values and units, they can often be used interchangeably with lengths. When using a percentage you need to be aware what it is a percentage of. In the case of a box inside another container, if you give the child box a percentage width it will be a percentage of the width of the parent container. This is because percentages resolve against the size of the containing block. With no percentage applied our <div> would take up 100% of the available space, as it is a block level element. If we give it a percentage width, this becomes a percentage of the space it would normally fill. Percentage margins and ...
The box model - Learn web development
hat box are laid out. By default, the elements inside a box are laid out in normal flow, which means that they behave just like any other block and inline elements (as explained above). We can, however, change the inner display type by using display values like flex. If we set display: flex; on an element, the outer display type is block, but the inner display type is changed to flex. Any direct children of this box will become flex items and will be laid out according to the rules set out in the Flexbox spec, which you'll learn about later on. Note: To read more about the values of display, and how boxes work in block and inline layout, take a look at the MDN guide to Block and Inline Layout. When you move on to learn about CSS Layout in more detail, you will encounter flex, and various o...
Test your skills: Flexbox - Learn web development
recreate the finished example: Additional questions: Can you now make the first item twice the size of the other items? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Three There are two elements in the HTML below, a div with a class of .parent which contains another div with a class of .child. Use Flexbox to center the child inside the parent. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Four In this final task arrange these items into rows as in the image. Try updating the live code below to recreate the f...
Grids - Learn web development
l look at the basic features of Grid Layout first and then explore how to create a simple grid system for your project. The following video provides a nice visual explanation of using CSS Grid: Defining a grid As a starting point, download and open the starting point file in your text editor and browser (you can also see it live here). You will see an example with a container, which has some child items. By default these display in normal flow so the boxes display one below the other. We will be working with this file for the first part of this lesson, making changes to see how grid behaves. To define a grid we use the grid value of the display property. As with Flexbox, this switches on Grid Layout, and all of the direct children of the container become grid items. Add this to the CSS in...
Legacy layout methods - Learn web development
cally appropriate like <article>s, <section>s, and <aside>, or whatever. Now for the CSS. First, of all, apply the following to your HTML to provide some basic setup: body { width: 90%; max-width: 900px; margin: 0 auto; } The body will be 90% of the viewport wide until it gets to 900px wide, in which case it will stay fixed at this width and center itself in the viewport. By default, its children (the <h1> and the two <div>s) will span 100% of the width of the body. If we want the two <div>s to be floated alongside one another, we need to set their widths to total 100% of the width of their parent element or smaller so they can fit alongside one another. Add the following to the bottom of your CSS: div:nth-of-type(1) { width: 48%; } div:nth-of-type(2) { width: 48%; } Here we've ...
Normal Flow - Learn web development
the two remains, and the smaller one disappears -- this is called margin collapsing, and we have met this before too. Let's look at a simple example that explains all of this: <h1>Basic document flow</h1> <p>I am a basic block level element. My adjacent block level elements sit on new lines below me.</p> <p>By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. Overfl...
Practical positioning examples - Learn web development
li a.active { background-color: #a60000; color: white; } Styling the panels The next job is to style our panels. Let's get going! First, of all, add the following rule to style the .panels <div> container. Here we simply set a fixed height to make sure the panels fit snugly inside 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. .info-box .panels { height: 352px; position: relative; clear: both; } Finally for this section, we will style the individual <article> elements that comprise our panels. The first rule we'll add will absolutely position the ...
Supporting older browsers - Learn web development
grid container, the multicol behaviour will not happen. Flexbox as a Fallback for Grid Flexbox has greater browser support than Grid due to being supported by IE10 and 11, although do check out the information later in this lesson explaining the rather patchy and confusing support for Flexbox in older browsers. If you make a flex container into a grid container, any flex property applied to the children will be ignored. For many layout tweaks in older browsers, you may find you can give a decent experience by using CSS in this way. We add a simpler layout based on older and well-supported techniques, then use the newer CSS to create the layout that over 90% of your audience will see. There are cases, however, when the fallback code will need to include something that the new browsers will a...
How CSS is structured - Learn web development
ted with CSS tutorial. If CSS is not applying to content as-expected, your selector may not match the way you think it should match. Each CSS rule starts with a selector--or a list of selectors--in order to tell the browser which element or elements the rules should apply to. All the examples below are valid selectors, or lists of selectors. h1 a:link .manythings #onething * .box p .box p:first-child h1, h2, .intro Try creating some CSS rules that use the selectors above. Add HTML to be styled by the selectors. If any of the syntax above is not familiar, try searching MDN. Note: You will learn more about selectors in the next module: CSS selectors. Specificity You may encounter scenarios where two selectors select the same HTML element. Consider the stylesheet below, with a p selector t...
Fundamental text and font styling - Learn web development
v> </div> const htmlInput = document.querySelector(".html-input"); const cssInput = document.querySelector(".css-input"); const reset = document.getElementById("reset"); let htmlCode = htmlInput.value; let cssCode = cssInput.value; const output = document.querySelector(".output"); const styleElem = document.createElement('style'); const headElem = document.querySelector('head'); headElem.appendChild(styleElem); function drawOutput() { output.innerHTML = htmlInput.value; styleElem.textContent = cssInput.value; } reset.addEventListener("click", function() { htmlInput.value = htmlCode; cssInput.value = cssCode; drawOutput(); }); htmlInput.addEventListener("input", drawOutput); cssInput.addEventListener("input", drawOutput); window.addEventListener("load", drawOutput); Test you...
How to build custom form controls - Learn web development
RIA attributes via JavaScript as the user updates their selected value. The role attribute The key attribute used by ARIA is the role attribute. The role attribute accepts a value that defines what an element is used for. Each role defines its own requirements and behaviors. In our example, we will use the listbox role. It's a "composite role", which means elements with that role expect to have children, each with a specific role (in this case, at least one child with the option role). It's also worth noting that ARIA defines roles that are applied by default to standard HTML markup. For example, the <table> element matches the role grid, and the <ul> element matches the role list. Because we use a <ul> element, we want to make sure the listbox role of our control will supersede the list rol...
Document and website structure - Learn web development
o note that you can break <article>s up into different <section>s, or <section>s up into different <article>s, depending on the context. <aside> contains content that is not directly related to the main content but can provide additional information indirectly related to it (glossary entries, author biography, related links, etc.). <header> represents a group of introductory content. If it is a child of <body> it defines the global header of a webpage, but if it's a child of an <article> or <section> it defines a specific header for that section (try not to confuse this with titles and headings). <nav> contains the main navigation functionality for the page. Secondary links, etc., would not go in the navigation. <footer> represents a group of end content for a page. Non-semantic wrappers ...
HTML table advanced features and accessibility - Learn web development
{ border-collapse: collapse; border: 4px solid rgb(200,200,200); letter-spacing: 1px; font-size: 0.8rem; } td, th { border: 2px solid rgb(190,190,190); padding: 10px 20px; } th { background-color: rgb(235,235,235); } td { text-align: center; } tr:nth-child(even) td { background-color: rgb(250,250,250); } tr:nth-child(odd) td { background-color: rgb(245,245,245); } caption { padding: 10px; } tbody { font-size: 90%; font-style: italic; } tfoot { font-weight: bold; } </style> </head> <body> <table> ...
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
n this article before we move on. HTML has a method of defining styling information for an entire column of data all in one place -- the <col> and <colgroup> elements. These exist because it can be a bit annoying and inefficient having to specify styling on columns -- you generally have to specify your styling information on every <td> or <th> in the column, or use a complex selector such as :nth-child(). Note: Styling columns like this is limited to a few properties: border, background, width, and visibility. To set other properties you'll have to either style every <td> or <th> in the column, or use a complex selector such as :nth-child(). Take the following simple example: <table> <tr> <th>Data 1</th> <th style="background-color: yellow">Data 2</th> </tr> <tr> <td>Calc...
General asynchronous programming concepts - Learn web development
The code runs in the order it appears in the source, and the later operation doesn't run till the earlier operation has finished running. Note: The previous exam...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
nimationFrame() method by taking our previous example and updating it, adding an event listener to start and stop the spinner when the mouse is clicked anywhere on the page. Some hints: A click event handler can be added to most elements, including the document <body>. It makes more sense to put it on the <body> element if you want to maximize the clickable area -- the event bubbles up to its child elements. You'll want to add a tracking variable to check whether the spinner is spinning or not, clearing the animation frame if it is, and calling it again if it isn't. Note: Try this yourself first; if you get really stuck, check out of our live example and source code. Throttling a requestAnimationFrame() animation One limitation of requestAnimationFrame() is that you can't choose your...
Introduction to events - Learn web development
t of the time. If you really want to register an event in the capturing phase instead, you can do so by registering your handler using addEventListener(), and setting the optional third property to true. Event delegation Bubbling also allows us to take advantage of event delegation -- this concept relies on the fact that if you want some code to run when you select any one of a large number of child elements, you can set the event listener on their parent and have events that happen on them bubble up to their parent rather than having to set the event listener on every child individually. Remember, bubbling involves checking the element the event is fired on for an event handler first, then moving up to the element's parent, etc. A good example is a series of list items -- if you want each ...
Drawing graphics - Learn web development
rds you, the viewer. The third vital ingredient is a renderer. This is an object that renders a given scene, as viewed through a given camera. We'll create one for now using the WebGLRenderer() constructor, but we'll not use it till later. Add the following lines next: const renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); The first line creates a new renderer, the second line sets the size at which the renderer will draw the camera's view, and the third line appends the <canvas> element created by the renderer to the document's <body>. Now anything the renderer draws will be displayed in our window. Next, we want to create the cube we'll display on the canvas. Add the following chunk...
Introduction to web APIs - Learn web development
Its context object is created by getting a reference to the <canvas> element you want to draw on, and then calling its HTMLCanvasElement.getContext() method: const canvas = document.querySelector('canvas');...
Inheritance in JavaScript - Learn web development
In addition, we present some advice on when and where you might use OOJS, and look at how classes are dealt with in modern ECMAScript syntax. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, familiarity with JavaScript basics (see First steps and Building blocks) and OOJS basics (see Introduction to objects). Objective: To understand how it is possible to implement inheritance in JavaScript. ...
Introducing JavaScript objects - Learn web development
another, and they work differently to inheritance mechanisms in classical object-oriented programming languages. In this article, we explore that difference, explain how prototype chains work, and look at how the prototype property can be used to add methods to existing constructors. Inheritance in JavaScript With most of the gory details of OOJS now explained, this article shows how to create "child" object classes (constructors) that inherit features from their "parent" classes. In addition, we present some advice on when and where you might use OOJS. Working with JSON data JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax, which is commonly used for representing and transmitting data on web sites (i.e. sen...
Aprender y obtener ayuda - Learn web development
e me 500 hours to learn what I need to know, and I have a year to do it, so if I assume 2 weeks' holiday I'll need to do work on this for 10 hours per week. I am free on evenings and weekends, so I'll plan my time around those." How much time you can spend on this of course depends on what your circumstances are. If you are at school, then you've got way more free time than if you have a job and children to provide for. It is still possible to achieve your goals, but you have to be realistic about how quickly you can do it. If you are doing a university or college course to learn web development, then most of this planning is done for you -- lucky you! When you have worked out a weekly schedule, then you should keep a record of what you manage to do each week in a simple spreadsheet or even ...
Componentizing our React app - Learn web development
into a <Todo /> component. JavaScript gives us an array method for transforming data into something else: Array.prototype.map(). Above the return statement of App(), make a new const called taskList and use map() to transform it. Let's start by turning our tasks array into something simple: the name of each task: const taskList = props.tasks.map(task => task.name); Let's try replacing all the children of the <ul> with taskList: <ul role="list" className="todo-list stack-large stack-exception" aria-labelledby="list-heading" > {taskList} </ul> This gets us some of the way towards showing all the components again, but we've got more work to do: the browser currently renders each task's name as unstructured text. We're missing our HTML structure -- the <li> and its checkboxes and butt...
Beginning our React todo list - Learn web development
argin: 0; margin-bottom: 1rem; } .label__lg { line-height: 1.01567; font-weight: 300; padding: 0.8rem; margin-bottom: 1rem; text-align: center; } .input__lg { padding: 2rem; border: 2px solid #000; } .input__lg:focus { border-color: #4d4d4d; box-shadow: inset 0 0 0 2px; } [class*="__lg"] { display: inline-block; width: 100%; font-size: 1.9rem; } [class*="__lg"]:not(:last-child) { margin-bottom: 1rem; } @media screen and (min-width: 620px) { [class*="__lg"] { font-size: 2.4rem; } } .filters { width: 100%; margin: unset auto; } /* Todo item styles */ .todo { display: flex; flex-direction: row; flex-wrap: wrap; } .todo > * { flex: 0 0 100%; } .todo-text { width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } .t...
Starting our Svelte Todo list app - Learn web development
argin: 0; margin-bottom: 1rem; } .label__lg { line-height: 1.01567; font-weight: 300; padding: 0.8rem; margin-bottom: 1rem; text-align: center; } .input__lg { padding: 2rem; border: 2px solid #000; } .input__lg:focus { border-color: #4d4d4d; box-shadow: inset 0 0 0 2px; } [class*="__lg"] { display: inline-block; width: 100%; font-size: 1.9rem; } [class*="__lg"]:not(:last-child) { margin-bottom: 1rem; } @media screen and (min-width: 620px) { [class*="__lg"] { font-size: 2.4rem; } } .filters { width: 100%; margin: unset auto; } /* Todo item styles */ .todo { display: flex; flex-direction: row; flex-wrap: wrap; } .todo > * { flex: 0 0 100%; } .todo-text { width: 100%; min-height: 4.4rem; padding: 0.4rem 0.8rem; border: 2px solid #565656; } .t...
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
s.map(t => t.id)) + 1 : 1 Everything works as expected -- we just extracted the last piece of markup to its own component. Now we need to find a way to give focus to the <h2> status label after a todo has been removed. So far we saw how to send information to a component via props, and how a component can communicate with its parent by emitting events or using two-way data binding. The child component could get a reference to the <h2> node using bind:this={dom_node} and expose it to the outside using two-way data binding. But doing so would break the component encapsulation; setting focus on it should be its own responsibility. So we need the TodosStatus component to expose a method that its parent can call to give focus to it. It's a very common scenario that a component needs to e...
Creating our first Vue component - Learn web development
s done prop to the checked attribute on the <input> element, so that it can serve as a record of whether the checkbox is checked or not. However, it's important that props serve as one-way data binding -- a component should never alter the value of its own props. There are a lot of reasons for this. In part, components editing props can make debugging a challenge. If a value is passed to multiple children, it could be hard to track where the changes to that value were coming from. In addition, changing props can cause components to re-render. So mutating props in a component would trigger the component to rerender, which may in-turn trigger the mutation again. To work around this, we can manage the done state using Vue's data property. The data property is where you can manage local state in a...
Adding a new todo form: Vue events, methods, and models - Learn web development
at each end. Passing data to parents with custom events We now are very close to being able to add new to-do items to our list. The next thing we need to be able to do is pass the newly-created to-do item to our App component. To do that, we can have our ToDoForm emit a custom event that passes the data, and have App listen for it. This works very similarly to native events on HTML elements: a child component can emit an event which can be listened to via v-on. In the onSubmit event of our ToDoForm, let's add a todo-added event. Custom events are emitted like this: this.$emit("event-name"). It's important to know that event handlers are case sensitive and cannot include spaces. Vue templates also get converted to lowercase, which means Vue templates cannot listen for events named with capit...
Rendering a list of Vue components - Learn web development
v-for directive to display them. Directives are applied to elements like other attributes. In case of v-for, you use a special syntax similar to a for...in loop in JavaScript -- v-for="item in items" -- where items is the array you want to iterate over, and item is a reference to the current element in the array. v-for attaches to the element you want to repeat, and renders that element and its children. In this case, we want to display an <li> element for every to-do item inside our ToDoItems array. Then we want to pass the data from each to-do item to a ToDoItem component. Key attribute Before we do that, there's one other piece of syntax to know about that is used with v-for, the key attribute. To help Vue optimize rendering the elements in the list, it tries to patch list elements so it...
Understanding client-side JavaScript frameworks - Learn web development
ue refs We are nearly done with Vue. The last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. We'll look at using Vue refs to handle this -- an advanced feature that allows you to have direct access to the underlying DOM nodes below the virtual DOM, or direct access from one component to the internal DOM structure of a child component. 9. Vue resources Now we'll round off our study of Vue by giving you a list of resources that you can use to go further in your learning, plus some other useful tips. Svelte tutorials Note: Svelte tutorials last tested in August 2020, with Svelte 3.24.1. If you need to check your code against our version, you can find a finished version of the sample Svelte app code as it should ...
Handling common JavaScript problems - Learn web development
function called loadScript(), which loads the polyfills into the page, then runs main() after the loading has finished. loadScript() looks like this: function loadScript(src, done) { const js = document.createElement('script'); js.src = src; js.onload = function() { done(); }; js.onerror = function() { done(new Error('Failed to load script ' + src)); }; document.head.appendChild(js); } This function creates a new <script> element, then sets its src attribute to the path we specified as the first argument ('polyfills.js' when we called it in the code above). When it has loaded, we run the function we specified as the second argument (main()). If an error occurs in the loading of the script, we still call the function, but with a custom error that we can retrieve to help...
Testopia
o provide continuing support for positional parameters, please be aware that some API calls may fail until you make this change. Also, future versions may remove this support completely. As always please backup your installation before attempting to install or upgrade. Testopia 2.3 This version supports Bugzilla 3.4. The main new features are: Support XML export and import of test plans and children Support CSV export of test cases and results. New reports: worst offender and case roll-up Set priorities on indidual case-runs New clone options Uses the latest Extjs 3.0 library Converts Testopia into a true Bugzilla extension Numerous bug fixes Integration Points Testopia integrates with Bugzilla products, components, versions, and milestones to allow a single management inte...
Creating a Language Pack
first need to go through the initial setup process. Pre-build steps In the .mozconfig, you want to have mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-firefox-build ac_add_options --disable-compile-environment ac_add_options --with-l10n-base=../l10n-central # path relative to MOZ_OBJDIR ac_add_options --enable-application=[browser or mail] The given path should have your localization directory as child (i.e., a subdirectory ab-CD where ab-CD is your locale code). You still need to specify which application you're localizing (e.g., for Firefox, that's browser, Thunderbird would be mail). Configure step You need to prepare the build directory, which is done with ./mach configure You only need to run this if the version number of Firefox changes. WINDOWS: Replace make with mozmake in the c...
HTTP logging
illa developer has told you to modify it. Click on Start Logging. Reproduce the bug (i.e. go to the web site that is broken for you and make the bug happen in the browser) Make a note of the value of "Current Log File". Click on Stop Logging. Go to the folder containing the specified log file, and gather all the log files. You will see several files that look like: log.txt-main.1806, log.txt-child.1954, log.txt-child.1970, etc. This is because Firefox now uses multiple processes, and each process gets its own log file. For many bugs, the "log.txt-main" file is the only thing you need to upload as a file attachment to your Bugzilla bug (this is assuming you're logging to help a mozilla developer). Other bugs may require all the logs to be uploaded--ask the developer if you're not sure. ...
The Firefox codebase: CSS Guidelines
cal-align: -2px; . The reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. Avoid setting styles in JavaScript. It's generally better to set a class and then specify the styles in CSS. classList is generally better than className. There's less chance of overwriting an existing class. Only use generic selectors such as :last-child, when it is what you mean semantically. If not, using a semantic class name is more descriptive and usually better. Boilerplate Make sure each file starts with the standard copyright header (see License Boilerplate). Before adding more CSS It is good practice to check if the CSS that is being written is needed, it can be the case that a common component has been already written could be reus...
Error codes returned by Mozilla APIs
tribute name. NS_ERROR_DOM_NO_DATA_ALLOWED_ERR (0x80530006) NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR (0x80530007) This error can occur when an attempt is made to modify an aspect of an object that cannot be changed. NS_ERROR_DOM_NOT_FOUND_ERR (0x80530008) A node was not found. For example, an attempt was made to use the element.insertBefore method to insert a node before one that is not a child. NS_ERROR_DOM_NOT_SUPPORTED_ERR (0x80530009) The operation is not supported. NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR (0x8053000A) NS_ERROR_DOM_INVALID_STATE_ERR (0x8053000B) An attempt was made to use an object which is no longer usable. NS_ERROR_DOM_SYNTAX_ERR (0x8053000C) An attribute value or property was set to an invalid value. NS_ERROR_DOM_INVALID_MODIFICATION_ERR (0x8053000D) An attem...
Limitations of frame scripts
face(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. If you want a chrome window: send a message from the content process using the message manager. The target property of the object passed into the message handler in the chrome process is the XUL <browser> receiving the message, and you can get the chrome window from that (Note: I'm not really sure ho...
Limitations of frame scripts
ace(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. If you want a chrome window: send a message from the content process using the message manager. The target property of the object passed into the message handler in the chrome process is the XUL <browser> receiving the message, and you can get the chrome window from that (I'm not sure how). nsIAbout...
Using the Browser API
Mozilla › Gecko › Chrome › API › Browser API › Using
n the repo as a Packaged App, then run it either on a simulator or a real device if you have one. In any case, you should at least download the repo and refer to the code as you read the sections below. The HTML An <iframe> is turned into a browser iframe by setting the mozbrowser attribute on it: <iframe src="http://mozilla.org" mozbrowser> In addition, the <iframe> can be loaded in its own child process -- separate to the page embedding this frame -- by including the remote attribute. <iframe src="http://hostname.tld" mozbrowser remote> Warning: This last attribute is necessary for security reasons if you plan to load content from an untrusted/unknown origin. If you don't use it, you run the risk of your application being compromised by a malicious web site. It is implied for WebExte...
mozbrowserselectionstatechanged
ll command can be issued (true) or not (false). canCut: A Boolean Indicating whether the cut command can be issued (true) or not (false). canCopy: A Boolean Indicating whether the copy command can be issued (true) or not (false). canPaste: A Boolean Indicating whether the paste command can be issued (true) or not (false). zoomFactor A number representing the current zoom factor in the child frame. This is unitless and represents a percentage increase/decrease, e.g. 1.1 is a 10% zoom in, and 0.9% is a 10% zoom out. isCollapsed A Boolean Indicating whether the current selection is collapsed (true) or not (false). visible A Boolean Indicating whether the current selection is visible (true) or not (false). states The current state of the selection. Example var browser = documen...
::-moz-tree-row
his feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The ::-moz-tree-row CSS pseudo-element is used to select rows and apply styles to tree rows. Associated elements treerow Syntax treechildren::-moz-tree-row { style properties } Style properties background border margin outline padding display -moz-appearance Examples treechildren::-moz-tree-row( foo bar ) { margin: 2%; } ...where... <treerow properties="foo">...</treerow> ...
Overview of Mozilla embedding APIs
e parent window // (ie. HWND on Win32). Replace 'nativeWindow' with a // reference to an appropriate native resource... rv = baseWindow->InitWindow(nativeWindow, // Native window nsnull, // Always nsnull. x, y, cx, cy); // Initial dimensions... if (NS_FAILED(rv)) return rv; // Create the child window for the WebBrowser. rv = baseWindow->Create(); if (NS_FAILED(rv)) return rv; // At this point webBrowser contains the new initialized instance // of the nsWebBrowser component... // Save webBrowser before it goes out of scope :-) Web Navigation The nsIWebNavigation interface is used to load URIs into the WebBrowser and provide access to session history capa...
Gecko's "Almost Standards" Mode
browsers based on the rendering engine found in Mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. ...
Creating a New Protocol
protocol declaration and generate headers, make in ipc/ipdl: make -C objdir/ipc/ipdl If there are any protocol-level errors, the IPDL compiler will print the relevant error messages and stop. To view the generated headers, look in objdir/ipc/ipdl/_ipdlheaders . Creating the Implementation The C++ implementation inherits from the abstract IPDL-generated classes PNewProtocolParent and PNewProtocolChild. It must implement abstract methods for receiving the appropriate messages on each side. The method signatures can be read from the generated PNewProtocolParent.h and PNewProtocolChild.h headers. Writing the Tests Protocols which are managed by PBrowser must be tested using the mochitest-chrome test framework with a <browser remote="true">. It is acceptable to use synchronous calls on JPW wrapper...
Glossary
Actor Bridge Channel Child Compressed Message Message Nullable Parent Protocol State ...
JavaScript Tips
NTERFACE; }, observe: function observe(aSubject, aTopic, aState) { } } When declaring XPCOM methods, try to use the same names for method parameters as are used in the interface definition. DOM elements DOM elements are just XPCOM objects with some of the interfaces precached. Don't call getAttribute to see if an attribute exists, call hasAttribute instead. Prefer to loop through childNodes rather than using first/lastChild with next/previousSibling. But prefer hasChildNodes() to childNodes.length > 0. Similarly prefer document.getElementsByTagName(aTag).item(0) != null to document.getElementsByTagName(aTag).length > 0. Prefer to use localName rather than tagName. XUL elements have many of the attributes mapped to properties. This was done for a reason, so use them! The prope...
SourceMap.jsm
nother instance of SourceNode, or an array where each member is one of those things. SourceNode.prototype.prepend(chunk) Prepend a chunk of generated JS to this source node. chunk: A string snippet of generated JS code, another instance of SourceNode, or an array where each member is one of those things. SourceNode.prototype.walk(fn) Walk over the tree of JS snippets in this node and its children. The walking function is called once for each snippet of JS and is passed that snippet and its original associated source's line/column location. fn: The traversal function. SourceNode.prototype.join(sep) Like Array.prototype.join except for SourceNodes. Inserts the separator between each of this source node's children. sep: The separator. SourceNode.prototype.replaceRight(pattern, ...
Localizing XLIFF files for iOS
e> tag, add the target-language attribute with your locale code as the value (e.g., target-language="xx-XX"). Be aware that there may be many <file> tags within one XLIFF document. Each <file> tag requires the target-language attribute with your locale code as the value (e.g., target-language="xx-XX"). Strings are located within <trans-unit> tags. Source English strings are contained in <source> child tags. 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 inside <target> child tags. Go through the full xliff page adding <target></target> below each <source> tag set to help you to identify strings that need to be translated. Do not delete the <source> tag sets. <trans-unit...
Mozilla Web Developer FAQ
age are marked with <td class="imgcell">, the required CSS rule is: .imgcell img, .imgcell a { display: block; } Longer explanation... Why are there still gaps even between text rows in tables when the layout engine is in the Standards mode or in the Almost Standards mode? In the Standards mode and in the Almost Standards mode Mozilla does not suppress the default margins of the first and last child element in table cells. Therefore, the default margins for paragraphs apply even with markup such as <td><p>foo</p></td>. Often the content of a cell in a table of tabular data does not constitute a paragraph. In that case, the easy solution is not to mark the contents of the cell as a paragraph. When the paragraph markup is called for but the default margins are unwanted, zero margins can be s...
Mozilla Web Services Security Model
s.xml. web-scripts-access.xml File Format The web-scripts-access.xml file is an XML document. Any errors in XML syntax, as well as many failures to follow the format, will cause the document to be ignored. The webScriptAccess element Its root element must be a webScriptAccess element in the http://www.mozilla.org/2002/soap/security namespace. This element must have either one delegate element child or any number (0 or more) of allow element children. All of these children elements must be in the same namespace as the parent, and must be empty. The delegate element A delegate element means that the browser should delegate the access control to a web-scripts-access.xml file in the directory that the service is in. For example, when accessing a Web Service at http://www.example.com/dir1/dir2...
Activity Monitor, Battery Status Menu and top
ting battery life problems.) Unfortunately "Energy Impact" is not a good measure for either users or software developers and it should be avoided. Activity Monitor can still be useful, however. Power-related measurements Activity Monitor has several tabs. They can all be customized to show any of the available measurements (by right-clicking on the column strip) but only the "Energy" tab groups child processes with parent processes, which is useful, so it's the best one to use. The following screenshot shows a customized "Energy" tab. The power-related columns are as follows. Energy Impact / Avg Energy Impact: See the separate section below. % CPU: CPU usage percentage. This can exceed 100% if multiple cores are being used. Idle wake Ups: In Mac OS 10.9 this measured "package id...
DMD
4% of once-reported (59.18% cumulative) Allocated at { #01: (no stack trace recorded due to --stacks=partial) } Reported at { #01: mozilla::dmd::DMDFuncs::Report(void const*) (/home/njn/moz/mi5/go64dmd/memory/replace/dmd/../../../../memory/replace/dmd/DMD.cpp:1646) #02: WindowsMallocSizeOf(void const*) (/home/njn/moz/mi5/dom/base/nsWindowMemoryReporter.cpp:189) #03: nsAttrAndChildArray::SizeOfExcludingThis(unsigned long (*)(void const*)) const (/home/njn/moz/mi5/dom/base/nsAttrAndChildArray.cpp:880) #04: mozilla::dom::FragmentOrElement::SizeOfExcludingThis(unsigned long (*)(void const*)) const (/home/njn/moz/mi5/dom/base/FragmentOrElement.cpp:2337) #05: nsINode::SizeOfIncludingThis(unsigned long (*)(void const*)) const (/home/njn/moz/mi5/go64dmd/parser/html/../../.
Refcount tracing and balancing
cess. Here are some tricks that make it easier. Check for leaks from smart pointers. If the leak comes from a smart pointer that is logged in the XPCOM_MEM_COMPTR_LOG, then find-comptr-leakers.pl will find the exact stack for you, and you don't have to look at trees. Ignore balanced trees. The make-tree.pl script accepts an option --ignore-balanced, which tells it not to bother printing out the children of a node whose balance factor is zero. This can help remove some of the clutter from an otherwise noisy tree. Ignore matched releases from smart pointers. If you've checked (see above) that the leak wasn't from a smart pointer, you can ignore the references that came from smart pointers (where we can use the pointer identity of the smart pointer to match the AddRef and the Release). This req...
about:memory
tes as their unit, but some are counts or percentages. Most measurements are presented within trees. For example: 585 (100.0%) -- preference-service +--585 (100.0%) -- referent +--493 (84.27%) -- strong +---92 (15.73%) -- weak +--92 (15.73%) -- alive +---0 (00.00%) -- dead Leaf nodes represent actual measurements; the value of each internal node is the sum of all its children. The use of trees allows measurements to be broken down into further categories, sub-categories, sub-sub-categories, etc., to arbitrary depth, as needed. All the measurements within a single tree are non-overlapping. Tree paths can be written using '/' as a separator. For example, preference/referent/weak/dead represents the path to the final leaf node in the example tree above. Sub-trees c...
Optimizing Applications For NSPR
for more info. There is no current workaround. You must write your program with this restriction in mind. PR_Interrupt is implemented except for <tt>PR_Connect()</tt>. IRIX The IRIX (classic) implementation has a known race condition in creating new threads. If the spawned thread establishes and exits before the parent thread is resumed, the parent will be left with an invalid pointer to the child. The problem has a solution that will be available soon. Digital Unix Digital Unix (aka, OSF1) requires the latest patches for the pthreads library. The changes are not evident until one tries to do thread suspension (<tt>PR_SuspendAll()</tt>) which is in preparation for garbage collection. Digital Unix is the main platform used for NSPR's prototype use of IPv6. There are some conflicts betw...
Process Forking in NSPR
ads within a single process (with no kernel threads) and on still others NSPR threads are user-level threads implemented on top of one or more kernel threads within single address space. NSPR does not override the fork function and so, when fork is called from the NSPR thread the results are different on the various platforms. All the threads present in the parent process may be replicated in the child process, only the calling thread may be replicated in the child process or only the calling kernel thread may be replicated. So, to be consistent across all platforms, it is suggested that when using fork in a NSPR thread; The exec function should be called in the child process. No NSPR functions should be called in the child process before the exec call is made. Original Document Informatio...
PR_CreatePipe
n returns one of these values: If the pipe is successfully created, PR_SUCCESS. If the pipe is not successfully created, PR_FAILURE. The error code can be retrieved via PR_GetError. Description PR_CreatePipe creates an anonymous pipe. Data written into the write end of the pipe can be read from the read end of the pipe. Pipes are useful for interprocess communication between a parent and a child process. When the pipe is no longer needed, both ends should be closed with calls to PR_Close. PR_CreatePipe is currently implemented on Unix, Linux, Mac OS X, and Win32 only. ...
PR_ProcessAttrSetInheritableFileMap
Prepare filemap for export to my children processes via PR_CreateProcess. Syntax #include <prshma.h> NSPR_API(PRStatus) PR_ProcessAttrSetInheritableFileMap( PRProcessAttr *attr, PRFileMap *fm, const char *shmname ); Parameters The function has the following parameters: attr Pointer to a PRProcessAttr structure used to pass data to PR_CreateProcess. fm Pointer to a PRFileMap structure to be passed to the child process. shmname Pointer to the name for the PRFileMap; used by child. Returns PRStatus Description PR_ProcessAttrSetInheritableFileMap connects the PRFileMap to PRProcessAttr with shmname. A subsequent call to PR_CreateProcess makes the PRFileMap importable by the child process. Note: This function is not implemented. ...
Process Management and Interprocess Communication
cesses. A process is an instance of a program. NSPR provides routines to create a new process and to wait for the termination of another process. NSPR does not provide an equivalent of the Unix fork(). The newly-created process executes its program from the beginning. A new process can inherit specified file descriptors from its parent, and the parent can redirect the standard I/O streams of the child process to specified file descriptors. Note that the functions described in this chapter are not available for MacOS or Win16 operating systems. Process Management Types and Constants The types defined for process management are: PRProcess PRProcessAttr Process Management Functions The process manipulation function fall into these categories: Setting the Attributes of a New Process ...
NSS 3.12.9 release notes
ub/mozilla.org/nspr/releases/v4.8.7/. New in NSS 3.12.9 Removed functions New SSL options New error codes Bugs Fixed The following bugs have been fixed in NSS 3.12.9. Bug 609068: Implement J-PAKE in FreeBL Bug 607058: crash [@ nss_cms_decoder_work_data] Bug 613394: November/December 2010 batch of NSS root CA changes Bug 610843: Need way to recover softoken in child after fork() Bug 617492: Add PK11_KeyGenWithTemplate function to pk11wrap (for Firefox Sync) Bug 610162: SHA-512 and SHA-384 hashes are incorrect for inputs of 512MB or larger when running under Windows and other 32-bit platforms (Fx 3.6.12 and 4.0b6) Bug 518551: Vfychain crashes in PKITS tests. Bug 536485: crash during ssl handshake in [@ intel_aes_decrypt_cbc_256] Bug 444367: NSS 3.12...
NSS_3.12.3_release_notes.html
chain even if revoked certificate. Bug 472749: Softoken permits AES keys of ANY LENGTH to be created Bug 473147: pk11mode tests fails on AIX when using shareable DBs. Bug 473357: ssltap incorrectly parses handshake messages that span record boundaries Bug 473365: Incompatible argument in pkix_validate.c. Bug 473505: softoken's C_Initialize and C_Finalize should succeed after a fork in a child process Bug 473944: Trust anchor is not trusted when requireFreshInfo flag is set. Bug 474532: Softoken cannot import certs with empty subjects and non-empty nicknames Bug 474777: Wrong deallocation when modifying CRL. Bug 476126: CERT_AsciiToName fails when AVAs in an RDN are separated by '+' Bug 477186: Infinite loop in CERT_GetCertChainFromCert Bug 477777: Selfserv crashed in clien...
Index
JS_ThrowStopIteration throws the appropriate StopIteration object for the function currently executing in cx. 490 JS_ToggleOptions JSAPI Reference, Obsolete, SpiderMonkey JS_ToggleOptions toggles context-wide options. It is equivalent to JS_SetOptions(cx, JS_GetOptions(cx) ^ options). 491 JS_TracerInit JSAPI Reference, Obsolete, SpiderMonkey JS_TraceChildren and other tracing APIs call the tracer callback for each traceable thing directly referenced by a particular object or runtime structure. It is the callback's responsibility to ensure the traversal of the full object graph, if desired, by eventually calling JS_TraceChildren on the passed thing. In this case the callback must be prepared to deal with cycles in the traversal graph. 492 ...
Functions
n't accessed in any other way (and it is not a generator-function). Such a function is guaranteed never to be called again after the enclosing function exits. An algol-like function may read the local variables and arguments of its immediate enclosing function from the stack, as if by magic. (JSContext::display caches the enclosing function's stack frame.) If that function is also algol-like, its child can read locals and variables from the next enclosing function, and so on. The compiler detects these cases and makes such functions null closures too. Flat closures. Suppose a function reads some variables from enclosing functions but is not algol-like. If the function does not assign to any closed-on vars/args, and it only reads closed-on local variables and arguments that never change value af...
Garbage collection
ory, i.e., tell the OS that certain pages are not being used and can be thrown away instead of paged to disk. gc/Root.h Defines classes for noting variables as GC roots. gc/Statistics.{h,cpp} Defines struct Statistics, which stores SpiderMonkey GC performance counters. Dictionary of terms black In common CS terminology, an object is black during the mark phase if it has been marked and its children are gray (have been queued for marking). An object is black after the mark phase if it has been marked. In SpiderMonkey, an object is black if its black mark bit is set. gray In common CS terminology, an object is gray during the mark phase if it has been queued for marking. In SpiderMonkey, an object is queued for marking if it is on the mark stack and is not black. Thus, the gray objects f...
JS::CompileOptions
(using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorReports. const char *filename() const Returns filename of the source code. const char *introducerFilename() const Returns filename of the file which introduces the file. const char16_t *sourceMapURL() const Returns the URL of the source map. Methods of JS::OwningCompileOptions Method Description ...
JSErrorReport
(using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorReports. linebuf const char * Text of the line that caused the error, minus the trailing newline character. tokenptr const char * Pointer to the error token in *linebuf. uclinebuf const char16_t * Unicode line buffer. This is the buffer that contains the original data. uctokenptr const char16_t * Poi...
JSRuntime
A context can run scripts. ...
JS_DumpHeap
TraceKind { // These trace kinds have a publicly exposed, although opaque, C++ type. // Note: The order here is determined by our Value packing. Other users // should sort alphabetically, for consistency. JSTRACE_OBJECT = 0x00, JSTRACE_STRING = 0x01, JSTRACE_SYMBOL = 0x02, JSTRACE_SCRIPT = 0x03, // Shape details are exposed through JS_TraceShapeCycleCollectorChildren. JSTRACE_SHAPE = 0x04, // The kind associated with a nullptr. JSTRACE_NULL = 0x06, // A kind that indicates the real kind should be looked up in the arena. JSTRACE_OUTOFLINE = 0x07, // The following kinds do not have an exposed C++ idiom. JSTRACE_BASE_SHAPE = 0x0F, JSTRACE_JITCODE = 0x1F, JSTRACE_LAZY_SCRIPT = 0x2F, JSTRACE_TYPE_OBJECT = 0x3F, JS...
JS_TracerInit
kind); Name Type Description trc JSTracer * The tracer visiting obj. thing void * A GC thing. kind uint32 One of the constants JSTRACE_OBJECT, JSTRACE_DOUBLE, JSTRACE_STRING; or a tag denoting an internal implementation-specific traversal kind. In the latter case, the only operations the callback may perform on thing are to call JS_TraceChildren or the DEBUG-only JS_PrintTraceThingInfo function. Description JS_TraceChildren and other tracing APIs call the tracer callback for each traceable thing directly referenced by a particular object or runtime structure. It is the callback's responsibility to ensure the traversal of the full object graph, if desired, by eventually calling JS_TraceChildren on the passed thing. In this case t...
Property attributes
e effects: The JavaScript engine does not set aside any memory for the property's value. The value is determined entirely by the getter. (The property has no stored value.) Assignment via the prototype chain is affected. Assigning to obj.x, where obj inherits a non-shared property from its prototype, creates a new own data property on obj; the prototype's .x is not shared with its children. If the inherited property is shared, the setter is called instead. If the property is also JSPROP_PERMANENT, then certain aspects of inheriting the property via the prototype chain are affected. Do not depend on this. See bug 575997. MXR ID Search for JSPROP_SHARED JSPROP_INDEX The property's id is represented internally as an integer, not a string. Obsolet...
JSAPI reference
ey 1.7 and earlier, the JSMarkOp hook was used instead. This has since been removed.) The tracing APIs are used by the garbage collector and JSTraceOp hooks. JSAPI applications may also use them to examine the object graph. ...
Shell global objects
HeapGrowth dynamicHeapGrowth dynamicMarkSlice allocationThreshold minEmptyChunkCount maxEmptyChunkCount compactingEnabled refreshFrameSlicesEnabled relazifyFunctions(...) Perform a GC and allow relazification of functions. Accepts the same arguments as gc(). getBuildConfiguration() Return an object describing some of the configuration options SpiderMonkey was built with. hasChild(parent, child) Return true if child is a child of parent, as determined by a call to TraceChildren setSavedStacksRNGState(seed) Set this compartment's SavedStacks' RNG state. getSavedFrameCount() Return the number of SavedFrame instances stored in this compartment's SavedStacks cache. saveStack([maxDepth [, compartment]]) Capture a stack. If maxDepth is given, capture at most maxDepth numb...
TPS Bookmark Lists
e: "Mozilla" }, ] }; This describes two bookmarks, one in the "menu" folder, and the other in the "folder1" subfolder of "menu". All bookmark paths must begin with one of the following: "menu": the normal bookmarks menu "toolbar": the bookmarks toolbar "tags": the tags folder "unfiled": the unfiled bookmarks folder "places": the places root folder ("menu", "toolbar", and "unfiled" are all children of this) Sub-folders are preceded with forward slashes, so "menu/folder1" denotes that "folder1" is a sub-folder of "menu". TPS does not support forward slashes as part of a folder name. Folder contents The contents for a folder are given as an array of objects, representing various bookmark types, described below. Bookmark objects Valid properties are: uri: the bookmark uri. Required. title...
A Web PKI x509 certificate primer
the key of the certificate. Its is directed mostly at what type of application the certificate was issued for. Examples of extended key usages are: serverAuth, clientAuth, and OCSPSigning. For end-entity certificates for PKI this extension is required to exist with the serverAuth bit asserted. Name constraints This is an extension exclusive for CA and indicates limits on the name space for its children. This is one of the most powerful extensions for businesses to have to help limit risk imposed by losing the private key of the CA. Authority information access This extension is primarily used to to describe the OCSP location for revocation checking. It is mandatory for certificates that chain up to a root in the Mozilla CA program. Self-signed certificates These are the steps to generate...
Gecko object attributes
Refer to aria-dropeffect for the list of possible values. grabbed true when the accessible object has been selected for dragging. haspopup true when the object displays a pop-up menu or window when invoked. Applied to: STATE_HASPOPUP Exposed in ARIA: aria-haspopup Note: this is only supported on ATK/AT-SPI. On MSAA, STATE_SYSTEM_HASPOPUP is used. sort if "ascending" or "descending", then child items within the container are currently sorted as indicated. Applied to: any container Exposed in ARIA: aria-sort Image related attributes src src attribute is placed on HTML image element. Applied to: ROLE_GRAPHIC for the <html:img/> element. Tree related attributes cycles "true" when the tree cell is a cycler, which means each click will cycle to the next option. In this case ac...
ROLE_MENUITEM
<< Gecko Roles Page Represents a menu item, which is an entry in a menu that a user can choose to carry out a command, select an option. Interfaces nsIAccessNode nsIAccessible Children No children. Mapped to AT-SPI: ROLE_MENU_ITEM ATK: ATK_ROLE_MENU_ITEM UA: NSAccessibilityMenuItemRole MSAA/ IA2: ROLE_SYSTEM_MENUITEM Used by ARIA: menuitem XUL: <menuitem/> ...
Implementation Details
...
Embedded Dialog API
p may wish to display as a dialog. Preferences are the canonical example. In this case, we must be sure to have an API which an embedding app can use to populate its own dialog, should it decide to eschew Mozilla's XUL version. These components need build no dialog posing interface. Guidelines A few restrictions on each component's UI interface... Most if not all of these dialogs will need to be child/dependent/transient windows, so each method responsible for actually opening a window must take an nsIDOMWindow *aParent parameter, and use that window as the dialog's parent, if non-null. To make our embedding API as consistent as possible, we'd like to impose a few coding conventions on these dialog-posing interfaces. Embedded dialog posing interface coding conventions The nsIDOMWindow *aPare...
Places utilities for JavaScript
Determines whether or not a ResultNode is a Bookmark separator. boolean nodeIsVisit(aNode) Determines whether or not a ResultNode is a visit item or not boolean nodeIsURI(aNode) Determines whether or not a ResultNode is a URL item or not boolean nodeIsQuery(aNode) Determines whether or not a ResultNode is a Query item or not boolean nodeIsReadOnly(aNode) Determines if a node is read only (children cannot be inserted, sometimes they cannot be removed depending on the circumstance) boolean nodeIsHost(aNode) Determines whether or not a ResultNode is a host folder or not boolean nodeIsContainer(aNode) Determines whether or not a ResultNode is a container item or not boolean nodeIsDynamicContainer(aNode) Determines whether or not a result-node is a dynamic-container item. The dynamic c...
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
strings. Will your array store non-refcounted objects and be a fixed size? If so, just use a native C++ array unless you need the enumeration options on nsTArray<T>. Example: an array of error message static const char* pointers. Are all the things you are storing interface pointers to instances of the same interface? If so, use nsCOMArray. Example: a content node's list of nsIContent children. Otherwise use nsIArray and make liberal use of QueryElementAt(). The point of nsCOMArray is that it's a template, and all the pointers in it must be pointers to the same type; it's nice to be able to use it because you get type-safety and don't have to spend time and code QIing (like you have to with nsIArray). Array Guidelines Here are a few simple rules which will keep your code clean ...
Creating the Component Code
ut various features of XPCOM. What We'll Be Working On The component we'll be working on in this book controls a special mode in your browser that prevents users from leaving the current domain or a set of safe domains. Once enabled, this "weblock" mode is password protected and persists until it is turned off by the password holder. It can be used to implement parental controlled browsing for children, or for targeted "kiosk browsing," where the content is restricted to a particular server. Web Lock User Interface shows the icon that is used to activate the web lock mode (leftmost in the status bar) once you have installed the WebLock component and the extra user interface. Web Lock User Interface Most of the actual work in the WebLock component is preparing the component itself, findin...
Observer Notifications
window-global-created WindowGlobalParent Called just after a WindowGlobalParent is initialized. A WindowGlobal actor has a lifetime matching that of an nsGlobalWindowInner. window-global-destroyed WindowGlobalParent Called just before a WindowGlobalParent is destroyed. By this point, the WGP being destroyed will have cleaned up most of its state, including its BrowsingContext children and JSWindowActors. Additionally, it will have been removed from any WindowContext tree it was part of. IO Notifications These topics can be used to watch the IO service for useful information. Topic Description offline-requested Called to query whether the application can go offline. The attempt to go offline can be canceled. Note: If your code chooses to ...
IAccessibleTable2
he IA2_EVENT_TABLE_MODEL_CHANGED event handler. This data is only guaranteed to be valid while the thread notifying the event continues. Once the handler has returned, the validity of the data depends on how the server manages the life cycle of its objects. Also, note that the server may have different life cycle management strategies for controls depending on whether or not a control manages its children. Lists, trees, and tables can have a large number of children and thus it's possible that the child objects for those controls would only be created as needed. Servers should document their life cycle strategy as this will be of interest to assistive technology or script engines accessing data out of process or from other threads. Servers only need to save the most recent row and column values...
IndexInParent
attribute long indexInParent; ...
TakeFocus
e. ...
nsIAccessibleEvent
isFromUserInput boolean Returns true if the event was caused by explicit user input, as opposed to purely originating from a timer or mouse movement. Constants Constant Gecko version Description 1.7 - 1.8.1 1.9 - 1.9.2 2.0 EVENT_SHOW 0x8002 0x0001 An object has been created. EVENT_HIDE 0x8003 0x0002 An object has been destroyed. EVENT_REORDER 0x8004 0x005C 0x0003 An object's children have changed. EVENT_ACTIVE_DECENDENT_CHANGED 0x0007 0x0004 The active descendant of a component has changed. The active descendant is used in objects with transient children. EVENT_FOCUS 0x8005 0x0008 0x0005 An object has received the keyboard focus. EVENT_STATE_CHANGE 0x800A 0x0009 0x0006 An object's state has changed. EVENT_LOCATION_CHANGE 0x800B 0x000A 0x0007 An object has changed...
nsIAccessibleRelation
le. RELATION_MEMBER_OF 0x05 This object is a member of a group of one or more objects. When there is more than one object in the group each member may have one and the same target, for example a grouping object. It is also possible that each member has multiple additional targets, for example one for every other member in the group. RELATION_NODE_CHILD_OF 0x06 This object is a child of a target object. RELATION_FLOWS_TO 0x07 Content flows from this object to a target object, that is has content that flows logically to another object in a sequential way, for example text flow. RELATION_FLOWS_FROM 0x08 Content flows to this object from a target object, that is has content that fl...
nsIAccessibleTreeCache
responding to the specified tree cell. invalidateCache() Invalidates the number of cached treeitem accessibles. void invalidateCache( in long aRow, in long aCount ); Parameters aRow Row index the invalidation starts from. aCount The number of treeitem accessibles to invalidate, the number sign specifies whether rows have been inserted (plus) or removed (minus) treeViewChanged() Invalidates children created for the previous tree view. void treeViewChanged(); Parameters None. treeViewInvalidated() Fires name change events for invalidated area of tree. void treeViewInvalidated( in long aStartRow, in long aEndRow, in long aStartCol, in long aEndCol ); Parameters aStartRow Row index invalidation starts from. aEndRow Row index invalidation ends, -1 means the last row index. aStartCo...
nsIBoxObject
cko 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. Read only. height long The height of the box, in CSS pixels. Read only. lastChild nsIDOMElement The last child of the box, in box-ordinal-group order. Read only. layoutManager nsIBoxLayoutManager Obsolete since Gecko 1.9 nextSibling nsIDOMElement The next sibling of the box, in box-ordinal-group order. Read only. pain...
nsIContentViewer
Missing Description aY Missing Description open() Attaches the content viewer to its DOM window and docshell. void open( in nsISupports aState, in nsISHEntry aSHEntry ); Parameters aState A state object that might be useful in attaching the DOM window. aSHEntry The history entry that the content viewer was stored in. The entry must have the docshells for all of the child documents stored in its child shell list. pageHide() void pageHide( in boolean isUnload ); Parameters isUnload Missing Description Exceptions thrown Missing Exception Missing Description permitUnload() Determins whether or not the document wants to prevent unloading by firing beforeunload on the document, and if it does, prompts the user. The result is returned. boolean pe...
nsIDOMHTMLSourceElement
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. It does not specify anything on its own. Attributes Attribute Type Description src DOMString The src attribute gives the address of the media resource. The value must be a valid URL. This attribute must be present. ...
nsIDOMMozNetworkStatsManager
n Gecko 18.0 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15) Implemented by: @mozilla.org/networkStatsManager;1. 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. If the object exists, you can use the Network Statistics service. You can test for the presence of the service as follows, for example: if ("mozNetworkStats" in navigator) { /* NetworkStats is available */ } else { alert("I'm sorry, but NetworkStats services are not supported."); } Method overview nsIDOMDOMRequest getSamples(in nsISupports netw...
nsIDOMNSHTMLDocument
e host name of the document's URL, but may be changed to the parent (but not top-level) domain in order to facilitate data exchange between documents from different sites in the same domain. embeds nsIDOMHTMLCollection Equivalent to getElementsByTagName("embed") Read only. fgColor DOMString Same as body.text head nsIDOMHTMLHeadElement Returns the first child element of the HTML element that is a HEAD element, or null if there is no HTML or HEAD element. Read only. height long The height of the body element. Read only. Obsolete since Gecko 6.0 linkColor DOMString Same as body.link plugins nsIDOMHTMLCollection Same as embeds for compatibility with Netscape 4.x Read only. vlinkColor DOMString ...
nsIDOMWindow2
Inherits from: nsIDOMWindow Last changed in Gecko 1.9 (Firefox 3) Because nsIDOMWindow is frozen, this interface was introduced in Firefox 3 (Gecko 1.9) to allow DOM windows to take on new features. DOM windows implement nsIDOMWindow2, which is a subclass of nsIDOMWindow. ...
nsIDOMWindowUtils
that have been performed. aModifiers Modifiers pressed. Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0 Using constants defined as MODIFIER_*. aIgnoreRootScrollFrame Optional Whether the event should ignore viewport bounds during dispatch. sendMouseEventToWindow() The same as sendMouseEvent() but ensures that the event is dispatched to this DOM window or one of its children. void sendMouseEventToWindow( in AString aType, in float aX, in float aY, in long aButton, in long aClickCount, in long aModifiers, in boolean aIgnoreRootScrollFrame Optional ); Parameters aType aX aY aButton aClickCount aModifiers Modifiers pressed. Using constants defined in nsIDOMNSEvent. Obsolete since Gecko 15.0 Using constants defined as MODIFIE...
nsIDroppedLinkHandler
); Methods canDropLink() Determines if a link being dragged can be dropped. boolean canDropLink( in nsIDOMDragEvent aEvent, in PRBool aAllowSameDocument ); Parameters aEvent A dragenter or dragover event. aAllowSameDocument If false, drops are only allowed if the document of the source of the drag is different from the destination. This check includes any parent, sibling and child frames in the same content tree. If true, the source is not checked. Return value true if the link being dragged can be dropped. Exceptions thrown Missing Exception Missing Description dropLink() Given a drop event, determines the link being dragged. If a uri is returned the caller can, for instance, load it. If null is returned, there is no valid link to be dropped. AString dropLink(...
nsIFileView
x="1" id="ftree"> <treecols> <-- The default Column type is size unless an appropriate id is passed, nsIFileView relies on the treecols section --> <treecol id="FilenameColumn" label="Name" flex="1" primary="true"/> <treecol id="LastModifiedColumn" label="Date" flex="1"/> <treecol id="Size" label="Size" flex="1"/> </treecols> <treechildren/> </tree> <script> var DIR="/home/"; //The directory to be opened var ftree = document.getElementById("ftree"); //The XUL tree element var lfile = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); lfile.initWithPath(DIR); // Open the directory var fview = Components.classes["@mozilla.org/filepicker/fileview;1"] ...
nsIMemoryReporter
to be displayed in about:memory. As of Gecko 6.0, the path should start with "explicit/" if the memory report accounts for all memory reported under sub-paths. Read only. process ACString The name of the process containing this reporter. Each reporter starts with an empty string for this value, indicating that it applies to the current process; this is true even for reporters in a child process. When a reporter from a child process is copied into the main process, the copy's process field is set appropriately. Read only. units PRInt32 The units used by the amount attribute; this will be one of the Unit type constants. Read only. Constants Memory reporter kind constants These allocation kind constants describe the types of memory allocation described by mem...
nsIMessageSender
To send messages to multiple "other sides", you would use nsIMessageBroadcaster. See Message Manager interfaces for more details on the distinction between message senders and message broadcasters. ...
nsIMessageWakeupService
ed. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Note: This service was introduced in Gecko 5.0 on Firefox for Android, but was not provided on desktop until Gecko 13.0 (Firefox 13). There is no IDL for this interface. The parentprocessmessagemanager is used for this, so messages send from childprocessmessagemanagers will be heard. Requesting wakeups To request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. The easiest way to do this is to add the appropriate entry to the chrome manifest that registers your component (see category in "Chrome registration"). To indicate a wakeup request in a manifest file, add a line that looks ...
nsIMsgDBHdr
s whether or not the message is read. isFlagged boolean Readonly: Indicates whether or not the message is starred in the UI. isKilled boolean Readonly: Indicates whether or not this message belongs to a subthread that has been ignored in the UI. If you want to know whether the message is the root of an ignored subthread then you should check for the Ignored flag. Any children of the ignored message will be marked as read when added to the database. priority nsMsgPriorityValue Indicates the priority of this message. flags unsigned long Indicates the flags of the message. See nsMsgMessageFlags for a list of what may or may not be set on this message. Note that the elided flag should not be set on messages, as it is a flag strictly dealin...
nsISessionStore
f the tab node storing the data. If you you are working in a browser.xul overlay and want the currently selected tab, it's as simple as gBrowser.selectedTab. If you just hold a reference to some content document in the overlay's chrome window, here is how you find its corresponding tab: function tabFromDoc(doc) { var no = gBrowser.getBrowserIndexForDocument(doc); return gBrowser.tabContainer.childNodes[no]; } // example use: Cc['@mozilla.org/browser/sessionstore;1'] .getService(Ci.nsISessionStore) .setTabValue(tabFromDoc(myContentDoc), 'myKey', 'myValue'); See also The Session store API article. nsISessionStartup JSON ...
nsISyncMessageSender
See Message Manager interfaces for more details on the distinction between message senders and message broadcasters. ...
nsITelemetry
id keyedScalarAdd(in ACString aName, in AString aKey, in jsval aValue); void keyedScalarSet(in ACString aName, in AString aKey, in jsval aValue); void keyedScalarSetMaximum(in ACString aName, in AString aKey, in jsval aValue); jsval snapshotKeyedScalars(in uint32_t aDataset, [optional] in boolean aClear); void clearScalars(); test only void flushBatchedChildTelemetry(); void recordEvent(in ACString aCategory, in ACString aMethod, in ACString aObject, [optional] in jsval aValue, [optional] in jsval extra); void setEventRecordingEnabled(in ACString aCategory, in boolean aEnabled); jsval snapshotEvents(in uint32_t aDataset, [optional] in boolean aClear); void registerEvents(in ACString aCategory, in jsval aEventData);...
nsITreeContentView
integer row index if the row was found within the tree. Returns -1 if the item was not found. getItemAtIndex() Retrieve the content item associated with the specified index. nsIDOMElement getItemAtIndex( in long index ); Parameters index The row index for which to get the item Return value The nsIDOMElement item. Remarks The nsITreeContentView interface only applies to trees with DOM element children, and does not apply to trees with flags="dontbuildcontent". See also nsITreeView tree ...
nsIWebBrowserFind
oolean Whether to find backwards (towards the beginning of the document). Default is false (search forward). matchCase boolean Whether to match case (case sensitive) when searching. Default is false. searchFrames boolean Whether to search through all frames in the content area. Default is true. Note: That you can control whether the search propagates into child or parent frames explicitly using nsIWebBrowserFindInFrames, but if one, but not both, of searchSubframes and searchParentFrames are set, this returns false. searchString wstring The string to search for. This must be non-empty to search. wrapFind boolean Whether the search wraps around to the start (or end) of the document if no match was found between the current p...
nsIWebContentHandlerRegistrar
l).host; // this section here is long and daunting, but its just finding a suitable contentWindow var DOMWindows = Services.wm.getEnumerator(null); while (DOMWindows.hasMoreElements()) { var aDOMWindow = DOMWindows.getNext(); if (aDOMWindow.gBrowser) { if (aDOMWindow.gBrowser.tabContainer) { //aDOMWindow has tabs var tabs = aDOMWindow.gBrowser.tabContainer.childNodes; for (var i = 0; i < tabs.length; i++) { console.log(tabs[i].linkedBrowser.contentWindow.location); if (tabs[i].linkedBrowser.contentWindow.location.hostname == myURIHostName) { htmlContentWindow = tabs[i].linkedBrowser.contentWindow; break; //break for loop } } if (htm...
nsIWindowCreator
RUint32 chromeFlags); Methods createChromeWindow() Create a new window. Gecko will/may call this method, if made available to it, to create new windows. nsIWebBrowserChrome createChromeWindow( in nsIWebBrowserChrome parent, in PRUint32 chromeFlags ); Parameters parent The nsIWebBrowserChrome of the parent window, if any. null if no parent exists. The newly created window should be made a child/dependent window of the parent, if any (and if the concept applies to the underlying OS). chromeFlags Chrome features from nsIWebBrowserChrome. Return value An nsIWebBrowserChrome for the new window. See also nsIWindowWatcher for more details. ...
nsIXPConnect
[noscript,notxpcom] void noteJSContext( in JSContextPtr aJSContext, in nsCCTraversalCallbackRef aCb ); Parameters aJSContext The JSContext to note. aCb The cycle collection traversal callback. Return value Missing Description Exceptions thrown Missing Exception Missing Description releaseJSContext() void releaseJSContext( in JSContextPtr aJSContex...
nsIXULSortService
Content container, in nsIContent node, in boolean aNotify ); Parameters db sortStatePtr root trueParent container node aNotify sort() Sort the contents of the widget containing aNode using aSortKey as the comparison key, and aSortHints as how to sort. 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. aSortKey The value to be used as the comparison key. aSortHints One or more hints as to how to sort: ascending: sort the contents in ascending order descending: sort the contents in descending order comparecase: perform case sensitive comparisons integer: treat values as integers, non-integers are compared as strings twostate: do not allow the natural (unordered state) Se...
nsIXULTemplateQueryProcessor
point and the member is always a placeholder for the end points (the results). The reference point is important when generating output recursively, as the query will be the same for each iteration, however, the reference point will differ. For instance, when examining an XML source, an XML query processor might begin at the node referred by the reference variable and end at a list of that node's children. Some queries may not need the reference variable if the syntax or the form of the data implies the value. For instance, a datasource that holds a table that can only produce one set of results. The reference variable may be specified in a template by setting the "container" attribute on the <template> element to the variable to use. The member variable may be specified in a similar way using ...
Getting Started Guide
, but you're hanging onto it in a member variable (see, for example, Comparison 1, below). You don't need an owning reference when the object is passed in as a parameter, and you don't need to keep it any longer than the scope of this function; the object's lifetime is known to contain yours in some well defined way, e.g., in the nodes of a tree, parent nodes keep owning references to their children, children need not keep owning references to their parents. It turns out that reference counting by hand is hard for programmers to get right. It may sound simple, but in practice it's very easy to forget to Release at the appropriate moment. Or to AddRef too many or too few times. How does nsCOMPtr help? nsCOMPtr manages AddRef, Release, and other red-tape for you. An nsCOMPtr looks and a...
Using nsISimpleEnumerator
s.interfaces.nsIPropertyElement); s += property.key + ' = ' + property.value + ';\n'; } alert(s); Example using JavaScript 1.7 features // creates a generator iterating over enum's values function generatorFromSimpleEnumerator(enum, interface) { while (enum.hasMoreElements()) { yield enum.getNext().QueryInterface(interface); } } var b = document.getElementById("stringbundleset").firstChild var props = generatorFromEnumerator(b.strings, Components.interfaces.nsIPropertyElement); var s = ""; for (let property in props) { s += property.key + ' = ' + property.value + ';\n'; } alert(s); Links Code based on Using_nsIPasswordManager nsISimpleEnumerator XUL:Property:strings ...
XPCOM ownership guidelines
graph for any system should be acyclic. Anytime there is a cycle of ownership, there is a situation that isn't automatically handled by destructors. Special code must be provided and called to break the cycle before the participants can be individually released. You don't need to own it if it's lifetime is guaranteed to be longer than yours. As for instance, when it owns you. Parents own their children (and not the reverse). Though parents may not need to own their children. For instance, a tree may own all the nodes that are in it. All the nodes in the tree point to each other with non-owning pointers. In the simplest scheme, however, parents point to their children with owning-pointers, children point back to their parents with non-owning-pointers. Containers own the things they contain ...
XPIDL
uuid(12345678-fedc-ba98-7654-0123456789ab) This is the internal way this interface is accessed; it must be unique, and the uuid must be generated when creating the interface. After that, it doesn't need to be changed any more. For instructions on how to generate an UUID see Generating GUIDs. builtinclass JavaScript classes are forbidden from implementing this interface. All children must also be marked with this property. function The JavaScript implementation of this interface may be a function that is invoked on property calls instead of an object with the given property scriptable This interface is usable by JavaScript classes. Must inherit from a scriptable interface. Methods and attributes Interfaces declare a series of attributes and ...
Address Book examples
use searchResult as required. } } Note: This method doesn't work with remote address books (e.g. LDAP). Hence the additional !ab.isRemote check How do I add/edit/delete contacts? Note: Not all address books can be written to. Use the nsIAbCollection.readOnly attribute to determine the read-only status of an address book Adding Contacts Create a card and set its propertie...
Index
, as well as a search bar at the top. 70 Thunderbird extensions Add-ons, Extensions, thunderbird Categori 71 Adding items to the Folder Pane This tutorial examines how to add items to an existing Folder Pane view. The result is a javascript file that will add a "Numbers" container to the end of Thunderbird's "All Folders" mode. That container will have 3 child-items, the numbers 1, 2, and 3. Clicking on those items will display the number in the main viewing pane of Thunderbird. 72 Adding views to the Folder Pane Add-ons, Draft, Extensions, Guide, NeedsContent, thunderbird This is a stub page for a tutorial for Thunderbird 3. 73 An overview of Thunderbird components thunderbird The Thunderbird mail application ...
Message Interfaces
nsIMsgHdr nsIMsgHdr - this interface describes headers for all mail messages. It can be used to retrieve address, subject and related header information for a mail message. nsIMsgDBHdr nsIMsgDBHdr - this interface describes headers for mail messages. It is a child of nsIMsgHdr (see above). nsIMsgThread nsIMsgThread - this interface is used to interact with threads in Thunderbird. nsIMsgDBView nsIMsgDBView - The nsIMsgDBView interface handles the display of mail in the threadpane and preview pane of Thunderbird and other XPCOM based mail cients. ...
The libmime module
ed in 2002. by Richard H. Pizzarro <rhp@netscape.com> This module, libmime, implements a general-purpose MIME parser. One of the methods provided by this parser is the ability to emit an HTML representation of the data stream. The parser is object-oriented. There is a class for each MIME type, and each class is responsible for parsing itself, and/or handing the input data off to one of its child objects. The definition of these classes is somewhat idiosyncratic and consists of an internally defined object system, instead of C++. There is one header file and one source file for each class (for example, the MimeInlineText class is defined in "mimetext.h" and "mimetext.c".) Each header file follows the following boiler-plate form: typedefs These come first to avoid circular dependenci...
Building a Thunderbird extension 3: install manifest
available version. "5.0.*" indicates that the extension works with Thunderbird 5.0 and any subsequent 5.0.x releases. See Valid Application Versions for a list of the supported version numbers and formats. There are more optional elements that can be specified in install.rdf. These are described on the Install Manifests page. Note that elements can be specified in any order, as long as they are children of the <Description> node. << Previous Next >> ...
Building a Thunderbird extension 5: XUL
pplication/javascript" src="chrome://myfirstext/content/overlay.js"/><!-- A reference to your JavaScript file --> <statusbar id="status-bar"> <statusbarpanel id="my-panel" label="Date"/> </statusbar> </overlay> The <statusbar> widget named status-bar specifies the merge point within the application window that we want to attach to. When parsing our overlay file, the XUL engine will take all child elements of the <statusbar> tag and merge them with the original XUL document's <statusbar> tag. In the example above we have defined a new <statusbarpanel> item (that can be referred to as my-panel) which will create a new instance of this widget type and add it at the end of the statusbar. In Thunderbird it will appear as a label at the right side of Thunderbird's statusbar and display "Date". ...
Styling the Folder Pane
getNumUnread(true) > aFolder.getNumUnread(false) Indicates whether or not subfolders have unread messages. noSelect-{true, false} aFolder.noSelect Indicates whether or not the folder is selectable. imapShared-{true, false} aFolder.imapShared Indicates whether or not the folder is a shared folder. specialFolder-Smart -- Indicates that the folder is a child of a unified folder (previously known as smart folder) in the smart folders view. ...
Standard OS Libraries
ctypes.bool, Display_ptr, Window, Window.ptr, Window.ptr, ctypes.int.ptr, ctypes.int.ptr, ctypes.int.ptr, ctypes.int.ptr, ctypes.unsigned_int.ptr ); let XCloseDisplay = X11.declare("XCloseDisplay", ctypes.default_abi, ctypes.int, Display_ptr ); let display = XOpenDisplay(null); let rootWindow = XRootWindow(display, 0); let root = new Window(); let child = new Window(); let rootX = new ctypes.int(); let rootY = new ctypes.int(); let windowX = new ctypes.int(); let windowY = new ctypes.int(); let mask = new ctypes.unsigned_int(); XQueryPointer(display, rootWindow, root.address(), child.address(), rootX.address(), rootY.address(), windowX.address(), windowY.address(), mask.address() ); XCloseDisplay(display); Comp...
DOM Inspector internals - Firefox Developer Tools
ts to be added by the overlays. Using modular overlays also allows for common XUL to be shared across the various documents that make up the DOM Inspector's UI, although not all overlays are shared by multiple consumers. Single-consumer overlays exist solely for organization. In some cases overlays are overlaid by other overlays. If we imagine a tree structure obtained by connecting overlays as children to the files they overlay, while ignoring any overlays used for host integration, we can visualize the host-agnostic overlay tree for a given file. Here's the expanded, host-agnostic overlay tree for inspector.xul: chrome://inspector/content/inspector.xul chrome://inspector/content/inspectorOverlay.xul chrome://inspector/content/toolboxOverlay.xul chrome://inspector/content/p...
Debugger.Script - Firefox Developer Tools
ecode instruction offset of the current opcode. count: the number of times the current opcode got executed. If this script has no coverage, or if it is not instrumented, then this function will return null. To ensure that the debuggee is instrumented, the flag Debugger.collectCoverageInfo should be set to true. If the instance refers to WebAssembly code, throw a TypeError. getChildScripts() If the instance refers to a JSScript, return a new array whose elements are Debugger.Script objects for each function in this script. Only direct children are included; nested children can be reached by walking the tree. If the instance refers to WebAssembly code, throw a TypeError. setBreakpoint(offset,handler) If the instance refers to a JSScript, set a breakpoint at the byt...
Debugger.Source - Firefox Developer Tools
all, its source's introductionScript and introductionOffset accessors both return undefined. If a <script> element was dynamically inserted into a document, then these accessors refer to the call that actually caused the script to run--usually the call that made the element part of the document. Thus, they donot refer to the call that created the element; stored the source as the element's text child; made the element a child of some uninserted parent node that was later inserted; or the like. Although the main script of a worker thread is introduced by a call to Worker or SharedWorker, these accessors always return undefined on such script's sources. A worker's main script source and the call that created the worker are always in separate threads, but Debugger is an inherently single-threa...
DOM allocation example - Firefox Developer Tools
n"); // stop Spidermonkey from sharing instances toolbarButton[getRandomInt(0,5000)] = "foo"; return toolbarButton; } function createToolbar() { var toolbar = document.createElement("div"); // stop Spidermonkey from sharing instances toolbar[getRandomInt(0,5000)] = "foo"; for (var i = 0; i < toolbarButtonCount; i++) { var toolbarButton = createToolbarButton(); toolbar.appendChild(toolbarButton); } return toolbar; } function createToolbars() { var container = document.getElementById("container"); for (var i = 0; i < toolbarCount; i++) { var toolbar = createToolbar(); container.appendChild(toolbar); } } createToolbars(); A simple pseudocode representation of how this code operates looks like this: createToolbars() -> createToolbar() // called 200 t...
Work with animations - Firefox Developer Tools
ion inspector to see what's going on in this example. Right-click in the box and select "Inspect Element" Make sure the selected element is the <div class="channel"> Switch over to the "Animations" tab Play the animation Let's take a closer look at the contents of the animation inspector here: It shows a synchronized timeline for every animation applied to the selected element or its children. The timeline starts at the start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). Animation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is: blue if a transition was used to animate a property orange ...
Tips - Firefox Developer Tools
sides a node to see all event listeners attached to it. Press S with a node selected to see it in the page (same as right-click a node and click "Scroll Into View"). Right-click a node and click "Use in Console" to command line as tempN variable. When selecting elements: Shift + click to select an element but keep selecting (picker mode doesn't disengage). Use <-/-> to navigate to parents/children elements (if they're hard to select). In the rules view: Click the inspector icon () next to any selector to highlight all elements that match it. Click the inspector icon () next to the element{} rule to lock the highlighter on the current element. Right-click any property and select "Show MDN Docs" to view the MDN docs for this property. Click on the filter icon () next to an overrid...
View Source - Firefox Developer Tools
context-click while the mouse is over some MathML, you'll see a context menu item labeled "View MathML Source": click it to see the MathML source. Limitations of View Source There are limitations to what View Source does for you that you need to be aware of. Error reporter != validator View Source only reports parsing errors, not HTML validity errors. For example, putting a <div> element as a child of a <ul> element isn't a parse error, but it is not valid HTML. Therefore, this error will not be flagged in View Source. If you want to check that HTML is valid, you should use an HTML validator, such as the one offered by W3C. Not all parse errors are reported Even though all the reported errors are parse errors according to the HTML specification, not all parse errors are reported by View S...
AnalyserNode.getFloatFrequencyData() - Web APIs
nst dataArray = new Float32Array(bufferLength); //Set up audio node network audioSourceNode.connect(analyserNode); analyserNode.connect(audioCtx.destination); //Create 2D canvas const canvas = document.createElement('canvas'); canvas.style.position = 'absolute'; canvas.style.top = 0; canvas.style.left = 0; canvas.width = window.innerWidth; canvas.height = window.innerHeight; document.body.appendChild(canvas); const canvasCtx = canvas.getContext('2d'); canvasCtx.clearRect(0, 0, canvas.width, canvas.height); function draw() { //Schedule next redraw requestAnimationFrame(draw); //Get spectrum data analyserNode.getFloatFrequencyData(dataArray); //Draw black background canvasCtx.fillStyle = 'rgb(0, 0, 0)'; canvasCtx.fillRect(0, 0, canvas.width, canvas.height); //Draw spectrum ...
Animation.startTime - Web APIs
column */ function animateNewCatWithWAAPI() { // make a new cat var newCat = addCat(); // animate said cat with the WAAPI's "animate" function var newAnimationPlayer = newCat.animate(keyframes, timing); // set the animation's start time to be the same as the original .cat#withWAAPI newAnimationPlayer.startTime = catRunning.startTime; // Add the cat to the pile. WAAPICats.appendChild(newCat); } Reduced time precision To offer protection against timing attacks and fingerprinting, the precision of animation.startTime might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in Firefox 60 animation.startTime; // 23.4...
AudioNode.channelCountMode - Web APIs
In this case, channelCount is ignored and only up-mixing happens. ...
AuthenticatorResponse.clientDataJSON - Web APIs
The clientDataJSON property of the AuthenticatorResponse interface stores a JSON string in an ArrayBuffer, representing the client data that was passed to CredentialsContainer.create() or CredentialsContainer.get(). This property is only accessed on one of the child objects of AuthenticatorResponse, specifically AuthenticatorAttestationResponse or AuthenticatorAssertionResponse. Syntax var arrayBuffer = AuthenticatorAttestationResponse.clientDataJSON; var arrayBuffer = AuthenticatorAssertionResponse.clientDataJSON; Value An ArrayBuffer. Properties After the clientDataJSON object is converted from an ArrayBuffer to a JavaScript object, it will have the following properties: type A string which is either "webauthn.get" when an existing credential is retrieved or "webauthn.create" wh...
AuthenticatorResponse - Web APIs
Interfaces based on AuthenticatorResponse Below is a list of interfaces based on the AuthenticatorResponse interface. ...
BiquadFilterNode.getFrequencyResponse() - Web APIs
Working Draft ...
Blob - Web APIs
Web › API › Blob
course). function typedArrayToURL(typedArray, mimeType) { return URL.createObjectURL(new Blob([typedArray.buffer], {type: mimeType})) } const bytes = new Uint8Array(59); for(let i = 0; i < 59; i++) { bytes[i] = 32 + i; } const url = typedArrayToURL(bytes, 'text/plain'); const link = document.createElement('a'); link.href = url; link.innerText = 'Open the array URL'; document.body.appendChild(link); Result Click the link in the example to see the browser decode the object URL. Extracting data from a blob One way to read content from a Blob is to use a FileReader. The following code reads the content of a Blob as a typed array: const reader = new FileReader(); reader.addEventListener('loadend', () => { // reader.result contains the contents of blob as a typed array }); reader...
CSSConditionRule - Web APIs
Two objects derive from it : CSSMediaRule and CSSSupportsRule. Syntax The syntax is described using the WebIDL format. interface CSSConditionRule : CSSGroupingRule { attribute DOMString conditionText; } Properties The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all properties of these classes. It has one specific property: CSSConditionRule.conditionText Represents the text of the condition of the rule. ...
CSSGroupingRule - Web APIs
CSSPageRule Syntax The syntax is described using the WebIDL format. ...
CSSPseudoElement.element - Web APIs
en CSSPseudoElement.element and Element.pseudo(): const myElement = document.querySelector('q'); const cssPseudoElement = myElement.pseudo('::after'); const originatingElement = cssPseudoElement.element; console.log(myElement === originatingElement); // Outputs true console.log(myElement.parentElement === originatingElement); // Outputs false console.log(myElement.lastElementChild === cssPseudoElement); // Outputs false console.log(myElement.lastChild === cssPseudoElement); // Outputs false console.log(myElement.nextElementSibling === cssPseudoElement); // Outputs false console.log(myElement.nextSibling === cssPseudoElement); // Outputs false Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition o...
CSSStyleSheet.insertRule() - Web APIs
if (Array.isArray(rule[1][0])) { rule = rule[1]; j = 0; } for (var pl = rule.
CanvasRenderingContext2D.createPattern() - Web APIs
Living Standard ...
Using channel messaging - Web APIs
This saves the transferred port and register an onmessage handler that will be called each time a message is passed through our MessageChannel. When a message is received from the main page we ...
Console.dir() - Web APIs
Web › API › Console › dir
In other words, console.dir() is the way to see all the properties of a specified JavaScript object in console by which the developer can easily get the properties of the object. Note: This feature is available in Web Workers. ...
Console.dirxml() - Web APIs
Web › API › Console › dirxml
Displays an interactive tree of the descendant elements of the specified XML/HTML element. If it is not possible to display as an element the JavaScript Object view is shown instead. The output is presented as a hierarchical listing of expandable nodes that let you see the contents of child nodes. Syntax console.dirxml(object); Parameters object A JavaScript object whose properties should be output. Specifications Specification Status Comment Console APIThe definition of 'console.dirxml()' in that specification. Living Standard Initial definition ...
console - Web APIs
Web › API › Console
Log the number of times this line has been called with the given label. console.countReset() Resets the value of the counter with the given label. console.debug() Outputs a message to the console with the log level debug. console.dir() Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects. console.dirxml() Displays an XML/HTML Element representation of the specified object if possible or the JavaScript Object view if it is not possible. console.error() Outputs an error message. You may use string substitution and additional arguments with this method. console.exception() An alias for error(). console.group() Creates a new inline group, indenting all following o...
CustomElementRegistry.get() - Web APIs
or for the named custom element, or undefined if there is no custom element definition with that name. Examples customElements.define('my-paragraph', class extends HTMLElement { constructor() { super(); let template = document.getElementById('my-paragraph'); let templateContent = template.content; const shadowRoot = this.attachShadow({mode: 'open'}) .appendChild(templateContent.cloneNode(true)); } }) // Return a reference to the my-paragraph constructor let ctor = customElements.get('my-paragraph'); Specifications Specification Status Comment HTML Living StandardThe definition of 'customElements.get()' in that specification. Living Standard Initial definition. ...
CustomElementRegistry.whenDefined() - Web APIs
enu content is ready to display. <nav id="menu-container"> <div class="menu-placeholder">Loading...</div> <nav-menu> <menu-item>Item 1</menu-item> <menu-item>Item 2</menu-item> ... <menu-item>Item N</menu-item> </nav-menu> </nav> const container = document.getElementById('menu-container'); const placeholder = container.querySelector('.menu-placeholder'); // Fetch all the children of menu that are not yet defined. const undefinedElements = container.querySelectorAll(':not(:defined)'); const promises = [...undefinedElements].map( button => customElements.whenDefined(button.localName) ); // Wait for all the children to be upgraded, // then remove the placeholder. await Promise.all(promises); container.removeChild(placeholder); Specifications Specification ...
CustomElementRegistry - Web APIs
Specifications ...
DOMImplementation.createDocument() - Web APIs
root element name, of the document to be created. documentType Optional Is the DocumentType of the document to be created. It defaults to null. Example var doc = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null); var body = document.createElementNS('http://www.w3.org/1999/xhtml', 'body'); body.setAttribute('id', 'abc'); doc.documentElement.appendChild(body); alert(doc.getElementById('abc')); // [object HTMLBodyElement] Specifications Specification Status Comment DOMThe definition of 'DOMImplementation.createDocument' in that specification. Living Standard Modified the return type of createDocument() from Document to XMLDocument. The third argument of createDocument(), doctype, is now optional and default to...
DOMImplementation.createDocumentType() - Web APIs
Syntax var doctype = document.implementation.createDocumentType(qualifiedNameStr, publicId, systemId); Parameters qualifiedNameStr Is a DOMString containing the qualified name, like svg:svg. publicId Is a DOMString containing the PUBLIC identifier. ...
DOMImplementation.createHTMLDocument() - Web APIs
ument and insert it below.</p> <iframe id="theFrame" src="about:blank" /> </body> The JavaScript implementation of makeDocument() follows: function makeDocument() { let frame = document.getElementById("theFrame"); let doc = document.implementation.createHTMLDocument("New Document"); let p = doc.createElement("p"); p.innerHTML = "This is a new paragraph."; try { doc.body.appendChild(p); } catch(e) { console.log(e); } // Copy the new HTML document into the frame let destDocument = frame.contentDocument; let srcNode = doc.documentElement; let newNode = destDocument.importNode(srcNode, true); destDocument.replaceChild(newNode, destDocument.documentElement); } The code in lines 4-12 handle creating the new HTML document and inserting some content into it. ...
DataTransfer.clearData() - Web APIs
Living Standard HTML 5.1The ...
DataTransfer.dropEffect - Web APIs
Transfer.setData("text", ev.target.id); ev.dataTransfer.effectAllowed = "move"; } function drop_handler(ev) { console.log("drop: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed); ev.preventDefault(); // Get the id of the target and add the moved element to the target's DOM var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed); ev.preventDefault(); // Set the dropEffect to move ev.dataTransfer.dropEffect = "move" } Specifications Specification Status Comment HTML Living StandardThe definition of...
DataTransfer.effectAllowed - Web APIs
ev.dataTransfer.setData("text", ev.target.id); ev.dataTransfer.effectAllowed = "move"; } function drop_handler(ev) { console.log("drop: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed); ev.preventDefault(); // Get the id of the target and add the moved element to the target's DOM var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed); ev.preventDefault(); // Set the dropEffect to move ev.dataTransfer.dropEffect = "move" } </script> <body> <h1>Examples <code>DataTransfer</code>.{<code>dropEffect</code>, <code>effectAllowed</code>} prop...
DataTransfer.getData() - Web APIs
Living Standard HTML 5.1The definition of 'getData()' in that specification. Recommendation Initial definition ...
DataTransfer.items - Web APIs
types[" + i + "] = " + ev.dataTransfer.types[i]); } } // Print each item's "kind" and "type" if (ev.dataTransfer.items != null) { for (var i=0; i < ev.dataTransfer.items.length; i++) { console.log("... items[...
DataTransfer.setData() - Web APIs
/ Set the drag's format and data. ...
DataTransfer.setDragImage() - Web APIs
default drag image will be used. ...
DataTransfer.types - Web APIs
types[" + i + "] = " + ev.dataTransfer.types[i]); } } // Print each item's "kind" and "type" if (ev.dataTransfer.items != null) { for (var i=0; i < ev.dataTransfer.items.length; i++) { console.log("... items[...
DataTransferItem.getAsFile() - Web APIs
ows the use of the getAsFile() method in a drop event handler. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = event.dataTransfer.items; for (var i = 0; i < data.length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // This item is the target node data[i].getAsString(function (s){ ev.target.appendChild(document.getElementById(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // Drag data item is HTML console.log("... Drop: HTML"); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI console.log("... Drop: URI"); } else if ((data[i].kind == 'f...
DataTransferItem.getAsString() - Web APIs
tAsString() method as an inline function in a drop event handler. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.items; for (var i = 0; i < data.length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // This item is the target node data[i].getAsString(function (s){ ev.target.appendChild(document.getElementById(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // Drag data item is HTML console.log("... Drop: HTML"); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI console.log("... Drop: URI"); } else if ((data[i].kind == 'f...
DataTransferItem.kind - Web APIs
g. Example This example shows the use of the kind property. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = event.dataTransfer.items; for (var i = 0; i < data.length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // This item is the target node data[i].getAsString(function (s){ ev.target.appendChild(document.getElementById(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // Drag data item is HTML console.log("... Drop: HTML"); } else if ((data[i].kind == 'file') && (data[i].type.match('^image/'))) { // Drag data item is an image file var f = data[i].getAsFile(); console.log("... Drop: File ...
DataTransferItem.type - Web APIs
type. Example This example shows the use of the type property. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.items; for (var i = 0; i < data.length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // This item is the target node data[i].getAsString(function (s){ ev.target.appendChild(document.getElementById(s)); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/html'))) { // Drag data item is HTML console.log("... Drop: HTML"); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI console.log("... Drop: URI"); } else if ((data[i].kind == 'f...
DataTransferItemList.DataTransferItem() - Web APIs
Drop: HTML = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI data[i].getAsString(funct...
DataTransferItemList.add() - Web APIs
Drop: HTML = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI data[i].getAsString(funct...
DataTransferItemList.clear() - Web APIs
Drop: HTML = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI data[i].getAsString(funct...
DataTransferItemList.length - Web APIs
Drop: HTML = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI data[i].getAsString(funct...
DataTransferItemList.remove() - Web APIs
Drop: HTML = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // Drag data item is URI data[i].getAsString(funct...
DirectoryEntrySync - Web APIs
as on a standard track and it proves not a good idea. Do not use it anymore. About this document This document was last updated on March 2, 2012 and follows the W3C Specifications (Working Draft) drafted on April 19, 2011. This specification is pretty much abandoned, having failed to reach any substantial traction. Basic concepts If you want to create subdirectories, you have to create each child directory in sequence. If you try to create a directory using a full path that includes parent directories that do not exist yet, you get an error. So create the hierarchy by recursively adding a new path after creating the parent directory. Example The getFile() method returns a FileEntrySync, which represents a file in the file system. The following creates an empty file called seekrits.txt ...
Document.adoptNode() - Web APIs
, importedNode and externalNode are the same object. Note: importedNode's Node.parentNode is null, since it has not yet been inserted into the document tree! Example const iframe = document.querySelector('iframe'); const iframeImages = iframe.contentDocument.querySelectorAll('img'); const newParent = document.getElementById('images'); iframeImages.forEach(function(imgEl) { newParent.appendChild(document.adoptNode(imgEl)); }); Notes Before they can be inserted into the current document, nodes from external documents should either be: cloned using document.importNode(); or adopted using document.adoptNode(). Best Practice: Although Firefox doesn't currently enforce this rule, we encourage you to follow this rule for improved future compatibility. For more on the Node.ownerDocu...
Document.anchors - Web APIs
Web › API › Document › anchors
<head> <meta charset="UTF-8" /> <title>Test</title> <script> function init() { var toc = document.getElementById("toc"); var i, li, newAnchor; for (i = 0; i < document.anchors.length; i++) { li = document.createElement("li"); newAnchor = document.createElement('a'); newAnchor.href = "#" + document.anchors[i].name; newAnchor.innerHTML = document.anchors[i].text; li.appendChild(newAnchor); toc.appendChild(li); } } </script> </head> <body onload="init()"> <h1>Title</h1> <h2><a name="contents">Contents</a></h2> <ul id="toc"></ul> <h2><a name="plants">Plants</a></h2> <ol> <li>Apples</li> <li>Oranges</li> <li>Pears</li> </ol> <h2><a name="veggies">Veggies</a></h2> <ol> <li>Carrots</li> <li>Celery</li> <li>Beats</li> </ol> </body> </html> View on JSFi...
Document.body - Web APIs
Web › API › Document › body
body = aNewBodyElement; alert(document.body.id); // "newBodyElement" Notes document.body is the element that contains the content for the document. In documents with <body> contents, returns the <body> element, and in frameset documents, this returns the outermost <frameset> element. Though the body property is settable, setting a new body on a document will effectively remove all the current children of the existing <body> element. Specification Specification Status Comment HTML Living StandardThe definition of 'Document.body' in that specification. Living Standard HTML 5.1The definition of 'Document.body' in that specification. Recommendation HTML5The definition of 'Document.body' in that specification. Recommendation ...
Document.createCDATASection() - Web APIs
returns it. Syntax var CDATASectionNode = document.createCDATASection(data); CDATASectionNode is a CDATA Section node. data is a string containing the data to be added to the CDATA Section. Example var docu = new DOMParser().parseFromString('<xml></xml>', 'application/xml') var cdata = docu.createCDATASection('Some <CDATA> data & then some'); docu.getElementsByTagName('xml')[0].appendChild(cdata); alert(new XMLSerializer().serializeToString(docu)); // Displays: <xml><![CDATA[Some <CDATA> data & then some]]></xml> Notes This will only work with XML, not HTML documents (as HTML documents do not support CDATA sections); attempting it on an HTML document will throw NOT_SUPPORTED_ERR. Will throw a NS_ERROR_DOM_INVALID_CHARACTER_ERR exception if one tries to submit the closing CDA...
Document.createComment() - Web APIs
nt() creates a new comment node, and returns it. Syntax CommentNode = document.createComment(data); Parameters data A string containing the data to be added to the Comment. Example var docu = new DOMParser().parseFromString('<xml></xml>', 'application/xml'); var comment = docu.createComment('This is a not-so-secret comment in your document'); docu.getElementsByTagName('xml')[0].appendChild(comment); alert(new XMLSerializer().serializeToString(docu)); // Displays: <xml><!--This is a not-so-secret comment in your document--></xml> Specifications Specification Status Comment DOMThe definition of 'document.createComment' in that specification. Living Standard ...
Document.createElement() - Web APIs
In this case, our custom element extends the HTMLUListElement, which represents the ...
Document.createProcessingInstruction() - Web APIs
tain "xml", "XML", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>. The closing processing instruction sequence (?>) is part of the data. Example var doc = new DOMParser().parseFromString('<foo />', 'application/xml'); var pi = doc.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'); doc.insertBefore(pi, doc.firstChild); console.log(new XMLSerializer().serializeToString(doc)); // Displays: <?xml-stylesheet href="mycss.css" type="text/css"?><foo/> Specifications Specification Status Comment DOMThe definition of 'createProcessingInstruction()' in that specification. Living Standard No change DOM4The definition of 'createProcessingInstruction()' in that specification.
Document.createTextNode() - Web APIs
ed to escape HTML characters. Syntax var text = document.createTextNode(data); text is a Text node. data is a string containing the data to be put in the text node. ...
Document.createTreeWalker() - Web APIs
NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a TreeWalker with an Attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION 8 Shows CDATASection nodes. NodeFilter.SHOW_COMMENT 128 Shows Comment nodes. NodeFilter.SHOW_DOCUMENT 256 Shows Document nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT 1024 Shows DocumentFragment nodes. ...
Document.documentElement - Web APIs
Document.documentElement returns the Element that is the root element of the document (for example, the <html> element for HTML documents). Syntax const element = document.documentElement Example const rootElement = document.documentElement; const firstTier = rootElement.childNodes; // firstTier is a NodeList of the direct children of the root element // such as <head> and <body> for (const child of firstTier) { // do something with each direct child of the root element } Notes For any non-empty HTML document, documentElement will always be an <html> element. For any non-empty XML document, documentElement will always be whatever element is the root element of the document. Specifications Specification Status Comment DOMThe definition of 'Document.docum...
Document.getElementsByClassName() - Web APIs
When called on the document object, the complete document is searched, including the root node. You may also call getElementsByClassName() on any element; it will return only elements which are descendants of the specified root element with the given class name(s). Syntax var elements = document.getElementsByClassName(names); // or: var elements = rootElement.getElementsByClassName(names); elements is a live HTMLCollection of found elements. ...
Document.links - Web APIs
Web › API › Document › links
Document interface returns a collection of all <area> elements and <a> elements in a document with a value for the href attribute. Syntax nodeList = document.links Value An HTMLCollection. Example var links = document.links; for(var i = 0; i < links.length; i++) { var linkHref = document.createTextNode(links[i].href); var lineBreak = document.createElement("br"); document.body.appendChild(linkHref); document.body.appendChild(lineBreak); } Specifications Specification Status Comment HTML Living StandardThe definition of 'Document.links' in that specification. Living Standard Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'document.links' in that specification. Obsolete Initial definition ...
Document.onafterscriptexecute - Web APIs
Syntax document.onafterscriptexecute = funcRef; funcRef is a function reference, called when the event is fired. ...
Document.onbeforescriptexecute - Web APIs
Syntax document.onbeforescriptexecute = funcRef; funcRef is a function reference, called when the event is fired. The event's target attribute is set to the script Element that is about to be executed. ...
Document.querySelector() - Web APIs
The Document method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned. Note: The matching is done using depth-first pre-order traversal of the document's nodes starting with the first element in the document's markup and iterating through sequential nodes by order of the number of child nodes. Syntax element = document.querySelector(selectors); Parameters selectors A DOMString containing one or more selectors to match. This string must be a valid CSS selector string; if it isn't, a SYNTAX_ERR exception is thrown. See Locating DOM elements using selectors for more about selectors and how to manage them. Note: Characters that are not part of standard CSS syntax must be ...
Document.readyState - Web APIs
ss switch (document.readyState) { case "loading": // The document is still loading. break; case "interactive": // The document has finished loading. We can now access the DOM elements. // But sub-resources such as images, stylesheets and frames are still loading. var span = document.createElement("span"); span.textContent = "A <span> element."; document.body.appendChild(span); break; case "complete": // The page is fully loaded. console.log("The first CSS rule is: " + document.styleSheets[0].cssRules[0].cssText); break; } readystatechange as an alternative to DOMContentLoaded event // Alternative to DOMContentLoaded event document.onreadystatechange = function () { if (document.readyState === 'interactive') { initApplication(); } } ...
Document.registerElement() - Web APIs
t with properties prototype to base the custom element on, and extends, an existing tag to extend. Both of these are optional. Example Here is a very simple example: var Mytag = document.registerElement('my-tag'); Now the new tag is registered in the browser. The Mytag variable holds a constructor that you can use to create a my-tag element in the document as follows: document.body.appendChild(new Mytag()); This inserts an empty my-tag element that will be visible if you use the browser's developer tools. It will not be visible if you use the browser's view source capability. And it won't be visible in the browser unless you add some content to the tag. Here is one way to add content to the new tag: var mytag = document.getElementsByTagName("my-tag")[0]; mytag.textContent = "I am a m...
Document.styleSheetSets - Web APIs
. Example Given an <ul> (list) element with the ID "sheetList", you can populate it with the names of all the available style sheet sets with code like this: let list = document.getElementById('sheetList'); let sheets = document.styleSheetSets; list.innerHTML = ''; for (let i = 0; i < sheets.length; i++) { let item = document.createElement('li'); item.innerHTML = sheets[i]; list.appendChild(item); } Notes The list of available style sheet sets is constructed by enumerating all the style sheets available for the document, in the order in which they're listed in the document.styleSheets attribute, adding the title of each style sheet that has a title to the list. Duplicates are dropped from the list (using a case-sensitive comparison). ...
EffectTiming.duration - Web APIs
mber of milliseconds long a single beginning-to-end iteration of the animation should take. The default is "auto". This value must not be negative; otherwise, it can have any value (including positive infinity). Currently, a value of "auto" is the same as specifying 0.0. This is a forwards-compatiblity measure since in the future, "auto" will be expanded to take into account the duration of any child effects. Consider using "auto" rather than 0 if that makes sense. Exceptions TypeError The specified value is either a string other than "auto", a number less than zero, NaN, or some other type of object entirely. Examples In the Pool of Tears example, each tear is passed a random duration via its timing object: // Randomizer function var getRandomMsRange = function(min, max) { return...
Element.attachShadow() - Web APIs
ode.innerText || node.textContent return text.trim().split(/\s+/g).length; } var count = 'Words: ' + countWords(wcParent); // Create a shadow root var shadow = this.attachShadow({mode: 'open'}); // Create text node and add word count to it var text = document.createElement('span'); text.textContent = count; // Append it to the shadow root shadow.appendChild(text); // Update count when element content changes setInterval(function() { var count = 'Words: ' + countWords(wcParent); text.textContent = count; }, 200) } } // Define the new element customElements.define('word-count', WordCount, { extends: 'p' }); Specifications Specification Status Comment DOMThe definition of 'attachShadow()' in tha...
Element.classList - Web APIs
Web › API › Element › classList
urn this.classList; }, configurable: 0, set: function(val){this.className = val} }); } catch(e) { // Less performant fallback for older browsers (IE 6-8): window[" uCL"] = polyfillClassList; // the below code ensures polyfillClassList is applied to all current and future elements in the doc. document.documentElement.firstChild.appendChild(document.createElement('style')).styleSheet.cssText=( '_*{x-uCLp:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' + // IE6 '[class]{x-uCLp/**/:expression(!this.hasOwnProperty("classList")&&window[" uCL"](this))}' //IE7-8 ); } })(window); // 3. Patch in unsupported methods in DOMTokenList (function(DOMTokenListProto, testClass){...
Element.getBoundingClientRect() - Web APIs
rties below it. <div></div> div { width: 400px; height: 200px; padding: 20px; margin: 50px auto; background: purple; } let elem = document.querySelector('div'); let rect = elem.getBoundingClientRect(); for (var key in rect) { if(typeof rect[key] !== 'function') { let para = document.createElement('p'); para.textContent = `${ key } : ${ rect[key] }`; document.body.appendChild(para); } } Notice how the width/height are equal to the equal to its width/height + padding. Also note how the values of x/left, y/top, right, and bottom are equal to the absolute distance from the relevant edge of the viewport to that side of the element, in each case. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definiti...
Element.innerHTML - Web APIs
Web › API › Element › innerHTML
Use Node.textContent to get a raw copy of these text nodes' contents. To insert the HTML into the document rather than replace the contents of an element, use the method insertAdjacentHTML(). ...
Element.insertAdjacentElement() - Web APIs
t a given position relative to the element it is invoked upon. Syntax targetElement.insertAdjacentElement(position, element); Parameters position A DOMString representing the position relative to the targetElement; must match (case-insensitively) one of the following strings: 'beforebegin': Before the targetElement itself. 'afterbegin': Just inside the targetElement, before its first child. 'beforeend': Just inside the targetElement, after its last child. 'afterend': After the targetElement itself. element The element to be inserted into the tree. Return value The element that was inserted, or null, if the insertion failed. Exceptions Exception Explanation SyntaxError The position specified is not a recognised value. TypeError ...
Element.insertAdjacentHTML() - Web APIs
that element. This avoids the extra step of serialization, making it much faster than direct innerHTML manipulation. Syntax element.insertAdjacentHTML(position, text); Parameters position A DOMString representing the position relative to the element; must be one of the following strings: 'beforebegin': Before the element itself. 'afterbegin': Just inside the element, before its first child. 'beforeend': Just inside the element, after its last child. 'afterend': After the element itself. text The string to be parsed as HTML or XML and inserted into the tree. Visualization of position names <!-- beforebegin --> <p> <!-- afterbegin --> foo <!-- beforeend --> </p> <!-- afterend --> Note: The beforebegin and afterend positions work only if the node is in the DOM tre...
Element.insertAdjacentText() - Web APIs
f the Element interface inserts a given text node at a given position relative to the element it is invoked upon. Syntax element.insertAdjacentText(position, element); Parameters position A DOMString representing the position relative to the element; must be one of the following strings: 'beforebegin': Before the element itself. 'afterbegin': Just inside the element, before its first child. 'beforeend': Just inside the element, after its last child. 'afterend': After the element itself. element A DOMString representing the text to be inserted into the tree. Return value Void. Exceptions Exception Explanation SyntaxError The position specified is not a recognised value. Visualization of position names <!-- beforebegin --> <p> <!--...
Element: mouseover event - Web APIs
Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmouseover Examples The following example illustrates the difference between mouseover and mouseenter events. ...
Element.querySelector() - Web APIs
More examples See Document.querySelector() for additional examples of the proper format for the selectors. Specifications Specification Status Comment DOMThe definition of 'querySelector()' in that specification. Living Standard Selectors API Level 2The definition of...
Element.scrollHeight - Web APIs
borum. padding-bottom Left Top Right Bottom margin-top margin-bottom border-top border-bottom Problems and solutions Determine if an element has been totally scrolled The following equivalence returns true if an element is at the end of its scroll, false if it isn't. element.scrollHeight - element.scrollTop === element.clientHeight When the container does not scroll, but has overflowing children, these checks determine if the container can scroll: window.getComputedStyle(element).overflowY === 'visible' window.getComputedStyle(element).overflowY !== 'hidden' scrollHeight Demo Associated with the onscroll event, this equivalence can be useful to determine whether a user has read a text or not (see also the element.scrollTop and element.clientHeight properties). For example: HTML ...
Element.tabStop - Web APIs
Web › API › Element › tabStop
This property was proposed to add tab functionality for Custom Elements. While with the existing tabIndex property, it is required to specify an order for the element to become tabbable. ...
ElementTraversal - Web APIs
The ElementTraversal interface used to define methods that allowed access from one Node to another in the document tree. It proved useless, as very few types of Node were able to implement all its methods and properties. It has been split into two interfaces, containing the useful methods and properties for each kind of nodes: ChildNode ParentNode As it was a pure interface, with no object of this type, this change has no effect on the Web. Specifications Specification Status Comment DOMThe definition of 'ChildNode' in that specification. Living Standard Splitted the ElementTraversal interface in ParentNode and ChildNode Element Traversal SpecificationThe definition of 'ElementTraversal' in that specification. Obsolete Initial definition ...
Event.composed - Web APIs
Web › API › Event › composed
ots are attached with their modes set to open and closed respectively. ...
Event.composedPath() - Web APIs
ots are attached with their modes set to open and closed respectively. ...
Event.preventDefault() - Web APIs
You can use Event.cancelable to check if the event is cancelable. Calling preventDefault() for a non-cancelable event has no effect. Speci...
Event.timeStamp - Web APIs
Web › API › Event › timeStamp
DOMHighResTimeStamp accurate to 5 microseconds (0.005 ms). In older implementations, the value is a DOMTimeStamp, accurate to a millisecond. Example HTML <p> Focus this iframe and press any key to get the current timestamp for the keypress event. </p> <p>timeStamp: <span id="time">-</span></p> JavaScript function getTime(event) { var time = document.getElementById("time"); time.firstChild.nodeValue = event.timeStamp; } document.body.addEventListener("keypress", getTime); Result Reduced time precision To offer protection against timing attacks and fingerprinting, the precision of Event.timeStamp might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms...
Event - Web APIs
Web › API › Event
vent--particularly if separate, independent code modules attach them, each for its own independent purposes. (For example, a webpage with an advertising-module and statistics-module both monitoring video-watching.) When there are many nested elements, each with its own handler(s), event processing can become very complicated--especially where a parent element receives the very same event as its child elements because "spatially" they overlap so the event technically occurs in both, and the processing order of such events depends on the Event bubbling and capture settings of each handler triggered. Interfaces based on Event Below is a list of interfaces which are based on the main Event interface, with links to their respective documentation in the MDN API reference. Note that all event int...
EventSource() - Web APIs
ew connection. The possible entries are: withCredentials, defaulting to false, indicating if CORS should be set to include credentials. Examples var evtSource = new EventSource('sse.php'); var eventList = document.querySelector('ul'); evtSource.onmessage = function(e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); } Note: You can find a full example on GitHub -- see Simple SSE demo using PHP. Specifications Specification Status Comment HTML Living StandardThe definition of 'EventSource()' in that specification. Living Standard Initial definition ...
EventSource: message event - Web APIs
ic example, an EventSource is created to receive events from the server; a page with the name sse.php is responsible for generating the events. var evtSource = new EventSource('sse.php'); var eventList = document.querySelector('ul'); evtSource.addEventListener('message', (e) => { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); }); onmessage equivalent evtSource.onmessage = (e) => { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); }; Specifications Specification Status HTML Living StandardThe definition of 'message event' in that specification. Living Standard ...
EventSource.onmessage - Web APIs
ource interface is an EventHandler called when a message event is received, that is when a message is coming from the source. Event objects of onmessage event handers are of type MessageEvent. Syntax eventSource.onmessage = function Examples evtSource.onmessage = function(e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); } Note: You can find a full example on GitHub -- see Simple SSE demo using PHP. Specifications Specification Status Comment HTML Living StandardThe definition of 'onmessage' in that specification. Living Standard Initial definition ...
EventSource - Web APIs
basic example, an EventSource is created to receive unnamed events from the server; a page with the name sse.php is responsible for generating the events. var evtSource = new EventSource('sse.php'); var eventList = document.querySelector('ul'); evtSource.onmessage = function(e) { var newElement = document.createElement("li"); newElement.textContent = "message: " + e.data; eventList.appendChild(newElement); } Each received event causes our EventSource object's onmessage event handler to be run. It, in turn, creates a new <li> element and writes the message's data into it, then appends the new element to the list element already in the document. Note: You can find a full example on GitHub -- see Simple SSE demo using PHP. To listen to named events, you'll require a listener for each...
File.webkitRelativePath - Web APIs
Draft Initial specification. This API has no official W3C or WHATWG specification. Browser compatibility The compatibility table in this page is generated from structured data. If you'...
FileError - Web APIs
Web › API › FileError
constants, which might change as the specifications continue to change. Use the constant names instead. Constant Value Description ENCODING_ERR 5 The URL is malformed. Make sure that the URL is complete and valid. INVALID_MODIFICATION_ERR 9 The modification requested is not allowed. For example, the app might be trying to move a directory into its own child or moving a file into its parent directory without changing its name. INVALID_STATE_ERR 7 The operation cannot be performed on the current state of the interface object. For example, the state that was cached in an interface object has changed since it was last read from disk. NO_MODIFICATION_ALLOWED_ERR 6 The state of the underlying file system prevents any writing ...
FileException - Web APIs
tants, which might change as the specifications continue to change. Use the constant names instead. Constant Value Description ENCODING_ERR 5 The URL is malformed. Make sure that the URL is complete and valid. INVALID_MODIFICATION_ERR 9 The modification requested is not allowed. Examples of invalid modifications include moving a directory into its own child or moving a file into its parent directory without changing its name. INVALID_STATE_ERR 7 The operation cannot be performed on the current state of the interface object. For example, the state that was cached in an interface object has changed since it was last read from disk. NO_MODIFICATION_ALLOWED_ERR 6 The state of the underlying file system prevents any writing ...
FileReader.readAsDataURL() - Web APIs
For a full compatibility code you can see our crossbrowser possible solution for image preview. See also this more powerful example. Specifications ...
FileSystemDirectoryEntry - Web APIs
The FileSystemDirectoryEntry interface of the File and Directory Entries API represents a directory in a file system. It provides methods which make it possible to access and manipulate the files in a directory, as well as to access the entries within the directory. Basic concepts You can create a new directory by calling getDirectory(). If you want to create subdirectories, create each child directory in sequence. If you try creating a directory using a full path that includes parent directories that do not exist yet, an error is returned. So create the hierarchy by recursively adding a new path after creating the parent directory. Example In the following code snippet, we create a directory called "Documents." // Taking care of the browser-specific prefixes. window.requestFileSys...
FileSystemEntry.copyTo() - Web APIs
ding the copied item's new details. errorCallback Optional An optional callback which is executed if an error occurs while copying the items. There's a single parameter: a FileError describing what went wrong. Return value undefined. Errors FileError.INVALID_MODIFICATION_ERR The requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it. FileError.QUOTA_EXCEEDED_ERR The operation exceeded the user's storage quota, or there isn't enough storage space left to complete the operation. Example This example shows how a temporary log file might be moved into a more permanent "log" directory. workingDirectory.getFile("tmp/log.txt", {}, function(fileEntry...
FileSystemEntry.moveTo() - Web APIs
viding the moved item's new details. errorCallback Optional An optional callback which is executed if an error occurs while moving the items. There's a single parameter: a FileError describing what went wrong. Return value undefined. Errors FileError.INVALID_MODIFICATION_ERR The requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it. FileError.QUOTA_EXCEEDED_ERR The operation exceeded the user's storage quota, or there isn't enough storage space left to complete the operation. Example This example shows how a temporary log file might be moved into a more permanent "log" directory when it exceeds a megabyte in size. workingDirectory.getFile("t...
FileSystemEntry.toURL() - Web APIs
ou have a temporary file system that contains an image file named awesomesauce.jpg, the URL returned by toURL() might be (depending on the browser's implementation) something like "filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg". Code that makes use of this might look like this: let img = document.createElement("img"); img.src = imageFileEntry.toURL(); document.body.appendChild(img); Assuming the scenario mentioned before the code, the result would be HTML that looks like this being appended to the end of the document: <img src="filesystem:http://my-awesome-website.woot/temporary/awesomesauce.jpg"> Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com...
GlobalEventHandlers.ondrag - Web APIs
: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("Drag"); } function dragstart_handler(ev) { console.log("dragStart"); ev.dataTransfer.setData("text", ev.target.id); } function drop_handler(ev) { console.log("Drop"); ev.currentTarget.style.background = "lightyellow"; ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver"); ev.preventDefault(); } </script> <body> <h1>Examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> --> <p id="source" ondrag="drag_handler(event);" ondragstart="dragstart_handler(event);" draggable="true"> Sele...
GlobalEventHandlers.ondragend - Web APIs
.dataTransfer.setData("text", ev.target.id); } function dragover_handler(ev) { console.log("dragOver"); // Change the target element's border to signify a drag over event // has occurred ev.currentTarget.style.background = "lightblue"; ev.preventDefault(); } function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragenter_handler(ev) { console.log("dragEnter"); // Change the source element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(e...
GlobalEventHandlers.ondragenter - Web APIs
.dataTransfer.setData("text", ev.target.id); } function dragover_handler(ev) { console.log("dragOver"); // Change the target element's border to signify a drag over event // has occurred ev.currentTarget.style.background = "lightblue"; ev.preventDefault(); } function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragenter_handler(ev) { console.log("dragEnter"); // Change the source element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(e...
GlobalEventHandlers.ondragexit - Web APIs
.dataTransfer.setData("text", ev.target.id); } function dragover_handler(ev) { console.log("dragOver"); // Change the target element's border to signify a drag over event // has occurred ev.currentTarget.style.background = "lightblue"; ev.preventDefault(); } function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragenter_handler(ev) { console.log("dragEnter"); // Change the source element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's border back to white ev.currentTarget.style.background = "white"; } function dragend_handler(e...
GlobalEventHandlers.ondragleave - Web APIs
fer.setData("text", ev.target.id); } function dragover_handler(ev) { console.log("dragOver"); // Change the target element's background color to signify a drag over event // has occurred ev.currentTarget.style.background = "lightblue"; ev.preventDefault(); } function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragenter_handler(ev) { console.log("dragEnter"); // Change the source element's background color for enter events ev.currentTarget.style.background = "yellow"; } function dragleave_handler(ev) { console.log("dragLeave"); // Change the source element's background color back to white ev.currentTarget.style.background = "white"; } function dragend...
GlobalEventHandlers.ondragover - Web APIs
: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("Drag"); } function dragstart_handler(ev) { console.log("dragStart"); ev.dataTransfer.setData("text", ev.target.id); } function drop_handler(ev) { console.log("Drop"); ev.currentTarget.style.background = "lightyellow"; ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver"); ev.preventDefault(); } </script> <body> <h1>Examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondragstart="dragstart_handler(event);" draggable="true"> Select this element, drag it to th...
GlobalEventHandlers.ondragstart - Web APIs
: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("Drag"); } function dragstart_handler(ev) { console.log("dragStart"); ev.dataTransfer.setData("text", ev.target.id); } function drop_handler(ev) { console.log("Drop"); ev.currentTarget.style.background = "lightyellow"; ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver"); ev.preventDefault(); } </script> <body> <h1>Examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondragstart="dragstart_handler(event);" draggable="true"> Select this element, drag it to th...
GlobalEventHandlers.ondrop - Web APIs
: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("Drag"); } function dragstart_handler(ev) { console.log("dragStart"); ev.dataTransfer.setData("text", ev.target.id); } function drop_handler(ev) { console.log("Drop"); ev.currentTarget.style.background = "lightyellow"; ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } function dragover_handler(ev) { console.log("dragOver"); ev.preventDefault(); } </script> <body> <h1>Examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div class="source"> <p id="source" ondrag="drag_handler(event);" ondragstart="dragstart_handler(event);" draggable="true"> Select this element...
GlobalEventHandlers.onmousemove - Web APIs
;</a></p> <p><a href="#" data-tooltip="Second link">&hellip; or here!</a></p> CSS .tooltip { position: absolute; z-index: 9999; padding: 6px; background: #ffd; border: 1px #886 solid; border-radius: 5px; } JavaScript const tooltip = new (function() { const node = document.createElement('div'); node.className = 'tooltip'; node.setAttribute('hidden', ''); document.body.appendChild(node); this.follow = function(event) { node.style.left = event.clientX + 20 + 'px'; node.style.top = event.clientY + 10 + 'px'; }; this.show = function(event) { node.textContent = event.target.dataset.tooltip; node.removeAttribute('hidden'); }; this.hide = function() { node.setAttribute('hidden', ''); }; })(); const links = document.querySelectorAll('a'); link...
HTMLAnchorElement.referrerPolicy - Web APIs
e, that is roughly the scheme, the host and the port. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS. Examples var elt = document.createElement("a"); var linkText = document.createTextNode("My link"); elt.appendChild(linkText); elt.href = "https://developer.mozilla.org/"; elt.referrerPolicy = "no-referrer"; var div = document.getElementById("divAround"); div.appendChild(elt); // When clicked, the link will not send a referrer header. Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerPolicy attribute' in that specification. Candidate Recomm...
HTMLAreaElement.referrerPolicy - Web APIs
information that has been concealed to third-party by using TLS. Examples <img usemap="#mapAround" width="100" height="100" src="/img/logo@2x.png" /> <map id="myMap" name="mapAround" />> var elt = document.createElement("area"); elt.href = "/img2.png"; elt.shape = "rect"; elt.referrerPolicy = "no-referrer"; elt.coords = "0,0,100,100"; var map = document.getElementById("myMap"); map.appendChild(elt); // When clicked, the area's link will not send a referrer header. Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerpolicy attribute' in that specification. Candidate Recommendation Added the referrerPolicy property. Browser compatibility The compatibility table on this page is generated from structured data. I...
HTMLCanvasElement.mozGetAsFile() - Web APIs
...
accessKeyLabel - Web APIs
therwise it returns an empty string. Syntax label = element.accessKeyLabel Example JavaScript var node = document.getElementById('btn1'); if (node.accessKeyLabel) { node.title += ' [' + node.accessKeyLabel + ']'; } else { node.title += ' [' + node.accessKey + ']'; } node.onclick = function () { var p = document.createElement('p'); p.textContent = 'Clicked!'; node.parentNode.appendChild(p); }; HTML <button accesskey="h" title="Caption" id="btn1">Hover me</button> Result Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLElement.accessKeyLabel' in that specification. Living Standard No change from initial definition. HTML 5.1 Recommendation Removed. pull w3c/html#144, issue w3c/html#99, ...
HTMLElement.contextMenu - Web APIs
The HTMLElement.contextMenu property refers to the context menu assigned to an element using the contextmenu attribute. The menu itself is created using the <menu> element. Syntax var elementContextMenu = element.contextMenu; Example var contextMenu = document.getElementById("element").contextMenu; // Change the label of the first menu entry contextMenu.firstElementChild.label = "New label"; ...
HTMLFormElement.method - Web APIs
The HTMLFormElement.method property represents the HTTP method used to submit the <form>. Unless explicitly specified, the default method is 'get'. Syntax var string = form.method; form.method = string; Example document.forms['myform'].method = 'post'; const formElement = document.createElement("form"); // Create a form document.body.appendChild(formElement); console.log(formElement.method); // 'get' Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLFormElement: method' in that specification. Living Standard ...
HTMLFormElement.reportValidity() - Web APIs
Syntax HTMLFormElement.reportValidity() Return value Boolean Example document.forms['myform'].addEventListener('submit', function() { document.forms['myform'].reportValidity(); }, false); Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLFormElement.reportValidity()' in that specification. ...
HTMLIFrameElement.referrerPolicy - Web APIs
safe-url Send a full URL when performing a same-origin or cross-origin request. This policy will leak origins and paths from TLS-protected resources to insecure origins. Carefully consider the impact of this setting. Examples var iframe = document.createElement("iframe"); iframe.src = "/"; iframe.referrerPolicy = "unsafe-url"; var body = document.getElementsByTagName("body")[0]; body.appendChild(iframe); // Fetch the image using the complete URL as the referrer Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerpolicy attribute' in that specification. Candidate Recommendation Added the referrerPolicy attribute. HTML Living StandardThe definition of 'HTMLIFrameElement: referrerPolicy' in that specification. ...
HTMLIFrameElement.src - Web APIs
The HTMLIFrameElement.src property reflects the HTML referrerpolicy attribute of the <iframe> element defining which referrer is sent when fetching the resource. Syntax refStr = iframeElt.src; iframeElt.src= refStr; Example var iframe = document.createElement("iframe"); iframe.src = "/"; var body = document.getElementsByTagName("body")[0]; body.appendChild(iframe); // Fetch the image using the complete URL as the referrer Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLIFrameElement: src' in that specification. Living Standard Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browse...
srcdoc - Web APIs
The srcdoc property of the HTMLIFrameElement specifies the content of the page. Examples var iframe = document.createElement("iframe"); iframe.srcdoc = `<!DOCTYPE html><p>Hello World!</p>`; document.body.appendChild(iframe); Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLIFrameElement: srcdoc' in that specification. Living Standard ...
Image() - Web APIs
nd HTMLImageElement.height of the resulting instance. The intrinsic width and height of the image in CSS pixels are reflected through the properties HTMLImageElement.naturalWidth and HTMLImageElement.naturalHeight. If no size is specified in the constructor both pairs of properties have the same values. Examples var myImage = new Image(100, 200); myImage.src = 'picture.jpg'; document.body.appendChild(myImage); This would be the equivalent of defining the following HTML tag inside the <body>: <img width="100" height="200" src="picture.jpg"> Specifications Specification Status Comment HTML Living StandardThe definition of 'Image()' in that specification. Living Standard ...
HTMLImageElement.alt - Web APIs
In other words, it should be the same text you would use in a textual button to serve the same purpose. For example, in the snippet of HTML below, a toolbar which uses icon images as link labels provides alt attributes for each giving a textual label to use instead of the icon when th...
HTMLImageElement.currentSrc - Web APIs
Living Standard Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compa...
HTMLImageElement.decode() - Web APIs
llowing example shows how to use the decode() method to control when an image is appended to the DOM. Without a Promise-returning method, you would add the image to the DOM in a load event handler, such as by using the img.onload event handler, and by handling the error in the error event's handler. const img = new Image(); img.src = 'nebula.jpg'; img.decode() .then(() => { document.body.appendChild(img); }) .catch((encodingError) => { // Do something with the error. }) Specifications Specification Status Comment HTML Living StandardThe definition of 'decode()' in that specification. Living Standard Initial definition. ...
HTMLImageElement.loading - Web APIs
o avoid loading the image from the network until it's actually needed. function addImageToList(url) { const list = document.querySelector("div.photo-list"); let newItem = document.createElement("div"); newItem.className = "photo-item"; let newImg = document.createElement("img"); newImg.loading = "lazy"; newImg.width = 320; newImg.height = 240; newImg.src = url; newItem.appendChild(newImg); list.appendChild(newItem); } Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLImageElement.loading' in that specification. Living Standard ...
HTMLImageElement.referrerPolicy - Web APIs
and the port. "unsafe-url" meaning that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS. Examples var img = new Image(); img.src = 'img/logo.png'; img.referrerPolicy = 'origin'; var div = document.getElementById('divAround'); div.appendChild(img); // Fetch the image using the origin as the referrer Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerPolicy attribute' in that specification. Candidate Recommendation Added the referrerPolicy property. Browser compatibility The compatibility table on this page is generated from structured data. If you'd like t...
HTMLImageElement.srcset - Web APIs
x; } JavaScript The following code is run within a handler for the window's load event. It uses the image's currentSrc property to fetch and display the URL selected by the browser from the srcset. let box = document.querySelector(".box"); let image = box.querySelector("img"); let newElem = document.createElement("p"); newElem.innerHTML = `Image: <code>${image.currentSrc}</code>`; box.appendChild(newElem); Result In the displayed output below, the selected URL will correspond with whether your display results in selecting the 1x or the 2x version of the image. If you happen to have both standard and high density displays, try moving this window between them and reloading the page to see the results change. For additional examples, see our guide to responsive images. Specifications ...
HTMLInputElement.webkitdirectory - Web APIs
Draft Initial specification. This API has no official W3C or WHATWG specification. Browser compatibility The compatibility table on this page is generated from structured data. If you'd l...
HTMLLIElement - Web APIs
e of the bullets, "disc", "square" or "circle". As the standard way of defining the list type is via the CSS list-style-type property, use the CSSOM methods to set it via a script. HTMLLIElement.value Is a long indicating the ordinal position of the list element inside a given <ol>. It reflects the value attribute of the HTML <li> element, and can be smaller than 0. If the <li> element is not a child of an <ol> element, the property has no meaning. Methods No specific method; inherits properties from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLLIElement' in that specification. Living Standard HTML5The definition of 'HTMLLIElement' in that specification. Recommendation The fo...
HTMLMediaElement: abort event - Web APIs
ce Event Event handler property onabort Examples const video = document.querySelector('video'); const videoSrc = 'https://path/to/video.webm'; video.addEventListener('abort', () => { console.log(`Abort loading: ${videoSrc}`); }); const source = document.createElement('source'); source.setAttribute('src', videoSrc); source.setAttribute('type', 'video/webm'); video.appendChild(source); Specifications Specification Status HTML Living Standard Living Standard HTML5 Recommendation ...
HTMLMediaElement.load() - Web APIs
an the available sources, thereby causing the changes to take effect. Syntax mediaElement.load(); Parameters None. Return value undefined. Usage notes Calling load() aborts all ongoing operations involving this media element, then begins the process of selecting and loading an appropriate media resource given the options specified in the <audio> or <video> element and its src attribute or child <source> element(s). This is described in more detail in Supporting multiple formats in Video and audio content. The process of aborting any ongoing activities will cause any outstanding Promises returned by play() being resolved or rejected as appropriate based on their status before the loading of new media can begin. Pending play promises are aborted with an "AbortError" DOMException. Approp...
HTMLMediaElement: loadstart event - Web APIs
Living Standard HTML5The definition of 'loadstart media event' in that specification. Recommendation ...
HTMLMediaElement: progress event - Web APIs
Living Standard HTML5The definition of 'progress media event' in that specification. Recommendation ...
HTMLMedia​Element​.textTracks - Web APIs
ax var textTracks = mediaElement.textTracks; Value A TextTrackList object representing the list of text tracks included in the media element. The list of tracks can be accessed using array notation, or using the object's getTrackById() method. Each track is represented by a TextTrack object which provides information about the track. ...
HTMLOptGroupElement - Web APIs
y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLOptGroupElement</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Inherits properties from its parent, HTMLElement. HTMLOptGroupElement.disabled Is a boolean representing whether or not the whole list of children <option> is disabled (true) or not (false). HTMLOptGroupElement.label Is a DOMString representing the label for the group. Methods No specific method; inherits methods from its parent, HTMLElement. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLOptgroupElement' in that specification. Living Standard HTML5Th...
HTMLOptionElement - Web APIs
parent, HTMLElement. HTMLOptionElement.defaultSelected Is a Boolean that contains the initial value of the selected HTML attribute, indicating whether the option is selected by default or not. HTMLOptionElement.disabled Is a Boolean representing the value of the disabled HTML attribute, which indicates that the option is unavailable to be selected. An option can also be disabled if it is a child of an <optgroup> element that is disabled. HTMLOptionElement.form Read only Is a HTMLFormElement representing the same value as the form of the corresponding <select> element, if the option is a descendant of a <select> element, or null if none is found. HTMLOptionElement.index Read only Is a long representing the position of the option within the list of options it belongs to, in tree-o...
HTMLScriptElement.referrerPolicy - Web APIs
tly specified on the <script> element, it will adopt a higher-level referrer policy, i.e. one set on the whole document or domain. If a higher-level policy is not available, the empty string is treated as being equivalent to no-referrer-when-downgrade. Examples var scriptElem = document.createElement("script"); scriptElem.src = "/"; scriptElem.referrerPolicy = "unsafe-url"; document.body.appendChild(script); Specifications Specification Status Comment Referrer PolicyThe definition of 'referrerpolicy attribute' in that specification. Candidate Recommendation Added the referrerPolicy attribute. HTML Living StandardThe definition of 'HTMLScriptElement: referrerPolicy' in that specification. Living Standard Browser compatibility The c...
HTMLSelectElement.add() - Web APIs
DOMError of the type HierarchyRequestError if the passed item is an ancestor of the HTMLSelectElement and no longer throws if the before parameter is not found. Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLSelectElement.add()' in that specification. Obsolete The method now throws an NOT_FOUND_ERR exception if the item of the before parameter is not a child of this element. Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLSelectElement.add()' in that specification. Obsolete Initial definition ...
HTMLSelectElement.selectedOptions - Web APIs
elect> element that are currently selected. The list of selected options is an HTMLCollection object with one entry per currently selected option. An option is considered selected if it has an HTMLOptionElement.selected attribute. Syntax var selectedCollection = HTMLSelectElement.selectedOptions; Value An HTMLCollection which lists every currently selected HTMLOptionElement which is either a child of the HTMLSelectElement or of an HTMLOptGroupElement within the <select> element. In other words, any option contained within the <select> element may be part of the results, but option groups are not included in the list. If no options are currently selected, the collection is empty and returns a length of 0. Example In this example, a <select> element with a number of options is used to le...
HTMLSlotElement.assignedElements() - Web APIs
her slots that are descendants of this slot. If no assigned nodes are found, it returns the slot's fallback content. Syntax var assignedElements = HTMLSlotElement.assignedElements(options) Parameters options Optional An object that sets options for the nodes to be returned. The available options are: flatten: A Boolean indicating whether to return the assigned elements of any available child <slot> elements (true) or not (false). Defaults to false. Return value An array of elements. Examples let slots = this.shadowRoot.querySelector('slot'); let elements = slots.assignedElements({flatten: true}); Specifications Specification Status Comment HTML Living StandardThe definition of 'assignedElements()' in that specification. Living Standard ...
HTMLSlotElement.assignedNodes() - Web APIs
of any other slots that are descendants of this slot. If no assigned nodes are found, it returns the slot's fallback content. Syntax var assignedNodes = HTMLSlotElement.assignedNodes(options) Parameters options Optional An object that sets options for the nodes to be returned. The available options are: flatten: A Boolean indicating whether to return the assigned nodes of any available child <slot> elements (true) or not (false). Defaults to false. Return value An array of nodes. Examples The following snippet is taken from our slotchange example (see it live also). let slots = this.shadowRoot.querySelectorAll('slot'); slots[1].addEventListener('slotchange', function(e) { let nodes = slots[1].assignedNodes(); console.log('Element in Slot "' + slots[1].name + '" changed ...
HTMLSlotElement: slotchange event - Web APIs
add or delete) the actual nodes themselves. Bubbles Yes Cancelable No Interface Event Event handler property None In order to trigger a slotchange event, one has to set or remove the slot attribute. ...
HTMLTableRowElement.rowIndex - Web APIs
tr><td>Bananas</td> <td>$2</td></tr> <tr><td>Oranges</td> <td>$8</td></tr> <tr><td>Top Sirloin</td> <td>$20</td></tr> </tbody> <tfoot> <tr><td>Total</td> <td>$30</td></tr> </tfoot> </table> JavaScript let rows = document.querySelectorAll('tr'); rows.forEach((row) => { let z = document.createElement("td"); z.textContent = `(row #${row.rowIndex})`; row.appendChild(z); }); Result ...
HTMLTrackElement: cuechange event - Web APIs
ck.oncuechange = function () { let cues = track.activeCues; // array of current cues } On the track element The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element. If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement. let textTrackElem = document.getElementById("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; }); In addition, you can use the oncuechange event handler: let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechan...
HTMLTrackElement - Web APIs
The HTMLTrackElement interface represents an HTML <track> element within the DOM. This element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignm...
Drag Operations - Web APIs
e data is a link, it should have the type text/uri-list. You could then insert a link into the content. function doDrop(event) { const lines = event.dataTransfer.getData("text/uri-list").split("\n"); lines.filter(line => !line.startsWith("#")) .forEach(line => { const link = document.createElement("a"); link.href = line; link.textContent = line; event.target.appendChild(link); }) event.preventDefault(); } This example inserts a link from the dragged data. As the name implies, the text/uri-list type actually may contain a list of URLs, each on a separate line. The above code uses split to break the string into lines, then iterates over the list of lines, and inserts each as a link into the document. (Note also that links starting with a number sign (#) ar...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
Recommendation Indexed Database API DraftThe definition of 'advance()' in that specification. Recommendation ...
IDBCursor.continue() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'continue()' in that specification. Recommendation ...
IDBCursor.delete() - Web APIs
Web › API › IDBCursor › delete
race under pressure') { var request = cursor.delete(); request.onsuccess = function() { console.log('Deleted that mediocre album from 1984. Even Power windows is better.'); }; } else { var listItem = document.createElement('li'); listItem.innerHTML = '<strong>' + cursor.value.albumTitle + '</strong>, ' + cursor.value.year; list.appendChild(listItem); } cursor.continue(); } else { console.log('Entries displayed.'); } }; }; Specifications Specification Status Comment Indexed Database API 2.0The definition of 'delete()' in that specification. Recommendation Indexed Database API DraftThe definition of 'delete()' in that specification. Recommendation B...
IDBCursor.direction - Web APIs
Recommendation Indexed Database API DraftThe definition of 'direction' in ...
IDBCursor.key - Web APIs
Web › API › IDBCursor › key
Recommendation Indexed Database API DraftThe definition of 'key' in that specification. Recommenda...
IDBCursor.primaryKey - Web APIs
Recommendation Indexed Database API DraftThe definition of 'primaryKey' in that specifi...
IDBCursor.request - Web APIs
Web › API › IDBCursor › request
Recommendation Initial definition. Browser compatibility The compatibility table on t...
IDBCursor.source - Web APIs
Web › API › IDBCursor › source
Recommendation Indexed Database API DraftThe definition of 'source' in that specification. R...
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
Recommendation Indexed Database API DraftThe definition of 'update()' in that specification. Recommendation Browser c...
IDBCursor - Web APIs
Web › API › IDBCursor
Recommendation Initial definition Indexed Database API DraftThe definition of 'cursor' in that specification. Recommendation A...
IDBCursorWithValue.value - Web APIs
Recommendation Indexed Database API DraftThe definition of 'IDBDatabase' in that specification. ...
IDBCursorWithValue - Web APIs
Recommendation Indexed Database API DraftThe definition of 'IDBCursorWithValue' in that specification. Recommendati...
IDBIndex.count() - Web APIs
Web › API › IDBIndex › count
Recommendation Indexed Database API DraftThe definition of 'count()' in that specification. Recommendation Brow...
IDBIndex.get() - Web APIs
Web › API › IDBIndex › get
Recommendation Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to c...
IDBIndex.getKey() - Web APIs
Web › API › IDBIndex › getKey
Recommendation Indexed Database API DraftThe definition of 'getKey()' in that specification. Recommendation Brow...
IDBIndex.isAutoLocale - Web APIs
...
IDBIndex.keyPath - Web APIs
Web › API › IDBIndex › keyPath
Recommendation Indexed Database API DraftThe definition of 'keyPath' in that specification. Recommendation Browser...
IDBIndex.locale - Web APIs
Web › API › IDBIndex › locale
...
IDBIndex.multiEntry - Web APIs
Recommendation Indexed Database API DraftThe definition of 'multiEntry' in that specification. Recommendation B...
IDBIndex.name - Web APIs
Web › API › IDBIndex › name
Recommendation Indexed Database API DraftThe definition of 'name' in that specification. Recommendation Browser compa...
IDBIndex.objectStore - Web APIs
Recommendation Indexed Database API DraftThe definition of 'objectStore' in that specification. Recommendation ...
IDBIndex.openCursor() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'openCursor()' in that specification. Recommendation ...
IDBIndex.openKeyCursor() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'openKeyCursor()' in that specification. Recommendat...
IDBIndex.unique - Web APIs
Web › API › IDBIndex › unique
Recommendation Indexed Database API DraftThe definition of 'unique' in that specification. Recommendation Browser c...
IDBIndex - Web APIs
Web › API › IDBIndex
Recommendation Indexed Database API DraftThe definition of 'IDBIndex' in that specification. Recommendation Brows...
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
Recommendation Indexed Database API DraftThe definition of 'bound()' in that specification. Recommendation ...
IDBKeyRange.lower - Web APIs
Web › API › IDBKeyRange › lower
Recommendation Indexed Database API DraftThe definition of 'lower' in that specification. Recommendation ...
IDBKeyRange.lowerBound() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'lowerBound()' in that specification. Recommend...
IDBKeyRange.lowerOpen - Web APIs
Recommendation Indexed Database API DraftThe definition of 'lowerOpen' in that specification. Recommendation ...
IDBKeyRange.only() - Web APIs
Web › API › IDBKeyRange › only
Recommendation Indexed Database API DraftThe definition of 'only' in that specification. Recommendation B...
IDBKeyRange.upper - Web APIs
Web › API › IDBKeyRange › upper
Recommendation Indexed Database API DraftThe definition of 'upper' in that specification. Recommendation ...
IDBKeyRange.upperBound() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'upperBound()' in that specification. Recomm...
IDBKeyRange.upperOpen - Web APIs
Recommendation Indexed Database API DraftThe definition of 'upperOpen' in that specification. Recommendation ...
IDBKeyRange - Web APIs
Recommendation Initial definition. Indexed Database API DraftThe definition of 'IDBKeyRange' in that specification. Recommen...
IDBLocaleAwareKeyRange - Web APIs
...
IDBObjectStore.index() - Web APIs
Recommendation Indexed Database API DraftThe definition of 'index()' in that specification. Recommendation Browser...
IIRFilterNode.getFrequencyResponse() - Web APIs
Working Draft ...
Intersection Observer API - Web APIs
0.6, 0.7, 0.8, 0.9, 1.0], [0, 0.25, 0.5, 0.75, 1.0] ]; for (let i=0; i<=1.0; i+= 0.01) { thresholdSets[0].push(i); } // Add each box, creating a new observer for each for (let i=0; i<4; i++) { let template = document.querySelector("#boxTemplate").content.cloneNode(true); let boxID = "box" + (i+1); template.querySelector(".sampleBox").id = boxID; wrapper.appendChild(document.importNode(template, true)); // Set up the observer for this box observerOptions.threshold = thresholdSets[i]; observers[i] = new IntersectionObserver(intersectionCallback, observerOptions); observers[i].observe(document.querySelector("#" + boxID)); } // Scroll to the starting position document.scrollingElement.scrollTop = wrapper.firstElementChild.getBoundingCl...
KeyboardEvent.code - Web APIs
Handle keyboard events in a game This example establishes an event listener for keydown events that handle keyboard input for a game that uses the typical "WASD" keyboard layout for steering forward, left, backward, and right. This will use the same four keys physically ...
MediaDevices.getSupportedConstraints() - Web APIs
Candidate Recommendation Initial definition. ...
MediaStream.onaddtrack - Web APIs
example adds a listener which, when a new track is added to the stream, appends a new item to a list of tracks; the new item shows the track's kind ("audio" or "video") and label. stream.onaddtrack = function(event) { let trackList = document.getElementById("tracks"); let label = document.createElement("li"); label.innerHTML = event.track.kind + ": " + event.track.label; trackList.appendChild(label); }; Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStream.onaddtrack' in that specification. Candidate Recommendation Initial specification. ...
MediaStream.onremovetrack - Web APIs
s specified in the event's track property. Example This example adds a listener which, when a track is removed from the stream, logs the track that was removed. stream.onremovetrack = function(event) { let trackList = document.getElementById("tracks"); let label = document.createElement("li"); label.innerHTML = "Removed: " + event.track.kind + ": " + event.track.label; trackList.appendChild(label); }; Specifications Specification Status Comment Media Capture and StreamsThe definition of 'MediaStream.onremovetrack' in that specification. Candidate Recommendation Initial specification. ...
Capabilities, constraints, and settings - Web APIs
function log(msg) { logElement.innerHTML += (msg + "<br>"); } function handleError(reason) { log("Error <code>" + reason.name + "</code> in constraint <code>"...
MouseEvent.buttons - Web APIs
Obsolete Initial definition UI EventsThe definition of 'MouseEvent.buttons' in that specification. Working Draft Current working draft ...
MouseEvent.movementX - Web APIs
.screenX - previousEvent.screenX. Syntax var xShift = instanceOfMouseEvent.movementX; Return value A number Example This example logs the amount of mouse movement using movementX and movementY. HTML <p id="log">Move your mouse around.</p> JavaScript function logMovement(event) { log.insertAdjacentHTML('afterbegin', `movement: ${event.movementX}, ${event.movementY}<br>`); while (log.childNodes.length > 128) log.lastChild.remove() } const log = document.getElementById('log'); document.addEventListener('mousemove', logMovement); Result Specifications Specification Status Comment Pointer LockThe definition of 'MouseEvent.movementX' in that specification. Candidate Recommendation Initial definition ...
msPlayToPreferredSourceUri - Web APIs
ine which must be unprotected content. A forward slash ("/") is appended to the URI string when it is sent over the network to a PlayTo device. This is done to conform to URI standards. Example <video src="http://www.contoso.com/videos/video.mp4" msPlayToPreferredSourceUri="http://www.contoso.com/catalogid=1234" /> var video = document.createElement('video'); document.body.appendChild(video); video.src = "http://www.contoso.com/videos/video.mp4"; video.msPlayToPreferredSourceUri = "http://www.contoso.com/catalogid=1234"; See also Microsoft PlayReady content access and protection technology is a set of technologies that can be used to distribute audio/video content more securely over a network, and help prevent the unauthorized use of this content. ...
MutationObserver.disconnect() - Web APIs
discarded. Usage notes If the element being observed is removed from the DOM, and then subsequently released by the browser's garbage collection mechanism, the MutationObserver is likewise deleted. Example This example creates an observer, then disconnects from it, leaving it available for possible reuse. const targetNode = document.querySelector("#someElement"); const observerOptions = { childList: true, attributes: true } const observer = new MutationObserver(callback); observer.observe(targetNode, observerOptions); /* some time later... */ observer.disconnect(); Specifications Specification Status Comment DOMThe definition of 'MutationObserver.disconnect()' in that specification. Living Standard ...
MutationObserver.takeRecords() - Web APIs
's DOM tree. Note: The queue of mutations which have occurred, but not been delivered to the observer's callback is left empty after calling takeRecords(). Example In this example, we demonstrate how to handle any undelivered MutationRecords by calling takeRecords() just before disconnecting the observer. const targetNode = document.querySelector("#someElement"); const observerOptions = { childList: true, attributes: true } const observer = new MutationObserver(callback); observer.observe(targetNode, observerOptions); /* ...later, when it's time to stop observing... */ /* handle any still-pending mutations */ let mutations = observer.takeRecords(); observer.disconnect(); if (mutations) { callback(mutations); } The code in lines 12-17 fetches any unprocessed mutation records,...
MutationObserverInit.subtree - Web APIs
The MutationObserverInit dictionary's optional subtree property can be set to true to monitor the targeted node and all of its descendants. The default value, false, indicates only the target node itself is to be monitored for changes. subtree can be used in concert with the other options to extend monitoring of attributes, text content, and child lists to the entire subtree rooted at the target node. Syntax var options = { subtree: true | false } Value A Boolean value. The default, false, indicates that only the target node specified when calling MutationObserver.observe() is to be monitored for changes. Changing this value to true causes the entire subtree rooted at the specified target node to be monitored for the changes indicated by the other options. For example, to watch the ta...
Navigator.productSub - Web APIs
The Navigator.productSub read-only property returns the build number of the current browser. Syntax prodSub = window.navigator.productSub prodSub is a string. Example <script> function prodsub() { var dt = document.getElementById("d").childNodes[0]; dt.data = window.navigator.productSub; } </script> <button onclick="prodsub();">productSub</button> // returns: 20010725 Notes On IE, this property returns undefined. On Apple Safari and Google Chrome this property always returns 20030107. Specifications Specification Status Comment HTML Living StandardThe definition of 'NavigatorID: productSub' in that specification. Living Standard Initial definition ...
Node.cloneNode() - Web APIs
Web › API › Node › cloneNode
The Node.cloneNode() method returns a duplicate of the node on which this method was called. Syntax let newClone = node.cloneNode([deep]) node The node to be cloned. newClone The new node, cloned from node. The newClone has no parent and is not part of the document, until it is added to another node that is part of the document (using Node.appendChild() or a similar method). deep Optional* If true, then node and its whole subtree--including text that may be in child Text nodes--is also copied. If false, only node will be cloned. Any text that node contains is not cloned, either (since text is contained by one or more child Text nodes). deep has no effect on empty elements (such as the <img> and <input> elements). *Note: In the DOM4 specification (since Gecko 13.0 (F...
Node.contains() - Web APIs
Web › API › Node › contains
Syntax node.contains( otherNode ) Example This function checks to see if an element is in the page's body. As contains is inclusive and determining if the body contains itself isn't the intention of isInPage this case explicitly returns false. ...
Node.isEqualNode() - Web APIs
Web › API › Node › isEqualNode
The specific set of data points that must match varies depending on the types of the nodes. Syntax var isEqualNode = node.isEqualNode(otherNode); otherNode: The Node to compare equality with. Example In this example, we create three <div> blocks. The first and third have the same contents and attributes, while the second is different. ...
Node.nextSibling - Web APIs
Web › API › Node › nextSibling
Syntax nextNode = node.nextSibling Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may refer to a whitespace text node rather than the actual element the author intended to get. See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. ...
Node.ownerDocument - Web APIs
The ownerDocument read-only property of the Node interface returns the top-level document object of the node. Syntax var document = element.ownerDocument; Value document is the top-level Document object in which all the child nodes are created. If this property is used on a node that is itself a document, the value is null. Example // Given a node "p", get the top-level HTML // child of the document object var d = p.ownerDocument; var html = d.documentElement; Specifications Specification Status Comment DOMThe definition of 'Node: ownerDocument' in that specification. Living Standard ...
Node.parentNode - Web APIs
Web › API › Node › parentNode
ode.parentNode read-only property returns the parent of the specified node in the DOM tree. Syntax parentNode = node.parentNode parentNode is the parent of the current node. The parent of an element is an Element node, a Document node, or a DocumentFragment node. Example if (node.parentNode) { // remove a node from the tree, unless // it's not in the tree already node.parentNode.removeChild(node); } Notes Document and DocumentFragment nodes can never have a parent, so parentNode will always return null. It also returns null if the node has just been created and is not yet attached to the tree. Specifications Specification Status Comment DOMThe definition of 'Node: parentNode' in that specification. Living Standard ...
Node.rootNode - Web APIs
Web › API › Node › rootNode
= node.rootNode; Value A Node object representing the topmost node in the tree. Example Running the following line in supporting browsers should return a reference to the HTML/document node: console.log(document.body.rootNode); Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may refer to a whitespace text node rather than the actual element the author intended to get. See Whitespace in the DOM and W3C DOM 3 FAQ: Why are some Text nodes empty? for more information. ...
NodeIterator.whatToShow - Web APIs
NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a NodeIterator or TreeWalker with an Attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. NodeFilter.SHOW_CDATA_SECTION 8 Shows CDATASection nodes. NodeFilter.SHOW_COMMENT 128 Shows Comment nodes. NodeFilter.SHOW_DOCUMENT 256 Shows Document nodes. NodeFilter.SHOW_DOCUMENT_FRAGMENT 1024 Shows DocumentFragment nodes. NodeFilter.SHOW_DOCUMEN...
NodeList.item() - Web APIs
Web › API › NodeList › item
index is the index of the node to be fetched. ...
RTCDataChannel.onmessage - Web APIs
t, and starts creating new <p> (paragraph) elements each time a message arrives, with the message's contents displayed inside it. The new elements are then attached to the end of the document. let pc = new RTCPeerConnection(); let dc = pc.createDataChannel(); dc.onmessage = function(event) { var el = document.createElement("p"); var txtNode = document.createTextNode(event.data); el.appendChild(txtNode); receiveBox.appendChild(el); } Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDataChannel.onmessage' in that specification. Candidate Recommendation Initial specification. ...
Range.cloneContents() - Web APIs
attributes are also cloned, which can lead to an invalid document through cloning. Partially selected nodes include the parent tags necessary to make the document fragment valid. Syntax documentFragment = range.cloneContents(); Example range = document.createRange(); range.selectNode(document.getElementsByTagName("div").item(0)); documentFragment = range.cloneContents(); document.body.appendChild(documentFragment); Specifications Specification Status Comment DOMThe definition of 'Range.cloneContents()' in that specification. Living Standard No change. Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'Range.cloneContents()' in that specification. Obsolete Initial specification. ...
Range.comparePoint() - Web APIs
The Range.comparePoint() method returns -1, 0, or 1 depending on whether the referenceNode is before, the same as, or after the Range. If the reference node is a Node of type Text, Comment, or CDATASection, then offset is the number of characters from the start of reference node. For other Node types, offset is the number of child nodes between the start of the reference node. Syntax returnValue = range.comparePoint(referenceNode, offset) Parameters referenceNode The Node to compare with the Range. offset An integer greater than or equal to zero representing the offset inside the referenceNode. Example range = document.createRange(); range.selectNode(document.getElementsByTagName('div').item(0)); returnValue = range.comparePoint(document.getElementsByTagName('p').item(0...
Range.createContextualFragment() - Web APIs
ring Text that contains text and tags to be converted to a document fragment. Example var tagString = "<div>I am a div node</div>"; var range = document.createRange(); // Make the parent of the first div in the document becomes the context node range.selectNode(document.getElementsByTagName("div").item(0)); var documentFragment = range.createContextualFragment(tagString); document.body.appendChild(documentFragment); Specification Specification Status Comment DOM Parsing and SerializationThe definition of 'Range.createContextualFragment()' in that specification. Working Draft Initial specification. ...
Range.endOffset - Web APIs
Web › API › Range › endOffset
The Range.endOffset read-only property returns a number representing where in the Range.endContainer the Range ends. If the endContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the endContainer to the boundary point of the Range. For other Node types, the endOffset is the number of child nodes between the start of the endContainer and the boundary point of the Range. This property is read-only. To change the endOffset of a Range, use one of the Range.setEnd methods. Syntax endRangeOffset = range.endOffset; Example var range = document.createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); endRangeOffset = range.endOffset; Specifications Specification Status Comment ...
Range.insertNode() - Web APIs
Web › API › Range › insertNode
The Range.insertNode() method inserts a node at the start of the Range. The new node is inserted at the start boundary point of the Range. If the new node is to be added to a text Node, that Node is split at the insertion point, and the insertion occurs between the two text nodes. If the new node is a document fragment, the children of the document fragment are inserted instead. Syntax range.insertNode(newNode); Parameters newNode The Node to insert at the start of the range. Example range = document.createRange(); newNode = document.createElement("p"); newNode.appendChild(document.createTextNode("New Node Inserted Here")); range.selectNode(document.getElementsByTagName("div").item(0)); range.insertNode(newNode); Specifications Specification Status Comment ...
Range.selectNodeContents() - Web APIs
Syntax range.selectNodeContents(referenceNode); Parameters referenceNode The Node whose contents will be selected within a Range. ...
Range.setEnd() - Web APIs
Web › API › Range › setEnd
doctype node; range endpoints cannot be located inside a doctype node. IndexSizeError The value specified by endOffset is either greater than or equal to the length of the node or is less than zero. Usage notes If the endNode is a Node of type Text, Comment, or CDataSection, then endOffset is the number of characters from the start of endNode. For other Node types, endOffset is the number of child nodes between the start of the endNode. Example const range = document.createRange(); const endNode = document.getElementsByTagName('p').item(3); const endOffset = endNode.childNodes.length; range.setEnd(endNode, endOffset); setEnd() is commonly used in conjunction with setStart() to fully configure a range. Specifications Specification Status Comment DOMThe defini...
Range.startOffset - Web APIs
Web › API › Range › startOffset
The Range.startOffset read-only property returns a number representing where in the startContainer the Range starts. If the startContainer is a Node of type Text, Comment, or CDATASection, then the offset is the number of characters from the start of the startContainer to the boundary point of the Range. For other Node types, the startOffset is the number of child nodes between the start of the startContainer and the boundary point of the Range. To change the startOffset of a Range, use the Range.setStart method. Syntax startRangeOffset = range.startOffset; Example var range = document.createRange(); range.setStart(startNode,startOffset); range.setEnd(endNode,endOffset); var startRangeOffset = range.startOffset; Specifications Specification Status Comment DOMT...
Range.surroundContents() - Web APIs
After surrounding, the boundary points of the range include newNode. An exception will be thrown, however, if the Range splits a non-Text node with only one of its boundary points. That is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. ...
ReadableStream.ReadableStream() - Web APIs
unction is run, which reads the data back out of the stream. ...
ReadableStream.getReader() - Web APIs
n done is true. if (done) { console.log("Stream complete"); para.textContent = value; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specification Status Comment StreamsThe definition of 'getReader()' in that specification. Living Standard Initial definition. ...
ReadableStream.tee() - Web APIs
lue - some data. Always undefined when done is true. if (done) { console.log("Stream complete"); return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Read ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list.appendChild(listItem); // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specification Status Comment StreamsThe definition of 'tee()' in that specification. Living Standard Initial definition. ...
ReadableStreamDefaultController.close() - Web APIs
unction is run, which reads the data back out of the stream. ...
ReadableStreamDefaultController.enqueue() - Web APIs
unction is run, which reads the data back out of the stream. ...
ReadableStreamDefaultController - Web APIs
unction is run, which reads the data back out of the stream. ...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Specifications Specification Status Comment StreamsThe definition of 'ReadableStreamDefaultReader()' in that specification. Living Standard Initial definition. ...
ReadableStreamDefaultReader.cancel() - Web APIs
Living Standard Initial definition. ...
ReadableStreamDefaultReader.read() - Web APIs
done is true. if (done) { console.log("Stream complete"); para.textContent = result; return; } // value for fetch streams is a Uint8Array charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } Example 2 - handling text line by line This example shows how you might fetch a text file and handle it as a stream of text lines. It deals with stream chunks not ending on line boundaries and converting from Uint8Array to strings. async function* makeTextFi...
SVGAnimationElement: beginEvent event - Web APIs
ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; padding: 10px 30px; } let svgElem = document.querySelector('svg'); let animateElem = document.querySelector('animateMotion'); let list = document.querySelector('ul'); animateElem.addEventListener('beginEvent', () => { let listItem = document.createElement('li'); listItem.textContent = 'beginEvent fired'; list.appendChild(listItem); }) animateElem.addEventListener('repeatEvent', (e) => { let listItem = document.createElement('li'); let msg = 'repeatEvent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listItem.textContent = msg; list.appendChild(listItem); }) Event handler property equivalent Note that you can also create an event listener for the begin event using the onbegin...
SVGAnimationElement: repeatEvent event - Web APIs
> ul { height: 100px; border: 1px solid #ddd; overflow-y: scroll; padding: 10px 30px; } let svgElem = document.querySelector('svg'); let animateElem = document.querySelector('animateMotion'); let list = document.querySelector('ul'); animateElem.addEventListener('beginEvent', () => { let listItem = document.createElement('li'); listItem.textContent = 'beginEvent fired'; list.appendChild(listItem); }) animateElem.addEventListener('repeatEvent', (e) => { let listItem = document.createElement('li'); let msg = 'repeatEvent fired'; if(e.detail) { msg += '; repeat number: ' + e.detail; } listItem.textContent = msg; list.appendChild(listItem); }) Event handler property equivalent Note that you can also create an event listener for the repeat event using the onrepe...
SVGTextContentElement - Web APIs
It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. ...
SVGUseElement - Web APIs
g to the y attribute of the given element. SVGUseElement.width Read only An SVGAnimatedLength corresponding to the width attribute of the given element. SVGUseElement.height Read only An SVGAnimatedLength corresponding to the height attribute of the given element. SVGUseElement.instanceRoot Read only An SVGElement corresponding to the instance root of the given element, which is a direct child of the elements shadow root. If the element does not have a shadow tree (for example, because its URI is invalid or because it has been disabled by conditional processing), then getting this attribute returns null. SVGUseElement.animatedInstanceRoot Read only An SVGElement corresponding to the instance root of the given element, which is a direct child of the elements shadow root. If the eleme...
Sensor.onactivate - Web APIs
Web › API › Sensor › onactivate
Syntax sensorInstance.onactivate = function sensorInstance.addEventListener('activate', function() { ... }) Because Sensor is a base class, onactivate may only be used on one of its derived classes. ...
Sensor.onerror - Web APIs
Web › API › Sensor › onerror
Syntax sensorInstance.onerror = function sensorInstance.addEventListener('error', function() { ... }) Because Sensor is a base class, onerror may only be used on one of its derived classes. ...
Sensor.onreading - Web APIs
Web › API › Sensor › onreading
Syntax sensorInstance.onreading = function sensorInstance.addEventListener('reading', function() { ... }) Because Sensor is a base class, onreading may only be used on one of its derived classes. ...
Sensor - Web APIs
Web › API › Sensor
Sensor Magnetometer OrientationSensor Properties Sensor.activated Read only Returns a Boolean indicating whether the sensor is active. Sensor.hasReading Read only Returns a Boolean indicating whether the sensor has a reading. Sensor.timestamp Read only Returns the time stamp of the latest sensor reading. Event handlers Sensor.onerror Called when an error occurs on one of the child interfaces of the Sensor interface. Sensor.onreading Called when a reading is taken on one of the child interfaces of the Sensor interface. Sensor.onactivate Called when one of the Sensor interface's becomes active. Methods Sensor.start() Activates one of the sensors based on Sensor. Sensor.stop() Deactivates one of the sensors based on Sensor. Specifications Specification...
Using Service Workers - Web APIs
t that for now. When we come to call the imgLoad() function, we call it with the url to the image we want to load, as we might expect, but the rest of the code is a little different: let body = document.querySelector('body'); let myImage = new Image(); imgLoad('myLittleVader.jpg').then((response) => { var imageURL = window.URL.createObjectURL(response); myImage.src = imageURL; body.appendChild(myImage); }, (Error) => { console.log(Error); }); On to the end of the function call, we chain the promise then() method, which contains two functions -- the first one is executed when the promise successfully resolves, and the second is called when the promise is rejected. In the resolved case, we display the image inside myImage and append it to the body (its argument is the request.response...
Service Worker API - Web APIs
Worker. It contains information about the request and resulting response, and provides the FetchEvent.respondWith() method, which allows us to provide an arbitrary response back to the controlled page. InstallEvent The parameter passed into the oninstall handler, the InstallEvent interface represents an install action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. As a child of ExtendableEvent, it ensures that functional events such as FetchEvent are not dispatched during installation. NavigationPreloadManager Provides methods for managing the preloading of resources with a service worker. Navigator.serviceWorker Returns a ServiceWorkerContainer object, which provides access to registration, removal, upgrade, and communication with the ServiceWorker objects for...
SpeechSynthesis.getVoices() - Web APIs
Draft Initial defini...
SpeechSynthesis.onvoiceschanged - Web APIs
Draft ...
SpeechSynthesis - Web APIs
voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } } populateVoiceList(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.onvoiceschanged = populateVoiceList; } inputForm.onsubmit = function(event) { event.preventDefault(); var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = voiceSelect.selectedOptions[0].getAttribute('data-name'); for(i = 0; i < voices.length ; i++) { ...
SpeechSynthesisUtterance - Web APIs
Draft ...
SpeechSynthesisVoice.default - Web APIs
stance.default; Value A Boolean. Examples for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } Specifications Specification Status Comment Web Speech APIThe definition of 'default' in that specification. Draft ...
SpeechSynthesisVoice.lang - Web APIs
senting the language of the device. Examples for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } Specifications Specification Status Comment Web Speech APIThe definition of 'lang' in that specification. Draft ...
SpeechSynthesisVoice.localService - Web APIs
Draft ...
SpeechSynthesisVoice.name - Web APIs
representing the name of the voice. Examples for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } Specifications Specification Status Comment Web Speech APIThe definition of 'name' in that specification. Draft ...
SpeechSynthesisVoice.voiceURI - Web APIs
Draft ...
SpeechSynthesisVoice - Web APIs
voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } } populateVoiceList(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.onvoiceschanged = populateVoiceList; } inputForm.onsubmit = function(event) { event.preventDefault(); var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = voiceSelect.selectedOptions[0].getAttribute('data-name'); for(i = 0; i < voices.length ; i++) { ...
Using writable streams - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); The write() method contains a promise including code that decodes each written chunk into a form...
StylePropertyMapReadOnly.get() - Web APIs
rieve all computed styles with computedStyleMap() const styleMap = myElement.computedStyleMap(); // array of properties we're interested in const ofInterest = ['font-weight', 'border-left-color', 'color', '--colour']; // iterate thru our properties of interest for ( let i = 0; i < ofInterest.length; i++ ) { // properties const cssProperty = document.createElement('dt'); cssProperty.appendChild(document.createTextNode(ofInterest[i])); stylesList.appendChild(cssProperty); // values const cssValue = document.createElement('dd'); cssValue.appendChild(document.createTextNode( styleMap.get(ofInterest[i]))); stylesList.appendChild(cssValue); } Specifications Specification Status Comment CSS Typed OM Level 1The definition of 'get()' in that specification...
TextRange - Web APIs
Web › API › TextRange
n the text of the specified element. Can only be used on Element objects. TextRange.parentElement() Returns the parent element of the range, which is the smallest element that contains the range completely. If the selection contains more than one element, when you modify the contents of the selection, the contents will be placed in the corresponding position of the parent element instead of the child element. TextRange.pasteHTML() Paste the HTML content into the given range and replace any previous text and HTML elements in the range. TextRange.queryCommandEnabled() Returns a Boolean indicating whether the specified command can be executed successfully with the execCommand method in the current state of the given document. You can also see Document.queryCommandEnabled(). TextRange.queryC...
TextTrack: cuechange event - Web APIs
ck.oncuechange = function () { let cues = track.activeCues; // array of current cues } On the track element The underlying TextTrack, indicated by the track property, receives a cuechange event every time the currently-presented cue is changed. This happens even if the track isn't associated with a media element. If the track is associated with a media element, using the <track> element as a child of the <audio> or <video> element, the cuechange event is also sent to the HTMLTrackElement. let textTrackElem = document.getElementById("texttrack"); textTrackElem.addEventListener("cuechange", (event) => { let cues = event.target.track.activeCues; }); In addition, you can use the oncuechange event handler: let textTrackElem = document.getElementById("texttrack"); textTrackElem.oncuechan...
TreeWalker.nextNode() - Web APIs
t also moves the current node to this one. If no such node exists, returns null and the current node is not changed. Syntax node = treeWalker.nextNode(); Example var treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }, false ); var node = treeWalker.nextNode(); // returns the first child of root, as it is the next node in document order Specifications Specification Status Comment DOMThe definition of 'TreeWalker.nextNode' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range Specification Document Object Model (DOM) Level 2 Traversal and Range SpecificationThe definition of 'TreeWal...
TreeWalker.nextSibling() - Web APIs
the current Node to its next sibling, if any, and returns the found sibling. If there is no such node, return null and the current node is not changed. Syntax node = treeWalker.nextSibling(); Example var treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_ELEMENT, { acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } }, false ); treeWalker.firstChild(); var node = treeWalker.nextSibling(); // returns null if the first child of the root element has no sibling Specifications Specification Status Comment DOMThe definition of 'TreeWalker.nextSibling' in that specification. Living Standard No change from Document Object Model (DOM) Level 2 Traversal and Range Specification Document Object Model (DOM) Leve...
TreeWalker.whatToShow - Web APIs
The TreeWalker.whatToShow read-only property returns an unsigned long being a bitmask made of constants describing the types of Node that must to be presented. Non-matching nodes are skipped, but their children may be included, if relevant. The possible values are: Constant Numerical value Description NodeFilter.SHOW_ALL -1 (that is the max value of unsigned long) Shows all nodes. NodeFilter.SHOW_ATTRIBUTE 2 Shows attribute Attr nodes. This is meaningful only when creating a TreeWalker with an Attr node as its root; in this case, it means that the attribute node will appear in the first position of the iteration or traversal. Since attributes are never children of other nodes, they do not appear when traversing over the document tree. No...
URL API - Web APIs
Web › API › URL API
ort the parameter list before generating the table. function fillTableWithParameters(tbl) { let url = new URL(document.location.href); url.searchParams.sort(); let keys = url.searchParams.keys(); for (let key of keys) { let val = url.searchParams.get(key); let row = document.createElement("tr"); let cell = document.createElement("td"); cell.innerText = key; row.appendChild(cell); cell = document.createElement("td"); cell.innerText = val; row.appendChild(cell); tbl.appendChild(row); }; } A working version of this example can be found on Glitch. Just add parameters to the URL when loading the page to see them in the table. For instance, try https://url-api.glitch.me?from=mdn&excitement=high&likelihood=inconceivable. Specifications Specif...
A basic 2D WebGL animation example - Web APIs
ogram is linked using gl.linkProgram(). If an error occurrs while linking the program, the error message is logged to console. Finally, the compiled program is returned to the caller. Compiling an individual shader The compileShader() function, below, is called by buildShaderProgram() to compile a single shader. ...
A simple RTCDataChannel sample - Web APIs
sugar -- the input box is emptied and re-focused so the user can immediately begin typing another message. Receiving messages When a "message" event occurs on the remote channel, our handleReceiveMessage() method is called as the event handler. function handleReceiveMessage(event) { var el = document.createElement("p"); var txtNode = document.createTextNode(event.data); el.appendChild(txtNode); receiveBox.appendChild(el); } This method simply performs some basic DOM injection; it creates a new <p> (paragraph) element, then creates a new Text node containing the message text, which is received in the event's data property. This text node is appended as a child of the new element, which is then inserted into the receiveBox block, thereby causing it to draw in the browser ...
Web Video Text Tracks Format (WebVTT) - Web APIs
lier In the above example it can be observed that we can use the identifier and pseudo class name for defining the language of caption, where <i> tag is for italics. The type of pseudo class is determined by the selector it is using and working is similar in nature as it works in HTML. Following CSS pseudo classes can be used: Lang (Lanugage): e.g., p:lang(it). Link: e.g., a:link. Nth-last-child: e.g., p:nth-last-child(2). Nth-child(n): e.g., p:nth-child(2). Where p and a are the tags which are used in HTML for paragraph and link, respectively and they can be replaced by identifiers which are used for Cues in WebVTT file. Specifications Specification Status Comment WebVTT: The Web Video Text Tracks Format Candidate Recommendation Initial definition ...
Inputs and input sources - Web APIs
I applications. The most notable--but not the only--difference is that WebXR adds the xr-standard gamepad mapping, expanding the GamepadMappingType enumerated type. This gamepad mapping defines how the controls on a typical one-hand handheld VR controller are mapped to gamepad controls. For details on the gamepad mapping as well as the other differences how the use of the Gamepad object and its children differs from its use in the Gamepad API, see the article Supporting advanced controllers and gamepads in WebXR applications. Incorporating input from non-WebXR sources Sometimes, you need to have a way to let the user provide input using controllers which are external to WebXR. Most commonly, these inputs are from keyboards and mice, but you could also use non-XR gamepad devices, network in...
Using the Web Animations API - Web APIs
We can do this by setting a decay on her animation's playbackRate. We use updatePlaybackRate() instead of setting the playbackRate directly since that produces a smooth update: setInterval( function() { // Make sure the playback rate never falls below .4 if (redQueen_alice.playbackRate > .4) { redQueen_...
Web Animations API Concepts - Web APIs
l the animation's playback relies on this timeline: seeking the animation moves the animation's position along the timeline; slowing down or speeding up the playback rate condenses or expands its spread across the timeline; repeating the animation lines up additional iterations of it along the timeline. In the future, we might have timelines based on gestures or scroll position or even parent and child timelines. The Web Animations API opens up so many possibilities! Animation The animation model can be thought of as an array of snapshots of what the animation could look like at any given time, lined up along the duration of the animation. Core Concepts Web animations consist of Timeline Objects, Animation Objects, and Animation Effect Objects working together. By assembling these dispara...
Advanced techniques: Creating and sequencing audio - Web APIs
let drawNote = lastNoteDrawn; let currentTime = audioCtx.currentTime; while (notesInQueue.length && notesInQueue[0].time < currentTime) { drawNote = notesInQueue[0].note; notesInQueue.splice(0,1); // remove note from queue } // We only need to draw if the note has moved. if (lastNoteDrawn != drawNote) { pads.forEach(function(el, i) { el.children[lastNoteDrawn].style.borderColor = 'hsla(0, 0%, 10%, 1)'; el.children[drawNote].style.borderColor = 'hsla(49, 99%, 50%, 1)'; }); lastNoteDrawn = drawNote; } // set up to draw again requestAnimationFrame(draw); } Putting it all together Now all that's left to do is make sure we've loaded the sample before we are able to play the instrument. We'll add a...
Using IIR filters - Web APIs
's get our response data: iirFilter.getFrequencyResponse(myFrequencyArray, magResponseOutput, phaseResponseOutput); We can use this data to draw a filter frequency plot. We'll do so on a 2d canvas context. ...
Web Authentication API - Web APIs
a credential for logging in to a service using an un-phishable and data-breach resistant asymmetric key pair instead of a password. AuthenticatorResponse The base interface for AuthenticatorAttestationResponse and AuthenticatorAssertionResponse, which provide a cryptographic root of trust for a key pair. Returned by CredentialsContainer.create() and CredentialsContainer.get(), respectively, the child interfaces include information from the browser such as the challenge origin. Either may be returned from PublicKeyCredential.response. AuthenticatorAttestationResponse Returned by CredentialsContainer.create() when a PublicKeyCredential is passed, and provides a cryptographic root of trust for the new key pair that has been generated. AuthenticatorAssertionResponse Returned by CredentialsCon...
Window.crypto - Web APIs
Web › API › Window › crypto
Although window.crypto is available on all windows, the returned Crypto object only has one usable feature in insecure contexts: the getRandomValues() method. ...
Window.customElements - Web APIs
Specification Specification Status Comment HTML Living StandardThe definition of 'window.customElements' in that specification. Living Standard Initial definition. Browser compatibility The compatibility table in this page is generated from structured dat...
Window.speechSynthesis - Web APIs
voices = synth.getVoices(); for(i = 0; i < voices.length ; i++) { var option = document.createElement('option'); option.textContent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textContent += ' -- DEFAULT'; } option.setAttribute('data-lang', voices[i].lang); option.setAttribute('data-name', voices[i].name); voiceSelect.appendChild(option); } } populateVoiceList(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.onvoiceschanged = populateVoiceList; } inputForm.onsubmit = function(event) { event.preventDefault(); var utterThis = new SpeechSynthesisUtterance(inputTxt.value); var selectedOption = voiceSelect.selectedOptions[0].getAttribute('data-name'); for(i = 0; i < voices.length ; i++) { ...
Window - Web APIs
Web › API › Window
nloaded. Also available via the onbeforeunload property. DOMContentLoaded Fired when the document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading. load Fired when the whole page has loaded, including all dependent resources such as stylesheets images. Also available via the onload property. unload Fired when the document or a child resource is being unloaded. Also available via the onunload property. Manifest events appinstalled Fired when the browser has successfully installed a page as an application. Also available via the onappinstalled property. beforeinstallprompt Fired when a user is about to be prompted to install a web application. Also available via the onbeforeinstallprompt property. Messaging events...
WritableStream.WritableStream() - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStream.getWriter() - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStream - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStreamDefaultWriter.WritableStreamDefaultWriter() - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStreamDefaultWriter.close() - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStreamDefaultWriter.write() - Web APIs
= new WritableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer exa...
WritableStreamDefaultWriter - Web APIs
ableStream({ // Implement the sink write(chunk) { return new Promise((resolve, reject) => { var buffer = new ArrayBuffer(2); var view = new Uint16Array(buffer); view[0] = chunk; var decoded = decoder.decode(view, { stream: true }); var listItem = document.createElement('li'); listItem.textContent = "Chunk decoded: " + decoded; list.appendChild(listItem); result += decoded; resolve(); }); }, close() { var listItem = document.createElement('li'); listItem.textContent = "[MESSAGE RECEIVED] " + result; list.appendChild(listItem); }, abort(err) { console.log("Sink error:", err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Si...
XMLSerializer.serializeToString() - Web APIs
the resulting XML There are some things worth noting about the XML output by serializeToString(): For XML serializations, Element and Attr nodes are always serialized with their namespaceURI intact. This may mean that a previously-specified prefix or default namespace may be dropped or altered. The resulting XML is compatible with the HTML parser. Elements in the HTML namespace that have no child nodes (thereby representing empty tags) are serialized with both begin and end tags ("<someelement></someelement>") instead of using the empty-element tag ("<someelement/>"). Specifications Specification Status Comment DOM Parsing and SerializationThe definition of 'serializeToString()' in that specification. Working Draft ...
XSLT Basic Example - Web APIs
. An XSLT stylesheet starts with the xsl:stylesheet element, which contains all the templates used to create the final output. The example in Figure 1 has two templates - one that matches the root node and one that matches Author nodes. The template that matches the root node outputs the article's title and then says to process all templates (via apply-templates) that match Author nodes which are children of the Authors node. Figure 1 : Simple XSLT Example XML Document (example.xml) : <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="example.xsl"?> <Article> <Title>My Article</Title> <Authors> <Author>Mr. Foo</Author> <Author>Mr. Bar</Author> </Authors> <Body>This is my article text.</Body> </Article> XSL Stylesheet (example.xsl) : <?xml version="1.0"?> <xsl:styl...
XSLTProcessor - Web APIs
ms the node source applying the stylesheet given importing using the XSLTProcessor.importStylesheet() function. The resultant object depends on the output method of the stylesheet: Output method Result type html HTMLDocument xml XMLDocument text XMLDocument with a single root element <transformiix:result> with the text as a child [Throws] void XSLTProcessor.setParameter(String namespaceURI, String localName, any value) Sets a parameter in the XSLT stylesheet that was imported. (Sets the value of an <xsl:param>.) A null value for namespaceURI is treated the same as an empty string. [Throws] any XSLTProcessor.getParameter(String namespaceURI, String localName) Gets the value of a parameter from the XSLT style...
Using the aria-invalid attribute - Accessibility
alid) { elem.setAttribute("aria-invalid", "true"); updateAlert(aMsg); } else { elem.setAttribute("aria-invalid", "false"); updateAlert(); } } The snippet below shows the alert functions, which add (or remove) the error message: function updateAlert(msg) { var oldAlert = document.getElementById("alert"); if (oldAlert) { document.body.removeChild(oldAlert); } if (msg) { var newAlert = document.createElement("div"); newAlert.setAttribute("role", "alert"); newAlert.setAttribute("id", "alert"); var content = document.createTextNode(msg); newAlert.appendChild(content); document.body.appendChild(newAlert); } } Note that the alert has the ARIA role attribute set to "alert." Working ...
Using the group role - Accessibility
t are dynamically created by a script or assistive technologies); a group should not be considered a major perceivable section on a page. When the role is added to an element, the browser will send out an accessible group event to assistive technology products which can then notify the user about it. A group should be used to form a logical collection of items with related functionality, such as children in a tree widget forming a collection of siblings in a hierarchy, or a collection of items having the same container in a directory. However, when a group is used in the context of list, authors must limit its children to listitem elements. Group elements may be nested. Proper handling of a group by assistive technologies is determined by the context in which it is provided. If an author bel...
Using the presentation role - Accessibility
This technique demonstrates how to use the presentation role and describes the effect it has on browsers and assistive technology. The presentation role is used to remove semantic meaning from an element and any of its related child elements. For example, a table used for layout purposes could have the presentation role applied to the table element to remove any semantic meaning from the table element and any of its table related children elements, such as table headers and table data elements. Non-table related elements should retain their semantic meaning, however. Possible effects on user agents and assistive technology Note: Opinions may differ on how assistive technology should handle this technique. The information provided above is one of those opinions and therefore not norm...
Using ARIA: Roles, states, and properties - Accessibility
ssibility API, and does not affect a page's DOM. Roles Widget roles button checkbox gridcell link menuitem menuitemcheckbox menuitemradio option progressbar radio scrollbar searchbox separator (when focusable) slider spinbutton switch tab tabpanel textbox treeitem Composite roles The techniques below describe each composite role as well as their required and optional child roles. combobox grid (including row, gridcell, rowheader, columnheader roles) listbox (including option role) menu menubar radiogroup (see radio role) tablist (including tab and tabpanel roles) tree treegrid Document structure roles application article cell columnheader definition directory document feed figure group heading img list listitem math none note pre...
ARIA: application role - Accessibility
This role should only be used to define very dynamic and desktop-like web applications. <div role="application">...</div> This defines this div element and all of its descendants to be treated like they are part of a desktop application. Description The application role indicates to assistive technologies that this part of the web content contains elements that do not conform to any other known HTML element or WAI-ARIA widget. ...
ARIA: article role - Accessibility
lications (WAI-ARIA) 1.1The definition of 'article' in that specification. Recommendation WAI-ARIA Authoring PracticesThe definition of 'feed' in that specification. Working Draft Precedence order This role corresponds to the <article> element in HTML, and that element should be used instead, if possible. This role does not require any specific roles to be present among its children. It is the only role allowed as a direct child of an element with the feed role. See Also feed role section role <article> element RSS Article ...
ARIA: gridcell role - Accessibility
The gridcell role is used to make a cell in a grid or treegrid. It is intended to mimic the functionality of the HTML td element for table-style grouping of information. <div role="gridcell">Potato</div> <div role="gridcell">Cabbage</div> <div role="gridcell">Onion</div> Elements that have role="gridcell" applied to them must be the child of an element with a role of row. <div role="row"> <div role="gridcell">Jane</div> <div role="gridcell">Smith</div> <div role="gridcell">496-619-5098</div> ... </div> The first rule of ARIA is if a native HTML element or attribute has the semantics and behavior you require, use it instead of re-purposing an element and adding ARIA. Instead use the native HTML td element in conjunction with the and contenteditable attribute: <td>Potato</td> <td>...
ARIA: Listitem role - Accessibility
ng list, recipe steps, driving directions. Warning: If at all possible in your work, you should use the appropriate semantic HTML elements to mark up a list and its listitems -- <ul>/<ol> and <li>. See Best practices for a full example. Associated WAI-ARIA Roles, States, and Properties list A list of items. Elements with role list must have one or more elements with the role listitem as children, a one or more elements with the role of group that have one or more elements with the listitem role as children. group A collection of related objects, limited to list items when nested in a list, not important enough to have their own place in a pages table of contents. Keyboard Interactions None. Required JavaScript features None. Examples ARIA Lists -- some useful examples ...
ARIA: img role - Accessibility
ria-labelledby="image-1"> ... <p id="image-1">Text that describes the group of images.</p> </div> SVG and role="img" If you are using embedded SVG images in your page, it is a good idea to set role="img" on the outer <svg> element and give it a label. This will cause screen readers to just consider 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, through certain media, or implied in certain ways. This is obvious to fix in the case of images (you can u...
ARIA: rowgroup role - Accessibility
in, or owned by, elements with either the table or grid role. Using the native <thead>, <tfoot> , and <tbody> HTML elements, whenever possible, is strongly encouraged. To create an ARIA table header, table footer or table body, add role="rowgroup" to the element. That rowgroup should be nested within a grid, table or treegrid, encompassing a group of one or more rows. Each row, in turn, contains child cells. These cells can be of different types, depending on whether they are column or row headers, or plain or grid cells. Note: Using the native HTML table element (<table>) along with the table header (<thead>), footer (<tfoot>), and body (<tbody>) elements whenever possible is strongly encouraged. Associated WAI-ARIA roles, states, and properties Context roles role="table" One of the...
ARIA: button role - Accessibility
input element let newNameInput = document.getElementById('newName'); let name = newNameInput.value; newNameInput.value = ''; // clear the text field newNameInput.focus(); // give the text field focus to enable entering and additional name. // Don't add blank entries to the list. if(name.length > 0) { listItem = document.createElement('li'); listItem.appendChild(document.createTextNode(name)); // Add the new name to the list. let list = document.getElementById('nameList'); list.appendChild(listItem); } } Toggle button example In this snippet a <span> element is converted to a toggle button using the button role and the aria-pressed attribute. When the button is activated, the aria-pressed value switches states; changing f...
WAI-ARIA Roles - Accessibility
es ARIA: alert roleThe alert role can be used to tell the user an element has been dynamically updated. Screen readers will instantly start reading out the updated content when the role is added. If the user is expected to close the alert, then the alertdialog role should be used instead.ARIA: application roleThe application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop application, and no traditional HTML interpretation techniques should be used. This role should only be used to define very dynamic and desktop-like web applications.ARIA: article roleThe article role indicates a section of a page that could easily stand on its own on a page, in a document, or on a website. It is usually set on related content items such ...
Accessibility documentation index - Accessibility
dynamically updated. Screen readers will instantly start reading out the updated content when the role is added. If the user is expected to close the alert, then the alertdialog role should be used instead. 52 ARIA: application role ARIA, ARIA Role, ARIA widget, Reference, Role application The application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop application, and no traditional HTML interpretation techniques should be used. This role should only be used to define very dynamic and desktop-like web applications. 53 ARIA: article role ARIA, ARIA Role, ARIA article role, Article, Article role, Reference The article role indicates a section of a page that could easily stand on its ...
Web accessibility for seizures and physical reactions - Accessibility
ess), and disorientation are very nonspecific symptoms associated with all kinds of diseases and not particularly suggestive of seizures (except maybe disorientation, which is seen in seizures). However, seizures are not the only adverse physical response possible from flashing, flickering, blnking, and other such stimuli. In 1997, a Japanese cartoon featured an animated "virus bomb". Some of the children watching the cartoon reacted by having seizures, others by suffering nausea, shaking, and vomitting blood. The reactions from the children were so severe, they had to be rushed to the emergency room. The physical disorders listed below are all possible consequences: each of these physical reactions may be so severe as to be incapacitating. Seizures Vestibuler Disordera Migraines Nausea ...
Understandable - Accessibility
liably read out by screenreaders. A better way to handle this is to again provide links to glossary pages containing the acronym expansion and explanation, or at the very least include them in the surrounding text in context. See Abbreviations. 3.1.5 Reading Level (AAA) If text is provided that requires a higher reading level that lower secondary education level (typically children around 11-14 years old), provide supplementary explainer material to help people who can't read it, or provide an alternative version that is written at lower secondary level. This doesn't mean that all subject matter should be understood by everyone, but that the style of writing should be accessible by everyone. It is better to just write all content at lower secondary level, even techn...
-moz-context-properties - CSS: Cascading Style Sheets
If you reference an SVG image in a webpage (such as with the <img> element or as a background image), the SVG image can coordinate with the embedding element (its context) to have the image adopt property values set on the embedding element. ...
:-moz-first-node - CSS: Cascading Style Sheets
Note: Any whitespace at the start of an element is ignored for the determination of :-moz-first-node. Syntax :-moz-first-node Examples CSS span:-moz-first-node { background-color: lime; } HTML <p> <span>This matches!</span> <span>This doesn't match.</span> </p> <p> Blahblah. ...
:-moz-only-whitespace - CSS: Cascading Style Sheets
Note: In Selectors Level 4 the :empty selector was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. The :-moz-only-whitespace CSS pseudo-class matches elements that only contains text nodes that only contain whitespace. ...
::-webkit-progress-bar - CSS: Cascading Style Sheets
Note: For ::-webkit-progress-value to take effect, appearance needs to be set to none on the <progress> element. ...
::-webkit-progress-value - CSS: Cascading Style Sheets
Note: In order to let ::-webkit-progress-value take effect, -webkit-appearance needs to be set to none on the <progress> element. Syntax ::-webkit-progress-value Examples This example will only work in browsers based on Blink or WebKit. ...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
It is often used to add cosmetic content to an element with the content property. It is inline by default. /* Add an arrow after links */ a::after { content: "->"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. Syntax /* CSS3 syntax */ ::after /* CSS2 syntax */ :after Note: CSS3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :after, introduced in CSS2. ...
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
It is often used to add cosmetic content to an element with the content property. It is inline by default. /* Add a heart before links */ a::before { content: "<3"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. Syntax /* CSS3 syntax */ ::before /* CSS2 syntax */ :before Note: CSS3 introduced the ::before notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :before, introduced in CSS2. ...
::part() - CSS: Cascading Style Sheets
Web › CSS › ::part
Working Draft Initial definition. ...
:defined - CSS: Cascading Style Sheets
Web › CSS › :defined
om our defined-pseudo-class demo (see it live also). ...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
Children can be either element nodes or text (including whitespace). Comments, processing instructions, and CSS content do not affect whether an element is considered empty. Note: In Selectors Level 4 the :empty pseudo-class was changed to act like :-moz-only-whitespace, but no browser currently supports this yet. /* Selects any <div> that contains no content */ div:empty { background: lime; } Syntax :empty Examples HTML <div class="box"><!-- I will be lime. --></div> <div class="box">I will be pink.</div> <div class="box"> <!-- I will be pink in older browsers because of the whitespace around this comment. ...
:first - CSS: Cascading Style Sheets
Web › CSS › :first
You can only change the margins, orphans, widows, and page breaks of the document. Furthermore, you may only use absolute-length units when defining the margins. All other properties will be ignored. ...
:has() - CSS: Cascading Style Sheets
Web › CSS › :has
d only be used with functions like document.querySelector(); this was due to performance concerns. This limitation has been removed because no browser implemented it that way. Instead, browsers currently only support the use of :has() within stylesheets. Examples Matching <a> elements that directly contain an <img> The following selector matches only <a> elements that directly contain an <img> child: a:has(> img) Matching <h1> elements that are followed by a <p> The following selector matches <h1> elements only if they have a <p> element directly following them: h1:has(+ p) Specifications Specification Status Comment Selectors Level 4The definition of ':has()' in that specification. Working Draft Initial definition Browser compatibility The co...
:host-context() - CSS: Cascading Style Sheets
ample</context-span></a></h1> Inside 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(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ...
:host - CSS: Cascading Style Sheets
Web › CSS › :host
ample</context-span></a></h1> Inside 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(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ...
:lang() - CSS: Cascading Style Sheets
Web › CSS › :lang
aders). For other document types there may be other document methods for determining the language. Syntax Formal syntax :lang( <language-code> ) Parameter <language-code> A <string> representing the language you want to target. Acceptable values are specified in the HTML spec. Examples In this example, the :lang() pseudo-class is used to match the parents of quote elements (<q>) using child combinators. Note that this doesn't illustrate the only way to do this, and that the best method to use depends on the type of document. Also note that Unicode values are used to specify some of the special quote characters. HTML <div lang="en"><q>This English quote has a <q>nested</q> quote inside.</q></div> <div lang="fr"><q>This French quote has a <q>nested</q> quote inside.</q></div> <div l...
:nth-last-of-type() - CSS: Cascading Style Sheets
counting backwards from the last one */ p:nth-last-of-type(4n) { color: lime; } Note: This pseudo-class is essentially the same as :nth-of-type, except it counts items backwards from the end, not forwards from the beginning. Syntax The nth-last-of-type pseudo-class is specified with a single argument, which represents the pattern for matching elements, counting from the end. See :nth-last-child for a more detailed explanation of its syntax. Formal syntax :nth-last-of-type( <nth> )where <nth> = <an-plus-b> | even | odd Examples HTML <div> <span>This is a span.</span> <span>This is another span.</span> <em>This is emphasized.</em> <span>Wow, this span gets limed!!!</span> <strike>This is struck through.</strike> <span>Here is one last span.</span> </div> CSS span:nth-l...
:nth-of-type() - CSS: Cascading Style Sheets
The :nth-of-type() CSS pseudo-class matches elements of a given type (tag name), based on their position among a group of siblings. /* Selects every fourth <p> element among any group of siblings */ p:nth-of-type(4n) { color: lime; } Syntax The nth-of-type pseudo-class is specified with a single argument, which represents the pattern for matching elements. See :nth-child for a more detailed explanation of its syntax. Formal syntax :nth-of-type( <nth> )where <nth> = <an-plus-b> | even | odd Examples Basic example HTML <div> <div>This element isn't counted.</div> <p>1st paragraph.</p> <p>2nd paragraph.</p> <div>This element isn't counted.</div> <p>3rd paragraph.</p> <p class="fancy">4th paragraph.</p> </div> CSS /* Odd paragraphs */ p:nth-of-type(2n+1) { color: re...
:only-of-type - CSS: Cascading Style Sheets
olor: lime; } Note: As originally defined, the selected element had to have a parent. Beginning with Selectors Level 4, this is no longer required. Syntax :only-of-type Examples Styling elements with no siblings of the same type HTML <main> <div>I am `div` #1.</div> <p>I am the only `p` among my siblings.</p> <div>I am `div` #2.</div> <div>I am `div` #3. <i>I am the only `i` child.</i> <em>I am `em` #1.</em> <em>I am `em` #2.</em> </div> </main> CSS main :only-of-type { color: red; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':only-of-type' in that specification. Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':o...
:scope - CSS: Cascading Style Sheets
Web › CSS › :scope
tches the element on which it's called. JavaScript let paragraph = document.getElementById("para"); let output = document.getElementById("output"); if (paragraph.matches(":scope")) { output.innerText = "Yep, the element is its own scope as expected!"; } HTML <p id="para"> This is a paragraph. It is not an interesting paragraph. Sorry about that. </p> <p id="output"></p> Result Direct children A situation where the :scope pseudo-class prove to be useful is when you need to get direct descendant of an already retrieved Element. JavaScript var context = document.getElementById('context'); var selected = context.querySelectorAll(':scope > div'); document.getElementById('results').innerHTML = Array.prototype.map.call(selected, function (element) { return '#' + element.getAttribu...
:where() - CSS: Cascading Style Sheets
Web › CSS › :where
my aside content. This <a href="https://developer.mozilla.org">also contains a link</a>. </aside> <footer class="where-styling"> <p>This is my footer, also containing <a href="https://github.com/mdn">a link</a>. </footer> </article> In this somewhat-contrived example, we have two articles that each contain a section, an aside, and a footer. They differ by the classes used to mark the child elements. To make selecting the links inside them simpler, but still distinct, we could use :is() or :where(), in the following manner: html { font-family: sans-serif; font-size: 150%; } :is(section.is-styling, aside.is-styling, footer.is-styling) a { color: red; } :where(section.where-styling, aside.where-styling, footer.where-styling) a { color: orange; } However, what if we later ...
display-mode - CSS: Cascading Style Sheets
The feature query applies regardless of whether a web app manifest is present. ...
Adjacent sibling combinator - CSS: Cascading Style Sheets
/* Paragraphs that come immediately after any image */ img + p { font-weight: bold; } Syntax former_element + target_element { style properties } Examples CSS li:first-of-type + li { color: red; } HTML <ul> <li>One</li> <li>Two!</li> <li>Three</li> </ul> Result Specifications Specification Status Comment Selectors Level 4The definition of 'next-sibling combinator' in that specification. ...
Detecting CSS animation support - CSS: Cascading Style Sheets
Otherwise, we can use JavaScript to create the desired CSS animation effects. Setting the animation property is easy; simply update its value in the style collection. However, adding keyframes is trickier, since they're not defined using traditio...
Using CSS animations - CSS: Cascading Style Sheets
It simply looks at the event.type to determine which kind of animation event occurred, then adds an appropriate note to the <ul> (unordered list) we're using to log these events. The output, when all is said and done, looks something like this: Started: elapsed time is 0 New loop started at time 3.01200008392334 New loop started at time 6.006000041961...
Spanning and Balancing Columns - CSS: Cascading Style Sheets
his guide is not as well supported across browsers as the functionality covered in the previous two sections in this guide. Spanning the Columns To cause an item to span across columns use the property column-span with a value of all. This will cause the element to span all of the columns. Any descendant element of the multicol container may become a spanner including both direct and indirect children. For example, a heading nested directly inside the container could become a spanner, as could a heading nested inside a section nested inside the multicol container. In the example below, the h2 element is set to column-span: all and spans all of the columns. In this second example, the heading is inside an <article> element, yet still spans the content as expected. When a spanner is in...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
nymous boxes to represent these items so that you do not need to wrap each item in a wrapper to represent the HTML table row, and a second one to represent the table element itself, You can't see or style these anonymous boxes; they are there purely to fix up the tree. If you then declare display: flex on the parent item, these anonymous boxes do not get created and so your item remains a direct child and can become a flex item -- losing any of the table display features. "Note: Some values of display normally trigger the creation of anonymous boxes around the original box. If such a box is a flex item, it is blockified first, and so anonymous box creation will not happen. For example, two contiguous flex items with display: table-cell will become two separate display: block flex items, inst...
Basic concepts of flexbox - CSS: Cascading Style Sheets
er than left and right becomes natural, and will be useful to you when dealing with other layout methods such as CSS Grid Layout which follow the same patterns. The flex container An area of a document laid out using flexbox is called a flex container. To create a flex container, we set the value of the area's container's display property to flex or inline-flex. As soon as we do this the direct children of that container become flex items. As with all properties in CSS, some initial values are defined, so when creating a flex container all of the contained flex items will behave in the following way. Items display in a row (the flex-direction property's default is row). The items start from the start edge of the main axis. The items do not stretch on the main dimension, but can shrink. ...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
you need to properly centre one thing inside another, flexbox is the way to do it. As in the above example, make a container into a flex container, and then use either align-items on the parent element or target the flex item itself with align-self. Card layout pushing footer down Whether you use flexbox or CSS Grid to lay out a list of card components, these layout methods only work on direct children of the flex or grid component. This means that if you have variable amounts of content, the card will stretch to the height of the grid area or flex container. Any content inside 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. Flexbox can solve this. We make the card a flex ...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
CSS Flexible Box Layout is a module of CSS that defines a CSS box model optimized for user interface design, and the layout of items in one dimension. In the flex layout model, the children of a flex container can be laid out in any direction, and can "flex" their sizes, either growing to fill unused space or shrinking to avoid overflowing the parent. Both horizontal and vertical alignment of the children can be easily manipulated. Basic Example In the following example a container has been set to display: flex, which means that the three child items become flex items. The value of justify-content has been set to space-between in order to space the items out evenly on the main axis. An equal amount of space is placed between each item with the left and right items being flush with the edges ...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
n the left-hand side of the grid. If you are working in a right-to-left language then line 1 will be the far right of the grid. We will learn more about the interaction between writing modes and grids in a later guide. A basic example As a very simple example we can take a grid with 3 column tracks and 3 row tracks. This gives us 4 lines in each dimension. Inside our grid container I have four child elements. If we do not place these on to the grid in any way they will lay out according to the auto-placement rules, one item in each of the first four cells. If you use the Firefox Grid Highlighter you can see how the grid has defined columns and rows. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > ...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
id lines named col-start. .wrapper { max-width: 1024px; margin: 0 auto; font: 1.2em Helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; background-color: #ffec99; border-radius: 5px; padding: 10px; } .wrapper { display: grid; grid-template-columns: repeat(12, [col-start] 1fr); grid-gap: 20px; } To demonstrate how this grid system works I have four child elements inside my wrapper. <div class="wrapper"> <div class="item1">Start column line 1, span 3 column tracks.</div> <div class="item2">Start column line 6, span 4 column tracks. 2 row tracks.</div> <div class="item3">Start row 2 column line 2, span 2 column tracks.</div> <div class="item4">Start at column line 3, span to the end of the grid (-1).</div> </div> I can then place these o...
CSS Grid Layout - CSS: Cascading Style Sheets
CSS Grid Layout excels at dividing a page into major regions or defining the relationship in terms of size, position, and layer, between parts of a control built from HTML primitives. Like tables, grid layout enables an author to align elements into columns and rows. However, many more layouts are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements. Basic example The example below shows a three-column track grid with new rows created at a minimum of 100 pixels and a maximum of auto. Items have been placed onto the grid using line-based placement. * {box-sizing: border-box;} .wrapper { max-width: 940px; margin: 0 auto; } .wrappe...
Using CSS counters - CSS: Cascading Style Sheets
Using the counters() function, separating text can be inserted between different levels of nested counters. Example of a nested counter CSS ol { counter-reset: section; /* Creates a new instance of the section counter with each ol element */ list-style-type: none; } li::before ...
CSS Scroll Snap - CSS: Cascading Style Sheets
Scroll Snap is the current implementation. ...
Using CSS transitions - CSS: Cascading Style Sheets
ackground-color: #333; transition: all 1s ease-out; } a:hover, a:focus { color: #333; background-color: #fff; } This CSS establishes the look of the menu, with the background and text colors both changing when the element is in its :hover and :focus states. JavaScript examples Care should be taken when using a transition immediately after: adding the element to the DOM using .appendChild() removing an element's display: none; property. This is treated as if the initial state had never occurred and the element was always in its final state. The easy way to overcome this limitation is to apply a window.setTimeout() of a handful of milliseconds before changing the CSS property you intend to transition to. Using transitions to make JavaScript functionality smooth Transitions ar...
General sibling combinator - CSS: Cascading Style Sheets
The general sibling combinator (~) separates two selectors and matches the second element only if it follows the first element (though not necessarily immediately), and both are children of the same parent element. /* Paragraphs that are siblings of and subsequent to any image */ img ~ p { color: red; } Syntax former_element ~ target_element { style properties } Examples CSS p ~ span { color: red; } HTML <span>This is not red.</span> <p>Here is a paragraph.</p> <code>Here is some code.</code> <span>And here is a red span!</span> <code>More code...</code> <span>And this is a red span!</span> Result Specifications Specification Status Comment Selectors Level 4The definition of 'subsequent-sibling combinator' in that specification. Working Draf...
Breadcrumb Navigation - CSS: Cascading Style Sheets
website by providing a breadcrumb trail back to the start page. Requirements The items typically display inline with a separator to indicate a hierarchy between individual pages. Recipe Download this example Note: The example above uses two selectors to insert content before every li except the first one. This could also be achieved using one selector only: .breadcrumb li:not(:first-child)::before { content: "->"; } This solution uses a more complex selector, but requires less rules. Feel free to choose the solution that you prefer. Choices made This pattern is laid out using a simple flex layout demonstrating how a line of CSS can give us our navigation. The separators are added using CSS Generated Content. You could change these to any separator that you like. Accessibil...
align-content - CSS: Cascading Style Sheets
er against the start edge of the alignment container in the cross axis. end The items are packed flush to each other against the end edge of the alignment container in the cross axis. flex-start The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-start side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start. flex-end The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. center The items are packed flush to each other in the center of th...
align-items - CSS: Cascading Style Sheets
In Flexbox, it controls the alignment of items on the Cross Axis. In Grid Layout, it controls the alignment of items on the Block Axis within their grid area. The interactive example below demonstrates some of the values for align-items using grid layout. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
align-self - CSS: Cascading Style Sheets
Working Draft Update to latest syntax definitions. CSS Flexible Box Layout ModuleThe definition of 'align-self' in that specification. Candidate Recommendation ...
background-clip - CSS: Cascading Style Sheets
background-clip property has no effect when specified on it. See "The backgrounds of special elements." Note: For documents whose root element is an HTML element: if the computed value of background-image on the root element is none and its background-color is transparent, user agents must instead propagate the computed values of the background properties from that element's first HTML <body> child element. The used values of that <body> element's background properties are their initial values, and the propagated values are treated as if they were specified on the root element. It is recommended that authors of HTML documents specify the canvas background for the <body> element rather than the HTML element. Syntax /* Keyword values */ background-clip: border-box; background-clip: padding...
border-bottom-width - CSS: Cascading Style Sheets
oall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-bottom-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing bottom border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-bottom-width: thick; } div:nth-child(2) { border-bottom-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-bottom-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-bottom-widt...
border-left-width - CSS: Cascading Style Sheets
Applies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-left-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-left-width: thick; } div:nth-child(2) { border-left-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-left-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-left-width' in th...
border-right-width - CSS: Cascading Style Sheets
pplies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-right-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples Comparing border widths HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-right-width: thick; } div:nth-child(2) { border-right-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-right-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-right-width' i...
border-top-width - CSS: Cascading Style Sheets
ition Initial valuemediumApplies toall elements. It also applies to ::first-letter.InheritednoComputed valuethe absolute length or 0 if border-top-style is none or hiddenAnimation typea length Formal syntax <line-width>where <line-width> = <length> | thin | medium | thick Examples HTML <div>Element 1</div> <div>Element 2</div> CSS div { border: 1px solid red; margin: 1em 0; } div:nth-child(1) { border-top-width: thick; } div:nth-child(2) { border-top-width: 2em; } Result Specifications Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'border-top-width' in that specification. Candidate Recommendation No significant change. CSS Level 2 (Revision 1)The definition of 'border-top-width' in that s...
clear - CSS: Cascading Style Sheets
Web › CSS › clear
sition of later floats, since later floats cannot be positioned higher than earlier ones. The floats that are relevant to be cleared are the earlier floats within the same block formatting context. If an element contains only floated elements, its height collapses to nothing. If you want it to always be able to resize, so that it contains floating elements inside it, you need to self-clear its children. This is called clearfix, and one way to do it is to add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } Syntax /* Keyword values */ clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end; /* Global values */ clear: inherit; clear: initial; clear: unset; Values none Is a key...
Computed value - CSS: Cascading Style Sheets
It is calculated from the specified value by: Handling the special values inherit, initial, unset, and revert. Doing the computation needed to reach the value described in the "Computed value" line in the property's definition table. The computation needed to reach a property's computed value typically involves converting relative values (such as those in em units or percentages) to absolute values. For example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). ...
<display-internal> - CSS: Cascading Style Sheets
This page defines those "internal" display values, which only have meaning within that particular layout mode. Syntax Valid <display-internal> values: table-row-group These elements behave like <tbody> HTML elements. table-header-group These elements behave like <thead> HTML elements. table-footer-group These elements behave like <tfoot> HTML elements. table-row These elements behave like <tr> HTML elements. table-cell These elements behave like <td> HTML elements. ...
<display-outside> - CSS: Cascading Style Sheets
s the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Examples In the following example, span elements (normally displayed as inline elements) are set to display: block and so break onto new lines and expand to fill their container in the inline dimension. HTML <span>span 1</span> <span>span 2</span> CSS span { display: block; border: 1px solid rebeccapurple;...
float - CSS: Cascading Style Sheets
Web › CSS › float
floated element. In this example, there are three colored squares. Two are floated left, and one is floated right. Note that the second "left" square is placed to the right of the first. Additional squares would continue to stack to the right, until they filled the containing box, after which they would wrap to the next line. A floated element is at least as tall as it's tallest nested floated children. We gave the parent width: 100% and floated it to ensure it is tall enough to encompass it's floated children, and to make sure it takes up the width of the parent so we don't have to clear it's adjacent sibling. HTML <section> <div class="left">1</div> <div class="left">2</div> <div class="right">3</div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tristiqu...
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
s static. This is an OS-independent and cross-browser way of literally telling the browsers to render the letters at exactly the number of pixels in height that you specified. The results may vary slightly across browsers, as they may use different algorithms to achieve a similar effect. Font sizing settings can also be used in combination. For example, if a parent element is set to 16px and its child element is set to larger, the child element displays larger than the parent element in the page. Note: Defining font sizes in px is not accessible, because the user cannot change the font size in some browsers. For example, users with limited vision may wish to set the font size much larger than the size chosen by a web designer. Avoid using them for font sizes if you wish to create an inclusive...
height - CSS: Cascading Style Sheets
Web › CSS › height
absolute lengthAnimation typea length, percentage or calc(); Formal syntax auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting height using pixels and percentages HTML <div id="taller">I'm 50 pixels tall.</div> <div id="shorter">I'm 25 pixels tall.</div> <div id="parent"> <div id="child"> I'm half the height of my parent. </div> </div> CSS div { width: 250px; margin-bottom: 5px; border: 2px solid blue; } #taller { height: 50px; } #shorter { height: 25px; } #parent { height: 100px; } #child { height: 50%; width: 75%; } Result Specifications Specification Status Comment CSS Box Sizing Module Level 4The definition of 'h...
inherit - CSS: Cascading Style Sheets
Web › CSS › inherit
ee, even when the parent element is not the containing block. 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 inside the sidebar might be different colors. For example, if one of them were the child of a div matched by the rule ... div#current { color: blue; } ... it would be blue. Specifications Specification Status Comment CSS Cascading and Inheritance Level 4The definition of 'inherit' in that specification. Candidate Recommendation No changes from Level 3. CSS Values and Units Module Level 3The definition of 'inherit' in that specification.
initial-letter-align - CSS: Cascading Style Sheets
height of the first line of text. The baseline of the initial letter aligns with the baseline of the Nth text baseline. hanging The hanging baseline of the initial letter aligns with the hanging baseline of the first line of text. ideographic The initial letter is centered in the N-line area. ...
initial-letter - CSS: Cascading Style Sheets
in terms of how many lines it occupies. Negative values are not allowed. <integer> Defines the number of lines the initial letter should sink when the size of it is given. Values must be greater than zero. If omitted, it duplicates the size value, floored to the nearest positive whole number. ...
justify-content - CSS: Cascading Style Sheets
ch other toward the start edge of the alignment container in the main axis. end The items are packed flush to each other toward the end edge of the alignment container in the main axis. flex-start The items are packed flush to each other toward the edge of the alignment container depending on the flex container's main-start side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start. flex-end The items are packed flush to each other toward the edge of the alignment container depending on the flex container's main-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. center The items are packed flush to each other toward the center of ...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
Editor's Draft Adds the vi, vb, ic, lh, and rlh units. CSS Values and Units Module Level 3The definition of '<length>' in that specification. Candidate ...
max-width - CSS: Cascading Style Sheets
Web › CSS › max-width
itednoPercentagesrefer to the width of the containing blockComputed valuethe percentage as specified or the absolute length or noneAnimation typea length, percentage or calc(); Formal syntax auto | <length> | <percentage> | min-content | max-content | fit-content(<length-percentage>)where <length-percentage> = <length> | <percentage> Examples Setting max width in pixels In this example, the "child" will be either 150 pixels wide or the width of the "parent," whichever is smaller. HTML <div id="parent"> <div id="child"> Fusce pulvinar vestibulum eros, sed luctus ex lobortis quis. </div> </div> CSS #parent { background: lightblue; width: 300px; } #child { background: gold; width: 100%; max-width: 150px; } Result Specifications Specification Status ...
opacity - CSS: Cascading Style Sheets
Web › CSS › opacity
e element is fully transparent (that is, invisible). Any <number> strictly between 0 and 1 The element is translucent (that is, content behind the element can be seen). 1 (default value) The element is fully opaque (visually solid). Description opacity applies to the element as a whole, including its contents, even though the value is not inherited by child elements. Thus, the element and its children all have the same opacity relative to the element's background, even if they have different opacities relative to one another. Using opacity with a value other than 1 places the element in a new stacking context. If you do not want to apply opacity to child elements, use the background property instead. For example: background: rgba(0, 0, 0, 0.4); ...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
first paragraph containing some text.</p> <p>This is the second paragraph containing some more text than the first one. It is used to demonstrate how orphans work.</p> <p>This is the third paragraph. It has a little bit more text than the first one.</p> </div> CSS div { background-color: #8cffa0; height: 150px; columns: 3; orphans: 3; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'orphans' in that specification. Candidate Recommendation Extends orphans to apply to any type of fragment, including pages, regions, or columns. CSS Level 2 (Revision 1)The definition of 'orphans' in that specification. Reco...
Guide to scroll anchoring - CSS: Cascading Style Sheets
he document, out of scroll anchoring. To opt out the entire document, you can set it on the <body> element: body { overflow-anchor: none; } To opt out a certain part of the document use overflow-anchor: none on its container element: .container { overflow-anchor: none; } Note: The specification details that once scroll anchoring has been opted out of, you cannot opt back into it from a child element. For example, if you opt out for the entire document, you will not be able to set overflow-anchor: auto elsewhere in the document to turn it back on for a subsection. Suppression triggers The specification also details some suppression triggers, which will disable scroll anchoring in places where it might be problematic. If any of the triggers happen on the anchor node, or an ancestor ...
page-break-inside - CSS: Cascading Style Sheets
more text.</p> <p>This is the fourth paragraph. It has a little bit more text than the third one.</p> </div> CSS .page { background-color: #8cffa0; height: 90px; width: 200px; columns: 1; column-width: 100px; } .list, ol, ul, p { break-inside: avoid; } p { background-color: #8ca0ff; } ol, ul, .list { margin: 0.5em 0; display: block; background-color: orange; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Paged Media Module Level 3The definition of 'page-break-inside' in that specification. Working Draft Allows this property on more elements. CSS Level 2 (Revision 1)The definition of 'page-break-inside' in that specification. Recommendation Initial definition. ...
perspective-origin - CSS: Cascading Style Sheets
ich the viewer is looking. It is used as the vanishing point by the perspective property. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The perspective-origin and perspective properties are attached to the parent of a child transformed in 3-dimensional space, unlike the perspective() transform function which is placed on the element being transformed. Syntax /* One-value syntax */ perspective-origin: x-position; /* Two-value syntax */ perspective-origin: x-position y-position; /* When both x-position and y-position are keywords, the following is also valid */ perspective-origin: y-position x-position; /* Glo...
place-content - CSS: Cascading Style Sheets
e of the alignment container in the appropriate axis. end The items are packed flush to each other toward the end edge of the alignment container in the appropriate axis. flex-start The items are packed flush to each other toward the edge of the alignment container depending on the flex container's main-start or cross-start side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start. flex-end The items are packed flush to each other toward the edge of the alignment container depending on the flex container's main-end or cross-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. center The items are packed flush to each other toward t...
place-items - CSS: Cascading Style Sheets
edge of the alignment container in the appropriate axis. end The item is packed flush to each other toward the end edge of the alignment container in the appropriate axis. flex-start The item is packed flush to each other toward the edge of the alignment container depending on the flex container's main-start or cross-start side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like start. flex-end The item is packed flush to each other toward the edge of the alignment container depending on the flex container's main-end or cross-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. self-start The item is packed flush to the edge of the ali...
revert - CSS: Cascading Style Sheets
Web › CSS › revert
ascaded value to the user agent's default style. If used within the user agent's default styles, this keyword is functionally equivalent to unset. The revert keyword works exactly the same as unset in many cases. The only difference is for properties that have values set by the browser or by custom stylesheets created by users (set on the browser side). Revert will not affect rules applied to children of an element you reset (but will remove effects of a parent rule on a child). So if you have a color: green for all sections and all: revert on a specific section the color of the section will be black. But if you have a rule to make all paragraphs red then all paragraphs will still be red in all sections. Revert is just a value. It is still possible to override revert value using specifici...
text-decoration-thickness - CSS: Cascading Style Sheets
e browser default. <percentage> Specifies the thickness of the text decoration line as a <percentage> of 1em in the current font. A percentage inherits as a relative value, and so therefore scales with changes in the font. The browser must use a minimum of 1 device pixel. For a given application of this property, the thickness is constant across the whole box it is applied to, even if there are child elements with a different font size. Formal definition Initial valueautoApplies toall elements. It also applies to ::first-letter and ::first-line.InheritednoPercentagesrefer to the font size of the element itselfComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | from-font | <length> | <percentage> Examples Varying thickness HTML <p class="thin">Here's so...
text-decoration - CSS: Cascading Style Sheets
the newer text-decoration-thickness property. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Text decorations are drawn across descendant text elements. This means that if an element specifies a text decoration, then a child element can't remove the decoration. For example, in the markup <p>This text has <em>some emphasized words</em> in it.</p>, the style rule p { text-decoration: underline; } would cause the entire paragraph to be underlined. The style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. However, the rule em { text-decoration: overline; } wo...
text-underline-offset - CSS: Cascading Style Sheets
recommended to use em units so the offset scales with the font size. <percentage> Specifies the offset of underlines as a <percentage> of 1 em in the element's font. A percentage inherits as a relative value, and so therefore scales with changes in the font. For a given application of this property, the offset is constant across the whole box that the underline is applied to, even if there are child elements with different font sizes or vertical alignment. Formal definition Initial valueautoApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesPercentagesrefer to the font size of the element itselfComputed valueas specifiedAnimation typeby computed value type Formal syntax auto | <length> | <percentage> Examples <p class="oneline">Here's some text with...
perspective() - CSS: Cascading Style Sheets
s stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The perspective() transform function is part of the transform value applied on the element being transformed. This differs from the perspective and perspective-origin properties which are attached to the parent of a child transformed in 3-dimensional space. Syntax The perspective distance used by perspective() is specified by a <length> value, which represents the distance between the user and the z=0 plane. The z=0 plane is the plane where everything appears in a 2-dimensional view, or the screen. A positive value makes the element appear closer to the user than the rest of the interface, a negative value farth...
scaleZ() - CSS: Cascading Style Sheets
le factor is 1, in which case the function is the identity transform. The scaling is not isotropic, and the angles of the element are not conserved. scaleZ(-1) defines an axial symmetry, with the z-axis passing through the origin (as specified by the transform-origin property). In the above interactive examples, perspective: 550px; (to create a 3D space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3D space), have been set on the cube. Note: scaleZ(sz) is equivalent to to scale3d(1, 1, sz). Syntax scaleZ(s) Values s Is a <number> representing the scaling factor to apply on the z-coordinate of each point of the element. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 ...
translateZ() - CSS: Cascading Style Sheets
epository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This transformation is defined by a <length> which specifies how far inward or outward the element or elements move. In the above interactive examples, perspective: 550px; (to create a 3D space) and transform-style: preserve-3d; (so the children, the 6 sides of the cube, are also positioned in the 3D space), have been set on the cube. Note: translateZ(tz) is equivalent to translate3d(0, 0, tz). Syntax translateZ(tz) Values tz A <length> representing the z-component of the translating vector. A positive value moves the element towards the viewer, and a negative value farther away. Cartesian coordinates on R2 Ho...
widows - CSS: Cascading Style Sheets
Web › CSS › widows
v> <p>This is the first paragraph containing some text.</p> <p>This is the second paragraph containing some more text than the first one. It is used to demonstrate how widows work.</p> <p>This is the third paragraph. It has a little bit more text than the first one.</p> </div> CSS div { background-color: #8cffa0; columns: 3; widows: 2; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'widows' in that specification. Candidate Recommendation Extends widows to apply to any type of fragment, including pages, regions, or columns. CSS Multi-column Layout ModuleThe definition of 'widows' in that specification. W...
Getting Started - Developer guides
) contains the following: <?xml version="1.0" ?> <root> I'm a test. </root> In the script we only need to change the request line to: ... onclick="makeRequest('test.xml')"> ... Then in alertContents(), we need to replace the line alert(httpRequest.responseText); with: var xmldoc = httpRequest.responseXML; var root_node = xmldoc.getElementsByTagName('root').item(0); alert(root_node.firstChild.data); This code takes the XMLDocument object given by responseXML and uses DOM methods to access some of the data contained in the XML document. You can see the test.xml here and the updated test script here. Step 5 - Working with data Finally, let's send some data to the server and receive a response. Our JavaScript will request a dynamic page this time, test.php, which will take the data w...
Creating and triggering events - Developer guides
reate the event. const event = document.createEvent('Event'); // Define that the event name is 'build'. event.initEvent('build', true, true); // Listen for the event. elem.addEventListener('build', function (e) { // e.target matches elem }, false); // target can be any Element or other EventTarget. ...
Mutation events - Developer guides
}, false); The event object is passed to the listener in a MutationEvent (see its definition in the specification) for most events, and MutationNameEvent for DOMAttributeNameChanged...
Content categories - Developer guides
port scripts, either by containing or specifying script code directly, or by specifying data that will be used by scripts. The script-supporting elements are: <script> <template> Transparent content model If an element has a transparent content model, then its contents must be structured such that they would be valid HTML 5, even if the transparent element were removed and replaced by the child elements. For example, the <del> and <ins> elements are transparent: <p>We hold these truths to be <del><em>sacred &amp; undeniable</em></del> <ins>self-evident</ins>.</p> If those elements were removed, this fragment would still be valid HTML (if not correct English). <p>We hold these truths to be <em>sacred &amp; undeniable</em> self-evident.</p> Other content models Sectioning root. ...
Rich-Text Editing in Mozilla - Developer guides
ecked) { return true ; } alert("Uncheck \"Show HTML\"."); oDoc.focus(); return false; } function setDocMode(bToSource) { var oContent; if (bToSource) { oContent = document.createTextNode(oDoc.innerHTML); oDoc.innerHTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.createRange(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } function printDoc() { if (!validateMode()) { return; } var oPrntWin = ...
Making content editable - Developer guides
ecked) { return true ; } alert("Uncheck \"Show HTML\"."); oDoc.focus(); return false; } function setDocMode(bToSource) { var oContent; if (bToSource) { oContent = document.createTextNode(oDoc.innerHTML); oDoc.innerHTML = ""; var oPre = document.createElement("pre"); oDoc.contentEditable = false; oPre.id = "sourceText"; oPre.contentEditable = true; oPre.appendChild(oContent); oDoc.appendChild(oPre); document.execCommand("defaultParagraphSeparator", false, "div"); } else { if (document.all) { oDoc.innerHTML = oDoc.innerText; } else { oContent = document.createRange(); oContent.selectNodeContents(oDoc.firstChild); oDoc.innerHTML = oContent.toString(); } oDoc.contentEditable = true; } oDoc.focus(); } funct...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
tent from older browsers that don't support SVG or MathML in text/html. The MathML named characters are available for use in named character references everywhere in the document (also in HTML content). To deal with legacy pages where authors have pasted partial SVG fragments into HTML (who knows why) or used a <math> tag for non-MathML purposes, attempts to nest various common HTML elements as children of SVG elements (without foreignObject) will immediately break out of SVG or MathML context. This may make some typos have surprising effects. Performance improvement with speculative parsing Unrelated to the requirements of HTML5 specification, the Gecko 2 parser uses speculative parsing, in which it continues parsing a document while scripts are being downloaded and executed. This results...
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
Maybe that's why color is one of the first things people often want to experiment with when learning to develop websites. With CSS, there are lots of ways to add color to your HTML elements to create just the look you want. This article is a primer introducing each of the ways CSS color can be used in HTML. Fortunately, adding color to your HTML is actually really easy to do, and you can add color to nearly anything. ...
HTML attribute: rel - HTML: Hypertext Markup Language
Web › HTML › Attributes › rel
not part of the current site. This can be used with attribute selectors to style external links in a way that indicates to the user that they will be leaving the current site. help Relevant to <form>, <link>, <a>, and <area>, the help keyword indicates that the linked to content provides context-sensitive help, providing information for the parent of the element defining the hyperlink, and its children. When used within <link>, the help is for the whole document. When included with <a> and <area> and supported, the default cursor will be help instead of pointer. icon Valid with <link>, the linked resource represents the icon, a resource for representing the page in the user interface, for the current document. The most common use for the icon value is the favicon: <link rel="icon" hr...
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
e download to begin. Receiving and saving the image The code that handles the newly-downloaded image is found in the imageReceived() method: function imageReceived() { let canvas = document.createElement("canvas"); let context = canvas.getContext("2d"); canvas.width = downloadedImg.width; canvas.height = downloadedImg.height; context.drawImage(downloadedImg, 0, 0); imageBox.appendChild(canvas); try { localStorage.setItem("saved-image-example", canvas.toDataURL("image/png")); } catch(err) { console.log("Error: " + err); } } imageReceived() is called to handle the "load" event on the HTMLImageElement that receives the downloaded image. This event is triggered once the downloaded data is all available. It begins by creating a new <canvas> element that we'll use t...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
ct, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, heading content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content; don't use a heading element as a child of the <hgroup> element -- it is now deprecated. Implicit ARIA role heading Permitted ARIA roles tab, presentation or none DOM interface HTMLHeadingElement Attributes These elements only include the global attributes. The align attribute is obsolete; don't use it. Usage notes Heading information may be used by user agents, for example, to constru...
<article>: The Article Contents element - HTML: Hypertext Markup Language
Web › HTML › Element › article
st not be a descendant of an <address> element. Implicit ARIA role article Permitted ARIA roles application, document, feed, main, none, presentation, region DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Each <article> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <article> element. When an <article> element is nested, the inner element represents an article related to the outer element. For example, the comments of a blog post can be <article> elements nested in the <article> representing the blog post. Author information of an <article> element can be provided through the <address> element, but it doesn't apply to nested <article> elements. The...
<caption>: The Table Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › caption
f the table. top The caption is displayed above the table. right The caption is displayed to the right of the table. bottom The caption is displayed below the table. Usage note: Do not use this attribute, as it has been deprecated. The <caption> element should be styled using the CSS properties caption-side and text-align. Usage notes The <caption> element should be the first child of its parent <table> element. When the <table> element that contains the <caption> is the only descendant of a <figure> element, you should use the <figcaption> element instead of <caption>. Example This simple example presents a table that includes a caption. <table> <caption>Example Caption</caption> <tr> <th>Login</th> <th>Email</th> </tr> <tr> <td>user1</td> <td>u...
<command>: The HTML Command element - HTML: Hypertext Markup Language
Web › HTML › Element › command
Flow content, phrasing content, metadata content. Permitted content None, it is an empty element. Tag omission The start tag is mandatory, but, as it is a void element, the use of an end tag is forbidden. Permitted parent elements <colgroup> only, though it can be implicitly defined as its start tag is not mandatory. The <colgroup> must not have a <span> as child. DOM interface HTMLCommandElement Attributes This element includes the global attributes. checked Indicates whether the command is selected. Must be omitted unless the type attribute is checkbox or radio. disabled Indicates that the command is not available. icon Gives a picture which represents the command. label The name of the command as shown to the user. radiog...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
The HTML Details Element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the <summary> element. A disclosure widget is typically presented onscreen using a small triangle which rotates (or twists) to indicate open/closed status, with a label next to the triangle. If the first child of the <details> element is a <summary>, the contents of the <summary> element are used as the label for the disclosure widget. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: The common use of a triangle which rot...
<dfn>: The Definition element - HTML: Hypertext Markup Language
Web › HTML › Element › dfn
ne those here. Specifying the term being defined The term being defined is identified following these rules: If the <dfn> element has a title attribute, the value of the title attribute is considered to be the term being defined. The element must still have text within it, but that text may be an abbreviation (perhaps using <abbr>) or another form of the term. If the <dfn> contains a single child element and does not have any text content of its own, and the child element is an <abbr> element with a title attribute itself, then the exact value of the <abbr> element's title is the term being defined. Otherwise, the text content of the <dfn> element is the term being defined. This is shown in the first example below. If the <dfn> element has a title attribute, it must contain the term b...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
es for this element are to implement a glossary or to display metadata (a list of key-value pairs). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, and if the <dl> element's children include one name-value group, palpable content. Permitted content Either: Zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. Or: One or more <div> elements, optionally intermixed with <script> and <template> elements. Tag omission None, both th...
<figcaption>: The Figure Caption element - HTML: Hypertext Markup Language
e to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content Flow content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents A <figure> element; the <figcaption> element must be its first or last child. Implicit ARIA role No corresponding role Permitted ARIA roles group, none, presentation DOM interface HTMLElement Attributes This element only includes the global attributes. Examples Please see the <figure> page for examples on <figcaption>. Specifications Specification Status Comment HTML Living StandardThe definition ...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › figure
t is referenced in the main flow of a document, but that can be moved to another part of the document or to an appendix without affecting the main flow. Being a sectioning root, the outline of the content of the <figure> element is excluded from the main outline of the document. A caption can be associated with the <figure> element by inserting a <figcaption> inside it (as the first or the last child). The first <figcaption> element found in the figure is presented as the figure's caption. Examples Images <!-- Just an image --> <figure> <img src="https://udn.realityripple.com/samples/6c/98485e5d8a.png" alt="The beautiful MDN logo."> </figure> <!-- Image with a caption --> <figure> <img src="https://udn.realityripple.com/samples/6c/98485e5d8a.png" alt="The beautiful MDN logo."...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
ent. Otherwise, one or more elements of metadata content where exactly one is a <title> element. Tag omission The start tag may be omitted if the first thing inside the <head> element is an element. The end tag may be omitted if the first thing following the <head> element is not a space character or a comment. Permitted parents An <html> element, as its first child. Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLHeadElement Attributes This element includes the global attributes. profile The URIs of one or more metadata profiles, separated by white space. Example <!doctype html> <html> <head> <title>Document title</title> </head> </html> Notes H...
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
Specifications Specification Status Comments HTML Living StandardThe definition of '<input type="month">' in that specification. Living Standard ...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
fallbackPicker.style.display = 'block'; fallbackLabel.style.display = 'block'; // populate the hours and minutes dynamically populateHours(); populateMinutes(); } function populateHours() { // populate the hours <select> with the 6 open hours of the day for(var i = 12; i <= 18; i++) { var option = document.createElement('option'); option.textContent = i; hourSelect.appendChild(option); } } function populateMinutes() { // populate the minutes <select> with the 60 minutes of each hour for(var i = 0; i <= 59; i++) { var option = document.createElement('option'); option.textContent = (i < 10) ? ("0" + i) : i; minuteSelect.appendChild(option); } } // make it so that if the hour is 18, the minutes value is set to 00 // -- you can't select times past 18:...
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
Specifications Specification Status Comments HTML Living StandardThe definition of '<input type="week">' in that specification. Living Standard ...
<legend> - HTML: Hypertext Markup Language
Web › HTML › Element › legend
f you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content Phrasing content and headings (h1-h6 elements). Tag omission None, both the starting and ending tag are mandatory. Permitted parents A <fieldset> whose first child is this <legend> element Implicit ARIA role No corresponding role Permitted ARIA roles No role permitted DOM interface HTMLLegendElement Attributes This element only includes the global attributes. Examples See <form> for examples on <legend>. Specifications Specification Status Comment HTML Living StandardThe definition ...
<li> - HTML: Hypertext Markup Language
Web › HTML › Element › li
e. Permitted content Flow content. Tag omission The end tag can be omitted if the list item is immediately followed by another <li> element, or if there is no more content in its parent element. Permitted parents An <ul>, <ol>, or <menu> element. Though not a conforming usage, the obsolete <dir> can also be a parent. Implicit ARIA role listitem when child of an ol, ul or menu Permitted ARIA roles menuitem, menuitemcheckbox, menuitemradio, option, none, presentation, radio, separator, tab, treeitem DOM interface HTMLLIElement Attributes This element includes the global attributes. value This integer attribute indicates the current ordinal value of the list item as defined by the <ol> element. The only allowed val...
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
(stripped of parameters) for same-origin requests. Send the origin when the destination is at least as secure as the current page (HTTP(S)->HTTPS). Otherwise, send no referrer. unsafe-URL Send the full URL (stripped of parameters) for same-origin or cross-origin requests. Notes: Dynamically inserting <meta name="referrer"> (with document.write() or appendChild()) makes the referrer behaviour unpredictable. When several conflicting policies are defined, the no-referrer policy is applied. theme-color: indicates a suggested color that user agents should use to customize the display of the page or of the surrounding user interface. The content attribute contains a valid CSS <color>. Standard metadata names defined in other specifications The...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ol
The HTML <ol> element represents an ordered list of items -- typically rendered as a numbered list. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, and if the <ol> element's children include at least one <li> element, palpable content. Permitted content Zero or more <li>, <script> and <template> elements. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role list Permitted ARIA roles directory, group, listbox, menu, menubar, n...
<rb>: The Ruby Base element - HTML: Hypertext Markup Language
Web › HTML › Element › rb
mic segment of the base text. {{EmbedInteractiveExample("pages/tabbed/rb.html", "tabbed-standard")}} The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories None. Permitted content As a child of a <ruby> element. Tag omission The end tag can be omitted if the element is immediately followed by an <rt>, <rtc>, or <rp> element or another <rb> element, or if there is no more content in the parent element. Permitted parents A <ruby> element. Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the ...
<section>: The Generic Section element - HTML: Hypertext Markup Language
Web › HTML › Element › section
es alert, alertdialog, application, banner, complementary, contentinfo, dialog, document, feed, log, main, marquee, navigation, none, note, presentation, search, status, tabpanel DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Each <section> should be identified, typically by including a heading (<h1>-<h6> element) as a child of the <section> element. If it makes sense to separately syndicate the content of a <section> element, use an <article> element instead. Do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for styling purposes. A rule of thumb is that a section should logically appear in the outline of a document. Example Before <div> ...
<style>: The Style Information element - HTML: Hypertext Markup Language
Web › HTML › Element › style
ecurity-Policy. The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. title This attribute specifies alternative style sheet sets. Deprecated attributes scoped This attribute specifies that the styles only apply to the elements of its parent(s) and children. This attribute may be re-introduced in the future per https://github.com/w3c/csswg-drafts/issues/3547. If you want to use the attribute now, you can use a polyfill. Examples A simple stylesheet In the following example, we apply a very simple stylesheet to a document: <!doctype html> <html> <head> <style> p { color: red; } </style> </head> <body> <p>This is my...
<time> - HTML: Hypertext Markup Language
Web › HTML › Element › time
prior to the introduction of the Gregorian calendar (due to complications in calculating those dates). The datetime value (the machine-readable value of the datetime) is the value of the element's datetime attribute, which must be in the proper format (see below). If the element does not have a datetime attribute, it must not have any element descendants, and the datetime value is the element's child text content. Valid datetime Values a valid year string 2011 a valid month string 2011-11 a valid date string 2011-11-18 a valid yearless date string 11-18 a valid week string 2011-W47 a valid time string 14:54 14:54:39 14:54:39.929 a valid local date and time string 2011-11-18T14:54:39.929 2011-11-18 14:54:39.929 a valid global date and time string 2011-11-18T14:54:39.929Z ...
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
more <td> and/or <th> elements; script-supporting elements (<script> and <template>) are also allowed Tag omission Start tag is mandatory. ...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, and if the <ul> element's children include at least one <li> element, palpable content. Permitted content Zero or more <li>, <script> and <template> elements. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role list Permitted ARIA roles directory, group, listbox, menu, menubar, n...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
the <source> element: the browser will choose the most suitable one. It can also be the destination for streamed media, using a MediaStream. <img> The HTML <img> element embeds an image into the document. <map> The HTML <map> element is used with <area> elements to define an image map (a clickable link area). <track> The HTML <track> element is used as a child of the media elements, <audio> and <video>. It lets you specify timed text tracks (or time-based data), for example to automatically handle subtitles. <video> The HTML Video element (<video>) embeds a media player which supports video playback into the document. You can use <video> for audio content as well, but the <audio> element may provide a more appropriate user experience. ...
tabindex - HTML: Hypertext Markup Language
the document source. The maximum value for tabindex is 32767. If not specified, it takes the default value 0. Avoid using tabindex values greater than 0. Doing so makes it difficult for people who rely on assistive technology to navigate and operate page content. Instead, write the document with the elements in a logical sequence. If you set the tabindex attribute on a <div>, then its child content cannot be scrolled with the arrow keys unless you set tabindex on the content, too. Check out this fiddle to understand the scrolling effects of tabindex. Accessibility concerns Avoid using the tabindex attribute in conjunction with non-interactive content to make something intended to be interactive focusable by keyboard input. An example of this would be using a <div> element to descr...
translate - HTML: Hypertext Markup Language
It can have the following values: empty string or "yes", which indicates that the element should be translated when the page is localized. "no", which indicates that the element must not be translated. Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. ...
Global attributes - HTML: Hypertext Markup Language
dex, their relative order follows their relative positions in the document. title Contains a text representing advisory information related to the element it belongs to. Such information can typically, but not necessarily, be presented to the user as a tooltip. translate An enumerated attribute that is used to specify whether an element's attribute values and the values of its Text node children are to be translated when the page is localized, or whether to leave them unchanged. It can have the following values: empty string and yes, which indicates that the element will be translated. no, which indicates that the element will not be translated. Specifications Specification Status Comment HTML Living StandardThe definition of 'Global attributes...
Preloading content with rel="preload" - HTML: Hypertext Markup Language
odel if the user's resources are more plentiful. Scripting and preloads Another nice thing about these preloads is that you can execute them with script. For example, here we create a HTMLLinkElement instance, then attach it to the DOM: var preloadLink = document.createElement("link"); preloadLink.href = "myscript.js"; preloadLink.rel = "preload"; preloadLink.as = "script"; document.head.appendChild(preloadLink); This means that the browser will preload the myscript.js file, but not actually use it yet. To use it, you could do this: var preloadedScript = document.createElement("script"); preloadedScript.src = "myscript.js"; document.body.appendChild(preloadedScript); This is useful when you want to preload a script, but then defer execution until exactly when you need it. Other resourc...
Microformats - HTML: Hypertext Markup Language
h-event is often used with both event listings and individual event pages <div class="h-event"> <h1 class="p-name">Microformats Meetup</h1> <p>From <time class="dt-start" datetime="2013-06-30 12:00">30<sup>th</sup> June 2013, 12:00</time> to <time...
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
d to configure your web server to return the Content-Security-Policy HTTP header. (Sometimes you may see mentions of the X-Content-Security-Policy header, but that's an older version and you don't need to specify it anymore.) Alternatively, the <meta> element can be used to configure a policy, for example: <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';"> Threats Mitigating cross site scripting A primary goal of CSP is to mitigate and report XSS attacks. XSS attacks exploit the browser's trust of the content received from the server. Malicious scripts are executed by the victim's browser because the browser trusts the source of the content, even when it's not coming from where it seems to be coming from. CSP makes it possible for...
Using Feature Policy - HTTP
herit the policy of their parent page. If the iframe has an allow attribute, the policies of the parent page and the allow attribute are combined, using the most restrictive subset. For an iframe to have a feature enabled, the origin must be in the allowlist for both the parent page and the allow attribute. Disabling a feature in a policy is a one-way toggle. If a feature has been disabled for a child frame by its parent frame, the child cannot re-enable it, and neither can any of the child's descendants. Enforcing best practices for good user experiences It's difficult to build a website that uses all the latest best practices and provides great performance and user experiences. As the website evolves, it can become even harder to maintain the user experience over time. You can use feature ...
CSP: default-src - HTTP
The HTTP Content-Security-Policy (CSP) default-src directive serves as a fallback for the other CSP fetch directives. ...
CSP: frame-src - HTTP
The HTTP Content-Security-Policy (CSP) frame-src directive specifies valid sources for nested browsing contexts loading using elements such as <frame> and <iframe>. CSP version 1 Directive type Fetch directive Fallback If this directive is absent, the user agent will look for the child-src directive (which falls back to the default-src directive). Syntax One or more sources can be allowed for the frame-src policy: Content-Security-Policy: frame-src <source>; Content-Security-Policy: frame-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk characte...
CSP: worker-src - HTTP
The HTTP Content-Security-Policy (CSP) worker-src directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. CSP version 3 Directive type Fetch directive Fallback If this directive is absent, the user agent will first look for the child-src directive, then the script-src directive, then finally for the default-src directive, when governing worker execution. Chrome 59 and higher skips the child-src directive. Edge 17 skips the script-src directive (bug). Syntax One or more sources can be allowed for the worker-src policy: Content-Security-Policy: worker-src <source>; Content-Security-Policy: worker-src <source> <source>; Sources <source> can be one of the following: <host-source> Internet hosts by...
Index - HTTP
Web › HTTP › Headers › Index
is absent, then any URI is allowed. If this directive is absent, the user agent will use the value in the <base> element. 30 CSP: block-all-mixed-content CSP, Directive, HTTP, Mixed Content, Reference, Security The HTTP Content-Security-Policy (CSP) block-all-mixed-content directive prevents loading any assets using HTTP when the page is loaded using HTTPS. 31 CSP: child-src CSP, Directive, HTTP, Reference, Security The deprecated HTTP Content-Security-Policy (CSP) child-src directive defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. For workers, non-compliant requests are treated as fatal network errors by the user agent. 32 CSP: connect-src CSP, Directive, HTTP, Re...
HTTP Index - HTTP
Web › HTTP › Index
ive is absent, the user agent will use the value in the <base> element. 78 CSP: block-all-mixed-content CSP, Content-Security-Policy, Directive, HTTP, Mixed Content, Reference, Security, block-all-mixed-content The HTTP Content-Security-Policy (CSP) block-all-mixed-content directive prevents loading any assets using HTTP when the page is loaded using HTTPS. 79 CSP: child-src CSP, Child, Content-Security-Policy, Directive, HTTP, Reference, Security, child-src, source The HTTP Content-Security-Policy (CSP) child-src directive defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. For workers, non-compliant requests are treated as fatal network errors by the user agent. 80 CSP: ...
Link prefetching FAQ - HTTP
ment start & stop notifications, and we approximate idle time as the period between the last document stop and the next document start. The last document stop notification occurs roughly when the onLoad handler would fire for the toplevel document. This is when we kick off prefetch requests. If a subframe contains prefetching hints, prefetching will not begin until the top-most frame and all its "child" frames finish loading. What happens if I click on a link while something is being prefetched? When the user clicks on a link, or initiates any kind of page load, link prefetching will stop and any prefetch hints will be discarded. If a prefetched document is partially downloaded, then the partial document will still be stored in the cache provided the server sent an "Accept-Ranges: bytes" resp...
Details of the object model - JavaScript
avaScript, "instance" does not have this technical meaning because JavaScript does not have this difference between classes and instances. However, in talking about JavaScript, "instance" can be used informally to mean an object created using a particular constructor function. So, in this example, you could informally say that jane is an instance of Engineer. Similarly, although the terms parent, child, ancestor, and descendant do not have formal meanings in JavaScript; you can use them informally to refer to objects higher or lower in the prototype chain. Creating objects with simple definitions Object hierarchy The following hierarchy is created using the code on the right side. Individual objects = Jim, Sally, Mark, Fred, Jane, etc. "Instances" created from constructor var jim = ne...
Functions - JavaScript
is the exit condition (equivalent to "!(x < 10)") return; // do stuff loop(x + 1); // the recursive call } loop(0); However, some algorithms cannot be simple iterative loops. For example, getting all the nodes of a tree structure (such as the DOM) is easier via recursion: function walkTree(node) { if (node == null) // return; // do something with node for (var i = 0; i < node.childNodes.length; i++) { walkTree(node.childNodes[i]); } } Compared to the function loop, each recursive call itself makes many recursive calls here. It is possible to convert any recursive algorithm to a non-recursive one, but the logic is often much more complex, and doing so requires the use of a stack. In fact, recursion itself uses a stack: the function stack. The stack-like behavior ca...
JavaScript technologies overview - JavaScript
led "host objects". HTML DOM HTML, the Web's markup language, is specified in terms of the DOM. Layered above the abstract concepts defined in DOM Core, HTML also defines the meaning of elements. The HTML DOM includes such things as the className property on HTML elements, or APIs such as document.body. The HTML specification also defines restrictions on documents; for example, it requires all children of a <ul> element, which represents an unordered list, to be <li> elements, as those represent list items. In general, it also forbids using elements and attributes that aren't defined in a standard. Looking for the Document object, Window object, and the other DOM elements? Read the DOM documentation. Other notable APIs The setTimeout and setInterval functions were first specified on the...
extends - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax class ChildClass extends ParentClass { ... } Description The extends keyword can be used to subclass custom classes as well as built-in objects. The .prototype of the extension must be an Object or null. Examples Using extends The first example creates a class called Square from a class called Polygon. ...
Default parameters - JavaScript
parameter initializers; attempting to do so throws a run-time ReferenceError. It also means that variables declared inside the function body using var will mask parameters of the same name, instead of the usual behavior of duplicate var declarations having no effect. The following function will throw a ReferenceError when invoked, because the default parameter value does not have access to the child scope of the function body: function f(a = go()) { // Throws a `ReferenceError` when `f` is invoked. function go() { return ':P' } } ...and this function will print undefined because variable var a is hoisted only to the top of the scope created for the function body (and not the parent scope created for the parameter list): function f(a, b = () => console.log(a)) { var a = 1 b() // Pri...
Array.isArray() - JavaScript
; Array.isArray(undefined); Array.isArray(17); Array.isArray('Array'); Array.isArray(true); Array.isArray(false); Array.isArray(new Uint8Array(32)); Array.isArray({ __proto__: Array.prototype }); instanceof vs isArray When checking for Array instance, Array.isArray is preferred over instanceof because it works through iframes. 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 // Considered harmful, because doesn't work through iframes arr instanceof Array; // false Specifications Specification ECMAScript (ECMA-262)The definition of 'Array.isArray' in that specification. ...
Object.create() - JavaScript
e.info('Shape moved.'); }; // Rectangle - subclass function Rectangle() { Shape.call(this); // call super constructor. } // subclass extends superclass Rectangle.prototype = Object.create(Shape.prototype); //If you don't set Rectangle.prototype.constructor to Rectangle, //it will take the prototype.constructor of Shape (parent). //To avoid that, we set the prototype.constructor to Rectangle (child). Rectangle.prototype.constructor = Rectangle; var rect = new Rectangle(); console.log('Is rect an instance of Rectangle?', rect instanceof Rectangle); // true console.log('Is rect an instance of Shape?', rect instanceof Shape); // true rect.move(1, 1); // Outputs, 'Shape moved.' If you wish to inherit from multiple objects, then mixins are a possibility. function MyClass() { SuperClass.ca...
Object.freeze() - JavaScript
objects themselves, those objects are not frozen and may be the target of property addition, removal or value re-assignment operations. var employee = { name: "Mayank", designation: "Developer", address: { street: "Rohini", city: "Delhi" } }; Object.freeze(employee); employee.name = "Dummy"; // fails silently in non-strict mode employee.address.city = "Noida"; // attributes of child object can be modified console.log(employee.address.city) // Output: "Noida" To make an object immutable, recursively freeze each property which is of type object (deep freeze). Use the pattern on a case-by-case basis based on your design when you know the object contains no cycles in the reference graph, otherwise an endless loop will be triggered. An enhancement to deepFreeze() would be to h...
Promise.any() - JavaScript
!response.ok) { throw new Error(`HTTP error! ...
new.target - JavaScript
{ throw 'Foo() must be called with new' } console.log('Foo instantiated with new') } new Foo() // logs "Foo instantiated with new" Foo() // throws "Foo() must be called with new" new.target in constructors In class constructors, new.target refers to the constructor that was directly invoked by new. This is also the case if the constructor is in a parent class and was delegated from a child constructor. class A { constructor() { console.log(new.target.name) } } class B extends A { constructor() { super() } } let a = new A() // logs "A" let b = new B() // logs "B" class C { constructor() { console.log(new.target) } } class D extends C { constructor() { super() } } let c = new C() // logs class C{constructor(){console.log(new.target);}} let d = new D() // logs class...
Authoring MathML - MathML
your own project, you might need the detection scripts to verify the level of MathML support. For example the following function verifies the MathML support by testing the mspace element (you may replace mspace with mpadded): function hasMathMLSupport() { var div = document.createElement("div"), box; div.innerHTML = "<math><mspace height='23px' width='77px'/></math>"; document.body.appendChild(div); box = div.firstChild.firstChild.getBoundingClientRect(); document.body.removeChild(div); return Math.abs(box.height - 23) <= 1 && Math.abs(box.width - 77) <= 1; } Alternatively, the following UA string sniffing will allow to detect the rendering engines with native MathML support (Gecko and WebKit). Note that UA string sniffing is not the most reliable method and might break from ve...
<math> - MathML
Web › MathML › Element › math
Attributes In addition to the following attributes, the <math> element accepts any attributes of the <mstyle> element. class, id, style Provided for use with stylesheets. dir Overall directionality of formulas. Possible values are either ltr (left to right) or rtl (right to left). href Used to set a hyperlink to a specified URI. ...
<menclose> - MathML
tation specified by the notation attribute. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. notation A list of notations, separated by white space, to apply to the child elements. The symbols are each drawn as if the others are not present, and therefore may overlap. Possible values are: Value Sample Rendering Rendering in your browser Description longdiv (default) a2 + b2 long division symbol actuarial a2 + b2 actuarial symbol radical a2 + b2 sq...
<mlabeledtr> - MathML
The first child is the label whereas all other children are representing row contents and are treated identically to children of <mtr> elements. Attributes class, id, style Provided for use with stylesheets. columnalign Overrides the horizontal alignment of cells specified by <mtable> for this row. Possible values are: left, center and right. ...
<mstyle> - MathML
Web › MathML › Element › mstyle
It accepts all attributes of all MathML presentation elements with some exceptions and additional attributes listed below. Attributes dir Overall directionality of formulas. Possible values are either ltr (left to right) or rtl (right to left). decimalpoint This attribute is specifying the character for the alignment point within <mstack> and <mtable> columns, if the decimalpoint value is used to specify the alignment. displaystyle A Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. ...
MathML element reference - MathML
otation) M <mmultiscripts> (Prescripts and tensor indices) N <mn> (Number) O <mo> (Operator) <mover> (Overscript) P <mpadded> (Space around content) <mphantom> (Invisible content with reserved space) R <mroot> (Radical with specified index) <mrow> (Grouped sub-expressions) S <ms> (String literal) <mscarries> (Annotations such as carries) <mscarry> (Single carry, child element of <mscarries>) <msgroup> (Grouped rows of <mstack> and <mlongdiv> elements) <msline> (Horizontal lines inside <mstack> elements) <mspace> (Space) <msqrt> (Square root without an index) <msrow> (Rows in <mstack> elements) <mstack> (Stacked alignment) <mstyle> (Style change) <msub> (Subscript) <msup> (Superscript) <msubsup> (Subscript-superscript pair) T <mtable> (Table or m...
Autoplay guide for media and Web Audio APIs - Web media technologies
The HTTP header is: Feature-Policy: autoplay 'none' Using the <iframe>'s allow a...
Media container formats (file types) - Web media technologies
re than one version of media files, using the <source> element to specify each source within the <audio> or <video> element. For example, you can offer an Ogg or WebM video as the first choice, with a fallback in MP4 format. You could even choose to offer a retro-like QuickTime or AVI fallback for good measure. To do this, you create a <video> (or <audio>) element with no src attribute. Then add child <source> elements within the <video> element, one for each version of the video you offer. This can be used to offer various versions of a video that can be selected depending on bandwidth availability, but in our case, we'll use it to offer format options. In the example shown here, a video is offered to the browser in two formats: WebM and MP4. The source for this interactive example is sto...
Using images in HTML - Web media technologies
Web › Media › images
mbed an image in a webpage. It supports a wide range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> The HTML <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. The browser considers each child <source> element and chooses the best match among them. CSS object-fit The object-fit CSS property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position The object-position CSS property specifies the alignment of content in a selected replaced element within the element's box. Areas of the box which aren't covered ...
Media - Progressive web apps (PWAs)
"print-head"> Heading for paged media </div> <div id="print-foot"> Page: </div> </body> </html> Make a new stylesheet, style4.css. ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
n Sets the appearance of decorative lines on text. Value: none|underline|overline|line-through|blink|inherit; Animatable: Yes text-rendering Hints about what tradeoffs to make as the browser renders text. Value: auto|optimizeSpeed|optimizeLegibility|geometricPrecision|inherit; Animatable: Yes transform Defines a list of transform definitions that are applied to an element and the element's children. Value: <transform-list>; Animatable: Yes unicode-bidi - Value:; Animatable: - vector-effect Specifies the vector effect to use when drawing an object. Value: default|non-scaling-stroke|inherit|<uri>; Animatable: Yes visibility Lets you control the visibility of graphical elements. Value: visible|hidden|collapse|inherit; Animatable: Yes word-spacing Specifies spacing behavior betwe...
begin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › begin
ation will be determined by a beginElement() method call or a hyperlink targeted to the element. discard For <discard>, begin defines when the target element will be discarded. The <discard> element has an implicit simple duration of indefinite. As soon as the element's active duration starts, the element identified by the href attribute is discarded. The behavior is the same as if Node.removeChild() were called on the parent of the target element with the target element as parameter. After removal of the target element, the <discard> element is no longer useful, therefore it is also discarded after the target element's removal. If the href attribute has an invalid URL reference (e.g. the target element did not exist), the <discard> element itself is still removed after the activation. Se...
color-interpolation - SVG: Scalable Vector Graphics
lor animations, and alpha compositing. Note: For filter effects, the color-interpolation-filters property controls which color space is used. The color-interpolation property chooses between color operations occurring in the sRGB color space or in a (light energy linear) linearized RGB color space. Having chosen the appropriate color space, component-wise linear interpolation is used. When a child element is blended into a background, the value of the color-interpolation property on the child determines the type of blending, not the value of the color-interpolation on the parent. For gradients which make use of the href or the deprecated xlink:href attribute to reference another gradient, the gradient uses the property's value from the gradient element which is directly referenced by the f...
enable-background - SVG: Scalable Vector Graphics
y value of enable-background: new, then all graphics elements within the current container element are rendered both onto the parent container element's background image canvas and onto the target device. Otherwise, there is no current background image canvas, so graphics elements are only rendered onto the target device. new [ <x> <y> <width> <height> ]? This value enables the ability of children of the current container element to access the background image. It also indicates that a new (i.e., initially transparent black) background image canvas is established and that in effect all children of the current container element shall be rendered into the new background image canvas in addition to being rendered onto the target device. The optional <x>, <y>, <width>, and <height> para...
href - SVG: Scalable Vector Graphics
Web › SVG › Attribute › href
sic shape which defines the motion path. Value <url> Default value None Animatable No pattern For <pattern>, href defines a URL referring to a different <pattern> element within the current SVG document. Any attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no children, and the referenced element does (possibly due to its own href attribute), then this element inherits the children from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attributes or children due to its own href attribute, then the current element can inherit those attributes or children. On the <pattern> element, the href attr...
overflow - SVG: Scalable Vector Graphics
no effect (i.e., a clipping rectangle is not created). If the overflow property has the value hidden or scroll, a clip of the exact size of the SVG viewport is applied. When scroll is specified on an <svg> element, a scrollbar or panner is normally shown for the SVG viewport whether or not any of its content is clipped. Within SVG content, the value auto implies that all rendered content for child elements must be visible, either through a scrolling mechanism, or by rendering with no clip. Although the initial value for overflow is auto, it is overwritten in the User Agent style sheet for the <svg> element when it is not the root element of a stand-alone document, the <pattern> element, and the <marker> element to be hidden by default. Note: As a presentation attribute, overflow can be ...
requiredExtensions - SVG: Scalable Vector Graphics
st-of-extensions> The value is a list of references (IRI references in SVG 1, URL References in SVG 2) which identify the required extensions, with the individual values separated by white space. Determines whether all of the named extensions are supported by the user agent. If all of the given extensions are supported, then the attribute evaluates to true; otherwise, the current element and its children are skipped and thus will not be rendered. Note: If a given extension reference contains white space within itself, that white space must be escaped. requiredExtensions is often used in conjunction with the <switch> element. If the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. Note: If several extension ...
requiredFeatures - SVG: Scalable Vector Graphics
The requiredFeatures attribute takes a list of feature strings, with the individual strings separated by white space. It determines whether or not all of the named features are supported by the browser; if all of them are supported, the attribute evaluates to true end the element is rendered; otherwise, the attribute evaluates to false and the current element and its children are skipped and thus will not be rendered. This provides a way to design SVG that gracefully falls back when features aren't available. If the attribute is not present, then its implicit evaluated value is true. If a null string or empty string value is given to attribute requiredFeatures, the attribute is evaluate to false. requiredFeatures is often used in conjunction with the <switch> element. If requiredFeatures is...
transform - SVG: Scalable Vector Graphics
html,body,svg { height:100% } <svg viewBox="-40 0 150 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <g fill="grey" transform="rotate(-10 50 100) translate(-36 45.5) skewX(40) scale(1 0.5)"> <path id="heart" d="M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z" /> </g> <use xlink:href="#heart" fill="none" stroke="red"/> </svg> Note: As of SVG2, transform is a presentation attribute, meaning it can be used as a CSS property. ...
xlink:href - SVG: Scalable Vector Graphics
ch defines the motion path. Value <iri> Default value None Animatable No pattern For <pattern>, xlink:href defines the reference to a different <pattern> element within the current SVG document fragment. Any attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no children, and the referenced element does (possibly due to its own xlink:href attribute), then this element inherits the children from the referenced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attributes or children due to its own xlink:href attribute, then the current element can inherit those attributes or children. Value <iri> ...
xlink:title - SVG: Scalable Vector Graphics
source in a human-readable fashion. The use of this information is highly dependent on the type of processing being done. It may be used, for example, to make titles available to applications used by visually impaired users, or to create a table of links, or to present help text that appears when a user lets a mouse pointer hover over a starting resource. Note: New content should use a <title> child element rather than a xlink:title attribute. These elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <color-profile>, <cursor>, <feImage>, <filter>, <font-face-uri>, <glyphRef>, <image>, <linearGradient>, <mpath>, <pattern>, <radialGradient>, <script>, <set>, <textPath>, <tref>, and <use> Usage context Value <anythi...
xml:space - SVG: Scalable Vector Graphics
Note: Instead of using the xml:space attribute, use the white-space CSS property. This attribute influences how browsers parse text content and therefore changes the way the DOM is built. Therefore, changing this attribute's value through the DOM API may have no effect. All elements are using this attribute. ...
<altGlyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › altGlyph
Value type: <list-of-coordinates> ; Default value: Absolute x-coordinate of ancestor <text> or <tspan>; Animatable: yes y This attribute defines the corresponding absolute y-coordinates for rendering the element. ...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
{from {r: 0} to {r: 60px}} #myClip circle { animation: openYourHeart 15s infinite; } A clipping path is conceptually equivalent to a custom viewport for the referencing element. Thus, it affects the rendering of an element, but not the element's inherent geometry. The bounding box of a clipped element (meaning, an element which references a <clipPath> element via a clip-path property, or a child of the referencing element) must remain the same as if it were not clipped. By default, pointer-events are not dispatched on clipped regions. For example, a circle with a radius of 10 which is clipped to a circle with a radius of 5 will not receive "click" events outside the smaller radius. Attributes clipPathUnits Defines the coordinate system for the contents of the <clipPath> element. V...
<feComponentTransfer> - SVG: Scalable Vector Graphics
Th <feComponentTransfer> SVG filter primitive performs color-component-wise remapping of data for each pixel. It allows operations like brightness adjustment, contrast adjustment, color balance or thresholding. The calculations are performed on non-premultiplied color values. The colors are modified by changing each channel (R, G, B, and A) to the result of what the children <feFuncR>, <feFuncB>, <feFuncG>, and <feFuncA> return. Usage context CategoriesFilter primitive elementPermitted contentAny number of the following elements, in any order:<feFuncA>, <feFuncR>, <feFuncB>, <feFuncG> Attributes Global attributes Core attributes Presentation attributes Filter primitive attributes class style Specific attributes in DOM Interface This element implements the SVGFEComponentTran...
<feMerge> - SVG: Scalable Vector Graphics
Web › SVG › Element › feMerge
The <feMerge> SVG element allows filter effects to be applied concurrently instead of sequentially. This is achieved by other filters storing their output via the result attribute and then accessing it in a <feMergeNode> child. Usage context CategoriesFilter primitive elementPermitted contentAny number of the following elements, in any order:<feMergeNode> Example SVG <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> <filter id="feOffset" x="-40" y="-20" width="100" height="200"> <feOffset in="SourceGraphic" dx="60" dy="60" /> <feGaussianBlur stdDeviation="5" result="blur2" /> <feMerge> <feMergeNode in="blur2" /> <feMergeNode in="SourceGraphic" /> </feMerge> </filter> <rect x="40" y="40" width="100" height="100" style="stroke: #0000...
<stop> - SVG: Scalable Vector Graphics
Web › SVG › Element › stop
The SVG <stop> element defines a color and its position to use on a gradient. This element is always a child of a <linearGradient> or <radialGradient> element. html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient id="myGradient" gradientTransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </linearGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes offset This attribute defines where the gradient stop is placed along the gradient vector. Value type: <number>|<percentage>; Default value: 0; Animatable: yes stop-color Thi...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
Candidate Recommendation Scalable Vector ...
<title> — the SVG accessible name element - SVG: Scalable Vector Graphics
Web › SVG › Element › title
container element or graphics element. Text in a <title> element is not rendered as part of the graphic, but browsers usually display it as a tooltip. If an element can be described by visible text, it is recommended to reference that text with an aria-labelledby attribute rather than using the <title> element. Note: For backward compatibility with SVG 1.1, <title> elements should be the first child element of their parent. html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <circle cx="5" cy="5" r="4"> <title>I'm a circle</title> </circle> <rect x="11" y="1" width="8" height="8"> <title>I'm a square</title> </rect> </svg> Attributes This element only includes global attributes Global attributes Core Attributes Most notab...
<tref> - SVG: Scalable Vector Graphics
Web › SVG › Element › tref
The textual content for a <text> SVG element can be either character data directly embedded within the <text> element or the character data content of a referenced element, where the referencing is specified with a <tref> element. Usage context CategoriesText content element, Text content child elementPermitted contentAny number of the following elements, in any order:Descriptive elements<animate>, <animateColor>, <set> Attributes Global attributes Conditional processing attributes Core attributes Graphical event attributes Presentation attributes Xlink attributes class style externalResourcesRequired Specific attributes xlink:href DOM Interface This element implements the SVGTRefElement interface. Example <svg width="100%" height="100%" viewBox="0 0 1000 300" xm...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
Candidate Recommendation Scalable Vector Grap...
SVG element reference - SVG: Scalable Vector Graphics
Web › SVG › Element
You should never use them in new projects, and should replace them in old proj...
Example - SVG: Scalable Vector Graphics
y; this.x += this.vx; this.y += this.vy; this.capPosition(); // Draw it. ...
Scripting - SVG: Scalable Vector Graphics
Web › SVG › Scripting
lements the handleEvent interface as the second parameter to these methods. function myRect(x,y,w,h,message){ this.message=message this.rect=document.createElementNS("http://www.w3.org/2000/svg","rect") this.rect.setAttributeNS(null,"x",x) this.rect.setAttributeNS(null,"y",y) this.rect.setAttributeNS(null,"width",w) this.rect.setAttributeNS(null,"height",h) document.documentElement.appendChild(this.rect) this.rect.addEventListener("click",this,false) this.handleEvent= function(evt){ switch (evt.type){ case "click": alert(this.message) break; } } } Inter-document scripting: referencing embedded SVG When using SVG within HTML, Adobe's SVG Viewer 3.0 automatically includes a window property called svgDocument that points to the SVG document. This is not ...
Basic Transformations - SVG: Scalable Vector Graphics
+ d y_{\mathrm{newCoordSys}} + f \end{matrix} \right. See a concrete example on the SVG transform documentation. Detailed information about this property can be found in the SVG Recommendation. Effects on Coordinate Systems When using transformations you establish a new coordinate system inside the element the transformations apply to. That means, the units you specify for the element and its children might not follow the 1:1 pixel mapping, but are also distorted, skewed, translated and scaled according to the transformation. <svg width="100" height="100"> <g transform="scale(2)"> <rect width="50" height="50" /> </g> </svg> The resulting rectangular in the above example will be 100x100px. The more intriguing effects arise, when you rely on attributes like userSpaceOnUse a...
SVG In HTML Introduction - SVG: Scalable Vector Graphics
op class="begin" offset="0%"/> <stop class="end" offset="100%"/> </linearGradient> <rect x="0" y="0" width="100" height="100" style="fill:url(#gradient)" /> <circle cx="50" cy="50" r="30" style="fill:url(#gradient)" /> </svg> </body> </html> Discussion The page is mainly regular HTML, CSS and JavaScript. The only interesting part is the <svg> element it contains. This element and its children are declared to be in the SVG namespace. The element contains a gradient and two shapes filled with the gradient. The gradient color stops have their colors set by CSS. When the user enters something incorrect into the form, the script sets the invalid attribute on the <body>, and a style rule changes the gradient end-stop color to red. (Another style rule makes an error message appear.) This...
SVG fonts - SVG: Scalable Vector Graphics
bove the first and most important to be defined is font-family, the value of which can then be referenced in CSS and SVG font-family properties. The font-weight and font-style attributes have the same purpose as the equivalent descriptors in CSS. All following attributes are rendering instructions for the font layout engine, for example, how much of the glyphs' overall heights are ascenders. Its child, the <font-face-src> element, corresponds to CSS' src descriptor in @font-face declarations. You can point to external sources for font declarations by means of its children <font-face-name> and <font-face-uri>. The above example states that if the renderer has a local font available named "Super Sans Bold", it should use this instead. Following <font-face-src> is a <missing-glyph> element. This...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
ir CSS counterparts, to enable font selection. Each of the following properties can be set as an attribute or via a CSS declaration: font-family, font-style, font-weight, font-variant, font-stretch, font-size, font-size-adjust, kerning, letter-spacing, word-spacing and text-decoration. Other text-related elements tspan This element is used to mark up sub-portions of a larger text. It must be a child of a text element or another tspan element. A typical usecase is to paint one word of a sentence bold red. <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> Playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> <style><![CDATA[ text{ dominant-bas...
Certificate Transparency - Web security
ose that violate the CA/B Forum Baseline Requirements, can be detected and revoked much more quickly. Browser vendors and root store maintainers are also empowered to make more informed decisions regarding problematic CAs that they may decide to distrust. Background CT logs are built upon the foundation of the Merkle tree data structure. Nodes are labelled with the cryptographic hashes of their child nodes. Leaf nodes contain hashes of actual pieces of data. The label of the root node therefore depends on all other nodes in the tree. In the context of certificate transparency, the data hashed by the leaf nodes are the certificates that have been issued by the various different CAs operating today. Certificate inclusion can be verified via an audit proof which can be generated and verified ef...
Web Components
ECMAScript 2015 class syntax (see Classes for more information). Register your new custom element using the CustomElementRegistry.define() method, passing it the element name to be defined, the class or function in which its functionality is specified, and optionally, what element it inherits from. If required, attach a shadow DOM to the custom element using Element.attachShadow() method. Add child elements, event listeners, etc., to the shadow DOM using regular DOM methods. If required, define an HTML template using <template> and <slot>. Again use regular DOM methods to clone the template and attach it to your shadow DOM. Use your custom element wherever you like on your page, just like you would any regular HTML element. Tutorials Using custom elements A guide showing how to use ...
descendant-or-self - XPath
...
descendant - XPath
Web › XPath › Axes › descendant
The descendant axis indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents. ...
position - XPath
a context is not zero-based. The first node has a position of 1. The context is determined by the rest of the path. <xsl:template match="//a[position() = 5]"> <!-- this template matches the fifth a element anywhere in the document. --> </xsl:template> <xsl:template match="//div[@class='foo']/bar[position() = 1]"> <!-- this template matches the first bar element that is a child of a div element with a class attribute equal to "foo" --> </xsl:template> Defined XPath 1.0 4.1 Gecko support Supported. ...
XPath
an also be used to test addressed nodes within a document to determine whether they match a pattern or not. XPath is mainly used in XSLT, but can also be used as a much more powerful way of navigating through the DOM of any XML-like language document using XPathExpression, such as HTML and SVG, instead of relying on the Document.getElementById() or ParentNode.querySelectorAll() methods, the Node.childNodes properties, and other DOM Core features. XPath uses a path notation (as in URLs) for navigating through the hierarchical structure of an XML document. It uses a non-XML syntax so that it can be used in URIs and XML attribute values. Note: Support for XPath varies widely; it's supported reasonably well in Firefox (although there are no plans to improve support further), while other browser...
<xsl:apply-templates> - XSLT: Extensible Stylesheet Language Transformations
structs the processor to apply the proper templates to them. Syntax <xsl:apply-templates select=EXPRESSION mode=NAME> <xsl:with-param> [optional] <xsl:sort> [optional] </xsl:apply-templates> Required Attributes None. Optional Attributes select Uses an XPath expression that specifies the nodes to be processed. An asterisk(*) selects the entire node-set. If this attribute is not set, all child nodes of the current node are selected. mode If there are multiple ways of processing defined for the same node, distinguishes among them. Type Instruction, appears within a template. Defined XSLT section 5.4. Gecko support Supported. ...
<xsl:attribute-set> - XSLT: Extensible Stylesheet Language Transformations
xsl:attribute> </xsl:attribute-set> Required Attributes name Specifies the name of the attribute set. The name must be a valid QName. Optional Attributes use-attribute-sets Builds an attribute set from other attribute sets. The names of the contributing sets must be separated with whitespace characters and must not directly or indirectly embed themselves. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 7.1.4. Gecko support Supported. ...
<xsl:copy> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › copy
Syntax <xsl:copy use-attribute-sets=LIST-OF-NAMES> TEMPLATE </xsl:copy> Required Attributes None. ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
per thousand character. The default is (?). zero-digit Specifies the digit zero character. The default is (0). digit Specifies the character used in the format pattern to stand for a digit. The default is (#). pattern-separator Specifies the character separating positive and negative subpatterns in a format pattern. The default is the semi-colon (;). Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 12.3. Gecko support Supported as of 1.0 (Mozilla 1.0, Netscape 7.0). ...
<xsl:for-each> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › for-each
Otherwise, nodes are processed in document order. ...
<xsl:if> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › if
ath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:if> element contains a test attribute and a template. If the test evaluates to true, the template is processed. In this it is similar to an if statement in other languages. To achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children. Syntax <xsl:if test=EXPRESSION> TEMPLATE </xsl:if> Required Attributes test Contains an XPath expression that can be evaluated (using the rules defined for boolean( ) if necessary) to a Boolean value. If the value is true, the template is processed; if it is not, no action is taken. Optional Attributes None. Type Instruction, appears within a template. Defined XSL section 9.1. ...
<xsl:import> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › import
t precedence than that of the importing stylesheet. This is in contrast to <xsl:include> where the contents of the included stylesheet have exactly the same precedence as the contents of the including stylesheet. Syntax <xsl:import href=URI /> Required Attributes href Specifies the URI of the stylesheet to import. Optional Attributes None. Type Top-level, must appear before any other child of <xsl:stylesheet> or <xsl:transform> in the importing stylesheet. Defined XSLT, section 2.6.2. Gecko support Mostly supported with a few issues with top level variables and parameters as of Mozilla 1.0. ...
<xsl:include> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › include
> element merges the contents of one stylesheet with another. Unlike the case of <xsl:import>, the contents of an included stylesheet have exactly the same precedence as the contents of the including stylesheet. Syntax <xsl:include href=URI /> Required Attributes href Specifies the URI of the stylesheet to include. Optional Attributes None. Type Top-level, may appear in any order as a child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 2.6.1. Gecko support Supported. ...
<xsl:key> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › key
ey( ) function. Syntax <xsl:key name=NAME match=EXPRESSION use=EXPRESSION /> Required Attributes name Specifies a name for this key. Must be a QName. match Defines the nodes for which this key is applicable. use Specifies an XPath expression that will be used to determine the value of the key for each of the applicable nodes. Optional Attributes None. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 12.2. Gecko support Supported. ...
<xsl:namespace-alias> - XSLT: Extensible Stylesheet Language Transformations
t is assigned a temporary namespace which is appropriately re-converted back to the XSLT namespace in the output tree. Syntax <xsl:namespace-alias stylesheet-prefix=NAME result-prefix=NAME /> Required Attributes stylesheet-prefix Specifies the temporary namespace. result-prefix Specifies the desired namespace for the output tree. Optional Attributes None. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 7.1.1 Gecko support Not supported at this time. ...
<xsl:otherwise> - XSLT: Extensible Stylesheet Language Transformations
Defined XSLT, section 9.2 Gecko support Supported. ...
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › output
DOCTYPE declaration in the output document. cdata-section-elements Lists elements whose text contents should be written as CDATA sections. Elements should be whitespace separated. indent (Not supported.) Specifies if the output should be indented to indicate its hierarchic structure. media-type (Not supported.) Specifies the output document MIME type. Type Top-level, must be the child <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 16. Gecko support Partial support. See comments above. ...
<xsl:param> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › param
XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes The <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. When used as a top-level element, the parameter is global . When used inside an <xsl:template> element, the parameter is local to that template. In this case it must be the first child element of the template. Syntax <xsl:param name=NAME select=EXPRESSION> TEMPLATE </xsl:param> Required Attributes name Names the parameter. This must be a QName. Optional Attributes select Uses an XPath expression to provide a default value if none is specified. Type Instruction, can appear as a top-level element or within a template. Defined XSLT, section 11. Gecko support Supported. ...
<xsl:preserve-space> - XSLT: Extensible Stylesheet Language Transformations
nt, separate the names with a whitespace character. Preserving whitespace is the default setting, so this element only needs to be used to counteract an <xsl:strip-space> element. Syntax <xsl:preserve-space elements=LIST-OF-ELEMENT-NAMES /> Required Attributes elements Specifies the elements for which whitespace should be preserved. Optional Attributes None. Type Top-level, must be a child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 3.4 Gecko support Supported. ...
<xsl:sort> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › sort
r Indicates whether upper- or lowercase letters are to be ordered first. The allowable values are "upper-first" and "lower-first". lang Specifies which language is to be used by the sort. data-type Defines whether items are to be ordered alphabetically or numerically. The allowable values are "text" and "number" with "text" being the default. Type Subinstruction, always appears as a child of <xsl:for-each>, where it must appear before the template proper or of <xsl:apply-templates>. Defined XSLT, section10. Gecko support Supported. ...
<xsl:strip-space> - XSLT: Extensible Stylesheet Language Transformations
Defined XSLT, section 3.4 Gecko support Supported. ...
<xsl:template> - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element › template
a particular mode for this template, which can be matched by an attribute of the <xsl:apply-templates> element. This is useful for processing the same information in multiple ways. priority Specifies a numeric priority for this template. This can be any number other than Infinity. The processor uses this number when more than one template matches the same node. Type Top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. Defined XSLT, section 5.3. Gecko support Supported. ...
XSLT elements reference - XSLT: Extensible Stylesheet Language Transformations
Web › XSLT › Element
An instruction, on the other hand, is associated with a template. A stylesheet may include several templates. A third type of element, not discussed here, is the literal result element (LRE). An LRE also appears in a template. ...
An Overview - XSLT: Extensible Stylesheet Language Transformations
archical framework of nodes. It can be made up of seven different types of nodes: the single root node, element nodes, text nodes, attribute nodes, comment nodes, processing instruction nodes, and namespace nodes. At the top of the tree is the root node. The root node does not correspond to any individual part of the XML document: it represents the document as whole. Below the root node are its children, which can be elements, comments, processing instructions and so on. Some of those children may also have children. And this can continue for several levels. There are certain constraints on which type of nodes can occur where: for example, text nodes can have no children. The result of the processor's action is also a tree. Netscape uses this tree to render the contents in the browser windo...
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
l:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) Axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self Functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) forma...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
ted) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) Axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self Functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported) format-number() ...
Basic Example - XSLT: Extensible Stylesheet Language Transformations
// load the xml file, example1.xml myXMLHTTPRequest = new XMLHttpRequest(); myXMLHTTPRequest.open("GET", "example1.xml", false); myXMLHTTPRequest.send(null); xmlDoc = myXMLHTTPRequest.responseXML; var fragment = xsltProcessor.transformToFragment(xmlDoc, document); document.getElementById("example").innerHTML = ""; myDOM = fragment; document.getElementById("example").appendChild(fragment); } ...
Setting Parameters - XSLT: Extensible Stylesheet Language Transformations
Setting Parameters While running transformations using precoded .xsl and .xml files is quite useful, configuring the .xsl file from JavaScript may be even more useful. For example, JavaScript and XSLT could be used to sort XML data and then display it. The sorting would have to alternate between ascending and descending sorting. XSLT provides the xsl:param element, which is a child of the xsl:stylesheet element. XSLTProcessor provides three JavaScript methods to interact with these parameters: XSLTProcessor.setParameter(), XSLTProcessor.getParameter() and XSLTProcessor.removeParameter(). They all take as the first argument the namespace URI of the xsl:param (Usually the param will fall in the default namespace, so passing in null will suffice.) The local name of the xsl:param is the s...
Understanding WebAssembly text format - WebAssembly
bstract Syntax Tree of a programming language, though, WebAssembly's tree is pretty flat, mostly consisting of lists of instructions. First, let's see what an S-expression looks like. Each node in the tree goes inside a pair of parentheses -- ( ... ). The first label inside 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. So that means the WebAssembly S-expression: (module (memory 1) (func)) represents a tree with the root node "module" and two child nodes, a "memory" node with the attribute "1" and a "func" node. We'll see shortly what these nodes actually mean. The simplest module Let's start with the simplest, shortest possible wasm module. (module) This module is totally empty, but is still a va...
Compiling an Existing C Module to WebAssembly - WebAssembly
=1 to your compilation command. And there you have it. You have compiled a WebP encoder and transcoded a JPEG image to WebP. To prove that it worked, turn your result buffer into a blob and use it on an <img> element: const blob = new Blob([result], {type: 'image/webp'}); const blobURL = URL.createObjectURL(blob); const img = document.createElement('img'); img.src = blobURL; document.body.appendChild(img) Behold, the glory of a new WebP image. Demo | Original Article ...