Opened 5 years ago

Closed 5 years ago

#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.

Change History (4)

comment:1 Changed 5 years ago 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 5 years ago by sebastian

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

comment:3 Changed 5 years ago by sebastian

See #1675 for the respective Firefox issue.

comment:4 Changed 5 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.