{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 '_setProperties(target, properties)'
Method: _setProperties(target, properties)
Method Full Name:     Sys$Component$_setProperties(target, properties)
Class: Component
Namespace: Sys
Source File: MicrosoftAjax.debug.js
1   function Sys$Component$_setProperties(target, properties) {
2     /// <summary locid="M:J#Sys.Component._setProperties" />
3     /// <param name="target"></param>
4     /// <param name="properties"></param>
5     var e = Function._validateParams(arguments, [
6     {name: "target"},
7     {name: "properties"}
8     ]);
9     if (e) throw e;
10    var current;
11    var targetType = Object.getType(target);
12    var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement);
13    var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating();
14    if (isComponent) target.beginUpdate();
15    for (var name in properties) {
16      var val = properties[name];
17      var getter = isObject ? null : target["get_" + name];
18      if (isObject || typeof(getter) !== 'function') {
19        var targetVal = target[name];
20        if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name));
21        if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) {
22          target[name] = val;
23        }
24        else {
25          Sys$Component$_setProperties(targetVal, val);
26        }
27      }
28      else {
29        var setter = target["set_" + name];
30        if (typeof(setter) === 'function') {
31          setter.apply(target, [val]);
32        }
33        else if (val instanceof Array) {
34          current = getter.apply(target);
35          if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name));
36          for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) {
37            current[j] = val[i];
38          }
39        }
40        else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) {
41          current = getter.apply(target);
42          if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name));
43          Sys$Component$_setProperties(current, val);
44        }
45        else {
46          throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name));
47        }
48      }
49    }
50    if (isComponent) target.endUpdate();
51  }
This is the JavaScript source for method _setProperties(target, properties) from ASP.NET AJAX Library. Full name for this method is Sys$Component$_setProperties(target, properties). It belongs to the class Component, which is in Sys namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map