22 ms·
JZed.js – The functional JQuery alternative
- arkitaip 13y agoI'm really liking the idea of having lots of new $ instead of chaining/burying things like jQuery does. Most of the functions are bareboned but as a concept it looks interesting.
- agumonkey 13y agoWhile he's at it with the Zed-ing he could have made a z. module or even prefixed all functions with 'z'+CamelCase. '$' is cute as a root wrapper for chains but $map($filter($each.. $siblings, $http(..))) gets heavy quick IMO.
- deckiedan 13y agoThe reason jQuery (and _.js, and others) do this is so that you minimize the number of global variables/functions used.
- rtpg 13y agoI love method chaining though, not having it is a huge drawback for me.
- joiguru 13y agoHow cross browser is this thing? Does it at least support all the browsers versions as JQuery v2?
- damon_c 13y agoThis also only really works on IE9 and maybe IE8 or better, but honstly IE6 and IE7 users users can seriously go fuck themselves with a dirty brick. I may add a function to detect these two bad browser so people can start forcing them to use a real browser for a change.
- prayerslayer 13y agoThere are parts that will not work in IE 8 (doesn't support addEventListener) or even IE 9 (doesn't support classList).
- TheRubyist 13y agoZed is dead.
- jbeja 13y agoAs your comment.
- ryanackley 13y agoIf this interests you, check out http://zeptojs.com/ http://zeptojs.com/. Seems like the same concept.
- binarymax 13y agoZepto really aims to match the jQuery style and the majority of methods while trimming the fat and sacrificing browser compat, and weighs in at 9.2k min gzipped. I'd say the only thing this has in common with jQuery is the use of the $. Most of the methods here can be found in many homegrown toolboxes. There is no chaining and no relationship to any of the methods here.
- ryanackley 13y agoI guess the semantics really matter to some people but a few direct quotes from the Readme JZed is my alternative to JQuery This is a tiny amount of code that has enough of the functionality found in JQuery then I filled it out with more based on the list at http://youmightnotneedjquery.com/ http://youmightnotneedjquery.com/. The semantics are different but the functionality is completely based on jquery.
- dsego 13y agoZepto is nice, but if you want something like jquery, just use jquery. Jquery is already small enough and battle-tested. I tried using zepto a year ago, and some DOM methods were 10-100x slower, which isn't worth the reduction in size.
- binarymax 13y agoI'm a fan of min.js[0], as it is closer in spirit to jQuery. Looks like the major addition this has is the XHR. Not sure how I feel about the individual $method style, but it looks like you covered almost anything one would need! [0] https://github.com/remy/min.js https://github.com/remy/min.js
- adito 13y agoThis gives me an idea of reimplementing jQuery as part of learning javascript.
- fiatjaf 13y agoDon't do that, do something no one has ever done.
- bluepill 13y agoAlways nice stuff, it would be cool if Zed would publish this on npm or Bower.
- gexla 13y ago> The library is tiny. Seriously, just go read the code. It's good education Thanks, Zed! I really appreciate what you have done for helping in education in other programming languages. Reading a small library which does much the same as Jquery is a great addition to your materials. I may not use this as a Jquery replacement, but I will certainly be looking through the code to see what I can learn from it. I spend far too little time in the front-end and it's time to change that. Edit: Edit: Okay, you guys didn't like my joke. So I removed the joke and expanded on the first part of my comment.
- grexi 13y agoI like the idea, but the tone of the docs is a little too rough for me (although I don't consider myself a functional snob). http://www.snapbugz.com/p/98f1d5a6 http://www.snapbugz.com/p/98f1d5a6
- the-kenny 13y agoWhat makes this library functional?
- jbeja 13y agoDon't like to much the name, is so "egoista", but i love the functional approach :).
- gdw2 13y agoIn the Readme he says he picked that name to annoy people!
- bct 13y agoAnnoying people is easy, I don't know why he would go out of his way to do it. It's certainly not something to be proud of.
- gdw2 13y agoIn the Readme he says he picked that name to annoy people!
- gdw2 13y agoIn the Readme he says he picked that name to annoy people!
- jiggy2011 13y agoThis is a wrapper around the DOM API, nothing like jquery at all.
- coldtea 13y agoYou know that jQuery is primarily a "wrapper around the DOM API", right?
- jiggy2011 13y agoNot exactly, jquery offers it's own API which is what makes it powerful and allows for it's method chaining, plugin system etc. A $(".className") returns a jquery object , not a DOM element.
- coldtea 13y ago>Not exactly, jquery offers it's own API Yes, that's the definition of a wrapper: it offers it's own API.
- jiggy2011 13y agojquery is really it's own abstraction, the jquery API allows you to interact with jquery objects which can do DOM manipulation on your behalf. This library literally returns DOM objects.
- esailija 13y agojQuery API is nothing like the DOM API. This library is a list of functions that are nothing but proxies for some other functions which you might as well call directly. Given that the author has written this http://zedshaw.com/essays/indirection_is_not_abstraction.html http://zedshaw.com/essays/indirection_is_not_abstraction.htm... I am sure this is some kind of joke...
- coldtea 13y ago>jQuery API is nothing like the DOM API. That's the whole point of making a wrapper around an API. That it doesn't look like the API you're wrapping.
- gaius 13y agoJay-Z will be along for trademark infringement in 5... 4... Same as Coinye West!
- asattarmd 13y agoI see nothing that makes this library "functional".
- bdfh42 13y agofunction $new(tag, id, html) looks like it has a bug. next line should read var new_tag = document.createElement(tag); not var new_tag = document.createElement("div"); unless I am missing something
- maaaats 13y ago>> I'm doing a bunch of work with CORS and requiring target sites to use jquery is insane when I just need a few little things. Why would target sites need to have jquery?
- deleted 13y ago[deleted]
- fiatjaf 13y agoI don't understand this also. Isn't CORS a server thing? I have used CORS, but still don't understand this.
- sdegutis 13y ago> This also only really works on IE9 and maybe IE8 or better, but honstly IE6 and IE7 users users can seriously go fuck themselves with a dirty brick. This kind of language doesn't belong in a software project, let alone its README, and is very likely one of the reasons software professionals are often not treated like professionals.
- agumonkey 13y agoYeah, a little too rock n roll here. Also, I don't think there's such a thing as a IE6/7 user (in the sense of mass of visitors to support for a website to thrive), only people forced to use it by heavy constraints. ps-edit: I mean, Zed Shaw knows about enterprises locked into IT contracts etc etc, so his comment was free noise. I guess that's just how he likes to speak and joke.
- sdegutis 13y agoHonestly, I'm starting to think IE6 is just an urban legend. I mean, has anyone ever actually seen it?
- deleted 13y ago[deleted]
- agumonkey 13y agoI don't know but we shouldn't write its name too often I don't want to summon evil spirits. ps: this made me google a bit for %, seems like 6 and 7 summed are around 7%.
- leoc 13y agoChina. http://www.modern.ie/ie6countdown http://www.modern.ie/ie6countdown
- rubiquity 13y agoYou're kidding right? You must live in the Bay Area. There exists these other continents named South America, Africa and Asia. I know I sound crazy right now but people in those mythical lands I just mentioned don't have the latest and greatest computers, or anything remotely close. Try closing your eyes for a minute and imagine a land without latte art, Apple products and toques. It'll blow your mind.
- agilebyte 13y agoWould be nice to detect CommonJS environment and not export to the global scope.
- Kiro 13y agoI don't understand the talk about CORS. In what way does this library help CORS stuff and what situations is he referring to exactly?
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]
- EGreg 13y agoPull requests like this show it's rather immature so far: Fixed $next() and $previous() not returning anything - 2 hrs ago
- bachback 13y agocool, this guy is doing some good work. see also mongrel2, a language agnostic webserver https://github.com/zedshaw/mongrel2 https://github.com/zedshaw/mongrel2
- benihana 13y ago>It's also functional so now LISP hackers can pretend they're both JavaScript Oakland Living Node.js gangsters and high class San Franciscans with their functionality snobbery. Oh Zed. Don't ever change, our industry needs people like you.
- deleted 13y ago[deleted]
- grannyg00se 13y agoI'm guessing zed was bored - or just felt like trolling? The library isn't "functional", does very little of use, and horribly pollutes the global name space. Maybe he just felt like venting about jQuery overuse and snobby programmers.
- amasad 13y agoSo how is it "more functional"?
- j_m_b 13y agoThanks! But I've long ago replaced my js with clojurescript.
- zackious 13y agoLooking through your code, you have some name mismatching in $parse. Best of luck.