Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Table: Reflow labels honor <abbr> title
Browse files Browse the repository at this point in the history
(cherry picked from commit 15f7a67)

Closes gh-7609
Fixes gh-7608
  • Loading branch information
Gabriel Schulhof committed Aug 22, 2014
1 parent 0095c40 commit b0b3495
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/widgets/table.reflow.js
Expand Up @@ -80,6 +80,9 @@ $.widget( "mobile.table", $.mobile.table, {
},

_addLabels: function( cells, label, contents ) {
if ( contents.length === 1 && contents[ 0 ].nodeName.toLowerCase() === "abbr" ) {
contents = contents.eq( 0 ).attr( "title" );
}
// .not fixes #6006
cells
.not( ":has(b." + label + ")" )
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/table/index.html
Expand Up @@ -129,6 +129,21 @@ <h1>Basic Table</h1>
</tr>
</tbody>
</table>
<table data-nstest-role="table" data-nstest-mode="reflow" id="reflow-abbr-test">
<thead>
<tr>
<th><abbr title="Player Name">PN</abbr></th>
</tr>
</thead>
<tbody>
<tr>
<td id="reflow-abbr-td1">Player I</td>
</tr>
<tr>
<td id="reflow-abbr-td2">Player II</td>
</tr>
</tbody>
</table>
</div>
</div>

Expand Down
7 changes: 7 additions & 0 deletions tests/unit/table/table_core.js
Expand Up @@ -99,6 +99,13 @@
}, 800);
});

test( "Reflow mode honors <abbr> tag title", function() {
var table = $( "#reflow-abbr-test" );

deepEqual( $( "#reflow-abbr-td1 b" ).text(), "Player Name", "Row 1 has the right label" );
deepEqual( $( "#reflow-abbr-td2 b" ).text(), "Player Name", "Row 2 has the right label" );
});

asyncTest( "The appropriate label is added" , function(){
setTimeout(function(){
var $table = $( "#reflow-table-test table" ),
Expand Down

0 comments on commit b0b3495

Please sign in to comment.