Behavior does this stuff, yes, but if you don't want to use Behavior, check out BehaviorAPI which is just does this piece. It reads JSON from data-foo-options OR from data-foo-optionname allowing for either style. It's pretty robust, including type casting and error handling. It's also pretty fast.
On Nov 22, 2011, at 2:25 PM, Olmo Maldonado <[email protected]> wrote: I've seen implementations that do: <div data-options="{'json': 'object'}"></div> Cons: - can't select with css selectors against attribute (option) values - perhaps messy - escaping fiasco Pros: + easy implementation .. Compared to yours, I'm not too excited about the '_' convention. Were you looking for this kind of criticism or did you want me to just look at your implementation to make it spiffy fast? On Tue, Nov 22, 2011 at 4:07 PM, Jonathan Bomgardner <[email protected]>wrote: > I'm one of the developers for the UI library JxLib and I'm proofing a > concept that will use something like this to parse a HTML document, create > an options object from the data-* attrinbutes , and finally instantiate all > of the corresponding widgets (class) in one pass. > > I know this is similar to Aaron's behaviour library but again it's just > part of a proof of concept and I'd rather have something baked right into > the library as I have ideas for taking this further. This is just a first > step. > > Thanks, > Jon >
