(function () { 'use strict'; window.HtmlHelpers = (function() { function _prefixIds(element) { var idPrefix = Math.floor(Math.random() * 100000); var idAttrs = ['id', 'for', 'data-conditional-input', 'data-modal-trigger']; idAttrs.forEach(function(attr) { Array.from(element.querySelectorAll('[' + attr + ']')).forEach(function(input) { var value = idPrefix + '__' + input.getAttribute(attr); input.setAttribute(attr, value); }); }); } function parseResponse(response) { return response.text().then(function (responseText) { var docFrag = document.createRange().createContextualFragment(responseText); _prefixIds(docFrag); return Promise.resolve(docFrag); }, function (error) { return Promise.reject(error); }).catch(function (error) { console.error(error); }); } return { parseResponse: parseResponse, } })(); })();