@qualweb/qw-element
Advanced tools
+23
-2
@@ -6,2 +6,4 @@ "use strict"; | ||
| constructor(element, elementsCSSRules) { | ||
| this.computedStyle = getComputedStyle(element, null); | ||
| ; | ||
| this.element = element; | ||
@@ -150,3 +152,23 @@ this.elementsCSSRules = elementsCSSRules; | ||
| if (fullElement) { | ||
| let children = this.element.children; | ||
| let attributeArray = []; | ||
| for (let child of children) { | ||
| let cssRulesValue = child.getAttribute('_cssRules'); | ||
| let selectorValue = child.getAttribute('_selector'); | ||
| attributeArray.push({ cssRulesValue, selectorValue }); | ||
| child.removeAttribute('_cssRules'); | ||
| child.removeAttribute('_selector'); | ||
| } | ||
| result = this.element.outerHTML; | ||
| let i = 0; | ||
| for (let child of children) { | ||
| let atributes = attributeArray[i]; | ||
| if (!!atributes.cssRulesValue) { | ||
| child.setAttribute('_cssRules', atributes.cssRulesValue); | ||
| } | ||
| if (!!atributes.selectorValue) { | ||
| child.setAttribute('_selector', atributes.selectorValue); | ||
| } | ||
| i++; | ||
| } | ||
| } | ||
@@ -263,4 +285,3 @@ else if (withText) { | ||
| getElementStyleProperty(property, pseudoStyle) { | ||
| const styles = getComputedStyle(this.element, pseudoStyle); | ||
| return styles.getPropertyValue(property); | ||
| return this.computedStyle.getPropertyValue(property); | ||
| } | ||
@@ -267,0 +288,0 @@ getElementTagName() { |
+1
-1
| { | ||
| "name": "@qualweb/qw-element", | ||
| "version": "0.1.21", | ||
| "version": "0.1.22", | ||
| "description": "Utilities module for qualweb", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+23
-2
@@ -6,4 +6,6 @@ class QWElement { | ||
| private selector: string; | ||
| private computedStyle:any; | ||
| constructor(element: Element, elementsCSSRules?: Map<Element, any>) { | ||
| this.computedStyle = getComputedStyle(element, null);; | ||
| this.element = element; | ||
@@ -170,3 +172,23 @@ this.elementsCSSRules = elementsCSSRules; | ||
| if (fullElement) { | ||
| let children = this.element.children; | ||
| let attributeArray: any=[]; | ||
| for(let child of children){ | ||
| let cssRulesValue= child.getAttribute('_cssRules'); | ||
| let selectorValue = child.getAttribute('_selector'); | ||
| attributeArray.push({cssRulesValue,selectorValue}) | ||
| child.removeAttribute('_cssRules'); | ||
| child.removeAttribute('_selector'); | ||
| } | ||
| result = this.element.outerHTML; | ||
| let i = 0; | ||
| for(let child of children){ | ||
| let atributes= attributeArray[i]; | ||
| if (!!atributes.cssRulesValue) { | ||
| child.setAttribute('_cssRules', atributes.cssRulesValue); | ||
| } | ||
| if (!!atributes.selectorValue) { | ||
| child.setAttribute('_selector', atributes.selectorValue); | ||
| } | ||
| i++; | ||
| } | ||
| } | ||
@@ -300,4 +322,3 @@ else if (withText) { | ||
| public getElementStyleProperty(property: string, pseudoStyle: string | null): string { | ||
| const styles = getComputedStyle(this.element, pseudoStyle); | ||
| return styles.getPropertyValue(property); | ||
| return this.computedStyle.getPropertyValue(property); | ||
| } | ||
@@ -304,0 +325,0 @@ |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
38068
4.65%883
4.99%