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.2.0 to 1.2.1

2

package.json
{
"name": "vue-fragment",
"version": "1.2.0",
"version": "1.2.1",
"description": "fragment component for vuejs",

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

@@ -8,12 +8,10 @@ # vue-fragment

For others, fragments are basically _root-less_ components. They come useful in many situations where you don't want to pollute the DOM, or you semantically return many elements at once.
For others, fragments are basically _root-less_ components. They come useful in many situations where you don't want to pollute the DOM with a useless container, or you want to return many elements at once.
### How
It's impossible to use functional components or slots, since it's all about vDOM and there is a "you should return one root element" limitation… So, I'm using an (internal) directive which will dump all children of the target node into its parent at the time of insertion. Since directives can manipulate DOM, we can bypass that limitation.
## how
It's impossible to use functional components or slots, since Vue.js vDOM diffing has a "you should return one root element" limitation… Instead, I'm using an (internal) directive which will dump all the children of the fragment root node in its place. Since directives can manipulate DOM, we can act after rendering and bypass Vue limitation.
TL;DR : I'm adding a `Fragment` component `<fragment />`.
The component is called `Fragment` so you won't have to change much code when Vue3 native fragments arrive. That said, **I'm not a core developer of Vue.js, and I don't have any view of their implementation. I only know what fragments are and how they should work, and did my best to reproduce it ; so it _should_ be fine.**
**The component is called `Fragment` after interesting discussions in issues/ about supporting a smooth transition to Vue3 native fragments.**
### Use
## use
- download the package `npm i -s vue-fragment`

@@ -20,0 +18,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