Bug Tracker

Opened 7 years ago

Closed 6 years ago

#7931 closed bug (fixed)

scrollTop and scrollLeft setters return null when called on empty jquery object

Reported by: anonymous Owned by: Xavi-
Priority: high Milestone: 1.6
Component: offset Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

Both the $.fn.scrollTop and $.fn.scrollLeft setters return null when called on an empty jquery object. This leads to unexpected null pointer exceptions. Example:

// Causes null pointer exception
$(".does-not-exists").scrollTop(100).addClass("scrolled");

This is also inconsistant behavior. Most jquery setters (e.g. height, width, addClass, attr, css, etc...) always return jquery objects.

Change History (4)

comment:1 Changed 7 years ago by anonymous

comment:2 Changed 7 years ago by Rick Waldron

Component: unfiledoffset
Owner: set to Xavi-
Priority: undecidedhigh
Status: newassigned

comment:3 Changed 6 years ago by jitter

#8391 is a duplicate of this ticket.

comment:4 Changed 6 years ago by john

Milestone: 1.next1.6
Resolution: fixed
Status: assignedclosed

Landed.

Note: See TracTickets for help on using tickets.