Open ghost opened 12 years ago
The default behaviour of Davis is to bind to all links and forms. If you had some links, or forms, on you page that you don't want Davis to bind to you can ignore them by changing the selector that Davis uses to find links etc.
Depending on your app you could either explicitly mark all the links you want Davis to bind to with a class or data attribute, or you could do so the other way round, explicitly marking all links you don't want Davis to bind to with a class or data attribute.
var app = Davis(function () {
// your routes etc here
this.configure(function () {
this.linkSelector = 'a:not(.external)' // if you want to explicitly mark external links
this.linkSelector = 'a[data-davis=true]' // if you want to explicitly mark davis links
})
})
This will make davis only listen to links that match those selectors, obviously you should choose whichever makes most sense for your app.
I have been working on allowing davis to be used without jQuery, this is currently not released but I can push the dev branch if you want to try it out. It should be possible to swap jQuery with Zepto with no changes required, if you want to use something different or no library at all then you will have to implement a few of the methods from jQuery or zepto that Davis relies on.
This was helpful. It would be nice to have it more front and center in the documentation. :+1:
Hi
I'm trying to be successful with Davis.js. Two things are not clear to me:
If I only write
Davis()
all links are being changed. E.g. when I click on one withhref="about.html"
, it goes no longer tohttp://example.org/app/about.html
, but instead happily goes tohttp://example.org/about.html
.