@webex/helper-html 3.0.0-beta.15 → 3.0.0-beta.151

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/html-base.js CHANGED
@@ -1,22 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.escape = escape;
12
9
  exports.escapeSync = escapeSync;
13
-
14
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
15
-
16
11
  /*!
17
12
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
18
13
  */
19
- var escapeMe = /(<|>|&)/g; // escape and escapeSync probably don't both need to exist, but it seemed like a
14
+
15
+ var escapeMe = /(<|>|&)/g;
16
+
17
+ // escape and escapeSync probably don't both need to exist, but it seemed like a
20
18
  // good idea in case we ever want to for the future.
21
19
 
22
20
  /**
@@ -24,40 +22,34 @@ var escapeMe = /(<|>|&)/g; // escape and escapeSync probably don't both need to
24
22
  * @param {[type]} html
25
23
  * @returns {[type]}
26
24
  */
27
-
28
25
  function escape(html) {
29
26
  return new _promise.default(function (resolve) {
30
27
  return resolve(escapeSync(html));
31
28
  });
32
29
  }
30
+
33
31
  /**
34
32
  * Synchronously escape HTML
35
33
  * @param {[type]} html
36
34
  * @returns {[type]}
37
35
  */
38
-
39
-
40
36
  function escapeSync(html) {
41
37
  return html.replace(escapeMe, entityReplacer);
42
38
  }
39
+
43
40
  /**
44
41
  * @param {string} char
45
42
  * @private
46
43
  * @returns {string}
47
44
  */
