Skip to content

Commit

Permalink
jQuery.hasData: Clarified when it returns false
Browse files Browse the repository at this point in the history
Fixes gh-889
Closes gh-891
  • Loading branch information
AurelioDeRosa committed Feb 14, 2016
1 parent 6142f86 commit a6eecc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion entries/jQuery.hasData.xml
Expand Up @@ -9,7 +9,7 @@
</signature>
<desc>Determine whether an element has any jQuery data associated with it.</desc>
<longdesc>
<p>The <code>jQuery.hasData()</code> method provides a way to determine if an element currently has any values that were set using <code><a href="/jQuery.data/">jQuery.data()</a></code>. If no data is associated with an element (there is no data object at all or the data object is empty), the method returns <code>false</code>; otherwise it returns <code>true</code>.</p>
<p>The <code>jQuery.hasData()</code> method provides a way to determine if an element currently has any values that were set using <code><a href="/jQuery.data/">jQuery.data()</a></code>. If there is no data object associated with an element, the method returns <code>false</code>; otherwise it returns <code>true</code>.</p>
<p>The primary advantage of <code>jQuery.hasData(element)</code> is that it does not create and associate a data object with the element if none currently exists. In contrast, <code>jQuery.data(element)</code> always returns a data object to the caller, creating one if no data object previously existed.
</p>
<p>Note that jQuery's event system uses the jQuery data API to store event handlers. Therefore, binding an event to an element using <code>.on()</code>, <code>.bind()</code>, <code>.live()</code>, <code>.delegate()</code>, or one of the shorthand event methods also associates a data object with that element.
Expand Down

0 comments on commit a6eecc2

Please sign in to comment.