Skip to content

Commit

Permalink
[FIXED JENKINS-21729] Fix IE8 NPE with respect to sortability
Browse files Browse the repository at this point in the history
IE8 (and I assume other browsers that use a doctype pre-html5) interpret the span outside of the link, as in HTML4.01 you needed the closing tag.
http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.4

The code was causing a NPE in IE8 and users could not sort the columns.

>> cell.innerHTML = '<a href="#" class="sortheader">'+this.getInnerText(cell)+'<span class="sortarrow" /></a>';

>> cell.innerHTML ;
"<A class=sortheader href="#"> S<SPAN class=sortarrow></A></SPAN>"

>> cell.innerHTML = '<a href="#" class="sortheader">'+this.getInnerText(cell)+'<span class="sortarrow"></span></a>'

>> cell.innerHTML ;
"<A class=sortheader href="#"> S<SPAN class=sortarrow></SPAN></A>"
  • Loading branch information
anafke authored and kohsuke committed Apr 19, 2014
1 parent 3cde986 commit 6566a0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -55,6 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Fixed a JavaScript problem in sortable table with IE8.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-21729">issue 21729</a>)
<li class=bug>
More efficient deletion of old builds (specified by date).
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22607">issue 22607</a>)
Expand Down
2 changes: 1 addition & 1 deletion war/src/main/webapp/scripts/sortable.js
Expand Up @@ -55,7 +55,7 @@ var Sortable = (function() {

// We have a first row: assume it's the header, and make its contents clickable links
firstRow.each(function (cell){
cell.innerHTML = '<a href="#" class="sortheader">'+this.getInnerText(cell)+'<span class="sortarrow" /></a>';
cell.innerHTML = '<a href="#" class="sortheader">'+this.getInnerText(cell)+'<span class="sortarrow"></span></a>';
this.arrows.push(cell.firstChild.lastChild);

var self = this;
Expand Down

0 comments on commit 6566a0c

Please sign in to comment.