10 ms·
On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too muc
by joeybaker 16y ago
On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.
- emehrkay 16y agoIt looks like they are only using a small portion of it -- selectors in init and a few event handlers. They could use one of the many pre-existing selector engines and write a simple cross-browser addEvent function
- donohoe 16y agoThat is the plan. The CSS selectors are only required (for now) as NYT has some specific criteria to cover the markup in various Article and Blg Post pages. For most cases I imagine 'querySelectorAll' or 'getElementsByTagName' would suffice
- pjscott 16y agoYou know what I would love to have the HTML5 guys add to the spec? Some way of keeping libraries like PrototypeJS and jQuery in the browser cache at all times, so that pages could just use them without worrying about the size. Perhaps some kind of alternate src attribute on script tags, so you could list a local copy (for reliability) as well as Google and Microsoft CDN URLs, and the browser would go with the first one it had in its cache. And if individual browsers wanted to distribute jQuery (et al.) along with the browser itself, and define an URN for it, so much the better. This is just something I thought up in the past few minutes, so take it with a grain of salt, but as a web developer, I would love this.
- mikeklaas 16y agoWhy isn't it sufficient to use the Google-hosted jQuery? It's likely to be cached.
- tjpick 16y ago1. a boatload of page view info you are sending off to google 2. it's another dependency that you don't control
- michaelbuckbee 16y agoTo your first point, is this a critique of the speed (pushing info up to Google) or to Google sucking in yet more information? If it's the latter I'm already in trouble because almost everything I do uses Google Analytics, but I can see the point if you're doing something else. WRT your second point, there's a middle ground of pointing to Google's hosted version for speed and falling back to a local copy if it is not found. You can see the technique in use within the Boilerplate HTML5 template - http://html5boilerplate.com/ http://html5boilerplate.com/ - Scroll down to the index.html file, line 58.
- jonknee 16y ago1) They set far in future expires header, so they should see very very little of your page view info.
- nl 16y agoIn HTML5 you can do this by keeping a script in LocalStorage, then executing it on-demand. It could also have a fallback mechanism for network loading (and lazy initialization). The implementation of this is left as an exercise for the reader.
- steveklabnik 16y agoWouldn't you be able to do this with the cache manifest? http://diveintohtml5.org/offline.html http://diveintohtml5.org/offline.html
- donohoe 16y agoThe only reason I didn't rip out PrototypeJS was for the CSS selectors and the add/remove classnames. That's what remain that will take time and hopefully not for much longer.