Add the querySelectorSafe() function and replace querySelector() usage (#7380)

* Initial commit

* Correct the over-estimation of my abilities

* Add fallback and move code to dom.js

* Use new function for tm-focus-selector

* Replace other uses of querySelector*

* Undo rash replacements of querySelector()
This commit is contained in:
yaisog
2023-05-06 12:54:54 +02:00
committed by GitHub
parent 6820d45bf0
commit e92e125697
5 changed files with 27 additions and 11 deletions

View File

@@ -119,8 +119,8 @@ ScrollableWidget.prototype.scrollIntoView = function(element,callback,options) {
};
ScrollableWidget.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
baseElement = baseElement || document.body;
var element = baseElement.querySelector(selector);
baseElement = baseElement || document;
var element = $tw.utils.querySelectorSafe(selector,baseElement);
if(element) {
this.scrollIntoView(element,callback,options);
}