Socket
Socket
Sign inDemoInstall

@riotjs/dom-bindings

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@riotjs/dom-bindings - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

59

dist/umd.dom-bindings.js

@@ -168,43 +168,2 @@ (function (global, factory) {

/**
* Get the current <template> fragment children located in between the head and tail comments
* @param {Comment} head - head comment node
* @param {Comment} tail - tail comment node
* @return {Array[]} children list of the nodes found in this template fragment
*/
function getFragmentChildren({ head, tail }) {
const nodes = walkNodes([head], head.nextSibling, n => n === tail, false);
nodes.push(tail);
return nodes
}
/**
* Recursive function to walk all the <template> children nodes
* @param {Array[]} children - children nodes collection
* @param {ChildNode} node - current node
* @param {Function} check - exit function check
* @param {boolean} isFilterActive - filter flag to skip nodes managed by other bindings
* @returns {Array[]} children list of the nodes found in this template fragment
*/
function walkNodes(children, node, check, isFilterActive) {
const {nextSibling} = node;
// filter tail and head nodes together with all the nodes in between
// this is needed only to fix a really ugly edge case https://github.com/riot/riot/issues/2892
if (!isFilterActive && !node[HEAD_SYMBOL] && !node[TAIL_SYMBOL]) {
children.push(node);
}
if (!nextSibling || check(node)) return children
return walkNodes(
children,
nextSibling,
check,
// activate the filters to skip nodes between <template> fragments that will be managed by other bindings
isFilterActive && !node[TAIL_SYMBOL] || nextSibling[HEAD_SYMBOL]
)
}
/**
* Quick type checking

@@ -488,5 +447,2 @@ * @param {*} element - anything

// make sure that the loop edge nodes are marked
markEdgeNodes(this.nodes);
return this

@@ -561,15 +517,2 @@ },

/**
* Mark the first and last nodes in order to ignore them in case we need to retrieve the <template> fragment nodes
* @param {Array[]} nodes - each binding nodes list
* @returns {undefined} void function
*/
function markEdgeNodes(nodes) {
const first = nodes[0];
const last = nodes[nodes.length - 1];
if (first) first[HEAD_SYMBOL] = true;
if (last) last[TAIL_SYMBOL] = true;
}
/**
* Loop the current template items

@@ -615,3 +558,3 @@ * @param {Array} items - expression collection value

if (isTemplateTag) {
nodes.push(...(mustMount ? meta.children : getFragmentChildren(meta)));
nodes.push(...meta.children);
} else {

@@ -618,0 +561,0 @@ nodes.push(el);

2

package.json
{
"name": "@riotjs/dom-bindings",
"version": "6.0.2",
"version": "6.0.3",
"description": "Riot.js DOM bindings",

@@ -5,0 +5,0 @@ "main": "dist/umd.dom-bindings.js",

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

import {HEAD_SYMBOL, TAIL_SYMBOL} from '../constants'
import {insertBefore, removeChild} from '@riotjs/util/dom'
import createTemplateMeta from '../util/create-template-meta'
import {defineProperty} from '@riotjs/util/objects'
import getFragmentChildren from '../util/get-fragment-children'
import {isTemplate} from '@riotjs/util/checks'

@@ -61,5 +59,2 @@ import udomdiff from '../util/udomdiff'

// make sure that the loop edge nodes are marked
markEdgeNodes(this.nodes)
return this

@@ -134,15 +129,2 @@ },

/**
* Mark the first and last nodes in order to ignore them in case we need to retrieve the <template> fragment nodes
* @param {Array[]} nodes - each binding nodes list
* @returns {undefined} void function
*/
function markEdgeNodes(nodes) {
const first = nodes[0]
const last = nodes[nodes.length - 1]
if (first) first[HEAD_SYMBOL] = true
if (last) last[TAIL_SYMBOL] = true
}
/**
* Loop the current template items

@@ -188,3 +170,3 @@ * @param {Array} items - expression collection value

if (isTemplateTag) {
nodes.push(...(mustMount ? meta.children : getFragmentChildren(meta)))
nodes.push(...meta.children)
} else {

@@ -191,0 +173,0 @@ nodes.push(el)

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