aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/controls.js
diff options
context:
space:
mode:
authorAlbin Larsson <mail@albinlarsson.com>2018-07-30 01:02:13 +0200
committerAlbin Larsson <mail@albinlarsson.com>2018-07-30 01:02:13 +0200
commite5e169a1e2edf53a90913b838f4c9d59c011aa12 (patch)
treeba33553ab53b31db207e6411af1ef4328655b4da /src/js/controls.js
parent5eda4985160b168464ac62ba174a847cbc099f7c (diff)
downloadplyr-e5e169a1e2edf53a90913b838f4c9d59c011aa12.tar.lz
plyr-e5e169a1e2edf53a90913b838f4c9d59c011aa12.tar.xz
plyr-e5e169a1e2edf53a90913b838f4c9d59c011aa12.zip
Don't move caption up when "showing" the lower controls when the controls are empty
Diffstat (limited to 'src/js/controls.js')
-rw-r--r--src/js/controls.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/js/controls.js b/src/js/controls.js
index 2bc8b4de..e95cfc86 100644
--- a/src/js/controls.js
+++ b/src/js/controls.js
@@ -1455,12 +1455,9 @@ const controls = {
target = this.elements.container;
}
- // Inject controls HTML
- if (is.element(container)) {
- target.appendChild(container);
- } else if (container) {
- target.insertAdjacentHTML('beforeend', container);
- }
+ // Inject controls HTML (needs to be before captions, hence "afterbegin")
+ const insertMethod = is.element(container) ? 'insertAdjacentElement' : 'insertAdjacentHTML';
+ target[insertMethod]('afterbegin', container);
// Find the elements if need be
if (!is.element(this.elements.controls)) {