Giter Site home page Giter Site logo

wkich / element-is-visible Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thefrontside/element-is-visible

0.0 0.0 0.0 214 KB

Robust algorithm for checking whether a DOM element is visible. Extracted from Selenium.

License: Apache License 2.0

TypeScript 100.00%

element-is-visible's Introduction

element-is-visible

Checks whether a DOM element is visible through various heuristics, such as checking CSS properties, sizing and overflow. The code is extracted from the Selenium project.

In comparison to other stand-alone libraries which perform this function, the alogrithm implemented by Selenium is much more comprehensive and checks more edge cases. It is still a best guess as to whether an element really is visible, for example an element with a very low opacity is counted as visible, even though it probably cannot be seen by an actual human.

Supports JSDOM by skipping the layout and sizing based checks.

Usage

import { isVisible } from 'element-is-visible';

let element = document.querySelector('#some-element');

isVisible(element) // => true

License

Apache2, see separate LICENSE and NOTICE files.

element-is-visible's People

Contributors

jnicklas avatar minkimcello avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.