Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.

Commit 0cd826b

Browse files
authored
Merge pull request #211 from raul-benito/patch-1
Accept options.details HTMLElement in commit method
2 parents e715f09 + fc807b9 commit 0cd826b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gitgraph.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@
616616
* @property {string} [color] - Master color (dot & message)
617617
* @property {string} [author = this.parent.author] - Author name & email
618618
* @property {string} [date] - Date of commit, default is now
619-
* @property {string} [detail] - DOM Element of detail part
619+
* @property {HTMLElement} [detail] - DOM Element of detail part
620620
* @property {string} [sha1] - Sha1, default is a random short sha1
621621
* @property {Commit} [parentCommit] - Parent commit
622622
* @property {string} [type = ("mergeCommit"|null)] - Type of commit
@@ -717,10 +717,10 @@
717717

718718
// Detail
719719
var isCompact = (this.parent.mode === "compact");
720-
if (typeof options.detailId === "string" && !isCompact) {
721-
options.detail = document.getElementById(options.detailId);
722-
} else {
720+
if (isCompact) {
723721
options.detail = null;
722+
} else if (typeof options.detailId === "string") {
723+
options.detail = document.getElementById(options.detailId) || options.detail;
724724
}
725725

726726
// Check collision (Cause of special compact mode)
@@ -1037,7 +1037,7 @@
10371037
* @param {boolean} options.arrowDisplay - Add a arrow under commit dot
10381038
* @param {string} [options.author = this.parent.author] - Author name & email
10391039
* @param {string} [options.date] - Date of commit, default is now
1040-
* @param {string} [options.detail] - DOM Element of detail part
1040+
* @param {HTMLElement} [options.detail] - DOM Element of detail part
10411041
* @param {string} [options.sha1] - Sha1, default is a random short sha1
10421042
* @param {Commit} [options.parentCommit] - Parent commit
10431043
* @param {string} [options.type = ("mergeCommit"|null)] - Type of commit

0 commit comments

Comments
 (0)