mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 21:33:43 +00:00
Bug 876277 - Clicking on global search results lines (not matches) was broken after 877686, fix it, r=past
This commit is contained in:
parent
98672acb0f
commit
ed64894f92
@ -2131,7 +2131,7 @@ LineResults.prototype.__iterator__ = function() {
|
||||
*/
|
||||
SourceResults.getItemForElement =
|
||||
LineResults.getItemForElement = function(aElement) {
|
||||
return WidgetMethods.getItemForElement.call(this, aElement);
|
||||
return WidgetMethods.getItemForElement.call(this, aElement, { noSiblings: true });
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1237,15 +1237,23 @@ this.WidgetMethods = {
|
||||
*
|
||||
* @param nsIDOMNode aElement
|
||||
* The element used to identify the item.
|
||||
* @param object aFlags [optional]
|
||||
* Additional options for showing the source. Supported options:
|
||||
* - noSiblings: if siblings shouldn't be taken into consideration
|
||||
* when searching for the associated item.
|
||||
* @return Item
|
||||
* The matched item, or null if nothing is found.
|
||||
*/
|
||||
getItemForElement: function(aElement) {
|
||||
getItemForElement: function(aElement, aFlags = {}) {
|
||||
while (aElement) {
|
||||
let item =
|
||||
this._itemsByElement.get(aElement) ||
|
||||
this._itemsByElement.get(aElement.nextElementSibling) ||
|
||||
this._itemsByElement.get(aElement.previousElementSibling);
|
||||
let item = this._itemsByElement.get(aElement);
|
||||
|
||||
// Also search the siblings if allowed.
|
||||
if (!aFlags.noSiblings) {
|
||||
item = item ||
|
||||
this._itemsByElement.get(aElement.nextElementSibling) ||
|
||||
this._itemsByElement.get(aElement.previousElementSibling);
|
||||
}
|
||||
if (item) {
|
||||
return item;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user