Quick Cliencide Update

Wednesday, September 14th, 2011 @ 5:53 pm | filed under: Code Releases

A few new additions/fixes to the Clientcide libs for your enjoyment:

  • Clientcide:
    • New behavior filter: StickyWin.Modal – make modal layers on the fly. Works really well with AJAX-ing in the HTML.
    • Updated Tabs filter to use new filter features (defaults and the like).
  • Behavior:
    • adding ability to set defaults for behaviors
  • More-Behaviors:
    • New Delegator for Fx.Reveal. Works a bit better than the Collapser Behavior in Clientcide’s repo because there’s no startup cost.

Not a lot of meat on the bone, I know, but I wanted to release it as I go. Expect more in the coming weeks.

As a side note, if any of you are using Behavior and writing filters, I’d love to hear about it. Leave a comment or drop me a line.

7 Responses to “Quick Cliencide Update”

  1. Eric Patrick Says:

    R.e. behavior options, I believe all options must be strict JSON (though single quotes are allowed).

    This would appear to prohibit nesting JSON objects within the options:

    This is easy enough to work around, albeit more verbose:

    A purely nice to have would be to set something like a ‘trusted’ option on the Behavior, and modify the _get* methods to only verify non-trusted stuff:

    var isSecure = this.trusted || JSON.isSecure(options);

    Or are you trending toward stricter JSON in general, as a pattern?

  2. Aaron N. Says:

    I’m not sure what you mean. You can absolutely have nested objects. Only functions aren’t allowed.

  3. Thomas Allmer Says:

    Since I learned about Behaviors and Delegators I use them all the time :)

    it’s just freaking amazing :)
    no more domready and dependence problems; include the behavior with packager and set data-behavior probably with some options and you are done.

    just love it :)

    most of the stuff is for my “own” MooTools Classes, but surely it could be some inspiration for others
    look at Source/Behaviors and Source/Delegators

    and while I’m at it I actually have a questions if you do some ajax in the delegator you can easily reapply the behaviors as you have the “getBehavior”; but when doing some ajax in a behavior how can I apply the behaviors to the new stuff?

    I currently do this on my ajax completion in the behavior (
    onLoaded: function(div) { myBehavior.apply(div); }
    which works but relays on a static name – so I have to stick with this name no matter what… no so nice :p any ideas?
    var myBehavior=new Behavior().apply(document.body);

  4. Aaron N. Says:

    Re: applying behaviors on new content from delegators, you have two options:

    1) fire the “ammendDom” event (preferred): https://github.com/anutron/more-behaviors/blob/master/Source/Delegators/Delegator.Ajax.js#L60 – this invokes this handler in Delegator: https://github.com/anutron/behavior/blob/master/Source/Delegator.js#L71

    2) use api.getBehavior() to get the bound behavior instance and call it’s apply method: https://github.com/anutron/behavior/blob/master/Source/Delegator.js#L50

    The former is preferred because other plugins can hook into it. Both of these are in the docs for Delegator (easy to miss; there’s a lot of documentation).

  5. Aaron N. Says:

    Nice work on that stack of Behaviors/Delegators in your github repo. Nice to see it getting used!

  6. Thomas Allmer Says:

    I actually wanted to know howto apply behaviors inside a behavior (which does some ajax) :p


    thx for creating such an awesome system :)

  7. Aaron N. Says:

    Ah. Looks like I don’t have this one in the docs:



    I’ll update docs.