$('som_div') 
$('som_div div.child_of_some_div')

I find myself frequently referencing child divs so use .down() a lot.  It 
would be convenient at times to get to that child div directly with the $ 
shortcut as I've exampled above. Has anyone else considered this or 
something similar?  Would this be a costly addition to the core, or perhaps 
a mistake for the core? 

1 good justifying reason for this, and perhaps there is an easy fix here as 
well.
I frequently will write a class and the class itself will expect a layer 
object; that layer object being the primary container for content the class 
interacts with.  So my constructor usually looks like:

var myClass = Class.create({
  initialize:function(layer) {
    this.container = $(layer);            // here is the 
  }
});

I'm finding that I do not have a convenient way to initialize myClass when 
layer is not a defined object, so when it is a child object of a defined 
object this is not convenient.

I'd like for the following to be suitable means to instantiate myClass:
var _myClass = new myClass('my_div');    // where my_div is a defined object
var _myClass = new myClass('my_div div.child')    // where we intend the 
child div of my_div to be the classes container

The latter does not work with the $ approach in the initializer for the 
class.  Is there another convenient means to accomplish this in the class or 
am I stuck doing this:
var _myClass = new myClass($('my_div').down('div.child'))

Karl..

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/aPZhw0xvJtoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to