| @@ -42,17 +42,15 @@ | ||
| 42 | 42 | } |
| 43 | 43 | if(!window.bf_globals[contentId]){ |
| 44 | 44 | window.bf_globals[contentId] = {inits: {}, contentId: contentId}; |
| 45 | 45 | }else{ |
| 46 | - window.bf_globals[contentId].inits = {}; | |
| 46 | + if(!window.bf_globals[contentId].inits) window.bf_globals[contentId].inits = {}; | |
| 47 | 47 | window.bf_globals[contentId].contentId = contentId; |
| 48 | 48 | } |
| 49 | 49 | }); |
| 50 | 50 | }; |
| 51 | - // Wait for DOM ready: optimizers can run this before the form markup is | |
| 52 | - // parsed, and the not-found branch would then delete arrived config. | |
| 53 | 51 | if(document.readyState === "loading"){ |
| 54 | - document.addEventListener("DOMContentLoaded", bfSetupGlobals); | |
| 52 | + document.addEventListener("DOMContentLoaded", bfSetupGlobals, { once: true }); | |
| 55 | 53 | } else { |
| 56 | 54 | bfSetupGlobals(); |
| 57 | 55 | } |
| 58 | 56 | })();'; |
| @@ -224,13 +222,14 @@ | ||
| 224 | 222 | $fileArr = $this->_validationJsFilesNeeded['requiredFldValidation']; |
| 225 | 223 | $this->addScriptInLoadedScriptsList($fileArr); |
| 226 | 224 | } |
| 227 | 225 | // for regex |
| 228 | - if (Helpers::property_exists_nested($fldData, 'valid->regexr')) { | |
| 229 | - $patternFile = $this->_validationJsFilesNeeded['generateBackslashPattern']; | |
| 230 | - $rgx = $this->_validationJsFilesNeeded['regexPatternValidation']; | |
| 231 | - $this->addScriptInLoadedScriptsList($patternFile); | |
| 232 | - $this->addScriptInLoadedScriptsList($rgx); | |
| 226 | + // The RegEx scripts are registered by Pro; without it there is nothing to load. | |
| 227 | + if (Helpers::property_exists_nested($fldData, 'valid->regexr') | |
| 228 | + && !empty($this->_validationJsFilesNeeded['generateBackslashPattern']) | |
| 229 | + && !empty($this->_validationJsFilesNeeded['regexPatternValidation'])) { | |
| 230 | + $this->addScriptInLoadedScriptsList($this->_validationJsFilesNeeded['generateBackslashPattern']); | |
| 231 | + $this->addScriptInLoadedScriptsList($this->_validationJsFilesNeeded['regexPatternValidation']); | |
| 233 | 232 | } |
| 234 | 233 | |
| 235 | 234 | $validationScriptFileMapping = ScriptFilePriorityManager::validationScriptFileMapping($fldData->typ); |
| 236 | 235 | if ($validationScriptFileMapping) { |