Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native trimEnd
https://bugs.webkit.org/show_bug.cgi?id=182545
Reviewed by Brian Burg.
Source/WebInspectorUI:
Rename:
- trimEnd to truncateEnd
- trimMiddle to truncateMiddle
* UserInterface/Base/Utilities.js:
(String.prototype.trimMiddle): Deleted.
(String.prototype.trimEnd): Deleted.
(String.prototype.truncateMiddle): Added.
(String.prototype.truncateEnd): Added.
Use strict mode. Scrict mode allows `this` to be a primitive (a string, in our case).
In non-strict mode, `this` is always an object. Without the strict mode,
"a".truncateEnd(42) !== "a", because truncateEnd returns a string object.
* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype._buildAttributeDOM):
* UserInterface/Views/DOMTreeElementPathComponent.js:
(WI.DOMTreeElementPathComponent):
* UserInterface/Views/SearchResultTreeElement.js:
Remove an obvious comment.
(WI.SearchResultTreeElement.truncateAndHighlightTitle):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._renderValue):
LayoutTests:
* inspector/unit-tests/string-utilities-expected.txt:
* inspector/unit-tests/string-utilities.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@228214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/inspector/unit-tests/string-utilities-expected.txt b/LayoutTests/inspector/unit-tests/string-utilities-expected.txt
index 25af5b1..d68c30e 100644
--- a/LayoutTests/inspector/unit-tests/string-utilities-expected.txt
+++ b/LayoutTests/inspector/unit-tests/string-utilities-expected.txt
@@ -46,3 +46,13 @@
PASS: Last line of a string with a traling line break should be empty.
PASS: Last line of an empty string is the same empty string.
+-- Running test case: String.prototype.truncateMiddle
+PASS: String stays the same.
+PASS: Ellipsis is inserted in the middle.
+PASS: Ellipsis is inserted after the second character.
+
+-- Running test case: String.prototype.truncateEnd
+PASS: String stays the same.
+PASS: Ellipsis is inserted in the middle.
+PASS: Ellipsis is inserted after the third character.
+