This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
376 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright 2014 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. | ||
*/ | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
// TODO(arv): Implement. | ||
|
||
scope.wrapHTMLCollection = scope.wrapNodeList; | ||
scope.wrappers.HTMLCollection = scope.wrappers.NodeList; | ||
|
||
})(window.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2014 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. | ||
*/ | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var HTMLElement = scope.wrappers.HTMLElement; | ||
var mixin = scope.mixin; | ||
var registerWrapper = scope.registerWrapper; | ||
var unwrap = scope.unwrap; | ||
var wrap = scope.wrap; | ||
var wrapHTMLCollection = scope.wrapHTMLCollection; | ||
|
||
var OriginalHTMLTableElement = window.HTMLTableElement; | ||
|
||
function HTMLTableElement(node) { | ||
HTMLElement.call(this, node); | ||
} | ||
HTMLTableElement.prototype = Object.create(HTMLElement.prototype); | ||
mixin(HTMLTableElement.prototype, { | ||
get caption() { | ||
return wrap(unwrap(this).caption); | ||
}, | ||
createCaption: function() { | ||
return wrap(unwrap(this).createCaption()); | ||
}, | ||
|
||
get tHead() { | ||
return wrap(unwrap(this).tHead); | ||
}, | ||
createTHead: function() { | ||
return wrap(unwrap(this).createTHead()); | ||
}, | ||
|
||
createTFoot: function() { | ||
return wrap(unwrap(this).createTFoot()); | ||
}, | ||
get tFoot() { | ||
return wrap(unwrap(this).tFoot); | ||
}, | ||
|
||
get tBodies() { | ||
return wrapHTMLCollection(unwrap(this).tBodies); | ||
}, | ||
createTBody: function() { | ||
return wrap(unwrap(this).createTBody()); | ||
}, | ||
|
||
get rows() { | ||
return wrapHTMLCollection(unwrap(this).rows); | ||
}, | ||
insertRow: function(index) { | ||
return wrap(unwrap(this).insertRow(index)); | ||
} | ||
}); | ||
|
||
registerWrapper(OriginalHTMLTableElement, HTMLTableElement, | ||
document.createElement('table')); | ||
|
||
scope.wrappers.HTMLTableElement = HTMLTableElement; | ||
})(window.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2014 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. | ||
*/ | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var HTMLElement = scope.wrappers.HTMLElement; | ||
var mixin = scope.mixin; | ||
var registerWrapper = scope.registerWrapper; | ||
var wrapHTMLCollection = scope.wrapHTMLCollection; | ||
var unwrap = scope.unwrap; | ||
var wrap = scope.wrap; | ||
|
||
var OriginalHTMLTableRowElement = window.HTMLTableRowElement; | ||
|
||
function HTMLTableRowElement(node) { | ||
HTMLElement.call(this, node); | ||
} | ||
HTMLTableRowElement.prototype = Object.create(HTMLElement.prototype); | ||
mixin(HTMLTableRowElement.prototype, { | ||
get cells() { | ||
return wrapHTMLCollection(unwrap(this).cells); | ||
}, | ||
|
||
insertCell: function(index) { | ||
return wrap(unwrap(this).insertCell(index)); | ||
} | ||
}); | ||
|
||
registerWrapper(OriginalHTMLTableRowElement, HTMLTableRowElement, | ||
document.createElement('tr')); | ||
|
||
scope.wrappers.HTMLTableRowElement = HTMLTableRowElement; | ||
})(window.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2014 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. | ||
*/ | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var HTMLElement = scope.wrappers.HTMLElement; | ||
var mixin = scope.mixin; | ||
var registerWrapper = scope.registerWrapper; | ||
var wrapHTMLCollection = scope.wrapHTMLCollection; | ||
var unwrap = scope.unwrap; | ||
var wrap = scope.wrap; | ||
|
||
var OriginalHTMLTableSectionElement = window.HTMLTableSectionElement; | ||
|
||
function HTMLTableSectionElement(node) { | ||
HTMLElement.call(this, node); | ||
} | ||
HTMLTableSectionElement.prototype = Object.create(HTMLElement.prototype); | ||
mixin(HTMLTableSectionElement.prototype, { | ||
get rows() { | ||
return wrapHTMLCollection(unwrap(this).rows); | ||
}, | ||
insertRow: function(index) { | ||
return wrap(unwrap(this).insertRow(index)); | ||
} | ||
}); | ||
|
||
registerWrapper(OriginalHTMLTableSectionElement, HTMLTableSectionElement, | ||
document.createElement('thead')); | ||
|
||
scope.wrappers.HTMLTableSectionElement = HTMLTableSectionElement; | ||
})(window.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2014 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('HTMLTableElement', function() { | ||
|
||
test('instanceof', function() { | ||
var table = createTable(); | ||
assert.instanceOf(table, HTMLTableElement); | ||
}); | ||
|
||
test('caption', function() { | ||
var table = createTable(); | ||
assert.equal(table.caption.localName, 'caption'); | ||
}); | ||
|
||
test('createCaption', function() { | ||
var table = createTable(); | ||
var caption = table.createCaption(); | ||
assert.equal(caption.localName, 'caption'); | ||
assert.instanceOf(caption, HTMLElement); | ||
}); | ||
|
||
test('tHead', function() { | ||
var table = createTable(); | ||
assert.equal(table.tHead.localName, 'thead'); | ||
assert.instanceOf(table.tHead, HTMLTableSectionElement); | ||
}); | ||
|
||
test('createTHead', function() { | ||
var table = createTable(); | ||
var thead = table.createTHead(); | ||
assert.equal(thead.localName, 'thead'); | ||
assert.instanceOf(thead, HTMLTableSectionElement); | ||
}); | ||
|
||
test('tFoot', function() { | ||
var table = createTable(); | ||
assert.equal(table.tFoot.localName, 'tfoot'); | ||
assert.instanceOf(table.tFoot, HTMLTableSectionElement); | ||
}); | ||
|
||
test('createTFoot', function() { | ||
var table = createTable(); | ||
var tfoot = table.createTFoot(); | ||
assert.equal(tfoot.localName, 'tfoot'); | ||
assert.instanceOf(tfoot, HTMLTableSectionElement); | ||
}); | ||
|
||
test('tBodies', function() { | ||
var table = createTable(); | ||
assert.instanceOf(table.tBodies, HTMLCollection); | ||
assert.equal(table.tBodies.length, 2); | ||
|
||
assert.equal(table.tBodies[0], table.querySelector('tbody')); | ||
}); | ||
|
||
test('createTBody', function() { | ||
var table = createTable(); | ||
var tbody = table.createTBody(); | ||
assert.equal(tbody.localName, 'tbody'); | ||
assert.instanceOf(tbody, HTMLTableSectionElement); | ||
}); | ||
|
||
test('rows', function() { | ||
var table = createTable(); | ||
assert.instanceOf(table.rows, HTMLCollection); | ||
assert.equal(table.rows.length, 8); | ||
}); | ||
|
||
test('insertRow', function() { | ||
var table = createTable(); | ||
var tr = table.insertRow(1); | ||
assert.instanceOf(tr, HTMLTableRowElement); | ||
assert.equal(tr.localName, 'tr'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2014 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('HTMLTableRowElement', function() { | ||
|
||
test('instanceof', function() { | ||
var table = createTable(); | ||
var row = table.querySelector('tr'); | ||
assert.instanceOf(row, HTMLTableRowElement); | ||
}); | ||
|
||
test('cells', function() { | ||
var table = createTable(); | ||
var row = table.querySelector('tr'); | ||
assert.instanceOf(row.cells, HTMLCollection); | ||
assert.equal(row.cells.length, 3); | ||
}); | ||
|
||
test('insertCell', function() { | ||
var table = createTable(); | ||
var row = table.querySelector('tr'); | ||
var newCell = row.insertCell(0); | ||
assert.equal(newCell.localName, 'td'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2014 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('HTMLTableSectionElement', function() { | ||
|
||
test('instanceof', function() { | ||
var table = createTable(); | ||
var thead = table.querySelector('thead'); | ||
assert.instanceOf(thead, HTMLTableSectionElement); | ||
var tfoot = table.querySelector('tfoot'); | ||
assert.instanceOf(tfoot, HTMLTableSectionElement); | ||
}); | ||
|
||
test('rows', function() { | ||
var table = createTable(); | ||
var thead = table.querySelector('thead'); | ||
assert.instanceOf(thead.rows, HTMLCollection); | ||
assert.equal(thead.rows.length, 2); | ||
|
||
var tbody = table.querySelector('tbody'); | ||
assert.instanceOf(tbody.rows, HTMLCollection); | ||
assert.equal(tbody.rows.length, 2); | ||
|
||
var tfoot = table.querySelector('tfoot'); | ||
assert.instanceOf(tfoot.rows, HTMLCollection); | ||
assert.equal(tfoot.rows.length, 2); | ||
}); | ||
|
||
test('insertRow', function() { | ||
var table = createTable(); | ||
var thead = table.querySelector('thead'); | ||
var tr = thead.insertRow(1); | ||
assert.instanceOf(tr, HTMLTableRowElement); | ||
assert.equal(tr.localName, 'tr'); | ||
|
||
var tbody = table.querySelector('tbody'); | ||
tr = thead.insertRow(1); | ||
assert.instanceOf(tr, HTMLTableRowElement); | ||
assert.equal(tr.localName, 'tr'); | ||
|
||
var tfoot = table.querySelector('tfoot'); | ||
tr = thead.insertRow(1); | ||
assert.instanceOf(tr, HTMLTableRowElement); | ||
assert.equal(tr.localName, 'tr'); | ||
}); | ||
|
||
}); |
Oops, something went wrong.