Revert "Changed behavior of .jqmData() only when called with no argument. It now returns undefined as per discussion on #jquerymobile-dev"

This reverts commit 43c5037bd8.
This commit is contained in:
gseguin 2011-09-16 09:12:43 -07:00
parent 43c5037bd8
commit 6dbdbfe4bc
2 changed files with 1 additions and 6 deletions

View file

@ -150,7 +150,6 @@ $.mobile.loadPage( "searchresults.php", {
<dl>
<dt><code>&#183;</code> Arguments:</dt>
<dd>See jQuery's <a href="http://api.jquery.com/jQuery.data/">data</a> and <a href="http://api.jquery.com/jQuery.removeData/">removeData</a> methods</dd>
<strong>Note: </strong>Calling jqmData() with no argument will return <code>undefined</code>. This behavior is subject to change in future versions.
<dt><code>&#183;</code> Also:</dt>
<dd>When finding elements by their jQuery Mobile data attribute, please use the custom selector <code>:jqmData()</code>, as it automatically incorporates namespaced data attributes into the lookup when they are in use. For example, instead of calling <code>$("div[data-role='page']")</code>, you should use <code>$("div:jqmData(role='page')")</code>, which internally maps to <code>$("div[data-"+ $.mobile.ns +"role='page']")</code> without forcing you to concatenate a namespace into your selectors manually.</dd>
</dl>

View file

@ -128,11 +128,7 @@
// Mobile version of data and removeData and hasData methods
// ensures all data is set and retrieved using jQuery Mobile's data namespace
$.fn.jqmData = function( prop, value ) {
var result;
if ( typeof prop != "undefined" ) {
result = this.data( prop ? $.mobile.nsNormalize( prop ) : prop, value );
}
return result;
return this.data( prop ? $.mobile.nsNormalize( prop ) : prop, value );
};
$.jqmData = function( elem, prop, value ) {