domsanitizer
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -13,9 +13,9 @@ 'use strict'; | ||
var spaces = ' \\f\\n\\r\\t'; | ||
var almostEverything = '[^ ' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[ ' + spaces + ']+' + almostEverything; | ||
var almostEverything = '[^' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[' + spaces + ']+' + almostEverything; | ||
var tagName = '<([A-Za-z]+[A-Za-z0-9:_-]*)((?:'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything + '))?)'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything.replace('\\/', '') + '))?)'; | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([ ' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([ ' + spaces + ']*/>)', 'g'); | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([' + spaces + ']*/>)', 'g'); | ||
var findAttributes = new RegExp('(' + attrName + '\\s*=\\s*)([\'"]?)' + UIDC + '\\2', 'gi'); | ||
@@ -22,0 +22,0 @@ |
@@ -12,9 +12,9 @@ /*! (c) Andrea Giammarchi - ISC */ | ||
var spaces = ' \\f\\n\\r\\t'; | ||
var almostEverything = '[^ ' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[ ' + spaces + ']+' + almostEverything; | ||
var almostEverything = '[^' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[' + spaces + ']+' + almostEverything; | ||
var tagName = '<([A-Za-z]+[A-Za-z0-9:_-]*)((?:'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything + '))?)'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything.replace('\\/', '') + '))?)'; | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([ ' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([ ' + spaces + ']*/>)', 'g'); | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([' + spaces + ']*/>)', 'g'); | ||
var findAttributes = new RegExp('(' + attrName + '\\s*=\\s*)([\'"]?)' + UIDC + '\\2', 'gi'); | ||
@@ -21,0 +21,0 @@ |
10
index.js
@@ -32,9 +32,9 @@ var domsanitizer = (function (exports) { | ||
var spaces = ' \\f\\n\\r\\t'; | ||
var almostEverything = '[^ ' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[ ' + spaces + ']+' + almostEverything; | ||
var almostEverything = '[^' + spaces + '\\/>"\'=]+'; | ||
var attrName = '[' + spaces + ']+' + almostEverything; | ||
var tagName = '<([A-Za-z]+[A-Za-z0-9:_-]*)((?:'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything + '))?)'; | ||
var attrPartials = '(?:\\s*=\\s*(?:\'[^\']*?\'|"[^"]*?"|<[^>]*?>|' + almostEverything.replace('\\/', '') + '))?)'; | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([ ' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([ ' + spaces + ']*/>)', 'g'); | ||
var attrSeeker = new RegExp(tagName + attrName + attrPartials + '+)([' + spaces + ']*/?>)', 'g'); | ||
var selfClosing = new RegExp(tagName + attrName + attrPartials + '*)([' + spaces + ']*/>)', 'g'); | ||
var findAttributes = new RegExp('(' + attrName + '\\s*=\\s*)([\'"]?)' + UIDC + '\\2', 'gi'); | ||
@@ -41,0 +41,0 @@ |
/*! (c) Andrea Giammarchi - ISC */ | ||
var domsanitizer=function(e){"use strict";var t,n,r,a="-"+Math.random().toFixed(6)+"%";try{t=document.createElement("template"),r="tabindex",(n="content")in t&&(t.innerHTML="<p "+r+'="'+a+'"></p>',t[n].childNodes[0].getAttribute(r)==a)||(a="_dt: "+a.slice(1,-1)+";")}catch(e){}var i="\x3c!--"+a+"--\x3e",c=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;var u=" \\f\\n\\r\\t",o="[^ "+u+"\\/>\"'=]+",s="[ "+u+"]+"+o,m="<([A-Za-z]+[A-Za-z0-9:_-]*)((?:",p="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+o+"))?)",d=new RegExp(m+s+p+"+)([ "+u+"]*/?>)","g"),g=new RegExp(m+s+p+"*)([ "+u+"]*/>)","g"),l=new RegExp("("+s+"\\s*=\\s*)(['\"]?)"+i+"\\2","gi");function x(e,t,n,r){return"<"+t+n.replace(l,b)+r}function b(e,t,n){return t+(n||'"')+a+(n||'"')}function f(e,t,n){return c.test(t)?e:"<"+t+n+"></"+t+">"}return function(e){return e.join(i).replace(g,f).replace(d,x)}}(); | ||
var domsanitizer=function(e){"use strict";var t,n,r,a="-"+Math.random().toFixed(6)+"%";try{t=document.createElement("template"),r="tabindex",(n="content")in t&&(t.innerHTML="<p "+r+'="'+a+'"></p>',t[n].childNodes[0].getAttribute(r)==a)||(a="_dt: "+a.slice(1,-1)+";")}catch(e){}var i="\x3c!--"+a+"--\x3e",c=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;var u=" \\f\\n\\r\\t",o="[^"+u+"\\/>\"'=]+",p="["+u+"]+"+o,s="<([A-Za-z]+[A-Za-z0-9:_-]*)((?:",m="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+o.replace("\\/","")+"))?)",l=new RegExp(s+p+m+"+)(["+u+"]*/?>)","g"),d=new RegExp(s+p+m+"*)(["+u+"]*/>)","g"),g=new RegExp("("+p+"\\s*=\\s*)(['\"]?)"+i+"\\2","gi");function x(e,t,n,r){return"<"+t+n.replace(g,b)+r}function b(e,t,n){return t+(n||'"')+a+(n||'"')}function f(e,t,n){return c.test(t)?e:"<"+t+n+"></"+t+">"}return function(e){return e.join(i).replace(d,f).replace(l,x)}}(); |
{ | ||
"name": "domsanitizer", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "A template to parsable tree transformer used to produce valid HTML content.", | ||
@@ -11,4 +11,6 @@ "main": "cjs/index.js", | ||
"cjs": "ascjs esm cjs", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls", | ||
"rollup": "rollup --config rollup.config.js && sed -i.bck 's/exports.default = index;/return index;/' index.js && rm index.js.bck", | ||
"min": "echo '/*! (c) Andrea Giammarchi - ISC */' > min.js && uglifyjs index.js -c -m >> min.js" | ||
"min": "echo '/*! (c) Andrea Giammarchi - ISC */' > min.js && uglifyjs index.js -c -m >> min.js", | ||
"test": "istanbul cover test/index.js" | ||
}, | ||
@@ -23,2 +25,4 @@ "keywords": [ | ||
"ascjs": "^3.0.1", | ||
"coveralls": "^3.0.3", | ||
"istanbul": "^0.4.5", | ||
"rollup": "^1.11.3", | ||
@@ -25,0 +29,0 @@ "rollup-plugin-node-resolve": "^4.2.3", |
# domsanitizer | ||
[![Build Status](https://travis-ci.com/WebReflection/domsanitizer.svg?branch=master)](https://travis-ci.com/WebReflection/domsanitizer) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/domsanitizer/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/domsanitizer?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/WebReflection/domsanitizer.svg)](https://greenkeeper.io/) ![WebReflection status](https://offline.report/status/webreflection.svg) | ||
A template to parsable tree transformer used to produce valid HTML content. | ||
@@ -4,0 +6,0 @@ |
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
8561
8
110
14
6