UNPKG

ullamlaboriosam

Version:
13 lines (12 loc) 483 B
// [INTERNAL USE ONLY] // Generate a fragment of HTML. This irons out the inconsistences u.prototype.generate = function (html) { // Table elements need to be child of <table> for some f***ed up reason if (/^\s*<t(h|r|d)/.test(html)) { return u(document.createElement('table')).html(html).children().nodes; } else if (/^\s*</.test(html)) { return u(document.createElement('div')).html(html).children().nodes; } else { return document.createTextNode(html); } };