Bug 182545 - Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native trimEnd
Summary: Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-06 11:53 PST by Nikita Vasilyev
Modified: 2018-02-06 19:08 PST (History)
4 users (show)

See Also:


Attachments
Patch (9.67 KB, patch)
2018-02-06 16:38 PST, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2018-02-06 11:53:06 PST
trimEnd just landed in JSC (bug 182233). Just like `trim` removes whitespace at the beginning and the end of a string,
trimEnd removes whitespace only at the end.

In Utilities.js we have:

String.prototype.trimEnd(maxLength)
String.prototype.trimMiddle(maxLength)
String.prototype.truncate(maxLength)

Our trimEnd truncates a string to a specified maxLength.

I suggest to rename:
1. trimEnd to truncateEnd
2. trimMiddle to truncateMiddle
Comment 1 BJ Burg 2018-02-06 14:43:39 PST
(In reply to Nikita Vasilyev from comment #0)
> trimEnd just landed in JSC (bug 182233). Just like `trim` removes whitespace
> at the beginning and the end of a string,
> trimEnd removes whitespace only at the end.
> 
> In Utilities.js we have:
> 
> String.prototype.trimEnd(maxLength)
> String.prototype.trimMiddle(maxLength)
> String.prototype.truncate(maxLength)
> 
> Our trimEnd truncates a string to a specified maxLength.
> 
> I suggest to rename:
> 1. trimEnd to truncateEnd
> 2. trimMiddle to truncateMiddle

Sounds okay to me.
Comment 2 Nikita Vasilyev 2018-02-06 16:38:42 PST
Created attachment 333235 [details]
Patch
Comment 3 BJ Burg 2018-02-06 16:59:18 PST
Comment on attachment 333235 [details]
Patch

r=me with EWS
Comment 4 WebKit Commit Bot 2018-02-06 19:05:59 PST
Comment on attachment 333235 [details]
Patch

Clearing flags on attachment: 333235

Committed r228214: <https://trac.webkit.org/changeset/228214>
Comment 5 WebKit Commit Bot 2018-02-06 19:06:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-02-06 19:08:23 PST
<rdar://problem/37298532>