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