html-react-parser
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -5,2 +5,15 @@ # Changelog | ||
### [0.10.2](https://github.com/remarkablemark/html-react-parser/compare/v0.10.1...v0.10.2) (2020-03-13) | ||
### Bug Fixes | ||
* **index:** add default export for parser ([6259959](https://github.com/remarkablemark/html-react-parser/commit/62599594de72c12c0c9fe9a8642ee52ed0488734)) | ||
### Tests | ||
* **html-to-react:** add test to ensure default export for parser ([efba1d4](https://github.com/remarkablemark/html-react-parser/commit/efba1d402000b25b8800e33c2b934351b64bac0c)) | ||
* **html-to-react:** have a stronger assert ([064f0df](https://github.com/remarkablemark/html-react-parser/commit/064f0dfc742f67d57941a02bfdb70a76b56be472)) | ||
### [0.10.1](https://github.com/remarkablemark/html-react-parser/compare/v0.10.0...v0.10.1) (2020-02-08) | ||
@@ -7,0 +20,0 @@ |
@@ -1665,2 +1665,4 @@ (function (global, factory) { | ||
var htmlReactParser = HTMLReactParser; | ||
var default_1 = HTMLReactParser; | ||
htmlReactParser.default = default_1; | ||
@@ -1667,0 +1669,0 @@ return htmlReactParser; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).HTMLReactParser=t(e.React)}(this,function(g){"use strict";g=g&&g.hasOwnProperty("default")?g.default:g;var e={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}},t={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}},s=1,c=4,u=8,p=24,f=32;function d(e,t){return(e&t)===t}function r(e,t,r){var n,i,a,o=e.Properties,l=e.DOMAttributeNames;for(i in o)n=l[i]||(r?i:i.toLowerCase()),a=o[i],t[n]={attributeName:n,propertyName:i,mustUseProperty:d(a,s),hasBooleanValue:d(a,c),hasNumericValue:d(a,u),hasPositiveNumericValue:d(a,p),hasOverloadedBooleanValue:d(a,f)}}var n={};r(e,n);var i={};r(t,i,!0);var a={};r(e,a),r(t,a,!0);function m(n,r){if("string"!=typeof n)throw new TypeError("First argument must be a string");if(!n)return[];r=r||{};var i=1,a=1;function o(e){var t=e.match(y);t&&(i+=t.length);var r=e.lastIndexOf("\n");a=~r?e.length-r:a+e.length}function l(){var t={line:i,column:a};return function(e){return e.position=new s(t),p(),e}}function s(e){this.start=e,this.end={line:i,column:a},this.source=r.source}function c(e){var t=new Error(r.source+":"+i+":"+a+": "+e);if(t.reason=e,t.filename=r.source,t.line=i,t.column=a,t.source=n,!r.silent)throw t}function u(e){var t=e.exec(n);if(t){var r=t[0];return o(r),n=n.slice(r.length),t}}function p(){u(v)}function f(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var e=l();if("/"==n.charAt(0)&&"*"==n.charAt(1)){for(var t=2;w!=n.charAt(t)&&("*"!=n.charAt(t)||"/"!=n.charAt(t+1));)++t;if(t+=2,w===n.charAt(t-1))return c("End of comment missing");var r=n.slice(2,t-2);return a+=2,o(r),n=n.slice(t),a+=2,e({type:"comment",comment:r})}}function m(){var e=l(),t=u(k);if(t){if(d(),!u(x))return c("property missing ':'");var r=u(b),n=e({type:"declaration",property:E(t[0].replace(h,w)),value:r?E(r[0].replace(h,w)):w});return u(T),n}}return s.prototype.content=n,p(),function(){var e,t=[];for(f(t);e=m();)!1!==e&&(t.push(e),f(t));return t}()}var o={html:n,svg:i,properties:a,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))},h=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,y=/\n/g,v=/^\s*/,k=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,x=/^:\s*/,b=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,T=/^[;\s]*/,l=/^\s+|\s+$/g,w="";function E(e){return e?e.replace(l,w):w}var S=function(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var i,a,o=m(e),l="function"==typeof t,s=0,c=o.length;s<c;s++)i=(r=o[s]).property,a=r.value,l?t(i,a,r):a&&((n=n||{})[i]=a);return n},C=/-([a-z])/g,F=/^--[a-zA-Z0-9-]+$|^[^-]+$/;var O={PRESERVE_CUSTOM_ATTRIBUTES:16<=g.version.split(".")[0],camelCase:function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");return F.test(e)?e:e.toLowerCase().replace(C,function(e,t){return t.toUpperCase()})},invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,i="function"==typeof t,a={},o={};for(r in e)n=e[r],i&&(a=t(r,n))&&2===a.length?o[a[0]]=a[1]:"string"==typeof n&&(o[n]=r);return o},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}},A=O.camelCase,M=o.html,R=o.svg,P=o.isCustomAttribute,L=Object.prototype.hasOwnProperty;var D=function(e){var t,r,n,i;e=e||{};var a={};for(t in e)n=e[t],P(t)?a[t]=n:(r=t.toLowerCase(),L.call(M,r)?a[(i=M[r]).propertyName]=!!(i.hasBooleanValue||i.hasOverloadedBooleanValue&&!n)||n:L.call(R,t)?a[(i=R[t]).propertyName]=n:O.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=n));return null!=e.style&&(a.style=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string.");var r={};return S(e,function(e,t){e&&t&&(r[A(e)]=t)}),r}(e.style)),a};for(var N,B=function e(t,r){for(var n,i,a,o,l,s=(r=r||{}).library||g,c=s.cloneElement,u=s.createElement,p=s.isValidElement,f=[],d="function"==typeof r.replace,m=0,h=t.length;m<h;m++)if(n=t[m],d&&p(i=r.replace(n)))1<h&&(i=c(i,{key:i.key||m})),f.push(i);else if("text"!==n.type){if(a=n.attribs,l=n,O.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===l.type&&O.isCustomComponent(l.name,l.attribs)||(a=D(n.attribs)),o=null,"script"===n.type||"style"===n.type)n.children[0]&&(a.dangerouslySetInnerHTML={__html:n.children[0].data});else{if("tag"!==n.type)continue;"textarea"===n.name&&n.children[0]?a.defaultValue=n.children[0].data:n.children&&n.children.length&&(o=e(n.children,r))}1<h&&(a.key=m),f.push(u(n.name,a,o))}else f.push(n.data);return 1===f.length?f[0]:f},z=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],I={},H=0,V=z.length;H<V;H++)I[(N=z[H]).toLowerCase()]=N;function U(e){for(var t,r={},n=0,i=e.length;n<i;n++)r[(t=e[n]).name]=t.value;return r}function j(e){e=e.toLowerCase();var t=I[e];return t||e}var _,X,q,Y={formatAttributes:U,formatDOM:function e(t,r,n){r=r||null;for(var i,a,o,l=[],s=0,c=t.length;s<c;s++){switch(i=t[s],o={next:null,prev:l[s-1]||null,parent:r},(a=l[s-1])&&(a.next=o),"#"!==i.nodeName[0]&&(o.name=j(i.nodeName),o.attribs={},i.attributes&&i.attributes.length&&(o.attribs=U(i.attributes))),i.nodeType){case 1:"script"===o.name||"style"===o.name?o.type=o.name:o.type="tag",o.children=e(i.childNodes,o);break;case 3:o.type="text",o.data=i.nodeValue;break;case 8:o.type="comment",o.data=i.nodeValue}l.push(o)}return n&&(l.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:l[0]?l[0]:null,prev:null,parent:r}),l[1]&&(l[1].prev=l[0])),l},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}},$="body",G=/<([a-zA-Z]+[0-9]?)/,W=/<head.*>/i,Z=/<body.*>/i,K=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,J=Y.isIE(9),Q=J||Y.isIE();if("function"==typeof window.DOMParser){var ee=new window.DOMParser,te=J?"text/xml":"text/html";_=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),J&&(e=e.replace(K,"<$1$2$3/>")),ee.parseFromString(e,te)}}if("object"==typeof document.implementation){var re=document.implementation.createHTMLDocument(Q?"HTML_DOM_PARSER_TITLE":void 0);X=function(t,e){if(e)return re.documentElement.getElementsByTagName(e)[0].innerHTML=t,re;try{return re.documentElement.innerHTML=t,re}catch(e){if(_)return _(t)}}}var ne=document.createElement("template");ne.content&&(q=function(e){return ne.innerHTML=e,ne.content.childNodes});var ie=X||_;var ae=function(e){var t,r,n,i,a=e.match(G);switch(a&&a[1]&&(t=a[1].toLowerCase()),t){case"html":if(_)return r=_(e),W.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),Z.test(e)||(n=r.getElementsByTagName($)[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");break;case"head":case $:if(ie)return i=ie(e).getElementsByTagName(t),Z.test(e)&&W.test(e)?i[0].parentNode.childNodes:i;break;default:if(q)return q(e);if(ie)return ie(e,$).getElementsByTagName($)[0].childNodes}return[]},oe=Y.formatDOM,le=Y.isIE(9),se=/<(![a-zA-Z\s]+)>/;var ce=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(se);return r&&r[1]&&(t=r[1],le&&(e=e.replace(r[0],""))),oe(ae(e),null,t)};function ue(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return B(ce(e),t)}return ue.domToReact=B,ue.htmlToDOM=ce,ue}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).HTMLReactParser=t(e.React)}(this,function(g){"use strict";g=g&&g.hasOwnProperty("default")?g.default:g;var e={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}},t={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}},s=1,c=4,u=8,p=24,f=32;function d(e,t){return(e&t)===t}function r(e,t,r){var n,i,a,o=e.Properties,l=e.DOMAttributeNames;for(i in o)n=l[i]||(r?i:i.toLowerCase()),a=o[i],t[n]={attributeName:n,propertyName:i,mustUseProperty:d(a,s),hasBooleanValue:d(a,c),hasNumericValue:d(a,u),hasPositiveNumericValue:d(a,p),hasOverloadedBooleanValue:d(a,f)}}var n={};r(e,n);var i={};r(t,i,!0);var a={};r(e,a),r(t,a,!0);function m(n,r){if("string"!=typeof n)throw new TypeError("First argument must be a string");if(!n)return[];r=r||{};var i=1,a=1;function o(e){var t=e.match(y);t&&(i+=t.length);var r=e.lastIndexOf("\n");a=~r?e.length-r:a+e.length}function l(){var t={line:i,column:a};return function(e){return e.position=new s(t),p(),e}}function s(e){this.start=e,this.end={line:i,column:a},this.source=r.source}function c(e){var t=new Error(r.source+":"+i+":"+a+": "+e);if(t.reason=e,t.filename=r.source,t.line=i,t.column=a,t.source=n,!r.silent)throw t}function u(e){var t=e.exec(n);if(t){var r=t[0];return o(r),n=n.slice(r.length),t}}function p(){u(v)}function f(e){var t;for(e=e||[];t=d();)!1!==t&&e.push(t);return e}function d(){var e=l();if("/"==n.charAt(0)&&"*"==n.charAt(1)){for(var t=2;w!=n.charAt(t)&&("*"!=n.charAt(t)||"/"!=n.charAt(t+1));)++t;if(t+=2,w===n.charAt(t-1))return c("End of comment missing");var r=n.slice(2,t-2);return a+=2,o(r),n=n.slice(t),a+=2,e({type:"comment",comment:r})}}function m(){var e=l(),t=u(k);if(t){if(d(),!u(x))return c("property missing ':'");var r=u(b),n=e({type:"declaration",property:E(t[0].replace(h,w)),value:r?E(r[0].replace(h,w)):w});return u(T),n}}return s.prototype.content=n,p(),function(){var e,t=[];for(f(t);e=m();)!1!==e&&(t.push(e),f(t));return t}()}var o={html:n,svg:i,properties:a,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))},h=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,y=/\n/g,v=/^\s*/,k=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,x=/^:\s*/,b=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,T=/^[;\s]*/,l=/^\s+|\s+$/g,w="";function E(e){return e?e.replace(l,w):w}var S=function(e,t){var r,n=null;if(!e||"string"!=typeof e)return n;for(var i,a,o=m(e),l="function"==typeof t,s=0,c=o.length;s<c;s++)i=(r=o[s]).property,a=r.value,l?t(i,a,r):a&&((n=n||{})[i]=a);return n},C=/-([a-z])/g,F=/^--[a-zA-Z0-9-]+$|^[^-]+$/;var O={PRESERVE_CUSTOM_ATTRIBUTES:16<=g.version.split(".")[0],camelCase:function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");return F.test(e)?e:e.toLowerCase().replace(C,function(e,t){return t.toUpperCase()})},invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,i="function"==typeof t,a={},o={};for(r in e)n=e[r],i&&(a=t(r,n))&&2===a.length?o[a[0]]=a[1]:"string"==typeof n&&(o[n]=r);return o},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}},A=O.camelCase,M=o.html,R=o.svg,P=o.isCustomAttribute,L=Object.prototype.hasOwnProperty;var D=function(e){var t,r,n,i;e=e||{};var a={};for(t in e)n=e[t],P(t)?a[t]=n:(r=t.toLowerCase(),L.call(M,r)?a[(i=M[r]).propertyName]=!!(i.hasBooleanValue||i.hasOverloadedBooleanValue&&!n)||n:L.call(R,t)?a[(i=R[t]).propertyName]=n:O.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=n));return null!=e.style&&(a.style=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string.");var r={};return S(e,function(e,t){e&&t&&(r[A(e)]=t)}),r}(e.style)),a};for(var N,B=function e(t,r){for(var n,i,a,o,l,s=(r=r||{}).library||g,c=s.cloneElement,u=s.createElement,p=s.isValidElement,f=[],d="function"==typeof r.replace,m=0,h=t.length;m<h;m++)if(n=t[m],d&&p(i=r.replace(n)))1<h&&(i=c(i,{key:i.key||m})),f.push(i);else if("text"!==n.type){if(a=n.attribs,l=n,O.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===l.type&&O.isCustomComponent(l.name,l.attribs)||(a=D(n.attribs)),o=null,"script"===n.type||"style"===n.type)n.children[0]&&(a.dangerouslySetInnerHTML={__html:n.children[0].data});else{if("tag"!==n.type)continue;"textarea"===n.name&&n.children[0]?a.defaultValue=n.children[0].data:n.children&&n.children.length&&(o=e(n.children,r))}1<h&&(a.key=m),f.push(u(n.name,a,o))}else f.push(n.data);return 1===f.length?f[0]:f},z=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],I={},H=0,V=z.length;H<V;H++)I[(N=z[H]).toLowerCase()]=N;function U(e){for(var t,r={},n=0,i=e.length;n<i;n++)r[(t=e[n]).name]=t.value;return r}function j(e){e=e.toLowerCase();var t=I[e];return t||e}var _,X,q,Y={formatAttributes:U,formatDOM:function e(t,r,n){r=r||null;for(var i,a,o,l=[],s=0,c=t.length;s<c;s++){switch(i=t[s],o={next:null,prev:l[s-1]||null,parent:r},(a=l[s-1])&&(a.next=o),"#"!==i.nodeName[0]&&(o.name=j(i.nodeName),o.attribs={},i.attributes&&i.attributes.length&&(o.attribs=U(i.attributes))),i.nodeType){case 1:"script"===o.name||"style"===o.name?o.type=o.name:o.type="tag",o.children=e(i.childNodes,o);break;case 3:o.type="text",o.data=i.nodeValue;break;case 8:o.type="comment",o.data=i.nodeValue}l.push(o)}return n&&(l.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:l[0]?l[0]:null,prev:null,parent:r}),l[1]&&(l[1].prev=l[0])),l},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}},$="body",G=/<([a-zA-Z]+[0-9]?)/,W=/<head.*>/i,Z=/<body.*>/i,K=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,J=Y.isIE(9),Q=J||Y.isIE();if("function"==typeof window.DOMParser){var ee=new window.DOMParser,te=J?"text/xml":"text/html";_=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),J&&(e=e.replace(K,"<$1$2$3/>")),ee.parseFromString(e,te)}}if("object"==typeof document.implementation){var re=document.implementation.createHTMLDocument(Q?"HTML_DOM_PARSER_TITLE":void 0);X=function(t,e){if(e)return re.documentElement.getElementsByTagName(e)[0].innerHTML=t,re;try{return re.documentElement.innerHTML=t,re}catch(e){if(_)return _(t)}}}var ne=document.createElement("template");ne.content&&(q=function(e){return ne.innerHTML=e,ne.content.childNodes});var ie=X||_;var ae=function(e){var t,r,n,i,a=e.match(G);switch(a&&a[1]&&(t=a[1].toLowerCase()),t){case"html":if(_)return r=_(e),W.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),Z.test(e)||(n=r.getElementsByTagName($)[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");break;case"head":case $:if(ie)return i=ie(e).getElementsByTagName(t),Z.test(e)&&W.test(e)?i[0].parentNode.childNodes:i;break;default:if(q)return q(e);if(ie)return ie(e,$).getElementsByTagName($)[0].childNodes}return[]},oe=Y.formatDOM,le=Y.isIE(9),se=/<(![a-zA-Z\s]+)>/;var ce=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(se);return r&&r[1]&&(t=r[1],le&&(e=e.replace(r[0],""))),oe(ae(e),null,t)};function ue(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return B(ce(e),t)}ue.domToReact=B,ue.htmlToDOM=ce;var pe=ue,fe=ue;return pe.default=fe,pe}); | ||
//# sourceMappingURL=html-react-parser.min.js.map |
@@ -26,1 +26,2 @@ var domToReact = require('./lib/dom-to-react'); | ||
module.exports = HTMLReactParser; | ||
module.exports.default = HTMLReactParser; |
{ | ||
"name": "html-react-parser", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "HTML to React parser.", | ||
@@ -5,0 +5,0 @@ "author": "Mark <mark@remarkablemark.org>", |
@@ -59,7 +59,7 @@ # html-react-parser | ||
```js | ||
// ES Modules | ||
import parse from 'html-react-parser'; | ||
// CommonJS | ||
const parse = require('html-react-parser'); | ||
// ES Modules | ||
import parse from 'html-react-parser'; | ||
``` | ||
@@ -232,7 +232,7 @@ | ||
No, this library is **_not_** [XSS (Cross-Site Scripting)](https://wikipedia.org/wiki/Cross-site_scripting) safe. See [#94](https://github.com/remarkablemark/html-react-parser/issues/94). | ||
No, this library is _**not**_ [XSS (cross-site scripting)](https://wikipedia.org/wiki/Cross-site_scripting) safe. See [#94](https://github.com/remarkablemark/html-react-parser/issues/94). | ||
#### Does this library sanitize invalid HTML? | ||
No, this library does **_not_** perform HTML sanitization. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124). | ||
No, this library does _**not**_ perform HTML sanitization. See [#124](https://github.com/remarkablemark/html-react-parser/issues/124) and [#125](https://github.com/remarkablemark/html-react-parser/issues/125). | ||
@@ -245,4 +245,12 @@ #### Are `<script>` tags parsed? | ||
This is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) (e.g., `onclick`) are parsed as a _string_ instead of a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73). | ||
This is because [inline event handlers](https://developer.mozilla.org/docs/Web/Guide/Events/Event_handlers) like `onclick` are parsed as a _string_ instead of a _function_. See [#73](https://github.com/remarkablemark/html-react-parser/issues/73). | ||
#### The parser throws an error. | ||
Check if your arguments are valid. Also, see ["Does this library sanitize invalid HTML?"](https://github.com/remarkablemark/html-react-parser#does-this-library-sanitize-invalid-html). | ||
#### Does this library support SSR? | ||
Yes, this library supports server-side rendering on Node.js. See [demo](https://repl.it/@remarkablemark/html-react-parser-SSR). | ||
## Benchmarks | ||
@@ -249,0 +257,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163345
1893
310