File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 * along with this program. If not, see <https://www.gnu.org/licenses/>.
1616 */
1717
18+ import { log } from '../core/log.js' ;
1819import { computeZoomScale , isPointInAnyRect } from './document-util.js' ;
1920import { DOMTextScanner } from './dom-text-scanner.js' ;
2021import { TextSourceElement } from './text-source-element.js' ;
@@ -335,14 +336,19 @@ export class TextSourceGenerator {
335336 * @returns {Element[] }
336337 */
337338 _getElementsFromPoint ( x , y , all ) {
338- if ( all ) {
339- // document.elementsFromPoint can return duplicates which must be removed.
340- const elements = document . elementsFromPoint ( x , y ) ;
341- return elements . filter ( ( e , i ) => elements . indexOf ( e ) === i ) ;
342- }
339+ try {
340+ if ( all ) {
341+ // document.elementsFromPoint can return duplicates which must be removed.
342+ const elements = document . elementsFromPoint ( x , y ) ;
343+ return elements . filter ( ( e , i ) => elements . indexOf ( e ) === i ) ;
344+ }
343345
344- const e = document . elementFromPoint ( x , y ) ;
345- return e !== null ? [ e ] : [ ] ;
346+ const e = document . elementFromPoint ( x , y ) ;
347+ return e !== null ? [ e ] : [ ] ;
348+ } catch ( e ) {
349+ log . logGenericError ( e , 'log' ) ;
350+ return [ ] ;
351+ }
346352 }
347353
348354 /**
You can’t perform that action at this time.
0 commit comments