{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method '_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName)'
Method: _validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName)
Method Full Name:     Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName)
Class: Function
Namespace: Global (MicrosoftAjax.debug.js)
Source File: MicrosoftAjax.debug.js
1   Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) {
2     var e;
3     if (typeof(param) === "undefined") {
4       if (mayBeNull) {
5         return null;
6       }
7       else {
8         e = Error.argumentUndefined(paramName);
9         e.popStackFrame();
10        return e;
11      }
12    }
13    if (param === null) {
14      if (mayBeNull) {
15        return null;
16      }
17      else {
18        e = Error.argumentNull(paramName);
19        e.popStackFrame();
20        return e;
21      }
22    }
23    if (expectedType && expectedType.__enum) {
24      if (typeof(param) !== 'number') {
25        e = Error.argumentType(paramName, Object.getType(param), expectedType);
26        e.popStackFrame();
27        return e;
28      }
29      if ((param % 1) === 0) {
30        var values = expectedType.prototype;
31        if (!expectedType.__flags || (param === 0)) {
32          for (var i in values) {
33            if (values[i] === param) return null;
34          }
35        }
36        else {
37          var v = param;
38          for (var i in values) {
39            var vali = values[i];
40            if (vali === 0) continue;
41            if ((vali & param) === vali) {
42              v -= vali;
43            }
44            if (v === 0) return null;
45          }
46        }
47      }
48      e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName()));
49      e.popStackFrame();
50      return e;
51    }
52    if (expectedDomElement) {
53      var val;
54      if (typeof(param.nodeType) !== 'number') {
55        var doc = param.ownerDocument || param.document || param;
56        if (doc != param) {
57          var w = doc.defaultView || doc.parentWindow;
58          val = (w != param) && !(w.document && param.document && (w.document === param.document));
59        }
60        else {
61          val = (typeof(doc.body) === 'undefined');
62        }
63      }
64      else {
65        val = (param.nodeType === 3);
66      }
67      if (val) {
68        e = Error.argument(paramName, Sys.Res.argumentDomElement);
69        e.popStackFrame();
70        return e;
71      }
72    }
73    if (expectedType && !expectedType.isInstanceOfType(param)) {
74      e = Error.argumentType(paramName, Object.getType(param), expectedType);
75      e.popStackFrame();
76      return e;
77    }
78    if (expectedType === Number && expectedInteger) {
79      if ((param % 1) !== 0) {
80        e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger);
81        e.popStackFrame();
82        return e;
83      }
84    }
85    return null;
86  }
This is the JavaScript source for method _validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) from ASP.NET AJAX Library. Full name for this method is Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName). It belongs to the class Function, which is in Global (MicrosoftAjax.debug.js) namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map