webshims-rails 1.10.6 → 1.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +8 -8
  2. data/lib/webshims-rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/webshims/polyfiller.js +14 -7
  4. data/vendor/assets/javascripts/webshims/shims/color-picker.js +1 -0
  5. data/vendor/assets/javascripts/webshims/shims/combos/1.js +153 -155
  6. data/vendor/assets/javascripts/webshims/shims/combos/10.js +168 -136
  7. data/vendor/assets/javascripts/webshims/shims/combos/11.js +116 -44
  8. data/vendor/assets/javascripts/webshims/shims/combos/12.js +100 -95
  9. data/vendor/assets/javascripts/webshims/shims/combos/13.js +100 -95
  10. data/vendor/assets/javascripts/webshims/shims/combos/14.js +51 -91
  11. data/vendor/assets/javascripts/webshims/shims/combos/15.js +129 -232
  12. data/vendor/assets/javascripts/webshims/shims/combos/16.js +228 -326
  13. data/vendor/assets/javascripts/webshims/shims/combos/17.js +116 -44
  14. data/vendor/assets/javascripts/webshims/shims/combos/18.js +116 -44
  15. data/vendor/assets/javascripts/webshims/shims/combos/19.js +210 -214
  16. data/vendor/assets/javascripts/webshims/shims/combos/2.js +204 -246
  17. data/vendor/assets/javascripts/webshims/shims/combos/20.js +210 -214
  18. data/vendor/assets/javascripts/webshims/shims/combos/21.js +59 -28
  19. data/vendor/assets/javascripts/webshims/shims/combos/23.js +100 -95
  20. data/vendor/assets/javascripts/webshims/shims/combos/24.js +2 -2
  21. data/vendor/assets/javascripts/webshims/shims/combos/25.js +210 -214
  22. data/vendor/assets/javascripts/webshims/shims/combos/26.js +51 -91
  23. data/vendor/assets/javascripts/webshims/shims/combos/28.js +110 -119
  24. data/vendor/assets/javascripts/webshims/shims/combos/29.js +6 -0
  25. data/vendor/assets/javascripts/webshims/shims/combos/3.js +126 -156
  26. data/vendor/assets/javascripts/webshims/shims/combos/30.js +126 -155
  27. data/vendor/assets/javascripts/webshims/shims/combos/31.js +104 -151
  28. data/vendor/assets/javascripts/webshims/shims/combos/4.js +73 -96
  29. data/vendor/assets/javascripts/webshims/shims/combos/5.js +116 -44
  30. data/vendor/assets/javascripts/webshims/shims/combos/6.js +116 -44
  31. data/vendor/assets/javascripts/webshims/shims/combos/7.js +226 -250
  32. data/vendor/assets/javascripts/webshims/shims/combos/8.js +226 -250
  33. data/vendor/assets/javascripts/webshims/shims/combos/9.js +168 -136
  34. data/vendor/assets/javascripts/webshims/shims/dom-extend.js +51 -91
  35. data/vendor/assets/javascripts/webshims/shims/form-core.js +53 -60
  36. data/vendor/assets/javascripts/webshims/shims/form-message.js +22 -5
  37. data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +87 -30
  38. data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +2 -76
  39. data/vendor/assets/javascripts/webshims/shims/form-validation.js +2 -2
  40. data/vendor/assets/javascripts/webshims/shims/forms-picker.js +1 -1
  41. data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +18 -8
  42. data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +100 -95
  43. data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +59 -28
  44. data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +9 -2
  45. data/vendor/assets/javascripts/webshims/shims/range-ui.js +29 -14
  46. data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +21 -7
  47. data/vendor/assets/javascripts/webshims/shims/styles/shim.css +30 -15
  48. data/vendor/assets/javascripts/webshims/shims/track-ui.js +6 -0
  49. metadata +2 -2
@@ -509,10 +509,15 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
509
509
  if(!$.parseHTML){
510
510
  webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims.");
511
511
  }
512
+
513
+ if(webshims.cfg.extendNative == 1){
514
+ webshims.warn("extendNative configuration will be set to false by default with next release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO");
515
+ }
516
+
512
517
  if (!webshims.cfg.no$Switch) {
513
518
  var switch$ = function(){
514
519
  if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) {
515
- webshims.error("jQuery was included more than once. Make sure to include it only once! Webshims and other Plugins might not work properly.");
520
+ webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly..");
516
521
  if (window.$) {
517
522
  window.$ = webshims.$;
518
523
  }
@@ -530,7 +535,10 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
530
535
  };
531
536
  switch$();
532
537
  setTimeout(switch$, 90);
538
+ webshims.ready('DOM', switch$);
533
539
  $(switch$);
540
+ webshims.ready('WINDOWLOAD', switch$);
541
+
534
542
  }
535
543
  // (function(){
536
544
  // var hostNames = {
@@ -638,6 +646,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
638
646
  $(evtDel).off(evt, fn);
639
647
  }
640
648
  });
649
+ return this;
641
650
  };
642
651
 
643
652
  var dataID = '_webshimsLib'+ (Math.round(Math.random() * 1000));
@@ -672,57 +681,6 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
672
681
  };
673
682
  });
674
683
 
675
- if($.Tween.propHooks._default && $.css){
676
- (function(){
677
- var isjQ8 = false;
678
- try {
679
- isjQ8 = $.css($('<b style="width: 10px" />')[0], 'width', '') == '10px';
680
- } catch(er){
681
- webshims.error(er);
682
- }
683
- var css = isjQ8 ?
684
- function(elem, prop){
685
- return $.css( elem, prop, false, "" );
686
- } :
687
- function(elem, prop){
688
- return $.css( elem, prop, "" );
689
- }
690
- ;
691
-
692
- $.extend($.Tween.propHooks._default, {
693
- get: function( tween ) {
694
- var result;
695
-
696
- if ( (tween.elem[ tween.prop ] != null || havePolyfill[ tween.prop ]) &&
697
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
698
- return havePolyfill[ tween.prop ] ? $.prop(tween.elem, tween.prop) : tween.elem[ tween.prop ];
699
- }
700
-
701
- // passing an empty string as a 3rd parameter to .css will automatically
702
- // attempt a parseFloat and fallback to a string if the parse fails
703
- // so, simple values such as "10px" are parsed to Float.
704
- // complex values such as "rotate(1rad)" are returned as is.
705
- result = css( tween.elem, tween.prop );
706
- // Empty strings, null, undefined and "auto" are converted to 0.
707
- return !result || result === "auto" ? 0 : result;
708
- },
709
- set: function( tween ) {
710
- // use step hook for back compat - use cssHook if its there - use .style if its
711
- // available and use plain properties where available
712
- if ( jQuery.fx.step[ tween.prop ] ) {
713
- jQuery.fx.step[ tween.prop ]( tween );
714
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
715
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
716
- } else if( !havePolyfill[ tween.prop ] ) {
717
- tween.elem[ tween.prop ] = tween.now;
718
- } else {
719
- $.prop(tween.elem, tween.prop, tween.now);
720
- }
721
- }
722
- });
723
- })();
724
- }
725
-
726
684
 
727
685
  ['removeAttr', 'prop', 'attr'].forEach(function(type){
728
686
  olds[type] = $[type];
@@ -1126,48 +1084,50 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1126
1084
  });
1127
1085
  };
