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


Groups > comp.lang.javascript > #4248

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-17 20:18 +0100
Organization Personal Software
Message-ID <timstreater-67276A.20185417072011@news.individual.net> (permalink)
References (3 earlier) <2976520.SPkdTlGXAF@PointedEars.de> <timstreater-2B95E1.21504315072011@news.individual.net> <3f5e837b-b881-44fd-a5b2-1632be2d684a@r5g2000prf.googlegroups.com> <timstreater-2926CA.09110617072011@news.individual.net> <a476f91d-522f-4988-8667-53735cc47e7f@a2g2000prf.googlegroups.com>

Show all headers | View raw


In article 
<a476f91d-522f-4988-8667-53735cc47e7f@a2g2000prf.googlegroups.com>,
 dhtml <dhtmlkitchen@gmail.com> wrote:

> On Jul 17, 1:11 am, Tim Streater <timstrea...@greenbee.net> wrote:
> > In article
> > <3f5e837b-b881-44fd-a5b2-1632be2d6...@r5g2000prf.googlegroups.com>,
> >
> >  dhtml <dhtmlkitc...@gmail.com> wrote:
> > > Where the style for `e` is defined? Is it in style attribute? An
> > > external stylesheet? In a STYLE element in the head?
> >
> > It's in an external style sheet.
> >
> The title of the thread is "When do elements get their style attribute
> values?" which got me to thinking about how the browser parses start
> tag. The term "attribute" has a specific meaning when talking about an
> element. Your problem is not that.

Quite possibly my terminology was not quite correct.

> Your problem is that you have is an external stylesheet and you want to
> know when elements get their styles from that.

Yes, and more particularly, when getComputedStyle could be relied upon 
to reliably return their values.

> Diego stated: "OK, in Safari it seems stylesheet are loaded
> asynchronously." However I'm thinking onload shouldn't fire until
> after all stylesheets have loaded. Can you upload a reduced test case
> so we can see what's going on?

When I started this, I was hoping that there was something trivial I 
didn't know about or had overlooked. That seems not to be the case; the 
other response on jsmentors, from Pete Otaqui, confirmed what Diego 
stated and went on to imply that this was a problem with all browsers. 
He gave some links where the issue is discussed further. News to me, I 
had naively expected that onload meant "fire when all is loaded".

Pete's suggested solution is to have an invisible element, apply (in the 
external stylesheet) a z-index to it, and AFAICT poll waiting for that 
to be applied, then assume all other styles have been applied. 
Personally, I wouldn't want to rely on that. Further, putting in a 
mechanism as complicated as that just to make a slight reduction in the 
application's maintenance load doesn't seem to me to be a good 
trade-off. So for the time being I'll leave things as they are (i.e. 
hardwire the values)

In terms of a reduced test case, I'll put one together and report back.

> > "That excessive bail ought not to be required, nor excessive fines imposed,
> > nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689
> An historical document having little bearing on law in America
> (unfortunately).

Except to the extent that the US Bill of Rights is based on it. As an 
aside, I should note that there are those who think the British don't 
have a written constitution. We do, of course, it's simply not all 
written down in one place. In particular there are:

Magna Carta 1215
Petition of Right 1628
Habeas Corpus Act 1679
English Bill of Rights 1689
Act of Settlement 1700 or so
and various Representation of the People Acts

-- 
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