Hello all,
I'm appending, using GreaseMonkey, an element to the body of a webpage. Although the appending itself works, the placement of the appended element sometimes causes a problem: it gets placed at the top, over the original contents.
The below URL is an example for when that it happens :
https://bugzilla.mozilla.org/show_bug.cgi?id=335545
I've been able to track the problem back to the '<div id="wrapper">' element, which gets a "position: absolute;" setting (removing/disabeling either the ID or the position moves the appended element back to the bottom, where its supposed to be).
The thing is that I'm looking for a generic (CSS) solution, not a page-specific one.
I've tried several things, including following the above div with another div containing the "clear: both" style, but nothing I try seems to work.
Does anyone have an idea what I would need to use for a generic solution ?
By the way, I've been humoring the thought of going thru all elements and attempt to remove any-and-all "position" settings, but that could be rather time-consuming - and I'm not even sure if it would work.
Regards,
Rudy Wieser
And in the case of that Mozilla page, you may need to check the
position of the added element. Compare it against the page height.
JJ,
And in the case of that Mozilla page, you may need to check the
position of the added element. Compare it against the page height.
I have no idea why a command like document.body.appendChild() would place the element anywhere else than at the end of the body. Do you have any example of it ?
I used FF's own "inspect element" to check where the appended element was placed in the DOM, and it was where it should be, at the bottom of the body.
Regards,
Rudy Wieser
Element's DOM node position does not guarantee the visual position
on the page since the introduction of CSS.
it may no longer apply if the page itself appended more element(s)
at the same parent element.
TBH, that sounds like an even less stable solution than the "remove the 'position' attribute" one I already described.
TBH, that sounds like an even less stable solution than the "remove the
'position' attribute" one I already described.
So preserving the page layout is not part of your requirements?
JJ,
TBH, that sounds like an even less stable solution than the "remove the
'position' attribute" one I already described.
So preserving the page layout is not part of your requirements?
I could not care less about preserving the /exact/ page layout. But I would like to keep it somewhat the same. my focus is on being able to read the page, not on getting a xerox copy of what the webpage creator designed.
FYI, my GreaseMonkey script grabs all floating elements, neuters them and puts them into the element (a DIV) I added to the bottom of the webpage.
IOW, I created an "get outof my face!" solution, but can still access them if I want to (which is seldom or never).
Regards,
Rudy Wieser
Below CSS should work 99% on any page, so that an element inserted[snip CSS]
at the end of BODY is shown at the end of the page.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 62:44:32 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,046 |