Closed
Bug 304927
Opened 20 years ago
Closed 4 years ago
New created body element does not consider the background color
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: andrea.martino, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
The page http://www.inf.unisi.ch/~martinoa/bugzilla/createIframe.html makes
large use of DOM and the generated page is not displayed correctly.
First, using DOM, a new IFRAME element is created and appended to the current
body. Then, a new HTML structure (that is, including HEAD and BODY) is created
and inserted into the freshly created IFRAME.contentDocument.
The document displayed in the IFRAME does not display correctly the body style
attribute. The padding and the margin attributes of the body element are
considered, but the background is not. The resulting internal frame should have
a red background color, but is white.
Reproducible: Always
Steps to Reproduce:
1. load http://www.inf.unisi.ch/~martinoa/bugzilla/createIframe.html
2. click "createIframe"
Actual Results:
The created IFRAME has a white background.
Expected Results:
The created IFRAME should have a red background (the body element's style
attribute defines a red background).
Comment 1•20 years ago
|
||
When modifying the background of the HTML element inside the newly created
document it does apply...
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Reporter | ||
Comment 2•20 years ago
|
||
(In reply to comment #1)
> When modifying the background of the HTML element inside the newly created
> document it does apply...
What you say is correct, but what I tried to do was something slightly different...
Consider the following code:
var newbody = document.createElement('body');
newbody.setAttribute('style', 'background: red; margin: 0; padding: 3em;');
newbody.appendChild(document.createTextNode('this is a stupid page'));
document.body.parentNode.replaceChild(newbody, document.body);
I didn't want to modify original body. I wanted to replace the original body
element with a new one..
Comment 3•20 years ago
|
||
Then this bug is probably invalid. You would first have to use importNode:
<http://www.w3.org/TR/DOM-Level-3-Core/core.html#Core-Document-importNode>.
Comment 4•20 years ago
|
||
We auto-import nodes (and don't implement importNode at all, as it happens). So
comment 3 is way off base.
Comment 5•20 years ago
|
||
For what it's worth, replaceChild on a document node has some known issues; we
have existing bugs on it...
Updated•11 years ago
|
Assignee: general → nobody
Comment 6•7 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 7•4 years ago
|
||
<script>
function x () {
var newbody = document.createElement('body');
newbody.setAttribute('style', 'background: red; margin: 0; padding: 3em;');
newbody.appendChild(document.createTextNode('this is a stupid page'));
self[0].document.body.parentNode.replaceChild(newbody, self[0].document.body);
}
</script>
<iframe onload=x()></iframe>
Seems to work fine these days.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•