Giter VIP home page Giter VIP logo

chibi's People

Contributors

bitbonsai avatar kylebarrow avatar ljmerza avatar tjk avatar yohn 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

chibi's Issues

Idiomatic way to find out whether a checkbox is checked?

I'm having trouble using Chibi to determine whether a checkbox is checked.

<input type="checkbox" id="mycb">

I tried the following:

$('#mycb').checked //==undefined
$('#mycb').val() //=="on" if checkbox is ON or "null" if it is off
$('#mycb').attr('checked') //==null

I'm not sure if I should depend on the .val() returning on in all browsers.

On further inspection, I noticed that $('#mycb') returns an array instead of just a single checkbox (this is in Chrome 44 on Linux). Thus, I can use $('#mycb')[0].checked but again this seems to contradict the Chibi docs.

So, whats the idiomatic way to do this in Chibi? I have currently by-passed Chibi and am directly doing document.getElementById('mycb').checked for this particular case, but I'd prefer to use Chibi if there is a way.

Chibi as implied global

Hi! I just meet chibi and I want to use it in a project. But how use it as an implied global in a more OO approach? I tried this:

(function ($) {
    // ...
}(chibi));

But without success... Can you help me with that?

Regards!

Event Delegation support

It would be nice if Chibi has Event Delegation support - maybe as the 2nd argument of .on(), like many of popular solutions out there. So code like this would be possible:

$('ul').on('click', 'li', foo);

Please publish to npm

Would be great if we can have this published to npm, so can just have this with npm install. And processed with browserify or webpack.

Cross Domain Ajax?

I couldn't figure out a way to do cross-domain AJAX via JSONP using the provided AJAX method. Is it possible? If not, I'd love to see this supported; I'd then have absolutely no need for jQuery.

Nodes variable is shared across all invocations of $()

Any invocation of $('selector') resets the nodes value. That can lead to very unexpected behavior.
Consider this scenario:

<p class="foo">footext</p>
<p class="bar">bartext</p>
var foo = $('.foo');
var bar = $('.bar');

console.log(foo.html());

bartext will be logged instead of the expected footext.

I would suggest not scoping nodes at the library level.

How do you select children with chibli?

Sorry if this is easy but is there a trick to searching all the children of an element?

Was trying:

$('#dropdown-main .dropdown').toggle();
$('#dropdown-main > .dropdown').toggle();
$('#dropdown-main > ul > li .dropdown').toggle();
$('#dropdown-main > ul > li > .dropdown').toggle();
$($('#dropdown-cart').find('.dropdown')).toggle();

.dropdown is not a direct descendant of #dropdown-main - any pointers in the right direction would be much appreciated.

Cheers

How about event handling?

I like the idea of keeping it as small as possible, but by adding just a bit more code you can have a killer-feature.
Only thing I really hate doing in vanilla-javascript is cross-browser events and triggering them from code.
I guess it could be implemented in less than 1KB of minified code.

htmlAppend appends in reverse order?

That seems bit strange to me and I do not understand fully what happens there (I'm a javascript noob) but the effect is quite opposite to what I expect.

var data = self.model.getAll();
var template = new t(document.getElementById("nowplaying-data-t").innerHTML);
var html = template.render({data: data});
$("#nowplaying-info").htmlAppend(html);

I have some text rendered from template that contains 2 lines of text. Trying to debug in Chrome I see the order in html is right, but the result after htmlAppend is reversed. Everything is fine if I add this text using html.

General Questions

What do you mean "pointless"?
https://github.com/kylebarrow/chibi#a-dom-element-selector-pointless

Does chibi simplify cross-browser differences?

This article complains that jquery and vanilla js can't mix, cuz jq is all or nothing-- eg, doesn't return a nodelist. How about chibi?
"By returning a jQuery object rather than a NodeList, built-in browser methods are essentially off limits, meaning you’re locked into the jQuery way of doing everything."
https://css-tricks.com/now-ever-might-not-need-jquery/#article-header-id-15

thx!

$().find use a function as filter

hi Kyle

There's any possibility find use a function as parameter using to filter nodes?
Something like this:

var foundElements = $("div").find( function(node) { 
// do something awesome here....
});

Multiple forms using ajax on one page failing to get input data

When there are multiple forms on a page, the ajax function seems unable to obtain input values for all forms except the last one in the html flow. The actually ajax submission is made but without any data. Only the form that sits last in the html file is submitted with data.

I have tried various combinations using ajax(), post(), get() and the results are the same.

The forms themselves work just fine when I use a vanilla js ajax for each one, but fail using chibi's ajax functions.

this isn't this on IE8..

http://jsfiddle.net/BySE9/

Works as expected on chrome etc.. returns undefined on IE..

Turns out this is the window on IE whereas it is what it's meant to be on Chrome. Unfortunately my JS knowledge isn't too great so please can you take a look? I love Chibi's smallness but this is a bit of a showstopper for me :(

Cheers,
John.

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.