Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug finding a max with letter-spacing #3

Open
usrlocalben opened this issue Sep 25, 2011 · 0 comments
Open

bug finding a max with letter-spacing #3

usrlocalben opened this issue Sep 25, 2011 · 0 comments
Assignees

Comments

@usrlocalben
Copy link

If you have negative letter-spacing, then container width() can be zero as the loop starts to find a max to bsearch from. In this case, it will exit early since it compares it against the (uninitialized) variable 'width' . The comments say that this is to "prevent an infinite loop." I'm not sure what testcase might cause that, but it appears that this code is unnecessary. If I set realWidth to container.width() and remove the infinite loop stuff then it works fine.

--- jquery.stretch.js.original  2011-09-24 22:50:22.974482000 -0400
+++ jquery.stretch.js   2011-09-24 22:28:29.274540681 -0400
@@ -63,11 +63,7 @@
                                min = max;
                                max *= 2;
                                container.css("font-size", max + "px");
-
-                               // If the width isn't changing, then avoid an infinite loop.
-                               var realWidth = contents.width();
-                               width = realWidth <= width ? idealWidth : realWidth;
-
+                               width = contents.width();
                        } while (width < idealWidth);
                } else {
                        max = opts.max;
@ghost ghost assigned tixxit Sep 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants