Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes this is possible. But I would always include the modernizr and polyfiller.js in the base setup.</p> <p>In case you are doing this you should configure at least waitReady and basePath:</p> <pre><code>webshims.setOptions({ waitReady: false, basePath: "/js/libs/shims/" }); </code></pre> <p>Your code for your view could look like this:</p> <pre><code>Backbone.View.extend({ initialize: function(){ //Load webshims webshims.polyfill('forms forms-ext mediaelement'); }, render: function() { this.$el.html( this.template(this.model.attributes) ); //update new created elements this.$el.updatePolyfill(); return this; } }); </code></pre> <p>Normally webshims delays jQuery's 'ready' event until all features are implented. In case you want to use webshims only in a specific view you can't delay it. In case you want to use the polyfilled JS/DOM API. You should wrap your JS code, which uses those APIs in a webshims.ready callback:</p> <pre><code>render: function() { var thisObject = this; this.$el.html( this.template(this.model.attributes) ); //update new created elements this.$el.updatePolyfill(); //wait until video API is implemented and then use it webshims.ready('mediaelement', function(){ $('video', thisObject.$el).play(); }); return this; } </code></pre> <p>In case you want to speed up things, you can load it inside your view and after window.load:</p> <pre><code> $(window).on('load', function(){ //preload after onload webshims.polyfill('forms forms-ext mediaelement'); }); </code></pre> <p>This way webshims is loaded either as soon as the view starts to initialize or after onload. webshims might give you a warning in this case, that you have called it twice, but this won't hurt.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload