import {basename} from './functions'; import each from './form-elements-each'; import Doc from './doc'; // Just kill form submission Doc.getByTag('form')[0].onsubmit = function (e) { e.preventDefault(); e.stopPropagation(); console.log(`Form 'submit' event fired.`); return false; }; // What polyfills did we have to load? const $polyfillPattern = /\/polyfills\//; const scriptList = Doc.scripts().filter(file => { return $polyfillPattern.test(file.getAttribute('src')) }); if (scriptList.length > 0) { const polyfillList = []; scriptList.forEach(file => { const src = file.getAttribute('src'); const name = basename(src).replace('.js', '') .replace('.min', ''); const el = `
  • ${name}
  • `; if (!polyfillList.includes(el)) { polyfillList.push(el); } }); const tag = Doc.getById('polyfills-loaded'); tag.innerHTML = '

    Polyfills loaded by this browser:

    '; tag.innerHTML += ``; } // Get each form field's html and syntax highlight it Doc.qsa('.form-field').forEach(each);