Comments (7)
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.
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.
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.
Hmmm....this seems the most sane. Allow you to remove certain pieces of functionality via JS...I like it!
from mrujs.
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.
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.
from mrujs.
Related Issues (20)
- Submitter is borked on Safari 15
- Type declarations aren't being emitted HOT 1
- (data-disable-with ) not working on form submit buttons HOT 1
- there was an error with mrujs.confirm HOT 6
- Enhancement of Mrujs in relation to Turbo
- Move turbo-specific code into Turbo plugin.
- Build a `data-ujs-confirm` similar to Sean's example
- Buttons should be able to define formmethod and formaction HOT 1
- Add Sean's glue code into Mrujs
- Document best practices for forms / buttons / etc
- Typescript type definition problem with `mrujs.start()` HOT 2
- Dispatching a "submit" event without detail: {} raises an error. HOT 4
- Is it possible to use mrujs without Turbo ? HOT 1
- Confirm:complete doesn't always fire on cancellation
- Cannot find module 'mrujs/plugins' or its corresponding type declarations. HOT 2
- mrujs website flashes when loading HOT 1
- Test issue HOT 1
- Add configuration option to disable DOM morphing HOT 7
- mrujs with importmap HOT 2
- Links with `data-remote=true` do not use the normal "open link in new tab" behavior when command/control + clicked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mrujs.