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 "] (); 	

Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.