New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent data-role="button" from double enhancing buttons or inputs #3141

Closed
toddparker opened this Issue Nov 22, 2011 · 11 comments

Comments

Projects
None yet
7 participants
@toddparker
Contributor

toddparker commented Nov 22, 2011

If you add data-role="button" to a button or input type=button/submit/etc. which is automatically enhanced, the script will add the button markup twice: wrapping the input and also injecting the button markup inside the input.

  <input data-role="button" type="submit" value="GO"/>

Even though this is incorrect markup, we should put in a check to see if there is duplication between the role and auto-init and not apply the markup enhancements twice in this scenario to make this fool-proof.

@jblas

This comment has been minimized.

Show comment
Hide comment
@jblas

jblas Nov 22, 2011

Contributor

This should be pretty easy and involve simply checking for the existence of a data object named "button" before executing the code in buttonMarkup().

Contributor

jblas commented Nov 22, 2011

This should be pretty easy and involve simply checking for the existence of a data object named "button" before executing the code in buttonMarkup().

@MauriceG

This comment has been minimized.

Show comment
Hide comment
@MauriceG

MauriceG Nov 23, 2011

Contributor

It seems, issue #3005 is related to this one. The duplicate button markup misses the ui-corner-styling for the last button in a controlgroup.

Contributor

MauriceG commented Nov 23, 2011

It seems, issue #3005 is related to this one. The duplicate button markup misses the ui-corner-styling for the last button in a controlgroup.

@redaemn

This comment has been minimized.

Show comment
Hide comment
@redaemn

redaemn Dec 20, 2011

Contributor

@toddparker

Sorry, can you create a test page if the problem still exist? I'm not able to recreate the bug here... :(

Contributor

redaemn commented Dec 20, 2011

@toddparker

Sorry, can you create a test page if the problem still exist? I'm not able to recreate the bug here... :(

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Dec 20, 2011

Contributor

Ok, this is so odd, it seems to be working now. Looking at why:
http://jsbin.com/ukewu3/201

Lots of issues reported on this in the past:
#2875
#1000
#2379

Contributor

toddparker commented Dec 20, 2011

Ok, this is so odd, it seems to be working now. Looking at why:
http://jsbin.com/ukewu3/201

Lots of issues reported on this in the past:
#2875
#1000
#2379

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Dec 21, 2011

Contributor

So any ideas why $("#mytest").button().button('disable'); would disable the button correctly but $("#mytest").button('disable'); doesn't disable the button?

Contributor

toddparker commented Dec 21, 2011

So any ideas why $("#mytest").button().button('disable'); would disable the button correctly but $("#mytest").button('disable'); doesn't disable the button?

@jblas

This comment has been minimized.

Show comment
Hide comment
@jblas

jblas Dec 22, 2011

Contributor

@toddparker

"disable" is actually a method on the button widget. This is basically a constructor (create) call for the widget:

$("#mytest").button();

while this is calling disable() on an existing button:

$("#mytest").button("disable");

You can't call the last example unless you've done the first one at some time before.

Contributor

jblas commented Dec 22, 2011

@toddparker

"disable" is actually a method on the button widget. This is basically a constructor (create) call for the widget:

$("#mytest").button();

while this is calling disable() on an existing button:

$("#mytest").button("disable");

You can't call the last example unless you've done the first one at some time before.

@toddparker

This comment has been minimized.

Show comment
Hide comment
@toddparker

toddparker Jan 1, 2012

Contributor

@jblas - Thanks, that was what I was thinking, just needed some confirmation.

Contributor

toddparker commented Jan 1, 2012

@jblas - Thanks, that was what I was thinking, just needed some confirmation.

garann added a commit to garann/jquery-mobile that referenced this issue Jan 10, 2012

@gseguin gseguin closed this in f0849af Jan 18, 2012

gseguin added a commit that referenced this issue Jan 18, 2012

Merge pull request #3442 from imjoshdean/master
Bug fix for #3141: Prevent inputs with unnecessary data-role button from being double enhanced

gseguin added a commit that referenced this issue Jan 19, 2012

gseguin added a commit that referenced this issue Jan 19, 2012

@lismore

This comment has been minimized.

Show comment
Hide comment
@lismore

lismore Jan 12, 2013

Hi everyone, never commented on GitHub before ,

I am having this issue of the button double enhancing.

This is what I have. HTML below (GitHub does not show it)

<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

I also tried with

I keep getting double submit buttons. Its the only thing holding me up at this stage of submitting my app to Apple.

lismore commented Jan 12, 2013

Hi everyone, never commented on GitHub before ,

I am having this issue of the button double enhancing.

This is what I have. HTML below (GitHub does not show it)

<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

I also tried with

I keep getting double submit buttons. Its the only thing holding me up at this stage of submitting my app to Apple.

@agcolom

This comment has been minimized.

Show comment
Hide comment
@agcolom

agcolom Jan 12, 2013

Member

@lismore could you try to produce a jsbin with your example? template here: http://jsbin.com/amozef/1/edit
(see details about how to report an issue: https://github.com/jquery/jquery-mobile/blob/master/CONTRIBUTING.md)

Thank you

Member

agcolom commented Jan 12, 2013

@lismore could you try to produce a jsbin with your example? template here: http://jsbin.com/amozef/1/edit
(see details about how to report an issue: https://github.com/jquery/jquery-mobile/blob/master/CONTRIBUTING.md)

Thank you

@lismore

This comment has been minimized.

Show comment
Hide comment
@lismore

lismore Jan 12, 2013

It seems it is not a bug but my implementation.

I changed the html button element to an input type=submit and when I went
to your link on JSBin I noticed in the html markup there.

data-role="page" which I had not got. Once I added that my constantly
spinning ajax loader image and the double button disappeared.

Thanks for the quick response.

Patrick

On Sat, Jan 12, 2013 at 10:13 PM, Anne-Gaelle Colom <
notifications@github.com> wrote:

@lismore https://github.com/lismore could you try to produce a jsbin
with your example? template here: http://jsbin.com/amozef/1/edit
(see details about how to report an issue:
https://github.com/jquery/jquery-mobile/blob/master/CONTRIBUTING.md)

Thank you


Reply to this email directly or view it on GitHubhttps://github.com/jquery/jquery-mobile/issues/3141#issuecomment-12185504.

lismore commented Jan 12, 2013

It seems it is not a bug but my implementation.

I changed the html button element to an input type=submit and when I went
to your link on JSBin I noticed in the html markup there.

data-role="page" which I had not got. Once I added that my constantly
spinning ajax loader image and the double button disappeared.

Thanks for the quick response.

Patrick

On Sat, Jan 12, 2013 at 10:13 PM, Anne-Gaelle Colom <
notifications@github.com> wrote:

@lismore https://github.com/lismore could you try to produce a jsbin
with your example? template here: http://jsbin.com/amozef/1/edit
(see details about how to report an issue:
https://github.com/jquery/jquery-mobile/blob/master/CONTRIBUTING.md)

Thank you


Reply to this email directly or view it on GitHubhttps://github.com/jquery/jquery-mobile/issues/3141#issuecomment-12185504.

@agcolom

This comment has been minimized.

Show comment
Hide comment
@agcolom

agcolom Jan 12, 2013

Member

I'm glad you found the problem :-)
and you're very welcome....

Member

agcolom commented Jan 12, 2013

I'm glad you found the problem :-)
and you're very welcome....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment