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

Add the domReady! statement #13310

Conversation

arnoudhgz
Copy link
Contributor

Description

When you are on the cart page and click on the 'edit' link for a product you are being redirected to the PDP and the current amount for that product that is in the cart should be filled in the amount field on the PDP.

In production mode when the settings minify and merge the javascript files in Stores > Configuration > Advanced > Developer are enabled the jquery selector sometimes (depending on the amount of javascript files) returns no values because the DOM is not ready when the script is executed.

By adding the domReady! statement in the require part we are sure that when the jQuery selector is being filled the DOM is ready.

This issue could not be reproduced on a clean magento 2.2 installation, but in a project where significantly more (external) modules (and therefore more javascript files) are included the issue occurred.

Manual testing scenarios

  1. Go to a PDP
  2. Add a product to the cart
  3. Go to the cart page (view and edit cart from the minicart)
  4. Click the edit button for the product in the cart
  5. See that the amount that you have in your cart for the product is being filled in the amount field on the PDP.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

The jquery selector sometimes (depending on the amount of javascript
files) returns no values because the DOM is not ready when the script is
executed.

By adding the domReady! statement in the require part we are sure that
when the jQuery selector is being filled the DOM is ready.
@magento-engcom-team
Copy link
Contributor

@arnoudhgz thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-team magento-team merged commit a797afe into magento:2.2-develop Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants