browser-extension-utils 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +6 -10
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -40,20 +40,16 @@ export const setAttribute = (element, name, value) =>
40
40
  element.setAttribute(name, value)
41
41
 
42
42
  export const setStyle = (element, values, overwrite) => {
43
- // setAttribute(element, "style", value) -> Fail when violates CSP
43
+ // element.setAttribute("style", value) -> Fail when violates CSP
44
44
  const style = element.style
45
45
 
46
- if (overwrite) {
47
- if (typeof values === "string") {
48
- style.cssText = values
49
- return
50
- }
51
-
52
- style.cssText = ""
46
+ if (typeof values === "string") {
47
+ style.cssText = overwrite? values : style.cssText + ";" +values
48
+ return;
53
49
  }
54
50
 
55
- if (typeof values === "string") {
56
- values = toStyleKeyValues(values)
51
+ if (overwrite) {
52
+ style.cssText = ""
57
53
  }
58
54
 
59
55
  for (const key in values) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-extension-utils",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Utilities for developing browser extensions and userscripts",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",