choojs / choojs/choo

Can I pass a rootNode to `nanohref`?

Open
#704 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6.8k
Forks
573
PR merge metrics
No merged PRs in 30d

Description

I am trying to mount a choo application in an "application shell" that is provided by a static site generator.

I would expect the routing behavior to be limited to the scope of choo's application host, yet `nanohref` will try to handle all anchors being clicked.

Looking at the `nanohref` docs, this behavior seems to be supported by passing a second `rootNode` argument to the `nanohref` function: https://github.com/choojs/nanohref#nanohrefhandlerlocation-rootnode

Looking at how choo itself is using `nanohref` it looks like passing a second argument is not intended: https://github.com/choojs/nanohref#nanohrefhandlerlocation-rootnode

This leads me to two questions:

1. Is it possible to achieve this behavior in some other way?
2. In case no, would you accept a PR that enables passing the application root to `nanohref` as well? In this case I have to admit I am slightly unsure how the API for this could even look like considering how there is basically zero surface area for options in choo.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.