Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update data.xml
PR updated based on feedback.
  • Loading branch information
AurelioDeRosa committed Jun 14, 2015
commit 4c3de4db4348debdf58cd89bb85f19a96500ea8e
4 changes: 2 additions & 2 deletions entries/data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1,
</code></pre>
<p>In jQuery 1.4.3 setting an element's data object with <code>.data(obj)</code> extends the data previously stored with that element.</p>
<p>Prior to jQuery 1.4.3 (starting in jQuery 1.4) the <code>.data()</code> method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.</p>
<p>jQuery 3 changes the behavior of this method to align it to the <a href="http://www.w3.org/TR/html5/dom.html#dom-dataset">Dataset API specifications</a>. Specifically, jQuery 3 transforms all the properties' key to be camelCase. Writing a statement like <code>$( "body" ).data( {"my-name": "aValue"} ).data();</code> will return <code>{ myName: "aValue" }</code>.</p>
<p><strong>jQuery 3</strong> changes the behavior of this method to align it to the <a href="http://www.w3.org/TR/html5/dom.html#dom-dataset">Dataset API specifications</a>. Specifically, jQuery 3 transforms all the properties' key to be camelCase. Writing a statement like <code>$( "body" ).data( { "my-name": "aValue" } ).data();</code> will return <code>{ myName: "aValue" }</code>.</p>
<p>Due to the way browsers interact with plugins and external code, the <code>.data()</code> method cannot be used on <code>&lt;object&gt;</code> (unless it's a Flash plugin), <code>&lt;applet&gt;</code> or <code>&lt;embed&gt;</code> elements.</p>
</longdesc>
<note id="no-data-on-xml" type="additional"/>
Expand Down Expand Up @@ -89,7 +89,7 @@ alert( $( "body" ).data( "foo" ) ); // undefined
$( "body" ).data( "bar", "foobar" );
alert( $( "body" ).data( "bar" ) ); // foobar
</code></pre>
<p>jQuery 3 changes the behavior of this method to align it to the <a href="http://www.w3.org/TR/html5/dom.html#dom-dataset">Dataset API specifications</a>. Specifically, jQuery 3 transforms all the properties' key to be camelCase. Writing a statement like <code>$( "body" ).data( {"my-name": "aValue"} ).data();</code> will return <code>{ myName: "aValue" }</code>.</p>
<p><strong>jQuery 3</strong> changes the behavior of this method to align it to the <a href="http://www.w3.org/TR/html5/dom.html#dom-dataset">Dataset API specifications</a>. Specifically, jQuery 3 transforms all the properties' key to be camelCase. Writing a statement like <code>$( "body" ).data( { "my-name": "aValue" } ).data();</code> will return <code>{ myName: "aValue" }</code>.</p>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this note be changed in the same way as the upper one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...yes. I'll do it now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid duplication, define it in one place & just use in these two? We do have includes but preferably the pattern would be defined here since it's not needed on other pages. Is it possible?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the global notes I'm not aware of any other method, sorry.

<h4 id="data-html5">
<a href="#data-html5">HTML5 data-* Attributes</a>
</h4>
Expand Down