Class inheritance change in 2.5.3-SNAPSHOT

8 views
Skip to first unread message

Phil Gates-Idem

unread,
Oct 24, 2013, 5:23:45 PM10/24/13
to rapt...@googlegroups.com
The _inherit function in raptor.js was copying properties from base class constructor to derived class constructor and it was clobbering some of the properties (such as "static" functions) that were in the derived class.

I made this change:
-            extend(clazz,inherit);
+            for (var key in inherit) {
+                // don't use extend because we should only copy properties
+                // that don't exist on target clazz
+                if (inherit.hasOwnProperty(key) && (clazz[key] === undefined)) {
+                    clazz[key] = inherit[key];
+                }
+            }

This is just an FYI. I don't think it will break anything

Patrick Steele-Idem

unread,
Oct 24, 2013, 7:32:03 PM10/24/13
to rapt...@googlegroups.com
Hmm... why are we even copying properties from the superclass constructor to the derived constructor? Seems like we should just delete those lines altogether... I'm not sure why I added it to begin with.


--
You received this message because you are subscribed to the Google Groups "RaptorJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raptorjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Phil Gates-Idem

unread,
Oct 24, 2013, 10:18:19 PM10/24/13
to rapt...@googlegroups.com
I think they should be removed as well.
Reply all
Reply to author
Forward
0 new messages