Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
Comments (7)
\x3c
is the hex encoded<
character. So the string actually contains<script>
, it is just displayed differently by the Chrome console.Today I learned: The Chrome console does this deliberately and only in very specific instances to enable devs to copy paste stuff from the console directly into an inline script in their HTML file without accidently breaking out of it (or inserting a comment).
from dompurify.
Heya, try to use the
FORCE_BODY: true
as config option, that should do the trick 🙂from dompurify.
I tried both
DOMPurify.sanitize('<script>a</script>',{ADD_TAGS:['script']},{FORCE_BODY: true})
and
DOMPurify.sanitize('<script>a</script>',{FORCE_BODY: true})
they gave empty string as result, added screenshot from demo page below:
from dompurify.
DOMPurify.sanitize
takes a single config object with all options, not multiple objects.DOMPurify.sanitize('<script>a</script>',{ADD_TAGS:['script'], FORCE_BODY: true})
should work instead.from dompurify.
Correct @realansgar , thanks 😅
from dompurify.
It gave the output as
\x3Cscript>a\x3C/script>
is that expected?
attached screenshot
![image](https://private-user-images.githubusercontent.com/165049826/317689118-975fb52c-e8f2-4fa6-9875-75185e869798.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY4Nzc5NTQsIm5iZiI6MTcxNjg3NzY1NCwicGF0aCI6Ii8xNjUwNDk4MjYvMzE3Njg5MTE4LTk3NWZiNTJjLWU4ZjItNGZhNi05ODc1LTc1MTg1ZTg2OTc5OC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNTI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDUyOFQwNjI3MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMDZkY2NmZjU1ZWViYmMxNDIwNTM5MmY1NDMxNGMwODdhZjNiYmNlYjk4MDYxNjI2OTY0NTFmYzRiOWE2Zjk5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.2OVfK1T3tuf9-27i1TB2CqWJxpuzHtk2KCNrTGSetYU)
from dompurify.
Nope, this is what the result looks like:
from dompurify.
Related Issues (20)