Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #75 from sergiokas/master

Fixed #72, allowing prune to run on IE8
  • Loading branch information...
commit 4f72ac023cb2d2a3acf010ee735ada84d31745c1 2 parents 0073f37 + f06a71c
@edtsech authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/underscore.string.js
View
8 lib/underscore.string.js
@@ -333,15 +333,17 @@
var template = '';
var pruned = '';
var i = 0;
+ var chars = []; // IE8 fix
// Set default values
pruneStr = pruneStr || '...';
length = parseNumber(length);
// Convert to an ASCII string to avoid problems with unicode chars.
- for (i in str) {
- template += (isWordChar(str[i]))?'A':' ';
- }
+ chars = _s.chars(str); // IE8 fix to allow iteration over the source string
+ for (i in chars) {
+ template += (isWordChar(chars[i]))?'A':' ';
+ }
// Check if we're in the middle of a word
if( template.substring(length-1, length+1).search(/^\w\w$/) === 0 )
Please sign in to comment.
Something went wrong with that request. Please try again.