Bug Tracker

Modify

Ticket #7931 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by anonymous

comment:2 Changed 3 years ago by rwaldron

  • Owner set to Xavi-
  • Priority changed from undecided to high
  • Status changed from new to assigned
  • Component changed from unfiled to offset

comment:3 Changed 3 years ago by jitter

#8391 is a duplicate of this ticket.

comment:4 Changed 3 years ago by john

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Milestone changed from 1.next to 1.6

Landed.

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.