Add support for the data-disable attribute.#347
Conversation
src/rails.js
Outdated
There was a problem hiding this comment.
Maybe we should try to avoid replacing the html in case there's no disable-with? We know it should not change at this point right?
There was a problem hiding this comment.
I guess I can bring some of the changes from #348 and avoid these html calls after all.
This gives the same behavior as the `data-disable-with` attribute, but instead of using a replacement String from the `data-disable-with` attribute the disabled state will use the origin text/value of the element.
Conflicts: test/public/test/data-disable.js
… the HTML after all.
|
summon @rafaelfranca |
|
|
Conflicts: src/rails.js test/public/test/data-disable.js
|
I experimented with this change this morning. The feature seems to work "as advertised" and I could not find any regression. 👍 I'd definitely like to see this getting merged. BTW: I never noticed disable(-with) works with text inputs and textareas, too :) |
|
I've been using this ever since without any problems. Will this be merged into master? |
|
@lucasmazza I just looked through all this, and it looks good to me. Just gotta do some work to rebase it onto master. I'm working on it right now. |
|
OK, merged in. There were some conflicts that had to be resolved, but seems to be working now. |
|
thanks @JangoSteve ❤️ I was holding this back to handle all the conflicts in my branch instead of affecting some of the existing PRs. |
|
Ah makes sense. No worries, we'll get those PRs taken care of. |
This is a spike for what was proposed on #329.
This gives the same behaviour as the
data-disable-withattribute, but instead of using a replacement String from thedata-disable-withattribute the disabled state will use the origin text/value of the element. Since there is a lot of shared behaviour betweendata-disableanddata-disabled-withI duplicated the test case so we can test the same stuff for both attributes.