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


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

DOM styling modified by <body onload=> JavaScript does not affect first rendering

Started by"Chris Beall" <Chris_Beall@prodigy.net>
First post2014-10-28 18:08 -0400
Last post2014-11-01 18:03 -0400
Articles 20 on this page of 24 — 9 participants

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


Contents

  DOM styling modified by <body onload=> JavaScript does not affect first rendering "Chris Beall" <Chris_Beall@prodigy.net> - 2014-10-28 18:08 -0400
    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering BootNic <bootnic.bounce@gmail.com> - 2014-10-29 00:26 -0400
    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering John Harris <niam@jghnorth.org.uk.invalid> - 2014-10-29 15:33 +0000
    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-10-29 21:11 +0000
      Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-10-30 10:12 +0100
        Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-10-31 20:45 +0000
          Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-11-01 10:12 +0100
            Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Tim Streater <timstreater@greenbee.net> - 2014-11-01 10:19 +0000
              Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-11-01 12:22 +0100
              Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 15:22 +0100
            Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-01 11:32 +0100
              Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-11-01 12:25 +0100
              Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 15:23 +0100
                Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-01 16:50 +0100
                  Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 20:40 +0100
                    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-02 20:55 +0100
                      Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-29 19:27 +0100
      Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Chris Beall" <Chris_Beall@prodigy.net> - 2014-10-30 15:46 -0400
    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-10-31 12:52 +0100
      Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Chris Beall" <Chris_Beall@prodigy.net> - 2014-10-31 10:37 -0400
    Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Chris Beall" <Chris_Beall@prodigy.net> - 2014-10-31 12:53 -0400
      Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Joao Rodrigues <groups_jr-1@yahoo.com> - 2014-11-01 10:41 -0200
        Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-01 15:29 +0100
        Re: DOM styling modified by <body onload=> JavaScript does not affect first rendering "Chris Beall" <Chris_Beall@prodigy.net> - 2014-11-01 18:03 -0400

Page 1 of 2  [1] 2  Next page →


#26015 — DOM styling modified by <body onload=> JavaScript does not affect first rendering

From"Chris Beall" <Chris_Beall@prodigy.net>
Date2014-10-28 18:08 -0400
SubjectDOM styling modified by <body onload=> JavaScript does not affect first rendering
Message-ID<op.xognrthttnmj2w@cbealls-imac.local>
(If this is too far off-topic for this group, please suggest another)

Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html

Observation: Of the tested browsers, only Firefox renders the page AFTER  
applying the style modifications (which is what I wanted).

Question: Is there a way to make this work on all modern browsers?  How  
about an easy way?  Or is it a rather widespread bug?

Why would you want to do this:  Because I want to modify animation timing  
based on the current dimensions of the window, without user interaction  
and when the page is first displayed.  The intent is to synchronize an  
animated walking-figure .gif to the window width.

Chris Beall

[toc] | [next] | [standalone]


#26016

FromBootNic <bootnic.bounce@gmail.com>
Date2014-10-29 00:26 -0400
Message-ID<20141029002611.053a995e@bootnic.server>
In reply to#26015

[Multipart message — attachments visible in raw view] — view raw

In article <op.xognrthttnmj2w@cbealls-imac.local>,
"Chris Beall" <Chris_Beall@prodigy.net> wrote:

> (If this is too far off-topic for this group, please suggest another)

> Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html

> Observation: Of the tested browsers, only Firefox renders the page AFTER  
> applying the style modifications (which is what I wanted).

> Question: Is there a way to make this work on all modern browsers?  How  
> about an easy way?  Or is it a rather widespread bug?

> Why would you want to do this:  Because I want to modify animation
> timing based on the current dimensions of the window, without user
> interaction and when the page is first displayed.  The intent is to
> synchronize an animated walking-figure .gif to the window width.

Followup-To: comp.infosystems.www.authoring.stylesheets

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Walking</title>
<style type="text/css">
/*
prefixes removed
*/
#testimg {
overflow: hidden;
max-width: 100%;
position: fixed;
bottom: 0;
}
#testimg > div:first-child {
width: 10000px;
}
#testimg > div:first-child > img {
animation-name: testkeys;
animation-duration: 100s;
animation-iteration-count: 1;
animation-timing-function: linear;
animation-delay: 25ms;
left: 100%;
position: relative;
}
@keyframes testkeys {
0% {
left: 0;
}
100% {
left: 100%;
}
}
</style>
</head>
<body>
<h1>Walking</h1>
<div id=testimg>
<div>
<img alt="" height=133
src="http://s23.postimg.org/st1p88c5z/walking.gif" width=100>
</div>
</div>
</body>
</html>


-- 
BootNic                                          Wed Oct 29, 2014 12:26 am
  "The POP3 server service depends on the SMTP server service, which failed 
  to start because of the following error: The operation completed 
  successfully."
  *Windows NT Server v3.51* 

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


#26023

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2014-10-29 15:33 +0000
Message-ID<s1225atgoj6c4nd93ugg88usfcnvqme0vd@4ax.com>
In reply to#26015
On Tue, 28 Oct 2014 18:08:07 -0400, "Chris Beall"
<Chris_Beall@prodigy.net> wrote:

>(If this is too far off-topic for this group, please suggest another)
>
>Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html
>
>Observation: Of the tested browsers, only Firefox renders the page AFTER  
>applying the style modifications (which is what I wanted).
>
>Question: Is there a way to make this work on all modern browsers?  How  
>about an easy way?  Or is it a rather widespread bug?
  <snip>

There are three possibilities :

1 There's a standard saying it mustn't happen; the browser
manufacturer says the browser obeys the standard; it does happen.
 It's a bug.

2 There's a manufacturer's specification saying it doesn't happen; the
browser manufacturer says the browser obeys the specification; it does
happen.
  It's a bug.

3 There's neither 1 nor 2; it does happen.
  It's a case of idiot programmer syndrome.

In other words, it's not a bug if it simply doesn't do what you would
like it to do. (Chances are someone very vocal wants it to do what it
does do).

  John

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


#26032

FromDr J R Stockton <reply1400@merlyn.demon.co.uk.invalid>
Date2014-10-29 21:11 +0000
Message-ID<0Qpl$Ta+fVUUFw8H@invalid.uk.co.demon.merlyn.invalid>
In reply to#26015
In comp.lang.javascript message <op.xognrthttnmj2w@cbealls-imac.local>,
Tue, 28 Oct 2014 18:08:07, Chris Beall <Chris_Beall@prodigy.net> posted:

>(If this is too far off-topic for this group, please suggest another)
>
>Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html
>
>Observation: Of the tested browsers, only Firefox renders the page
>AFTER  applying the style modifications (which is what I wanted).
>
>Question: Is there a way to make this work on all modern browsers?  How
>about an easy way?  Or is it a rather widespread bug?
>
>Why would you want to do this:  Because I want to modify animation
>timing  based on the current dimensions of the window, without user
>interaction  and when the page is first displayed.  The intent is to
>synchronize an  animated walking-figure .gif to the window width.


What happens if you put something *like*

<body style="display:none;"
  onload='document.body.style="display:block;"'>

and then, instead of using onload, do that statement when your
modifications are completed?

-- 
 (c) John Stockton, nr London UK        Reply address via Merlyn Home Page.
   news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
   <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
   <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

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


#26039

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-10-30 10:12 +0100
Message-ID<XnsA3D667E8B5370eejj99@194.109.133.133>
In reply to#26032
Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 29 okt 2014 
in comp.lang.javascript:

> What happens if you put something *like*
> 
> <body style="display:none;"
>   onload='document.body.style="display:block;"'>

wrong syntax, try:

<body style="display:none;"
  onload='document.body.style.display="block"'>


 
> and then, instead of using onload, do that statement when your
> modifications are completed?



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#26063

FromDr J R Stockton <reply1400@merlyn.demon.co.uk.invalid>
Date2014-10-31 20:45 +0000
Message-ID<MPmbIcNBU$UUFw6d@invalid.uk.co.demon.merlyn.invalid>
In reply to#26039
In comp.lang.javascript message <XnsA3D667E8B5370eejj99@194.109.133.133>
, Thu, 30 Oct 2014 10:12:52, Evertjan. <exxjxw.hannivoort@inter.nl.net>
posted:

>Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 29 okt 2014
>in comp.lang.javascript:
>
>> What happens if you put something *like*
>>
>> <body style="display:none;"
>>   onload='document.body.style="display:block;"'>
>
>wrong syntax,

that is why I wrote "something like".  I wished to convey the idea,
without having time to test it.


-- 
 (c) John Stockton, nr London, UK.   E-mail, see Home Page.    Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

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


#26064

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-11-01 10:12 +0100
Message-ID<XnsA3D867E6E632Feejj99@194.109.133.133>
In reply to#26063
Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 31 okt 2014 
in comp.lang.javascript:

> In comp.lang.javascript message <XnsA3D667E8B5370eejj99@194.109.133.133>
> , Thu, 30 Oct 2014 10:12:52, Evertjan. <exxjxw.hannivoort@inter.nl.net>
> posted:
> 
>>Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 29 okt 
2014
>>in comp.lang.javascript:
>>
>>> What happens if you put something *like*
>>>
>>> <body style="display:none;"
>>>   onload='document.body.style="display:block;"'>
>>
>>wrong syntax,
> 
> that is why I wrote "something like".  I wished to convey the idea,
> without having time to test it.

