Socket
Socket
Sign inDemoInstall

morphdom

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morphdom - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

11

lib/index.js

@@ -22,8 +22,11 @@ var specialElHandlers = {

INPUT: function(fromEl, toEl) {
if (toEl.hasAttribute('value')) {
fromEl.value = toEl.value;
fromEl.checked = toEl.checked;
fromEl.value = toEl.value;
if (!toEl.hasAttribute('checked')) {
fromEl.removeAttribute('checked');
}
if (toEl.hasAttribute('checked')) {
fromEl.checked = toEl.checked;
if (!toEl.hasAttribute('value')) {
fromEl.removeAttribute('value');
}

@@ -30,0 +33,0 @@ }

@@ -36,3 +36,3 @@ {

"dependencies": {},
"version": "0.1.8"
"version": "0.1.9"
}
morphdom
========
[![Build Status](https://travis-ci.org/patrick-steele-idem/morphdom.svg?branch=master)](https://travis-ci.org/patrick-steele-idem/morphdom)
_NOTE: This module is experimental, but seems to work in the latest browsers (including IE9+)._

@@ -16,2 +18,10 @@

First install the module into your project:
```
npm install morphdom --save
```
The code below shows how to morph one `<div>` element to another `<div>` element.
```javascript

@@ -38,6 +48,8 @@ var morphdom = require('morphdom');

el1.className = 'foo';
el1.innerHTML = 'Hello John';
morphdom(el1, '<div class="bar"></div>');
morphdom(el1, '<div class="bar">Hello Frank</div>');
expect(el1.className).to.equal('bar');
expect(el1.innerHTML).to.equal('Hello Frank');
```

@@ -54,3 +66,3 @@

- *fromNode* (`Node`)- The node to morph
- *toNode* (`Node`) - The node that the `fromNode` should be morphed to
- *toNode* (`Node`|`String`) - The node that the `fromNode` should be morphed to (or an HTML string)
- *options* (`Object`) - See below for supported options

@@ -87,6 +99,8 @@

- `el.firstChild`
- `el.tagName`
- `el.nextSibling`
- `el.attributes`
- `node.firstChild`
- `node.tagName`
- `node.nextSibling`
- `node.attributes`
- `node.nodeType`
- `node.nodeValue`

@@ -103,2 +117,3 @@ ## What about the virtual DOM?

- The real DOM _cannot_ be modified behind the scenes (e.g., no jQuery) because the diff is done against the virtual DOM tree
- A [lightweight] copy of the real DOM must be maintained in memory at all times
- The virtual DOM is an abstraction layer that introduces code overhead

@@ -118,2 +133,10 @@ - The virtual DOM representations are not standardized (will vary by implementation)

## Is this module used by any library/framework?
This module will be used by the next major version of [Marko Widgets](https://github.com/marko-js/marko-widgets) (currently in beta: `npm install marko-widgets@5.0.0-beta --save`). Marko Widgets is a high performance and lightweight UI components framework for the [Marko templating engine](https://github.com/marko-js/marko).
You can see how Marko Widgets compares to React in performance by taking a look at the following benchmark: [Marko vs React: Performance Benchmark](https://github.com/patrick-steele-idem/marko-vs-react)
However, `morphdom` was designed to be standalone and will work with any library or framework.
# Benchmarks

@@ -129,3 +152,3 @@

The average time for each test is shown in the table below:
The table below shows some sample benchmark results when running the benchmarks on a MacBook Pro (2.8 GHz Intel Core i7, 16 GB 1600 MHz DDR3). The average time per iteration for each test is shown in the table below:

@@ -132,0 +155,0 @@ <table>

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