Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-dom-mutate

Package Overview
Dependencies
Maintainers
5
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-dom-mutate - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

57

can-dom-mutate.js

@@ -360,7 +360,44 @@ 'use strict';

* @module {{}} can-dom-mutate
* @parent can-infrastructure
* @parent can-dom-utilities
* @collection can-infrastructure
*
* @description Dispatch and listen for DOM mutations.
* @group can-dom-events.static 0 static
* @group can-dom-events.events 1 events
* @signature `domMutation`
* @group can-dom-mutate.static 0 methods
* @group can-dom-mutate/modules 1 modules
* @signature `domMutate`
*
* `can-dom-mutate` exports an object that lets you listen to changes
* in the DOM using the [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)
* API.
*
* ```js
* import domMutate from "can-dom-mutate";
*
* domMutate //->
* {
* onAttributeChange( documentElement, callback ),
* onInsertion( documentElement, callback ),
* onRemoval( documentElement, callback ),
* onNodeAttributeChange( node, callback ),
* onNodeInsertion( node, callback ),
* onNodeRemoval( node, callback )
* }
*
* // listen to every attribute change within the document:
* domMutate.onAttributeChange(document.documentElement, function(mutationRecord){
* mutationRecord.target //-> <input>
* mutationRecord.attributeName //-> "name"
* mutationRecord.oldValue //-> "Ramiya"
* })
* ```
*
* If you want to support browsers that do not support the `MutationObserver` api, use
* [can-dom-mutate/node] to update the DOM. Every module within CanJS should do this:
*
* ```js
* var mutate = require('can-dom-mutate/node');
* var el = document.createElement('div');
*
* mutate.appendChild.call(document.body, el);
* ```
*/

@@ -370,2 +407,3 @@ domMutate = {

* @function can-dom-mutate.dispatchNodeInsertion dispatchNodeInsertion
* @hide
*

@@ -386,2 +424,3 @@ * Dispatch an insertion mutation on the given node.

* @function can-dom-mutate.dispatchNodeRemoval dispatchNodeRemoval
* @hide
*

@@ -402,2 +441,4 @@ * Dispatch a removal mutation on the given node.

* @function can-dom-mutate.dispatchNodeAttributeChange dispatchNodeAttributeChange
* @parent can-dom-mutate.static
* @hide
*

@@ -407,3 +448,9 @@ * Dispatch an attribute change mutation on the given node.

* @signature `dispatchNodeAttributeChange( node, attributeName, oldValue [, callback ] )`
* @parent can-dom-mutate.static
*
* ```
* input.setAttribute("value", "newValue")
* domMutate.dispatchNodeAttributeChange(input, "value","oldValue")
* ```
*
*
* @param {Node} target The node on which to dispatch an attribute change mutation.

@@ -410,0 +457,0 @@ * @param {String} attributeName The attribute name whose value has changed.

29

node.js

@@ -48,3 +48,3 @@ 'use strict';

}
return result;
return result;
}

@@ -81,12 +81,16 @@ };

* @module {{}} can-dom-mutate/node node
* @parent can-dom-mutate
* @parent can-dom-mutate/modules
*
* Append, insert, and remove DOM nodes. Also, change node attributes.
* This allows mutations to be dispatched in environments where MutationObserver is not supported.
* @signature `mutateNode`
*
* Exports an `Object` with methods that shouhld be used to mutate HTML.
*
* ```js
* var mutate = require('can-dom-mutate/node');
* var mutateNode = require('can-dom-mutate/node');
* var el = document.createElement('div');
*
* mutate.appendChild.call(document.body, el);
* mutateNode.appendChild.call(document.body, el);
*
* ```

@@ -98,2 +102,3 @@ */

* @function can-dom-mutate/node.appendChild appendChild
* @parent can-dom-mutate/node
*

@@ -103,3 +108,3 @@ * Append a node to an element, effectively `Node.prototype.appendChild`.

* @signature `mutate.appendChild.call(parent, child)`
* @parent can-dom-mutate.node
*
* @param {Node} parent The parent into which the child is inserted.

@@ -112,2 +117,3 @@ * @param {Node} child The child which will be inserted into the parent.

* @function can-dom-mutate/node.insertBefore insertBefore
* @parent can-dom-mutate/node
*

@@ -117,3 +123,2 @@ * Insert a node before a given reference node in an element, effectively `Node.prototype.insertBefore`.

* @signature `mutate.insertBefore.call(parent, child, reference)`
* @parent can-dom-mutate.node
* @param {Node} parent The parent into which the child is inserted.

@@ -127,2 +132,3 @@ * @param {Node} child The child which will be inserted into the parent.

* @function can-dom-mutate/node.removeChild removeChild
* @parent can-dom-mutate/node
*

@@ -132,3 +138,3 @@ * Remove a node from an element, effectively `Node.prototype.removeChild`.

* @signature `mutate.removeChild.call(parent, child)`
* @parent can-dom-mutate.node
*
* @param {Node} parent The parent from which the child is removed.

@@ -141,2 +147,3 @@ * @param {Node} child The child which will be removed from the parent.

* @function can-dom-mutate/node.replaceChild replaceChild
* @parent can-dom-mutate/node
*

@@ -146,3 +153,3 @@ * Insert a node before a given reference node in an element, effectively `Node.prototype.replaceChild`.

* @signature `mutate.replaceChild.call(parent, newChild, oldChild)`
* @parent can-dom-mutate.node
*
* @param {Node} parent The parent into which the newChild is inserted.

@@ -156,2 +163,3 @@ * @param {Node} newChild The child which is inserted into the parent.

* @function can-dom-mutate/node.setAttribute setAttribute
* @parent can-dom-mutate/node
*

@@ -161,3 +169,3 @@ * Set an attribute value on an element, effectively `Element.prototype.setAttribute`.

* @signature `mutate.setAttribute.call(element, name, value)`
* @parent can-dom-mutate.node
*
* @param {Element} element The element on which to set the attribute.

@@ -170,2 +178,3 @@ * @param {String} name The name of the attribute to set.

* @function can-dom-mutate/node.removeAttribute removeAttribute
* @parent can-dom-mutate/node
*

@@ -175,3 +184,3 @@ * Removes an attribute from an element, effectively `Element.prototype.removeAttribute`.

* @signature `mutate.removeAttribute.call(element, name, value)`
* @parent can-dom-mutate.node
*
* @param {Element} element The element from which to remove the attribute.

@@ -178,0 +187,0 @@ * @param {String} name The name of the attribute to remove.

{
"name": "can-dom-mutate",
"description": "Dispatch and listen for DOM mutations",
"version": "1.0.3",
"version": "1.0.4",
"author": {

@@ -6,0 +6,0 @@ "name": "DoneJS Team",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc