Search result tabs didn't become children of the current tab if the selection include white spaces before/after the search term.

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-08-30 00:39:17 +09:00
parent 24fc712975
commit ec294ee820

View File

@ -225,6 +225,8 @@ TreeStyleTabWindow.prototype = {
shouldOpenSearchResultAsChild : function TSTWindow_shouldOpenSearchResultAsChild(aTerm)
{
aTerm = aTerm.replace(/^\s+|\s+$/g, '');
var mode = this.getTreePref('autoAttach.searchResult');
if (mode == this.kSEARCH_RESULT_ATTACH_ALWAYS) {
return true;
@ -241,7 +243,7 @@ TreeStyleTabWindow.prototype = {
if (!aWindow || !(aWindow instanceof Ci.nsIDOMWindow))
return false;
var selection = aWindow.getSelection();
if (selection && selection.toString() == aTerm)
if (selection && selection.toString().replace(/^\s+|\s+$/g, '') == aTerm)
return true;
return aWindow.frames ? Array.slice(aWindow.frames).some(arguments.callee) : false ;
})(w);