Giter Club home page Giter Club logo

Comments (5)

vvo avatar vvo commented on May 28, 2024 17

Ultimately I would not even accept string based selectors. For such a low level library, no magic is fine. Accept only Node or Node Lists :)

from in-view.

camwiegert avatar camwiegert commented on May 28, 2024 3

@vvo @bertez I agree, it would be nice to just pass a Node or NodeList.

One nice thing about using string selectors is that we can use it as a key to keep track of registered handlers for that selector.

inView('.selector').on('enter', el =>
    el.classList.add('in-view'));

inView('.selector') // returns the same registry as above

If we add the ability to use Node & NodeList, it will be up to the user to maintain a reference to that registry.

const registry = inView(document.querySelectorAll('.selector'));

Admittedly, that's not the worst thing. It wouldn't break any existing functionality.

from in-view.

pihvi avatar pihvi commented on May 28, 2024

Thanks for this great library!

I'd also like to see an option to pass an Array of nodes as I'm using jQuery and it returns an Array of nodes, not NodeList. This would make jQuery interop much simpler.

from in-view.

 avatar commented on May 28, 2024

+1

from in-view.

WhereJuly avatar WhereJuly commented on May 28, 2024

I vote for only one DOM node to pass as @vvo mentioned. The utility size should be kept at the minimum.

from in-view.

Related Issues (20)

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.