If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

resizing when the window does




DOM: CSS Object Model
15 years ago
12 years ago


(Reporter: Daniel, Unassigned)


Windows XP

Firefox Tracking Flags

(Not tracked)


(Whiteboard: finding the bug, URL)



15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030529

A function call is being effected by the onresize event.  That function is
calling the 'layout', which is executing.  Within our 'layout' function, I'm
finding myself unable to affect the DOM style.  I am able to access the
attributes of the elements I'm playing with.  I can get it's id through the same
arguments, read its offset's and even write it's html attributes.  However I
cannot write to it's stylesheet rules.

The sourcecode for the function is:

var cX = innerWidth; var cY = innerHeight;
function layout(){
	var a=arguments;
	with( document.getElementById(a[0]) ){
		style.left	=cX*parseInt(a[1])+'px';
		style.top	=cY*parseInt(a[2])+'px';
		style.width	=cX*parseInt(a[3])+'px';
		style.height	=cY*parseInt(a[4])+'px';
		style.fontSize	=cX*parseInt(a[5])+'pt'; }}

The first time this function executes on any object it is working.  However, the
second time I execute it on an object (during the onresize event) it fails to
change the style attribute.  I have tested the cX and cY variables and the
statements on the right are passing '###px' to the attributes.  

I'm very concerned, because it seems like such an odd bug.  It's just weird.

Reproducible: Always

Steps to Reproduce:
1.copy the above function and variable declarations
2.create an html element with an id of 'element_id'
3.call the function with "window.onresize=layout('element_id',100,100,100,100); "

Actual Results:  
Doesn't access that attribute, it just ignores it.
There are no errors, but nothing is completed.

Expected Results:  
It should allow access to the DOM stylesheet?

Hmmm... I'm using XP, Moz 1.4 on a dual boot.
Can you provide a URI to a testcase?

Comment 2

14 years ago
After further thought into the potential causes of the bug, I've decided to run
a few tests.

The cause may be a static sampling of innerWidth and innerHeight...

Well, I'll report back.
Summary: doesn't allow changes to style object after onresize → resizing when the window does
Whiteboard: finding the bug

Comment 3

14 years ago
The bug results due to the fact that innerWidth does not automatically update
when the window resizes.  Although the function was operational, and it was
assigning the values to style, it was assigning the same value.  

After some more testing the problem was found to be resolveable by calling
innerWidth again.

Storing a pointer to innerWidth in a variable and referencing that variable does
not seem to re-call the method, so perhaps it may be made easier for web
developers if the innerWidth feature were updated when the window resizes.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Last Resolved: 12 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.