@wernfried/daterangepicker 5.4.1 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ var DateRangePicker = (function(exports, luxon2) {
6
6
  constructor(element, options, cb) {
7
7
  if (typeof element === "string" && document.querySelectorAll(element).length > 1)
8
8
  throw new RangeError(`Option 'element' must match to one element only`);
9
- this.parentEl = "body";
9
+ this.parentEl = document.querySelector("body");
10
10
  this.element = element instanceof HTMLElement ? element : document.querySelector(element);
11
11
  this.isInputText = this.element instanceof HTMLInputElement && this.element.type === "text";
12
12
  this.button = null;
@@ -161,7 +161,11 @@ var DateRangePicker = (function(exports, luxon2) {
161
161
  options.template = template.join("");
162
162
  this.container = createElementFromHTML(options.template);
163
163
  }
164
- this.parentEl = document.querySelector(typeof options.parentEl === "string" ? options.parentEl : this.parentEl);
164
+ if (options.parentEl instanceof HTMLElement) {
165
+ this.parentEl = options.parentEl;
166
+ } else if (typeof options.parentEl === "string") {
167
+ this.parentEl = document.querySelector(options.parentEl) ?? this.parentEl;
168
+ }
165
169
  this.parentEl.appendChild(this.container);
166
170
  if (typeof options.timePicker === "boolean")
167
171
  this.timePicker = options.timePicker;