jquery / jquery/learn.jquery.com

learn.jquery.com: Deprecated and Beaking Changes

Open
#740 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
915
Forks
471
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Learning Center and Code Organization/object literals page, then compare the documented examples with the jQuery 1.8.3, 3.0.0, and 3.1.1 cases described here. Update the documentation with version-specific guidance and examples for the affected patterns, with the deprecated and broken behavior clearly addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.