Opened 11 years ago
Closed 10 years ago
#1240 closed defect (fixed)
[PATCH] Linker: trim spaces from url
Reported by: | guest | Owned by: | gogo |
---|---|---|---|
Priority: | normal | Milestone: | 0.96 |
Component: | Plugins | Version: | trunk |
Severity: | normal | Keywords: | patch |
Cc: |
Description
For some reason, users will sometimes mis-copy and enter a space before or after a URL in Xinha. This leads to subtly broken links -- when you mouse over them, they look fine, but in the source, there's a %20 on the end. This can be trivially fixed (see attached patch).
P.S. Can I have an account on trac? My name is David Turner <novalis@…>, and I work for the Open Planning Project with Doug Mayle, whom I think you have spoken to.
Attachments (1)
Change History (6)
Changed 11 years ago by guest
comment:1 Changed 11 years ago by gogo
- Summary changed from Linker: trim spaces from url to [PATCH] Linker: trim spaces from url
comment:2 Changed 11 years ago by gogo
- Keywords patch added
comment:3 Changed 11 years ago by mokhet
It is *not* Xinha goal to create a "String.prototype.trim" function, especially when the usage/modification is so generic. I have a "String.prototype.trim" function in my own library, as much of us, but I end up with a different "String.prototype.trim" (Xinha version) when Xinha is added (dynamic and static) to my document.
I would much more prefer a "Xinha.StringTrim?" function instead of modifying the prototype of the "String" Object.
Xinha is a third party application. Ans as such, it should (must) *never* update any built-in and hosts objects prototypes.
Xinha.StringTrim? = function(str) { return str.replace(/\s+|\s+$/g, ""); };
comment:4 Changed 11 years ago by gogo
Replying to mokhet:
It is *not* Xinha goal to create a "String.prototype.trim" function, especially
String.prototype.trim() has been present since revision 1 mokhet, infact probably from before Xinha was Xinha...
http://xinha.webfactional.com/browser/trunk/htmlarea.js?rev=1
and to be fair, the function of trim() on a string is pretty standard no matter what programming language you are thinking of, I don't see it as being a problem.
comment:5 Changed 10 years ago by ray
- Component changed from Xinha Core to Plugins
- Resolution set to fixed
- Status changed from new to closed
- Type changed from enhancement to defect
rev [1027]: I just happened to run into this bug myself and was quite surprised that this is not already in place
A patch for this issue.