{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 'create(type, properties, events, references, element)'
Method: create(type, properties, events, references, element)
Method Full Name:     Sys$Component$create(type, properties, events, references, element)
Class: Component
Namespace: Sys
Source File: MicrosoftAjax.debug.js
1   var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) {
2     /// <summary locid="M:J#Sys.Component.create" />
3     /// <param name="type" type="Type"></param>
4     /// <param name="properties" optional="true" mayBeNull="true"></param>
5     /// <param name="events" optional="true" mayBeNull="true"></param>
6     /// <param name="references" optional="true" mayBeNull="true"></param>
7     /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
8     /// <returns type="Sys.UI.Component"></returns>
9     var e = Function._validateParams(arguments, [
10    {name: "type", type: Type},
11    {name: "properties", mayBeNull: true, optional: true},
12    {name: "events", mayBeNull: true, optional: true},
13    {name: "references", mayBeNull: true, optional: true},
14    {name: "element", mayBeNull: true, domElement: true, optional: true}
15    ]);
16    if (e) throw e;
17    if (!type.inheritsFrom(Sys.Component)) {
18      throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
19    }
20    if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
21      if (!element) throw Error.argument('element', Sys.Res.createNoDom);
22    }
23    else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom);
24    var component = (element ? new type(element): new type());
25    var app = Sys.Application;
26    var creatingComponents = app.get_isCreatingComponents();
27    component.beginUpdate();
28    if (properties) {
29      Sys$Component$_setProperties(component, properties);
30    }
31    if (events) {
32      for (var name in events) {
33        if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name));
34        if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction);
35        component["add_" + name](events[name]);
36      }
37    }
38    if (component.get_id()) {
39      app.addComponent(component);
40    }
41    if (creatingComponents) {
42      app._createdComponents[app._createdComponents.length] = component;
43      if (references) {
44        app._addComponentToSecondPass(component, references);
45      }
46      else {
47        component.endUpdate();
48      }
49    }
50    else {
51      if (references) {
52        Sys$Component$_setReferences(component, references);
53      }
54      component.endUpdate();
55    }
56    return component;
57  }
This is the JavaScript source for method create(type, properties, events, references, element) from ASP.NET AJAX Library. Full name for this method is Sys$Component$create(type, properties, events, references, element). 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