Polyfill HTML5 form attribute (for input fields)

后端 未结 6 843
悲&欢浪女
悲&欢浪女 2020-12-19 03:44

This is the markup I use:


...
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 04:07

    I take some time to send an update for this polyfill because it doesn't work with MS Edge.

    I add 2 line to fix it :

          var isEdge = navigator.userAgent.indexOf("Edge");
          if (sampleElement && window.HTMLFormElement && sampleElement.form instanceof HTMLFormElement && !isIE11 && isEdge == -1) {
            // browser supports it, no need to fix
            return;
          }
    

    UPDATE: Edge now support it: https://caniuse.com/#feat=form-attribute

提交回复
热议问题