Coffeekraken.io 0.0.1

querySelector

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

Name Type Description Status Default
selector { String } The css selector to search required
settings { Object } required

Return { HTMLElement } The founded element

Example

    // 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
});

Author : Olivier Bossel olivier.bossel@gmail.com

Settings

Here's the list of available settings.

visible

If we want only a visible element

Type : { Boolean }

Default : false

inViewport

If we want only an element that is in the viewport

Type : { Boolean }

Default : false

rootNode

The root node to start the query from

Type : { HTMLElement }

Default : document.body