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

skatejs-named-slots

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skatejs-named-slots - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

bower.json
{
"name": "skatejs-named-slots",
"description": "A polygap (partial polyfill) for the Shadow DOM Named Slot API.",
"main": "lib/index.js",
"main": "dist/index.js",
"authors": [],

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -8,9 +8,7 @@ {

"scripts": {
"test": "karma start --single-run",
"test/watch": "karma start",
"test": "sk-tests",
"test/watch": "sk-tests-watch",
"test/perf": "karma start --single-run --perf",
"build": "rollup --config && rollup --config --min",
"lint": "eslint -c node_modules/skatejs-build/.eslintrc src",
"prerelease": "npm test && eslint -c node_modules/skatejs-build/.eslintrc src && npm run build",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"prepublish": "sk-bundle"
},

@@ -37,4 +35,3 @@ "repository": {

"eslint-plugin-react": "^3.16.1",
"skatejs-build": "1.1.0",
"semantic-release": "^4.3.5"
"skatejs-build": "2.1.1"
},

@@ -51,3 +48,3 @@ "dependencies": {

},
"version": "0.2.0"
"version": "0.2.1"
}

@@ -291,3 +291,3 @@ import { eachChildNode, eachNodeOrFragmentNodes } from './util/each';

if (!canPatchNativeAccessors && !slot.childNodes.push) {
staticProp(slot, 'childNodes', []);
staticProp(slot, 'childNodes', [...slot.childNodes]);
}

@@ -643,2 +643,15 @@

// when we are doing this: root.innerHTML = "<slot><div></div></slot>";
// slot.__childNodes is out of sync with slot.childNodes.
// to fix it we have to manually remove and insert them
if (canPatchNativeAccessors && getNodeType(firstChild) == 'slot' && (firstChild.__childNodes.length != firstChild.childNodes.length)) {
while (firstChild.hasChildNodes()) {
firstChild.removeChild(firstChild.firstChild);
}
for (let i=0; i<firstChild.__childNodes.length; i++) {
firstChild.appendChild(firstChild.__childNodes[i]);
}
}
// When we polyfill everything on HTMLElement.prototype, we overwrite

@@ -645,0 +658,0 @@ // properties. This makes it so that parentNode reports null even though

@@ -82,2 +82,57 @@ import create from '../../lib/create';

});
describe('with slot/fallback content assigned by innerHTML', function () {
let fallback;
beforeEach(function () {
root.innerHTML = '<slot><div></div></slot>';
slot = root.firstChild;
fallback = slot.firstChild;
});
it('should have fallback nodes', function () {
expect(slot.childNodes.length).to.equal(1);
expect(slot.childNodes[0]).to.equal(fallback);
});
it('should have no assigned nodes', function () {
expect(slot.____assignedNodes.length).to.equal(0);
expect(slot.assignedNodes().length).to.equal(0);
});
it('should be in a fallback state', function () {
expect(slot.____isInFallbackMode).to.equal(true);
});
describe('when assigned nodes', function () {
let newNode;
beforeEach(function () {
newNode = create('div');
host.appendChild(newNode);
});
it('should contain assigned nodes', function () {
expect(slot.assignedNodes()[0]).to.equal(newNode);
});
it('should not be in a fallback state', function () {
expect(slot.____isInFallbackMode).to.equal(false);
});
describe('are removed', function () {
beforeEach(function () {
host.removeChild(newNode);
});
it('should not contain the assigned nodes', function () {
expect(slot.assignedNodes().length).to.equal(0);
});
it('should return to a fallback state', function () {
expect(slot.____isInFallbackMode).to.equal(true);
});
});
});
});
});

Sorry, the diff of this file is not supported yet

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