Code Monkey home page Code Monkey logo

Comments (7)

koto avatar koto commented on June 14, 2024

Also TrustedURL.HASH, see thread

from trusted-types.

vrana avatar vrana commented on June 14, 2024

The EMPTY constants seem fine but I'm opposed to TrustedURL.HASH. There's no reason to use # alone as URL. It's only used to put there (usually in a.href) something that is later ignored (because the event handler stops the propagation). Anything else would work too, e.g. TrustedURL.EMPTY. Using # and not stopping the propagation causes the page to jump to the top which is a poor experience and we shouldn't encourage that by adding a constant for #.

from trusted-types.

koto avatar koto commented on June 14, 2024

Filed a request for TrustedHTML.EMPTY at https://bugs.chromium.org/p/chromium/issues/detail?id=936436

from trusted-types.

mikesamuel avatar mikesamuel commented on June 14, 2024

Would a solution to issue #96 obviate this?

from trusted-types.

xtofian avatar xtofian commented on June 14, 2024

Would a solution to issue #96 obviate this?

I think so.

I'd lean towards making these sorts of constants not part of the standard, but rather leave it to a (reference) builder library to provide. Either as explicit symbols, or via template literals, which would allow you to write
trustedHTML`` and trustedURL`#`.

from trusted-types.

koto avatar koto commented on June 14, 2024

I'm for keeping TrustedHTML.EMPTY as part of the standard. It's an easy way to facilitate rewriting existing code that doesn't require to use policies. For example, code linters might automatically refactor the code without any side-effects (assuming some minimal polyfill exists, or the replacement tests for the existence of the property first).

from trusted-types.

koto avatar koto commented on June 14, 2024

The empty HTML constant was implemented in http://crbug.com/936436. Due to naming conventions and other concerns it will be available at the factory level, so currently:

const html = TrustedTypes.emptyHTML

(tests at https://github.com/web-platform-tests/wpt/blob/master/trusted-types/TrustedTypePolicyFactory-constants.tentative.html).

I'll follow up with the polyfill implementation.

from trusted-types.

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.