Skip to content

Commit

Permalink
Fix to list creation
Browse files Browse the repository at this point in the history
`append('<ul>')` appends a whole `<ul>` node (with closing tag). You need to create it and then append the list items to that node, not to the top-level element.
  • Loading branch information
jcutler committed Nov 11, 2011
1 parent 4b09ac9 commit c9d3374
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions js/github.commits.widget.js
Expand Up @@ -25,18 +25,17 @@
var totalCommits = (last < commits.length ? last : commits.length);

element.empty();
element.append('<ul>');
var list = $('<ul>').appendTo(element);

for (var c = 0; c < totalCommits; c++) {
element.append(
list.append(
'<li>' +
' ' + avatar(commits[c].author.email) +
' ' + author(commits[c].author.login) +
' commited ' + message(commits[c].message, commits[c].url) +
' ' + when(commits[c].committed_date) +
'</li>');
}
element.append('</ul>');
element.append('<br/><h5>by <a href="https://github.com/alexanderbeletsky/github.commits.widget">github.commits.widget</a></h5>');

function avatar(email) {
Expand Down

0 comments on commit c9d3374

Please sign in to comment.