Giter Site home page Giter Site logo

Feature request: when more than one attribute with the same name applies to a single element, throw an exception instead of just using the last one about thymesheet HOT 2 OPEN

Dretch avatar Dretch commented on June 30, 2024
Feature request: when more than one attribute with the same name applies to a single element, throw an exception instead of just using the last one

from thymesheet.

Comments (2)

4dz avatar 4dz commented on June 30, 2024

The idea is it works like css.
If you do this it’s perfectly valid, and it could happen as a result of two or more selectors cascading (combining) too β€” which is your second example.

This is no different than having a css

  • {
    color:blue
    }

a {
color:red
}

(For example)

These are perfectly valid scenarios - especially the second one you gave - and changing it would be a breaking change, causing unexpected errors.

from thymesheet.

Dretch avatar Dretch commented on June 30, 2024

I agree that the behaviour makes sense in that it is consistent with CSS, and that changing it will cause unexpected errors.

I checked what errors would occur in our project by hacking Thymesheet to throw some exceptions in the cases I outlined above... and I found quite a few errors when running our project's tests.

Unfortunately perhaps half of these exceptions are thrown because of Thymesheet that is obviously erroneus (especially with the first case, but also sometimes in the second case). It seems pretty common for people to use multiple th:attr, th:if or th:classappend attributes, and expect them to be applied cumulatively.

So, while this behaviour does make sense. I don't think it is ideal because it also results in problems going unnoticed.

from thymesheet.

Related Issues (12)

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.