Bug Tracker

Modify

Ticket #8562 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

In a javascript 'class' where 'this' refers to the object, hover with proxy does not work, but mousenter/mouseleave does.

Reported by: rfitzhugh Owned by: rfitzhugh
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocking: Blocked by:

Description


Change History

comment:1 Changed 3 years ago by rfitzhugh

Using IE8 and jQuery 1.5. Have simple jscript 'class'. Discovered that hover with proxy (where 'this' refers to the jscript object) does not work (meaning the function(s) in the hover never execute) although mouseenter/mouseleave with the same proxy and functions do work.

The following works:

.mouseenter($.proxy(this.doHover, this))

.mouseleave($.proxy(this.unDoHover, this))

The following does NOT work:

.hover(function() {$.proxy(this.doHover, this)}, function () {$.proxy(this.unDoHover, this)})

No errors are thrown, but the functions do not execute.

Thank you.

comment:2 Changed 3 years ago by ajpiano

  • Owner set to rfitzhugh
  • Status changed from new to pending

Thank you for your time and interest in helping the jQuery project, but we require that all bugs have a testcase that demonstrates the issue on  jsFiddle or  jsBin. If you can provide one, we'll be happy to investigate this issue further. Thanks!

comment:3 Changed 3 years ago by ajpiano

  • Status changed from pending to closed
  • Resolution set to invalid

Hm. It actually looks like you're just using proxy wrong in the hover statement.

.hover($.proxy(this.doHover,this),$.proxy(this.unDoHover,this)); is what you should be using. The way you have it now, it's just creating new proxy functions on every hover, and never firing them.

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.