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)
Tracking
()
VERIFIED
FIXED
People
(Reporter: doyle.davidson, Assigned: peterl-retired)
Details
Attachments
(1 file)
621 bytes,
text/html
|
Details |
Reporter | ||
Updated•25 years ago
|
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:
Reporter | ||
Comment 1•25 years ago
|
||
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•25 years ago
|
||
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.
Reporter | ||
Comment 3•25 years ago
|
||
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....
Assignee | ||
Comment 4•25 years ago
|
||
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.
Assignee | ||
Comment 5•25 years ago
|
||
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
Reporter | ||
Comment 7•25 years ago
|
||
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?
Assignee | ||
Comment 8•25 years ago
|
||
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.
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 9•25 years ago
|
||
Resetting CSS properties via javascript now respects quirk mode of the document.
Updated•25 years ago
|
Status: RESOLVED → VERIFIED
Comment 10•25 years ago
|
||
Verified fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•