From 9bdd42eb9c9f0dcc36aef3ba149e3394c3ba1789 Mon Sep 17 00:00:00 2001 From: alexMA Date: Sun, 14 Jun 2020 12:48:43 -0400 Subject: [PATCH 1/2] docs: add attachToDocument replacement example (#1578) --- docs/api/options.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/api/options.md b/docs/api/options.md index a006d6a52..fda090a03 100644 --- a/docs/api/options.md +++ b/docs/api/options.md @@ -323,7 +323,18 @@ wrapper.destroy() - default: `false` ::: warning Deprecation warning -`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. +`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. Example: + +```js +const elem = document.createElement('div') +if (document.body) { + document.body.appendChild(elem) +} +wrapper = mount(Component, { + attachTo: elem +}) +``` + ::: Like [`attachTo`](#attachto), but automatically creates a new `div` element for you and inserts it into the body. From 4c742e934da8b5b0d81c82a8320177f77e036724 Mon Sep 17 00:00:00 2001 From: Alex Middeleer Date: Sun, 14 Jun 2020 18:48:17 -0400 Subject: [PATCH 2/2] docs: make purpose of example more clear --- docs/api/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/options.md b/docs/api/options.md index fda090a03..b79e7efb7 100644 --- a/docs/api/options.md +++ b/docs/api/options.md @@ -323,7 +323,7 @@ wrapper.destroy() - default: `false` ::: warning Deprecation warning -`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. Example: +`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead. For example, if you need to attach the component to the document.body: ```js const elem = document.createElement('div')