function truncateTitleText(titles) {
  for (let i = 0; i < titles.length; i++) {
    let el = titles[i];
    const originalTitle = el.innerText;
    let truncatedTitle = el.innerText;
    while (el.scrollHeight > el.offsetHeight && truncatedTitle.length > 0) {
      el.innerText = (truncatedTitle = truncatedTitle.slice(0, -1)) + '...';
    }
    if (truncatedTitle.length == 0) {
      console.error('Title truncation failed: ' + originalTitle);
    }
  }
}
/**
 * Truncates titles that are longer than two lines and appends an ellipsis. Text
 * overflow in CSS ("text-overflow: ellipsis") cannot handle multiple lines.
 */
Truncates titles that are longer than two lines and appends an ellipsis. Text
overflow in CSS ("text-overflow: ellipsis") cannot handle multiple lines.
Truncates titles that are longer than two lines and appends an ellipsis . Text overflow in CSS ( " text - overflow : ellipsis " ) cannot handle multiple lines .
function truncateTitleText(titles) {
  for (let i = 0; i < titles.length; i++) {
    let el = titles[i];
    const originalTitle = el.innerText;
    let truncatedTitle = el.innerText;
    while (el.scrollHeight > el.offsetHeight && truncatedTitle.length > 0) {
      el.innerText = (truncatedTitle = truncatedTitle.slice(0, -1)) + '...';
    }
    if (truncatedTitle.length == 0) {
      console.error('Title truncation failed: ' + originalTitle);
    }
  }
}
function truncateTitleText ( titles ) { for ( let i = 0 ; i < titles . length ; i ++ ) { let el = titles [ i ] ; const originalTitle = el . innerText ; let truncatedTitle = el . innerText ; while ( el . scrollHeight > el . offsetHeight && truncatedTitle . length > 0 ) { el . innerText = ( truncatedTitle = truncatedTitle . slice ( 0 , - 1 ) ) + '...' ; } if ( truncatedTitle . length == 0 ) { console . error ( 'Title truncation failed: ' + originalTitle ) ; } } }
Truncates titles that are longer than two lines and appends an ellipsis.
Truncates titles that are longer than two lines and appends an ellipsis .