browser-extension-utils 0.0.14 → 0.0.15
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.
- package/lib/index.js +6 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -94,7 +94,11 @@ export const setAttributes = (element, attributes) => {
|
|
|
94
94
|
for (const name in attributes) {
|
|
95
95
|
if (Object.hasOwn(attributes, name)) {
|
|
96
96
|
const value = attributes[name]
|
|
97
|
-
if (
|
|
97
|
+
if (value === undefined) {
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (/^(value|textContent|innerText|innerHTML)$/.test(name)) {
|
|
98
102
|
element[name] = value
|
|
99
103
|
} else if (name === "style") {
|
|
100
104
|
setStyle(element, value, true)
|
|
@@ -165,7 +169,7 @@ export const toStyleMap = (styleText) => {
|
|
|
165
169
|
return map
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
export const noStyleSpace = (text) => text.replace(/\s*([^\w
|
|
172
|
+
export const noStyleSpace = (text) => text.replace(/\s*([^\w-+%!])\s*/gm, "$1")
|
|
169
173
|
|
|
170
174
|
export const createSetStyle = (styleText) => {
|
|
171
175
|
const styleMap = toStyleMap(styleText)
|