Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1675 closed change (fixed)

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

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

http://codereview.adblockplus.org/5325266087837696

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 Firefox 3.5, 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.

Change History (4)

comment:1 Changed 5 years ago by sebastian

See #1674 for the respective Chrome/Opera/Safari issue.

comment:2 Changed 5 years ago by sebastian

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

comment:3 Changed 5 years ago by sebastian

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:4 Changed 5 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Firefox-next
Note: See TracTickets for help on using tickets.