mirror of
https://github.com/wassname/template.git
synced 2026-09-10 12:44:01 +08:00
WIP switch to webcomponents loader async polyfills; multiple small fixes for Firefox and generally more defensive coding
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Template } from '../mixins/template';
|
||||
// import { Template } from '../mixins/template';
|
||||
import { Controller } from '../controller';
|
||||
|
||||
const isOnlyWhitespace = /^\s*$/;
|
||||
@@ -31,7 +31,7 @@ export class Article extends HTMLElement {
|
||||
|
||||
connectedCallback() {
|
||||
document.onreadystatechange = function () {
|
||||
console.log("onreadystatechange:");
|
||||
console.log('onreadystatechange:');
|
||||
console.log(document.readyState);
|
||||
};
|
||||
console.info('Article tag connected, we can now listen to controller events.');
|
||||
|
||||
@@ -35,6 +35,12 @@ export class Bibliography extends HTMLElement {
|
||||
observer.observe(this, options);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
requestAnimationFrame(() => {
|
||||
this.parseIfPossible();
|
||||
});
|
||||
}
|
||||
|
||||
parseIfPossible() {
|
||||
const scriptTag = this.querySelector('script');
|
||||
if (!scriptTag) return;
|
||||
|
||||
@@ -49,12 +49,6 @@ export class Cite extends T(HTMLElement) {
|
||||
|
||||
/* Lifecycle */
|
||||
|
||||
// constructor() {
|
||||
// super();
|
||||
// // Cite.currentId += 1;
|
||||
// // this.citeId = Cite.currentId;
|
||||
// }
|
||||
|
||||
connectedCallback() {
|
||||
this.outerSpan = this.root.querySelector('#citation-');
|
||||
this.innerSpan = this.root.querySelector('.citation-number');
|
||||
@@ -105,11 +99,15 @@ export class Cite extends T(HTMLElement) {
|
||||
return index == -1 ? '?' : index + 1 + '';
|
||||
});
|
||||
const textContent = '[' + numberStrings.join(', ') + ']';
|
||||
this.innerSpan.textContent = textContent;
|
||||
if (this.innerSpan) {
|
||||
this.innerSpan.textContent = textContent;
|
||||
}
|
||||
}
|
||||
|
||||
set entries(entries) {
|
||||
this.hoverBox.innerHTML = entries.map(hover_cite).join('<br><br>');
|
||||
if (this.hoverBox) {
|
||||
this.hoverBox.innerHTML = entries.map(hover_cite).join('<br><br>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user