Giter Site home page Giter Site logo

Comments (2)

SergejGleithmann avatar SergejGleithmann commented on May 17, 2024

I guess the error happens somewhere around here: https://github.com/mdbootstrap/TW-Elements/blob/026a359b473152cc1441d1d5e20e69b60ae348c7/src/js/dom/manipulator.js#L14C7-L14C7

I would maybe use something like this:

if (type === "array") {
    return JSON.parse(val);
  }

However this would require the type parameter, that is referenced in the index.js of the components. The way it is now, it prevents certain attributes. For example one can not set an attribute to a string that only consists of numbers even if the attribute expects a string. Also "false" is always interpreted as a boolean even if the attribute expects a string. This could then be refactored as well.
Would this be appreciated?

from tailwind-elements.

juujisai avatar juujisai commented on May 17, 2024

Hi! You are rignt, adding Objects and Arrays inside data attributes does not work at this moment. The best way to set options that contains those two is to do it via JS. We are going to discuss this in our team and decide whether this should be changed.

As of the attributes that consists of numbers or booleans I think it works as it should. Those values should be considered either as a number or as a boolean - if the string inside the data attribute says false then it should be considered as a boolean value.

Do you have any example where that could create an issue? Maybe I'm missing something.

from tailwind-elements.

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.