PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] What is the difference between Shopify checkout liquid template page:load event and DOMContentLoaded?

 June 30, 2022     javascript, shopify, shopify-template     No comments   

Issue

Shopify checkout liquid offers an event called:

page:load

Documentation: page-load

Unfortunately, the documentation is sparse. What is the difference between page:load and regular JavaScript DOMContentLoaded event?


Solution

From MDN webdocs

The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.

While from Shopify Docs

All of the checkout steps are hosted at a single URL path, where the content is loaded dynamically depending on the current step.

Shopify is most probably loading some stuff on their end on DOMContentLoaded and fires page:load event when everything is ready and you can make your DOM customizations. Moreover, DOMContentLoaded will only be fired once for whole checkout, but page:load would be fired once for each Checkout step.

Same thing has been described in the docs for page:load.

The page:load event is triggered when the content of each step is loaded. This is the default event that you should use when adding content into the page on load.



Answered By - Bilal Akbar
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing