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
4 changes: 4 additions & 0 deletions textFit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
reProcess: true, // if true, textFit will re-process already-fit nodes. Set to 'false' for better performance
widthOnly: false, // if true, textFit will fit text to element width, regardless of text height
alignVertWithFlexbox: false, // if true, textFit will use flexbox for vertical alignment
ignoreZeroSize: false, // if true, textFit will not fail if inner width or height is 0
};

return function textFit(els, options) {
Expand Down Expand Up @@ -100,6 +101,9 @@

// Don't process if we can't find box dimensions
if (!originalWidth || (!settings.widthOnly && !originalHeight)) {
if (settings.ignoreZeroSize) {
return
}
if(!settings.widthOnly)
throw new Error('Set a static height and width on the target element ' + el.outerHTML +
' before using textFit!');
Expand Down
2 changes: 1 addition & 1 deletion textFit.min.js

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