Change: let makeLink accept object

This commit is contained in:
eight 2017-10-15 02:59:55 +08:00
parent a1ca416ef2
commit 7c2248933a

View File

@ -195,11 +195,16 @@ function $element(opt) {
function makeLink(href = '', content) {
return $element({
const opt = {
tag: 'a',
target: '_blank',
href,
rel: 'noopener',
appendChild: content,
});
rel: 'noopener'
};
if (typeof href === 'object') {
Object.assign(opt, href);
} else {
opt.href = href;
opt.appendChild = content;
}
return $element(opt);
}