Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a check for leading spaces to correct for issues in IE9, speci…

…fically with special character sets. Should fix #3
  • Loading branch information...
commit 90027f46aed7a151da10f537d6e5d19dcf6f082c 1 parent b6375de
@heygrady authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 jquery.textshadow.js
View
8 jquery.textshadow.js
@@ -9,7 +9,8 @@
rbreakright = /([\)\]\}\!\?\u2014])/g,
rbreakboth = /([-\u2013])/g,
rsplit = /[\s\u2063]/,
- rspace = /(\s*)/g;
+ rspace = /(\s*)/g,
+ rprespace = /^(\s*)/;
// create a plugin
$.fn.textshadow = function(value, options) {
@@ -42,7 +43,7 @@
//---------------------
// For splitting words
//---------------------
- // function for returning al words in an element as text nodes
+ // function for returning all words in an element as text nodes
function allWords(elem) {
$(elem).contents().each(function() {
if (this.nodeType === 3 && this.data) {
@@ -85,6 +86,9 @@
// Add the original string (it gets split)
var fragment = document.createDocumentFragment();
+ // set the "last index" based on leading whitespace
+ lastIndex = rprespace.exec(text)[1].length;
+
// loop by the splits
$.each(split, function() {
length = this.length;
Please sign in to comment.
Something went wrong with that request. Please try again.