Opened on 12/08/2014 at 05:01:55 PM

Closed on 12/08/2014 at 05:30:04 PM

#1674 closed change (fixed)

Use String.trim() to strip leading/trailing whitespaces

Reported by: sebastian Assignee: sebastian
Priority: P4 Milestone: Adblock-Plus-1.8.9-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/6438904399921152

Description

Background

Currently most of our code is using .replace(/^\s+/, "").replace(/\s+$/, "") in order to remove leading and trailing whitespaces in a string. However since Chrome 23 and Safari 5, there is String.trim() which does the same in a more readable and more efficient way.

What to change

Use .trim() to remove leading and trailing whitespaces, where currently regular expressions are used.

Attachments (0)

Change History (4)

comment:1 Changed on 12/08/2014 at 05:02:36 PM by sebastian

  • Summary changed from Use String.trim() to strip leading/trailing whitespaces. to Use String.trim() to strip leading/trailing whitespaces

comment:2 Changed on 12/08/2014 at 05:03:05 PM by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed on 12/08/2014 at 05:22:59 PM by sebastian

See #1675 for the respective Firefox issue.

comment:4 Changed on 12/08/2014 at 05:30:04 PM by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from sebastian.
 
Note: See TracTickets for help on using tickets.