GithubHelp home page GithubHelp logo

Comments (6)

cure53 avatar cure53 commented on July 24, 2024

My proposal would be to add two additional hooks:

                /* Execute a hook if present */
                _executeHook('uponSanitizeElement', currentNode, {
                    tagName: tagName
                });

and

                /* Execute a hook if present */
                _executeHook('uponSanitizeAttribute', currentNode, {
                    attrName: attrName, attrValue: tmp.value
                }); 

Those get called once we already verified, that the element is an element and that the attribute is an attribute. In addition, we are passing the verified tag name and the verified attribute name alongside the value.

This should make it far more secure and easy to create a hook as the developer doesn't have to do the whole tedious verification on their own.

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

@fhemberger I have added a slightly renovated hook API. Would you mind having a quick look? I think we can release 0.6.2 if all is fine.

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

@fhemberger I added some basic code to enable deletion of existing hooks. Mind reviewing it real quick please? Changes: 753053b

from dompurify.

fhemberger avatar fhemberger commented on July 24, 2024

@cure53 Two minimal annotations, besides that LGTM 👍

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

@fhemberger Added that. Testing the whole feature on MSIE now, then I think we should be good.

from dompurify.

cure53 avatar cure53 commented on July 24, 2024

I am fairly happy with the Hook API for now, closing this ticket until additional needs and requests come in.

from dompurify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.