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

test-drive

Package Overview
Dependencies
Maintainers
3
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-drive - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

cjs/select-dom.d.ts

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

export declare function selectDom(container: Element, attrName?: string): <T extends Element>(...selectors: string[]) => T | null;
export declare function selectDom(container: Element, attrName?: string): (...selectors: string[]) => Element | null;
//# sourceMappingURL=select-dom.d.ts.map

@@ -11,3 +11,3 @@ "use strict";

const selectorExpr = `[${attrName}~="${selector}"]`;
const elementList = Array.prototype.slice.call(parentElement.querySelectorAll(selectorExpr));
const elementList = [...parentElement.querySelectorAll(selectorExpr)];
if (dom_matches_1.default(parentElement, selectorExpr)) {

@@ -14,0 +14,0 @@ elementList.unshift(parentElement);

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

export declare function selectDom(container: Element, attrName?: string): <T extends Element>(...selectors: string[]) => T | null;
export declare function selectDom(container: Element, attrName?: string): (...selectors: string[]) => Element | null;
//# sourceMappingURL=select-dom.d.ts.map

@@ -6,3 +6,3 @@ import matches from 'dom-matches';

const selectorExpr = `[${attrName}~="${selector}"]`;
const elementList = Array.prototype.slice.call(parentElement.querySelectorAll(selectorExpr));
const elementList = [...parentElement.querySelectorAll(selectorExpr)];
if (matches(parentElement, selectorExpr)) {

@@ -9,0 +9,0 @@ elementList.unshift(parentElement);

{
"name": "test-drive",
"version": "1.0.2",
"version": "1.0.3",
"description": "Opinionated library for writing web component tests",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

@@ -5,9 +5,11 @@ import matches from 'dom-matches';

function select<T extends Element>(parentElement: Element, ...selectors: string[]): T | null {
function select(parentElement: Element, ...selectors: string[]): Element | null {
const [selector, ...rest] = selectors;
const selectorExpr = `[${attrName}~="${selector}"]`;
const elementList: T[] = Array.prototype.slice.call(parentElement.querySelectorAll(selectorExpr));
const elementList = [...parentElement.querySelectorAll(selectorExpr)];
if (matches(parentElement, selectorExpr)) {
elementList.unshift(parentElement as T);
elementList.unshift(parentElement);
}
if (elementList.length === 0) {

@@ -18,5 +20,5 @@ return null;

if (rest.length > 0) {
return select<T>(element, ...rest);
return select(element, ...rest);
} else {
return element as T;
return element;
}

@@ -28,5 +30,5 @@ } else {

return function <T extends Element>(...selectors: string[]) {
return select<T>(container, ...selectors);
return function (...selectors: string[]) {
return select(container, ...selectors);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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