webshims-rails 1.10.6 → 1.10.9

Sign up to get free protection for your applications and to get access to all the features.
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-message', function($, webshims, window, document, undefined, options){
1874
1827
  "use strict";
@@ -1922,8 +1875,15 @@ webshims.register('form-message', function($, webshims, window, document, undefi
1922
1875
  validityMessages.en.rangeOverflow[type] = validityMessages.en.rangeOverflow[type] || 'Value must be at or before {%max}.';
1923
1876
  });
1924
1877
  }
1925
-
1926
- validityMessages['en-US'] = validityMessages['en-US'] || validityMessages.en;
1878
+ if(!validityMessages['en-US']){
1879
+ validityMessages['en-US'] = $.extend(true, {}, validityMessages.en);
1880
+ }
1881
+ if(!validityMessages['en-GB']){
1882
+ validityMessages['en-GB'] = $.extend(true, {}, validityMessages.en);
1883
+ }
1884
+ if(!validityMessages['en-AU']){
1885
+ validityMessages['en-AU'] = $.extend(true, {}, validityMessages.en);
1886
+ }
1927
1887
  validityMessages[''] = validityMessages[''] || validityMessages['en-US'];
1928
1888
 
1929
1889
  validityMessages.de = $.extend(true, {
@@ -2023,12 +1983,22 @@ webshims.register('form-message', function($, webshims, window, document, undefi
2023
1983
 
2024
1984
  webshims.activeLang({
2025
1985
  langObj: validityMessages,
2026
- module: 'form-core',
1986
+ module: 'form-core',
2027
1987
  callback: function(langObj){
2028
-
2029
1988
  currentValidationMessage = langObj;
2030
1989
  }
2031
1990
  });
1991
+ webshims.activeLang({
1992
+ register: 'form-core',
1993
+ callback: function(val){
1994
+ $.each(validityMessages, function(i, val){
1995
+ if(validityMessages[val]){
1996
+ currentValidationMessage = validityMessages[val];
1997
+ return false;
1998
+ }
1999
+ });
2000
+ }
2001
+ });
2032
2002
 
2033
2003
  implementProperties.forEach(function(messageProp){
2034
2004
  webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, {
@@ -2075,6 +2045,7 @@ webshims.register('form-message', function($, webshims, window, document, undefi
2075
2045
 
2076
2046
  });
2077
2047
  });
2048
+
2078
2049
  (function($, Modernizr, webshims){
2079
2050
  "use strict";
2080
2051
  var hasNative = Modernizr.audio && Modernizr.video;
@@ -2109,52 +2080,55 @@ webshims.register('form-message', function($, webshims, window, document, undefi
2109
2080
  });
2110
2081
  webshims.loader.loadList(['mediaelement-native-fix']);
2111
2082
  }
2112
- }
2113
-
2114
- if(hasNative && !options.preferFlash){
2115
- var noSwitch = {
2116
- 1: 1,
2117
- 2: 1
2118
- };
2119
- var switchOptions = function(e){
2120
- var media;
2121
- var parent;
2122
- if(!options.preferFlash &&
2083
+
2084
+ if(!options.preferFlash){
2085
+ var noSwitch = {
2086
+ 1: 1,
2087
+ 2: 1
2088
+ };
2089
+ var switchOptions = function(e){
2090
+ var media, error, parent;
2091
+ if(!options.preferFlash &&
2123
2092
  ($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
2124
- (media = $(e.target).closest('audio, video')) && !noSwitch[media.prop('error')]
2093
+ (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
2125
2094
  ){
2126
- $(function(){
2127
- if(hasSwf && !options.preferFlash){
2128
- loadSwf();
2129
- webshims.ready('WINDOWLOAD '+swfType, function(){
2130
- setTimeout(function(){
2131
- if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2132
- options.preferFlash = true;
2133
- document.removeEventListener('error', switchOptions, true);
2134
- $('audio, video').each(function(){
2135
- webshims.mediaelement.selectSource(this);
2136
- });
2137
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2138
- }
2139
- }, 9);
2140
- });
2141
- } else{
2142
- document.removeEventListener('error', switchOptions, true);
2095
+ if(error == null){
2096
+ webshims.warn("There was an unspecified error on a mediaelement");
2097
+ return;
2098
+
2143
2099
  }
2144
- });
2145
- }
2146
- };
2147
- document.addEventListener('error', switchOptions, true);
2148
- $('audio, video').each(function(){
2149
- var error = $.prop(this, 'error');
2150
- if(error && !noSwitch[error]){
2151
- switchOptions({target: this});
2152
- return false;
2153
- }
2154
- });
2100
+ $(function(){
2101
+ if(hasSwf && !options.preferFlash){
2102
+ loadSwf();
2103
+ webshims.ready('WINDOWLOAD '+swfType, function(){
2104
+ setTimeout(function(){
2105
+ if(!options.preferFlash && webshims.mediaelement.createSWF && !media.is('.nonnative-api-active')){
2106
+ options.preferFlash = true;
2107
+ document.removeEventListener('error', switchOptions, true);
2108
+ $('audio, video').each(function(){
2109
+ webshims.mediaelement.selectSource(this);
2110
+ });
2111
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
2112
+ }
2113
+ }, 9);
2114
+ });
2115
+ } else{
2116
+ document.removeEventListener('error', switchOptions, true);
2117
+ }
2118
+ });
2119
+ }
2120
+ };
2121
+ document.addEventListener('error', switchOptions, true);
2122
+ $('audio, video').each(function(){
2123
+ var error = $.prop(this, 'error');
2124
+ if(error && !noSwitch[error]){
2125
+ switchOptions({target: this});
2126
+ return false;
2127
+ }
2128
+ });
2129
+ }
2155
2130
  }
2156
2131
 
2157
-
2158
2132
  if(Modernizr.track && !bugs.track){
2159
2133
  (function(){
2160
2134
 
@@ -2535,63 +2509,14 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2535
2509
 
2536
2510
  });
2537
2511
 
2538
- webshims.ready('dom-support', function(){
2539
- if(!supportsLoop){
2540
- webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2541
- }
2542
-
2543
- ['audio', 'video'].forEach(function(nodeName){
2544
- var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2545
- prop: {
2546
- value: function(){
2547
- var data = webshims.data(this, 'mediaelement');
2548
- selectSource(this, data);
2549
- if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2550
- supLoad.prop._supvalue.apply(this, arguments);
2551
- }
2552
- }
2553
- }
2554
- });
2555
- nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2556
- prop: {
2557
- value: function(type){
2558
- var ret = '';
2559
- if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2560
- ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2561
- if(ret == 'no'){
2562
- ret = '';
2563
- }
2564
- }
2565
- if(!ret && hasSwf){
2566
- type = $.trim((type || '').split(';')[0]);
2567
- if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2568
- ret = 'maybe';
2569
- }
2570
- }
2571
- return ret;
2572
- }
2573
- }
2574
- });
2575
- });
2576
- webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2577
- set: function(){
2578
- var elem = this;
2579
- var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2580
- clearTimeout(baseData.loadTimer);
2581
- baseData.loadTimer = setTimeout(function(){
2582
- selectSource(elem);
2583
- elem = null;
2584
- }, 9);
2585
- }
2586
- });
2587
- });
2588
-
2512
+ var handleMedia = false;
2589
2513
  var initMediaElements = function(){
2590
2514
  var testFixMedia = function(){
2591
2515
  if(webshims.implement(this, 'mediaelement')){
2592
2516
  selectSource(this);
2593
2517
 
2594
- if(hasNative){
2518
+ //fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
2519
+ if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
2595
2520
  var bufferTimer;
2596
2521
  var lastBuffered;
2597
2522
  var elem = this;
@@ -2620,7 +2545,7 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2620
2545
  lastBuffered = getBufferedString();
2621
2546
  }
2622
2547
  clearTimeout(bufferTimer);
2623
- bufferTimer = setTimeout(testBuffer, 999);
2548
+ bufferTimer = setTimeout(testBuffer, 400);
2624
2549
  },
2625
2550
  'emptied stalled mediaerror abort suspend': function(e){
2626
2551
  if(e.type == 'emptied'){
@@ -2637,11 +2562,62 @@ webshims.register('mediaelement-core', function($, webshims, window, document, u
2637
2562
  }
2638
2563
 
2639
2564
  };
2640
- var handleMedia = false;
2565
+
2641
2566
 
2642
2567
 
2643
2568
  webshims.ready('dom-support', function(){
2644
2569
  handleMedia = true;
2570
+
2571
+ if(!supportsLoop){
2572
+ webshims.defineNodeNamesBooleanProperty(['audio', 'video'], 'loop');
2573
+ }
2574
+
2575
+ ['audio', 'video'].forEach(function(nodeName){
2576
+ var supLoad = webshims.defineNodeNameProperty(nodeName, 'load', {
2577
+ prop: {
2578
+ value: function(){
2579
+ var data = webshims.data(this, 'mediaelement');
2580
+ selectSource(this, data);
2581
+ if(hasNative && (!data || data.isActive == 'html5') && supLoad.prop._supvalue){
2582
+ supLoad.prop._supvalue.apply(this, arguments);
2583
+ }
2584
+ }
2585
+ }
2586
+ });
2587
+ nativeCanPlayType[nodeName] = webshims.defineNodeNameProperty(nodeName, 'canPlayType', {
2588
+ prop: {
2589
+ value: function(type){
2590
+ var ret = '';
2591
+ if(hasNative && nativeCanPlayType[nodeName].prop._supvalue){
2592
+ ret = nativeCanPlayType[nodeName].prop._supvalue.call(this, type);
2593
+ if(ret == 'no'){
2594
+ ret = '';
2595
+ }
2596
+ }
2597
+ if(!ret && hasSwf){
2598
+ type = $.trim((type || '').split(';')[0]);
2599
+ if(mediaelement.swfMimeTypes.indexOf(type) != -1){
2600
+ ret = 'maybe';
2601
+ }
2602
+ }
2603
+ return ret;
2604
+ }
2605
+ }
2606
+ });
2607
+ });
2608
+ webshims.onNodeNamesPropertyModify(['audio', 'video'], ['src', 'poster'], {
2609
+ set: function(){
2610
+ var elem = this;
2611
+ var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
2612
+ clearTimeout(baseData.loadTimer);
2613
+ baseData.loadTimer = setTimeout(function(){
2614
+ selectSource(elem);
2615
+ elem = null;
2616
+ }, 9);
2617
+ }
2618
+ });
2619
+
2620
+
2645
2621
  webshims.addReady(function(context, insertedElement){
2646
2622
  var media = $('video, audio', context)
2647
2623
  .add(insertedElement.filter('video, audio'))