Search completed in 1.15 seconds.
27 results for "oldvalue":
Your results are loading. Please wait...
MutationObserverInit.attributeOldValue - Web APIs
The MutationObserverInit dictionary's optional attributeOldValue property is used to specify whether or not to record the prior value of the altered attribute in MutationRecord objects denoting attribute value changes. Syntax var options = { attributeOldValue: true | false } Value A Boolean value indicating whether or not the prior value of a changed attribute should be included in the MutationObserver.oldValue property when reporting attribute value changes. If true, oldValue is set accordingly. If false, it is not. When using attributeOldValue, setting the attributes option to true is optional. Example In this example, a Mutation Observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users in ...
...xample, reflect changes to users' nicknames, or to mark them as away from keyboard (AFK) or offline. function callback(mutationList) { mutationList.forEach(function(mutation) { switch(mutation.type) { case "attributes": notifyUser("Attribute name " + mutation.attributeName + " changed to " + mutation.target[mutation.attributeName] + " (was " + mutation.oldValue + ")"); break; } }); } var targetNode = document.querySelector("#target"); var observer = new MutationObserver(callback); observer.observe(targetNode, { attributes: true, attributeOldValue: true }); The callback() function--which will be passed into the observe() method when starting the observer, looks at each item in the list of MutationRecord objects. For any items represe...
...he observer, looks at each item in the list of MutationRecord objects. For any items representing an attribute change (which can be detected by the value of MutationRecord.type being "attributes"), a function called notifyUser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributeName]) and its old value (mutation.oldValue). When observe() is called, the specified options are attributes and attributeOldValue, which means that changes to attribute values will be reported, and each mutation record will include the oldValue property specifying the attribute's previous value. Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.attributeOldValue' in that ...
MutationObserverInit.characterDataOldValue - Web APIs
The MutationObserverInit dictionary's optional characterDataOldValue property is used to specify whether or not the MutationRecord.oldValue property for DOM mutations should be set to the previous value of text nodes which changed. If you set the MutationObserverInit.characterData property to true but don't set characterDataOldValue to true as well, the MutationRecord will not include information describing the prior state of the text node's contents. Character data changes are detectable on any text node, including nodes based on the Text, ProcessingInstruction, and Comment interfaces. ...
...you set the MutationObserverInit.characterData property to true but don't set characterDataOldValue to true as well, the MutationRecord will not include information describing the prior state of the text node's contents. Character data changes are detectable on any text node, including nodes based on the Text, ProcessingInstruction, and Comment interfaces. Syntax var options = { characterDataOldValue: true | false } Value A Boolean value indicating whether or not to set the MutationRecord's oldValue property to be a string containing the value of the character node's contents prior to the change represented by the mutation record. By default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. To watch for changes to the text con...
...'s oldValue property to be a string containing the value of the character node's contents prior to the change represented by the mutation record. By default, only changes to the text of the node specified as the target parameter when you called observe() are monitored. To watch for changes to the text contents of all descendants of target, set the subtree option to true. If you set characterDataOldValue to true, characterData is automatically assumed to be true, even if you don't expressly set it as such. Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.characterDataOldValue' in that specification. Living Standard ...
nsIMsgFolder
IMsgFolder 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 NotifyIntPropertyChanged(in nsIAtom property, in long oldValue, in long newValue); void NotifyBoolPropertyChanged(in nsIAtom property, in boolean oldValue, in boolean newValue); void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldValue, in unsigned long newValue); void NotifyUnicharPropertyCh...
... NotifyIntPropertyChanged(in nsIAtom property, in long oldValue, in long newValue); void NotifyBoolPropertyChanged(in nsIAtom property, in boolean oldValue, in boolean newValue); void NotifyPropertyFlagChanged(in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldValue, 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); ...
...oesn't currently exist, a nsIMsgFolder may be returned. ...
...And 2 more matches
Object.observe() - Archive of obsolete content
The function called each time changes are made, with the following argument: changes An array of objects each representing a change. The properties of these change objects are: name: The name of the property which was changed. object: The changed object after the change was made. type: A string indicating the type of change taking place. One of "add", "update", or "delete". oldValue: Only for "update" and "delete" types. The value before the change. acceptList The list of types of changes to be observed on the given object for the given callback. If omitted, the array ["add", "update", "delete", "reconfigure", "setPrototype", "preventExtensions"] will be used. Return value The object to be observed. Description callback is called each time a change is made t...
...n callback is called each time a change is made to obj, with an array of all changes in the order in which they occurred. ...
...anges in the order in which they occurred. ...
...z', object: <obj>, type: 'add'}] obj.foo = 'hello'; // [{name: 'foo', object: <obj>, type: 'update', oldValue: 0}] delete obj.baz; // [{name: 'baz', object: <obj>, type: 'delete', oldValue: 2}] Object.defineProperty(obj, 'foo', {writable: false}); // [{name: 'foo', object: <obj>, type: 'reconfigure'}] Object.setPrototypeOf(obj, {}); // [{name: '__proto__', object: <obj>, type: 'setPrototype', oldValue: <prototype>}] Object.seal(obj); // [ // {name: 'foo', object: <obj>, type: 'reconfigure'}, // {name: 'bar', object: <obj>, type: 'reconfigure'}, // {object: <obj>, type: 'preventExtensions'} // ] Data Binding // A user model var user = { id: 0, name: 'Brendan Eich', title: 'Mr.' }; // Create a greeting for the user function updateGreeting() { user.greeting = 'Hello, ' + user.t...
Element.classList - Web APIs
Web › API › Element › classList
tClass){ if (!DOMTokenListProto.item) DOMTokenListProto.item = function(i){ function NullCheck(n) {return n===void 0 ? null : n} return NullCheck(this[i]); }; if (!DOMTokenListProto.toggle || testClass.toggle("a",0)!==false) DOMTokenListProto.toggle=function(val){ if (arguments.length > 1) return (this[arguments[1] ? ...
...istProto.item = function(i){ function NullCheck(n) {return n===void 0 ? null : n} return NullCheck(this[i]); }; if (!DOMTokenListProto.toggle || testClass.toggle("a",0)!==false) DOMTokenListProto.toggle=function(val){ if (arguments.length > 1) return (this[arguments[1] ? ...
...em = function(i){ function NullCheck(n) {return n===void 0 ? null : n} return NullCheck(this[i]); }; if (!DOMTokenListProto.toggle || testClass.toggle("a",0)!==false) DOMTokenListProto.toggle=function(val){ if (arguments.length > 1) return (this[arguments[1] ? ...
...is.value; return (this.remove(oldValue), oldValue === this.value && (this.add(val), true) /*|| false*/); }; if (!DOMTokenListProto.replace || typeof testClass.replace("a", "b") !== "boolean") DOMTokenListProto.replace = function(oldToken, newToken){ checkIfValidClassListEntry("replace", oldToken), checkIfValidClassListEntry("replace", newToken); var oldValue = this.value; return (this.remove(oldToken), this.value !== oldValue && (this.add(newToken), true)); }; if (!DOMTokenListProto.contains) DOMTokenListProto.contains = function(value){ for (var i=0,Len=this.length; i !== Len; ++i) if (this[i] === value) return true; return false; }; if (!DOMTokenListProto.forEach) DOMTokenListProto.forEach = function(...
MutationObserverInit.attributes - Web APIs
t value is false. If true, the callback specified when observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. You can expand the capabilities of attribute mutation monitoring using other options: attributeFilter lets you specify specific attribute names to monitor instead of monitoring all attributes. ...
...ny time one or more attributes have changed on observed nodes. You can expand the capabilities of attribute mutation monitoring using other options: attributeFilter lets you specify specific attribute names to monitor instead of monitoring all attributes. attributeOldValue lets you specify whether or not you want the previous value of changed attributes to be included in the MutationRecord's oldValue property. subtree lets you specify whether to watch the target node and all of its descendants (true), or just the target node (false). If you set either attributeFilter or attributeOldValue to true, attributes is automatically assumed to be true, even if you don't expressly set it as such. Example In this example, a Mutation Observer is set up to watch for changes to the status and username...
...xample, reflect changes to users' nicknames, or to mark them as away from keyboard (AFK) or offline. function callback(mutationList) { mutationList.forEach(function(mutation) { switch(mutation.type) { case "attributes": notifyUser("Attribute name " + mutation.attributeName + " changed to " + mutation.target[mutation.attributeName] + " (was " + mutation.oldValue + ")"); break; } }); } var targetNode = document.querySelector("#target"); var observer = new MutationObserver(callback); observer.observe(targetNode, { attributes: true, attributeOldValue: true }); The callback() function--which will be passed into the observe() method when starting the observer, looks at each item in the list of MutationRecord objects. For any items represe...
...he observer, looks at each item in the list of MutationRecord objects. For any items representing an attribute change (which can be detected by the value of MutationRecord.type being "attributes"), a function called notifyUser() is used to tell the user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributeName]) and its old value (mutation.oldValue). When observe() is called, the specified options are attributes and attributeOldValue, which means that changes to attribute values will be reported, and each mutation record will include the oldValue property specifying the attribute's previous value. Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.attributes' in that specifi...
Mail event system
NotifyDeleteOrMoveMessages OnDeleteOrMoveMessages Sample code In this example, a listener will be set up to be notified when the message count changes in a folder: // our variable to know if the listener fired var listenerHasFired = false; var totalMessagesListenerHasFired = false; // the listening function that will react to changes function myOnIntPropertyChanged(item, property, oldValue, newValue) { listenerHasFired=true; var propertyString = property.GetUnicode(); dump("OnIntPropertyChanged has fired with property + " + propertyString + "!\n"); if (propertyString == "TotalMessages") { totalMessagesListenerHasFired=true; //now show us visually var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder); dump("The folder " + folder.pret...
...s") { totalMessagesListenerHasFired=true; //now show us visually var folder = item.QueryInterface(Components.interfaces.nsIMsgFolder); dump("The folder " + folder.prettyName + " now has " + newValue + " messages."); } else if (propertyString == "TestProperty") { dump("Recieved integer test property fired on folder " + folder.prettyName + " with values " + oldValue + " and " + newValue + "\n"); } // set up the folder listener to point to the above function var folderListener = { OnItemAdded: function(parent, item, viewString) {}, OnItemRemoved: function(parent, item, viewString) {}, OnItemPropertyChanged: function(parent, item, viewString) {}, OnItemIntPropertyChanged: myOnIntPropertyChanged, OnItemBoolPropertyChanged: function(item, prope...
...and " + newValue + "\n"); } // set up the folder listener to point to the above function var folderListener = { OnItemAdded: function(parent, item, viewString) {}, OnItemRemoved: function(parent, item, viewString) {}, OnItemPropertyChanged: function(parent, item, viewString) {}, OnItemIntPropertyChanged: myOnIntPropertyChanged, OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) {}, OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) {}, OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) {}, OnItemEvent: function(item, event) = {}, OnFolderLoaded: function(aFolder) = {} OnDeleteOrMoveMessagesCompleted: function( aFolder) = {}, } // now register myself as a listener on every mail folder var mailSession = Comp...
MutationObserverInit.attributeFilter - Web APIs
away from keyboard (AFK) or offline. ...
...For any items representing an attribute change (which can be detected by the value of MutationRecord.type being "attributes"), we use the attribute's name, obtained using MutationRecord.attributeName, to identify ...
...bserver, looks at each item in the list of MutationRecord objects. For any items representing an attribute change (which can be detected by the value of MutationRecord.type being "attributes"), we use the attribute's name, obtained using MutationRecord.attributeName, to identify the type of change that occurred and then dispatch to the appropriate handler function. Note the use of MutationRecord.oldValue to get the previous value of the "username" property so we have that information when doing lookups in our local array of users. When observe() is called, the specified options include both attributeFilter and subtree, so that we monitor the attribute values for all of the nodes contained within the subtree rooted at the node with the ID "userlist". The attributeOldValue option is set to true be...
MutationObserverInit - Web APIs
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. ...
... 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 specified, otherwise the default value is false. attributeFilter Optional An array of specific attribute names to be monitored. If this property isn't included, changes to all attributes cause mutation notifications. attributeOldValue Optional Set to true to record the previous value of any attribute that changes when monitoring the node or nodes for attribute changes; see Monitoring attribute values in MutationObserver for details on watching for attribute changes and value recording. The default value is false. characterData Optional Set to true to monitor the specified target node (and, if subtree is true, its descendant...
... for attribute changes; see Monitoring attribute values in MutationObserver for details on watching for attribute changes and value recording. The default value is false. characterData Optional Set to true to monitor the specified target node (and, if subtree is true, its descendants) for changes to the character data contained within the node or nodes. The default value is true if characterDataOldValue is specified, otherwise the default value is false. characterDataOldValue Optional Set to true to record the previous value of a node's text whenever the text changes on nodes being monitored. For details and an example, see Monitoring text content changes in MutationObserver. The default value is false. Specifications Specification Status Comment DOMThe definitio...
StorageEvent - Web APIs
The key attribute is null when the change is caused by the storage clear() method. Read only. newValue DOMString The new value of the key. The newValue is null when the change has been invoked by st...
... Attribute Type Description key DOMString Represents the key changed. The key attribute is null when the change is caused by the storage clear() method. Read only. newValue DOMString The new value of the key. The newValue is null when the change has been invoked by storage clear() method or the key has been removed from the storage. Read only. oldValue DOMString The original value of the key. The oldValue is null when the key has been newly added and therefore doesn't have any previous value. Read only. storageArea Storage Represents the Storage object that was affected. Read only. url USVString The URL of the document whose key changed. Read only. Methods initStorageEvent() Initializes the event in ...
...storageArea Storage Represents the Storage object that was affected. Read only. url USVString The URL of the document whose key changed. Read only. Methods initStorageEvent() Initializes the event in a manner analogous to the similarly-named initEvent() method in the DOM Events interfaces. Syntax storageEvent.initStorageEvent(type[, canBubble[, cancelable[, key[, oldValue[, newValue[, url[, storageArea]]]]]]]) Parameters typeArg The name of the event. canBubble Optional A boolean indicating whether the event bubbles up through the DOM or not. cancelable Optional A boolean indicating whether the event is cancelable. key Optional The key whose value is changing as a result of this event. oldValue Optional The key's old value. newValue Optional The ke...
preferences/service - Archive of obsolete content
ame : string Preference name. ...
...global/locale/intl.properties"); Example: Setting Global Preferences var { get, set } = require("sdk/preferences/service"); var { when: unload } = require("sdk/system/unload"); var oldValue = get("browser.urlbar.autoFill"); set("browser.urlbar.autoFill", true); // By AMO policy global preferences must be changed back to their original value unload(function() { set("browser.urlbar.autoFill", oldValue); }); ...
Array.observe() - Archive of obsolete content
ction called each time changes are made, with the following argument: changes An array of objects each representing a change. The properties of these change objects are: name: The name of the property which was changed. object: The changed array after the change was made. type: A string indicating the type of change taking place. One of "add", "update", "delete", or "splice". oldValue: Only for "update" and "delete" types. The value before the change. index: Only for the "splice" type. The index at which the change occurred. removed: Only for the "splice" type. An array of the removed elements. addedCount: Only for the "splice" type. The number of elements added. Description The callback function is called each time a change is made to arr, with an array ...
... done via Array methods, such as Array.prototype.pop() will be reported as "splice" changes. Index assignment changes which do not change the length of the array may be reported as "update" changes. Examples Logging different change types var arr = ['a', 'b', 'c']; Array.observe(arr, function(changes) { console.log(changes); }); arr[1] = 'B'; // [{type: 'update', object: <arr>, name: '1', oldValue: 'b'}] arr[3] = 'd'; // [{type: 'splice', object: <arr>, index: 3, removed: [], addedCount: 1}] arr.splice(1, 2, 'beta', 'gamma', 'delta'); // [{type: 'splice', object: <arr>, index: 1, removed: ['B', 'c'], addedCount: 3}] Specifications Strawman proposal specification. ...
Object.unobserve() - Archive of obsolete content
Strawman proposal specification. ...
...Strawman proposal specification. ...
source-editor.jsm
to the document at which the change occurred. removedCharCount Number The number of characters removed from the document. addCharCount Number The number of characters added to the document. Selection The "Selection" element is sent when the selection within the editor changes. It has the following properties: Property Type Description oldValue Object The previously-selected range of text. newValue Object The newly-selected range of text. The objects used for oldValue and newValue each have two properties of type Number: start and end, describing the start and end positions of the range of characters. The "Focus" event is sent when the editor is focused. It has no properties. The "Blur" event is sent when t...
...oint objects representing all of the breakpoints that have been removed; see Breakpoint objects for details. The "DirtyChanged" event is sent when the dirty state of the editor changes. This state indicates whether or not there have been changes to the text since the last time the content was saved. This event has the following properties: Property Type Description oldValue Boolean The previous state of the dirty flag. newValue Boolean The new state of the dirty flag. If the dirty flag is true, the document has not been saved since the last time its text was changed. You can set the dirty state of the document by setting the value of the dirty attribute. ...
CSSStyleDeclaration.removeProperty() - Web APIs
The CSSStyleDeclaration.removeProperty() method interface removes a property from a CSS style declaration object. Syntax var oldValue = style.removeProperty(property); Parameters property is a DOMString representing the property name to be removed. Note that multi-word property names are hyphenated and not camel-cased. Return value oldValue is a DOMString equal to the value of the CSS property before it was removed. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: if the property or declaration block is read only. ...
...d not camel-cased. Return value oldValue is a DOMString equal to the value of the CSS property before it was removed. Exceptions DOMException NO_MODIFICATION_ALLOWED_ERR: if the property or declaration block is read only. Example The following JavaScript code removes the background-color CSS property from a selector rule: var declaration = document.styleSheets[0].rules[0].style; var oldValue = declaration.removeProperty('background-color'); Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'CSSStyleDeclaration.removeProperty()' in that specification. Working Draft Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'CSSStyleDeclaration' in that specification. Obsolete ...
Index - Web APIs
Web › API › Index
tionObserverInit.attributeFilter API, Attribute, Changes, DOM, DOM WHATWG, Mutation Observers, MutationObserverInit, Observer, Property, atttributeFilter, mutation The MutationObserverInit dictionary's optional attributeFilter property is an array of strings specifying the names of the attributes whose values are to be monitored for changes. 2614 MutationObserverInit.attributeOldValue API, API Reference, Attributes, Changes, DOM, DOM WHATWG, Monitor, MutationObserverInit, Observer, Property, Reference, value The MutationObserverInit dictionary's optional attributeOldValue property is used to specify whether or not to record the prior value of the altered attribute in MutationRecord objects denoting attribute value changes. 2615 MutationObserverInit.attribu...
...I, Characters, DOM, DOM WHATWG, Mutation Observer, Mutation Observer API, MutationObserverInit, Observer, Property, Reference, Text, Watching, characterData The MutationObserverInit dictionary's optional characterData property is used to specify whether or not to monitor the node or nodes being observed for changes to their textual contents. 2617 MutationObserverInit.characterDataOldValue API, Changes, Monitoring, Mutation Observer, Mutation Observer API, MutationObserverInit, Nodes, Reference, Textr, characterDataOldValue, mutation, value The MutationObserverInit dictionary's optional characterDataOldValue property is used to specify whether or not the MutationRecord.oldValue property for DOM mutations should be set to the previous value of text nodes which changed. ...
MutationObserverInit.characterData - Web APIs
rue | false } Value A Boolean value indicating whether or not to call the observer's callback function when textual nodes' values change. If true, the callback specified when observe() was used to start observing the node or subtree is called any time the contents of a text node are changed. ...
...change. If true, the callback specified when observe() was used to start observing the node or subtree is called any time the contents of a text node are changed. You can expand the capabilities of attribute mutation monitoring using other options: characterDataOldValue lets you specify whether or not you want the previous value of changed text nodes to be provided using the MutationRecord's oldValue property. subtree lets you specify whether to watch the target node and all of its descendants (true), or just the target node (false). If you set characterDataOldValue to true, characterData is automatically assumed to be true, even if you don't expressly set it as such. Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverIn...
nsIDOMStorageEventObsolete
ata store has changed. If the value of the domain attribute is "#session", then the session storage has changed. Note: This interface describes the old, non-standard form of this event. You should use the nsIDOMStorageEvent interface instead. Method overview void initStorageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, in nsIDOMStorage storageAreaArg); Attributes Attribute Type Description domain DOMString The domain of the storage area which changed, or "#session" if the event represents a change to session storage. Read only. Methods initStorageEvent() Initializes a storage event. void initStorageEvent( in DOM...
Debugger.Object - Firefox Developer Tools
the referent. change(frame,name,oldDescriptor,newDescriptor) The existing property namedname on the referent is being changed from those given byoldDescriptor to those given bynewDescriptor. This handler method is only called when attributes of the property other than its value are being changed; if only the value is changing, SpiderMonkey calls the handler's set method. set(frame,oldValue,newValue) The data property namedname of the referent is about to have its value changed fromoldValue tonewValue. SpiderMonkey only calls this method on assignments to data properties that will succeed; assignments to un-writable data properties fail without notifying the debugger. extensionsPrevented(frame) The referent has been made non-extensible, as if by a call to Object.pr...
Element.shadowRoot - Web APIs
are> element's class definition we include some life cycle callbacks that make a call to an external function, updateStyle(), which actually applies the size and color to the element. You'll see that we are passing it this (the custom element itself) as a parameter. connectedCallback() { console.log('Custom square element added to page.'); updateStyle(this); } attributeChangedCallback(name, oldValue, newValue) { 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. From here we use standard DOM traversal techniques to find the <style> element inside the shadow DOM and then update the CSS found inside it: function updateStyle(elem) { const shadow = elem.shadowR...
MutationObserver.MutationObserver() - Web APIs
dList': /* One or more children have been added to and/or removed from the tree. (See mutation.addedNodes and mutation.removedNodes.) */ break; case 'attributes': /* An attribute value changed on the element in mutation.target. 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. 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 ...
MutationObserver.observe() - Web APIs
ions 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 be monitored). Usage notes Reusing MutationObservers You can call observe() multiple times on the same MutationObserver to watch for changes to different parts of the DOM tree and/or different types of changes. ...
MutationRecord - Web APIs
ng of the added or removed nodes, or null. MutationRecord.nextSibling Node Return the next sibling of the added or removed nodes, or null. MutationRecord.attributeName String Returns the local name of the changed attribute, 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 Mut...
ShadowRoot - Web APIs
are> element's class definition we include some life cycle callbacks that make a call to an external function, updateStyle(), which actually applies the size and color to the element. You'll see that we are passing it this (the custom element itself) as a parameter. connectedCallback() { console.log('Custom square element added to page.'); updateStyle(this); } attributeChangedCallback(name, oldValue, newValue) { 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. From here we use standard DOM traversal techniques to find the <style> element inside the shadow DOM and then update the CSS found inside it: function updateStyle(elem) { var shadow = elem.shadowRoo...
Using the Web Storage API - Web APIs
es -- it is really a way for other pages on the domain using the storage to sync any changes that are made. Pages on other domains can't access the same storage objects. On the events page (see events.js) the only JavaScript is as follows: window.addEventListener('storage', function(e) { document.querySelector('.my-key').textContent = e.key; document.querySelector('.my-old').textContent = e.oldValue; document.querySelector('.my-new').textContent = e.newValue; document.querySelector('.my-url').textContent = e.url; document.querySelector('.my-storage').textContent = JSON.stringify(e.storageArea); }); Here we add an event listener to the window object that fires when the Storage object associated with the current origin is changed. As you can see above, the event object associated with t...
WindowEventHandlers.onstorage - Web APIs
the context of another document. Syntax window.onstorage = functionRef; Value functionRef is a function name or a function expression. This function receives a StorageEvent as its sole argument. Example This example logs the value for a storage key whenever it changes in another document. window.onstorage = function(e) { console.log('The ' + e.key + ' key has been changed from ' + e.oldValue + ' to ' + e.newValue + '.'); }; Specifications Specification Status Comment HTML Living StandardThe definition of 'onstorage' in that specification. Living Standard ...
Using custom elements - Web Components
llback is run whenever one of the element's attributes is changed in some way. As you can see from its properties, it is possible to act on attributes individually, looking at their name, and old and new attribute values. In this case however, we are just running the updateStyle() function again to make sure that the square's style is updated as per the new values: attributeChangedCallback(name, oldValue, newValue) { console.log('Custom square element attributes changed.'); updateStyle(this); } Note that to get the attributeChangedCallback() callback to fire when an attribute changes, you have to observe the attributes. This is done by specifying a static get observedAttributes() method inside custom element class - this should return an array containing the names of the attributes you want...