kylebarrow / chibi Goto Github PK
View Code? Open in Web Editor NEWA tiny JavaScript micro-library
A tiny JavaScript micro-library
This does not look like a framework (library perhaps?)
Please see:
http://stackoverflow.com/q/3057526/1348195
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.
Hi,
Would it possible if AjaxStart and AjaxComplete be incorporated in ChibiJS?
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);
Are there any plans to provide a .d.ts
file so that chibi can be used from Typescript?
Is it possible to request/save data to an element?
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
.
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!
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.
Hi :)
How do I do $(document).width()
as known in jQuery with chibi?
Thanks
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.
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.
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.
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....
});
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.
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
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!
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.
I tried but failed to build your library version in Prototype way. Can you tell me why it does not work in this way & why it does not return nodes as array to be used with Native JavaScript methods like forEach, slice. thanks
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.