Indeed, nontheless the "why" does not diminish the fact that it was 
syntactically wrong and so a wrong idea.

element.style is a CSSstyleDeclaration object,
needing a specific style element as a key/index
and is read/write:

<body style="display:none;"
  onload='alert(document.body.style["display"])'>

will return 'none'. 

and so cannot be used for entering stylesheet strings,
as a stylesheet is not a style.

=====================

<body style="display:none;"
  onload='document.body.style.display="block"'>

works fine here, however:

<body style="display:none;"
  onload='this.style.display="block"'>

cannot be used, why is that?

cann't we use "this" in a onload?

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#26065

FromTim Streater <timstreater@greenbee.net>
Date2014-11-01 10:19 +0000
Message-ID<011120141019222837%timstreater@greenbee.net>
In reply to#26064
In article <XnsA3D867E6E632Feejj99@194.109.133.133>, Evertjan.
<exxjxw.hannivoort@inter.nl.net> wrote:

> Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 31 okt 2014 
> in comp.lang.javascript:
> 
> > In comp.lang.javascript message <XnsA3D667E8B5370eejj99@194.109.133.133>
> > , Thu, 30 Oct 2014 10:12:52, Evertjan. <exxjxw.hannivoort@inter.nl.net>
> > posted:
> > 
> >>Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 29 okt 
> 2014
> >>in comp.lang.javascript:
> >>
> >>> What happens if you put something *like*
> >>>
> >>> <body style="display:none;"
> >>>   onload='document.body.style="display:block;"'>
> >>
> >>wrong syntax,
> > 
> > that is why I wrote "something like".  I wished to convey the idea,
> > without having time to test it.
> 
> Indeed, nontheless the "why" does not diminish the fact that it was 
> syntactically wrong and so a wrong idea.

Whether it's syntactically wrong is irrelevant. The question is whether
the semantics can be implemented.

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


#26067

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-11-01 12:22 +0100
Message-ID<XnsA3D87DE6E4908eejj99@194.109.133.133>
In reply to#26065
Tim Streater <timstreater@greenbee.net> wrote on 01 nov 2014 in 
comp.lang.javascript:

>> Indeed, nontheless the "why" does not diminish the fact that it was 
>> syntactically wrong and so a wrong idea.
> 
> Whether it's syntactically wrong is irrelevant. The question is whether
> the semantics can be implemented.

Such relevance is a subjective parameter. 


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#26071

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-11-01 15:22 +0100
Message-ID<1729120.e8NWb2r2O7@PointedEars.de>
In reply to#26065
Tim Streater wrote:

> Evertjan. wrote:
>> Dr J R Stockton […] wrote […]:
>> > In comp.lang.javascript message
>> > <XnsA3D667E8B5370eejj99@194.109.133.133> , Thu, 30 Oct 2014 10:12:52,
>> > Evertjan. <exxjxw.hannivoort@inter.nl.net> posted:
>> > 
>> >>Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> wrote on 29 okt
>> 2014
>> >>in comp.lang.javascript:
>> >>
>> >>> What happens if you put something *like*
>> >>>
>> >>> <body style="display:none;"
>> >>>   onload='document.body.style="display:block;"'>
>> >>
>> >>wrong syntax,
>> > 
>> > that is why I wrote "something like".  I wished to convey the idea,
>> > without having time to test it.
>> 
>> Indeed, nontheless the "why" does not diminish the fact that it was
>> syntactically wrong and so a wrong idea.
> 
> Whether it's syntactically wrong is irrelevant. The question is whether
> the semantics can be implemented.

Nonsense.
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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


#26066

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2014-11-01 11:32 +0100
Message-ID<m32cqt$qtc$1@solani.org>
In reply to#26064
Evertjan. wrote:

> <body style="display:none;"
>   onload='document.body.style.display="block"'>
> 
> works fine here, however:
> 
> <body style="display:none;"
>   onload='this.style.display="block"'>
> 
> cannot be used, why is that?
> 
> cann't we use "this" in a onload?

In this case /this/ is bound to the window object, because the onload
attribute of the body elements maps to the load event of the window
object.  Test:

  <body onload="console.log(this)">

-- 
Christoph M. Becker

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


#26068

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-11-01 12:25 +0100
Message-ID<XnsA3D87E7595345eejj99@194.109.133.133>
In reply to#26066
"Christoph M. Becker" <cmbecker69@arcor.de> wrote on 01 nov 2014 in 
comp.lang.javascript:

