dompurify 1.0.2 → 1.0.3

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/purify.js CHANGED
@@ -15,7 +15,7 @@ var mathMl = ['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi',
15
15
 
16
16
  var text = ['#text'];
17
17
 
18
- var html$1 = ['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'coords', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'span', 'srclang', 'start', 'src', 'step', 'style', 'summary', 'tabindex', 'title', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns'];
18
+ var html$1 = ['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'coords', 'crossorigin', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'integrity', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns'];
19
19
 
20
20
  var svg$1 = ['accent-height', 'accumulate', 'additivive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan'];
21
21
 
@@ -47,6 +47,14 @@ function clone(object) {
47
47
  return newObject;
48
48
  }
49
49
 
50
+ var MUSTACHE_EXPR = /\{\{[\s\S]*|[\s\S]*\}\}/gm; // Specify template detection regex for SAFE_FOR_TEMPLATES mode
51
+ var ERB_EXPR = /<%[\s\S]*|[\s\S]*%>/gm;
52
+ var DATA_ATTR = /^data-[\-\w.\u00B7-\uFFFF]/; // eslint-disable-line no-useless-escape
53
+ var ARIA_ATTR = /^aria-[\-\w]+$/; // eslint-disable-line no-useless-escape
54
+ var IS_ALLOWED_URI = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
55
+ var IS_SCRIPT_OR_DATA = /^(?:\w+script|data):/i;
56
+ var ATTR_WHITESPACE = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // This needs to be extensive thanks to Webkit/Blink's behavior
57
+
50
58
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
51
59
 
52
60
  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
@@ -63,15 +71,15 @@ function createDOMPurify() {
63
71
  };
64
72
 
65
73
  /**
66
- * Version label, exposed for easier checks
67
- * if DOMPurify is up to date or not
68
- */
69
- DOMPurify.version = '1.0.2';
74
+ * Version label, exposed for easier checks
75
+ * if DOMPurify is up to date or not
76
+ */
77
+ DOMPurify.version = '1.0.3';
70
78
 
71
79
  /**
72
- * Array of elements that DOMPurify removed during sanitation.
73
- * Empty if nothing was removed.
74
- */
80
+ * Array of elements that DOMPurify removed during sanitation.
81
+ * Empty if nothing was removed.
82
+ */
75
83
  DOMPurify.removed = [];
76
84
 
77
85
  if (!window || !window.document || window.document.nodeType !== 9) {
@@ -126,14 +134,23 @@ function createDOMPurify() {
126
134
  var hooks = {};
127
135
 
128
136
  /**
129
- * Expose whether this browser supports running the full DOMPurify.
130
- */
137
+ * Expose whether this browser supports running the full DOMPurify.
138
+ */
131
139
  DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.documentMode !== 9;
132
140
 
141
+ var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
142
+ ERB_EXPR$$1 = ERB_EXPR,
143
+ DATA_ATTR$$1 = DATA_ATTR,
144
+ ARIA_ATTR$$1 = ARIA_ATTR,
145
+ IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
146
+ ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
147
+
148
+
149
+ var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
133
150
  /**
134
- * We consider the elements and attributes below to be safe. Ideally
135
- * don't add any new ones but feel free to remove unwanted ones.
136
- */
151
+ * We consider the elements and attributes below to be safe. Ideally
152
+ * don't add any new ones but feel free to remove unwanted ones.
153
+ */
137
154
 
138
155
  /* allowed element names */
139
156
  var ALLOWED_TAGS = null;
@@ -166,10 +183,6 @@ function createDOMPurify() {
166
183
  */
167
184
  var SAFE_FOR_TEMPLATES = false;
168
185
 
169
- /* Specify template detection regex for SAFE_FOR_TEMPLATES mode */
170
- var MUSTACHE_EXPR = /\{\{[\s\S]*|[\s\S]*\}\}/gm;
171
- var ERB_EXPR = /<%[\s\S]*|[\s\S]*%>/gm;
172
-
173
186
  /* Decide if document with <html>... should be returned */
174
187
  var WHOLE_DOCUMENT = false;
175
188
 
@@ -221,17 +234,16 @@ function createDOMPurify() {
221
234
  var formElement = document.createElement('form');
222
235
 
223
236
  /**
224
- * _parseConfig
225
- *
226
- * @param optional config literal
227
- */
237
+ * _parseConfig
238
+ *
239
+ * @param optional config literal
240
+ */
228
241
  // eslint-disable-next-line complexity
229
242
  var _parseConfig = function _parseConfig(cfg) {
230
243
  /* Shield configuration object from tampering */
231
244
  if ((typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
232
245
  cfg = {};
233
246
  }
234
-
235
247
  /* Set configuration parameters */
236
248
  ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
237
249
  ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
@@ -251,6 +263,8 @@ function createDOMPurify() {
251
263
  SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
252
264
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
253
265
 
266
+ IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
267
+
254
268
  if (SAFE_FOR_TEMPLATES) {
255
269
  ALLOW_DATA_ATTR = false;
256
270
  }
@@ -316,10 +330,10 @@ function createDOMPurify() {
316
330
  };
317
331
 
318
332
  /**
319
- * _forceRemove
320
- *
321
- * @param a DOM node
322
- */
333
+ * _forceRemove
334
+ *
335
+ * @param a DOM node
336
+ */
323
337
  var _forceRemove = function _forceRemove(node) {
324
338
  DOMPurify.removed.push({ element: node });
325
339
  try {
@@ -330,11 +344,11 @@ function createDOMPurify() {
330
344
  };
331
345
 
332
346
  /**
333
- * _removeAttribute
334
- *
335
- * @param an Attribute name
336
- * @param a DOM node
337
- */
347
+ * _removeAttribute
348
+ *
349
+ * @param an Attribute name
350
+ * @param a DOM node
351
+ */
338
352
  var _removeAttribute = function _removeAttribute(name, node) {
339
353
  DOMPurify.removed.push({
340
354
  attribute: node.getAttributeNode(name),
@@ -344,11 +358,11 @@ function createDOMPurify() {
344
358
  };
345
359
 
346
360
  /**
347
- * _initDocument
348
- *
349
- * @param a string of dirty markup
350
- * @return a DOM, filled with the dirty markup
351
- */
361
+ * _initDocument
362
+ *
363
+ * @param a string of dirty markup
364
+ * @return a DOM, filled with the dirty markup
365
+ */
352
366
  var _initDocument = function _initDocument(dirty) {
353
367
  /* Create a HTML document */
354
368
  var doc = void 0;
@@ -424,11 +438,11 @@ function createDOMPurify() {
424
438
  }
425
439
 
426
440
  /**
427
- * _createIterator
428
- *
429
- * @param document/fragment to create iterator for
430
- * @return iterator instance
431
- */
441
+ * _createIterator
442
+ *
443
+ * @param document/fragment to create iterator for
444
+ * @return iterator instance
445
+ */
432
446
  var _createIterator = function _createIterator(root) {
433
447
  return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, function () {
434
448
  return NodeFilter.FILTER_ACCEPT;
@@ -436,11 +450,11 @@ function createDOMPurify() {
436
450
  };
437
451
 
438
452
  /**
439
- * _isClobbered
440
- *
441
- * @param element to check for clobbering attacks
442
- * @return true if clobbered, false if safe
443
- */
453
+ * _isClobbered
454
+ *
455
+ * @param element to check for clobbering attacks
456
+ * @return true if clobbered, false if safe
457
+ */
444
458
  var _isClobbered = function _isClobbered(elm) {
445
459
  if (elm instanceof Text || elm instanceof Comment) {
446
460
  return false;
@@ -452,22 +466,22 @@ function createDOMPurify() {
452
466
  };
453
467
 
454
468
  /**
455
- * _isNode
456
- *
457
- * @param object to check whether it's a DOM node
458
- * @return true is object is a DOM node
459
- */
469
+ * _isNode
470
+ *
471
+ * @param object to check whether it's a DOM node
472
+ * @return true is object is a DOM node
473
+ */
460
474
  var _isNode = function _isNode(obj) {
461
475
  return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
462
476
  };
463
477
 
464
478
  /**
465
- * _executeHook
466
- * Execute user configurable hooks
467
- *
468
- * @param {String} entryPoint Name of the hook's entry point
469
- * @param {Node} currentNode
470
- */
479
+ * _executeHook
480
+ * Execute user configurable hooks
481
+ *
482
+ * @param {String} entryPoint Name of the hook's entry point
483
+ * @param {Node} currentNode
484
+ */
471
485
  var _executeHook = function _executeHook(entryPoint, currentNode, data) {
472
486
  if (!hooks[entryPoint]) {
473
487
  return;
@@ -479,15 +493,15 @@ function createDOMPurify() {
479
493
  };
480
494
 
481
495
  /**
482
- * _sanitizeElements
483
- *
484
- * @protect nodeName
485
- * @protect textContent
486
- * @protect removeChild
487
- *
488
- * @param node to check for permission to exist
489
- * @return true if node was killed, false if left alive
490
- */
496
+ * _sanitizeElements
497
+ *
498
+ * @protect nodeName
499
+ * @protect textContent
500
+ * @protect removeChild
501
+ *
502
+ * @param node to check for permission to exist
503
+ * @return true if node was killed, false if left alive
504
+ */
491
505
  var _sanitizeElements = function _sanitizeElements(currentNode) {
492
506
  var content = void 0;
493
507
 
@@ -531,8 +545,8 @@ function createDOMPurify() {
531
545
  if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
532
546
  /* Get the element's text content */
533
547
  content = currentNode.textContent;
534
- content = content.replace(MUSTACHE_EXPR, ' ');
535
- content = content.replace(ERB_EXPR, ' ');
548
+ content = content.replace(MUSTACHE_EXPR$$1, ' ');
549
+ content = content.replace(ERB_EXPR$$1, ' ');
536
550
  if (currentNode.textContent !== content) {
537
551
  DOMPurify.removed.push({ element: currentNode.cloneNode() });
538
552
  currentNode.textContent = content;
@@ -545,24 +559,17 @@ function createDOMPurify() {
545
559
  return false;
546
560
  };
547
561
 
548
- var DATA_ATTR = /^data-[\-\w.\u00B7-\uFFFF]/; // eslint-disable-line no-useless-escape
549
- var ARIA_ATTR = /^aria-[\-\w]+$/; // eslint-disable-line no-useless-escape
550
- var IS_ALLOWED_URI = /^(?:(?:(?:f|ht)tps?|mailto|tel):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
551
- var IS_SCRIPT_OR_DATA = /^(?:\w+script|data):/i;
552
- /* This needs to be extensive thanks to Webkit/Blink's behavior */
553
- var ATTR_WHITESPACE = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;
554
-
555
562
  /**
556
- * _sanitizeAttributes
557
- *
558
- * @protect attributes
559
- * @protect nodeName
560
- * @protect removeAttribute
561
- * @protect setAttribute
562
- *
563
- * @param node to sanitize
564
- * @return void
565
- */
563
+ * _sanitizeAttributes
564
+ *
565
+ * @protect attributes
566
+ * @protect nodeName
567
+ * @protect removeAttribute
568
+ * @protect setAttribute
569
+ *
570
+ * @param node to sanitize
571
+ * @return void
572
+ */
566
573
  // eslint-disable-next-line complexity
567
574
  var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
568
575
  var attr = void 0;
@@ -637,23 +644,23 @@ function createDOMPurify() {
637
644
  }
638
645
 
639
646
  /* Make sure attribute cannot clobber */
640
- if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in window || value in document || value in formElement)) {
647
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
641
648
  continue;
642
649
  }
643
650
 
644
651
  /* Sanitize attribute content to be template-safe */
645
652
  if (SAFE_FOR_TEMPLATES) {
646
- value = value.replace(MUSTACHE_EXPR, ' ');
647
- value = value.replace(ERB_EXPR, ' ');
653
+ value = value.replace(MUSTACHE_EXPR$$1, ' ');
654
+ value = value.replace(ERB_EXPR$$1, ' ');
648
655
  }
649
656
 
650
657
  /* Allow valid data-* attributes: At least one character after "-"
651
658
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
652
659
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
653
660
  We don't need to check the value; it's always URI safe. */
654
- if (ALLOW_DATA_ATTR && DATA_ATTR.test(lcName)) {
661
+ if (ALLOW_DATA_ATTR && DATA_ATTR$$1.test(lcName)) {
655
662
  // This attribute is safe
656
- } else if (ALLOW_ARIA_ATTR && ARIA_ATTR.test(lcName)) {
663
+ } else if (ALLOW_ARIA_ATTR && ARIA_ATTR$$1.test(lcName)) {
657
664
  // This attribute is safe
658
665
  /* Otherwise, check the name is permitted */
659
666
  } else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
@@ -664,7 +671,7 @@ function createDOMPurify() {
664
671
  // This attribute is safe
665
672
  /* Check no script, data or unknown possibly unsafe URI
666
673
  unless we know URI values are safe for that attribute */
667
- } else if (IS_ALLOWED_URI.test(value.replace(ATTR_WHITESPACE, ''))) {
674
+ } else if (IS_ALLOWED_URI$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
668
675
  // This attribute is safe
669
676
  /* Keep image data URIs alive if src/xlink:href is allowed */
670
677
  } else if ((lcName === 'src' || lcName === 'xlink:href') && value.indexOf('data:') === 0 && DATA_URI_TAGS[currentNode.nodeName.toLowerCase()]) {
@@ -672,7 +679,7 @@ function createDOMPurify() {
672
679
  /* Allow unknown protocols: This provides support for links that
673
680
  are handled by protocol handlers which may be unknown ahead of
674
681
  time, e.g. fb:, spotify: */
675
- } else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA.test(value.replace(ATTR_WHITESPACE, ''))) {
682
+ } else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) {
676
683
  // This attribute is safe
677
684
  /* Check for binary attributes */
678
685
  // eslint-disable-next-line no-negated-condition
@@ -695,11 +702,11 @@ function createDOMPurify() {
695
702
  };
696
703
 
697
704
  /**
698
- * _sanitizeShadowDOM
699
- *
700
- * @param fragment to iterate over recursively
701
- * @return void
702
- */
705
+ * _sanitizeShadowDOM
706
+ *
707
+ * @param fragment to iterate over recursively
708
+ * @return void
709
+ */
703
710
  var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
704
711
  var shadowNode = void 0;
705
712
  var shadowIterator = _createIterator(fragment);
@@ -730,12 +737,12 @@ function createDOMPurify() {
730
737
  };
731
738
 
732
739
  /**
733
- * Sanitize
734
- * Public method providing core sanitation functionality
735
- *
736
- * @param {String|Node} dirty string or DOM node
737
- * @param {Object} configuration object
738
- */
740
+ * Sanitize
741
+ * Public method providing core sanitation functionality
742
+ *
743
+ * @param {String|Node} dirty string or DOM node
744
+ * @param {Object} configuration object
745
+ */
739
746
  // eslint-disable-next-line complexity
740
747
  DOMPurify.sanitize = function (dirty, cfg) {
741
748
  var body = void 0;
@@ -757,6 +764,9 @@ function createDOMPurify() {
757
764
  throw new TypeError('toString is not a function');
758
765
  } else {
759
766
  dirty = dirty.toString();
767
+ if (typeof dirty !== 'string') {
768
+ throw new TypeError('dirty is not a string, aborting');
769
+ }
760
770
  }
761
771
  }
762
772
 
@@ -865,35 +875,35 @@ function createDOMPurify() {
865
875
  };
866
876
 
867
877
  /**
868
- * Public method to set the configuration once
869
- * setConfig
870
- *
871
- * @param {Object} configuration object
872
- * @return void
873
- */
878
+ * Public method to set the configuration once
879
+ * setConfig
880
+ *
881
+ * @param {Object} configuration object
882
+ * @return void
883
+ */
874
884
  DOMPurify.setConfig = function (cfg) {
875
885
  _parseConfig(cfg);
876
886
  SET_CONFIG = true;
877
887
  };
878
888
 
879
889
  /**
880
- * Public method to remove the configuration
881
- * clearConfig
882
- *
883
- * @return void
884
- */
890
+ * Public method to remove the configuration
891
+ * clearConfig
892
+ *
893
+ * @return void
894
+ */
885
895
  DOMPurify.clearConfig = function () {
886
896
  CONFIG = null;
887
897
  SET_CONFIG = false;
888
898
  };
889
899
 
890
900
  /**
891
- * AddHook
892
- * Public method to add DOMPurify hooks
893
- *
894
- * @param {String} entryPoint
895
- * @param {Function} hookFunction
896
- */
901
+ * AddHook
902
+ * Public method to add DOMPurify hooks
903
+ *
904
+ * @param {String} entryPoint
905
+ * @param {Function} hookFunction
906
+ */
897
907
  DOMPurify.addHook = function (entryPoint, hookFunction) {
898
908
  if (typeof hookFunction !== 'function') {
899
909
  return;
@@ -903,13 +913,13 @@ function createDOMPurify() {
903
913
  };
904
914
 
905
915
  /**
906
- * RemoveHook
907
- * Public method to remove a DOMPurify hook at a given entryPoint
908
- * (pops it from the stack of hooks if more are present)
909
- *
910
- * @param {String} entryPoint
911
- * @return void
912
- */
916
+ * RemoveHook
917
+ * Public method to remove a DOMPurify hook at a given entryPoint
918
+ * (pops it from the stack of hooks if more are present)
919
+ *
920
+ * @param {String} entryPoint
921
+ * @return void
922
+ */
913
923
  DOMPurify.removeHook = function (entryPoint) {
914
924
  if (hooks[entryPoint]) {
915
925
  hooks[entryPoint].pop();
@@ -917,12 +927,12 @@ function createDOMPurify() {
917
927
  };
918
928
 
919
929
  /**
920
- * RemoveHooks
921
- * Public method to remove all DOMPurify hooks at a given entryPoint
922
- *
923
- * @param {String} entryPoint
924
- * @return void
925
- */
930
+ * RemoveHooks
931
+ * Public method to remove all DOMPurify hooks at a given entryPoint
932
+ *
933
+ * @param {String} entryPoint
934
+ * @return void
935
+ */
926
936
  DOMPurify.removeHooks = function (entryPoint) {
927
937
  if (hooks[entryPoint]) {
928
938
  hooks[entryPoint] = [];
@@ -930,11 +940,11 @@ function createDOMPurify() {
930
940
  };
931
941
 
932
942
  /**
933
- * RemoveAllHooks
934
- * Public method to remove all DOMPurify hooks
935
- *
936
- * @return void
937
- */
943
+ * RemoveAllHooks
944
+ * Public method to remove all DOMPurify hooks
945
+ *
946
+ * @return void
947
+ */
938
948
  DOMPurify.removeAllHooks = function () {
939
949
  hooks = {};
940
950
  };