bubbling may be marked as blocking the occurrence of default events; this function can reflect the correct value of the flag for blocking this. isDefaultPrevented = (src. defaultPrevented | src. returnValue = false | src. getPreventDefault src. getPreventDefault ())? ReturnTrue: returnFalse; // src is the event type} else {this. type = src;} // Add the explicitly provided features to the event object if (props) {jQuery. extend (this, props);} // create a timestamp if the input event contains m
, call if(special.remove) {Special.remove.call (Elem, handleobj); } } } //Remove Generic event handler if we removed something and no more handlers exist //(avoids potential for endless recursion during removal of special event handlers) if(Origcount !)handlers.length) {if(!special.teardown | | special.teardown.call (elem, namespaces, elemdata.handle) = = =false) {jquery.removeevent (Elem, type, elemdata.handle); } //Remove the Eve
use the index of the string to participate in some operations ("2" + 1 = "21"), the result of the operation may be inconsistent with the expected.Not only will the elements of the array itself be traversed, but the additional (expando) elements added by the user will also be traversed, such as an array having such a property myarray.name, then a index= "name" will appear in a loop. Furthermore, even properties on the chain of an array prototype may b
is dealing with a JSON request if (!controllercontext.httpcontext.request.contenttype.star Tswith ("Application/json", stringcomparison.ordinalignorecase)) return null; Get a generic stream reader (get reader for the HTTP stream) var streamReader = new StreamReader (CONTROLLERC Ontext. HttpContext.Request.InputStream); ConVert Stream Reader to a JSON Text reader var jsonreader = new JsonTextReader (StreamReader); Tell JSON to read if (!jsonreader.read ()) return
Explorer, or Jav Ascript engine and Firefox's XPCOM infrastructure).
Here are some rules of thumb to avoid memory leaks:
Use an event system to attach an event handler function
The most common circular reference mode [DOM element--> event handler--> closure Scope--> DOM] is discussed in this MSDN blog article. To avoid this problem, you can use a rigorously tested event system to attach event-handling functions such as Google doctype, Dojo, or JQuery.
In addition, the use of inline (inline)
object's properties.
Second, the overall structure:
Data cache
Jquery.extend ({
//Global Cached Object Cache
: {},//
unique ID seed
uuid:0,
//Unique identification of each jQuery copy in the page
expando: "JQuery" + (JQuery.fn.jquery + math.random ()). Replace (/\d/g, ""),
//whether there is an associated data
hasdata:function ( {},
//set, read custom data or internal data
data:function (elem, name, data, pvt) {
//collection of all anchor objects scrip TS//All Script object collection frames//All frame objects, this should be the same as Window.frames embeds /collection of all Embed objects plugins Collection of all Plugin objects stylesheets//Style sheet Collection title//page title Body//body Object Activeelement//Current element DesignMode//design mode with input focus, optional value: Inherit on off selection//current selection Readys Tate//page read status: Uninitialized, lo
application of many controls. It's easy to put your control in a div and set the overflow property to auto
6. Dynamically creating controls
With the placeholder control, this stuff is used even more in asp.net 2.0 Mutil-view and master page.
Sub Page_Load ()Dim I as IntegerFor I=0 to 4Dim MyUserControl as ControlMyUserControl = Page.LoadControl ("Foo.ascx")PLACEHOLDER1.CONTROLS.ADD (MyUserControl)PLACEHOLDER1.CONTROLS.ADD (New LiteralControl (""))Next IEnd Sub
7. Use of client code
1
attach event-handling functions such as Google doctype, Dojo, or JQuery.
In addition, the use of inline (inline) event-handling functions in IE can result in another type of leakage. This is not a common circular reference leak, but a leak of a temporary anonymous script object in memory. For more information, see the "DOM Insertion Order leak model" for understanding and resolving IE leak mode (understanding and solving Internet Explorer leak Patterns) (DOM insertion orders leak M Odel) "sect
only a fixed place for you to show it. At this point you can use the following strokes, automatic scroll bar, and the application of many controls. It's easy to put your control in a div and set the overflow property to auto
6. Dynamically creating controls
With the placeholder control, this stuff is used even more in asp.net 2.0 Mutil-view and master page.
Sub Page_Load ()
Dim I as Integer
For I=0 to 4
Dim MyUserControl as Control
MyUserControl = Page.LoadControl ("Foo.ascx")
PLACEHOLDER1.
instance:privatememberclass=new privatememberclass ();
Trace (Instance.privateprop);
A compilation error occurs at this time. This is a common mistake many people always ask why private properties can be accessed by instances, and now you know.
Dynamic classes allow for the dynamic extension of a class (for example, by allowing new properties or methods to be added). This is called expando in a JScript.NET program, and if a class is not a dynamic cla
() = = ' No such method ' Bird.metaClass.getPro Perty = {Name->def metaproperty = Bird.metaClass.getMetaProperty (name) Metaproperty?metaproperty.getproperty ( Delegate): ' No such property '}def B = new Bird () assert b.name = ' tweety ' assert b.filling = = ' No such property ' This example mainly shows that we can not only use the expando feature to add method attributes and constructor methods, but we can also overwrite existing methods. Finally,
letter behind it and select "Store as Global Variable"
Then, a tempX object is displayed in the console, which is the stuff with the cache. Suppose it is called temp1.
That temp1 has a get method that can directly obtain its cache object. Assume that you want to view the id of the object bound to the event is clickMe. Then executetemp1.get($('#clickMe').get(0))(Ortemp1.get(document.querySelector('#clickMe'))) It will display something equivalent to jquery1.x above.
The method is the same as
know the window, what about the document? Does the mshtml namespace provide corresponding interfaces? After discovery, document implements the following two interfaces:
[Guid ("identifier")] [TypeLibType (4160)] public interface IHTMLDocument2: IHTMLDocument {[DispId (1005)] IHTMLElement activeElement {get;} [DispId (1022)] dynamic alinkColor {get; set;} [DispId (1003)] IHTMLElementCollection all {get;} [DispId (1007)] IHTMLElementCollection anchors {get;} [DispId (1008)] IHTMLElementCollecti
, we can see that a callback parameter is passed in the called url to tell the server that my local callback function is called remoteLoad. Therefore, please pass the query result to this function for calling.
B.
JQuery Processing
In jQuery ajax, jsonp and jsonpCallback specify the "callback" and "remoteLoad" values respectively.
The default value of jsonp is "callback", and the default value of jsonpCallback is a timestamp field (jQuery. expando +
())? ReturnTrue: returnFalse; // src is the event type} else {this. type = src;} // Add the explicitly provided features to the event object if (props) {jQuery. extend (this, props);} // create a timestamp if the input event contains more than one this. timeStamp = src src. timeStamp | jQuery. now (); // The flag event has fixed this [jQuery. expando] = true ;};View Code
The event object created in step 1
Step 2: Identify the event type and copy
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.