@angular/core 15.2.0-next.3 → 15.2.0-next.4

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,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.0-next.3
2
+ * @license Angular v15.2.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7249,70 +7249,18 @@ class DOMParserHelper {
7249
7249
  }
7250
7250
  }
7251
7251
  /**
7252
- * Use an HTML5 `template` element, if supported, or an inert body element created via
7253
- * `createHtmlDocument` to create and fill an inert DOM element.
7252
+ * Use an HTML5 `template` element to create and fill an inert DOM element.
7254
7253
  * This is the fallback strategy if the browser does not support DOMParser.
7255
7254
  */
7256
7255
  class InertDocumentHelper {
7257
7256
  constructor(defaultDoc) {
7258
7257
  this.defaultDoc = defaultDoc;
7259
7258
  this.inertDocument = this.defaultDoc.implementation.createHTMLDocument('sanitization-inert');
7260
- if (this.inertDocument.body == null) {
7261
- // usually there should be only one body element in the document, but IE doesn't have any, so
7262
- // we need to create one.
7263
- const inertHtml = this.inertDocument.createElement('html');
7264
- this.inertDocument.appendChild(inertHtml);
7265
- const inertBodyElement = this.inertDocument.createElement('body');
7266
- inertHtml.appendChild(inertBodyElement);
7267
- }
7268
7259
  }
7269
7260
  getInertBodyElement(html) {
7270
- // Prefer using <template> element if supported.
7271
7261
  const templateEl = this.inertDocument.createElement('template');
7272
- if ('content' in templateEl) {
7273
- templateEl.innerHTML = trustedHTMLFromString(html);
7274
- return templateEl;
7275
- }
7276
- // Note that previously we used to do something like `this.inertDocument.body.innerHTML = html`
7277
- // and we returned the inert `body` node. This was changed, because IE seems to treat setting
7278
- // `innerHTML` on an inserted element differently, compared to one that hasn't been inserted
7279
- // yet. In particular, IE appears to split some of the text into multiple text nodes rather
7280
- // than keeping them in a single one which ends up messing with Ivy's i18n parsing further
7281
- // down the line. This has been worked around by creating a new inert `body` and using it as
7282
- // the root node in which we insert the HTML.
7283
- const inertBody = this.inertDocument.createElement('body');
7284
- inertBody.innerHTML = trustedHTMLFromString(html);
7285
- // Support: IE 11 only
7286
- // strip custom-namespaced attributes on IE<=11
7287
- if (this.defaultDoc.documentMode) {
7288
- this.stripCustomNsAttrs(inertBody);
7289
- }
7290
- return inertBody;
7291
- }
7292
- /**
7293
- * When IE11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
7294
- * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
7295
- * 'ns1:xlink:foo').
7296
- *
7297
- * This is undesirable since we don't want to allow any of these custom attributes. This method
7298
- * strips them all.
7299
- */
7300
- stripCustomNsAttrs(el) {
7301
- const elAttrs = el.attributes;
7302
- // loop backwards so that we can support removals.
7303
- for (let i = elAttrs.length - 1; 0 < i; i--) {
7304
- const attrib = elAttrs.item(i);
7305
- const attrName = attrib.name;
7306
- if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
7307
- el.removeAttribute(attrName);
7308
- }
7309
- }
7310
- let childNode = el.firstChild;
7311
- while (childNode) {
7312
- if (childNode.nodeType === Node.ELEMENT_NODE)
7313
- this.stripCustomNsAttrs(childNode);
7314
- childNode = childNode.nextSibling;
7315
- }
7262
+ templateEl.innerHTML = trustedHTMLFromString(html);
7263
+ return templateEl;
7316
7264
  }
7317
7265
  }
7318
7266
  /**
@@ -8795,7 +8743,7 @@ class Version {
8795
8743
  /**
8796
8744
  * @publicApi
8797
8745
  */
8798
- const VERSION = new Version('15.2.0-next.3');
8746
+ const VERSION = new Version('15.2.0-next.4');
8799
8747
 
8800
8748
  // This default value is when checking the hierarchy for a token.
8801
8749
  //