Ticket #1240 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

[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

trim-links.patch (400 bytes) - added by guest 5 years ago.
A patch for this issue.

Change History

Changed 5 years ago by guest

A patch for this issue.

Changed 5 years ago by gogo

  • summary changed from Linker: trim spaces from url to [PATCH] Linker: trim spaces from url

Changed 5 years ago by gogo

  • keywords patch added

Changed 5 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, ""); };

Changed 5 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.

Changed 5 years ago by ray

  • status changed from new to closed
  • resolution set to fixed
  • component changed from Xinha Core to Plugins
  • 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

Note: See TracTickets for help on using tickets.