linkify-element
Advanced tools
Comparing version 4.0.0-beta.1 to 4.0.0-beta.2
@@ -61,3 +61,3 @@ var linkifyElement = (function (linkifyjs) { | ||
if (!element || element.nodeType !== HTML_NODE) { | ||
throw new Error("Cannot linkify ".concat(element, " - Invalid DOM Node type")); | ||
throw new Error("Cannot linkify " + element + " - Invalid DOM Node type"); | ||
} // Is this element already a link? | ||
@@ -145,4 +145,6 @@ | ||
function linkifyElement(element, opts) { | ||
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
function linkifyElement(element, opts, doc) { | ||
if (doc === void 0) { | ||
doc = null; | ||
} | ||
@@ -149,0 +151,0 @@ try { |
@@ -1,1 +0,1 @@ | ||
var linkifyElement=function(e){"use strict";function n(e,n,t){var r=t[t.length-1];e.replaceChild(r,n);for(var i=t.length-2;i>=0;i--)e.insertBefore(t[i],r),r=t[i]}function t(e,n,t){for(var r=[],i=0;i<e.length;i++){var o=e[i];"nl"===o.t&&n.get("nl2br")?r.push(t.createElement("br")):o.isLink&&n.check(o)?r.push(n.render(o)):r.push(t.createTextNode(o.toString()))}return r}function r(i,o,a){if(!i||1!==i.nodeType)throw new Error("Cannot linkify ".concat(i," - Invalid DOM Node type"));if("A"===i.tagName||o.ignoreTags.indexOf(i.tagName)>=0)return i;for(var l=i.firstChild;l;){var d=void 0,u=void 0,c=void 0;switch(l.nodeType){case 1:r(l,o,a);break;case 3:if(d=l.nodeValue,0===(u=e.tokenize(d)).length||1===u.length&&"text"===u[0].t)break;n(i,l,c=t(u,o,a)),l=c[c.length-1]}l=l.nextSibling}return i}function i(e){return function(n){var t=n.tagName,r=n.attributes,i=n.content,o=n.eventListeners,a=e.createElement(t);for(var l in r)a.setAttribute(l,r[l]);if(o&&a.addEventListener)for(var d in o)a.addEventListener(d,o[d]);return a.appendChild(e.createTextNode(i)),a}}function o(n,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;try{o=o||document||window&&window.document||global&&global.document}catch(e){}if(!o)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return r(n,t=new e.Options(t,i(o)),o)}return o.helper=r,o.getDefaultRender=i,o.normalize=function(n,t){return new e.Options(n,i(t))},o}(linkify); | ||
var linkifyElement=function(e){"use strict";function n(e,n,t){var r=t[t.length-1];e.replaceChild(r,n);for(var i=t.length-2;i>=0;i--)e.insertBefore(t[i],r),r=t[i]}function t(e,n,t){for(var r=[],i=0;i<e.length;i++){var o=e[i];"nl"===o.t&&n.get("nl2br")?r.push(t.createElement("br")):o.isLink&&n.check(o)?r.push(n.render(o)):r.push(t.createTextNode(o.toString()))}return r}function r(i,o,a){if(!i||1!==i.nodeType)throw new Error("Cannot linkify "+i+" - Invalid DOM Node type");if("A"===i.tagName||o.ignoreTags.indexOf(i.tagName)>=0)return i;for(var l=i.firstChild;l;){var d=void 0,u=void 0,f=void 0;switch(l.nodeType){case 1:r(l,o,a);break;case 3:if(d=l.nodeValue,0===(u=e.tokenize(d)).length||1===u.length&&"text"===u[0].t)break;n(i,l,f=t(u,o,a)),l=f[f.length-1]}l=l.nextSibling}return i}function i(e){return function(n){var t=n.tagName,r=n.attributes,i=n.content,o=n.eventListeners,a=e.createElement(t);for(var l in r)a.setAttribute(l,r[l]);if(o&&a.addEventListener)for(var d in o)a.addEventListener(d,o[d]);return a.appendChild(e.createTextNode(i)),a}}function o(n,t,o){void 0===o&&(o=null);try{o=o||document||window&&window.document||global&&global.document}catch(e){}if(!o)throw new Error("Cannot find document implementation. If you are in a non-browser environment like Node.js, pass the document implementation as the third argument to linkifyElement.");return r(n,t=new e.Options(t,i(o)),o)}return o.helper=r,o.getDefaultRender=i,o.normalize=function(n,t){return new e.Options(n,i(t))},o}(linkify); |
@@ -11,3 +11,3 @@ export { linkifyElement as default }; | ||
*/ | ||
declare function linkifyElement(element: HTMLElement, opts: any, ...args: any[]): HTMLElement; | ||
declare function linkifyElement(element: HTMLElement, opts: any, doc?: Document): HTMLElement; | ||
declare namespace linkifyElement { | ||
@@ -14,0 +14,0 @@ export { linkifyElementHelper as helper }; |
@@ -60,3 +60,3 @@ import { Options, tokenize } from 'linkifyjs'; | ||
if (!element || element.nodeType !== HTML_NODE) { | ||
throw new Error("Cannot linkify ".concat(element, " - Invalid DOM Node type")); | ||
throw new Error("Cannot linkify " + element + " - Invalid DOM Node type"); | ||
} // Is this element already a link? | ||
@@ -144,4 +144,6 @@ | ||
function linkifyElement(element, opts) { | ||
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
function linkifyElement(element, opts, doc) { | ||
if (doc === void 0) { | ||
doc = null; | ||
} | ||
@@ -148,0 +150,0 @@ try { |
@@ -11,3 +11,3 @@ export = linkifyElement; | ||
*/ | ||
declare function linkifyElement(element: HTMLElement, opts: any, ...args: any[]): HTMLElement; | ||
declare function linkifyElement(element: HTMLElement, opts: any, doc?: Document): HTMLElement; | ||
declare namespace linkifyElement { | ||
@@ -14,0 +14,0 @@ export { linkifyElementHelper as helper }; |
@@ -62,3 +62,3 @@ 'use strict'; | ||
if (!element || element.nodeType !== HTML_NODE) { | ||
throw new Error("Cannot linkify ".concat(element, " - Invalid DOM Node type")); | ||
throw new Error("Cannot linkify " + element + " - Invalid DOM Node type"); | ||
} // Is this element already a link? | ||
@@ -146,4 +146,6 @@ | ||
function linkifyElement(element, opts) { | ||
var doc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
function linkifyElement(element, opts, doc) { | ||
if (doc === void 0) { | ||
doc = null; | ||
} | ||
@@ -150,0 +152,0 @@ try { |
{ | ||
"name": "linkify-element", | ||
"version": "4.0.0-beta.1", | ||
"version": "4.0.0-beta.2", | ||
"description": "Browser DOM element interface for linkifyjs", | ||
@@ -33,4 +33,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"linkifyjs": "*" | ||
"linkifyjs": "^4.0.0-beta.1" | ||
} | ||
} |
469
19805