News for hackers. Stuff that matters.
Re:HTML.js – Befriend the DOM by dccoolgai on Tuesday August 13, 2013 @08:34AM (#6205277)
So I guess I'll be the first to ask the obvious question. How is this different or better than jQuery?
Re:HTML.js – Befriend the DOM by grey-area on Tuesday August 13, 2013 @08:44AM (#6205315)
It doesn't wrap and extend dom elements, just finds them, so there's no $(this) etc just to be sure all your objects behave the same way, no .attr('id') to get attributes etc. It also has a nicer syntax I think, like the idea of doing HTML.body.ul.li.a So it looks interesting, though I wish they had included Ajax.

This doesn't do everything jquery does, and is not intended as a drop-in replacement, more as a different way of doing things which is simpler, smaller and more intuitive.

Re:HTML.js – Befriend the DOM by maxhowell on Tuesday August 13, 2013 @09:22AM (#6205510)
What does Hacker News recommend as a standalone AJAX solution nowadays?
Re:HTML.js – Befriend the DOM by jenius on Tuesday August 13, 2013 @09:52AM (#6205662)
I've used superagent (https://github.com/visionmedia/superagent) a number of times and it's wonderful, but beware if you're trying to make it work with old IE.
Re:HTML.js – Befriend the DOM by prezjordan on Tuesday August 13, 2013 @12:31PM (#6206700)
Geez, has he made everything?
Re:HTML.js – Befriend the DOM by phpnode on Tuesday August 13, 2013 @01:56PM (#6207146)
yes, he has. as has substack. basically everything.

but part of the reason they are so prolific is that they focus on very small, single use modules that do one thing well. So they have hundreds of repos, but many of them are 10 - 15 lines of code.

Re:HTML.js – Befriend the DOM by prezjordan on Wednesday August 14, 2013 @12:39AM (#6209956)
That may be one reason, but the guy's responsible for Express, Jade, Mocha, Commander, and many others. I honestly thought visionmedia was a company until a few months ago.
Re:HTML.js – Befriend the DOM by phpnode on Wednesday August 14, 2013 @01:30PM (#6212923)
i did too, the sheer volume of useful code he ships is incredible.
Re:HTML.js – Befriend the DOM by grey-area on Tuesday August 13, 2013 @09:31AM (#6205561)
Not sure if it is a complete replacement, but I needed to remove a dependency on jquery recently and used this code:

https://github.com/inkling/backbone.native/blob/master/backb...

The $.ajax function was all I needed.

Re:HTML.js – Befriend the DOM by jonahx on Tuesday August 13, 2013 @09:34AM (#6205577)
Just using the native XMLHttpRequest has pretty good support: http://en.wikipedia.org/wiki/XMLHttpRequest#History_and_supp...
Re:HTML.js – Befriend the DOM by 2mur on Tuesday August 13, 2013 @11:15AM (#6206214)
If you are a node.js user, these libraries have familiar APIs:

https://github.com/substack/hyperquest

https://github.com/iriscouch/browser-request

Re:HTML.js – Befriend the DOM by STRML on Tuesday August 13, 2013 @09:53AM (#6205668)
The node-inspired `http-browserify` is my favorite; really nice, sane syntax for doing ajax requests that you can mix with client-side streams and transforms to do really advanced things with code that is clear and readable. Of course you have to use browserify to use it, but it's worth looking into.
Re:HTML.js – Befriend the DOM by clarkdave on Tuesday August 13, 2013 @10:34AM (#6205947)
Reqwest (https://github.com/ded/reqwest) has worked well for me, and has EnderJS support too. The API is similar, but not identical, to jQuery.ajax.
Re:HTML.js – Befriend the DOM by CmonDev on Tuesday August 13, 2013 @08:35AM (#6205279)
There is a small FAQ in the bottom.
Re:HTML.js – Befriend the DOM by jhh on Tuesday August 13, 2013 @08:37AM (#6205285)
"Not so much. This doesn't wrap or hide the DOM for you. It exposes and enhances it, making it your ally instead of trying to protect you from it. Old IE versions are fading; it's time to go native!"

This seems like a pretty poetic way of describing differences between software packages. And I mean that in a non-charming way.

Re:HTML.js – Befriend the DOM by dccoolgai on Tuesday August 13, 2013 @08:42AM (#6205302)
I red the faq... didn't really answer my question... from the examples I saw, there was nothing there that ouldn't be achieved with JQ...which is why I brought it here...thought maybe I was missing something.
Re:HTML.js – Befriend the DOM by smanuel on Tuesday August 13, 2013 @08:50AM (#6205342)
Well... everything could be achieved with JQ. Usually with 1 line of code. But that library is 2.7k and you're working directly with the DOM elements and not with wrappers. So I guess it could come handy for smaller projects where you wouldn't need the full JQ power and 10 JQ widgets.