How to use query-selector-shadow-dom - 3 common examples

To help you get started, we’ve selected a few query-selector-shadow-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChromeLabs / ProjectVisBug / app / features / search.js View on Github external
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) {}
}
github GoogleChromeLabs / ProjectVisBug / app / features / search.js View on Github external
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) {}
}
github mkay581 / router-component / src / router-component.ts View on Github external
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' });
        }
    }

query-selector-shadow-dom

use querySelector syntax to search for nodes inside of (nested) shadow roots

MIT
Latest version published 1 year ago

Package Health Score

73 / 100
Full package analysis