1128
1086
  return function(nativeElem, shadowElem, opts){
1129
- opts = opts || {};
1130
- if(nativeElem.jquery){
1131
- nativeElem = nativeElem[0];
1132
- }
1133
- if(shadowElem.jquery){
1134
- shadowElem = shadowElem[0];
1135
- }
1136
- var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1137
- var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1138
- var shadowFocusElementData = {};
1139
- if(!opts.shadowFocusElement){
1140
- opts.shadowFocusElement = shadowElem;
1141
- } else if(opts.shadowFocusElement){
1142
- if(opts.shadowFocusElement.jquery){
1143
- opts.shadowFocusElement = opts.shadowFocusElement[0];
1087
+ if(nativeElem && shadowElem){
1088
+ opts = opts || {};
1089
+ if(nativeElem.jquery){
1090
+ nativeElem = nativeElem[0];
1144
1091
  }
1145
- shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1146
- }
1147
-
1148
- $(nativeElem).on('remove', function(e){
1149
- if (!e.originalEvent) {
1150
- $(shadowElem).remove();
1092
+ if(shadowElem.jquery){
1093
+ shadowElem = shadowElem[0];
1151
1094
  }
1152
- });
1153
-
1154
- nativeData.hasShadow = shadowElem;
1155
- shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1156
- shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1157
- nativeElement: nativeElem,
1158
- shadowElement: shadowElem,
1159
- shadowFocusElement: opts.shadowFocusElement
1160
- };
1161
- if(opts.shadowChilds){
1162
- opts.shadowChilds.each(function(){
1163
- elementData(this, 'shadowData', shadowData.shadowData);
1095
+ var nativeData = $.data(nativeElem, dataID) || $.data(nativeElem, dataID, {});
1096
+ var shadowData = $.data(shadowElem, dataID) || $.data(shadowElem, dataID, {});
1097
+ var shadowFocusElementData = {};
1098
+ if(!opts.shadowFocusElement){
1099
+ opts.shadowFocusElement = shadowElem;
1100
+ } else if(opts.shadowFocusElement){
1101
+ if(opts.shadowFocusElement.jquery){
1102
+ opts.shadowFocusElement = opts.shadowFocusElement[0];
1103
+ }
1104
+ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData);
1105
+ }
1106
+
1107
+ $(nativeElem).on('remove', function(e){
1108
+ if (!e.originalEvent) {
1109
+ $(shadowElem).remove();
1110
+ }
1164
1111
  });
1112
+
1113
+ nativeData.hasShadow = shadowElem;
1114
+ shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem;
1115
+ shadowFocusElementData.shadowData = shadowData.shadowData = nativeData.shadowData = {
1116
+ nativeElement: nativeElem,
1117
+ shadowElement: shadowElem,
1118
+ shadowFocusElement: opts.shadowFocusElement
1119
+ };
1120
+ if(opts.shadowChilds){
1121
+ opts.shadowChilds.each(function(){
1122
+ elementData(this, 'shadowData', shadowData.shadowData);
1123
+ });
1124
+ }
1125
+
1126
+ if(opts.data){
1127
+ shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1128
+ }
1129
+ opts = null;
1165
1130
  }
1166
-
1167
- if(opts.data){
1168
- shadowFocusElementData.shadowData.data = shadowData.shadowData.data = nativeData.shadowData.data = opts.data;
1169
- }
1170
- opts = null;
1171
1131
  webshims.docObserve();
1172
1132
  };
1173
1133
  })(),
@@ -1451,7 +1411,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1451
1411
  // register: moduleName:string,
1452
1412
  // callback: callback:function
1453
1413
  // });
1454
- // get/set including removeLang
1414
+ // get/set including remoteLang
1455
1415
  // - webshims.activeLang({
1456
1416
  // module: moduleName:string,
1457
1417
  // callback: callback:function,
@@ -1703,12 +1663,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1703
1663
  $.expr[":"][name] = $.expr.filters[name+"-element"];
1704
1664
  });
1705
1665
 
1706
-
1707
- $.expr[":"].focus = function( elem ) {
1666
+ var pseudoFocus = $.expr[":"].focus;
1667
+ $.expr[":"].focus = function(){
1708
1668
  try {
1709
- var doc = elem.ownerDocument;
1710
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus());
1711
- } catch(e){}
1669
+ return pseudoFocus.apply(this, arguments);
1670
+ } catch(e){
1671
+ webshims.error(e);
1672
+ }
1712
1673
  return false;
1713
1674
  };
1714
1675
 
@@ -1723,7 +1684,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1723
1684
  });
1724
1685
  };
1725
1686
 
