Git Product home page Git Product logo

backbone.native's People

Contributors

dstokes avatar etlovett avatar loganfsmyth avatar playfrisb avatar terence1990 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backbone.native's Issues

delegateEvents not working

I'm trying to use delegateEvents, but it seems not to work for me, not sure if it's related to backbone.native.
This is working using native js (see commented code). Any ideas ?

Here is a part of the (simplified) view I'm working on (using browserify)

var Backbone = require("backbone")
Backbone.$ = require("backbone.native")

var dom = require("../../dom") // homemade helper

module.exports = Backbone.View.extend({
 , events: {
     "scroll .js-ss-PageContent": "checkScroll"
   }

, initialize: function() {
    this.el.innerHTML = (require("./index.jade"))()

    // i've to use that since `events` doesn't work :(
    //this.elScroll = dom.$(".js-ss-PageContent", this.el)[0]
    //this.elScroll.addEventListener("scroll", this.checkScroll.bind(this), false)
  }

, checkScroll: function() {
    console.log("interesting scroll spotted")
  }
})

possible extended prototype

We love backbone.native.

I realize of course that it "is not a drop-in replacement for all of jQuery", though we believe there is room for some basic jQuery functionality.

For our purposes, we use backbone.native and extend it with some simply written, true jQuery functions that cover 90% of our html element rendering / manipulation requirements. The following functions are 300 lines unminified:

find, each, children, first, last, append, attr, removeAttr, show, hide, hasClass, addClass, removeClass, toggleClass, css, text, val, data, get, post, getJSON, getScript

Of course we appreciate the README jQuery Collection behavior comment, though our find function above appears to provide the correct native Backbone functionality of this.$.

If this resonates with you, I will create a pull request. An alternative is a backbone.native.extended lib, though its nice to keep all wrapped in a single file.

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.