enhance : function()

in xf/ui/xf.ui.core.js [23:55]


        enhance : function (jqObj) {
            if (!(jqObj instanceof $)) {
                jqObj = $(jqObj);

                if (!jqObj instanceof $) {
                    return;
                }
            }

            _.each(XF.ui, function (enhancement, index) {

                if (typeof enhancement === 'object' && enhancement.hasOwnProperty('selector')) {

                    jqObj.find(enhancement.selector).not('[data-skip-enhance=true]').each(function (){
                        var skip = false;

                        _.each(XF.ui.enhanced, function (elem, index) {

                            if (XF.ui.enhanced[index] === this) {
                                skip = true;
                            }
                        });

                        if (!skip & $(this).attr('data-skip-enhance') != 'true') {
                            var options = $(this).data();
                            XF.ui.enhanced.push(this);
                            enhancement.render(this, options);
                        }
                    });
                }
            });

        },