htmlpolyfillswebshim

Webshim loads all features from the polyfills?


Does Webshim loads all features from the polyfills even if the used features are natively support in the browser?

If the answers is “Yes”, I am sure, there will be huge performance hit. Even though we specify the feature we used in the web page.

Example: webshims.polyfill('forms forms-ext');

If the answer is “No”, Whether Webshim uses “yesNope.js” to load the polyfills or any other method has been used to load the polyfill files.

Thanks in advance.


Solution

  • It does not use YepNope, but (custom build of) Modernizr, which is similar feature detection library. Check http://afarkas.github.io/webshim/demos/#Customizing-modernizr and https://github.com/aFarkas/webshim/blob/gh-pages/js-webshim/dev/extras/modernizr-custom.js


    The polyfill method adds only the features you pass to it. See https://github.com/aFarkas/webshim/blob/gh-pages/js-webshim/dev/polyfiller.js


    Also each polyfill must have a test method which basically checks if this polyfill needs to be loaded or not. See http://afarkas.github.io/webshim/demos/#Customizing-extending