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


Groups > comp.lang.javascript > #4117 > unrolled thread

When do elements get their style attribute values?

Started byTim Streater <timstreater@greenbee.net>
First post2011-07-12 17:14 +0100
Last post2011-07-16 11:01 +0200
Articles 6 on this page of 26 — 9 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

Page 2 of 2 — ← Prev page 1 [2]


#4247

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-07-17 09:10 -0700
Message-ID<a476f91d-522f-4988-8667-53735cc47e7f@a2g2000prf.googlegroups.com>
In reply to#4242
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.

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

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?

> "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).
--
Garrett

[toc] | [prev] | [next] | [standalone]


#4248

FromTim Streater <timstreater@greenbee.net>
Date2011-07-17 20:18 +0100
Message-ID<timstreater-67276A.20185417072011@news.individual.net>
In reply to#4247
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

[toc] | [prev] | [next] | [standalone]


#4268

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-07-17 22:30 -0700
Message-ID<6f908137-6a4b-43a8-aa1c-c19f32c62906@y13g2000prb.googlegroups.com>
In reply to#4248
On Jul 17, 12:18 pm, Tim Streater <timstrea...@greenbee.net> wrote:
> In article
> <a476f91d-522f-4988-8667-53735cc47...@a2g2000prf.googlegroups.com>,
>
>  dhtml <dhtmlkitc...@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.
>
[...]
> > 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.
>
Got it. You want something like a hypothetical "stylesLoaded" flag or
a maybe a `sync` attribute on the LINK element or (blasphemy) a "Chain
of Dependency" pattern where you could declare that one object or
resource depends on the LINK (or SCRIPT).

> > 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".
>
Here are some further discussions. I proposed a "Chain of Dependency"
pattern to WHATWG. Apparently I am too mean to have ideas worth
considering.
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-February/018560.html

A shame, because it is a wonderfully expressive and powerful way to
express a dependency chain.

> 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)
>
I see what he's after there but yeah, it's a kludge.

> In terms of a reduced test case, I'll put one together and report back.
>
Alright. There's some speculation here that the Ajax call is
interfering. I'm not convinced either way. OTOH, I'm not quite
motivated enough to download browsers and start writing tests. But if
I were, I'd try and reduce it to the simplest thing that can trigger
the problem situation.

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

That is a historical document having little bearing on law in
America.

I once tried asserting my fourth amendment rights to a police officer
who was attempting a search. I got beaten and bruised all over -- cuts
and bruises on back, arms, legs. I spent the night in jail and was
charged with two counts of A&B on a PO (felony charges). I was dirt
poor and got a court appointed attorney who, fortunately, was not a
schlep and helped me to beat the case. That's what happened when I
decided not to let the cop search me and instead spoke the fourth
amendment.

But my case is a mild one. Waco massacre was more severe.
--
Garrett

[toc] | [prev] | [next] | [standalone]


#4239

Fromdhtml <dhtmlkitchen@gmail.com>
Date2011-07-16 19:18 -0700
Message-ID<bca5a9fc-3bfd-4767-a258-d71384b29773@z15g2000pre.googlegroups.com>
In reply to#4223
On Jul 15, 1:50 pm, Tim Streater <timstrea...@greenbee.net> wrote:
> In article <2976520.SPkdTlG...@PointedEars.de>,
>  Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote:
>
>
>
>
>
>
>
>
>
> > Tim Streater wrote:
>
> > > RobG <rg...@iinet.net.au> wrote:
> > >> You should note that you have posted the same question here:
>
> > >> <URL:
>
> >http://groups.google.com/group/jsmentors/browse_frm/thread/97771feb3c...
>
> > Ouch.
>
> > > And guess what: I got an intelligent answer and suggestion for
> > > workaround there, too.
>
> > The fact that their[tm] crystal balls work slightly better than ours[tm]
> > does not mean that your question was a smart one.
>
> Don't be silly. My question was clear and concise and contained all the
> necessary information (apart from which browser I was trying), as is
> evidenced by the answers on jsmentors.
>
The reason that I do not post on JS Mentors is that it is censored and
moderated by Rey Bango. And I have had at least one post not show up
on that list.
--
Garrett

[toc] | [prev] | [next] | [standalone]


#4226

FromSteveYoungTbird <stephen.young@chello.at>
Date2011-07-16 10:47 +0200
Message-ID<31992$4e215029$5471378a$30732@news.chello.at>
In reply to#4219
On 07/15/2011 08:11 PM, Thomas 'PointedEars' Lahn wrote:

> The fact that their[tm] crystal balls work slightly better than ours[tm]
> does not mean that your question was a smart one.
>

Actually, I don't believe that you can claim the words "their" and 
"ours"[sic] as trademarks.

Steve.

[toc] | [prev] | [next] | [standalone]


#4227

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-07-16 11:01 +0200
Message-ID<2976702.SPkdTlGXAF@PointedEars.de>
In reply to#4226
SteveYoungTbird wrote:

> On 07/15/2011 08:11 PM, Thomas 'PointedEars' Lahn wrote:
> 
>> The fact that their[tm] crystal balls work slightly better than ours[tm]
>> does not mean that your question was a smart one.
>>
> 
> Actually, I don't believe that you can claim the words "their" and
> "ours"[sic] as trademarks.

`[tm]' most of the time has a different meaning in Usenet.


F'up2 PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
 -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web