Closed Bug 10743 Opened 25 years ago Closed 25 years ago

Repositioning DIV via JavaScript doesn't work

Categories

(Core :: CSS Parsing and Computation, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: doyle.davidson, Assigned: peterl-retired)

Details

Attachments

(1 file)

Summary: Repositioning DIV via JavaScript doesn't work
Try to move a DIV via style.top & style.left isn't working in M8.  See attached
example:
Attached file Bug sample
Status: NEW → ASSIGNED
This bug is actually invalid. The CSS parser is correctly rejecting the left and
top values because they don't include unit specifiers.
Try:
   div.style.top=pos+"px";
   div.style.left=pos+"px";
to get the desired effect while conforming to the standards.

This should work however as long as the document is in quirk mode (where we
forgive the lack of unit specifiers and presume pixels where we can). The quirk
mode detection wasn't working for this.
Ok, adding "px" made the DIV move, but now the size of the DIV is weird.  It
seems to take the original size and then move down and right, requiring a
scroll bar.  If I shrink/grow the "viewer" window, the amount to scroll stays
the same!!!!  It's as if it was to be screen width + N pixels.  So I can now
move it but the layout is messed up....
The scroll bar is an artifact of the relative positioning. The DIV is staying as
wide as the window, but since it is positioned, it now sticks outside the
window's visible area. Creating a new bug to track that issue.
Actually, as I look at the CSS spec some more, I believe the width of the
positioned DIV is correct per CSS2. The fact that it is relatively positioned
should not effect its computed width. If it were absolutely positioned, then the
width should shrink. Troy, what's your take?
Yes, the fact that it is relatively positioned should not effect its computed
width. It does have an effect on absolutely positioned elements as Peter points
out
Ok, I've tried reading thru the CSS 2 draft again (boy I'm glad I'm not
implementing that stuff!!!) and section 9.4.3 talks about the relative
positioning and specifically "Relatively positioned boxes keep their normal
flow size, including line breaks and the space originally reserved for them."

OK, I guess I can accept the sizing and the scrollbar too.  Since I resized the
window, the doc is reflowed and there recomputed the DIV's size (pre-relative
positioning).  So this bug is now INVALID?
The original bug was indeed invalid, but I'm re-interpreting it as the fact that
quirk mode wasn't getting propogated into all the right places. I'll close it as
fixed when the quirk mode fix goes in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Resetting CSS properties via javascript now respects quirk mode of the document.
Status: RESOLVED → VERIFIED
Verified fixed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: