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

Commit 15f7a67

Browse files
author
Gabriel Schulhof
committed
Table: Reflow labels honor <abbr> title
Closes gh-7609 Fixes gh-7608
1 parent 834843c commit 15f7a67

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

js/widgets/table.reflow.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ $.widget( "mobile.table", $.mobile.table, {
8080
},
8181

8282
_addLabels: function( cells, label, contents ) {
83+
if ( contents.length === 1 && contents[ 0 ].nodeName.toLowerCase() === "abbr" ) {
84+
contents = contents.eq( 0 ).attr( "title" );
85+
}
8386
// .not fixes #6006
8487
cells
8588
.not( ":has(b." + label + ")" )

tests/unit/table/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ <h1>Basic Table</h1>
129129
</tr>
130130
</tbody>
131131
</table>
132+
<table data-nstest-role="table" data-nstest-mode="reflow" id="reflow-abbr-test">
133+
<thead>
134+
<tr>
135+
<th><abbr title="Player Name">PN</abbr></th>
136+
</tr>
137+
</thead>
138+
<tbody>
139+
<tr>
140+
<td id="reflow-abbr-td1">Player I</td>
141+
</tr>
142+
<tr>
143+
<td id="reflow-abbr-td2">Player II</td>
144+
</tr>
145+
</tbody>
146+
</table>
132147
</div>
133148
</div>
134149

tests/unit/table/table_core.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@
9999
}, 800);
100100
});
101101

102+
test( "Reflow mode honors <abbr> tag title", function() {
103+
var table = $( "#reflow-abbr-test" );
104+
105+
deepEqual( $( "#reflow-abbr-td1 b" ).text(), "Player Name", "Row 1 has the right label" );
106+
deepEqual( $( "#reflow-abbr-td2 b" ).text(), "Player Name", "Row 2 has the right label" );
107+
});
108+
102109
asyncTest( "The appropriate label is added" , function(){
103110
setTimeout(function(){
104111
var $table = $( "#reflow-table-test table" ),

0 commit comments

Comments
 (0)