changed our two new custom data helper names to jqmData() and :jqmData()

This commit is contained in:
scottjehl 2011-03-25 17:50:40 -04:00
parent 7d3642f3ab
commit 7503f62a10
19 changed files with 101 additions and 101 deletions

View file

@ -9,7 +9,7 @@
$.fn.buttonMarkup = function( options ){
return this.each( function() {
var el = $( this ),
o = $.extend( {}, $.fn.buttonMarkup.defaults, el.mobileData(), options),
o = $.extend( {}, $.fn.buttonMarkup.defaults, el.jqmData(), options),
// Classes Defined
buttonClass,

View file

@ -21,7 +21,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsibleContain = $el.addClass('ui-collapsible-contain'),
collapsibleHeading = $el.find(o.heading).eq(0),
collapsibleContent = collapsibleContain.wrapInner('<div class="ui-collapsible-content"></div>').find('.ui-collapsible-content'),
collapsibleParent = $el.closest( ":jqdata(role='collapsible-set')" ).addClass('ui-collapsible-set');
collapsibleParent = $el.closest( ":jqmData(role='collapsible-set')" ).addClass('ui-collapsible-set');
//replace collapsibleHeading if it's a legend
if(collapsibleHeading.is('legend')){
@ -62,7 +62,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
.addClass('ui-corner-all');
}
else {
if( collapsibleContain.mobileData('collapsible-last') ){
if( collapsibleContain.jqmData('collapsible-last') ){
collapsibleHeading
.find('a:eq(0), .ui-btn-inner')
.addClass('ui-corner-bottom');
@ -82,7 +82,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsibleHeading.find('.ui-icon').removeClass('ui-icon-minus').addClass('ui-icon-plus');
collapsibleContent.addClass('ui-collapsible-content-collapsed').attr('aria-hidden',true);
if( collapsibleContain.mobileData('collapsible-last') ){
if( collapsibleContain.jqmData('collapsible-last') ){
collapsibleHeading
.find('a:eq(0), .ui-btn-inner')
.addClass('ui-corner-bottom');
@ -100,7 +100,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
collapsibleHeading.find('.ui-icon').removeClass('ui-icon-plus').addClass('ui-icon-minus');
collapsibleContent.removeClass('ui-collapsible-content-collapsed').attr('aria-hidden',false);
if( collapsibleContain.mobileData('collapsible-last') ){
if( collapsibleContain.jqmData('collapsible-last') ){
collapsibleHeading
.find('a:eq(0), .ui-btn-inner')
.removeClass('ui-corner-bottom');
@ -112,16 +112,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
//close others in a set
if( collapsibleParent.length && !collapsibleParent.mobileData("collapsiblebound") ){
if( collapsibleParent.length && !collapsibleParent.jqmData("collapsiblebound") ){
collapsibleParent
.mobileData("collapsiblebound", true)
.jqmData("collapsiblebound", true)
.bind("expand", function( event ){
$(this).find( ".ui-collapsible-contain" )
.not( $(event.target).closest( ".ui-collapsible-contain" ) )
.not( "> .ui-collapsible-contain .ui-collapsible-contain" )
.trigger( "collapse" );
})
var set = collapsibleParent.find( ":jqdata(role=collapsible)" )
var set = collapsibleParent.find( ":jqmData(role=collapsible)" )
set.first()
.find('a:eq(0)')
@ -129,7 +129,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
.find('.ui-btn-inner')
.addClass('ui-corner-top');
set.last().mobileData('collapsible-last', true)
set.last().jqmData('collapsible-last', true)
}
collapsibleHeading

View file

@ -9,7 +9,7 @@ $.fn.controlgroup = function(options){
return this.each(function(){
var o = $.extend({
direction: $( this ).mobileData( "type" ) || "vertical",
direction: $( this ).jqmData( "type" ) || "vertical",
shadow: false
},options);
var groupheading = $(this).find('>legend'),

View file

@ -117,7 +117,7 @@
//mobile version of data() method
//treats namespaced data-attrs the same as non-namespaced ones
$.fn.mobileData = function( prop, value ){
$.fn.jqmData = function( prop, value ){
var pUndef = prop === undefined,
vUndef = value === undefined;
@ -148,11 +148,11 @@
}
};
// Monkey-patching Sizzle to filter the :jqdata selector
// Monkey-patching Sizzle to filter the :jqmData selector
var oldFind = jQuery.find;
jQuery.find = function( selector, context, ret, extra ) {
selector = selector.replace(/:jqdata\(([^)]*)\)/g, "[data-" + (jQuery.mobile.ns || "") + "$1]");
selector = selector.replace(/:jqmData\(([^)]*)\)/g, "[data-" + (jQuery.mobile.ns || "") + "$1]");
return oldFind.call( this, selector, context, ret, extra );
};

View file

@ -16,14 +16,14 @@ $.widget( "mobile.dialog", $.mobile.widget, {
//add ARIA role
.attr("role","dialog")
.addClass('ui-page ui-dialog ui-body-a')
.find( ":jqdata(role=header)" )
.find( ":jqmData(role=header)" )
.addClass('ui-corner-top ui-overlay-shadow')
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>Close</a>" )
.end()
.find('.ui-content:not([class*="ui-body-"])')
.addClass('ui-body-c')
.end()
.find( ".ui-content,:jqdata(role='footer')" )
.find( ".ui-content,:jqmData(role='footer')" )
.last()
.addClass('ui-corner-bottom ui-overlay-shadow');
@ -42,7 +42,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
$targetel = $(e.target).closest("form");
}
if( $targetel.length && !$targetel.mobileData("transition") ){
if( $targetel.length && !$targetel.jqmData("transition") ){
$targetel
.attr("data-" + $.mobile.ns + "transition", $.mobile.urlHistory.getActive().transition )
.attr("data-" + $.mobile.ns + "direction", "reverse");

View file

@ -66,13 +66,13 @@ $.event.special.tap = {
.bind( "mousedown touchstart", function( event ) {
if ( event.which && event.which !== 1 ||
//check if event fired once already by a device that fires both mousedown and touchstart (while supporting both events)
$this.mobileData( "prevEvent") && $this.mobileData( "prevEvent") !== event.type ) {
$this.jqmData( "prevEvent") && $this.jqmData( "prevEvent") !== event.type ) {
return false;
}
//save event type so only this type is let through for a temp duration,
//allowing quick repetitive taps but not duplicative events
$this.mobileData( "prevEvent", event.type );
$this.jqmData( "prevEvent", event.type );
setTimeout(function(){
$this.removeData( "prevEvent" );
}, 800);

View file

@ -11,9 +11,9 @@ $.fn.fixHeaderFooter = function(options){
return this.each(function(){
var $this = $(this);
if( $this.mobileData('fullscreen') ){ $this.addClass('ui-page-fullscreen'); }
$this.find( ".ui-header:jqdata(position='fixed')" ).addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown
$this.find( ".ui-footer:jqdata(position='fixed')" ).addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup
if( $this.jqmData('fullscreen') ){ $this.addClass('ui-page-fullscreen'); }
$this.find( ".ui-header:jqmData(position='fixed')" ).addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown
$this.find( ".ui-footer:jqmData(position='fixed')" ).addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup
});
};
@ -104,12 +104,12 @@ $.fixedToolbars = (function(){
//before page is shown, check for duplicate footer
$('.ui-page').live('pagebeforeshow', function(event, ui){
var page = $(event.target),
footer = page.find( ":jqdata(role='footer'):not(.ui-sticky-footer)" ),
id = footer.mobileData('id');
footer = page.find( ":jqmData(role='footer'):not(.ui-sticky-footer)" ),
id = footer.jqmData('id');
stickyFooter = null;
if (id)
{
stickyFooter = $( ".ui-footer:jqdata(id='" + id + "').ui-sticky-footer" );
stickyFooter = $( ".ui-footer:jqmData(id='" + id + "').ui-sticky-footer" );
if (stickyFooter.length == 0) {
// No sticky footer exists for this data-id. We'll use this
// footer as the sticky footer for the group and then create

View file

@ -14,7 +14,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
input = this.element,
//NOTE: Windows Phone could not find the label through a selector
//filter works though.
label = input.closest("form,fieldset,:jqdata(role='page')").find("label").filter("[for=" + input[0].id + "]"),
label = input.closest("form,fieldset,:jqmData(role='page')").find("label").filter("[for=" + input[0].id + "]"),
inputtype = input.attr( "type" ),
checkedicon = "ui-icon-" + inputtype + "-on",
uncheckedicon = "ui-icon-" + inputtype + "-off";
@ -31,13 +31,13 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
// If there's no selected theme...
if( !this.options.theme ) {
this.options.theme = this.element.mobileData( "theme" );
this.options.theme = this.element.jqmData( "theme" );
}
label
.buttonMarkup({
theme: this.options.theme,
icon: this.element.parents( ":jqdata(type='horizontal')" ).length ? undefined : uncheckedicon,
icon: this.element.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedicon,
shadow: false
});
@ -53,14 +53,14 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
"touchmove": function( event ){
var oe = event.originalEvent.touches[0];
if( label.mobileData("movestart") ){
if( Math.abs( label.mobileData("movestart")[0] - oe.pageX ) > 10 ||
Math.abs( label.mobileData("movestart")[1] - oe.pageY ) > 10 ){
label.mobileData("moved", true);
if( label.jqmData("movestart") ){
if( Math.abs( label.jqmData("movestart")[0] - oe.pageX ) > 10 ||
Math.abs( label.jqmData("movestart")[1] - oe.pageY ) > 10 ){
label.jqmData("moved", true);
}
}
else{
label.mobileData("movestart", [ parseFloat( oe.pageX ), parseFloat( oe.pageY ) ]);
label.jqmData("movestart", [ parseFloat( oe.pageX ), parseFloat( oe.pageY ) ]);
}
},
@ -71,14 +71,14 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
label.removeData("movestart");
if( label.mobileData("etype") && label.mobileData("etype") !== event.type || label.mobileData("moved") ){
if( label.jqmData("etype") && label.jqmData("etype") !== event.type || label.jqmData("moved") ){
label.removeData("etype").removeData("moved");
if( label.mobileData("moved") ){
if( label.jqmData("moved") ){
label.removeData("moved");
}
return false;
}
label.mobileData( "etype", event.type );
label.jqmData( "etype", event.type );
self._cacheVals();
input.attr( "checked", inputtype === "radio" && true || !input.is( ":checked" ) );
self._updateAll();
@ -114,19 +114,19 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
_cacheVals: function(){
this._getInputSet().each(function(){
$(this).mobileData("cacheVal", $(this).is(":checked") );
$(this).jqmData("cacheVal", $(this).is(":checked") );
});
},
//returns either a set of radios with the same name attribute, or a single checkbox
_getInputSet: function(){
return this.element.closest( "form,fieldset,:jqdata(role='page')" )
return this.element.closest( "form,fieldset,:jqmData(role='page')" )
.find( "input[name='"+ this.element.attr( "name" ) +"'][type='"+ this.inputtype +"']" );
},
_updateAll: function(){
this._getInputSet().each(function(){
var dVal = $(this).mobileData("cacheVal");
var dVal = $(this).jqmData("cacheVal");
if( dVal && dVal !== $(this).is(":checked") || this.inputtype === "checkbox" ){
$(this).trigger("change");
}

View file

@ -206,11 +206,11 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
button
.bind( "touchstart" , function( event ){
//set startTouches to cached copy of
$( this ).mobileData( "startTouches", $.extend({}, event.originalEvent.touches[ 0 ]) );
$( this ).jqmData( "startTouches", $.extend({}, event.originalEvent.touches[ 0 ]) );
})
.bind( $.support.touch ? "touchend" : "mouseup" , function( event ){
//if it's a scroll, don't open
if( $( this ).mobileData( "moved" ) ){
if( $( this ).jqmData( "moved" ) ){
$( this ).removeData( "moved" );
} else {
self.open();
@ -220,12 +220,12 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
.bind( "touchmove", function( event ){
//if touch moved enough, set data moved and don't open menu
var thisTouches = event.originalEvent.touches[ 0 ],
startTouches = $( this ).mobileData( "startTouches" ),
startTouches = $( this ).jqmData( "startTouches" ),
deltaX = Math.abs(thisTouches.pageX - startTouches.pageX),
deltaY = Math.abs(thisTouches.pageY - startTouches.pageY);
if( deltaX > 10 || deltaY > 10 ){
$( this ).mobileData( "moved", true );
$( this ).jqmData( "moved", true );
}
});
@ -301,7 +301,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
}
//find placeholder text
if( !this.getAttribute('value') || text.length == 0 || $this.mobileData('placeholder') ){
if( !this.getAttribute('value') || text.length == 0 || $this.jqmData('placeholder') ){
if( o.hidePlaceholderMenuItems ){
classes.push( "ui-selectmenu-placeholder" );
}
@ -420,7 +420,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
//for webos (set lastscroll using button offset)
if( scrollTop == 0 && btnOffset > screenHeight ){
self.thisPage.one('pagehide',function(){
$(this).mobileData('lastScroll', btnOffset);
$(this).jqmData('lastScroll', btnOffset);
});
}

View file

@ -31,7 +31,7 @@ $.widget( "mobile.textinput", $.mobile.widget, {
var focusedEl = input;
//"search" input widget
if( input.is( "[type='search'],:jqdata(type='search')" ) ){
if( input.is( "[type='search'],:jqmData(type='search')" ) ){
focusedEl = input.wrap('<div class="ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-searchfield'+ themeclass +'"></div>').parent();
var clearbtn = $('<a href="#" class="ui-input-clear" title="clear text">clear text</a>')
.tap(function( e ){
@ -87,11 +87,11 @@ $.widget( "mobile.textinput", $.mobile.widget, {
},
disable: function(){
( this.element.attr("disabled",true).is( "[type='search'],:jqdata(type='search')" ) ? this.element.parent() : this.element ).addClass("ui-disabled");
( this.element.attr("disabled",true).is( "[type='search'],:jqmData(type='search')" ) ? this.element.parent() : this.element ).addClass("ui-disabled");
},
enable: function(){
( this.element.attr("disabled", false).is( "[type='search'],:jqdata(type='search')" ) ? this.element.parent() : this.element ).removeClass("ui-disabled");
( this.element.attr("disabled", false).is( "[type='search'],:jqmData(type='search')" ) ? this.element.parent() : this.element ).removeClass("ui-disabled");
}
});
})( jQuery );

View file

@ -68,14 +68,14 @@
// find and enhance the pages in the dom and transition to the first page.
initializePage: function(){
//find present pages
var $pages = $( ":jqdata(role='page')" );
var $pages = $( ":jqmData(role='page')" );
//add dialogs, set data-url attrs
$pages.add( ":jqdata(role='dialog')" ).each(function(){
$pages.add( ":jqmData(role='dialog')" ).each(function(){
var $this = $(this);
// unless the data url is already set set it to the id
if( !$this.mobileData('url') ){
if( !$this.jqmData('url') ){
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) );
}
});

View file

@ -8,9 +8,9 @@
$.mobile.listview.prototype.options.filter = false;
$( ":jqdata(role='listview')" ).live( "listviewcreate", function() {
$( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
var list = $( this ),
listview = list.mobileData( "listview" );
listview = list.jqmData( "listview" );
if ( !listview.options.filter ) {
return;
@ -34,7 +34,7 @@ $( ":jqdata(role='listview')" ).live( "listviewcreate", function() {
for (var i = listItems.length; i >= 0; i--) {
item = $(listItems[i]);
if (item.is("li:jqdata(role=list-divider)")) {
if (item.is("li:jqmData(role=list-divider)")) {
if (!childItems) {
item.hide();
}
@ -52,7 +52,7 @@ $( ":jqdata(role='listview')" ).live( "listviewcreate", function() {
.appendTo( wrapper )
.textinput();
if ($( this ).mobileData( "inset" ) ) {
if ($( this ).jqmData( "inset" ) ) {
wrapper.addClass( "ui-listview-filter-inset" );
}

View file

@ -122,7 +122,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
_itemApply: function( $list, item ) {
// TODO class has to be defined in markup
item.find( ".ui-li-count" )
.addClass( "ui-btn-up-" + ($list.mobileData( "counttheme" ) || this.options.countTheme) + " ui-btn-corner-all" );
.addClass( "ui-btn-up-" + ($list.jqmData( "counttheme" ) || this.options.countTheme) + " ui-btn-corner-all" );
item.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" );
@ -158,7 +158,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
var o = this.options,
$list = this.element,
self = this,
dividertheme = $list.mobileData( "dividertheme" ) || o.dividerTheme,
dividertheme = $list.jqmData( "dividertheme" ) || o.dividerTheme,
li = $list.children( "li" ),
counter = $.support.cssPseudoElement || !$.nodeName( $list[0], "ol" ) ? 0 : 1;
@ -189,12 +189,12 @@ $.widget( "mobile.listview", $.mobile.widget, {
return;
}
var itemTheme = item.mobileData("theme") || o.theme;
var itemTheme = item.jqmData("theme") || o.theme;
var a = item.find( "a" );
if ( a.length ) {
var icon = item.mobileData("icon");
var icon = item.jqmData("icon");
item
.buttonMarkup({
@ -212,7 +212,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
itemClass += " ui-li-has-alt";
var last = a.last(),
splittheme = $list.mobileData( "splittheme" ) || last.mobileData( "theme" ) || o.splitTheme;
splittheme = $list.jqmData( "splittheme" ) || last.jqmData( "theme" ) || o.splitTheme;
last
.appendTo(item)
@ -232,11 +232,11 @@ $.widget( "mobile.listview", $.mobile.widget, {
corners: true,
theme: splittheme,
iconpos: "notext",
icon: $list.mobileData( "spliticon" ) || last.mobileData( "icon" ) || o.splitIcon
icon: $list.jqmData( "spliticon" ) || last.jqmData( "icon" ) || o.splitIcon
} ) );
}
} else if ( item.mobileData( "role" ) === "list-divider" ) {
} else if ( item.jqmData( "role" ) === "list-divider" ) {
itemClass += " ui-li-divider ui-btn ui-bar-" + dividertheme;
item.attr( "role", "heading" );
@ -307,18 +307,18 @@ $.widget( "mobile.listview", $.mobile.widget, {
_createSubPages: function() {
var parentList = this.element,
parentPage = parentList.closest( ".ui-page" ),
parentId = parentPage.mobileData( "url" ),
parentId = parentPage.jqmData( "url" ),
o = this.options,
self = this,
persistentFooterID = parentPage.find( ":jqdata(role='footer')" ).mobileData( "id" );
persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" );
$( parentList.find( "ul, ol" ).toArray().reverse() ).each(function( i ) {
var list = $( this ),
parent = list.parent(),
title = $.trim(parent.contents()[ 0 ].nodeValue) || parent.find('a:first').text(),
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i),
theme = list.mobileData( "theme" ) || o.theme,
countTheme = list.mobileData( "counttheme" ) || parentList.mobileData( "counttheme" ) || o.countTheme,
theme = list.jqmData( "theme" ) || o.theme,
countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme,
newPage = list.wrap( "<div data-" + $.mobile.ns + "role='page'><div data-" + $.mobile.ns + "role='content'></div></div>" )
.parent()
.before( "<div data-" + $.mobile.ns + "role='header' data-" + $.mobile.ns + "theme='" + o.headerTheme + "'><div class='ui-title'>" + title + "</div></div>" )

View file

@ -13,7 +13,7 @@ $.widget( "mobile.navbar", $.mobile.widget, {
_create: function(){
var $navbar = this.element,
$navbtns = $navbar.find("a"),
iconpos = $navbtns.filter( ":jqdata(icon)").length ? this.options.iconpos : undefined;
iconpos = $navbtns.filter( ":jqmData(icon)").length ? this.options.iconpos : undefined;
$navbar
.addClass('ui-navbar')

View file

@ -376,12 +376,12 @@
//support deep-links to generated sub-pages
if( url.indexOf( "&" + $.mobile.subPageUrlKey ) > -1 ){
to = $( ":jqdata(url='" + url + "')" );
to = $( ":jqmData(url='" + url + "')" );
}
if( from ){
//set as data for returning to that spot
from.mobileData( "lastScroll", currScroll);
from.jqmData( "lastScroll", currScroll);
//trigger before show/hide events
from.data( "page" )._trigger( "beforehide", null, { nextPage: to } );
}
@ -404,16 +404,16 @@
removeActiveLinkClass();
//jump to top or prev scroll, sometimes on iOS the page has not rendered yet. I could only get by this with a setTimeout, but would like to avoid that.
$.mobile.silentScroll( to.mobileData( "lastScroll" ) );
$.mobile.silentScroll( to.jqmData( "lastScroll" ) );
reFocus( to );
//trigger show/hide events
if( from ){
from.mobileData( "page" )._trigger( "hide", null, { nextPage: to } );
from.jqmData( "page" )._trigger( "hide", null, { nextPage: to } );
}
//trigger pageshow, define prevPage as either from or empty jQuery obj
to.mobileData( "page" )._trigger( "show", null, { prevPage: from || $("") } );
to.jqmData( "page" )._trigger( "show", null, { prevPage: from || $("") } );
//set "to" as activePage
$.mobile.activePage = to;
@ -482,7 +482,7 @@
function enhancePage(){
//set next page role, if defined
if ( nextPageRole || to.mobileData('role') === 'dialog' ) {
if ( nextPageRole || to.jqmData('role') === 'dialog' ) {
url = urlHistory.getActive().url + dialogHashKey;
if(nextPageRole){
to.attr( "data-" + $.mobile.ns + "role", nextPageRole );
@ -496,7 +496,7 @@
//if url is a string
if( url ){
to = $( ":jqdata(url='" + url + "')" );
to = $( ":jqmData(url='" + url + "')" );
fileUrl = path.getFilePath(url);
}
else{ //find base url of element, if avail
@ -560,7 +560,7 @@
//workaround to allow scripts to execute when included in page divs
all.get(0).innerHTML = html;
to = all.find( ":jqdata(role='page'), :jqdata(role='dialog')" ).first();
to = all.find( ":jqmData(role='page'), :jqmData(role='dialog')" ).first();
//rewrite src and href attrs to use a base url
if( !$.support.dynamicBaseTag ){
@ -614,7 +614,7 @@
if( !$.mobile.ajaxEnabled ||
//TODO: deprecated - remove at 1.0
!$.mobile.ajaxFormsEnabled ||
$(this).is( ":jqdata(ajax='false')" ) ){ return; }
$(this).is( ":jqmData(ajax='false')" ) ){ return; }
var type = $(this).attr("method"),
url = path.clean( $(this).attr( "action" ) );
@ -674,10 +674,10 @@
hasTarget = $this.is( "[target]" ),
//if data-ajax attr is set to false, use the default behavior of a link
hasAjaxDisabled = $this.is( ":jqdata(ajax='false')" );
hasAjaxDisabled = $this.is( ":jqmData(ajax='false')" );
//if there's a data-rel=back attr, go back in history
if( $this.is( ":jqdata(rel='back')" ) ){
if( $this.is( ":jqmData(rel='back')" ) ){
window.history.back();
return false;
}
@ -711,11 +711,11 @@
}
else {
//use ajax
var transition = $this.mobileData( "transition" ),
direction = $this.mobileData("direction"),
var transition = $this.jqmData( "transition" ),
direction = $this.jqmData("direction"),
reverse = (direction && direction === "reverse") ||
// deprecated - remove by 1.0
$this.mobileData( "back" );
$this.jqmData( "back" );
//this may need to be more specific as we use data-rel more
nextPageRole = $this.attr( "data-" + $.mobile.ns + "rel" );

View file

@ -32,7 +32,7 @@ $.widget( "mobile.page", $.mobile.widget, {
var $elem = this.element,
o = this.options;
this.keepNative = ":jqdata(role='none'), :jqdata(role='nojs')" + (o.keepNative ? ", " + o.keepNative : "");
this.keepNative = ":jqmData(role='none'), :jqmData(role='nojs')" + (o.keepNative ? ", " + o.keepNative : "");
if ( this._trigger( "beforeCreate" ) === false ) {
return;
@ -41,21 +41,21 @@ $.widget( "mobile.page", $.mobile.widget, {
//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.
$elem.find( ":jqdata(role='page'), :jqdata(role='content')" ).andSelf().each(function() {
$(this).addClass( "ui-" + $(this).mobileData( $.mobile.ns + "role" ) );
$elem.find( ":jqmData(role='page'), :jqmData(role='content')" ).andSelf().each(function() {
$(this).addClass( "ui-" + $(this).jqmData( $.mobile.ns + "role" ) );
});
$elem.find( "[data-" + $.mobile.ns + "role='nojs']" ).addClass( "ui-nojs" );
// pre-find data els
var $dataEls = $elem.find( ":jqdata(role)" ).andSelf().each(function() {
var $dataEls = $elem.find( ":jqmData(role)" ).andSelf().each(function() {
var $this = $( this ),
role = $this.mobileData( "role" ),
theme = $this.mobileData( "theme" );
role = $this.jqmData( "role" ),
theme = $this.jqmData( "theme" );
//apply theming and markup modifications to page,header,content,footer
if ( role === "header" || role === "footer" ) {
$this.addClass( "ui-bar-" + (theme || $this.parent( ":jqdata(role='page')" ).mobileData( "theme" ) || "a") );
$this.addClass( "ui-bar-" + (theme || $this.parent( ":jqmData(role='page')" ).jqmData( "theme" ) || "a") );
// add ARIA role
$this.attr( "role", role === "header" ? "banner" : "contentinfo" );
@ -76,8 +76,8 @@ $.widget( "mobile.page", $.mobile.widget, {
// auto-add back btn on pages beyond first view
if ( o.addBackBtn && role === "header" &&
$( ".ui-page" ).length > 1 &&
$elem.mobileData( "url" ) !== $.mobile.path.stripHash( location.hash ) &&
!leftbtn && $this.mobileData( "backbtn" ) !== false ) {
$elem.jqmData( "url" ) !== $.mobile.path.stripHash( location.hash ) &&
!leftbtn && $this.jqmData( "backbtn" ) !== false ) {
$( "<a href='#' class='ui-btn-left' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "icon='arrow-l'>"+ o.backBtnText +"</a>" ).prependTo( $this );
}
@ -121,13 +121,13 @@ $.widget( "mobile.page", $.mobile.widget, {
this._enhanceControls();
//links in bars, or those with data-role become buttons
$elem.find( ":jqdata(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a" )
$elem.find( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a" )
.not( ".ui-btn" )
.not(this.keepNative)
.buttonMarkup();
$elem
.find(":jqdata(role='controlgroup')")
.find(":jqmData(role='controlgroup')")
.controlgroup();
//links within content areas
@ -194,11 +194,11 @@ $.widget( "mobile.page", $.mobile.widget, {
nonNativeControls
.filter( "input, select" )
.filter( ":jqdata(role='slider'), :jqdata(type='range')" )
.filter( ":jqmData(role='slider'), :jqmData(type='range')" )
.slider();
nonNativeControls
.filter( "select:not(:jqdata(role='slider'))" )
.filter( "select:not(:jqmData(role='slider'))" )
.selectmenu();
}
});

View file

@ -11,7 +11,7 @@ $.widget( "mobile.widget", {
var elem = this.element,
options = {};
$.each( this.options, function( option ) {
var value = elem.mobileData( option.replace( /[A-Z]/g, function( c ) {
var value = elem.jqmData( option.replace( /[A-Z]/g, function( c ) {
return "-" + c.toLowerCase();
} ) );
if ( value !== undefined ) {

View file

@ -154,11 +154,11 @@
});
test( "pages without a data-url attribute have it set to their id", function(){
same($("#foo").mobileData('url'), "foo");
same($("#foo").jqmData('url'), "foo");
});
test( "pages with a data-url attribute are left with the original value", function(){
same($("#bar").mobileData('url'), "bak");
same($("#bar").jqmData('url'), "bak");
});
asyncTest( "pageLoading doesn't add the dialog to the page when loading message is false", function(){

View file

@ -256,10 +256,10 @@
same($searchPage.find('li[style^="display: none;"]').length, 4);
//there should be two list entries that are list dividers and hidden
same($searchPage.find('li:jqdata(role=list-divider)[style^="display: none;"]').length, 2);
same($searchPage.find('li:jqmData(role=list-divider)[style^="display: none;"]').length, 2);
//there should be two list entries that are not list dividers and hidden
same($searchPage.find('li:not(:jqdata(role=list-divider))[style^="display: none;"]').length, 2);
same($searchPage.find('li:not(:jqmData(role=list-divider))[style^="display: none;"]').length, 2);
start();
}, 1000);
});
@ -291,9 +291,9 @@
}, 500);
setTimeout(function() {
same($page.find('li:jqdata(role=list-divider)[style^="display: none;"]').length, 2);
same($page.find('li:jqdata(role=list-divider)[style^="display: none;"] + li:not(:jqdata(role=list-divider))[style^="display: none;"]').length, 2);
same($page.find('li:jqdata(role=list-divider):not([style^="display: none;"]) + li:not(:jqdata(role=list-divider)):not([style^="display: none;"])').length, 2);
same($page.find('li:jqmData(role=list-divider)[style^="display: none;"]').length, 2);
same($page.find('li:jqmData(role=list-divider)[style^="display: none;"] + li:not(:jqmData(role=list-divider))[style^="display: none;"]').length, 2);
same($page.find('li:jqmData(role=list-divider):not([style^="display: none;"]) + li:not(:jqmData(role=list-divider)):not([style^="display: none;"])').length, 2);
start();
}, 1000);
});