Update anchor.js

pull/552/head
Anton 2 years ago committed by GitHub
parent 908306c271
commit b2eacaade1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,29 +45,28 @@ jQuery.fn.dataTable.render.anchor = function (
innerText = data;
}
var attributes = attributes typeof 'function' ? attributes(data, row, meta) : attributes;
var attrs = attributes typeof 'function' ? attributes(data, row, meta) : attributes;
if (!attributes.href) {
if (!attrs.href) {
switch (type) {
case 'mail':
attributes.href = 'mailto:' + data;
attrs.href = 'mailto:' + data;
break;
case 'phone':
attributes.href = 'tel:' + data.replace(/[^+\d]+/g, '');
attrs.href = 'tel:' + data.replace(/[^+\d]+/g, '');
break;
case 'link':
case default:
try {
attributes.href = new URL(data);
attrs.href = new URL(data);
} catch (e) {
attributes.href = data;
attrs.href = data;
}
}
}
var anchorEl = jQuery('</a>');
anchorEl.attr(attributes).text(innerText);
var anchorEl = jQuery('<a/>');
return anchorEl[0].outerText;
return anchorEl.attr(attrs).text(innerText)[0].outerText;
};
};

Loading…
Cancel
Save