Skip to content

Commit

Permalink
Merge pull request #206 from coenmooij/hotfix/document-reference
Browse files Browse the repository at this point in the history
Use direct document reference instead of window child
  • Loading branch information
maxisam authored Aug 20, 2019
2 parents c725ebb + a60ae2f commit 9cfc83d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class ClipboardService {
* Creates a fake textarea element, sets its value from `text` property,
* and makes a selection on it.
*/
public copyFromContent(content: string, container: HTMLElement = this.window.document.body) {
public copyFromContent(content: string, container: HTMLElement = this.document.body) {
// check if the temp textarea still belongs to the current container.
// In case we have multiple places using ngx-clipboard, one is in a modal using container but the other one is not.
if (this.tempTextArea && !container.contains(this.tempTextArea)) {
Expand All @@ -89,7 +89,7 @@ export class ClipboardService {
}

// remove temporary textarea if any
public destroy(container: HTMLElement = this.window.document.body) {
public destroy(container: HTMLElement = this.document.body) {
if (this.tempTextArea) {
container.removeChild(this.tempTextArea);
// removeChild doesn't remove the reference from memory
Expand Down

0 comments on commit 9cfc83d

Please sign in to comment.