- this.data = $.trim(this.data);
- if(this.data.length === 0 && oldLength > 0 && el.parent().contents().length === 1)
- this.data = ' ';
- if(this.data.length === 0) {
- addInfo(oldText);
- el.remove();
+ if(!text.transformed) {
+ addInfo([text.original]);
+ el.remove();
+ return true; // continue
+ }
+
+ if(text.transformed !== text.original) {
+ var toAdd = [];
+ if(!text.trimmed) {
+ toAdd.push(text.original);
+ } else {
+ var startingMatch = text.original.match(/^\s+/g),
+ endingMatch = text.original.match(/\s+$/g),
+ startingWhiteSpace = startingMatch ? startingMatch[0] : null,
+ endingWhiteSpace = endingMatch ? endingMatch[0] : null;
+
+ if(endingWhiteSpace) {
+ if(text.transformed[text.transformed.length - 1] === ' ' && endingWhiteSpace[0] === ' ')
+ endingWhiteSpace = endingWhiteSpace.substr(1);
+ toAdd.push(endingWhiteSpace);
+ }