Bug Tracker

Modify

Ticket #8162 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

jQuery Load Event linking to bad code

Reported by: guybedford Owned by: kswedberg
Priority: low Milestone:
Component: web Version:
Keywords: Cc: paul_irish
Blocking: Blocked by:

Description

The jQuery events page links to an image load plugin on this page:

 http://api.jquery.com/load-event/ to  https://github.com/peol/jquery.imgloaded/raw/master/ahpi.imgload.js

I spent a good amount of time trying to get the above to work like so: $('.container img').load(function(){ $(this).fadeIn(); });

Unfortunately it was giving an error as $('img') isn't the exact element (you need to use $('img')[0]) and hence it fails the initial Tag Name check in the code.

I ended up using the newer version here -

 https://gist.github.com/268257

It would be worth updating the link.

Change History

comment:1 Changed 2 years ago by addyosmani

  • Owner set to jdsharp
  • Priority changed from undecided to low
  • Component changed from unfiled to web

As mentioned by desandro in one of the gists, if you want the images as context inside the callback, then you should be using paul_irish's original version. That said the ajpi.imgload.js file is specifically noted as being broken at the moment so we may end up removing the reference to it completely. I'll speak to paul_irish and peol before we commit to making any changes here.

comment:2 Changed 2 years ago by addyosmani

  • Cc paul_irish added

CC'ing paul_irish for his input on this.

comment:3 Changed 2 years ago by jitter

Huh? Why do we even have a link to a "3rd party" plugin on the official api documentation? We also don't link to e.g.  https://github.com/brandonaaron/jquery-cssHooks on the .css/.animate pages.

I opt for removing this link.

comment:4 Changed 2 years ago by jdsharp

  • Owner changed from jdsharp to kswedberg
  • Status changed from new to assigned

Assigning to Karl

comment:5 Changed 2 years ago by jitter

  • Version 1.5 deleted
  • Milestone 1.next deleted

comment:6 Changed 2 years ago by addyosmani

  • Status changed from assigned to closed
  • Resolution set to fixed

I've gone in and removed the blockquote where we reference peol's special events plugin for image loading. Given that a) it's stated as broken on GitHub and b) we probably shouldn't be referencing third party plugins unless we're sure they're working with the current stable release, it doesn't make sense to be recommending it. Please feel free to revert this change if you disagree.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.