Use String#trim() instead of String#replace()
This commit is contained in:
parent
a112fffe09
commit
482bab417b
@ -111,7 +111,7 @@ var TreeStyleTabBookmarksServiceEditable = {
|
||||
' value=""/>' +
|
||||
' </menupopup>' +
|
||||
' </menulist>' +
|
||||
'</row>').replace(/^\s*|\s*$/g, '').replace(/>\s+</g, '><')));
|
||||
'</row>').trim().replace(/>\s+</g, '><')));
|
||||
range.detach();
|
||||
document.getElementById('treestyletab-parent-label').setAttribute('value', TreeStyleTabUtils.treeBundle.getString('bookmarkProperty.parent.label'));
|
||||
this.blankItem.setAttribute('label', TreeStyleTabUtils.treeBundle.getString('bookmarkProperty.parent.blank.label'));
|
||||
|
@ -312,7 +312,7 @@ var TreeStyleTabWindowHelper = {
|
||||
return aString
|
||||
.replace(/\/\*.*\*\//g, '')
|
||||
.replace(/\/\/.+$/, '')
|
||||
.replace(/^\s+|\s+$/g, '');
|
||||
.trim();
|
||||
});
|
||||
},
|
||||
_getFunctionSource : function TSTWH__getFunctionSource(aFunc)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* The Original Code is the Tree Style Tab.
|
||||
*
|
||||
* The Initial Developer of the Original Code is YUKI "Piro" Hiroshi.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011-2013
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011-2014
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): YUKI "Piro" Hiroshi <piro.outsider.reflex@gmail.com>
|
||||
@ -457,7 +457,7 @@ FullTooltipManager.prototype = {
|
||||
for (let i = 0, maxi = aExtraLabels.length; i < maxi; i++)
|
||||
{
|
||||
let label = aExtraLabels[i];
|
||||
label = label.replace(/^\s+|\s+$/g, '');
|
||||
label = label.trim();
|
||||
if (!label)
|
||||
continue;
|
||||
root.appendChild(this.document.createElement('description'))
|
||||
|
@ -1261,7 +1261,7 @@ catch(e) {
|
||||
case 'text/unicode':
|
||||
case 'text/plain':
|
||||
case 'text/x-moz-text-internal':
|
||||
return [aData.replace(/^\s+|\s+$/g, '')];
|
||||
return [aData.trim()];
|
||||
|
||||
case 'text/x-moz-url':
|
||||
return [((aData instanceof Ci.nsISupportsString) ? aData.toString() : aData)
|
||||
|
@ -269,7 +269,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
shouldOpenSearchResultAsChild : function TSTWindow_shouldOpenSearchResultAsChild(aTerm)
|
||||
{
|
||||
aTerm = aTerm.replace(/^\s+|\s+$/g, '');
|
||||
aTerm = aTerm.trim();
|
||||
|
||||
var mode = utils.getTreePref('autoAttach.searchResult');
|
||||
if (mode == this.kSEARCH_RESULT_ATTACH_ALWAYS) {
|
||||
@ -280,7 +280,7 @@ TreeStyleTabWindow.prototype = {
|
||||
}
|
||||
|
||||
var selection = this.window.getBrowserSelection();
|
||||
return selection.replace(/^\s+|\s+$/g, '') == aTerm;
|
||||
return selection.trim() == aTerm;
|
||||
},
|
||||
kSEARCH_RESULT_DO_NOT_ATTACH : 0,
|
||||
kSEARCH_RESULT_ATTACH_IF_SELECTED : 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user