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

snabbdom

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snabbdom - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

#snabbdom.js#

2

.vscode/settings.json
{
"typescript.check.workspaceVersion": false
"typescript.tsdk": "./node_modules/typescript/lib"
}

@@ -16,3 +16,3 @@ "use strict";

function updateAttrs(oldVnode, vnode) {
var key, cur, old, elm = vnode.elm, oldAttrs = oldVnode.data.attrs, attrs = vnode.data.attrs, namespaceSplit;
var key, elm = vnode.elm, oldAttrs = oldVnode.data.attrs, attrs = vnode.data.attrs, namespaceSplit;
if (!oldAttrs && !attrs)

@@ -26,17 +26,25 @@ return;

for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
var cur = attrs[key];
var old = oldAttrs[key];
if (old !== cur) {
if (!cur && booleanAttrsDict[key])
elm.removeAttribute(key);
if (booleanAttrsDict[key]) {
if (cur) {
elm.setAttribute(key, "");
}
else {
elm.removeAttribute(key);
}
}
else {
namespaceSplit = key.split(":");
if (namespaceSplit.length > 1 && NamespaceURIs.hasOwnProperty(namespaceSplit[0]))
if (namespaceSplit.length > 1 && NamespaceURIs.hasOwnProperty(namespaceSplit[0])) {
elm.setAttributeNS(NamespaceURIs[namespaceSplit[0]], key, cur);
else
}
else {
elm.setAttribute(key, cur);
}
}
}
}
//remove removed attributes
// remove removed attributes
// use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)

@@ -43,0 +51,0 @@ // the other option is to remove all attributes with value == undefined

{
"name": "snabbdom",
"version": "0.6.5",
"version": "0.6.6",
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.",

@@ -5,0 +5,0 @@ "main": "snabbdom.js",

@@ -15,3 +15,4 @@ import {VNode, VNodeData} from '../vnode';

const booleanAttrsDict = Object.create(null);
const booleanAttrsDict: {[attribute: string]: boolean} = Object.create(null);
for (let i = 0, len = booleanAttrs.length; i < len; i++) {

@@ -22,3 +23,3 @@ booleanAttrsDict[booleanAttrs[i]] = true;

function updateAttrs(oldVnode: VNode, vnode: VNode): void {
var key: string, cur: any, old: any, elm: Element = vnode.elm as Element,
var key: string, elm: Element = vnode.elm as Element,
oldAttrs = (oldVnode.data as VNodeData).attrs,

@@ -34,17 +35,22 @@ attrs = (vnode.data as VNodeData).attrs, namespaceSplit: Array<string>;

for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
const cur = attrs[key];
const old = oldAttrs[key];
if (old !== cur) {
if (!cur && booleanAttrsDict[key])
elm.removeAttribute(key);
else {
if (booleanAttrsDict[key]) {
if (cur) {
elm.setAttribute(key, "");
} else {
elm.removeAttribute(key);
}
} else {
namespaceSplit = key.split(":");
if (namespaceSplit.length > 1 && NamespaceURIs.hasOwnProperty(namespaceSplit[0]))
if (namespaceSplit.length > 1 && NamespaceURIs.hasOwnProperty(namespaceSplit[0])) {
elm.setAttributeNS((NamespaceURIs as any)[namespaceSplit[0]], key, cur);
else
} else {
elm.setAttribute(key, cur);
}
}
}
}
//remove removed attributes
// remove removed attributes
// use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)

@@ -51,0 +57,0 @@ // the other option is to remove all attributes with value == undefined

Sorry, the diff of this file is not supported yet

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