>> <body style="display:none;"
>>   onload='this.style.display="block"'>
>> 
>> cannot be used, why is that?
>> 
>> cann't we use "this" in a onload?
> 
> In this case /this/ is bound to the window object, because the onload
> attribute of the body elements maps to the load event of the window
> object.  Test:
> 
>   <body onload="console.log(this)">

nice!

<body style='display:none;'
  onload='this.document.body.style.display="block"'>

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#26072

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-11-01 15:23 +0100
Message-ID<1487860.gEOcuQC4dx@PointedEars.de>
In reply to#26066
Christoph M. Becker wrote:

> Evertjan. wrote:
>> <body style="display:none;"
>>   onload='document.body.style.display="block"'>
>> 
>> works fine here, however:
>> 
>> <body style="display:none;"
>>   onload='this.style.display="block"'>
>> 
>> cannot be used, why is that?
>> 
>> cann't we use "this" in a onload?
> 
> In this case /this/ is bound to the window object,

Probably yes.

> because the onload attribute of the body elements maps to the load event
> of the window object.

No.

> Test:
> 
>   <body onload="console.log(this)">

Non sequitur.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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


#26074

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2014-11-01 16:50 +0100
Message-ID<m32vge$hu$1@solani.org>
In reply to#26072
Thomas 'PointedEars' Lahn wrote:

> Christoph M. Becker wrote:
> 
>> Evertjan. wrote:
>>> <body style="display:none;"
>>>   onload='document.body.style.display="block"'>
>>>
>>> works fine here, however:
>>>
>>> <body style="display:none;"
>>>   onload='this.style.display="block"'>
>>>
>>> cannot be used, why is that?
>>>
>>> cann't we use "this" in a onload?
>>
>> In this case /this/ is bound to the window object,
> 
> Probably yes.
> 
>> because the onload attribute of the body elements maps to the load event
>> of the window object.
> 
> No.

Well, I better reformulate:

The body element exposes the onload event handler of the Window object
as event handler content attribute with the name onload.

-- 
Christoph M. Becker

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


#26075

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-11-01 20:40 +0100
Message-ID<30111511.LVop5iYoBa@PointedEars.de>
In reply to#26074
Christoph M. Becker wrote:

> The body element exposes the onload event handler of the Window object
> as event handler content attribute with the name onload.

Unfortunately, indeed they do have made that *implementation bug* somewhat 
part of the standard (Notes are not normative, and the HTML5 test suite is 
comparably small as HTML5 was rushed to REC):

<http://www.w3.org/TR/2014/REC-html5-20141028//dom.html#global-attributes>
<http://html5doctor.com/the-ride-to-5/#comment-736723>
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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


#26080

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2014-11-02 20:55 +0100
Message-ID<m3626r$cd6$1@solani.org>
In reply to#26075
Thomas 'PointedEars' Lahn wrote:

> Christoph M. Becker wrote:
> 
>> The body element exposes the onload event handler of the Window object
>> as event handler content attribute with the name onload.
> 
> Unfortunately, indeed they do have made that *implementation bug* somewhat 
> part of the standard (Notes are not normative, and the HTML5 test suite is 
> comparably small as HTML5 was rushed to REC):
> 
> <http://www.w3.org/TR/2014/REC-html5-20141028//dom.html#global-attributes>

In section 4.3.1[1] it even seems to be defined as normative:

| The body element exposes as event handler content attributes a number
| of the event handlers of the Window object. It also mirrors their
| event handler IDL attributes.
|
| The onblur, onerror, onfocus, onload, onresize, and onscroll event
| handlers of the Window object, exposed on the body element, replace
| the generic event handlers with the same names normally supported by
| HTML elements.

[1]
<http://www.w3.org/TR/2014/REC-html5-20141028/sections.html#the-body-element>

> <http://html5doctor.com/the-ride-to-5/#comment-736723>

Thanks for the link to an interesting comment. :)

-- 
Christoph M. Becker

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


#26252

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-11-29 19:27 +0100
Message-ID<2452801.iXYFeIIy4p@PointedEars.de>
In reply to#26080
Christoph M. Becker wrote:

> In section 4.3.1[1] it even seems to be defined as normative:
> […]
> | The body element exposes as event handler content attributes a number
> | of the event handlers of the Window object. It also mirrors their
> | event handler IDL attributes.
> |
> | The onblur, onerror, onfocus, onload, onresize, and onscroll event
> | handlers of the Window object, exposed on the body element, replace
> | the generic event handlers with the same names normally supported by
> | HTML elements.
> 
> [1]
> <http://www.w3.org/TR/2014/REC-html5-20141028/sections.html#the-body-element>

