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 7605633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:12:57+00:00 2026-05-31T00:12:57+00:00

I’m using mootools 1.4.3 for basic class inheritance. I’m actually converting some code from

  • 0

I’m using mootools 1.4.3 for basic class inheritance. I’m actually converting some code from a different Class library. This other class library would dynamically create getters and setters based on a predefined function name template (a member function _get_xxx would yield a getter for xxx). I wanted to do something similar with mootools. I’m not new to Javascript, but I’m somewhat unfamiliar with the more advanced concepts.

I have gotten it to work partially. In the code where the Class object is being defined I loop through the classes parameters and add defineGetter or defineSetter accordingly.

http://jsfiddle.net/Qa2dr/1/

This works great and it creates the getters and setters properly. Where it fails is when I create a child class. These dynamic getters/setters are not propagated to the child class. I’m not sure if this is possible and if so how it is done. Using the above change to the mootools Class and these classes:

http://jsfiddle.net/vLyk7/10/

In the log for foo I can see the getter and setter for bar. In the log for baz I can see the getter and setter for quux, but I’d also like to see the getters and setters from the parent. Again, if I can get this to work, it will save me a lot of time in converting this code.

  • 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-31T00:12:59+00:00Added an answer on May 31, 2026 at 12:12 am

    Right. I think I get what you are trying to do but…

    __defineGetter__ and __defineSetter__ are deprecated and not cross browser: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/DefineSetter

    Protecting and proxying direct access to these properties won’t work when you extend the object because the setter/getter – accessing the properties on the new object – won’t go to the parent (prototype object) where you are listening.

    you can try looking at the Extends param. when you set the new Class up, look for the functions being present all the way up the prototype chain from the new params object and if a match is found, you should apply the setter/getter to the new object as well. it’s not that easy…

    I’d say, probably after: newClass.prototype.parent = parent; you should be able to check if the getter/setters have become available and attach your listeners. you probably want to save a reference somehow unless you want to check all class properties at this point.

    alternatively, you can refactor the initialize class mutator w/o going into the type creation and append your stuff there – though the original object may not be available.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.