GithubHelp home page GithubHelp logo

jquery about aurelia-form HOT 2 CLOSED

spoonx avatar spoonx commented on August 16, 2024
jquery

from aurelia-form.

Comments (2)

bas080 avatar bas080 commented on August 16, 2024

I agree that it should be removed. I also want to alter the setting of attributes on elements. It's not flexible enough currently. What happens now is the following.

let someSchema = [{
  key: 'username',
  attributes: {
    class: 'form-control highlighted'
  }
}];

Because I'm setting the class attribute I have to repeat classes that I want to keep. Not terrible but redundant.

I'm also not able to do DOM element selections and manipulate them using the full browser DOM api.

I believe a good alternative is to have a render function which returns the form-field's element as a callback. example

let someSchema = [{
  key: 'username',
  render: element => {
    element.getElementsByTagName('input')[0].classList.add('highlight');
  }
}];

By implementing the manipulation of Dom like this we can leave it up to the user to use jquery or the native DOM api.

I do think that for certain use cases the attributes property defined on the element is convenient. So we would have to remove the jquery dependency.

from aurelia-form.

RWOverdijk avatar RWOverdijk commented on August 16, 2024

I think we can just remove jquery, and assign the attributes ourselves. I want to keep it simple.

As to repeating classes, same thing, I think that's fine. The user can choose to use render or use class and repeat the class names.

from aurelia-form.

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.