48
-
49
-
50
45
  function entityReplacer(char) {
51
46
  switch (char) {
52
47
  case '<':
53
48
  return '&lt;';
54
-
55
49
  case '>':
56
50
  return '&gt;';
57
-
58
51
  case '&':
59
52
  return '&amp;';
60
-
61
53
  default:
62
54
  return char;
63
55
  }
@@ -1 +1 @@
1
- {"version":3,"names":["escapeMe","escape","html","resolve","escapeSync","replace","entityReplacer","char"],"sources":["html-base.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nconst escapeMe = /(<|>|&)/g;\n\n// escape and escapeSync probably don't both need to exist, but it seemed like a\n// good idea in case we ever want to for the future.\n\n/**\n * Escapes HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escape(html) {\n return new Promise((resolve) => resolve(escapeSync(html)));\n}\n\n/**\n * Synchronously escape HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escapeSync(html) {\n return html.replace(escapeMe, entityReplacer);\n}\n\n/**\n * @param {string} char\n * @private\n * @returns {string}\n */\nfunction entityReplacer(char) {\n switch (char) {\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '&':\n return '&amp;';\n default:\n return char;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA,IAAMA,QAAQ,GAAG,UAAjB,C,CAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACO,SAASC,MAAT,CAAgBC,IAAhB,EAAsB;EAC3B,OAAO,qBAAY,UAACC,OAAD;IAAA,OAAaA,OAAO,CAACC,UAAU,CAACF,IAAD,CAAX,CAApB;EAAA,CAAZ,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASE,UAAT,CAAoBF,IAApB,EAA0B;EAC/B,OAAOA,IAAI,CAACG,OAAL,CAAaL,QAAb,EAAuBM,cAAvB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;;AACA,SAASA,cAAT,CAAwBC,IAAxB,EAA8B;EAC5B,QAAQA,IAAR;IACE,KAAK,GAAL;MACE,OAAO,MAAP;;IACF,KAAK,GAAL;MACE,OAAO,MAAP;;IACF,KAAK,GAAL;MACE,OAAO,OAAP;;IACF;MACE,OAAOA,IAAP;EARJ;AAUD"}
1
+ {"version":3,"names":["escapeMe","escape","html","resolve","escapeSync","replace","entityReplacer","char"],"sources":["html-base.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nconst escapeMe = /(<|>|&)/g;\n\n// escape and escapeSync probably don't both need to exist, but it seemed like a\n// good idea in case we ever want to for the future.\n\n/**\n * Escapes HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escape(html) {\n return new Promise((resolve) => resolve(escapeSync(html)));\n}\n\n/**\n * Synchronously escape HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escapeSync(html) {\n return html.replace(escapeMe, entityReplacer);\n}\n\n/**\n * @param {string} char\n * @private\n * @returns {string}\n */\nfunction entityReplacer(char) {\n switch (char) {\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '&':\n return '&amp;';\n default:\n return char;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAEA,IAAMA,QAAQ,GAAG,UAAU;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,MAAM,CAACC,IAAI,EAAE;EAC3B,OAAO,qBAAY,UAACC,OAAO;IAAA,OAAKA,OAAO,CAACC,UAAU,CAACF,IAAI,CAAC,CAAC;EAAA,EAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAU,CAACF,IAAI,EAAE;EAC/B,OAAOA,IAAI,CAACG,OAAO,CAACL,QAAQ,EAAEM,cAAc,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAc,CAACC,IAAI,EAAE;EAC5B,QAAQA,IAAI;IACV,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,OAAO;IAChB;MACE,OAAOA,IAAI;EAAC;AAElB"}
package/dist/html.js CHANGED
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  _Object$defineProperty(exports, "escape", {
12
9
  enumerable: true,
13
10
  get: function get() {
14
11
  return _htmlBase.escape;
15
12
  }
16
13
  });
17
-
18
14
  _Object$defineProperty(exports, "escapeSync", {
19
15
  enumerable: true,
20
16
  get: function get() {
21
17
  return _htmlBase.escapeSync;
22
18
  }
23
19
  });
24
-
25
20
  exports.filterSync = exports.filterEscapeSync = exports.filterEscape = exports.filter = void 0;
26
-
27
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
28
-
29
22
  var _curry2 = _interopRequireDefault(require("lodash/curry"));
30
-
31
23
  var _htmlBase = require("./html-base");
32
-
33
24
  /**
34
25
  * @param {Object} allowedTags
35
26
  * @param {Array<string>} allowedStyles
@@ -41,11 +32,11 @@ function noop() {
41
32
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
42
33
  args[_key] = arguments[_key];
43
34
  }
44
-
45
35
  return new _promise.default(function (resolve) {
46
36
  resolve(noopSync.apply(void 0, args));
47
37
  });
48
38
  }
39
+
49
40
  /**
50
41
  * @param {function} processCallback callback function to do additional
51
42
  * processing on node. of the form process(node)
@@ -55,12 +46,9 @@ function noop() {
55
46
  * @private
56
47
  * @returns {string}
57
48
  */
58
-
59
-
60
49
  function noopSync(processCallback, allowedTags, allowedStyles, html) {
61
50
  return html;
62
51
  }
63
-
64
52
  var filter = (0, _curry2.default)(noop, 4);
65
53
  exports.filter = filter;
66
54
  var filterSync = (0, _curry2.default)(noopSync, 4);
package/dist/html.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["noop","args","resolve","noopSync","processCallback","allowedTags","allowedStyles","html","filter","filterSync","filterEscape","filterEscapeSync"],"sources":["html.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {curry} from 'lodash';\n\nexport {escape, escapeSync} from './html-base';\n\n/**\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noop(...args) {\n return new Promise((resolve) => {\n resolve(noopSync(...args));\n });\n}\n\n/**\n * @param {function} processCallback callback function to do additional\n * processing on node. of the form process(node)\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noopSync(processCallback, allowedTags, allowedStyles, html) {\n return html;\n}\n\nexport const filter = curry(noop, 4);\nexport const filterSync = curry(noopSync, 4);\nexport const filterEscape = curry(noop, 4);\nexport const filterEscapeSync = curry(noopSync, 4);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAT,GAAuB;EAAA,kCAANC,IAAM;IAANA,IAAM;EAAA;;EACrB,OAAO,qBAAY,UAACC,OAAD,EAAa;IAC9BA,OAAO,CAACC,QAAQ,MAAR,SAAYF,IAAZ,CAAD,CAAP;EACD,CAFM,CAAP;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,QAAT,CAAkBC,eAAlB,EAAmCC,WAAnC,EAAgDC,aAAhD,EAA+DC,IAA/D,EAAqE;EACnE,OAAOA,IAAP;AACD;;AAEM,IAAMC,MAAM,GAAG,qBAAMR,IAAN,EAAY,CAAZ,CAAf;;AACA,IAAMS,UAAU,GAAG,qBAAMN,QAAN,EAAgB,CAAhB,CAAnB;;AACA,IAAMO,YAAY,GAAG,qBAAMV,IAAN,EAAY,CAAZ,CAArB;;AACA,IAAMW,gBAAgB,GAAG,qBAAMR,QAAN,EAAgB,CAAhB,CAAzB"}
1
+ {"version":3,"names":["noop","args","resolve","noopSync","processCallback","allowedTags","allowedStyles","html","filter","filterSync","filterEscape","filterEscapeSync"],"sources":["html.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {curry} from 'lodash';\n\nexport {escape, escapeSync} from './html-base';\n\n/**\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noop(...args) {\n return new Promise((resolve) => {\n resolve(noopSync(...args));\n });\n}\n\n/**\n * @param {function} processCallback callback function to do additional\n * processing on node. of the form process(node)\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noopSync(processCallback, allowedTags, allowedStyles, html) {\n return html;\n}\n\nexport const filter = curry(noop, 4);\nexport const filterSync = curry(noopSync, 4);\nexport const filterEscape = curry(noop, 4);\nexport const filterEscapeSync = curry(noopSync, 4);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,GAAU;EAAA,kCAANC,IAAI;IAAJA,IAAI;EAAA;EACnB,OAAO,qBAAY,UAACC,OAAO,EAAK;IAC9BA,OAAO,CAACC,QAAQ,eAAIF,IAAI,CAAC,CAAC;EAC5B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,QAAQ,CAACC,eAAe,EAAEC,WAAW,EAAEC,aAAa,EAAEC,IAAI,EAAE;EACnE,OAAOA,IAAI;AACb;AAEO,IAAMC,MAAM,GAAG,qBAAMR,IAAI,EAAE,CAAC,CAAC;AAAC;AAC9B,IAAMS,UAAU,GAAG,qBAAMN,QAAQ,EAAE,CAAC,CAAC;AAAC;AACtC,IAAMO,YAAY,GAAG,qBAAMV,IAAI,EAAE,CAAC,CAAC;AAAC;AACpC,IAAMW,gBAAgB,GAAG,qBAAMR,QAAQ,EAAE,CAAC,CAAC;AAAC"}
package/dist/html.shim.js CHANGED
@@ -1,43 +1,30 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  _Object$defineProperty(exports, "escape", {
12
9
  enumerable: true,
13
10
  get: function get() {
14
11
  return _htmlBase.escape;
15
12
  }
16
13
  });
17
-
18
14
  _Object$defineProperty(exports, "escapeSync", {
19
15
  enumerable: true,
20
16
  get: function get() {
21
17
  return _htmlBase.escapeSync;
22
18
  }
23
19
  });
24
-
25
20
  exports.filterSync = exports.filterEscapeSync = exports.filterEscape = exports.filter = void 0;
26
-
27
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
28
-
29
22
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
30
-
31
23
  var _reduce2 = _interopRequireDefault(require("lodash/reduce"));
32
-
33
24
  var _includes2 = _interopRequireDefault(require("lodash/includes"));
34
-
35
25
  var _forEach2 = _interopRequireDefault(require("lodash/forEach"));
36
-
37
26
  var _curry2 = _interopRequireDefault(require("lodash/curry"));
38
-
39
27
  var _htmlBase = require("./html-base");
40
-
41
28
  /**
42
29
  * Some browsers don't implement {@link Element#remove()} or
43
30
  * {@link NodeList#remove()} or {@link HTMLCollection#remove()}. This wrapper
@@ -51,22 +38,19 @@ function removeNode(node) {
51
38
  node.remove();
52
39
  return;
53
40
  }
54
-
55
41
  if (node.parentElement) {
56
42
  node.parentElement.removeChild(node);
57
43
  return;
58
44
  }
59
-
60
45
  if ('length' in node) {
61
46
  for (var i = node.length - 1; i >= 0; i -= 1) {
62
47
  removeNode(node[i]);
63
48
  }
64
-
65
49
  return;
66
50
  }
67
-
68
51
  throw new Error('Could not find a way to remove node');
69
52
  }
53
+
70
54
  /**
71
55
  * @param {Object} allowedTags
72
56
  * @param {Array<string>} allowedStyles
@@ -74,17 +58,15 @@ function removeNode(node) {
74
58
  * @private
75
59
  * @returns {string}
76
60
  */
77
-
78
-
79
61
  function _filter() {
80
62
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
81
63
  args[_key] = arguments[_key];
82
64
  }
83
-
84
65
  return new _promise.default(function (resolve) {
85
66
  resolve(_filterSync.apply(void 0, args));
86
67
  });
87
68
  }
69
+
88
70
  /**
89
71
  * Curried async HTML filter.
90
72
  * @param {Object} allowedTags Map of tagName -> array of allowed attributes
@@ -92,9 +74,8 @@ function _filter() {
92
74
  * @param {string} html html to filter
93
75
  * @returns {string}
94
76
  */
95
-
96
-
97
77
  var filter = (0, _curry2.default)(_filter, 4);
78
+
98
79
  /**
99
80
  * @param {function} processCallback callback function to do additional
100
81
  * processing on node. of the form process(node)
@@ -104,63 +85,54 @@ var filter = (0, _curry2.default)(_filter, 4);
104
85
  * @private
105
86
  * @returns {string}
106
87
  */
107
-
108
88
  exports.filter = filter;
109
-
110
89
  function _filterSync(processCallback, allowedTags, allowedStyles, html) {
111
90
  if (!html || !allowedStyles || !allowedTags) {
112
91
  if (html.length === 0) {
113
92
  return html;
114
93
  }
115
-
116
94
  throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');
117
95
  }
118
-
119
96
  var doc = new DOMParser().parseFromString(html, 'text/html');
120
97
  depthFirstForEach(doc.body.childNodes, filterNode);
121
98
  processCallback(doc.body);
122
-
123
99
  if (html.indexOf('body') === 1) {
124
100
  return "<body>".concat(doc.body.innerHTML, "</body>");
125
101
  }
126
-
127
102
  return doc.body.innerHTML;
103
+
128
104
  /**
129
105
  * @param {Node} node
130
106
  * @private
131
107
  * @returns {undefined}
132
108
  */
133
-
134
109
  function filterNode(node) {
135
110
  if (!isElement(node)) {
136
111
  return;
137
112
  }
138
-
139
113
  var nodeName = node.nodeName.toLowerCase();
140
114
  var allowedTagNames = (0, _keys.default)(allowedTags);
141
115
  depthFirstForEach(node.childNodes, filterNode);
142
-
143
116
  if ((0, _includes2.default)(allowedTagNames, nodeName)) {
144
117
  var allowedAttributes = allowedTags[nodeName];
145
118
  (0, _forEach2.default)(listAttributeNames(node.attributes), function (attrName) {
146
119
  if (!(0, _includes2.default)(allowedAttributes, attrName)) {
147
120
  node.removeAttribute(attrName);
148
121
  } else if (attrName === 'href' || attrName === 'src') {
149
- var attrValue = node.attributes.getNamedItem(attrName).value.trim().toLowerCase(); // We're doing at runtime what the no-script-url rule does at compile
122
+ var attrValue = node.attributes.getNamedItem(attrName).value.trim().toLowerCase();
123
+
124
+ // We're doing at runtime what the no-script-url rule does at compile
150
125
  // time
151
126
  // eslint-disable-next-line no-script-url
152
-
153
127
  if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {
154
128
  reparent(node);
155
129
  }
156
130
  } else if (attrName === 'style') {
157
131
  var styles = node.attributes.getNamedItem('style').value.split(';').map(function (style) {
158
132
  var styleName = trim(style.split(':')[0]);
159
-
160
133
  if ((0, _includes2.default)(allowedStyles, styleName)) {
161
134
  return style;
162
135
  }
163
-
164
136
  return null;
165
137
  }).filter(function (style) {
166
138
  return Boolean(style);
@@ -173,6 +145,7 @@ function _filterSync(processCallback, allowedTags, allowedStyles, html) {
173
145
  }
174
146
  }
175
147
  }
148
+
176
149
  /**
177
150
  * Same as _filter, but escapes rather than removes disallowed values
178
151
  * @param {Function} processCallback
@@ -181,17 +154,15 @@ function _filterSync(processCallback, allowedTags, allowedStyles, html) {
181
154
  * @param {string} html
182
155
  * @returns {Promise<string>}
183
156
  */
184
-
185
-
186
157
  function _filterEscape() {
187
158
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
188
159
  args[_key2] = arguments[_key2];
189
160
  }
190
-
191
161
  return new _promise.default(function (resolve) {
192
162
  resolve(_filterEscapeSync.apply(void 0, args));
193
163
  });
194
164
  }
165
+
195
166
  /**
196
167
  * Same as _filterSync, but escapes rather than removes disallowed values
197
168
  * @param {Function} processCallback
@@ -200,62 +171,53 @@ function _filterEscape() {
200
171
  * @param {string} html
201
172
  * @returns {string}
202
173
  */
203
-
204
-
205
174
  function _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {
206
175
  if (!html || !allowedStyles || !allowedTags) {
207
176
  if (html.length === 0) {
208
177
  return html;
209
178
  }
210
-
211
179
  throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');
212
180
  }
213
-
214
181
  var doc = new DOMParser().parseFromString(html, 'text/html');
215
182
  depthFirstForEach(doc.body.childNodes, filterNode);
216
183
  processCallback(doc.body);
217
-
218
184
  if (html.indexOf('body') === 1) {
219
185
  return "<body>".concat(doc.body.innerHTML, "</body>");
220
186
  }
221
-
222
187
  return doc.body.innerHTML;
188
+
223
189
  /**
224
190
  * @param {Node} node
225
191
  * @private
226
192
  * @returns {undefined}
227
193
  */
228
-
229
194
  function filterNode(node) {
230
195
  if (!isElement(node)) {
231
196
  return;
232
197
  }
233
-
234
198
  depthFirstForEach(node.childNodes, filterNode);
235
199
  var nodeName = node.nodeName.toLowerCase();
236
200
  var allowedTagNames = (0, _keys.default)(allowedTags);
237
-
238
201
  if ((0, _includes2.default)(allowedTagNames, nodeName)) {
239
202
  var allowedAttributes = allowedTags[nodeName];
240
203
  (0, _forEach2.default)(listAttributeNames(node.attributes), function (attrName) {
241
204
  if (!(0, _includes2.default)(allowedAttributes, attrName)) {
242
205
  node.removeAttribute(attrName);
243
206
  } else if (attrName === 'href' || attrName === 'src') {
244
- var attrValue = node.attributes.getNamedItem(attrName).value.toLowerCase(); // We're doing at runtime what the no-script-url rule does at compile
207
+ var attrValue = node.attributes.getNamedItem(attrName).value.toLowerCase();
208
+
209
+ // We're doing at runtime what the no-script-url rule does at compile
245
210
  // time
246
211
  // eslint-disable-next-line no-script-url
247
-
248
212
  if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {
249
213
  reparent(node);
250
214
  }
251
215
  } else if (attrName === 'style') {
252
216
  var styles = node.attributes.getNamedItem('style').value.split(';').map(function (style) {
253
217
  var styleName = trim(style.split(':')[0]);
254
-
255
218
  if ((0, _includes2.default)(allowedStyles, styleName)) {
256
219
  return style;
257
220
  }
258
-
259
221
  return null;
260
222
  }).filter(function (style) {
261
223
  return Boolean(style);
@@ -268,101 +230,89 @@ function _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {
268
230
  }
269
231
  }
270
232
  }
233
+
271
234
  /**
272
235
  * Escapes a given html node
273
236
  * @param {Node} node
274
237
  * @returns {undefined}
275
238
  */
276
-
277
-
278
239
  function escapeNode(node) {
279
240
  var before = document.createTextNode("<".concat(node.nodeName.toLowerCase(), ">"));
280
241
  var after = document.createTextNode("</".concat(node.nodeName.toLowerCase(), ">"));
281
242
  node.parentNode.insertBefore(before, node);
282
-
283
243
  while (node.childNodes.length > 0) {
284
244
  node.parentNode.insertBefore(node.childNodes[0], node);
285
245
  }
286
-
287
246
  node.parentNode.insertBefore(after, node);
288
247
  removeNode(node);
289
248
  }
290
-
291
249
  var trimPattern = /^\s|\s$/g;
250
+
292
251
  /**
293
252
  * @param {string} str
294
253
  * @returns {string}
295
254
  */
296
-
297
255
  function trim(str) {
298
256
  return str.replace(trimPattern, '');
299
257
  }
258
+
300
259
  /**
301
260
  * @param {Node} node
302
261
  * @private
303
262
  * @returns {undefined}
304
263
  */
305
-
306
-
307
264
  function reparent(node) {
308
265
  while (node.childNodes.length > 0) {
309
266
  node.parentNode.insertBefore(node.childNodes[0], node);
310
267
  }
311
-
312
268
  removeNode(node);
313
269
  }
270
+
314
271
  /**
315
272
  * @param {NamedNodeMap} attributes
316
273
  * @private
317
274
  * @returns {Array<string>}
318
275
  */
319
-
320
-
321
276
  function listAttributeNames(attributes) {
322
277
  return (0, _reduce2.default)(attributes, function (attrNames, attr) {
323
278
  attrNames.push(attr.name);
324
279
  return attrNames;
325
280
  }, []);
326
281
  }
282
+
327
283
  /**
328
284
  * @param {Array} list
329
285
  * @param {Function} fn
330
286
  * @private
331
287
  * @returns {undefined}
332
288
  */
333
-
334
-
335
289
  function depthFirstForEach(list, fn) {
336
290
  for (var i = list.length; i >= 0; i -= 1) {
337
291
  fn(list[i]);
338
292
  }
339
293
  }
294
+
340
295
  /**
341
296
  * @param {Node} o
342
297
  * @private
343
298
  * @returns {Boolean}
344
299
  */
345
-
346
-
347
300
  function isElement(o) {
348
301
  if (!o) {
349
302
  return false;
350
303
  }
351
-
352
304
  if (o.ownerDocument === undefined) {
353
305
  return false;
354
306
  }
355
-
356
307
  if (o.nodeType !== 1) {
357
308
  return false;
358
309
  }
359
-
360
310
  if (typeof o.nodeName !== 'string') {
361
311
  return false;
362
312
  }
363
-
364
313
  return true;
365
314
  }
315
+
366
316
  /**
367
317
  * Curried HTML filter.
368
318
  * @param {Object} allowedTags Map of tagName -> array of allowed attributes
@@ -370,9 +320,8 @@ function isElement(o) {
370
320
  * @param {string} html html to filter
371
321
  * @returns {string}
372
322
  */
373
-
374
-
375
323
  var filterSync = (0, _curry2.default)(_filterSync, 4);
324
+
376
325
  /**
377
326
  * Curried HTML filter that escapes rather than removes disallowed tags
378
327
  * @param {Object} allowedTags Map of tagName -> array of allowed attributes
@@ -380,9 +329,9 @@ var filterSync = (0, _curry2.default)(_filterSync, 4);
380
329
  * @param {string} html html to filter
381
330
  * @returns {Promise<string>}
382
331
  */
383
-
384
332
  exports.filterSync = filterSync;
385
333
  var filterEscape = (0, _curry2.default)(_filterEscape, 4);
334
+
386
335
  /**
387
336
  * Curried HTML filter that escapes rather than removes disallowed tags
388
337
  * @param {Object} allowedTags Map of tagName -> array of allowed attributes
@@ -390,7 +339,6 @@ var filterEscape = (0, _curry2.default)(_filterEscape, 4);
390
339
  * @param {string} html html to filter
391
340
  * @returns {string}
392
341
  */
393
-
394
342
  exports.filterEscape = filterEscape;
395
343
  var filterEscapeSync = (0, _curry2.default)(_filterEscapeSync, 4);
396
344
  exports.filterEscapeSync = filterEscapeSync;
@@ -1 +1 @@
1
- {"version":3,"names":["removeNode","node","remove","parentElement","removeChild","i","length","Error","_filter","args","resolve","_filterSync","filter","processCallback","allowedTags","allowedStyles","html","doc","DOMParser","parseFromString","depthFirstForEach","body","childNodes","filterNode","indexOf","innerHTML","isElement","nodeName","toLowerCase","allowedTagNames","allowedAttributes","listAttributeNames","attributes","attrName","removeAttribute","attrValue","getNamedItem","value","trim","reparent","styles","split","map","style","styleName","Boolean","join","setAttribute","_filterEscape","_filterEscapeSync","escapeNode","before","document","createTextNode","after","parentNode","insertBefore","trimPattern","str","replace","attrNames","attr","push","name","list","fn","o","ownerDocument","undefined","nodeType","filterSync","filterEscape","filterEscapeSync"],"sources":["html.shim.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-env browser */\n\nimport {curry, forEach, includes, reduce} from 'lodash';\n\nexport {escape, escapeSync} from './html-base';\n\n/**\n * Some browsers don't implement {@link Element#remove()} or\n * {@link NodeList#remove()} or {@link HTMLCollection#remove()}. This wrapper\n * calls the appropriate `#remove()` method if available, or falls back to a\n * non-global-polluting polyfill.\n * @param {Element|NodeList|HTMLCollection} node\n * @returns {undefined}\n */\nfunction removeNode(node) {\n if (node.remove) {\n node.remove();\n\n return;\n }\n\n if (node.parentElement) {\n node.parentElement.removeChild(node);\n\n return;\n }\n\n if ('length' in node) {\n for (let i = node.length - 1; i >= 0; i -= 1) {\n removeNode(node[i]);\n }\n\n return;\n }\n\n throw new Error('Could not find a way to remove node');\n}\n\n/**\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction _filter(...args) {\n return new Promise((resolve) => {\n resolve(_filterSync(...args));\n });\n}\n\n/**\n * Curried async HTML filter.\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filter = curry(_filter, 4);\n\n/**\n * @param {function} processCallback callback function to do additional\n * processing on node. of the form process(node)\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction _filterSync(processCallback, allowedTags, allowedStyles, html) {\n if (!html || !allowedStyles || !allowedTags) {\n if (html.length === 0) {\n return html;\n }\n\n throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');\n }\n\n const doc = new DOMParser().parseFromString(html, 'text/html');\n\n depthFirstForEach(doc.body.childNodes, filterNode);\n processCallback(doc.body);\n\n if (html.indexOf('body') === 1) {\n return `<body>${doc.body.innerHTML}</body>`;\n }\n\n return doc.body.innerHTML;\n\n /**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\n function filterNode(node) {\n if (!isElement(node)) {\n return;\n }\n\n const nodeName = node.nodeName.toLowerCase();\n const allowedTagNames = Object.keys(allowedTags);\n\n depthFirstForEach(node.childNodes, filterNode);\n\n if (includes(allowedTagNames, nodeName)) {\n const allowedAttributes = allowedTags[nodeName];\n\n forEach(listAttributeNames(node.attributes), (attrName) => {\n if (!includes(allowedAttributes, attrName)) {\n node.removeAttribute(attrName);\n } else if (attrName === 'href' || attrName === 'src') {\n const attrValue = node.attributes.getNamedItem(attrName).value.trim().toLowerCase();\n\n // We're doing at runtime what the no-script-url rule does at compile\n // time\n // eslint-disable-next-line no-script-url\n if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {\n reparent(node);\n }\n } else if (attrName === 'style') {\n const styles = node.attributes\n .getNamedItem('style')\n .value.split(';')\n .map((style) => {\n const styleName = trim(style.split(':')[0]);\n\n if (includes(allowedStyles, styleName)) {\n return style;\n }\n\n return null;\n })\n .filter((style) => Boolean(style))\n .join(';');\n\n node.setAttribute('style', styles);\n }\n });\n } else {\n reparent(node);\n }\n }\n}\n\n/**\n * Same as _filter, but escapes rather than removes disallowed values\n * @param {Function} processCallback\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @returns {Promise<string>}\n */\nfunction _filterEscape(...args) {\n return new Promise((resolve) => {\n resolve(_filterEscapeSync(...args));\n });\n}\n\n/**\n * Same as _filterSync, but escapes rather than removes disallowed values\n * @param {Function} processCallback\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @returns {string}\n */\nfunction _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {\n if (!html || !allowedStyles || !allowedTags) {\n if (html.length === 0) {\n return html;\n }\n\n throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');\n }\n\n const doc = new DOMParser().parseFromString(html, 'text/html');\n\n depthFirstForEach(doc.body.childNodes, filterNode);\n processCallback(doc.body);\n\n if (html.indexOf('body') === 1) {\n return `<body>${doc.body.innerHTML}</body>`;\n }\n\n return doc.body.innerHTML;\n\n /**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\n function filterNode(node) {\n if (!isElement(node)) {\n return;\n }\n\n depthFirstForEach(node.childNodes, filterNode);\n\n const nodeName = node.nodeName.toLowerCase();\n const allowedTagNames = Object.keys(allowedTags);\n\n if (includes(allowedTagNames, nodeName)) {\n const allowedAttributes = allowedTags[nodeName];\n\n forEach(listAttributeNames(node.attributes), (attrName) => {\n if (!includes(allowedAttributes, attrName)) {\n node.removeAttribute(attrName);\n } else if (attrName === 'href' || attrName === 'src') {\n const attrValue = node.attributes.getNamedItem(attrName).value.toLowerCase();\n\n // We're doing at runtime what the no-script-url rule does at compile\n // time\n // eslint-disable-next-line no-script-url\n if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {\n reparent(node);\n }\n } else if (attrName === 'style') {\n const styles = node.attributes\n .getNamedItem('style')\n .value.split(';')\n .map((style) => {\n const styleName = trim(style.split(':')[0]);\n\n if (includes(allowedStyles, styleName)) {\n return style;\n }\n\n return null;\n })\n .filter((style) => Boolean(style))\n .join(';');\n\n node.setAttribute('style', styles);\n }\n });\n } else {\n escapeNode(node);\n }\n }\n}\n\n/**\n * Escapes a given html node\n * @param {Node} node\n * @returns {undefined}\n */\nfunction escapeNode(node) {\n const before = document.createTextNode(`<${node.nodeName.toLowerCase()}>`);\n const after = document.createTextNode(`</${node.nodeName.toLowerCase()}>`);\n\n node.parentNode.insertBefore(before, node);\n while (node.childNodes.length > 0) {\n node.parentNode.insertBefore(node.childNodes[0], node);\n }\n node.parentNode.insertBefore(after, node);\n\n removeNode(node);\n}\n\nconst trimPattern = /^\\s|\\s$/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nfunction trim(str) {\n return str.replace(trimPattern, '');\n}\n\n/**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\nfunction reparent(node) {\n while (node.childNodes.length > 0) {\n node.parentNode.insertBefore(node.childNodes[0], node);\n }\n removeNode(node);\n}\n\n/**\n * @param {NamedNodeMap} attributes\n * @private\n * @returns {Array<string>}\n */\nfunction listAttributeNames(attributes) {\n return reduce(\n attributes,\n (attrNames, attr) => {\n attrNames.push(attr.name);\n\n return attrNames;\n },\n []\n );\n}\n\n/**\n * @param {Array} list\n * @param {Function} fn\n * @private\n * @returns {undefined}\n */\nfunction depthFirstForEach(list, fn) {\n for (let i = list.length; i >= 0; i -= 1) {\n fn(list[i]);\n }\n}\n\n/**\n * @param {Node} o\n * @private\n * @returns {Boolean}\n */\nfunction isElement(o) {\n if (!o) {\n return false;\n }\n\n if (o.ownerDocument === undefined) {\n return false;\n }\n\n if (o.nodeType !== 1) {\n return false;\n }\n\n if (typeof o.nodeName !== 'string') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Curried HTML filter.\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filterSync = curry(_filterSync, 4);\n\n/**\n * Curried HTML filter that escapes rather than removes disallowed tags\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {Promise<string>}\n */\nexport const filterEscape = curry(_filterEscape, 4);\n\n/**\n * Curried HTML filter that escapes rather than removes disallowed tags\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filterEscapeSync = curry(_filterEscapeSync, 4);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAT,CAAoBC,IAApB,EAA0B;EACxB,IAAIA,IAAI,CAACC,MAAT,EAAiB;IACfD,IAAI,CAACC,MAAL;IAEA;EACD;;EAED,IAAID,IAAI,CAACE,aAAT,EAAwB;IACtBF,IAAI,CAACE,aAAL,CAAmBC,WAAnB,CAA+BH,IAA/B;IAEA;EACD;;EAED,IAAI,YAAYA,IAAhB,EAAsB;IACpB,KAAK,IAAII,CAAC,GAAGJ,IAAI,CAACK,MAAL,GAAc,CAA3B,EAA8BD,CAAC,IAAI,CAAnC,EAAsCA,CAAC,IAAI,CAA3C,EAA8C;MAC5CL,UAAU,CAACC,IAAI,CAACI,CAAD,CAAL,CAAV;IACD;;IAED;EACD;;EAED,MAAM,IAAIE,KAAJ,CAAU,qCAAV,CAAN;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,OAAT,GAA0B;EAAA,kCAANC,IAAM;IAANA,IAAM;EAAA;;EACxB,OAAO,qBAAY,UAACC,OAAD,EAAa;IAC9BA,OAAO,CAACC,WAAW,MAAX,SAAeF,IAAf,CAAD,CAAP;EACD,CAFM,CAAP;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAMG,MAAM,GAAG,qBAAMJ,OAAN,EAAe,CAAf,CAAf;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASG,WAAT,CAAqBE,eAArB,EAAsCC,WAAtC,EAAmDC,aAAnD,EAAkEC,IAAlE,EAAwE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OL,EAPK,CAAP;AASD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASxC,iBAAT,CAA2B4C,IAA3B,EAAiCC,EAAjC,EAAqC;EACnC,KAAK,IAAI5D,CAAC,GAAG2D,IAAI,CAAC1D,MAAlB,EAA0BD,CAAC,IAAI,CAA/B,EAAkCA,CAAC,IAAI,CAAvC,EAA0C;IACxC4D,EAAE,CAACD,IAAI,CAAC3D,CAAD,CAAL,CAAF;EACD;AACF;AAED;AACA;AACA;AACA;AACA;;;AACA,SAASqB,SAAT,CAAmBwC,CAAnB,EAAsB;EACpB,IAAI,CAACA,CAAL,EAAQ;IACN,OAAO,KAAP;EACD;;EAED,IAAIA,CAAC,CAACC,aAAF,KAAoBC,SAAxB,EAAmC;IACjC,OAAO,KAAP;EACD;;EAED,IAAIF,CAAC,CAACG,QAAF,KAAe,CAAnB,EAAsB;IACpB,OAAO,KAAP;EACD;;EAED,IAAI,OAAOH,CAAC,CAACvC,QAAT,KAAsB,QAA1B,EAAoC;IAClC,OAAO,KAAP;EACD;;EAED,OAAO,IAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAM2C,UAAU,GAAG,qBAAM3D,WAAN,EAAmB,CAAnB,CAAnB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAM4D,YAAY,GAAG,qBAAMvB,aAAN,EAAqB,CAArB,CAArB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAMwB,gBAAgB,GAAG,qBAAMvB,iBAAN,EAAyB,CAAzB,CAAzB"}
1
+ {"version":3,"names":["removeNode","node","remove","parentElement","removeChild","i","length","Error","_filter","args","resolve","_filterSync","filter","processCallback","allowedTags","allowedStyles","html","doc","DOMParser","parseFromString","depthFirstForEach","body","childNodes","filterNode","indexOf","innerHTML","isElement","nodeName","toLowerCase","allowedTagNames","allowedAttributes","listAttributeNames","attributes","attrName","removeAttribute","attrValue","getNamedItem","value","trim","reparent","styles","split","map","style","styleName","Boolean","join","setAttribute","_filterEscape","_filterEscapeSync","escapeNode","before","document","createTextNode","after","parentNode","insertBefore","trimPattern","str","replace","attrNames","attr","push","name","list","fn","o","ownerDocument","undefined","nodeType","filterSync","filterEscape","filterEscapeSync"],"sources":["html.shim.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-env browser */\n\nimport {curry, forEach, includes, reduce} from 'lodash';\n\nexport {escape, escapeSync} from './html-base';\n\n/**\n * Some browsers don't implement {@link Element#remove()} or\n * {@link NodeList#remove()} or {@link HTMLCollection#remove()}. This wrapper\n * calls the appropriate `#remove()` method if available, or falls back to a\n * non-global-polluting polyfill.\n * @param {Element|NodeList|HTMLCollection} node\n * @returns {undefined}\n */\nfunction removeNode(node) {\n if (node.remove) {\n node.remove();\n\n return;\n }\n\n if (node.parentElement) {\n node.parentElement.removeChild(node);\n\n return;\n }\n\n if ('length' in node) {\n for (let i = node.length - 1; i >= 0; i -= 1) {\n removeNode(node[i]);\n }\n\n return;\n }\n\n throw new Error('Could not find a way to remove node');\n}\n\n/**\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction _filter(...args) {\n return new Promise((resolve) => {\n resolve(_filterSync(...args));\n });\n}\n\n/**\n * Curried async HTML filter.\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filter = curry(_filter, 4);\n\n/**\n * @param {function} processCallback callback function to do additional\n * processing on node. of the form process(node)\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction _filterSync(processCallback, allowedTags, allowedStyles, html) {\n if (!html || !allowedStyles || !allowedTags) {\n if (html.length === 0) {\n return html;\n }\n\n throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');\n }\n\n const doc = new DOMParser().parseFromString(html, 'text/html');\n\n depthFirstForEach(doc.body.childNodes, filterNode);\n processCallback(doc.body);\n\n if (html.indexOf('body') === 1) {\n return `<body>${doc.body.innerHTML}</body>`;\n }\n\n return doc.body.innerHTML;\n\n /**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\n function filterNode(node) {\n if (!isElement(node)) {\n return;\n }\n\n const nodeName = node.nodeName.toLowerCase();\n const allowedTagNames = Object.keys(allowedTags);\n\n depthFirstForEach(node.childNodes, filterNode);\n\n if (includes(allowedTagNames, nodeName)) {\n const allowedAttributes = allowedTags[nodeName];\n\n forEach(listAttributeNames(node.attributes), (attrName) => {\n if (!includes(allowedAttributes, attrName)) {\n node.removeAttribute(attrName);\n } else if (attrName === 'href' || attrName === 'src') {\n const attrValue = node.attributes.getNamedItem(attrName).value.trim().toLowerCase();\n\n // We're doing at runtime what the no-script-url rule does at compile\n // time\n // eslint-disable-next-line no-script-url\n if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {\n reparent(node);\n }\n } else if (attrName === 'style') {\n const styles = node.attributes\n .getNamedItem('style')\n .value.split(';')\n .map((style) => {\n const styleName = trim(style.split(':')[0]);\n\n if (includes(allowedStyles, styleName)) {\n return style;\n }\n\n return null;\n })\n .filter((style) => Boolean(style))\n .join(';');\n\n node.setAttribute('style', styles);\n }\n });\n } else {\n reparent(node);\n }\n }\n}\n\n/**\n * Same as _filter, but escapes rather than removes disallowed values\n * @param {Function} processCallback\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @returns {Promise<string>}\n */\nfunction _filterEscape(...args) {\n return new Promise((resolve) => {\n resolve(_filterEscapeSync(...args));\n });\n}\n\n/**\n * Same as _filterSync, but escapes rather than removes disallowed values\n * @param {Function} processCallback\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @returns {string}\n */\nfunction _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {\n if (!html || !allowedStyles || !allowedTags) {\n if (html.length === 0) {\n return html;\n }\n\n throw new Error('`allowedTags`, `allowedStyles`, and `html` must be provided');\n }\n\n const doc = new DOMParser().parseFromString(html, 'text/html');\n\n depthFirstForEach(doc.body.childNodes, filterNode);\n processCallback(doc.body);\n\n if (html.indexOf('body') === 1) {\n return `<body>${doc.body.innerHTML}</body>`;\n }\n\n return doc.body.innerHTML;\n\n /**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\n function filterNode(node) {\n if (!isElement(node)) {\n return;\n }\n\n depthFirstForEach(node.childNodes, filterNode);\n\n const nodeName = node.nodeName.toLowerCase();\n const allowedTagNames = Object.keys(allowedTags);\n\n if (includes(allowedTagNames, nodeName)) {\n const allowedAttributes = allowedTags[nodeName];\n\n forEach(listAttributeNames(node.attributes), (attrName) => {\n if (!includes(allowedAttributes, attrName)) {\n node.removeAttribute(attrName);\n } else if (attrName === 'href' || attrName === 'src') {\n const attrValue = node.attributes.getNamedItem(attrName).value.toLowerCase();\n\n // We're doing at runtime what the no-script-url rule does at compile\n // time\n // eslint-disable-next-line no-script-url\n if (attrValue.indexOf('javascript:') === 0 || attrValue.indexOf('vbscript:') === 0) {\n reparent(node);\n }\n } else if (attrName === 'style') {\n const styles = node.attributes\n .getNamedItem('style')\n .value.split(';')\n .map((style) => {\n const styleName = trim(style.split(':')[0]);\n\n if (includes(allowedStyles, styleName)) {\n return style;\n }\n\n return null;\n })\n .filter((style) => Boolean(style))\n .join(';');\n\n node.setAttribute('style', styles);\n }\n });\n } else {\n escapeNode(node);\n }\n }\n}\n\n/**\n * Escapes a given html node\n * @param {Node} node\n * @returns {undefined}\n */\nfunction escapeNode(node) {\n const before = document.createTextNode(`<${node.nodeName.toLowerCase()}>`);\n const after = document.createTextNode(`</${node.nodeName.toLowerCase()}>`);\n\n node.parentNode.insertBefore(before, node);\n while (node.childNodes.length > 0) {\n node.parentNode.insertBefore(node.childNodes[0], node);\n }\n node.parentNode.insertBefore(after, node);\n\n removeNode(node);\n}\n\nconst trimPattern = /^\\s|\\s$/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nfunction trim(str) {\n return str.replace(trimPattern, '');\n}\n\n/**\n * @param {Node} node\n * @private\n * @returns {undefined}\n */\nfunction reparent(node) {\n while (node.childNodes.length > 0) {\n node.parentNode.insertBefore(node.childNodes[0], node);\n }\n removeNode(node);\n}\n\n/**\n * @param {NamedNodeMap} attributes\n * @private\n * @returns {Array<string>}\n */\nfunction listAttributeNames(attributes) {\n return reduce(\n attributes,\n (attrNames, attr) => {\n attrNames.push(attr.name);\n\n return attrNames;\n },\n []\n );\n}\n\n/**\n * @param {Array} list\n * @param {Function} fn\n * @private\n * @returns {undefined}\n */\nfunction depthFirstForEach(list, fn) {\n for (let i = list.length; i >= 0; i -= 1) {\n fn(list[i]);\n }\n}\n\n/**\n * @param {Node} o\n * @private\n * @returns {Boolean}\n */\nfunction isElement(o) {\n if (!o) {\n return false;\n }\n\n if (o.ownerDocument === undefined) {\n return false;\n }\n\n if (o.nodeType !== 1) {\n return false;\n }\n\n if (typeof o.nodeName !== 'string') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Curried HTML filter.\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filterSync = curry(_filterSync, 4);\n\n/**\n * Curried HTML filter that escapes rather than removes disallowed tags\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {Promise<string>}\n */\nexport const filterEscape = curry(_filterEscape, 4);\n\n/**\n * Curried HTML filter that escapes rather than removes disallowed tags\n * @param {Object} allowedTags Map of tagName -> array of allowed attributes\n * @param {Array<string>} allowedStyles Array of allowed styles\n * @param {string} html html to filter\n * @returns {string}\n */\nexport const filterEscapeSync = curry(_filterEscapeSync, 4);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AAEA;AACA;A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EAAE;IACN,OAAO,KAAK;EACd;EAEA,IAAIA,CAAC,CAACC,aAAa,KAAKC,SAAS,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,IAAIF,CAAC,CAACG,QAAQ,KAAK,CAAC,EAAE;IACpB,OAAO,KAAK;EACd;EAEA,IAAI,OAAOH,CAAC,CAACvC,QAAQ,KAAK,QAAQ,EAAE;IAClC,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAM2C,UAAU,GAAG,qBAAM3D,WAAW,EAAE,CAAC,CAAC;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,IAAM4D,YAAY,GAAG,qBAAMvB,aAAa,EAAE,CAAC,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,IAAMwB,gBAAgB,GAAG,qBAAMvB,iBAAiB,EAAE,CAAC,CAAC;AAAC"}
package/dist/index.js CHANGED
@@ -1,52 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  _Object$defineProperty(exports, "escape", {
10
8
  enumerable: true,
11
9
  get: function get() {
12
10
  return _html.escape;
13
11
  }
14
12
  });
15
-
16
13
  _Object$defineProperty(exports, "escapeSync", {
17
14
  enumerable: true,
18
15
  get: function get() {
19
16
  return _html.escapeSync;
20
17
  }
21
18
  });
22
-
23
19
  _Object$defineProperty(exports, "filter", {
24
20
  enumerable: true,
25
21
  get: function get() {
26
22
  return _html.filter;
27
23
  }
28
24
  });
29
-
30
25
  _Object$defineProperty(exports, "filterEscape", {
31
26
  enumerable: true,
32
27
  get: function get() {
33
28
  return _html.filterEscape;
34
29
  }
35
30
  });
36
-
37
31
  _Object$defineProperty(exports, "filterEscapeSync", {
38
32
  enumerable: true,
39
33
  get: function get() {
40
34
  return _html.filterEscapeSync;
41
35
  }
42
36
  });
43
-
44
37
  _Object$defineProperty(exports, "filterSync", {
45
38
  enumerable: true,
46
39
  get: function get() {
47
40
  return _html.filterSync;
48
41
  }
49
42
  });
50
-
51
43
  var _html = require("./html");
52
44
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport {escape, escapeSync, filter, filterSync, filterEscape, filterEscapeSync} from './html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA"}
1
+ {"version":3,"names":[],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport {escape, escapeSync, filter, filterSync, filterEscape, filterEscapeSync} from './html';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/helper-html",
3
- "version": "3.0.0-beta.15",
3
+ "version": "3.0.0-beta.151",
4
4
  "description": "HTML Utiltities",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -24,11 +24,11 @@
24
24
  ]
25
25
  },
26
26
  "devDependencies": {
27
- "@webex/test-helper-chai": "3.0.0-beta.15",
28
- "@webex/test-helper-mocha": "3.0.0-beta.15"
27
+ "@webex/test-helper-chai": "3.0.0-beta.151",
28
+ "@webex/test-helper-mocha": "3.0.0-beta.151"
29
29
  },
30
30
  "dependencies": {
31
- "@webex/helper-html": "3.0.0-beta.15",
31
+ "@webex/helper-html": "3.0.0-beta.151",
32
32
  "lodash": "^4.17.21"
33
33
  }
34
34
  }