A long time ago, I still in the cnblogs inside the time to ask a question (just looked for a half a day did not find). I wonder if anyone has found that the jquery********* attribute is added to the DOM after "select" with the jquery selector.First of all, "1294122065250" in jQuery1294122065250 is actually a time stamp. Look at the source code for jquery.var expando = "JQuery" + Now (), uuid = 0, windowdata = {};Since closures are used, each jquery ob
The static function jquery. parsexml is added to provide browser-compatible conversion from string to XML documents.
There are many logic web pages for this function, and jquery is not particularly specific. There are roughly two types of functions:
For standard browsers, use the domparser object:VaR parser = new domparser (); var xml = parser. parsefromstring (text, 'text/html ');
For IE, use Microsoft. xmldom object:VaR parser = new activexobject ('Microsoft. xmldom '); parser. a
(String, Number), do not put anything else in DOM expando or property. Of course, if you can ensure that it is cleared in time, it is an exception.This is the most important golden rule. Put things in DOM expando, you will find it very convenient, and then get it with $ (), but never do this. Really, I know what you're thinking, and now I already think about it. yes, JS objects are put in DOM
Mark DavisMicrosoft Corporation
Abstract:This article describes the significant impact of some DHTML functions on performance and provides some tips for improving DHTML page performance.
Directory
IntroductionBatch Process DHTML changesUse innertextUse Dom to add a single elementExtend the options in the select ElementUpdate a table with DomWrite Once, use multiple timesDo not use dynamic attributes too muchData Binding is very effectiveDo not set the
The operations on events are nothing more than addEvent, fireEvent, and removeEvent. Generally, lib extends the functions provided by the browser to solve problems such as compatibility Memory leakage. The third problem is how to get the domReady status.6.1 event packages
Browser event compatibility is a headache. The IE event is in the global window, while the mozilla event is passed in to the callback function as the event Source parameter. There are also many event handling methods.
Jquery pr
(String, Number), do not put anything else in DOM expando or property. Of course, if you can ensure that it is cleared in time, it is an exception.
This is the most important golden rule. Put things in DOM expando, you will find it very convenient, and then get it with $ (), but never do this. Really, I know what you're thinking, and now I already think about it. yes, JS objects are put in DOM
C # dynamic type and Anonymous class,A simple example of dynamic type
Dynamic expando = new System. Dynamic. ExpandoObject (); // readable and writable dynamic fieldExpando. Id = 1;Expando. Name = "Test ";String json = Utils. ConvertJson. JsonEncode (expando); // output {Id: 1, Name: 'test '}
// Add fields dynamically
List
Dynamic dobj = new System. Dynamic. Exp
If:
Dynamic expando = new ExpandoObject ();
D.someprop=somevalueorclass;
And then, we're in the controller:
return new Jsonresult (expando);
Well, our front desk will get:
[{' Key ': ' Someprop ', ' Value ': Somevalueorclass}]
And in fact, we know that JSON-formatted content should be like this:
{Someprop:somevalueorclass}
So, we need a custom serializer, which should be as follows:
public class
overflow3: Data exposure, easy to be rewritten directlyHow to solve these problems? jquery introduces the concept of data Objects
First, regardless of how the interior is implemented, first look at the properties of the nodeOne more gray custom key with valueGray means that it is not possible to enumerate through a for, this setting is in ES5, which is supported directly by the API.//If not, create oneif(!unlock) {Unlock= data.uid++; //Secure it in a non-enumerable, non-writable Property
parameters at the place of the call;
3, in the event method, the first use of $.event.fix to convert old events to new event references;
4, after the event method is used after the compatible processing of event object methods and properties.
Ii. Use of examples
Copy Code code as follows:
Three, JQuery $.event.fix method defines the original code reference
Copy Code code as follows:
Fix:function (Event)
{
if (Event[expando
accept data for non-element nodes at modern browsers,//But we should not, #8335.
Always return a empty object. if (Acceptdata (owner) {//If It is a node unlikely to being stringify-ed or looped over//use plain a
Ssignment if (owner.nodetype) {owner[This.expando] = value;
Otherwise secure it non-enumerable property//Configurable must is true to allow the Deleted when the data is removed} else {Object.defineproperty (owner, This.expando, {VA
Lue:value, configurable:
In jquery, there's this wayvar obj = {}; $.data (obj,' name ', ' Jake '); Console.info ($.data (obj,' name ')); Console.info (obj);Output resultsSo, $.data (), in which there are three parameters, is assigned, there are two parameters is the value, the consistent jquery style.Here, imitate. var$data = (function(){ varexpando = ' jQuery ' +string (Math.random ()). Replace (/\d/g, "); functionGetCache (cache) {returncache[expando]=cac
(){};// Code 3Var f = function g () {}; f === g; // false f. expando = 'foo'; g. expando; // undefined// Code 4Var f = function g () {return 1 ;}; if (false) {f = function g () {return 2 ;};} g (); // 2Say:Code 1 and 2 indicate that this object exists no matter where function g is called after function g is declared. It means that declaring a function in this way is irrelevant to not copying the value assi
method is to add an attribute selector before the existing selector: [id = XXX], * XXX is the id of the context. if the context itself does not set an id, the default value is expando. */If (support. qsa (! RbuggyQSA |! RbuggyQSA. test (selector) {nid = old = expando; newContext = context; // If context is document, newSelector is taken from selector, otherwise, falsenewSelector = nodeType = 9 selector; /
cannot be completely deleted. The related data continues until the window object is closed. Similarly, these problems also exist in the event object, because the event processor (handlers) also uses this method for storage.
The simplest way to solve this problem is to store the data to a new attribute of the local object. That is:
//...If (elem. nodeType ){Cache [id] = dataObject;Elem [expando] = id;} Else {Elem [
method is to add an attribute selector before the existing selector: [id = XXX], * XXX is the id of the context. If the context itself does not set an id, the default value is expando. */If (support. qsa (! RbuggyQSA |! RbuggyQSA. test (selector) {nid = old = expando; newContext = context; // If context is document, newSelector is taken from selector, otherwise, falsenewSelector = nodeType = 9 selector; /
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.