inkling / backbone.native Goto Github PK
View Code? Open in Web Editor NEWA tiny drop-in replacement for jQuery to allow Backbone to work.
License: Other
A tiny drop-in replacement for jQuery to allow Backbone to work.
License: Other
Would be nice to be able to install it through bower. Would be awesome if you guys pulled it off!
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")
}
})
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.
So you can more exposure, users, testers and searchablity from backplug.io.
https://github.com/documentcloud/backbone/wiki/Extensions%2C-Plugins%2C-Resources
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.