Indeed they did.  While I still think it was a mistake to do this – one 
should be able to tell apart when loading of each of window, document and 
document body has been completed –, it would appear that the bug turned 
quasi-standard has prevailed over such considerations and is now a standard 
(bug).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


#26050

From"Chris Beall" <Chris_Beall@prodigy.net>
Date2014-10-30 15:46 -0400
Message-ID<op.xoj6jrdgtnmj2w@cbealls-imac.local>
In reply to#26032
Dr J R Stockton wrote:

> In comp.lang.javascript message <op.xognrthttnmj2w@cbealls-imac.local>,
> Tue, 28 Oct 2014 18:08:07, Chris Beall <Chris_Beall@prodigy.net> posted:
>
>> (If this is too far off-topic for this group, please suggest another)
>>
>> Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html
>>
>> Observation: Of the tested browsers, only Firefox renders the page
>> AFTER  applying the style modifications (which is what I wanted).
>>
>> Question: Is there a way to make this work on all modern browsers?  How
>> about an easy way?  Or is it a rather widespread bug?

> What happens if you put something *like*
>
> <body style="display:none;"
>   onload='document.body.style="display:block;"'>
>
> and then, instead of using onload, do that statement when your
> modifications are completed?
>

Looking much better.  See  
http://beallsprings.org/sandbox/Mod%20DOM%20test3.html (version 2 blew up  
on the launch pad...)
Leaving my modification code in a function, I used:

<body style="display:none;"
   onload='animInit();document.body.style.display="block"'>

combining Dr. S's suggestion and Evertjan.'s correct syntax with an  
invocation of the function

Which works on Firefox (15 seconds), Safari (12 seconds), Chrome (12  
seconds), and IE (15 seconds).  Opera duration stays at 1 second, but  
inspection with Dragonfly shows that both the Style and Computed style  
reflect a change to animation-duration (no prefix) to 15 seconds.  So the  
change takes place, but the rendering engine uses only the unmodified  
value.

Incidentally, Safari and Chrome both ignored animation-timing-function,  
instead using the default 'ease'.  Adding  
-webkit-animation-timing-function: linear; brought them to heel.

As it turns out, the particular target audience for my original effect  
does not use Opera, so for me this issue is resolved, although the  
solution is clearly not yet a completely generic fix.

Now to integrate what I've learned into the actual web page.

Thanks to all,
   Chris Beall

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


#26059

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2014-10-31 12:52 +0100
Message-ID<m2vt5h$nji$1@solani.org>
In reply to#26015
Chris Beall wrote:

> (If this is too far off-topic for this group, please suggest another)
> 
> Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html
> 
> Observation: Of the tested browsers, only Firefox renders the page AFTER
> applying the style modifications (which is what I wanted).
> 
> Question: Is there a way to make this work on all modern browsers?  How
> about an easy way?  Or is it a rather widespread bug?
> 
> Why would you want to do this:  Because I want to modify animation
> timing based on the current dimensions of the window, without user
> interaction and when the page is first displayed.  The intent is to
> synchronize an animated walking-figure .gif to the window width.

Have you tried to use the DOMContentLoaded event[1] of the document
instead of window's load event?  I don't know if that would make any
difference, but it seems to be worth a try.

[1] <https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded>

-- 
Christoph M. Becker

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


#26060

From"Chris Beall" <Chris_Beall@prodigy.net>
Date2014-10-31 10:37 -0400
Message-ID<op.xolmwxrftnmj2w@cbealls-imac.local>
In reply to#26059
Christoph M. Becker wrote:

> Chris Beall wrote:
>
>> Testcase: http://beallsprings.org/sandbox/Mod%20DOM%20test.html
>>
>> Observation: Of the tested browsers, only Firefox renders the page AFTER
>> applying the style modifications (which is what I wanted).
>
> Have you tried to use the DOMContentLoaded event[1] of the document
> instead of window's load event?  I don't know if that would make any
> difference, but it seems to be worth a try.
>
> [1]  
> <https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded>
>

I have not, however the Mozilla doc you referenced says "without waiting  
for stylesheets, images, and subframes to finish loading".  Since it is a  
stylesheet that I am modifying, I would not expect the DOM structure to  
contain it at that point in time.

Note that, with help from others, a solution that works for Firefox,  
Safari, Chrosm, and IE (but not Opera) has been found.

Chris Beall

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


Page 1 of 2  [1] 2  Next page →

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


csiph-web