人民医院前端

yahoo.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*!
  2. Copyright (c) 2011, Yahoo! Inc. All rights reserved.
  3. Code licensed under the BSD License:
  4. http://developer.yahoo.com/yui/license.html
  5. version: 2.9.0
  6. */
  7. export var YAHOO = {};
  8. YAHOO.lang = {
  9. /**
  10. * Utility to set up the prototype, constructor and superclass properties to
  11. * support an inheritance strategy that can chain constructors and methods.
  12. * Static members will not be inherited.
  13. *
  14. * @method extend
  15. * @static
  16. * @param {Function} subc the object to modify
  17. * @param {Function} superc the object to inherit
  18. * @param {Object} overrides additional properties/methods to add to the
  19. * subclass prototype. These will override the
  20. * matching items obtained from the superclass
  21. * if present.
  22. */
  23. extend: function (subc, superc, overrides) {
  24. if (!superc || !subc) {
  25. throw new Error("YAHOO.lang.extend failed, please check that " +
  26. "all dependencies are included.");
  27. }
  28. var F = function () { };
  29. F.prototype = superc.prototype;
  30. subc.prototype = new F();
  31. subc.prototype.constructor = subc;
  32. subc.superclass = superc.prototype;
  33. if (superc.prototype.constructor == Object.prototype.constructor) {
  34. superc.prototype.constructor = superc;
  35. }
  36. if (overrides) {
  37. var i;
  38. for (i in overrides) {
  39. subc.prototype[i] = overrides[i];
  40. }
  41. /*
  42. * IE will not enumerate native functions in a derived object even if the
  43. * function was overridden. This is a workaround for specific functions
  44. * we care about on the Object prototype.
  45. * @property _IEEnumFix
  46. * @param {Function} r the object to receive the augmentation
  47. * @param {Function} s the object that supplies the properties to augment
  48. * @static
  49. * @private
  50. */
  51. var _IEEnumFix = function () { }, ADD = ["toString", "valueOf"];
  52. try {
  53. if (/MSIE/.test(navigator.userAgent)) {
  54. _IEEnumFix = function (r, s) {
  55. for (i = 0; i < ADD.length; i = i + 1) {
  56. var fname = ADD[i], f = s[fname];
  57. if (typeof f === 'function' && f != Object.prototype[fname]) {
  58. r[fname] = f;
  59. }
  60. }
  61. };
  62. }
  63. }
  64. catch (ex) { }
  65. ;
  66. _IEEnumFix(subc.prototype, overrides);
  67. }
  68. }
  69. };