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

vue-fragment

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-fragment - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

2

dist/vue-fragment.esm.js

@@ -1,1 +0,1 @@

function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_defineProperty(e,t,n[t])})}return e}var freeze=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(e){console.warn("tried to set frozen property ".concat(t," with ").concat(e))}})},component={abstract:!0,name:"Fragment",props:{name:{type:String,default:function(){return Math.floor(Date.now()*Math.random()).toString(16)}},html:{type:String,default:null}},mounted:function(){var e=this.$el,t=e.parentNode;e.__isFragment=!0,e.__isMounted=!1;var n=document.createComment("fragment#".concat(this.name,"#head")),r=document.createComment("fragment#".concat(this.name,"#tail"));e.__head=n,e.__tail=r;var o=document.createDocumentFragment();if(o.appendChild(n),Array.from(e.childNodes).forEach(function(t){var n=!t.hasOwnProperty("__isFragmentChild__");o.appendChild(t),n&&(freeze(t,"parentNode",e),freeze(t,"__isFragmentChild__",!0))}),o.appendChild(r),this.html){var a=document.createElement("template");a.innerHTML=this.html,Array.from(a.content.childNodes).forEach(function(e){o.appendChild(e)})}var i=e.nextSibling;t.insertBefore(o,e,!0),t.removeChild(e),freeze(e,"parentNode",t),freeze(e,"nextSibling",i),i&&freeze(i,"previousSibling",e),e.__isMounted=!0},render:function(e){var t=this,n=this.$slots.default;return n&&n.length&&n.forEach(function(e){return e.data=_objectSpread({},e.data,{attrs:_objectSpread({fragment:t.name},(e.data||{}).attrs)})}),e("div",{attrs:{fragment:this.name}},n)}};function ssr(e,t){"production"!==process.env.NODE_ENV&&console.warn("v-fragment SSR is not implemented yet.")}var Fragment=component,SSR=ssr,Plugin={install:function(e){e.component("Fragment",component)}},index={Fragment:component,Plugin:Plugin,SSR:ssr};export default index;export{Fragment,SSR,Plugin};
function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_defineProperty(e,t,n[t])})}return e}var freeze=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(e){console.warn("tried to set frozen property ".concat(t," with ").concat(e))}})},unfreeze=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n})},component={abstract:!0,name:"Fragment",props:{name:{type:String,default:function(){return Math.floor(Date.now()*Math.random()).toString(16)}},html:{type:String,default:null}},mounted:function(){var e=this.$el,t=e.parentNode;e.__isFragment=!0,e.__isMounted=!1;var n=document.createComment("fragment#".concat(this.name,"#head")),r=document.createComment("fragment#".concat(this.name,"#tail"));e.__head=n,e.__tail=r;var i=document.createDocumentFragment();if(i.appendChild(n),Array.from(e.childNodes).forEach(function(t){var n=!t.hasOwnProperty("__isFragmentChild__");i.appendChild(t),n&&(freeze(t,"parentNode",e),freeze(t,"__isFragmentChild__",!0))}),i.appendChild(r),this.html){var o=document.createElement("template");o.innerHTML=this.html,Array.from(o.content.childNodes).forEach(function(e){i.appendChild(e)})}var a=e.nextSibling;t.insertBefore(i,e,!0),t.removeChild(e),freeze(e,"parentNode",t),freeze(e,"nextSibling",a),a&&freeze(a,"previousSibling",e),e.__isMounted=!0},render:function(e){var t=this,n=this.$slots.default;return n&&n.length&&n.forEach(function(e){return e.data=_objectSpread({},e.data,{attrs:_objectSpread({fragment:t.name},(e.data||{}).attrs)})}),e("div",{attrs:{fragment:this.name}},n)}};function ssr(e,t){"production"!==process.env.NODE_ENV&&console.warn("v-fragment SSR is not implemented yet.")}var Fragment=component,SSR=ssr,Plugin={install:function(e){var t=window.Node.prototype.removeChild;window.Node.prototype.removeChild=function(e){if(!this.__isFragment){if(e.__isFragment&&e.__isMounted){for(;e.__head.nextSibling!==e.__tail;)t.call(this,e.__head.nextSibling);t.call(this,e.__head),t.call(this,e.__tail);var n=e.__head.previousSibling,r=e.__tail.nextSibling;return n&&freeze(n,"nextSibling",r),r&&freeze(r,"previousSibling",n),unfreeze(e,"parentNode"),e}var i=e.previousSibling,o=e.nextSibling,a=t.call(this,e);return i&&freeze(i,"nextSibling",o),o&&freeze(o,"previousSibling",i),a}if(this.parentNode){var l=this.parentNode.removeChild(e);return unfreeze(e,"parentNode"),l}};var n=window.Node.prototype.insertBefore;window.Node.prototype.insertBefore=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t&&t.__isFragment&&t.__isMounted?t.__head:t;if(this.__isFragment){var o=!e.hasOwnProperty("__isFragmentChild__"),a=!r||o;o&&freeze(e,"__isFragmentChild__",!0);var l=this.parentNode?this.parentNode.insertBefore(e,t):n.call(this,e,i);return a&&freeze(e,"parentNode",this),l}if(e.__isFragment&&e.__isMounted){if(e===t)return void console.error("something must be wrong");freeze(e,"parentNode",this),e.previousSibling&&freeze(e.previousSibling,"nextSibling",e.nextSibling),e.nextSibling&&freeze(e.nextSibling,"previousSibling",e.previousSibling),freeze(e,"nextSibling",t),freeze(e,"previousSibling",t.previousSibling),t.previousSibling&&freeze(t.previousSibling,"nextSibling",e),freeze(t,"previousSibling",e);for(var d=document.createDocumentFragment(),s=e.__head;s!==e.__tail;)d.appendChild(s),s=s.nextSibling;return d.appendChild(e.__tail),n.call(this,d,i),e}return n.call(this,e,i)};var r=window.Node.prototype.appendChild;window.Node.prototype.appendChild=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.__isFragment)return r.call(this,e);if(this.parentNode){var n=!e.hasOwnProperty("__isFragmentChild__"),i=!t||n;n&&freeze(e,"__isFragmentChild__",!0);var o=this.parentNode.insertBefore(e,this.__tail,t);return i&&freeze(e,"parentNode",this),o}},e.component("Fragment",component)}},index={Fragment:component,Plugin:Plugin,SSR:ssr};export default index;export{Fragment,SSR,Plugin};

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Fragment={})}(this,function(e){"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(n){t(e,n,r[n])})}return e}var r=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(e){console.warn("tried to set frozen property ".concat(t," with ").concat(e))}})},o={abstract:!0,name:"Fragment",props:{name:{type:String,default:function(){return Math.floor(Date.now()*Math.random()).toString(16)}},html:{type:String,default:null}},mounted:function(){var e=this.$el,t=e.parentNode;e.__isFragment=!0,e.__isMounted=!1;var n=document.createComment("fragment#".concat(this.name,"#head")),o=document.createComment("fragment#".concat(this.name,"#tail"));e.__head=n,e.__tail=o;var a=document.createDocumentFragment();if(a.appendChild(n),Array.from(e.childNodes).forEach(function(t){var n=!t.hasOwnProperty("__isFragmentChild__");a.appendChild(t),n&&(r(t,"parentNode",e),r(t,"__isFragmentChild__",!0))}),a.appendChild(o),this.html){var i=document.createElement("template");i.innerHTML=this.html,Array.from(i.content.childNodes).forEach(function(e){a.appendChild(e)})}var c=e.nextSibling;t.insertBefore(a,e,!0),t.removeChild(e),r(e,"parentNode",t),r(e,"nextSibling",c),c&&r(c,"previousSibling",e),e.__isMounted=!0},render:function(e){var t=this,r=this.$slots.default;return r&&r.length&&r.forEach(function(e){return e.data=n({},e.data,{attrs:n({fragment:t.name},(e.data||{}).attrs)})}),e("div",{attrs:{fragment:this.name}},r)}};var a=o,i=function(e,t){"production"!==process.env.NODE_ENV&&console.warn("v-fragment SSR is not implemented yet.")},c={install:function(e){e.component("Fragment",o)}},u={Fragment:a,Plugin:c,SSR:i};e.Fragment=a,e.SSR=i,e.Plugin=c,e.default=u,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Fragment={})}(this,function(e){"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(n){t(e,n,i[n])})}return e}var i=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,get:function(){return n},set:function(e){console.warn("tried to set frozen property ".concat(t," with ").concat(e))}})},r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n})},o={abstract:!0,name:"Fragment",props:{name:{type:String,default:function(){return Math.floor(Date.now()*Math.random()).toString(16)}},html:{type:String,default:null}},mounted:function(){var e=this.$el,t=e.parentNode;e.__isFragment=!0,e.__isMounted=!1;var n=document.createComment("fragment#".concat(this.name,"#head")),r=document.createComment("fragment#".concat(this.name,"#tail"));e.__head=n,e.__tail=r;var o=document.createDocumentFragment();if(o.appendChild(n),Array.from(e.childNodes).forEach(function(t){var n=!t.hasOwnProperty("__isFragmentChild__");o.appendChild(t),n&&(i(t,"parentNode",e),i(t,"__isFragmentChild__",!0))}),o.appendChild(r),this.html){var a=document.createElement("template");a.innerHTML=this.html,Array.from(a.content.childNodes).forEach(function(e){o.appendChild(e)})}var l=e.nextSibling;t.insertBefore(o,e,!0),t.removeChild(e),i(e,"parentNode",t),i(e,"nextSibling",l),l&&i(l,"previousSibling",e),e.__isMounted=!0},render:function(e){var t=this,i=this.$slots.default;return i&&i.length&&i.forEach(function(e){return e.data=n({},e.data,{attrs:n({fragment:t.name},(e.data||{}).attrs)})}),e("div",{attrs:{fragment:this.name}},i)}};var a=o,l=function(e,t){"production"!==process.env.NODE_ENV&&console.warn("v-fragment SSR is not implemented yet.")},d={install:function(e){var t=window.Node.prototype.removeChild;window.Node.prototype.removeChild=function(e){if(!this.__isFragment){if(e.__isFragment&&e.__isMounted){for(;e.__head.nextSibling!==e.__tail;)t.call(this,e.__head.nextSibling);t.call(this,e.__head),t.call(this,e.__tail);var n=e.__head.previousSibling,o=e.__tail.nextSibling;return n&&i(n,"nextSibling",o),o&&i(o,"previousSibling",n),r(e,"parentNode"),e}var a=e.previousSibling,l=e.nextSibling,d=t.call(this,e);return a&&i(a,"nextSibling",l),l&&i(l,"previousSibling",a),d}if(this.parentNode){var s=this.parentNode.removeChild(e);return r(e,"parentNode"),s}};var n=window.Node.prototype.insertBefore;window.Node.prototype.insertBefore=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t&&t.__isFragment&&t.__isMounted?t.__head:t;if(this.__isFragment){var a=!e.hasOwnProperty("__isFragmentChild__"),l=!r||a;a&&i(e,"__isFragmentChild__",!0);var d=this.parentNode?this.parentNode.insertBefore(e,t):n.call(this,e,o);return l&&i(e,"parentNode",this),d}if(e.__isFragment&&e.__isMounted){if(e===t)return void console.error("something must be wrong");i(e,"parentNode",this),e.previousSibling&&i(e.previousSibling,"nextSibling",e.nextSibling),e.nextSibling&&i(e.nextSibling,"previousSibling",e.previousSibling),i(e,"nextSibling",t),i(e,"previousSibling",t.previousSibling),t.previousSibling&&i(t.previousSibling,"nextSibling",e),i(t,"previousSibling",e);for(var s=document.createDocumentFragment(),u=e.__head;u!==e.__tail;)s.appendChild(u),u=u.nextSibling;return s.appendChild(e.__tail),n.call(this,s,o),e}return n.call(this,e,o)};var a=window.Node.prototype.appendChild;window.Node.prototype.appendChild=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.__isFragment)return a.call(this,e);if(this.parentNode){var n=!e.hasOwnProperty("__isFragmentChild__"),r=!t||n;n&&i(e,"__isFragmentChild__",!0);var o=this.parentNode.insertBefore(e,this.__tail,t);return r&&i(e,"parentNode",this),o}},e.component("Fragment",o)}},s={Fragment:a,Plugin:d,SSR:l};e.Fragment=a,e.SSR=l,e.Plugin=d,e.default=s,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vue-fragment",
"version": "1.5.3",
"version": "1.6.0",
"description": "fragment component for vuejs",

@@ -5,0 +5,0 @@ "main": "dist/vue-fragment.min.js",

@@ -1,2 +0,2 @@

const freeze = (object, property, value) => {
export const freeze = (object, property, value) => {
Object.defineProperty(object, property, {

@@ -9,3 +9,3 @@ configurable: true,

const unfreeze = (object, property, value = null) => {
export const unfreeze = (object, property, value = null) => {
Object.defineProperty(object, property, {

@@ -49,3 +49,3 @@ configurable: true,

tpl.appendChild(head)
Array.from(container.childNodes)

@@ -52,0 +52,0 @@ .forEach(node => {

@@ -1,3 +0,3 @@

import component from './component'
import ssr from './ssr'
import component, { freeze, unfreeze } from './component'
import ssr from './ssr'

@@ -9,9 +9,97 @@ export const Fragment = component

export const Plugin = {
install: function(Vue) {
install: function (Vue) {
const orgRemoveChild = window.Node.prototype.removeChild
window.Node.prototype.removeChild = function (node) {
if (this.__isFragment) {
if (this.parentNode) {
let ret = this.parentNode.removeChild(node)
unfreeze(node, 'parentNode')
return ret
}
} else if (node.__isFragment && node.__isMounted) {
while (node.__head.nextSibling !== node.__tail) orgRemoveChild.call(this, node.__head.nextSibling)
orgRemoveChild.call(this, node.__head)
orgRemoveChild.call(this, node.__tail)
let prev = node.__head.previousSibling,
next = node.__tail.nextSibling
if (prev) freeze(prev, 'nextSibling', next)
if (next) freeze(next, 'previousSibling', prev)
unfreeze(node, 'parentNode')
return node
} else {
let prev = node.previousSibling,
next = node.nextSibling
let ret = orgRemoveChild.call(this, node)
if (prev) freeze(prev, 'nextSibling', next)
if (next) freeze(next, 'previousSibling', prev)
return ret
}
}
const orgInsertBefore = window.Node.prototype.insertBefore
window.Node.prototype.insertBefore = function (node, ref, inFragment = false) {
let realRef = !!ref && !!ref.__isFragment && !!ref.__isMounted ? ref.__head : ref
if (this.__isFragment) {
let notFrChild = !node.hasOwnProperty('__isFragmentChild__'),
freezeParent = !inFragment || notFrChild
notFrChild && freeze(node, '__isFragmentChild__', true)
let ret = this.parentNode ? this.parentNode.insertBefore(node, ref) : orgInsertBefore.call(this, node, realRef)
freezeParent && freeze(node, 'parentNode', this)
return ret
} else if (node.__isFragment && node.__isMounted) {
if (node === ref) {
console.error('something must be wrong')
return
}
freeze(node, 'parentNode', this)
if (node.previousSibling) freeze(node.previousSibling, 'nextSibling', node.nextSibling)
if (node.nextSibling) freeze(node.nextSibling, 'previousSibling', node.previousSibling)
freeze(node, 'nextSibling', ref)
freeze(node, 'previousSibling', ref.previousSibling)
if (ref.previousSibling) freeze(ref.previousSibling, 'nextSibling', node)
freeze(ref, 'previousSibling', node)
let tpl = document.createDocumentFragment(),
ele = node.__head
while (ele !== node.__tail) {
tpl.appendChild(ele)
ele = ele.nextSibling
}
tpl.appendChild(node.__tail)
orgInsertBefore.call(this, tpl, realRef)
return node
} else {
return orgInsertBefore.call(this, node, realRef)
}
}
const orgAppendChild = window.Node.prototype.appendChild
window.Node.prototype.appendChild = function (node, inFragment = false) {
if (this.__isFragment) {
if (this.parentNode) {
let notFrChild = !node.hasOwnProperty('__isFragmentChild__'),
freezeParent = !inFragment || notFrChild
notFrChild && freeze(node, '__isFragmentChild__', true)
let ret = this.parentNode.insertBefore(node, this.__tail, inFragment)
freezeParent && freeze(node, 'parentNode', this)
return ret
}
} else {
return orgAppendChild.call(this, node)
}
}
Vue.component('Fragment', component)
}
},
}
export default {
Fragment, Plugin, SSR
Fragment,
Plugin,
SSR,
}
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