Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion clamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
* Gets an element's last child. That may be another node or a node's contents.
*/
function getLastChild(elem) {
if (!elem.lastChild) {
return;
}
//Current element has children, need to go deeper and get last child as a text node
if (elem.lastChild.children && elem.lastChild.children.length > 0) {
return getLastChild(Array.prototype.slice.call(elem.children).pop());
Expand All @@ -133,7 +136,7 @@
* height is beneath the passed-in max param.
*/
function truncate(target, maxHeight) {
if (!maxHeight) {return;}
if (!target || !maxHeight) {return;}

/**
* Resets global variables.
Expand Down
13 changes: 1 addition & 12 deletions clamp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.