From 0cb70e214ffd24070fa9e312746953faa0b8a305 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 31 May 2021 05:35:59 -0400 Subject: Changing Backdrop rootElement to default to a string (#34092) The current config can cause the "body" to become stale. Specifically, if the entire body element is swapped out for a new body element, then the backdrop will continue to append itself to the original body element, since it's stored in memory as a reference on this object. This also no longer allows an explicit null to be passed to Backdrop's rootElement This still accomplishes the laziness of "not finding the rootElement until the Backdrop is created" to avoid problems of the JavaScript being included inside (so, before body is available). --- js/tests/unit/util/backdrop.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/util/backdrop.spec.js b/js/tests/unit/util/backdrop.spec.js index 195d5067c..3150ba14d 100644 --- a/js/tests/unit/util/backdrop.spec.js +++ b/js/tests/unit/util/backdrop.spec.js @@ -243,10 +243,10 @@ describe('Backdrop', () => { }) }) - it('Should default parent element to "document.body" when config value is null', done => { + it('Should find the rootElement if passed as a string', done => { const instance = new Backdrop({ isVisible: true, - rootElement: null + rootElement: 'body' }) const getElement = () => document.querySelector(CLASS_BACKDROP) instance.show(() => { -- cgit v1.2.3