Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a node instead of a selector #134

Open
JacobDB opened this issue Jul 15, 2022 · 0 comments
Open

Allow passing a node instead of a selector #134

JacobDB opened this issue Jul 15, 2022 · 0 comments

Comments

@JacobDB
Copy link

JacobDB commented Jul 15, 2022

I've come across some situations where I don't know how many sets of tab will be on a page, and so have to loop over all instances of [data-tabs] to initialize a Tabby for it. I've achieved this with..

const ELEMENTS = document.querySelectorAll("[data-tabs]");

if (ELEMENTS.length > 0) {
   ELEMENTS.forEach((element) => {
       new Tabby(`#${element.getAttribute("id")}`);
   });
}

but that seems somewhat fragile and also confusing to read. Being able to directly pass element in this case would really simplify things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant