The trim method for strings doesn't work. The regex that matches the whitespace contains double back slashes (e.g. /^\\s+|\\s+$/g). But since the regex is defined as a native regex and not using a String, escaping is not needed. (it should be just /^\s+|\s+$/g instead).

Thus the current trim implementation removes backslashes followed by one or more of the letter 's' at the beginning and end of strings.

Patch see attachement.
Index: /home/tschneider/Projekte/qooxdoo/source/script/core/QxNative.js
===================================================================
--- /home/tschneider/Projekte/qooxdoo/source/script/core/QxNative.js    
(revision 2760)
+++ /home/tschneider/Projekte/qooxdoo/source/script/core/QxNative.js    
(working copy)
@@ -333,15 +333,15 @@
 };
 
 String.prototype.trimLeft = function() {
-  return this.replace(/^\\s+/, QxConst.CORE_EMPTY);
+  return this.replace(/^\s+/, QxConst.CORE_EMPTY);
 };
 
 String.prototype.trimRight = function() {
-  return this.replace(/\\s+$/, QxConst.CORE_EMPTY);
+  return this.replace(/\s+$/, QxConst.CORE_EMPTY);
 };
 
 String.prototype.trim = function() {
-  return this.replace(/^\\s+|\\s+$/g, QxConst.CORE_EMPTY);
+  return this.replace(/^\s+|\s+$/g, QxConst.CORE_EMPTY);
 };
 
 String.prototype.add = function(v, sep)

Reply via email to