Giter Site home page Giter Site logo

Comments (3)

a-h avatar a-h commented on June 16, 2024 1

Sorry about the issue, it looks like it was an oversight during the addition of optional CSS class rendering functionality. The tests all had CSS class names that didn't trigger the CSS safety features, hence missing it.

I've done a PR, does that look like what you were expecting?

For background, CSS class names are sanitised by default, since templ can't tell whether they came from a user controlled variable (unsafe), or a programmer controlled constant (safe).

It looks like you spotted that you have to mark Go variables that you've set yourself (i.e. programmer controlled) as being safe by converting them to a templ.ConstantCSSClass type using the templ.SafeClass function.

But... I missed the code to handle that specific KV generic type.

Thanks for the great bug report and the nice words! 😁

from templ.

docapotamus avatar docapotamus commented on June 16, 2024 1

@a-h glad the issue with using SafeClass in KV is resolved. Looking at the PR, I realised that I should have been using SafeClass rather than SafeCSS in the string element and that resolved my issue in that case too.

Thanks for the help. Once I've got a bit further with the conversion to templ I'll try and add some extra docs for CSS,

from templ.

docapotamus avatar docapotamus commented on June 16, 2024

@a-h thanks for quick response and the PR. It looks good to me, I'll check out that version in the code base later this morning and report back.

from templ.

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.