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

@spectrum-web-components/shared

Package Overview
Dependencies
Maintainers
6
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/shared - npm Package Compare versions

Comparing version 0.12.0 to 0.12.1

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [0.12.1](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/shared@0.12.0...@spectrum-web-components/shared@0.12.1) (2021-03-29)
**Note:** Version bump only for package @spectrum-web-components/shared
# [0.12.0](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/shared@0.11.1...@spectrum-web-components/shared@0.12.0) (2021-03-22)

@@ -8,0 +12,0 @@

4

package.json

@@ -21,3 +21,3 @@ {

],
"version": "0.12.0",
"version": "0.12.1",
"description": "",

@@ -52,3 +52,3 @@ "main": "./src/index.js",

},
"gitHead": "ca6cd53b42caa5c52255f2af313d1689cf67157f"
"gitHead": "4defd67aae71ad095d1c001bd1d23665edf39b24"
}

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

export declare const reparentChildren: (srcElements: Element[], newParent: Element) => Function;
export declare const reparentChildren: (srcElements: Element[], newParent: Element) => (() => Element[]);

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

function restoreChildren(placeholderItems, srcElements) {
function restoreChildren(placeholderItems, srcElements, slotNames) {
for (let index = 0; index < srcElements.length; ++index) {

@@ -6,8 +6,13 @@ const srcElement = srcElements[index];

const parentElement = placeholderItem.parentElement || placeholderItem.getRootNode();
if (slotNames[index]) {
srcElement.slot = slotNames[index];
}
parentElement.replaceChild(srcElement, placeholderItem);
delete placeholderItems[index];
}
return srcElements;
}
export const reparentChildren = (srcElements, newParent) => {
let placeholderItems = [];
let slotNames = [];
for (let index = 0; index < srcElements.length; ++index) {

@@ -17,2 +22,4 @@ const placeholderItem = document.createComment('placeholder for reparented element');

const srcElement = srcElements[index];
slotNames.push(srcElement.slot);
srcElement.removeAttribute('slot');
const parentElement = srcElement.parentElement || srcElement.getRootNode();

@@ -23,5 +30,5 @@ parentElement.replaceChild(placeholderItem, srcElement);

return function () {
restoreChildren(placeholderItems, srcElements);
return restoreChildren(placeholderItems, srcElements, slotNames);
};
};
//# sourceMappingURL=reparent-children.js.map
function restoreChildren(
placeholderItems: Comment[],
srcElements: Element[]
): void {
srcElements: Element[],
slotNames: string[]
): Element[] {
for (let index = 0; index < srcElements.length; ++index) {

@@ -10,5 +11,9 @@ const srcElement = srcElements[index];

placeholderItem.parentElement || placeholderItem.getRootNode();
if (slotNames[index]) {
srcElement.slot = slotNames[index];
}
parentElement.replaceChild(srcElement, placeholderItem);
delete placeholderItems[index];
}
return srcElements;
}

@@ -19,4 +24,5 @@

newParent: Element
): Function => {
): (() => Element[]) => {
let placeholderItems: Comment[] = [];
let slotNames: string[] = [];

@@ -30,2 +36,4 @@ for (let index = 0; index < srcElements.length; ++index) {

const srcElement = srcElements[index];
slotNames.push(srcElement.slot);
srcElement.removeAttribute('slot');
const parentElement =

@@ -37,5 +45,5 @@ srcElement.parentElement || srcElement.getRootNode();

return function () {
restoreChildren(placeholderItems, srcElements);
return function (): Element[] {
return restoreChildren(placeholderItems, srcElements, slotNames);
};
};

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