mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
committed by
GitHub
parent
a8b2e7e343
commit
38c3a44bf9
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user