shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
querySelector
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.dom.query
Enhanced proxy of the Element.querySelector function that let you specify if you want an element that is visible, or even that is in the viewport
Params
- selector*-String
The css selector to search
- settings*-Object
The settings of the query
Return
- -HTMLElement
The founded element
Example
import { querySelector } from '@blackbyte/sugar/dom';
// simple query
const elm = querySelector('.a-cool-css-selector');
// get an element that is in the viewport
const elm = querySelector('.a-cool-css-selector', {
inViewport : true
});Settings
- visible-Boolean
Specify if you want only the visible nodes
- inViewport-Boolean
Specify if you want only the nodes that are in the viewport
- $rootNodedocument.bodyHTMLElement
Specify the root node from where you want to query
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space