Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #4204

Re: When do elements get their style attribute values?

From Tim Streater <timstreater@greenbee.net>
Newsgroups comp.lang.javascript
Subject Re: When do elements get their style attribute values?
Date 2011-07-14 22:08 +0100
Organization Personal Software
Message-ID <timstreater-3BCD3F.22081914072011@news.individual.net> (permalink)
References <timstreater-888955.17142712072011@news.individual.net> <s47r17ljum3pluv5sln2e2vn618ovv8hhu@4ax.com> <timstreater-4F6B2C.14485913072011@news.individual.net> <n1cu17taggf1k9e05euq2u9gugknlv63a3@4ax.com>

Show all headers | View raw


In article <n1cu17taggf1k9e05euq2u9gugknlv63a3@4ax.com>,
 Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> wrote:

> On Wed, 13 Jul 2011 14:49:00 +0100, Tim Streater wrote:
> 
> >In article <s47r17ljum3pluv5sln2e2vn618ovv8hhu@4ax.com>,
> > Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> wrote:
> 
> >> The answer is utterly simple. If some JavaScript program changes
> >> the height, then the style values are set exactly after that
> >> JavaScript program has finished its work and before the next one
> >> starts.
> 
> >Not really. I'm trying to *read* the values as soon as I can be sure 
> >that the element exists - in the onload handler. No JavaScript of mine 
> >has attempted to set the height (or margin-top etc) before that. And I 
> >don't want it to - I want to use CSS to define everything, and *read* it 
> >with javaScript.
> >
> >It usually helps to read the question before giving an answer.
> 
> Sorry, but you had written earlier: "But I find that if I do
> this right at the start of the onload function, I get back a
> zero value, whereas if I do it a bit later (e.g. after waiting
> for some ajax calls to complete), then I get the proper value.
> 
> I could not rule out that the Ajax calls change the height, so
> that seemed like the most likely explanation.

Fair enough :-)

> If not, then I have to assume that onload fires before the page
> is completely loaded, including its linked CSS files. That's
> news to me. Can anybody here confirm or deny it?

I'm using Safari 5.0.5 under OS X 10.6.8, I should add.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-12 17:14 +0100
  Re: When do elements get their style attribute values? Martin Honnen <mahotrash@yahoo.de> - 2011-07-12 18:20 +0200
    Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-12 17:44 +0100
  Re: When do elements get their style attribute values? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2011-07-13 15:27 +0200
    Re: When do elements get their style attribute values? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-07-13 13:37 +0000
    Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-13 14:49 +0100
      Re: When do elements get their style attribute values? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2011-07-14 20:24 +0200
        Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-14 22:08 +0100
  Re: When do elements get their style attribute values? RobG <rgqld@iinet.net.au> - 2011-07-14 16:08 -0700
    Re: When do elements get their style attribute values? Andrew Poulos <ap_prog@hotmail.com> - 2011-07-15 12:50 +1000
    Re: When do elements get their style attribute values? SteveYoungTbird <stephen.young@chello.at> - 2011-07-15 16:43 +0200
    Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-15 18:21 +0100
      Re: When do elements get their style attribute values? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-15 20:11 +0200
        Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-15 21:50 +0100
          Re: When do elements get their style attribute values? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-16 11:11 +0200
            Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-16 12:38 +0100
              Re: When do elements get their style attribute values? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-17 02:43 +0200
                Re: When do elements get their style attribute values? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-17 02:45 +0200
          Re: When do elements get their style attribute values? dhtml <dhtmlkitchen@gmail.com> - 2011-07-16 19:12 -0700
            Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-17 09:11 +0100
              Re: When do elements get their style attribute values? dhtml <dhtmlkitchen@gmail.com> - 2011-07-17 09:10 -0700
                Re: When do elements get their style attribute values? Tim Streater <timstreater@greenbee.net> - 2011-07-17 20:18 +0100
                Re: When do elements get their style attribute values? dhtml <dhtmlkitchen@gmail.com> - 2011-07-17 22:30 -0700
          Re: When do elements get their style attribute values? dhtml <dhtmlkitchen@gmail.com> - 2011-07-16 19:18 -0700
        Re: When do elements get their style attribute values? SteveYoungTbird <stephen.young@chello.at> - 2011-07-16 10:47 +0200
          Re: When do elements get their style attribute values? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-16 11:01 +0200

csiph-web