Skip to content

Commit

Permalink
improve fix using nullish coalescing
Browse files Browse the repository at this point in the history
  • Loading branch information
Aierie committed Jul 29, 2022
1 parent dbe886b commit 332b4fe
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/custom-elements/ts_src/Patch/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,10 @@ export default function (internals: CustomElementInternals) {

Node.prototype.cloneNode = function (this: Node, deep) {
const clone = Native.Node_cloneNode.call(this, !!deep);
// document.ownerDocument is null
const registry = this.ownerDocument
? this.ownerDocument!.__CE_registry
: (this as Document).__CE_registry;

// Only create custom elements if this element's owner document is
// associated with the registry.
if (!registry) {
if (!(this.ownerDocument ?? this).__CE_registry) {
internals.patchTree(clone);
} else {
internals.patchAndUpgradeTree(clone);
Expand Down

0 comments on commit 332b4fe

Please sign in to comment.