Compute line height if `options.lineHeight` is not provided
Closed this issue · 6 comments
aron commented
Should be able to use $root.css('line-height')
for a best guess right?
NoxHarmonium commented
Or as a non jQuery dependent solution something like this might do:
var style = window.getComputedStyle(el, null);
var lineHeight = parseFloat(style['line-height'])
Is it a required parameter for performance reasons or something? If I submitted a pull request to make line height optional and auto-detected if not provided would it be accepted?
jeffchan commented
Yes definitely would consider it! Just got to make sure it's cross browser compliant
Tuizi commented
getComputedStyle is one of the most expensive javascript property. This will kill rendering performance on a page using 100+ truncation.
Tuizi commented
@NoxHarmonium @aron feature available in truncate.js v1.1.0, enjoy!
NoxHarmonium commented
Nice work 👍