Matt,
I think he meant an "actual" height change, not just intercepting
#setStyle call. Timer seems like an only option in that case, and
you're right about performance hog. On a side note, I wouldn't
recommend "wrapping" an already "methodized" #setStyle - it's very
inefficient. It's also a good idea to see what "style" is, as it could
be either an object or a string. Moreover, "style.height" could be 0,
so "if (style.height && ... )" would not work as expected.

- kangax

On Jun 25, 10:47 am, Matt Foster <[EMAIL PROTECTED]> wrote:
> Hmm this is an interesting idea, so many different ways to access that
> property, and with no native property change model it seems
> impossible.  My first thought was using a timer but that is going to
> gum up resources.  If in your app you were savvy and used a setter
> method you could implement an event that would get this done.  Using
> prototype's setStyle, and ele being a valid dom reference you could do
> something like this
>
> ele.setStyle = ele.setStyle.wrap(function(prc, style){
>         if(style.height && this.getHeight() != style.height.match(/^[0-9]+/
> g).first()){
>                 prc(style);
>                 this.fire("derka:heightChange");
>         }
>         else
>                 prc(style);
>
> });
>
> Which would work fine for a single element, if you wanted to observe
> multiple elements height change I'd suggest iterating over a
> collection of objects that needed this functionality and wrap their
> setStyle methods.
>
> Here is a basic working demo of this in action, be sure to have
> firebug working as the debug comes across in the 
> console.http://positionabsolute.net/projects/javascript/propertyChangeEvent/
>
> --
> Matt Foster
> Ajax Engineer
> Nth Penguin, LLChttp://www.nthpenguin.com
>
> On Jun 24, 9:12 pm, mocambo <[EMAIL PROTECTED]> wrote:
>
> > Could anybody give me any suggestions for observing
> > Element.style.height change ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to