Giter Club home page Giter Club logo

Comments (2)

olivernn avatar olivernn commented on June 2, 2024

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.

from davis.js.

arxpoetica avatar arxpoetica commented on June 2, 2024

This was helpful. It would be nice to have it more front and center in the documentation. 👍

from davis.js.

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.