Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (PluginRegistry.has(query))
return PluginRegistry.get(query)({
selected: SelectorEngine.selection(),
query
})
if (query == 'links') query = 'a'
if (query == 'buttons') query = 'button'
if (query == 'images') query = 'img'
if (query == 'text') query = 'p,caption,a,h1,h2,h3,h4,h5,h6,small,date,time,li,dt,dd'
if (!query) return SelectorEngine.unselect_all()
if (query == '.' || query == '#' || query.trim().endsWith(',')) return
try {
let matches = querySelectorAllDeep(query + notList)
if (!matches.length) matches = querySelectorAllDeep(query)
if (matches.length) {
matches.forEach(el =>
fn
? fn(el)
: SelectorEngine.select(el))
}
}
catch (err) {}
}
return PluginRegistry.get(query)({
selected: SelectorEngine.selection(),
query
})
if (query == 'links') query = 'a'
if (query == 'buttons') query = 'button'
if (query == 'images') query = 'img'
if (query == 'text') query = 'p,caption,a,h1,h2,h3,h4,h5,h6,small,date,time,li,dt,dd'
if (!query) return SelectorEngine.unselect_all()
if (query == '.' || query == '#' || query.trim().endsWith(',')) return
try {
let matches = querySelectorAllDeep(query + notList)
if (!matches.length) matches = querySelectorAllDeep(query)
if (matches.length) {
matches.forEach(el =>
fn
? fn(el)
: SelectorEngine.select(el))
}
}
catch (err) {}
}
private scrollToHash(hash: string = this.location.hash): void {
const behaviorAttribute = this.getAttribute('hash-scroll-behavior') as ScrollBehavior;
const hashId = hash.replace('#', '');
const hashElement = querySelectorDeep(`[id=${hashId}]`, this.shownPage) as HTMLElement;
if (hashElement) {
hashElement.scrollIntoView({ behavior: behaviorAttribute || 'auto' });
}
}