Bug 471845 - Use .trim*() in SeaMonkey; (Bv1a) /suite/ part; r=neil
This commit is contained in:
Родитель
f0e1520e43
Коммит
c1ed4a1ab0
|
@ -1462,10 +1462,8 @@ function loadURI(uri, referrer, flags)
|
|||
|
||||
function BrowserLoadURL(aTriggeringEvent)
|
||||
{
|
||||
var url = gURLBar.value;
|
||||
|
||||
// Remove leading and trailing spaces first
|
||||
url = url.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
var url = gURLBar.value.trim();
|
||||
|
||||
if (url.match(/^view-source:/)) {
|
||||
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null, null);
|
||||
|
|
|
@ -1147,15 +1147,10 @@ function getAltText(node)
|
|||
return "";
|
||||
}
|
||||
|
||||
// Copied from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
|
||||
// strip leading and trailing whitespace, and replace multiple consecutive whitespace characters with a single space
|
||||
function stripWS(text)
|
||||
{
|
||||
var middleRE = /\s+/g;
|
||||
var endRE = /(^\s+)|(\s+$)/g;
|
||||
|
||||
text = text.replace(middleRE, " ");
|
||||
return text.replace(endRE, "");
|
||||
return text.trim().replace(/\s+/g, " ");
|
||||
}
|
||||
|
||||
function setItemValue(id, value)
|
||||
|
|
|
@ -443,10 +443,7 @@ function getOuterMarkup(node, indent) {
|
|||
}
|
||||
break;
|
||||
case Node.TEXT_NODE: // Text
|
||||
var tmp = node.nodeValue;
|
||||
tmp = tmp.replace(/(\n|\r|\t)+/g, " ");
|
||||
tmp = tmp.replace(/^ +/, "");
|
||||
tmp = tmp.replace(/ +$/, "");
|
||||
var tmp = node.nodeValue.replace(/(\n|\r|\t)+/g, " ").trim();
|
||||
if (tmp.length != 0) {
|
||||
str += '<span class="text">' + unicodeTOentity(tmp) + '</span>';
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
function addToUrlbarHistory(aUrlToAdd)
|
||||
{
|
||||
// Remove leading and trailing spaces first
|
||||
aUrlToAdd = aUrlToAdd.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
aUrlToAdd = aUrlToAdd.trim();
|
||||
|
||||
if (!aUrlToAdd)
|
||||
return;
|
||||
|
|
|
@ -151,8 +151,7 @@ function handleHostInput(aSiteField) {
|
|||
function trimSpacesAndScheme(aString) {
|
||||
if (!aString)
|
||||
return "";
|
||||
return aString.replace(/(^\s+)|(\s+$)/g, "")
|
||||
.replace(/([-\w]*:\/+)?/, "");
|
||||
return aString.trim().replace(/([-\w]*:\/+)?/, "");
|
||||
}
|
||||
|
||||
function btnDisable(aDisabled) {
|
||||
|
|
|
@ -76,9 +76,7 @@ function sidebar_customize_init()
|
|||
debug("Adding observer to all panels database.");
|
||||
all_panels.database.AddObserver(panels_observer);
|
||||
|
||||
allPanelsObj.datasources = allPanelsObj.datasources.replace(/^\s+/,'');
|
||||
allPanelsObj.datasources = allPanelsObj.datasources.replace(/\s+$/,'');
|
||||
allPanelsObj.datasources = allPanelsObj.datasources.split(/\s+/);
|
||||
allPanelsObj.datasources = allPanelsObj.datasources.trim().split(/\s+/);
|
||||
for (var ii = 0; ii < allPanelsObj.datasources.length; ii++) {
|
||||
debug("Init: Adding "+allPanelsObj.datasources[ii]);
|
||||
|
||||
|
|
|
@ -1280,8 +1280,7 @@ function SidebarTogglePanel(panel_menuitem) {
|
|||
if (sb_panel_is_excluded(panel_menuitem)) {
|
||||
debug("Plucking this component out of the exclude list");
|
||||
replace_pat = new RegExp(sidebarObj.component + "\s*");
|
||||
new_exclude = new_exclude.replace(replace_pat,'');
|
||||
new_exclude = new_exclude.replace(/^\s+/,'');
|
||||
new_exclude = new_exclude.replace(replace_pat, "").trimLeft();
|
||||
// did_exclude remains false
|
||||
} else {
|
||||
debug("Adding this component to the exclude list");
|
||||
|
|
Загрузка…
Ссылка в новой задаче