Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive this repo in favor of native DomPurify? #7

Open
NullVoxPopuli opened this issue Jun 20, 2023 · 0 comments
Open

Archive this repo in favor of native DomPurify? #7

NullVoxPopuli opened this issue Jun 20, 2023 · 0 comments

Comments

@NullVoxPopuli
Copy link

In modern ember (~ since ~4 years ago), folks should be using dompurify directly,

It can be done like this, following their instructions: https://github.com/cure53/DOMPurify

npm add dompurify

in a component:

import * as DOMPurify from 'dompurify';

export default class Demo extends Component {
  sanitize = (x) => DOMPurify.sanitize(x);
  
  // or
  get sanitized() {
    return DOMPurify.sanitize(this.args.something);
  }
}
{{{this.sanitize @something}}}

{{{this.sanitized}}

See also: https://guides.emberjs.com/release/in-depth-topics/rendering-values/

@NullVoxPopuli NullVoxPopuli changed the title Archive this repo Archive this repo in favor of native DomPurify? Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant