Giter Club home page Giter Club logo

Comments (7)

existentialmutt avatar existentialmutt commented on August 17, 2024

lol, I noticed this behavior when working on #66 Went to log the issue and I wound up here.

Would it be possible to add code to the various observerCallback functions that removes the behaviors if the node doesn't match the designated attributes?

e.g. in method.ts:

  observerCallback (nodeList: Node[]): void {
    nodeList.forEach((node) => {
      if (match(node, window.mrujs.querySelectors.linkClickSelector)) {
        node.addEventListener('click', this.handle)
      } else { // <---------------- THIS IS THE NEW PART
       node.removeEventListener('click', this.handle)
     }

    // ...

  }

from mrujs.

KonnorRogers avatar KonnorRogers commented on August 17, 2024

This may not be the worst way to handle it....I know me and @leastbad have been mulling over "in what scenario would someone ever do this?"

from mrujs.

leastbad avatar leastbad commented on August 17, 2024

Just to throw an idea on the pile:

You could introduce a method that people could call which would fully de-mrujs an element. This would allow you to sleep well at night while Officially Not Worrying about people randomly disabling parts of an mrujs-blessed element. Programmatically removing the data-remote attribute is just such a weird way to solve a problem.

from mrujs.

KonnorRogers avatar KonnorRogers commented on August 17, 2024

Hmmm....this seems the most sane. Allow you to remove certain pieces of functionality via JS...I like it!

from mrujs.

existentialmutt avatar existentialmutt commented on August 17, 2024

I agree this is a weird case to design for- I've certainly never done it in all my years of working with OG UJS. A de-mrujs method sounds good to me.

from mrujs.

KonnorRogers avatar KonnorRogers commented on August 17, 2024

im just gonna leave it alone until someone can come up with a compelling use case. Ive never had this come up before. Marking as closed unless someone can provide a real life example.

from mrujs.

leastbad avatar leastbad commented on August 17, 2024

giphy

from mrujs.

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.