Sorry, I'm dumb... just do (pWidth * .9).round();

On Feb 17, 9:27 am, Iain <[email protected]> wrote:
> just do some math.  once the textarea is injected do:
>
> var pWidth = textarea.getParent().getSize().x;
> var tWidth = ( ( pWidth * .9 ) * 100 ).round();
>
> textarea.setStyle( 'width', tWidth );
>
> Anyways, I still think this could be done with CSS and I think you're
> just over-complicating it.
>
> On Feb 17, 9:05 am, ryan <[email protected]> wrote:
>
> > You are :)
> > We're writing an inline html editor, so we dont know the width of the
> > textarea... and there can be multiple per page.
>
> > On Feb 17, 4:34 pm, Michal Charemza <[email protected]> wrote:
>
> > > I really think that it is possible by adding a class to the wrapper.  
> > > Say if your css is:
>
> > > #container {width: 40em}
> > > .wrapper, textarea { width: 90%; }
> > > .wrapper textarea { width: 100%; }
>
> > > And your original HTML is
>
> > > <div id="container">
> > >    <textarea></textarea>
> > > </div>
>
> > > Before any JS is run, the textarea's width will be 90% of the width of  
> > > container, due to the second CSS rule.
>
> > > Then you wrap the textarea with a div of class "wrapper". Then the DOM  
> > > will be like:
>
> > > <div id="container">
> > >    <div class="wrapper"><textarea></textarea></div>
> > > </div>
>
> > > When the wrapper is injected into the page, its width will be 90% of  
> > > the container, due to the second CSS rule. Then the textarea's width  
> > > will be 100% of the wrapper, due to the third CSS rule. This will be  
> > > equal to 90% of the width of the container, exactly how it was before  
> > > the textarea was wrapped.
>
> > > Or am I missing something?
>
> > > Michal.
>
> > > On 17 Feb 2009, at 16:05, ryan wrote:
>
> > > > As its wrapping the texarea with a div through javascript.
>
> > > > On Feb 17, 1:27 pm, Michal <[email protected]> wrote:
> > > >> There is an undocumented function in Fx or Fx.CSS that parses the CSS
> > > >> files (used in Fx.Morph)... you might be able to use that? Still, I  
> > > >> am
> > > >> curious as to why the CSS solution won't work...?
>
> > > >> On Tue, Feb 17, 2009 at 1:23 PM, ryan <[email protected]> wrote:
>
> > > >>> Yeah, which we're not... it doesnt work in this case :(
> > > >>> Thats what I thought would work too... seems strange that there is  
> > > >>> no
> > > >>> way to access the original style sheet information?

Reply via email to