Bug 14265 - Use $.trim instead of trim() in admin/categorie.tt
Summary: Use $.trim instead of trim() in admin/categorie.tt
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-25 03:36 UTC by David Cook
Modified: 2016-12-05 21:23 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 14265 - Use $.trim instead of trim() in admin/categorie.tt (1.71 KB, patch)
2015-05-25 04:05 UTC, David Cook
Details | Diff | Splinter Review
Bug 14265 - Use $.trim instead of trim() in admin/categorie.tt (1.77 KB, patch)
2015-05-25 13:13 UTC, Indranil Das Gupta
Details | Diff | Splinter Review
Bug 14265 - Use $.trim instead of trim() in admin/categorie.tt (1.92 KB, patch)
2015-05-27 15:31 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2015-05-25 03:36:27 UTC
At the moment, we use both jQuery's $.trim() and the regular Javascript trim() in our templates.

You can find trim() in:
- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt
- koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt

You can find $.trim() in:
- koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt

The jQuery $.trim() appears perfectly cross-platform, but the Javascript trim() isn't supported in IE8 or earlier. It was only introduced in IE9.

Since we already use jQuery everywhere, I don't see why we can't use $.trim() instead of trim(). 

At the moment, people using IE8 in the staff client (and I'm sure there are many of them) can't save patron categories. Javascript errors will prevent the submission of the page.

--

I know we occasionally debate supporting older versions of IE, but this is a pretty easy win.
Comment 1 David Cook 2015-05-25 04:05:34 UTC Comment hidden (obsolete)
Comment 2 Indranil Das Gupta 2015-05-25 13:13:40 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-05-27 15:31:33 UTC
Created attachment 39593 [details] [review]
Bug 14265 - Use $.trim instead of trim() in admin/categorie.tt

This patch replaces trim() with $.trim() in admin/categorie.tt, as
$.trim() is more cross-platform (ie it is supported in "< IE9").

_TEST PLAN_

Before applying patch:

0) Use IE 8 or use Document Mode 8 in a newer IE using F12 Developer Tools
1) Go to Administration > Patron categories
2) Click "Edit" next to a category
3) Click "Save" at the bottom
4) Note the form doesn't submit (you can also notice the error in the
console log)

Apply the patch:

5) Hold down shift + refresh the page
6) Click "Save" at the bottom"
7) Note that the form does submit and there are no errors reported

Signed-off-by: Indranil Das Gupta <indradg@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
No regression found using iceweasel.
I did not know the staff interface was IE compatible.
Comment 4 Tomás Cohen Arazi (tcohen) 2015-06-01 17:20:50 UTC
Patch pushed to master.

Thanks David!
Comment 5 Chris Cormack 2015-06-03 08:06:02 UTC
Pushed to 3.20.x will be in 3.20.1
Comment 6 Liz Rea 2015-06-22 22:40:37 UTC
Patch pushed to 3.18.x will be in 3.18.08