<template id="commitdate">
<div class="commit-group-heading">
</div>
<ul class="list-unstyled commits-list">
<li>
<div class="commit-main-info">
<a href="#" target="_blank"></a>
</div>
<span class="text-muted">by</span> <span class="author"></span>
</li>
</ul>
</li>
</template>
<template id="commit">
<li>
<div class="commit-main-info">
<a href="#" target="_blank"></a>
</div>
<span class="text-muted">by</span> <span class="author"></span>
</li>
</template>
And i am using it like this in my javascript code : if (lastDate == commitDate) {
var commitTemplate = $("#commit");
var commitNode = commitTemplate.prop("content");
$(commitNode).find(".commit-main-info").append(commit.message);
$(commitNode).find(".author").text(commit.login);
$(commitNode).find("a").attr("href", commit.html_url);
$(commitNode).find("a").text("# "+commit.sha.substring(0,6));
var clonedCommitNode = document.importNode(commitNode, true);
$("ul").last().append(clonedCommitNode);
} else {
var commitDateTemplate = $("#commitdate");
var commitDateNode = commitDateTemplate.prop("content");
$(commitDateNode).find(".commit-group-heading").text("Commits on " + commit.date);
$(commitDateNode).find("a").attr("href", commit.html_url);
$(commitDateNode).find("a").text("# "+commit.sha.substring(0,6));
$(commitDateNode).find(".commit-main-info").append(commit.message);
$(commitDateNode).find(".author").text(commit.login);
var clonedCommitDateNode = document.importNode(commitDateNode, true);
$("body").append(clonedCommitDateNode);
}
first solution always get the biggest share, if not all :)That is simply not true. There is a certain etiquette here on EE that you seem to be unaware of.
also, empty + append is not good as just replace!Again not true - if you put forward the that way to add new content is through html() and the solution requires that more than one item is to be added then .html() will not work.
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.
TRUSTED BY
Two equally valid answers given - points to be split evenly.