TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Sprint – A high-performance, DOM library for modern browsers

138 pointsby sebgeelenabout 10 years ago

17 comments

tshadwellabout 10 years ago
Or, you know, use the Javascript DOM APIs? They&#x27;re really not at all that bad.<p><pre><code> var d = document.createElement(&quot;div&quot;); d.className = &quot;new&quot;; d.innerHTML = &quot;&lt;p&gt;Hi Sprint&lt;&#x2F;p&gt;&quot;; </code></pre> Skimming through the code I&#x27;m not sure the authors really grok Javascript anyway, which might explain why they need a (pretty thin) custom API for the standard APIs. toArray should be simply this:<p>function toArray(o) { return Array.prototype.slice.call(o) }<p>Instead it&#x27;s:<p><pre><code> var toArray = function(obj) { var arr = [] var i = obj.length while (i--) { arr[i] = obj[i] } return arr } </code></pre> This is just silly:<p><pre><code> prepend: function() { insertHTML.call(this, &quot;afterbegin&quot;, arguments) return this }, var insertHTML = function(position, args) { var argsLen = args.length var contents = args </code></pre> [...]<p><pre><code> var domMethods = { afterbegin: function(el) { this.insertBefore(el, this.firstChild) }, </code></pre> Perhaps this isn&#x27;t so constructive and I should fork the library and annotate every method with its vanilla Javascript equivalent. I&#x27;m sure this post is non-constructive in some respects but I <i>like</i> Javascript, I just wish people would learn how to work with the language it instead of replacing the API wholesale.
评论 #9421754 未加载
评论 #9421590 未加载
评论 #9422233 未加载
评论 #9425546 未加载
评论 #9423077 未加载
评论 #9422853 未加载
评论 #9421649 未加载
kmfrkabout 10 years ago
<p><pre><code> A tiny, lightning fast jQuery-like library for modern browsers. </code></pre> Respectfully, this entire description is an oxymoron. Every time someone mentions a jQuery-like microlibrary, they just mean a jQuery without wide browser(-quirk) support.<p>Browser support is a big part of what makes jQuery jQuery, and without it, you definitely get a much smaller library, but it is also very un-jQuery-like. :)<p>Now for some praise! It makes me really happy to see a comparison - benchmark! - with competitors, which is something everyone should be required to do, when they create software with 40,000 similar offerings. Looking at you, Markdown editors!
评论 #9419951 未加载
评论 #9419933 未加载
评论 #9419952 未加载
apendletonabout 10 years ago
Not supporting the selector for .on() and .off() is a pretty serious limitation; catching bubbled events on child DOM elements is a super-common jQuery pattern, and makes event-handling over a DOM that&#x27;s having stuff added to it much more pleasant to write. It&#x27;s also pretty fundamental to some third-party libraries that run on top of jQuery, like Backbone (at least if you use its View event handling).
评论 #9421072 未加载
timdaubabout 10 years ago
Yeah, its great that there are libraries like this that try to do better than the status quo.<p>But, with every <i>new</i> library there&#x27;s always the question about support. And so since there is no involvement perceptible on its Github page (no PRs, no issues and 3months without a commit), I wouldn&#x27;t want to use this in production.
评论 #9419987 未加载
arnauddriabout 10 years ago
The readme presents it as a production-ready jquery alternative but there isn&#x27;t a single test written and it looks like there&#x27;s no support at all
评论 #9420248 未加载
rwaldronabout 10 years ago
There isn&#x27;t a single test for this project. How can its claims of jQuery-alike-ness be supported?<p>Tests, or it doesn&#x27;t exist.
评论 #9420711 未加载
hackerboosabout 10 years ago
This only supports IE10+. Why shouldn&#x27;t I just use Javascript directly?
评论 #9419547 未加载
评论 #9419980 未加载
vbezhenarabout 10 years ago
I like this approach. I generally tend not to use jQuery, because native DOM API is often good enough for my needs, but it&#x27;s not fun to write and read code using that API. jQuery for me is shortcuts and wrappers for this code.
tonypaceabout 10 years ago
I am tired of terribly slow mobile sites. A demo of the difference would help.
评论 #9419884 未加载
ShahoAabout 10 years ago
It doesn´t seem to support the jQuery .ajax() method, I hope its added soon
评论 #9419562 未加载
latchabout 10 years ago
I&#x27;ve used [the very badly named] minified.js in the past, and I was quite happy. Has optional support for IE6.<p><a href="http:&#x2F;&#x2F;minifiedjs.com" rel="nofollow">http:&#x2F;&#x2F;minifiedjs.com</a>
malandrewabout 10 years ago
virtual-dom is all you need: <a href="https:&#x2F;&#x2F;github.com&#x2F;Matt-Esch&#x2F;virtual-dom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Matt-Esch&#x2F;virtual-dom</a><p>There is a reason why both elm and mercury uses virtual-dom under the hood to generate and manipulate the DOM.<p>Plus you can render server-side: <a href="https:&#x2F;&#x2F;github.com&#x2F;nthtran&#x2F;vdom-to-html" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nthtran&#x2F;vdom-to-html</a><p>If you still want to work with existing html like templates, there is this project: <a href="https:&#x2F;&#x2F;github.com&#x2F;TimBeyer&#x2F;html-to-vdom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;TimBeyer&#x2F;html-to-vdom</a>
camilo_uabout 10 years ago
How this compares to zepto? As far as i know, this is basically the same promise zepto does &quot;A kind-of-jquery but faster (and only modern boys)&quot;
评论 #9420332 未加载
igvadaimonabout 10 years ago
I didn&#x27;t find any information on browser support.
评论 #9419556 未加载
SimeVidasabout 10 years ago
Finally I can run .css() over 700,000 times per second. Also, the 30 KB saved over the wire means a lot because the average page size is over 1 MB.
jackmooreabout 10 years ago
I think this needs some text outlining it&#x27;s differentiation from Zepto. Why would I use this instead of Zepto?
curiouslyabout 10 years ago
Hey guys found this neat little library<p><a href="http:&#x2F;&#x2F;vanilla-js.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;vanilla-js.com&#x2F;</a><p>I get 12+ million operation (a true master race class) vs advertised 800,000 and peasantry of jQuery&#x27;s 300,000.<p>Not sure if I want to sacrifice performance for aesthetically better looking (debatable ofc) syntax and bother investing time learning how to do something slower.