Closed
Bug 1171039
Opened 10 years ago
Closed 10 years ago
Creating a new HTMLDocument and using it's open/write()/close methods is a no-op
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: nikdunn1979, Unassigned, NeedInfo)
Details
(Keywords: testcase)
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36
Steps to reproduce:
Created a test page:
<!doctype html>
<html>
<head>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script>
function bar() {
var html = document.documentElement.outerHTML;
var newDoc = document.implementation.createHTMLDocument('');
newDoc.open();
newDoc.write(html);
newDoc.close();
debugger;
}
</script>
</head>
<body>
<div id="main" class="m-scene" onclick="bar();">Foo</div>
</body>
</html>
Actual results:
newDoc.body has no child nodes. Works in other browsers.
Expected results:
newDoc.body should have had child nodes.
| Reporter | ||
Comment 1•10 years ago
|
||
The bug also exists with very simple html fragments like: "<div>Foo</div>"
Comment 3•10 years ago
|
||
Do you know if this used to work in earlier versions of Firefox?
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Core & HTML
Ever confirmed: true
Flags: needinfo?(nikdunn1979)
Keywords: testcase
Product: Firefox → Core
Summary: HTMLDocument.write() is broken in Firefox 38.0 → Creating a new HTMLDocument and using it's write() method with the outerHTML of another document generates an empty body (body contents of original document are ignored)
Comment 4•10 years ago
|
||
Seems like this didn't work in at least Firefox 28, so if it did work it's been broken for a long time.
Updated•10 years ago
|
Summary: Creating a new HTMLDocument and using it's write() method with the outerHTML of another document generates an empty body (body contents of original document are ignored) → Creating a new HTMLDocument and using it's open/write()/close methods is a no-op
Comment 5•10 years ago
|
||
Per spec, for document.open at https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open step 2 is:
If the Document object is not an active document, then abort these steps.
The document in this case is not an active document, so document.open() is a no-op.
Then you do the document.write, which lands at https://html.spec.whatwg.org/multipage/webappapis.html#document.write%28%29 and has the same step 2. So document.write is a no-op on this case as well.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•