Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7070561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:34:53+00:00 2026-05-28T05:34:53+00:00

The original code: this.control.addEventListener(‘click’, $.proxy(function() { this.time.hashours = (this.duration() / 3600) >= 1.0; this.time.duration.text(getTime(this.duration(),

  • 0

The original code:

this.control.addEventListener('click', $.proxy(function() {
    this.time.hashours = (this.duration() / 3600) >= 1.0;
    this.time.duration.text(getTime(this.duration(), this.controls.time.hasHours));
    this.time.current.text(getTime(0, this.controls.time.hasHours));
}, this));

The attempt at cross-browser support:

$(this.control).bind('click', $.proxy(function(e) {
    var o = e.delegateTarget;
    o.time.hashours = (o.duration() / 3600) >= 1.0;
    o.time.duration.text(getTime(o.duration(), o.controls.time.hasHours));
    o.time.current.text(getTime(0, o.controls.time.hasHours));
}, this));

Even with the proxy, the context of this no longer belongs to the calling object because of jQuery’s custom event model. How can I get the original this.control?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:34:54+00:00Added an answer on May 28, 2026 at 5:34 am

    Even with the proxy, the context of this no longer belongs to the calling object because of jQuery’s custom event model.

    I don’t think jQuery’s custom event model is the problem here. When you proxy the callback function, the this value should refer to the root object that contains control and other properties such as ctime and time as in your original example.

    In other words, don’t try to get the original object like this from the delegateTarget

    var o = e.delegateTarget;
    o.time.hashours = (o.duration() / 3600) >= 1.0;
    ...
    

    but just stick to your original code,

    this.time.hashours = (this.duration() / 3600) >= 1.0;
    

    Checkout this minimal example that resembles your structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from this code will show in original color how can i change it to
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
String product = Integer.toString(w); char[] original = String.toCharArray(product); This is the code I have
Update Luckily, the code that WebKit uses to make this control draws onto a
The original code: public List<Contact> GetContactListEntityCompiledLINQ() { if (entities == null) entities = new
here is the original code: public static int getInt () { Scanner in =
I've got a webapp whose original code base was developed with a hand crafted
I have a plugin where the original code is ... // when the DOM
Original Working VB_Code Private Declare Function ConnectReader Lib rfidhid.dll () As Integer Private Declare
The code below is (hopefully) a minimized testcase of my original problem. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.