kupriyanenko / jbone

JavaScript Library for Events and DOM manipulation. Replaces jQuery for Backbone (2.5kb gzipped)
http://jbone.js.org
MIT License
279 stars 35 forks source link

Request to extend jBone with add() method #37

Closed henryruhs closed 9 years ago

henryruhs commented 9 years ago

Hello,

it would be nice to have the add() method for object collections in the jBone core.

I looked into jQuery:

https://github.com/jquery/jquery/blob/10399ddcf8a239acc27bdec9231b996b178224d3/src/traversing.js#L112

add: function( selector, context ) {
    return this.pushStack(
        jQuery.unique(
            jQuery.merge( this.get(), jQuery( selector, context ) )
        )
    );
}

And rebuild it for jBone:

https://github.com/redaxmedia/jbone-extend/blob/master/add.js

jBone.fn.add = function(selector, context) {
    return jBone.merge(this, jBone(selector, context));
};

Let me know what you think. Consider to link my jbone-extend repo inside your Readme :-)

kupriyanenko commented 9 years ago

Hi @redaxmedia, yes, I think it can be very useful, I think I can add it today/tomorrow.

henryruhs commented 9 years ago

Your extend branch looks very promising, let me know if I can help you with beta testing.

Hint: Please add more inline documentation / comments to your codebase.

kupriyanenko commented 9 years ago

Implemented.

henryruhs commented 9 years ago

There is a typo dspan instead of span

kupriyanenko commented 9 years ago

it's div + span :)