//aka makeDesignerHappy(dEl);
functionbreakWord(dEl){if(!dEl||dEl.nodeType!== 1){return false;
}else if(dEl.currentStyle&& typeofdEl.currentStyle.wordBreak=== 'string'){//Lazy Function Definition Pattern, Peter's Blog
//From http://peter.michaux.ca/article/3556
breakWord= function(dEl){//For Internet Explorer
dEl.runtimeStyle.wordBreak= 'break-all';return true;
}returnbreakWord(dEl);
}else if(document.createTreeWalker){//Faster Trim in Javascript, Flagrant Badassery
//http://blog.stevenlevithan.com/archives/faster-trim-javascript
vartrim= function(str) {
str=str.replace(/^\s\s*/,'');varws= /\s/,
i=str.length;while(ws.test(str.charAt(--i)));returnstr.slice(0, i+ 1);
}//Lazy Function Definition Pattern, Peter's Blog
//From http://peter.michaux.ca/article/3556
breakWord= function(dEl){//For Opera, Safari, and Firefox
vardWalker=document.createTreeWalker(dEl, NodeFilter.SHOW_TEXT,null,false);varnode,s,c=String.fromCharCode('8203');while(dWalker.nextNode())
{
node=dWalker.currentNode;//we need to trim String otherwise Firefox will display
//incorect text-indent with space characters
s=trim( node.nodeValue ) .split('').join(c);
node.nodeValue=s;
}return true;
}returnbreakWord(dEl);
}else{return false;
}
}
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
//Break All Words
void function(){varaEl=document.getElementsByTagName('p');vardEl,i;varsName= "break-word";varoReg= newRegExp('(\\s|^)' +sName+ '(\\s|$)');for(i=0;dEl=aEl[i];i++){if(dEl.className.match(oReg)){
breakWord(dEl);
}
}
}();