diff --git a/jquery.parsley.js b/jquery.parsley.js index d21b5f9..bd9ffad 100644 --- a/jquery.parsley.js +++ b/jquery.parsley.js @@ -44,16 +44,6 @@ StringNodeList.prototype.toString = function() { return buffer + "]>"; } -/** - * Trims and replaces arbitrary whitespace with single spaces. - */ -StringNodeList.prototype.normalizeSpace = function() { - jQuery.each(this, function() { - this.string = pQuery.normalizeSpace(this.string); - }); - return this; -} - /** * Creates an array of strings that mirrors this StringNodeList. */ @@ -77,7 +67,7 @@ StringNodeList.prototype.simple = function() { * * The following shortcut arguments are also available: * - extract() - * => function(node) { return pQuery.normalizeSpace(jQuery(node).text()); } + * => function(node) { return jQuery(node).text(); } * - extract("@foo") * => function(node) { return jQuery(node).attr("foo"); } * - extract(/regex/) @@ -86,7 +76,7 @@ StringNodeList.prototype.simple = function() { jQuery.fn.extract = function(func) { if(!func){ func = function(node) { - return pQuery.normalizeSpace(jQuery(node).text()); + return jQuery(node).text(); }; } @@ -180,10 +170,6 @@ pQuery.group = function(parselet) { }); } -pQuery.normalizeSpace = function(string) { - return string.replace(/\s+/g, ' ').replace(/^\s+/m, '').replace(/\s+$/m, ''); -} - pQuery.extract = function(parselet) { jQuery.each(parselet, function(key, value) { if(typeof(value) == "array") { diff --git a/tests.html b/tests.html index 3bb307e..f7bc771 100644 --- a/tests.html +++ b/tests.html @@ -30,11 +30,7 @@ return max; }).simple(), [25, 10]); }); - - test("trailing space normalization", function() { - same($(".message").extract().normalizeSpace().simple(), ["Merry christmas!", "Happy new year!"]); - }); - + test("extract", function(){ var parselet = { page: location.href.split("/").pop, @@ -88,7 +84,7 @@