mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 00:17:32 +09:00
parent
31b26a24e3
commit
cedff6e214
28 changed files with 82 additions and 879 deletions
|
|
@ -3,23 +3,26 @@
|
|||
'use strict';
|
||||
// -sp-context: content
|
||||
(function () {
|
||||
let proto = Object.create(HTMLDivElement.prototype);
|
||||
proto.template = `<style></style>`;
|
||||
proto.createdCallback = function() {
|
||||
let shadow = this.createShadowRoot();
|
||||
if (this.template) {
|
||||
let te = document.createElement('template');
|
||||
te.innerHTML = this.template;
|
||||
shadow.appendChild(document.importNode(te.content, true));
|
||||
}
|
||||
};
|
||||
class UiComponentTest extends HTMLDivElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.template = `<style></style>`;
|
||||
}
|
||||
|
||||
let UiComponentTest = document.registerElement('ui-component-test', {
|
||||
prototype: proto,
|
||||
});
|
||||
connectedCallback() {
|
||||
let shadow = this.createShadowRoot();
|
||||
if (this.template) {
|
||||
let te = document.createElement('template');
|
||||
te.innerHTML = this.template;
|
||||
shadow.appendChild(document.importNode(te.content, true));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let uic = new UiComponentTest();
|
||||
document.body.appendChild(uic);
|
||||
customElements.define('ui-component-test', UiComponentTest, { extend: 'div'} );
|
||||
|
||||
let uic = new UiComponentTest();
|
||||
document.body.appendChild(uic);
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue