I’m currently working on some rather awesome stuff with SproutCore and it’s shiny new Template Views. They’re an excellent solution for the most part, but being only a few months old they’re still somewhat buggy.
Originally in sproutcore-1.6.0.beta.(1|3) the touch events in the template view didn’t bubble properly which prevented the iPhone view from scrolling at all. That’s been fixed in 1.6.0.rc.1, however I ran into a new issue. When the window orientation changes from portrait to landscape, or vice-versa, I change the classes on a couple divs so that I can show a UI that’s most appropriate for the perspective. This was working excellently until this morning. For whatever reason the view isn’t actually updating until I touch the screen. Obviously this isn’t good enough.
Fortunately, the fix, with props to Stoyan Stefanov, is rather simple in principle. I’ve simply added a helper function to my app that adds a junk style to a stylesheet.
bruteForceRepaint: function() {
var ss = document.styleSheets[0];
try { ss.addRule('.xxxxxx', 'position: relative'); }
catch(e) {}
}
There’s probably a better place to put this, but for now I’ve added it directly to the Application object itself. Then I simply call this within the statechart’s portrait and landscape events after the classes are updated. The whole snippet looks like:
Landscape: SC.State.design({
enterState: function() {
MyApp.LandscapeView.set('isActive',true);
MyApp.bruteForceRepaint();
}
I had initially written this up using Thomas Fuchs’ technique, but I found that it wasn’t reliable enough. Sometimes it worked, sometimes it didn’t and I don’t know why. The above script, while polluting the stylesheet, is far more reliable. I haven’t seen it fail yet.
Spine is a lightweight framework for building JavaScript web applications. Spine gives you a MVC structure and then gets out of your way, allowing you to concentrate on the fun stuff, building awesome web applications.
Spine is opinionated and, although at first glance it might look similar to other frameworks like Backbone, it actually has quite a different take on things.
Spine is tiny, the library comes in at around 500 lines of JavaScript, that’s about 2K minified & compressed. However, it’s not about size, it’s how you use it, and Spine certainly packs a punch!
Dustin Diaz:
Ender is a small yet powerful JavaScript library composed of application agnostic opensource submodules wrapped in a slick intuitive interface. At only 7k Ender.js can help you build anything from small prototypes to providing a solid base for large-scale rich applications.
Good stuff. Be sure to check out the repo.
Shame on you if you write Javascript and you’re not already subscribed to this.
Tempo is the first JS Templating solution I’ve seen that degrades gracefully if Javascript isn’t available.
Thomas Fuchs:
Templating. While there’s a gadzillion more or less awesome templating engines for JavaScript out there, in one case I needed something übersimple—and tried to fit it into a tweet (for no particular reason).
The truth is that if site content doesn’t load through curl it’s broken.
There is no piece of dynamic AJAXy magic that requires beating the Web to a bloody pulp with a sharp-edged hashbang. Please stop doing it.
Hashbangs may not be quite the most evil thing on the Web today, but since you simply can never do a hashbang-implementation perfectly right, you probably should not be doing one at all.
Lifehacker/Gawker have thrown away a decade’s worth of clean URL experience, and ended up with something that actually looks worse than the typical templated Classic ASP site. (How more Frontpage can you get?)