Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Implement document.documentElement.appendChild etc #196

Merged
merged 1 commit into from
Aug 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/wrappers/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
}

[
'createComment',
'createDocumentFragment',
'createElement',
'createElementNS',
Expand Down Expand Up @@ -175,6 +176,7 @@
window.HTMLBodyElement,
window.HTMLDocument || window.Document, // Gecko adds these to HTMLDocument
window.HTMLHeadElement,
window.HTMLHtmlElement,
], [
'appendChild',
'compareDocumentPosition',
Expand All @@ -194,6 +196,7 @@
], [
'adoptNode',
'contains',
'createComment',
'createDocumentFragment',
'createElement',
'createElementNS',
Expand Down
30 changes: 30 additions & 0 deletions test/js/HTMLHtmlElement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is goverened by a BSD-style
* license that can be found in the LICENSE file.
*/

suite('HTMLHtmlElement', function() {

var wrap = ShadowDOMPolyfill.wrap;

test('instanceof', function() {
var doc = wrap(document);
assert.instanceOf(doc.documentElement, HTMLHtmlElement);
assert.equal(wrap(document.documentElement), doc.documentElement);
});

test('appendChild', function() {
var doc = wrap(document);

var a = document.createComment('a');
var b = document.createComment('b');

document.documentElement.appendChild(a);
assert.equal(doc.documentElement.lastChild, a);

doc.documentElement.appendChild(b);
assert.equal(doc.documentElement.lastChild, b);
});

});
1 change: 1 addition & 0 deletions test/test.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var modules = [
'HTMLContentElement.js',
'HTMLFieldSetElement.js',
'HTMLHeadElement.js',
'HTMLHtmlElement.js',
'HTMLInputElement.js',
'HTMLKeygenElement.js',
'HTMLLabelElement.js',
Expand Down