Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe("linkifyjs/element", () => {
/**
* The following tests were based on the documentation:
* https://soapbox.github.io/linkifyjs/docs/linkify-element.html
*/
const options: LinkifyOptions = {};
const result1: HTMLElement = linkifyElement(document.body, options, document);
const result2: HTMLElement = linkifyElement(document.body, options);
const result3: HTMLElement = linkifyElement(document.body);
});
describe("linkifyjs/element", () => {
/**
* The following tests were based on the documentation:
* https://soapbox.github.io/linkifyjs/docs/linkify-element.html
*/
const options: LinkifyOptions = {};
const result1: HTMLElement = linkifyElement(document.body, options, document);
const result2: HTMLElement = linkifyElement(document.body, options);
const result3: HTMLElement = linkifyElement(document.body);
});
describe("linkifyjs/element", () => {
/**
* The following tests were based on the documentation:
* https://soapbox.github.io/linkifyjs/docs/linkify-element.html
*/
const options: LinkifyOptions = {};
const result1: HTMLElement = linkifyElement(document.body, options, document);
const result2: HTMLElement = linkifyElement(document.body, options);
const result3: HTMLElement = linkifyElement(document.body);
});
function init(metadata) {
const currentUser = document.querySelector('.hnuser').innerText;
if (currentUser === metadata.user) {
return false;
}
const infoTable = document.querySelector('table#hnmain').querySelectorAll('table')[1];
for (const row of infoTable.querySelectorAll('tr')) {
const headingsEl = row.querySelector('td');
if (headingsEl.innerText === 'about:') {
linkifyElement(headingsEl.nextElementSibling, {
attributes: {
rel: 'noopener'
}
});
}
}
return true;
}
export function linkifyElement(element, options = linkifyMatrix.options) {
return _linkifyElement(element, options);
}
inserted: function (el) {
linkifyElement(el, {
className: 'text-blue-500',
formatHref: function (href, type) {
if (type === 'mention') {
return window.location.origin + '/users' + href
}
return href
}
})
}
})
${comments}
${text}
`;
break;
}
default:
break;
}
itemDiv.innerHTML = table;
linkifyElement(itemDiv, linkifyOptions);
}
});
created:
${renderedDate}
karma:
${userInfo.karma}
${userInfo.about ? 'about:' + userInfo.about + '' : ''}
`;
userDiv.innerHTML = table;
linkifyElement(userDiv, linkifyOptions);
}
});