Side navigation
#8391 closed bug (duplicate)
Opened February 26, 2011 11:43AM UTC
Closed February 28, 2011 11:23AM UTC
Last modified February 28, 2011 05:23PM UTC
scrollTop, scrollLeft setters break chaining when selector doesn't match any elements
Reported by: | fred.mol@gmail.com | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | offset | Version: | 1.5.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The following line throws a javascript error:
$('.does-not-exist').scrollTop(0).scrollLeft(0);
The reason is that both scrollTop and scrollLeft always return
null when the selector doesn't match any elements. They should
only return null when used as getter (i.e. called without any
arguments)
Test case: http://jsfiddle.net/QZ6nH/1/
Attachments (0)
Change History (5)
Changed February 27, 2011 02:02AM UTC by comment:1
status: | new → open |
---|
Changed February 27, 2011 09:27PM UTC by comment:2
component: | unfiled → attributes |
---|---|
milestone: | 1.next → 1.6 |
priority: | undecided → low |
Changed February 28, 2011 11:23AM UTC by comment:3
component: | attributes → offset |
---|---|
milestone: | 1.6 → 1.next |
priority: | low → high |
resolution: | → duplicate |
status: | open → closed |
Changed February 28, 2011 05:23PM UTC by comment:5
Here's a pull request with the fix: https://github.com/jquery/jquery/pull/171
Yep, seems inconsistent.