FIX: return empty array when no parent for range (#14386)

If parent element for range does not exists, range calculator should
return empty array. In that case duration calculations will stop because
of:

```
if (_rangeElements(element).length === 2) {
  opts.duration = _calculateDuration(element);
}
```
This commit is contained in:
Krzysztof Kotlarek 2021-09-20 16:03:02 +10:00 committed by GitHub
parent a8b2e7e343
commit 38c3a44bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,9 @@ function buildOptionsFromElement(element, siteSettings) {
}
function _rangeElements(element) {
if (!element.parentElement) {
return [];
}
return Array.from(element.parentElement.children).filter(
(span) => span.dataset.date
);