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 directly passing in HTMLElement to default ui element option #330

Closed
stefanprobst opened this issue Jun 26, 2023 · 1 comment · Fixed by #331
Closed

allow directly passing in HTMLElement to default ui element option #330

stefanprobst opened this issue Jun 26, 2023 · 1 comment · Fixed by #331

Comments

@stefanprobst
Copy link
Contributor

currently, the default pagefind ui expects a query selector string as options.element, see https://github.com/CloudCannon/pagefind/blob/main/pagefind_ui/default/ui-core.js#L40

it would be nice if it were possible to directly pass in a reference to an html element as well, i.e.:

- const dom = document.querySelector(selector);
+ const dom = selector instanceof HTMLElement ? selector : document.querySelector(selector);

would you accept a pr for this?

@bglw
Copy link
Contributor

bglw commented Jun 26, 2023

I would certainly accept a PR for this 🙂

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