@ecency/render-helper 2.4.31 → 2.4.32

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,4 +1,4 @@
1
- import { DOMParser as DOMParser$1, XMLSerializer } from '@xmldom/xmldom';
1
+ import { DOMParser as DOMParser$1, XMLSerializer as XMLSerializer$1 } from '@xmldom/xmldom';
2
2
  import xss from 'xss';
3
3
  import multihash from 'multihashes';
4
4
  import querystring from 'querystring';
@@ -168,14 +168,13 @@ var ALLOWED_ATTRIBUTES = {
168
168
  "del": [],
169
169
  "ins": []
170
170
  };
171
- var lenientErrorHandler = (level, msg, context) => {
171
+ var hasDOMParser = typeof globalThis.DOMParser !== "undefined";
172
+ var hasXMLSerializer = typeof globalThis.XMLSerializer !== "undefined";
173
+ var lenientErrorHandler = (level, msg, _context) => {
172
174
  return void 0;
173
175
  };
174
- var DOMParser = new DOMParser$1({
175
- // Use onError instead of deprecated errorHandler
176
- // By providing a non-throwing error handler, parsing continues despite malformed HTML
177
- onError: lenientErrorHandler
178
- });
176
+ var DOMParser = hasDOMParser ? new globalThis.DOMParser() : new DOMParser$1({ onError: lenientErrorHandler });
177
+ var XMLSerializer = hasXMLSerializer ? globalThis.XMLSerializer : XMLSerializer$1;
179
178
 
180
179
  // src/helper.ts
181
180
  function removeDuplicateAttributes(html) {
@@ -253,6 +252,8 @@ function isValidUsername(username) {
253
252
  !label.includes("..");
254
253
  });
255
254
  }
255
+
256
+ // src/methods/get-inner-html.method.ts
256
257
  function getSerializedInnerHTML(node) {
257
258
  const serializer = new XMLSerializer();
258
259
  if (node.childNodes[0]) {