Skip to content
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

trigger() function not pass extraParameters when trigger click event of a radio element (Only jQuery 3.2.0) #3579

Closed
GrayYoung opened this issue Mar 20, 2017 · 9 comments

Comments

@GrayYoung
Copy link

@GrayYoung GrayYoung commented Mar 20, 2017

$(document).on('click', '#tab-type .list-choice :radio', function(event, isSimulated) {
	// Prescription Type
	var pstType = $(this).val(), $colADD = PS.$tabs.eq(3).find('.col-add');

	if(PS.isSingleVision(pstType)) {
		$colADD.find('.form-control').val(PS.data.ADD.defaultValue).valid();
		$colADD.addClass('hidden');
	} else {
		$colADD.removeClass('hidden');
	}
	if(isSimulated !== true) { 
		if(PS.isNonRX(pstType)) {
			PS.$tabs.eq(3).removeClass('active');
		} else {
			// VWC-1075
			PS.$tabs.eq(3).addClass('active').find(':input:visible:first').focus();

			$modal.scrollTop($modal.scrollTop() + PS.$tabs.eq(3).offset().top);
		}
	}
	PS.data.prescriptionType = pstType;
	$btnNext.removeClass('hidden');
});

// In another function
PS.$tabs.eq(2).find(':radio').filter(function() {
	if(this.value === data.prescriptionType) {
		return true;
	}
	if($(this).closest('label').text().trim() === data.prescriptionType) {
		return true;
	}

	return false;
}).trigger('click', [true]);

isSimulated is undefined, it should be true.

@mgol
Copy link
Member

@mgol mgol commented Mar 20, 2017

Could you create a test case without external libraries on https://jsfiddle.net or https://jsbin.com?

@mgol
Copy link
Member

@mgol mgol commented Mar 20, 2017

...actually, this seems like https://bugs.jquery.com/ticket/13353 (also relevant: #1741). I'm closing this one as a duplicate; I assume your issue is not isolated to jQuery 3.2.0 but also happens in older versions.

@mgol mgol closed this Mar 20, 2017
@GrayYoung
Copy link
Author

@GrayYoung GrayYoung commented Mar 20, 2017

But when I switch the version to 3.1.1, the code work fine.

@mgol
Copy link
Member

@mgol mgol commented Mar 20, 2017

OK, please provide a test case on https://jsfiddle.net or https://jsbin.com then and we'll have a look.

@mgol mgol reopened this Mar 20, 2017
@mgol mgol added the Needs info label Mar 20, 2017
@GrayYoung
Copy link
Author

@GrayYoung GrayYoung commented Mar 20, 2017

https://jsfiddle.net/kzg5o5pa/5/

I finally have done the test case, trigger function with passing extraParameters not work on radio element, but button element. It is so strange.
Tested the case use jQuery 3.2.0 and jQuery 3.1.1, only not work when use jQuery 3.2.0 .

@GrayYoung GrayYoung changed the title trigger() function not pass extraParameters when update jQuery into 3.2.0 trigger() function not pass extraParameters when trigger click event of a radio element (Only jQuery 3.2.0) Mar 20, 2017
@mgol
Copy link
Member

@mgol mgol commented Mar 20, 2017

I can confirm the behavior. A simplified test case: https://jsfiddle.net/kzg5o5pa/7/.

This is a regression from 3.1.1.

Thank you!

@mgol mgol added Blocker Bug Event and removed Needs info labels Mar 20, 2017
@mgol mgol added this to the 3.2.1 milestone Mar 20, 2017
@mgol
Copy link
Member

@mgol mgol commented Mar 20, 2017

The regression was introduced in b442aba.

@mgol mgol added the Needs review label Mar 20, 2017
@gibson042
Copy link
Member

@gibson042 gibson042 commented Mar 20, 2017

The regression was introduced in b442aba.

And as such, is actually a "fix" to a consistently-broken state.

@timmywil
Copy link
Member

@timmywil timmywil commented Mar 20, 2017

We're going to back out this change and take closer look at #1367 for 3.3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.