mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 03:55:43 +08: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:
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
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user