Skip to main content

Bug Tracker

Side navigation

#8162 closed feature (fixed)

Opened February 03, 2011 03:45PM UTC

Closed February 06, 2011 10:24PM UTC

jQuery Load Event linking to bad code

Reported by: guybedford Owned by: kswedberg
Priority: low Milestone:
Component: web Version:
Keywords: Cc: paul_irish
Blocked by: Blocking:
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.

Attachments (0)
Change History (6)

Changed February 03, 2011 04:36PM UTC by addyosmani comment:1

component: unfiledweb
owner: → jdsharp
priority: undecidedlow

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.

Changed February 03, 2011 04:54PM UTC by addyosmani comment:2

cc: → paul_irish

CC'ing paul_irish for his input on this.

Changed February 03, 2011 06:23PM UTC by jitter comment:3

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.

Changed February 03, 2011 07:59PM UTC by jdsharp comment:4

owner: jdsharpkswedberg
status: newassigned

Assigning to Karl

Changed February 03, 2011 11:40PM UTC by jitter comment:5

milestone: 1.next
version: 1.5

Changed February 06, 2011 10:24PM UTC by addyosmani comment:6

resolution: → fixed
status: assignedclosed

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.