1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

Undo mistakenly committed changes to the element picker

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2360
This commit is contained in:
Raymond Hill 2022-11-13 11:07:41 -05:00
parent 502fcee546
commit 4a01affa0e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -113,16 +113,6 @@ const getElementBoundingClientRect = function(elem) {
/******************************************************************************/
const elementsFromPoint = function(parent, x, y) {
const elems = parent.elementsFromPoint(x, y);
if ( elems.length !== 0 && elems[0].shadowRoot !== null ) {
return elementsFromPoint(elems[0].shadowRoot, x, y);
}
return elems;
};
/******************************************************************************/
const highlightElements = function(elems, force) {
// To make mouse move handler more efficient
if (
@ -564,11 +554,11 @@ const filtersFrom = function(x, y) {
// Network filter candidates from all other elements found at [x,y].
// https://www.reddit.com/r/uBlockOrigin/comments/qmjk36/
// Extract network candidates first.
const magicAttr = `${vAPI.sessionId}-clickblind`;
pickerRoot.setAttribute(magicAttr, '');
const elems = elementsFromPoint(document, x, y);
pickerRoot.removeAttribute(magicAttr);
if ( typeof x === 'number' ) {
const magicAttr = `${vAPI.sessionId}-clickblind`;
pickerRoot.setAttribute(magicAttr, '');
const elems = document.elementsFromPoint(x, y);
pickerRoot.removeAttribute(magicAttr);
for ( const elem of elems ) {
netFilterFromElement(elem);
}
@ -580,14 +570,11 @@ const filtersFrom = function(x, y) {
// https://github.com/gorhill/uBlock/issues/2519
// https://github.com/uBlockOrigin/uBlock-issues/issues/17
// Prepend `body` if full selector is ambiguous.
for ( const elem of elems ) {
let elem = first;
while ( elem && elem !== document.body ) {
cosmeticFilterFromElement(elem);
elem = elem.parentNode;
}
//let elem = first;
//while ( elem && elem !== document.body ) {
// cosmeticFilterFromElement(elem);
// elem = elem.parentNode;
//}
// The body tag is needed as anchor only when the immediate child
// uses `nth-of-type`.
let i = cosmeticFilterCandidates.length;