1726
-
1687
+ var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition';
1727
1688
  webshims.wsPopover = {
1728
1689
  id: 0,
1729
1690
  _create: function(){
@@ -1731,7 +1692,7 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1731
1692
  this.id = webshims.wsPopover.id++;
1732
1693
  this.eventns = '.wsoverlay' + this.id;
1733
1694
  this.timers = {};
1734
- this.element = $('<div class="ws-popover" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
1695
+ this.element = $('<div class="ws-popover'+transClass+'" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>');
1735
1696
  this.contentElement = $('.ws-po-box', this.element);
1736
1697
  this.lastElement = $([]);
1737
1698
  this.bindElement();
@@ -1770,47 +1731,6 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1770
1731
  };
1771
1732
 
1772
1733
 
1773
- /* extension, but also used to fix native implementation workaround/bugfixes */
1774
- (function(){
1775
- var firstEvent,
1776
- invalids = [],
1777
- stopSubmitTimer,
1778
- form
1779
- ;
1780
-
1781
- $(document).on('invalid', function(e){
1782
- if(e.wrongWebkitInvalid){return;}
1783
- var jElm = $(e.target);
1784
-
1785
-
1786
- if(!firstEvent){
1787
- //trigger firstinvalid
1788
- firstEvent = $.Event('firstinvalid');
1789
- firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
1790
- var firstSystemInvalid = $.Event('firstinvalidsystem');
1791
- $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
1792
- jElm.trigger(firstEvent);
1793
- }
1794
-
1795
- //if firstinvalid was prevented all invalids will be also prevented
1796
- if( firstEvent && firstEvent.isDefaultPrevented() ){
1797
- e.preventDefault();
1798
- }
1799
- invalids.push(e.target);
1800
- e.extraData = 'fix';
1801
- clearTimeout(stopSubmitTimer);
1802
- stopSubmitTimer = setTimeout(function(){
1803
- var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
1804
- //reset firstinvalid
1805
- firstEvent = false;
1806
- invalids = [];
1807
- $(e.target).trigger(lastEvent, lastEvent);
1808
- }, 9);
1809
- jElm = null;
1810
- });
1811
- })();
1812
-
1813
-
1814
1734
  webshims.getContentValidationMessage = function(elem, validity, key){
1815
1735
  var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || '';
1816
1736
  if(key && message[key]){
@@ -1844,19 +1764,13 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1844
1764
  };
1845
1765
 
1846
1766
 
1847
- webshims.ready('forms', function(){
1848
- $(document).on('focusin.lazyloadvalidation', function(e){
1849
- if('form' in e.target && $(e.target).is(':invalid')){
1850
- lazyLoad();
1851
- }
1852
- });
1767
+ $(document).on('focusin.lazyloadvalidation', function(e){
1768
+ if('form' in e.target && $(e.target).is(':invalid')){
1769
+ lazyLoad();
1770
+ }
1853
1771
  });
1854
1772
  webshims.ready('WINDOWLOAD', lazyLoad);
1855
- if(options.overrideMessages){
1856
- options.customMessages = true;
1857
- webshims.reTest('form-message');
1858
- webshims.error('overrideMessages is deprecated. use customMessages instead.');
1859
- }
1773
+
1860
1774
  if(options.replaceValidationUI){
1861
1775
  webshims.ready('DOM forms', function(){
1862
1776
  $(document).on('firstinvalid', function(e){
@@ -1867,8 +1781,47 @@ webshims.register('form-core', function($, webshims, window, document, undefined
1867
1781
  });
1868
1782
  });
1869
1783
  }
1870
- });
1784
+
1785
+ /* extension, but also used to fix native implementation workaround/bugfixes */
1786
+ (function(){
1787
+ var firstEvent,
1788
+ invalids = [],
1789
+ stopSubmitTimer,
1790
+ form
1791
+ ;
1792
+
1793
+ $(document).on('invalid', function(e){
1794
+ if(e.wrongWebkitInvalid){return;}
1795
+ var jElm = $(e.target);
1796
+
1797
+
1798
+ if(!firstEvent){
1799
+ //trigger firstinvalid
1800
+ firstEvent = $.Event('firstinvalid');
1801
+ firstEvent.isInvalidUIPrevented = e.isDefaultPrevented;
1802
+ var firstSystemInvalid = $.Event('firstinvalidsystem');
1803
+ $(document).triggerHandler(firstSystemInvalid, {element: e.target, form: e.target.form, isInvalidUIPrevented: e.isDefaultPrevented});
1804
+ jElm.trigger(firstEvent);
1805
+ }
1871
1806
 
1807
+ //if firstinvalid was prevented all invalids will be also prevented
1808
+ if( firstEvent && firstEvent.isDefaultPrevented() ){
1809
+ e.preventDefault();
1810
+ }
1811
+ invalids.push(e.target);
1812
+ e.extraData = 'fix';
1813
+ clearTimeout(stopSubmitTimer);
1814
+ stopSubmitTimer = setTimeout(function(){
1815
+ var lastEvent = {type: 'lastinvalid', cancelable: false, invalidlist: $(invalids)};
1816
+ //reset firstinvalid
1817
+ firstEvent = false;
1818
+ invalids = [];
1819
+ $(e.target).trigger(lastEvent, lastEvent);
1820
+ }, 9);
1821
+ jElm = null;
1822
+ });
1823
+ })();
1824
+ });
1872
1825
 
1873
1826
  webshims.register('form-datalist', function($, webshims, window, document, undefined, options){
1874
1827
  "use strict";
@@ -2193,52 +2146,55 @@ webshims.register('form-datalist', function($, webshims, window, document, undef
2193
2146
  });
2194
2147
  webshims.loader.loadList(['mediaelement-native-fix']);
2195
2148
  }
2196
- }
2197
-
2198
- if(hasNative && !options.preferFlash){
2199
- var noSwitch = {
2200
- 1: 1,
2201
- 2: 1
2202
- };
2203
- var switchOptions = function(e){
2204
- var media;
2205
- var parent;
2206
- if(!options.preferFlash &&
2149
+
2150
+ if(!options.preferFlash){
2151
+ var noSwitch = {
2152
+ 1: 1,
2153
+ 2: 1
2154
+ };
2155
+ var switchOptions = function(e){
2156
+ var media, error, parent;
2157
+ if(!options.preferFlash &&
2207
2158
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2208
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2159
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
2209
2160
  ){
2210
- $(function(){
2211
- if(hasSwf && !options.preferFlash){
2212
- loadSwf();
2213
- webshims.ready('WINDOWLOAD '+swfType, function(){
2214
- setTimeout(function(){
2215
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2216
- options.preferFlash = true;
2217
- document.removeEventListener('error', switchOptions, true);
2218
- $('audio, video').each(function(){
2219
- webshims.mediaelement.selectSource(this);
2220
- });
2221
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2222
- }
2223
- }, 9);
2224
- });
2225
- } else{
2226
- document.removeEventListener('error', switchOptions, true);
2161
+ if(error == null){
2162
+ webshims.warn("There was an unspecified error on a mediaelement");
2163
+ return;
2164
+
2227
2165
  }
2228
- });
2229
- }
2230
- };
2231
- document.addEventListener('error', switchOptions, true);
2232
- $('audio, video').each(function(){
2233
- var error = $.prop(this, 'error');
2234
- if(error && !noSwitch[error]){
2235
- switchOptions({target: this});
2236
- return false;
2237
- }
2238
- });
2166
+ $(function(){
2167
+ if(hasSwf && !options.preferFlash){
2168
+ loadSwf();
2169
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2170
+ setTimeout(function(){
2171
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2172
+ options.preferFlash = true;
2173
+ document.removeEventListener('error', switchOptions, true);
2174
+ $('audio, video').each(function(){
2175
+ webshims.mediaelement.selectSource(this);
2176
+ });
2177
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2178
+ }
2179
+ }, 9);
2180
+ });
2181
+ } else{
2182
+ document.removeEventListener('error', switchOptions, true);
2183
+ }
2184
+ });
2185
+ }
2186
+ };
2187
+ document.addEventListener('error', switchOptions, true);
2188
+ $('audio, video').each(function(){
2189
+ var error = $.prop(this, 'error');
2190
+ if(error && !noSwitch[error]){
2191
+ switchOptions({target: this});
2192
+ return false;
2193
+ }
2194
+ });
2195
+ }
2239
2196
  }
