New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@qualweb/qw-element

Package Overview
Dependencies
Maintainers
3
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@qualweb/qw-element - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

67

dist/index.js

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

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -8,10 +8,67 @@ exports.QWElement = void 0;

this.elementsCSSRules = elementsCSSRules;
this.selector = "";
this.selector = '';
}
addCSSRulesPropertyToElement(element) {
var _a, _b;
var _a;
if (element && ((_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.has(element))) {
element.setAttribute('_cssRules', JSON.stringify((_b = this.elementsCSSRules) === null || _b === void 0 ? void 0 : _b.get(element)));
element.setAttribute('_cssRules', 'true');
}
}
hasCSSRules() {
return this.element.getAttribute('_cssRules') === 'true';
}
getCSSRules() {
var _a;
return (_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.get(this.element);
}
hasCSSProperty(property, pseudoStyle, media) {
var _a, _b;
if ((_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.has(this.element)) {
const rules = (_b = this.elementsCSSRules) === null || _b === void 0 ? void 0 : _b.get(this.element);
if (pseudoStyle && media) {
return rules['media'][media][pseudoStyle][property] !== undefined;
}
else if (pseudoStyle) {
return rules[pseudoStyle][property] !== undefined;
}
else if (media) {
return rules['media'][media][property] !== undefined;
}
return rules[property] !== undefined;
}
return false;
}
getCSSProperty(property, pseudoStyle, media) {
var _a, _b;
if ((_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.has(this.element)) {
const rules = (_b = this.elementsCSSRules) === null || _b === void 0 ? void 0 : _b.get(this.element);
if (pseudoStyle && media) {
return rules['media'][media][pseudoStyle][property];
}
else if (pseudoStyle) {
return rules[pseudoStyle][property];
}
else if (media) {
return rules['media'][media][property];
}
return rules[property];
}
return undefined;
}
getCSSMediaRules() {
var _a, _b;
if ((_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.has(this.element)) {
const rules = (_b = this.elementsCSSRules) === null || _b === void 0 ? void 0 : _b.get(this.element);
return rules['media'];
}
return undefined;
}
getCSSPseudoSelectorRules(pseudoSelector) {
var _a, _b;
if ((_a = this.elementsCSSRules) === null || _a === void 0 ? void 0 : _a.has(this.element)) {
const rules = (_b = this.elementsCSSRules) === null || _b === void 0 ? void 0 : _b.get(this.element);
return rules[pseudoSelector];
}
return undefined;
}
elementHasAttribute(attribute) {

@@ -80,3 +137,3 @@ return this.element.getAttributeNames().includes(attribute);

const clonedElem = this.element.cloneNode(true);
clonedElem.removeAttribute("_cssRules");
clonedElem.removeAttribute('_cssRules');
if (fullElement) {

@@ -83,0 +140,0 @@ return clonedElem.outerHTML;

6

package.json
{
"name": "@qualweb/qw-element",
"version": "0.1.10",
"version": "0.1.11",
"description": "Utilities module for qualweb",

@@ -31,4 +31,4 @@ "main": "dist/index.js",

"devDependencies": {
"@qualweb/types": "^0.4.20",
"@types/node": "^14.0.14",
"@qualweb/types": "^0.4.21",
"@types/node": "^14.0.20",
"chai": "^4.2.0",

@@ -35,0 +35,0 @@ "esm": "^3.2.25",

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

'use strict';
class QWElement {

@@ -12,3 +10,3 @@

this.elementsCSSRules = elementsCSSRules;
this.selector = "";
this.selector = '';
}

@@ -18,6 +16,68 @@

if (element && this.elementsCSSRules ?.has(element)) {
element.setAttribute('_cssRules', JSON.stringify(this.elementsCSSRules ?.get(element)));
element.setAttribute('_cssRules', 'true');
}
}
public hasCSSRules(): boolean {
return this.element.getAttribute('_cssRules') === 'true';
}
public getCSSRules(): any {
return this.elementsCSSRules?.get(this.element);
}
public hasCSSProperty(property: string, pseudoStyle?: string, media?: string): boolean {
if (this.elementsCSSRules?.has(this.element)) {
const rules = this.elementsCSSRules?.get(this.element);
if (pseudoStyle && media) {
return rules['media'][media][pseudoStyle][property] !== undefined;
} else if (pseudoStyle) {
return rules[pseudoStyle][property] !== undefined;
} else if (media) {
return rules['media'][media][property] !== undefined;
}
return rules[property] !== undefined;
}
return false;
}
public getCSSProperty(property: string, pseudoStyle?: string, media?: string): any {
if (this.elementsCSSRules?.has(this.element)) {
const rules = this.elementsCSSRules?.get(this.element);
if (pseudoStyle && media) {
return rules['media'][media][pseudoStyle][property];
} else if (pseudoStyle) {
return rules[pseudoStyle][property];
} else if (media) {
return rules['media'][media][property];
}
return rules[property];
}
return undefined;
}
public getCSSMediaRules() : any {
if (this.elementsCSSRules?.has(this.element)) {
const rules = this.elementsCSSRules?.get(this.element);
return rules['media'];
}
return undefined;
}
public getCSSPseudoSelectorRules(pseudoSelector: string): any {
if (this.elementsCSSRules?.has(this.element)) {
const rules = this.elementsCSSRules?.get(this.element);
return rules[pseudoSelector];
}
return undefined;
}
public elementHasAttribute(attribute: string): boolean {

@@ -97,3 +157,3 @@ return this.element.getAttributeNames().includes(attribute);

const clonedElem = <Element>this.element.cloneNode(true);
clonedElem.removeAttribute("_cssRules");
clonedElem.removeAttribute('_cssRules');
if (fullElement) {

@@ -100,0 +160,0 @@ return clonedElem.outerHTML;

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