pvdspek / jquery.autoellipsis

Auto-ellipsis plugin for jQuery
http://pvdspek.github.com/jquery.autoellipsis
MIT License
142 stars 32 forks source link

Firefox H2 elements being removed rather than showing ellipsis #25

Open codemonkeyneo opened 11 years ago

codemonkeyneo commented 11 years ago

Firefox seemed to be the only browser that would remove the content for title elements that were wrapped in H2.

To fix the issue we just altered the offset and then the problem was fixed. Its a quick hack but maybe someone else experiencing the problem can benefit from the work around.

// Iterate until wrapper element height is less than or equal to the original container element
// height plus possible wrapperOffset.
-      while (wrapperElement.innerHeight() > containerElementHeight + wrapperOffset) {
+      while (wrapperElement.innerHeight() > containerElementHeight + (wrapperOffset + 1)) {
        // Apply ellipsis on last text node, by removing one word.
        ellipsisApplied = ellipsisOnLastTextNode(selectedElement);