@nerimity/html-embed 1.1.7 → 1.1.8

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/dist/index.js CHANGED
@@ -10,8 +10,8 @@ const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', '
10
10
  const allowedAttributes = ["href", "src", "color", "style", "class"];
11
11
  const allowedCssProperties = [
12
12
  "background-clip",
13
- "-webkit-background-clip",
14
- "-webkit-text-fill-color",
13
+ "-webkitBackgroundClip",
14
+ "-webkitTextFillColor",
15
15
  "display",
16
16
  "position",
17
17
  "inset",
@@ -139,14 +139,17 @@ function checkCSS(cssVal) {
139
139
  }
140
140
  }
141
141
  function cssNameToJsName(name) {
142
- var split = name.split("-");
142
+ var split = name.split("-").filter(n => n);
143
143
  var output = "";
144
144
  for (var i = 0; i < split.length; i++) {
145
145
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
146
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
146
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
147
147
  }
148
148
  output += split[i];
149
149
  }
150
+ if (name.startsWith("-")) {
151
+ output = "-" + output;
152
+ }
150
153
  return output;
151
154
  }
152
155
  function jsNameToCssName(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerimity/html-embed",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -6,8 +6,8 @@ const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', '
6
6
  const allowedAttributes = ["href", "src", "color", "style", "class"]
7
7
  const allowedCssProperties = [
8
8
  "background-clip",
9
- "-webkit-background-clip",
10
- "-webkit-text-fill-color",
9
+ "-webkitBackgroundClip",
10
+ "-webkitTextFillColor",
11
11
  "display",
12
12
  "position",
13
13
  "inset",
@@ -145,14 +145,17 @@ function checkCSS(cssVal: string) {
145
145
 
146
146
 
147
147
  function cssNameToJsName(name: string) {
148
- var split = name.split("-");
148
+ var split = name.split("-").filter(n => n);
149
149
  var output = "";
150
150
  for (var i = 0; i < split.length; i++) {
151
151
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
152
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
152
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
153
153
  }
154
154
  output += split[i];
155
155
  }
156
+ if (name.startsWith("-")) {
157
+ output = "-" + output
158
+ }
156
159
  return output;
157
160
  }
158
161