Live data from Hacker News

Vanilla JS, fast, lightweight, cross-platform framework

vanilla-js.com

71–80 of 134 posts

Re: Vanilla JS, fast, lightweight, cross-platform framework

#71
post #55
post #38

Earlier quoted context omitted.

If you'll look at the comment below, you'll see a rather interesting discussion going on. Jokes can be an effective way to start a dialogue.

You're right. And now I feel bad that my whiny comment is the top-rated one, edging out that interesting discussion, but oh well. Hopefully I motivated people to prove me wrong. :)

Actually accepting that you had a whiny comment is what's keeping you on top, hehe. Anyways, I felt the same way, oh man another fake library that complaints about frameworks & libraries. It's alright these have to repeat from time to time, not everybody saw the last one, etc.

Re: Vanilla JS, fast, lightweight, cross-platform framework

#72
Question: is the 'Speed Comparison' for real? I find it really, really hard to believe. Surely jQuery & co. revert to native implementations (if they exists, as they do in all modern browsers) for things like `document.getElementById` and don't iterate over the whole DOM.

Re: Vanilla JS, fast, lightweight, cross-platform framework

#73
post #55

Earlier quoted context omitted.

You're right. And now I feel bad that my whiny comment is the top-rated one, edging out that interesting discussion, but oh well. Hopefully I motivated people to prove me wrong. :)

Actually accepting that you had a whiny comment is what's keeping you on top, hehe. Anyways, I felt the same way, oh man another fake library that complaints about frameworks & libraries. It's alright these have to repeat from time to time, not everybody saw the last one, etc.

from time to time, not every other day.

Re: Vanilla JS, fast, lightweight, cross-platform framework

#74
Raw Javascript is simply not an option. The API is awful, default types are not powerful enough and cross-platform consistency is a joke. For every decently sized project you start in JS you have to reinvent a thousand wheels to even get rolling, so you better just leverage a framework.

Re: Vanilla JS, fast, lightweight, cross-platform framework

#76
post #18

Earlier quoted context omitted.

I'll take $('p').text('Hello.') over for (var p in document.getElementsByTagName('p')) { p.innerHTML = 'Hello.'; } any day!

innerHTML is an easy one, try setting an attribute -- you have to create a new attribute node, set its value and then add that to the element..

> you have to create a new attribute node, set its value and then add that to the element..

Erm... no you don't: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082

Re: Vanilla JS, fast, lightweight, cross-platform framework

#77
post #14

I love pure JavaScript. jQuery is overrated and most libraries are only good for one thing or the other, nothing can replace the joy and performance of Vanilla JS!

jQuery is kind of a big download for mobile, so I often skip it for small tasks. What gets me is when people include jQuery and then further bog things down by loading a lot of plug-ins to do things that could easily be accomplished by adding a few lines of code of their own. Even if you do need and include jQuery, it doesn't mean you have to use it for every piece of javascript in your app. Many times, a plug-in wil…

> jQuery is kind of a big download for mobile, so I often skip it for small tasks.

That's what Zepto[0] is for: jQuery's API, 20% of the size (although it drops some features, e.g. $(selector) is pretty directly proxied to document.querySelectorAll, so $('> .foo') works in jQuery but blows up in Zepto)

[0] http://zeptojs.com/

Re: Vanilla JS, fast, lightweight, cross-platform framework

#78

Earlier quoted context omitted.

innerHTML is an easy one, try setting an attribute -- you have to create a new attribute node, set its value and then add that to the element..

setAttribute()?

IE8 =(

Re: Vanilla JS, fast, lightweight, cross-platform framework

#79

Earlier quoted context omitted.

innerHTML is an easy one, try setting an attribute -- you have to create a new attribute node, set its value and then add that to the element..

> you have to create a new attribute node, set its value and then add that to the element.. Erm... no you don't: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-F68F082

IE8 =(

Re: Vanilla JS, fast, lightweight, cross-platform framework

#80

Question: is the 'Speed Comparison' for real? I find it really, really hard to believe. Surely jQuery & co. revert to native implementations (if they exists, as they do in all modern browsers) for things like `document.getElementById` and don't iterate over the whole DOM.

Yeah, Sizzle will grab an element using `document.getElementById()` but only after checking the nodeType of the context, ensuring the selector is a string and running the selector through a regular expression.
Post reply on HN