src/Server/js/caliban.js
/*
             * Add submit handlers to FORM elements, except those to be ignored
             */
Add submit handlers to FORM elements, except those to be ignored
Add submit handlers to FORM elements except those to be ignored
function addSubmitListeners(trackerInstance) {
                var i,
                    ignorePattern = getClassesRegExp(configIgnoreClasses, 'ignore'),
                    formElements = documentAlias.forms,
                    formElement = null,
                    trackerType = null;
                if (formElements) {
                    for (i = 0; i < formElements.length; i++) {
                        formElement = formElements[i];
                        if (!ignorePattern.test(formElement.className)) {
                            trackerType = typeof formElement.calibanTrackers;
                            if ('undefined' === trackerType) {
                                formElement.calibanTrackers = [];
                            }
                            if (-1 === indexOfArray(formElement.calibanTrackers, trackerInstance)) {
                                formElement.calibanTrackers.push(trackerInstance);
                                addSubmitListener(formElement);
                            }
                        }
                    }
                }
            }
function addSubmitListeners ( trackerInstance ) { var i , ignorePattern = getClassesRegExp ( configIgnoreClasses , 'ignore' ) , formElements = documentAlias . forms , formElement = null , trackerType = null ; if ( formElements ) { for ( i = 0 ; i < formElements . length ; i ++ ) { formElement = formElements [ i ] ; if ( ! ignorePattern . test ( formElement . className ) ) { trackerType = typeof formElement . calibanTrackers ; if ( 'undefined' === trackerType ) { formElement . calibanTrackers = [ ] ; } if ( - 1 === indexOfArray ( formElement . calibanTrackers , trackerInstance ) ) { formElement . calibanTrackers . push ( trackerInstance ) ; addSubmitListener ( formElement ) ; } } } } }
Add submit handlers to FORM elements, except those to be ignored
Add submit handlers to FORM elements except those to be ignored
// iterate through FORM elements // we make sure to setup form only once for each tracker // Add event listeners to relevant forms onSubmit