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

learn.jquery.com: Deprecated and Beaking Changes #740

Open
poing opened this issue Dec 19, 2016 · 1 comment
Open

learn.jquery.com: Deprecated and Beaking Changes #740

poing opened this issue Dec 19, 2016 · 1 comment

Comments

@poing
Copy link

poing commented Dec 19, 2016

I find myself struggling for answers, that just do not seem to be available anywhere. Trying to use
object literals as shown in the Learning Center leads to warnings, upgrading jQuery leads to the code not working.

//Using an object literal for a jQuery feature
var myFeature = {
  	init: function() {
	    console.log(Math.random());
    }
};
myFeature.init();
Version Console
jquery-1.8.3.js Use of getPreventDefault() is deprecated. Use defaultPrevented instead.
jquery-migrate-3.0.0.js jQuery.fn.load() is deprecated.
jquery-3.1.1 TypeError: url.indexOf is not a function.

I was able to find a different way to do it. But I ended up the same results. So the following code does not bring me any closer to building object literals in 3.1.1

// Create your own jQuery function
jQuery.fn.extend({
    init: function () {
        console.log(Math.random());
    }
});
$.fn.init();

So how is this an issue? Well, versions changes have affected the fundamental use. But the Learning Center only provides one (outdated) example.

$( document ).ready( myFeature.init );  // Deprecated
$( document ).on( 'ready' , myFeature.init );  // Deprecated?
$.fn.myFeature.init;  // Is this the correct way?

I suggest the Learning Center is updated with version specific documentation that shows relative examples for each version. I would like to help, but skill level is rather low.

Sincerely,
Brian LaVallee

@btangmu
Copy link

btangmu commented Jul 18, 2017

As Brian pointed out, the basic tutorial uses deprecated code like $( document ).ready(). That should be fixed. I was about to create an issue for it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants