Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JQuery deprecation: $(document).ready() method

jeffbissNov 9 2016 — edited Nov 9 2016

I am trying to get a grip on how to develop OracleJET projects on my own, from scratch and was trying to figure out:

require(['ojs/ojcore', 'knockout', 'jquery', 'ojs/ojknockout', 'ojs/ojmodule', 'ojs/ojbutton', 'ojs/ojtoolbar', 'ojs/ojmenu'], // add additional JET component modules as needed

        function (oj, ko, $) // this callback gets executed when all required modules are loaded

        {

            function DemoViewModel() {

            }

            $(document).ready(

                    function ()

                    {

                        ko.applyBindings(new DemoViewModel());

                    }

            );

        }

);

I found, from an internet search that "ready" is a jQuery handler method. I found the jQuery ready page (https://api.jquery.com/ready/) and see that the form $(document).ready(handler) is deprecated, that $(handler) should be used.

So, should this code in main.js be updated to:

require(['ojs/ojcore', 'knockout', 'jquery', 'ojs/ojknockout', 'ojs/ojmodule', 'ojs/ojbutton', 'ojs/ojtoolbar', 'ojs/ojmenu'], // add additional JET component modules as needed

        function (oj, ko, $) // this callback gets executed when all required modules are loaded

        {

            function DemoViewModel() {

            }

            $(

                function ()

                {

                    ko.applyBindings(new DemoViewModel());

                }

            );

        }

);

This post has been answered by John JB Brock-Oracle on Nov 9 2016
Jump to Answer
Comments
Post Details
Added on Nov 9 2016
1 comment
974 views