Bug Tracker

Ticket #6170 (closed bug: fixed)

Opened 5 years ago

Last modified 3 years ago

jQuery(window).scroll(); causes IE* to scroll to 0,0

Reported by: rlrosario Owned by: dmethvin
Priority: high Milestone: 1.7
Component: event Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

Triggering the scroll event on the window ('jQuery(window).scroll();') should be considered a special case because the window object has a scroll method that takes two parameters: x,y. On non-IE browsers, the call gets ignored when parameters aren't passed in. But on IE*, the call takes on 0,0 as a default and scrolls the page. This issue is preventing me from triggering scroll handlers this way because of the undesirable side effect.

I wrote a patch on github:  http://github.com/rlr/jquery/commit/10966bb9b0c46c69697ebf4703b8ddc9906648f3

Change History

comment:1 in reply to: ↑ description Changed 5 years ago by rlrosario

Any way to edit this bug? It really should be Version 1.4.2 Milestone 1.4.3 but that wasnt available when I submitted it?

comment:2 Changed 4 years ago by dmethvin

  • Priority set to undecided
  • Status changed from new to open

comment:3 Changed 4 years ago by dmethvin

  • Owner set to dmethvin
  • Priority changed from undecided to low
  • Status changed from open to assigned
  • Milestone changed from 1.4.2 to 1.6

comment:4 Changed 4 years ago by john

  • Priority changed from low to high
  • Milestone changed from 1.6 to 1.next

comment:5 Changed 3 years ago by dmethvin

This is the problem where we execute methods on things that are not .nodeType===1 DOM elements, such as window or plain Object. The solution is to not run those methods for such cases.

comment:6 Changed 3 years ago by john

(This was confirmed during the bug triage meeting.)

comment:7 Changed 3 years ago by dmethvin

Since this behavior may be desired (or at least currently used) for plain objects, I'm only planning to exclude window in the 1.7 patch.

comment:8 Changed 3 years ago by dmethvin

  • Milestone changed from 1.next to 1.7

comment:9 Changed 3 years ago by Dave Methvin

  • Status changed from assigned to closed
  • Resolution set to fixed

Fix #6170. Don't try to run DOM methods on window.

Changeset: 6872d31f5a7d6162161b61bfd35ad0e8aa545395

comment:10 Changed 3 years ago by dmethvin

#10355 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.