Skip to content

Commit

Permalink
Prevent calling method on null
Browse files Browse the repository at this point in the history
getWindow().$ is null after reattach element.
  • Loading branch information
sculpt0r committed Dec 29, 2020
1 parent 6220082 commit 74eb1de
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,19 @@
if ( this._.cache.nativeSel !== undefined )
return this._.cache.nativeSel;

return ( this._.cache.nativeSel = isMSSelection ? this.document.$.selection : this.document.getWindow().$.getSelection() );
var s = null;
if ( isMSSelection ) {
s = this.document.$.selection;
} else {
var nativeObj = this.document.getWindow().$;
if ( nativeObj ) {
s = nativeObj.getSelection();
}
}

this._.cache.nativeSel = s;

return s;
},

/**
Expand Down

0 comments on commit 74eb1de

Please sign in to comment.