@lwc/engine-core 8.3.0 → 8.4.0

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/index.js CHANGED
@@ -293,6 +293,16 @@ function toPrettyMemberNotation(parent, child) {
293
293
  return `${toString$1(parent)}[${JSON.stringify(child)}]`;
294
294
  }
295
295
  }
296
+ function safelyCallGetter(target, key) {
297
+ // Arbitrary getters can throw. We don't want to throw an error just due to dev-mode-only mutation tracking
298
+ // (which is only used for performance debugging) so ignore errors here.
299
+ try {
300
+ return target[key];
301
+ }
302
+ catch (_err) {
303
+ /* ignore */
304
+ }
305
+ }
296
306
  /**
297
307
  * Flush all the logs we've written so far and return the current logs.
298
308
  */
@@ -361,7 +371,7 @@ function trackTargetForMutationLogging(key, target) {
361
371
  // Deeply traverse arrays and objects to track every object within
362
372
  if (isArray$1(target)) {
363
373
  for (let i = 0; i < target.length; i++) {
364
- trackTargetForMutationLogging(toPrettyMemberNotation(key, i), target[i]);
374
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, i), safelyCallGetter(target, i));
365
375
  }
366
376
  }
367
377
  else {
@@ -370,10 +380,10 @@ function trackTargetForMutationLogging(key, target) {
370
380
  // https://github.com/salesforce/observable-membrane/blob/b85417f/src/base-handler.ts#L142-L143
371
381
  // Note this code path is very hot, hence doing two separate for-loops rather than creating a new array.
372
382
  for (const prop of getOwnPropertyNames$1(target)) {
373
- trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
383
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
374
384
  }
375
385
  for (const prop of getOwnPropertySymbols$1(target)) {
376
- trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), target[prop]);
386
+ trackTargetForMutationLogging(toPrettyMemberNotation(key, prop), safelyCallGetter(target, prop));
377
387
  }
378
388
  }
379
389
  }
@@ -666,8 +676,9 @@ for (const [propName, attrName] of entries(AriaPropNameToAttrNameMap)) {
666
676
  return this.getAttribute(attrName);
667
677
  },
668
678
  set(newValue) {
669
- // TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
670
- // Our historical behavior is to only treat null as removing the attribute
679
+ // TODO [#3284]: According to the spec, IDL nullable type values
680
+ // (null and undefined) should remove the attribute; however, we
681
+ // only do so in the case of null for historical reasons.
671
682
  // See also https://github.com/w3c/aria/issues/1858
672
683
  if (isNull(newValue)) {
673
684
  this.removeAttribute(attrName);
@@ -8005,7 +8016,10 @@ function validateClassAttr(vnode, elm, data, renderer) {
8005
8016
  let nodesAreCompatible = true;
8006
8017
  let readableVnodeClassname;
8007
8018
  const elmClassName = getAttribute(elm, 'class');
8008
- if (!isUndefined$1(className) && String(className) !== elmClassName) {
8019
+ if (!isUndefined$1(className) &&
8020
+ String(className) !== elmClassName &&
8021
+ // No mismatch if SSR `class` attribute is missing and CSR `class` is the empty string
8022
+ !(className === '' && isNull(elmClassName))) {
8009
8023
  // className is used when class is bound to an expr.
8010
8024
  nodesAreCompatible = false;
8011
8025
  // stringify for pretty-printing
@@ -8443,5 +8457,5 @@ function readonly(obj) {
8443
8457
  }
8444
8458
 
8445
8459
  export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8446
- /** version: 8.3.0 */
8460
+ /** version: 8.4.0 */
8447
8461
  //# sourceMappingURL=index.js.map