Merge pull request #13348 from zfox23/MS14129_buyButtonStuck

Fix MS14129: Prevent Marketplace buttons from getting stuck in hover state
This commit is contained in:
Zach Fox 2018-06-12 11:02:52 -07:00 committed by GitHub
commit cf9cf45d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -306,13 +306,21 @@
// change pricing to GET/BUY on button hover
$('body').on('mouseenter', '#price-or-edit .price', function () {
var $this = $(this);
var buyString = "BUY";
var getString = "GET";
// Protection against the button getting stuck in the "BUY"/"GET" state.
// That happens when the browser gets two MOUSEENTER events before getting a
// MOUSELEAVE event.
if ($this.text() === buyString || $this.text() === getString) {
return;
}
$this.data('initialHtml', $this.html());
var cost = $(this).parent().siblings().text();
if (parseInt(cost) > 0) {
$this.text('BUY');
$this.text(buyString);
} else {
$this.text('GET');
$this.text(getString);
}
});