querySelectorAll

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.query

Enhanced proxy of the Element.querySelectorAll function that let you specify if you want elements that are visible, or even that are in the viewport

Params

  1. selector*-String

    The css selector to search

  2. settings*-Object

    The settings of the query

Return

  1. -Array}<HTMLElement>

    The founded elements

Example

import { querySelectorAll } from '@blackbyte/sugar/dom';
// simple query
const elms = querySelectorAll('.a-cool-css-selector');

// get elements that are in the viewport
const elms = querySelectorAll('.a-cool-css-selector', {
  inViewport : true
});

Settings

  1. visible-Boolean

    Specify if you want only the visible nodes

  2. inViewport-Boolean

    Specify if you want only the nodes that are in the viewport

  3. $rootNodedocument.bodyHTMLElement

    Specify the root node from where you want to query

Todo

  • testsnormal