Skip to content

Instantly share code, notes, and snippets.

@kara-ryli
Created September 3, 2010 18:38
Show Gist options
  • Save kara-ryli/564334 to your computer and use it in GitHub Desktop.
Save kara-ryli/564334 to your computer and use it in GitHub Desktop.
Adds a test to Modernizr to detect support for text-overflow.
Modernizr.addTest('textoverflow', function () {
var s = document.documentElement.style;
return 'textOverflow' in s || 'OTextOverflow' in s;
});
@kara-ryli
Copy link
Author

This test is shamelessly adapted from this comment by kangax on Ajaxian.

Allows css like

.textoverflow .line-that-might-wrap {
  overflow: hidden;
  text-overflow: ellipsis;
  whites-space: nowrap;
  width: 100%; /* Any width, for IE6 */
}

Without it looking bad in Firefox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment