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

vdom-virtualize

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vdom-virtualize - npm Package Compare versions

Comparing version 0.0.13 to 1.0.0

vcomment.js

31

index.js

@@ -26,2 +26,3 @@ /*!

, VText = require("virtual-dom/vnode/vtext")
, VComment = require("./vcomment")

@@ -35,2 +36,3 @@ module.exports = createVNode

if(domNode.nodeType == 3) return createFromTextNode(domNode, key)
if(domNode.nodeType == 8) return createFromCommentNode(domNode, key)
return

@@ -40,6 +42,22 @@ }

createVNode.fromHTML = function(html, key) {
var domNode = document.createElement('div'); // create container
domNode.innerHTML = html; // browser parses HTML into DOM tree
var child = domNode.children.length ? domNode.children[0] : domNode.firstChild;
return createVNode(child, key);
var rootNode = null;
try {
// Everything except iOS 7 Safari, IE 8/9, Andriod Browser 4.1/4.3
var parser = new DOMParser();
var doc = parser.parseFromString(html, 'text/html');
rootNode = doc.documentElement;
} catch(e) {
// Old browsers
var ifr = document.createElement('iframe');
ifr.setAttribute('data-content', html);
ifr.src = 'javascript: window.frameElement.getAttribute("data-content");';
document.head.appendChild(ifr);
rootNode = ifr.contentDocument.documentElement;
setTimeout(function() {
ifr.remove(); // Garbage collection
}, 0);
}
return createVNode(rootNode, key);
};

@@ -52,2 +70,7 @@

function createFromCommentNode(cNode) {
return new VComment(cNode.nodeValue)
}
function createFromElement(el) {

@@ -54,0 +77,0 @@ var tagName = el.tagName

4

package.json
{
"name": "vdom-virtualize",
"version": "0.0.13",
"version": "1.0.0",
"description": "Virtulize any DOM node and turn it into a virtual-dom node.",
"main": "index.js",
"dependencies": {
"peerDependencies": {
"virtual-dom": "2.0.1"

@@ -8,0 +8,0 @@ },

# vdom-virtualize
**New in v1.0:** vdom-virtualize now supports comments and does now use peerDependencies to depend on virtual-dom.
## API

@@ -4,0 +6,0 @@

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