(function ( $ ) {

$.widget( "mobile.page", $.mobile.widget, {
	options: {},
	
	_create: function() {
		this._trigger( "beforeCreate" );
		
		//some of the form elements currently rely on the presence of ui-page and ui-content
		// classes so we'll handle page and content roles outside of the main role processing
		// loop below.
		this.element.find( "[data-role=page],[data-role=content]" ).andSelf().each(function() {
			var $this = $( this );
			$this.addClass( "ui-" + $this.data( "role" ) );
		});
		
		this.element.find( "[data-role=nojs]" ).addClass( "ui-nojs" );
		this._enchanceControls();
		
		//pre-find data els
		var $dataEls = this.element.find( "[data-role]" ).andSelf().each(function() {
			var $this = $( this ),
				role = $this.data( "role" ),
				theme = $this.data( "theme" );
			
			//apply theming and markup modifications to page,header,content,footer
			if ( role === "header" || role === "footer" ) {
				$this.addClass( "ui-bar-" + (theme || "a") );
				
				//right,left buttons
				var $headeranchors = $this.children( "a" ),
					leftbtn = $headeranchors.filter( ".ui-btn-left" ).length,
					rightbtn = $headeranchors.filter( ".ui-btn-right" ).length;
				
				if ( !leftbtn ) {
					leftbtn = $headeranchors.eq( 0 ).addClass( "ui-btn-left" ).length;
				}
				if ( !rightbtn ) {
					rightbtn = $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;
				}
				
				//auto-add back btn on pages beyond first view
				if ( $.mobile.addBackBtn && role === "header" && $.mobile.urlStack.length > 1 && !leftbtn ) {
					$( "<a href='#' class='ui-btn-left' data-icon='arrow-l'>Back</a>" )
						.tap(function() {
							history.back();
							return false;
						})
						.click(function() {
							return false;
						})
						.prependTo( $this );
				}
				
				$headeranchors.buttonMarkup();
				
				//page title	
				$this.children( ":header" ).addClass( "ui-title" );
			} else if ( role === "page" || role === "content" ) {
				$this.addClass( "ui-body-" + (theme || "c") );
			}
			
			switch(role) {
			case "header":
			case "footer":
			case "page":
			case "content":
				$this.addClass( "ui-" + role );
				break;
			case "collapsible":
			case "fieldcontain":
			case "navbar":
			case "listview":
			case "dialog":
			case "ajaxform":
				$this[ role ]();
				break;
			case "controlgroup":
				// FIXME for some reason this has to come before the form control stuff (see above)
				$this.controlgroup({
					direction: $this.data( "type" )
				});
				break;
			}
		});
		
		//links in bars, or those with data-role become buttons
		$dataEls
			.filter( "[data-role=button]" )
			.add( ".ui-bar a, .ui-footer a, .ui-header a")
			.not( ".ui-btn" )
			.buttonMarkup();
		
		//links within content areas
		this.element.find( ".ui-body a:not(.ui-btn):not(.ui-link-inherit)" )
			.addClass( "ui-link" );
		
		//fix toolbars
		this.element.fixHeaderFooter();
	},
	
	_enchanceControls: function() {
		// degrade inputs to avoid poorly implemented native functionality
		this.element.find( "input" ).each(function() {
			var type = this.getAttribute( "type" );
			if ( $.mobile.degradeInputs[ type ] ) {
				$( this ).replaceWith(
					$( "<div>" ).html( $(this).clone() ).html()
						.replace( /type="([a-zA-Z]+)"/, "data-type='$1'" ) );
			}
		});
		
		// enchance form controls
		this.element
			.find( ":radio, :checkbox" )
			.customCheckboxRadio();
		this.element
			.find( ":button, :submit, :reset, :image" )
			.not( ".ui-nojs" )
			.customButton();
		this.element
			.find( "input, textarea" )
			.not( ":radio, :checkbox, :button, :submit, :reset, :image" )
			.customTextInput();
		this.element
			.find( "input, select" )
			.filter( "[data-role=slider], [data-type=range]" )
			.slider();
		this.element
			.find( "select" )
			.not( "[data-role=slider]" )
			.customSelect();
	}
});

})( jQuery );

@@ -97,16 +97,21 @@
 n() %7B%0A%09%09
+if ( 
 this._tr
@@ -133,17 +133,45 @@
 reate%22 )
-;
+ === false ) %7B%0A%09%09%09return;%0A%09%09%7D
 %0A%09%09%0A%09%09//

Allow preventing the default initialization for pages by canceling the pagebeforecreate event. Fixes #105.