This repository was archived by the owner on Oct 7, 2020. It is now read-only.
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
Extends the HTMLTableElement and HTMLTableRowElement #6
Closed
Description
Hi,
I try to create 2 Custom Elements by extend the HTMLTableElement and HTMLTableRowElement, but it fail.
After further debuging, it failed on the code for prototype chain clone.
defineProperty(o, key, gOPD(p, key));
gOPD(p,key)
return the correct Object, but defineProperty()
fail to define it in new object.
I tested it on IE10, here's part of the js code for extend HTMLTableElement:
var HiTable = Object.create(HTMLTableElement.prototype);
HiTable.setNamePref = function(namePref) {
this.namePref = namePref;
}
document.registerElement('hi-table', { prototype: HiTable } );
...
var myCreateTable = function (captionText, className, panelName) {
var tblObj = document.createElement('hi-table');
tblObj.setNamePref(className+'Row');
if (className)
tblObj.className = className;
if (captionText) {
tblObj.createCaption();
tblObj.caption.innerHTML = captionText;
}
if (panelName)
document.getElementById(panelName).appendChild(tblObj);
return tblObj;
}
...
myCreateTable('Caption Text', 'whatStyle', 'whereToPut');
It fails at createCaption()
in function myCreateTable()
if the prototype
is created from HTMLElement, cause the function belongs to HTMLTableElement only.
It fails at the same point if the prototype
is created from HTMLTableElement, cause:
defineProperty()
fail to define object returned by gOPD(p,key)
(line 110)