Browse Source

fix Ellipsis break in firefox #1882 (#1921)

pull/1939/head
niko 8 years ago
committed by GitHub
parent
commit
b75ca54a70
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/components/Ellipsis/index.js

8
src/components/Ellipsis/index.js

@ -137,11 +137,15 @@ export default class Ellipsis extends Component {
if (sh <= th) { if (sh <= th) {
shadowNode.innerHTML = text.substring(0, mid + 1) + suffix; shadowNode.innerHTML = text.substring(0, mid + 1) + suffix;
sh = shadowNode.offsetHeight; sh = shadowNode.offsetHeight;
if (sh > th) { if (sh > th || mid === begin) {
return mid; return mid;
} else { } else {
begin = mid; begin = mid;
mid = Math.floor((end - begin) / 2) + begin; if (end - begin === 1) {
mid = 1 + begin;
} else {
mid = Math.floor((end - begin) / 2) + begin;
}
return this.bisection(th, mid, begin, end, text, shadowNode); return this.bisection(th, mid, begin, end, text, shadowNode);
} }
} else { } else {

Loading…
Cancel
Save