2240
2197
 
2241
-
2242
2198
  if(Modernizr.track && !bugs.track){
2243
2199
  (function(){
2244
2200
 
@@ -2619,63 +2575,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2619
2575
 
2620
2576
  });
2621
2577
 
2622
- webshims.ready('dom-support', function(){
2623
- if(!supportsLoop){
2624
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2625
- }
2626
-
2627
- ['audio', 'video'].forEach(function(nodeName){
2628
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2629
- prop: {
2630
- value: function(){
2631
- var data = webshims.data(this, 'mediaelement');
2632
- selectSource(this, data);
2633
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2634
- supLoad.prop._supvalue.apply(this, arguments);
2635
- }
2636
- }
2637
- }
2638
- });
2639
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2640
- prop: {
2641
- value: function(type){
2642
- var ret = '';
2643
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2644
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2645
- if(ret == 'no'){
2646
- ret = '';
2647
- }
2648
- }
2649
- if(!ret && hasSwf){
2650
- type = $.trim((type || '').split(';')[0]);
2651
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2652
- ret = 'maybe';
2653
- }
2654
- }
2655
- return ret;
2656
- }
2657
- }
2658
- });
2659
- });
2660
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2661
- set: function(){
2662
- var elem = this;
2663
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2664
- clearTimeout(baseData.loadTimer);
2665
- baseData.loadTimer = setTimeout(function(){
2666
- selectSource(elem);
2667
- elem = null;
2668
- }, 9);
2669
- }
2670
- });
2671
- });
2672
-
2578
+ var handleMedia = false;
2673
2579
  var initMediaElements = function(){
2674
2580
  var testFixMedia = function(){
2675
2581
  if(webshims.implement(this, 'mediaelement')){
2676
2582
  selectSource(this);
2677
2583
 
2678
- if(hasNative){
2584
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
2585
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
2679
2586
  var bufferTimer;
2680
2587
  var lastBuffered;
2681
2588
  var elem = this;
@@ -2704,7 +2611,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2704
2611
  lastBuffered = getBufferedString();
2705
2612
  }
2706
2613
  clearTimeout(bufferTimer);
2707
- bufferTimer = setTimeout(testBuffer, 999);
2614
+ bufferTimer = setTimeout(testBuffer, 400);
2708
2615
  },
2709
2616
  'emptied stalled mediaerror abort suspend': function(e){
2710
2617
  if(e.type == 'emptied'){
@@ -2721,11 +2628,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2721
2628
  }
2722
2629
 
2723
2630
  };
2724
- var handleMedia = false;
2631
+
2725
2632
 
2726
2633
 
2727
2634
  webshims.ready('dom-support', function(){
2728
2635
  handleMedia = true;
2636
+
2637
+ if(!supportsLoop){
2638
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2639
+ }
2640
+
2641
+ ['audio', 'video'].forEach(function(nodeName){
2642
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2643
+ prop: {
2644
+ value: function(){
2645
+ var data = webshims.data(this, 'mediaelement');
2646
+ selectSource(this, data);
2647
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2648
+ supLoad.prop._supvalue.apply(this, arguments);
2649
+ }
2650
+ }
2651
+ }
2652
+ });
2653
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2654
+ prop: {
2655
+ value: function(type){
2656
+ var ret = '';
2657
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2658
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2659
+ if(ret == 'no'){
2660
+ ret = '';
2661
+ }
2662
+ }
2663
+ if(!ret && hasSwf){
2664
+ type = $.trim((type || '').split(';')[0]);
2665
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2666
+ ret = 'maybe';
2667
+ }
2668
+ }
2669
+ return ret;
2670
+ }
2671
+ }
2672
+ });
2673
+ });
2674
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2675
+ set: function(){
2676
+ var elem = this;
2677
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2678
+ clearTimeout(baseData.loadTimer);
2679
+ baseData.loadTimer = setTimeout(function(){
2680
+ selectSource(elem);
2681
+ elem = null;
2682
+ }, 9);
2683
+ }
2684
+ });
2685
+
2686
+
2729
2687
  webshims.addReady(function(context, insertedElement){
2730
2688
  var media = $('video, audio', context)
2731
2689
  .add(insertedElement.filter('video, audio'))