4 ms·
what is the best way to handle not storing state on DOM, when you need to maintain javascriptless functionality, and your data is loaded from the server pre-ren
by catshirt 16y ago
what is the best way to handle not storing state on DOM, when you need to maintain javascriptless functionality, and your data is loaded from the server pre-render? currently using data attributes to solve this. which means our state is in DOM anyway.
- jashkenas 16y agoI'd think it'd be a little nicer to bootstrap in the data as JSON objects -- so that you don't have to scrape your own data out of the HTML... But really, if you have to maintain JavaScript-less functionality for a web site (not a web app), that's a fine way to do it. Pull all of your data out of the data attributes once at load time, and you're off to the races.
- catshirt 16y agothanks! good to know it's not atypical... it naturally doesn't "feel right". this functionality is one of the only things that has kept my code from evolving into nearly backbone. felt like maybe I was missing a piece of the puzzle. considering that... backbone is not exactly what I need, but it is definitely inspiring for refining my own solutions (which again, are drawn from similar conclusions).
- HenrikJoreteg 16y agoThanks for your input. As you probably realized, my post was more about a strategy for apps that feel more like desktop apps, where once you're logged in, you're not really moving around from page to page at all. In my case it was a chat app where the whole app was useless without JS. It's an interesting thought, though. However, I don't know if I'd see the need for something like backbone on any site where I was trying to support non-js browsers.