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

nanomorph

Package Overview
Dependencies
Maintainers
22
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanomorph - npm Package Compare versions

Comparing version 5.1.2 to 5.1.3

4

lib/events.js

@@ -12,2 +12,6 @@ module.exports = [

'onmouseleave',
'ontouchcancel',
'ontouchend',
'ontouchmove',
'ontouchstart',
'ondragstart',

@@ -14,0 +18,0 @@ 'ondrag',

4

lib/morph.js

@@ -21,3 +21,5 @@ var events = require('./events')

if (nodeType === TEXT_NODE || nodeType === COMMENT_NODE) {
oldNode.nodeValue = newNode.nodeValue
if (oldNode.nodeValue !== newNode.nodeValue) {
oldNode.nodeValue = newNode.nodeValue
}
}

@@ -24,0 +26,0 @@

{
"name": "nanomorph",
"version": "5.1.2",
"version": "5.1.3",
"description": "Hyper fast diffing algorithm for real DOM nodes",
"main": "index.js",
"scripts": {
"deps": "dependency-check . && dependency-check . --extra --no-dev",
"deps": "dependency-check . && dependency-check . --extra --no-dev -i nanoassert",
"test": "standard && npm run deps && browserify test/index.js | tape-run",

@@ -23,10 +23,15 @@ "test:fast": "browserify test/diff.js | tape-run",

"license": "MIT",
"dependencies": {},
"dependencies": {
"nanoassert": "^1.1.0"
},
"browser": {
"assert": "nanoassert"
},
"devDependencies": {
"bankai": "^7.6.2",
"bel": "^4.4.3",
"bel": "^5.1.1",
"browserify": "^14.1.0",
"dependency-check": "^2.5.1",
"math-random-seed": "^1.0.0",
"standard": "^7.1.2",
"standard": "^10.0.3",
"tape": "^4.6.0",

@@ -33,0 +38,0 @@ "tape-run": "^3.0.0"

@@ -13,4 +13,10 @@ # nanomorph [![stability][0]][1]

var tree = html`<div>hello people</div>`
tree = morph(tree, html`<div>nanananana-na-no</div>`)
tree = morph(tree, html`<div>teeny, tiny, tin bottle</div>`)
document.body.appendChild(tree)
// document.body === <body><div>hello people</div></body>
morph(tree, html`<div>nanananana-na-no</div>`)
// document.body === <body><div>nanananana-na-no</div></body>
morph(tree, html`<div>teeny, tiny, tin bottle</div>`)
// document.body === <body><div>teeny, tiny, tin bottle</div></body>
```

@@ -26,4 +32,17 @@

## Reordering Lists
[tbi]
It's common to work with lists of elements on the DOM. Adding, removing or
reordering elements in a list can be rather expensive. To optimize this you can
add an `id` attribute to a DOM node. When reordering nodes it will compare
nodes with the same ID against each other, resulting in far fewer re-renders.
This is especially potent when coupled with DOM node caching.
```js
var el = html`
<section>
<div id="first">hello</div>
<div id="second">world</div>
</section>
`
```
## Caching DOM elements

@@ -101,10 +120,10 @@ Sometimes we want to tell the algorithm to not evaluate certain nodes (and its

[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[0]: https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/nanomorph.svg?style=flat-square
[3]: https://npmjs.org/package/nanomorph
[4]: https://img.shields.io/travis/yoshuawuyts/nanomorph/master.svg?style=flat-square
[5]: https://travis-ci.org/yoshuawuyts/nanomorph
[6]: https://img.shields.io/codecov/c/github/yoshuawuyts/nanomorph/master.svg?style=flat-square
[7]: https://codecov.io/github/yoshuawuyts/nanomorph
[4]: https://img.shields.io/travis/choojs/nanomorph/master.svg?style=flat-square
[5]: https://travis-ci.org/choojs/nanomorph
[6]: https://img.shields.io/codecov/c/github/choojs/nanomorph/master.svg?style=flat-square
[7]: https://codecov.io/github/choojs/nanomorph
[8]: http://img.shields.io/npm/dm/nanomorph.svg?style=flat-square

@@ -111,0 +130,0 @@ [9]: https://npmjs.org/package/nanomorph

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