Sha256: d15b86b108367bea60842c901e9caa7403cadd94ce02c1476fe978e01ca44169
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
(function($) { // *********** EDIFICE TRAIT CODE ************ // /** @name $.edifice_traits @namespace @description Traits live here. */ $.edifice_traits = {}; /** * Runs $.edifice.traits.X on all contained elements with data-trait containing X * * @param {Boolean} Reset the checks to see if things have already been attached * [use this if you have clone an element without copying events] * * Records which elements have already been 'traited' via data-trait-attached */ $.fn.attach_traits = function(reset) { if (reset) { this.find('[data-trait]').removeAttr('data-trait-attached'); } for (trait in $.edifice_traits) { var $els = this.find('[data-trait~=' + trait + ']:not([data-trait-attached~=' + trait + '])'); $els.attr('data-trait-attached', function(i, val) { return (val ? val + ' ' : '') + trait; }); $.edifice_traits[trait].call($els); } return this; } }(jQuery));
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
edifice-widgets-0.1.1 | app/assets/javascripts/edifice-widgets/traits.js |
edifice-widgets-0.1.0 | app/assets/javascripts/edifice-widgets/traits.js |