dompurify 3.3.0 → 3.3.1

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.
@@ -1,6 +1,6 @@
1
- /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
1
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
2
2
 
3
- import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib';
3
+ import { TrustedTypePolicy, TrustedHTML, TrustedTypesWindow } from 'trusted-types/lib/index.js';
4
4
 
5
5
  /**
6
6
  * Configuration to control DOMPurify behavior.
@@ -94,6 +94,10 @@ interface Config {
94
94
  * Add child elements to be removed when their parent is removed.
95
95
  */
96
96
  FORBID_CONTENTS?: string[] | undefined;
97
+ /**
98
+ * Extend the existing or default array of forbidden content elements.
99
+ */
100
+ ADD_FORBID_CONTENTS?: string[] | undefined;
97
101
  /**
98
102
  * Add elements to block-list.
99
103
  */
@@ -1,4 +1,4 @@
1
- /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
1
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
2
2
 
3
3
  const {
4
4
  entries,
@@ -305,7 +305,7 @@ const _createHooksMap = function _createHooksMap() {
305
305
  function createDOMPurify() {
306
306
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
307
307
  const DOMPurify = root => createDOMPurify(root);
308
- DOMPurify.version = '3.3.0';
308
+ DOMPurify.version = '3.3.1';
309
309
  DOMPurify.removed = [];
310
310
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
311
311
  // Not running in a browser, provide a factory function
@@ -651,6 +651,12 @@ function createDOMPurify() {
651
651
  }
652
652
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
653
653
  }
654
+ if (cfg.ADD_FORBID_CONTENTS) {
655
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
656
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
657
+ }
658
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
659
+ }
654
660
  /* Add #text in case KEEP_CONTENT is set to true */
655
661
  if (KEEP_CONTENT) {
656
662
  ALLOWED_TAGS['#text'] = true;