JQuery Mobile Tutorial: How components are initialized automatically

Source: Internet
Author: User

Article Introduction: This article gives us a deep understanding of how components are automatically initialized in the internal design principles of jquery Mobile.

In this article, let's take a deep look at the internal design principles of jquery Mobile. How components are initialized automatically
(Note: The code snippet in the following example is from version 1.1.0)
Many students who have seen the source code or have used jquery mobile students, we have a very big problem:
-------jquery Mobile provides several components, how do they automatically initialize?
!! Key Note: The following similar automatic initialization process is pagecreate triggered after the call, relevant instructions on Pagecreate can see the relevant introduction of my previous

We pick one of the components: ListView

First Look at a flowchart:

SOURCE Example:

#5193 bound inside the Pagecreate $ (document). Bind ("pagecreate create", function (e) { 	//call Enhancewithin, passed an argument: target ( Dom object) 	
1, $.mobile.listview.prototype.enhancewithin
#1203 enhancewith:function (target,usekeepnative) {// 	call This.enhance 	// Note here: Options.initselector will be read to filter the selection 	
2, enhance
1207 Enhance:function (targets,usekeepnative) { 	var $widgetElements = $ (targets); 	 	//...... 	 	$widgetElements = $.mobile.enhanceable ($widgetElements); 	 	Note: The 	widgetname:name 	//conversion to call plug-in 	//$ (selector)//this.widgetname:listview ===> loaded in #979 row [" ListView "] (); 	


Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.