snabbdom-virtualize
Advanced tools
Comparing version 0.3.0 to 0.4.0
{ | ||
"name": "snabbdom-virtualize", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Library for turning strings and DOM nodes into virtual DOM nodes compatible with snabbdom.", | ||
@@ -17,7 +17,7 @@ "author": { | ||
"prepublish": "npm run build", | ||
"build": "webpack --config webpack.config.js", | ||
"watch": "webpack --watch --config webpack.config.js", | ||
"build": "babel src -d lib", | ||
"watch": "npm run build -- --watch", | ||
"test": "karma start test/karma.conf.js" | ||
}, | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"devDependencies": { | ||
@@ -24,0 +24,0 @@ "babel-cli": "^6.3.17", |
@@ -19,3 +19,3 @@ # snabbdom-virtualize [![Build Status](https://travis-ci.org/appcues/snabbdom-virtualize.svg?branch=master)](https://travis-ci.org/appcues/snabbdom-virtualize) | ||
// Require. | ||
var virtualize = require('snabbdom-virtualize'); | ||
let virtualize = require('snabbdom-virtualize'); | ||
``` | ||
@@ -27,5 +27,5 @@ | ||
// Actual DOM nodes | ||
var topNode = document.createElement('div'); | ||
var textNode = document.createTextNode('Click '); | ||
var linkNode = document.createElement('a'); | ||
let topNode = document.createElement('div'); | ||
let textNode = document.createTextNode('Click '); | ||
let linkNode = document.createElement('a'); | ||
linkNode.setAttribute('href', 'http://example.com'); | ||
@@ -35,8 +35,37 @@ linkNode.textContent = 'here'; | ||
topNode.appendChild(linkNode); | ||
var vnode = virtualize(topNode); | ||
let vnode = virtualize(topNode); | ||
// String | ||
var vnode = virtualize('<div>Click <a href="http://example.com">here</a>'); | ||
let vnode = virtualize('<div>Click <a href="http://example.com">here</a>'); | ||
``` | ||
#### Using modules à la carte | ||
If you'd prefer to import just the function for virtualizing DOM nodes or just | ||
the function for virtualizing HTML strings, you're in luck. Just import | ||
`snabbdom-virtualize/nodes` or `snabbdom-virtualize/strings` and use in the | ||
same way: | ||
```javascript | ||
// DOM nodes. | ||
import virtualize from 'snabbdom-virtualize/nodes'; | ||
let topNode = document.createElement('div'); | ||
let textNode = document.createTextNode('Click '); | ||
let linkNode = document.createElement('a'); | ||
linkNode.setAttribute('href', 'http://example.com'); | ||
linkNode.textContent = 'here'; | ||
topNode.appendChild(textNode); | ||
topNode.appendChild(linkNode); | ||
let vnode = virtualize(topNode); | ||
// HTML strings. | ||
import virtualize from 'snabbdom-virtualize/strings'; | ||
let vnode = virtualize('<div>Click <a href="http://example.com">here</a>'); | ||
``` | ||
### Project setup | ||
@@ -51,3 +80,3 @@ | ||
This will output a compiled `index.js` file in the root directory. | ||
This will output compiled files in the `lib` directory. | ||
@@ -54,0 +83,0 @@ ### Tests |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
10
82
0
12363
231
1