Side navigation
#7931 closed bug (fixed)
Opened January 09, 2011 11:15PM UTC
Closed April 12, 2011 08:14PM UTC
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:
#!js // 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.
Attachments (0)
Change History (4)
Changed January 10, 2011 12:17AM UTC by comment:1
Changed January 18, 2011 01:36PM UTC by comment:2
component: | unfiled → offset |
---|---|
owner: | → Xavi- |
priority: | undecided → high |
status: | new → assigned |
Changed April 12, 2011 08:14PM UTC by comment:4
milestone: | 1.next → 1.6 |
---|---|
resolution: | → fixed |
status: | assigned → closed |
Landed.
Here's the pull request: https://github.com/jquery/jquery/pull/171