mui.fixed.js 943 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * fixed trim
  3. * @param {type} undefined
  4. * @returns {undefined}
  5. */
  6. (function(undefined) {
  7. if (String.prototype.trim === undefined) { // fix for iOS 3.2
  8. String.prototype.trim = function() {
  9. return this.replace(/^\s+|\s+$/g, '');
  10. };
  11. }
  12. Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  13. obj['__proto__'] = proto;
  14. return obj;
  15. };
  16. })();
  17. /**
  18. * fixed CustomEvent
  19. */
  20. (function() {
  21. if (typeof window.CustomEvent === 'undefined') {
  22. function CustomEvent(event, params) {
  23. params = params || {
  24. bubbles: false,
  25. cancelable: false,
  26. detail: undefined
  27. };
  28. var evt = document.createEvent('Events');
  29. var bubbles = true;
  30. for (var name in params) {
  31. (name === 'bubbles') ? (bubbles = !!params[name]) : (evt[name] = params[name]);
  32. }
  33. evt.initEvent(event, bubbles, true);
  34. return evt;
  35. };
  36. CustomEvent.prototype = window.Event.prototype;
  37. window.CustomEvent = CustomEvent;
  38. }
  39. })();