useNativeClamp: false is broken
php4fan opened this issue · 3 comments
php4fan commented
When using useNativeClamp: false
I get this error:
clamp.js:117 Uncaught TypeError: Cannot read properties of null (reading 'children')
php4fan commented
In getLastChild(elem)
:
if (elem.lastChild.children && elem.lastChild.children.length > 0) {
return getLastChild(Array.prototype.slice.call(elem.children).pop());
}
Is this supposed to be:
if (elem.lastChild && elem.lastChild.children && elem.lastChild.children.length > 0) {
return getLastChild(Array.prototype.slice.call(elem.children).pop());
}
or
if (elem.children && elem.children.length > 0) {
return getLastChild(Array.prototype.slice.call(elem.children).pop());
}
?
Looks more likely to be the latter.
php4fan commented
Also here:
//This is the absolute last child, a text node, but something's wrong with it. Remove it and keep trying
else if (!elem.lastChild || !elem.lastChild.nodeValue || elem.lastChild.nodeValue == '' || elem.lastChild.nodeValue == opt.truncationChar) {
elem.lastChild.parentNode.removeChild(elem.lastChild); ///////////////// 1
return getLastChild(element); ///////////////// 2
}
- This throws error "cannot read property
parentNode
of null..." ifelem.lastChild
is null which is a possibility and does happen - I'm pretty sure you mean
elem
, notelement
php4fan commented
Oh shit I'm wasting my time, this project hasn't been touched in 9 years.