Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results
Show changes
Showing
with 476 additions and 562 deletions
......@@ -15,11 +15,11 @@ import {
ATTRIBUTE_SRC,
ATTRIBUTE_TITLE,
ATTRIBUTE_TYPE,
TAG_SCRIPT
TAG_SCRIPT,
} from "../constants.mjs";
import { KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource } from "../resource.mjs";
import {instanceSymbol} from '../../constants.mjs';
export {Data}
import { instanceSymbol } from "../../constants.mjs";
export { Data };
/**
* This class is used by the resource manager to embed data.
......@@ -31,7 +31,6 @@ export {Data}
* @summary A Data Resource class
*/
class Data extends Resource {
/**
* @property {string} mode=cors https://developer.mozilla.org/en-US/docs/Web/API/fetch
* @property {string} credentials=same-origin https://developer.mozilla.org/en-US/docs/Web/API/fetch
......@@ -39,10 +38,10 @@ class Data extends Resource {
*/
get defaults() {
return extend({}, super.defaults, {
mode: 'cors',
credentials: 'same-origin',
type: 'application/json',
})
mode: "cors",
credentials: "same-origin",
type: "application/json",
});
}
/**
......@@ -61,7 +60,6 @@ class Data extends Resource {
* @return {Monster.DOM.Resource}
*/
connect() {
if (!(this[referenceSymbol] instanceof HTMLElement)) {
this.create();
}
......@@ -79,14 +77,12 @@ class Data extends Resource {
return Symbol.for("@schukai/monster/dom/resource/data");
}
/**
* @return {string}
*/
static getURLAttribute() {
return ATTRIBUTE_SRC
return ATTRIBUTE_SRC;
}
}
/**
......@@ -108,7 +104,6 @@ function createElement() {
return self;
}
/**
* @private
* @return {Promise}
......@@ -117,44 +112,41 @@ function createElement() {
function appendToDocument() {
const self = this;
const targetNode = document.querySelector(self.getOption(KEY_QUERY, 'head'))
const targetNode = document.querySelector(self.getOption(KEY_QUERY, "head"));
if (!(targetNode instanceof HTMLElement)) {
throw new Error('target not found')
throw new Error("target not found");
}
targetNode.appendChild(self[referenceSymbol]);
getGlobalFunction('fetch')(self.getOption(ATTRIBUTE_SRC), {
method: 'GET', // *GET, POST, PUT, DELETE, etc.
mode: self.getOption('mode', 'cors'), // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: self.getOption('credentials', 'same-origin'), // include, *same-origin, omit
getGlobalFunction("fetch")(self.getOption(ATTRIBUTE_SRC), {
method: "GET", // *GET, POST, PUT, DELETE, etc.
mode: self.getOption("mode", "cors"), // no-cors, *cors, same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
credentials: self.getOption("credentials", "same-origin"), // include, *same-origin, omit
headers: {
'Accept': self.getOption('type', 'application/json')
Accept: self.getOption("type", "application/json"),
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer,
}).then(response => {
return response.text()
}).then(text => {
redirect: "follow", // manual, *follow, error
referrerPolicy: "no-referrer", // no-referrer,
})
.then((response) => {
return response.text();
})
.then((text) => {
const textNode = document.createTextNode(text);
self[referenceSymbol].appendChild(textNode);
self[internalStateSymbol].getSubject()['loaded'] = true;
}).catch(e => {
self[internalStateSymbol].getSubject()["loaded"] = true;
})
.catch((e) => {
self[internalStateSymbol].setSubject({
loaded: true,
error: e.toString(),
})
});
targetNode.setAttribute(ATTRIBUTE_ERRORMESSAGE, e.toString());
})
});
return self;
}
......@@ -10,13 +10,15 @@ import {
ATTRIBUTE_CLASS,
ATTRIBUTE_HREF,
ATTRIBUTE_ID,
ATTRIBUTE_NONCE, ATTRIBUTE_SRC,
ATTRIBUTE_TITLE, ATTRIBUTE_TYPE,
TAG_LINK
ATTRIBUTE_NONCE,
ATTRIBUTE_SRC,
ATTRIBUTE_TITLE,
ATTRIBUTE_TYPE,
TAG_LINK,
} from "../constants.mjs";
import { KEY_DOCUMENT, referenceSymbol, Resource } from "../resource.mjs";
import {instanceSymbol} from '../../constants.mjs';
export {Link}
import { instanceSymbol } from "../../constants.mjs";
export { Link };
/**
* This class is used by the resource manager to embed external resources.
......@@ -29,7 +31,6 @@ export {Link}
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
*/
class Link extends Resource {
/**
* @property {string} as {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as}
* @property {string} crossOrigin=anonymous {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-crossorigin}
......@@ -50,7 +51,7 @@ class Link extends Resource {
get defaults() {
return extend({}, super.defaults, {
as: undefined,
crossOrigin: 'anonymous',
crossOrigin: "anonymous",
disabled: undefined,
href: undefined,
hreflang: undefined,
......@@ -63,8 +64,8 @@ class Link extends Resource {
rel: undefined,
sizes: undefined,
type: undefined,
nonce: undefined
})
nonce: undefined,
});
}
/**
......@@ -76,7 +77,6 @@ class Link extends Resource {
return Symbol.for("@schukai/monster/dom/resource/link");
}
/**
*
* @return {Monster.DOM.Resource.Link}
......@@ -90,9 +90,8 @@ class Link extends Resource {
* @return {string}
*/
static getURLAttribute() {
return ATTRIBUTE_HREF
return ATTRIBUTE_HREF;
}
}
/**
......@@ -105,7 +104,27 @@ function createElement() {
const document = self.getOption(KEY_DOCUMENT);
self[referenceSymbol] = document.createElement(TAG_LINK);
for (let key of ['as','crossOrigin','disabled','href','hreflang','imagesizes','imagesrcset','integrity','media','prefetch','referrerpolicy','sizes','rel','type',ATTRIBUTE_HREF,ATTRIBUTE_ID,ATTRIBUTE_CLASS,ATTRIBUTE_TITLE,ATTRIBUTE_NONCE]) {
for (let key of [
"as",
"crossOrigin",
"disabled",
"href",
"hreflang",
"imagesizes",
"imagesrcset",
"integrity",
"media",
"prefetch",
"referrerpolicy",
"sizes",
"rel",
"type",
ATTRIBUTE_HREF,
ATTRIBUTE_ID,
ATTRIBUTE_CLASS,
ATTRIBUTE_TITLE,
ATTRIBUTE_NONCE,
]) {
if (self.getOption(key) !== undefined) {
self[referenceSymbol][key] = self.getOption(key);
}
......
......@@ -3,8 +3,6 @@
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* In this namespace you will find classes and methods for links
*
......
......@@ -7,8 +7,8 @@
import { extend } from "../../../data/extend.mjs";
import { Link } from "../link.mjs";
import {instanceSymbol} from '../../../constants.mjs';
export {Stylesheet}
import { instanceSymbol } from "../../../constants.mjs";
export { Stylesheet };
/**
* This class is used by the resource manager to embed external resources.
......@@ -21,14 +21,13 @@ export {Stylesheet}
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
*/
class Stylesheet extends Link {
/**
* @property {string} rel {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel}
*/
get defaults() {
return extend({}, super.defaults, {
rel: 'stylesheet'
})
rel: "stylesheet",
});
}
/**
......@@ -37,9 +36,6 @@ class Stylesheet extends Link {
* @since 2.1.0
*/
static get [instanceSymbol]() {
return Symbol.for("@schukai/monster/dom/resource/link/stylesheet")
return Symbol.for("@schukai/monster/dom/resource/link/stylesheet");
}
}
......@@ -13,11 +13,11 @@ import {
ATTRIBUTE_SRC,
ATTRIBUTE_TITLE,
ATTRIBUTE_TYPE,
TAG_SCRIPT
TAG_SCRIPT,
} from "../constants.mjs";
import { KEY_DOCUMENT, referenceSymbol, Resource } from "../resource.mjs";
import {instanceSymbol} from '../../constants.mjs';
export {Script}
import { instanceSymbol } from "../../constants.mjs";
export { Script };
/**
* This class is used by the resource manager to embed scripts.
......@@ -29,7 +29,6 @@ export {Script}
* @summary A Resource class
*/
class Script extends Resource {
/**
* @property {boolean} async=true {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async}
* @property {string} crossOrigin=anonymous {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-crossorigin}
......@@ -43,14 +42,14 @@ class Script extends Resource {
get defaults() {
return extend({}, super.defaults, {
async: true,
crossOrigin: 'anonymous',
crossOrigin: "anonymous",
defer: false,
integrity: undefined,
nomodule: false,
nonce: undefined,
referrerpolicy: undefined,
type: 'text/javascript',
})
type: "text/javascript",
});
}
/**
......@@ -75,9 +74,8 @@ class Script extends Resource {
* @return {string}
*/
static getURLAttribute() {
return ATTRIBUTE_SRC
return ATTRIBUTE_SRC;
}
}
/**
......@@ -90,12 +88,24 @@ function createElement() {
const document = self.getOption(KEY_DOCUMENT);
self[referenceSymbol] = document.createElement(TAG_SCRIPT);
for (let key of ['crossOrigin', 'defer', 'async', 'integrity', 'nomodule', ATTRIBUTE_NONCE, 'referrerpolicy', ATTRIBUTE_TYPE, ATTRIBUTE_SRC, ATTRIBUTE_ID, ATTRIBUTE_CLASS, ATTRIBUTE_TITLE]) {
for (let key of [
"crossOrigin",
"defer",
"async",
"integrity",
"nomodule",
ATTRIBUTE_NONCE,
"referrerpolicy",
ATTRIBUTE_TYPE,
ATTRIBUTE_SRC,
ATTRIBUTE_ID,
ATTRIBUTE_CLASS,
ATTRIBUTE_TITLE,
]) {
if (self.getOption(key) !== undefined) {
self[referenceSymbol][key] = self.getOption(key);
}
}
return self;
}
......@@ -15,7 +15,7 @@ import {Data} from "./resource/data.mjs";
import { Stylesheet } from "./resource/link/stylesheet.mjs";
import { Script } from "./resource/script.mjs";
export {ResourceManager}
export { ResourceManager };
/**
* The ResourceManager is a singleton that manages all resources.
......@@ -27,7 +27,6 @@ export {ResourceManager}
* @summary A Resource class
*/
class ResourceManager extends BaseWithOptions {
/**
*
* @param {Object} options
......@@ -36,18 +35,16 @@ export {ResourceManager}
constructor(options) {
super(options);
if (!(this.getOption('document') instanceof Document)) {
throw new Error('unsupported document type')
if (!(this.getOption("document") instanceof Document)) {
throw new Error("unsupported document type");
}
}
/**
* @property {string} baseurl
*/
getBaseURL() {
this.getOption('document')?.baseURL;
this.getOption("document")?.baseURL;
}
/**
......@@ -60,13 +57,13 @@ export {ResourceManager}
*/
get defaults() {
return Object.assign({}, super.defaults, {
document: getGlobalObject('document'),
document: getGlobalObject("document"),
resources: {
scripts: [],
stylesheets: [],
data: []
}
})
data: [],
},
});
}
/**
......@@ -76,7 +73,7 @@ export {ResourceManager}
* @throws {Error} unsupported resource definition
*/
connect() {
runResourceMethod.call(this, 'connect');
runResourceMethod.call(this, "connect");
return this;
}
......@@ -87,7 +84,7 @@ export {ResourceManager}
* @throws {Error} unsupported resource definition
*/
available() {
return Promise.all(runResourceMethod.call(this, 'available'));
return Promise.all(runResourceMethod.call(this, "available"));
}
/**
......@@ -99,10 +96,9 @@ export {ResourceManager}
* @see Monster.DOM.Resource.Script
*/
addScript(url, options) {
return addResource.call(this, 'scripts', url, options);
return addResource.call(this, "scripts", url, options);
}
/**
* Add Stylesheet
*
......@@ -112,7 +108,7 @@ export {ResourceManager}
* @see Monster.DOM.Resource.Link.Stylesheet
*/
addStylesheet(url, options) {
return addResource.call(this, 'stylesheets', url, options);
return addResource.call(this, "stylesheets", url, options);
}
/**
......@@ -124,10 +120,8 @@ export {ResourceManager}
* @see Monster.DOM.Resource.Data
*/
addData(url, options) {
return addResource.call(this, 'data', url, options);
return addResource.call(this, "data", url, options);
}
}
/**
......@@ -140,20 +134,19 @@ function runResourceMethod(method) {
const result = [];
for (const type of ['scripts', 'stylesheets', 'data']) {
const resources = self.getOption('resources.' + type);
for (const type of ["scripts", "stylesheets", "data"]) {
const resources = self.getOption(`resources.${type}`);
if (!isArray(resources)) {
continue;
}
for (const resource of resources) {
if (!(resource instanceof Resource)) {
throw new Error('unsupported resource definition')
throw new Error("unsupported resource definition");
}
result.push(resource[method]());
}
}
return result;
......@@ -174,23 +167,23 @@ function addResource(type, url, options) {
url = url.toString();
}
options = options || {}
options = options || {};
let resource;
switch (type) {
case 'scripts':
resource = new Script(extend({}, options, {[ATTRIBUTE_SRC]: url}))
case "scripts":
resource = new Script(extend({}, options, { [ATTRIBUTE_SRC]: url }));
break;
case 'stylesheets':
resource = new Stylesheet(extend({}, options, {[ATTRIBUTE_HREF]: url}))
case "stylesheets":
resource = new Stylesheet(extend({}, options, { [ATTRIBUTE_HREF]: url }));
break;
case 'data':
resource = new Data(extend({}, options, {[ATTRIBUTE_SRC]: url}))
case "data":
resource = new Data(extend({}, options, { [ATTRIBUTE_SRC]: url }));
break;
default:
throw new Error('unsupported type ' + type)
throw new Error(`unsupported type ${type}`);
}
(self.getOption('resources')?.[type]).push(resource);
self.getOption("resources")?.[type].push(resource);
return self;
}
......@@ -5,13 +5,13 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {Base} from '../types/base.mjs';
import {getGlobalFunction, getGlobalObject} from '../types/global.mjs';
import { Base } from "../types/base.mjs";
import { getGlobalFunction, getGlobalObject } from "../types/global.mjs";
import { validateInstance, validateString } from "../types/validate.mjs";
import { ATTRIBUTE_TEMPLATE_PREFIX } from "./constants.mjs";
import { getDocumentTheme } from "./theme.mjs";
import {instanceSymbol} from '../constants.mjs';
export {Template}
import { instanceSymbol } from "../constants.mjs";
export { Template };
/**
* The template class provides methods for creating templates.
......@@ -32,7 +32,7 @@ class Template extends Base {
*/
constructor(template) {
super();
const HTMLTemplateElement = getGlobalFunction('HTMLTemplateElement');
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
validateInstance(template, HTMLTemplateElement);
this.template = template;
}
......@@ -46,7 +46,6 @@ class Template extends Base {
return Symbol.for("@schukai/monster/dom/resource/template");
}
/**
*
* @returns {HTMLTemplateElement}
......@@ -63,7 +62,6 @@ class Template extends Base {
createDocumentFragment() {
return this.template.content.cloneNode(true);
}
}
/**
......@@ -132,20 +130,17 @@ class Template extends Base {
export function findDocumentTemplate(id, currentNode) {
validateString(id);
const document = getGlobalObject('document');
const HTMLTemplateElement = getGlobalFunction('HTMLTemplateElement');
const DocumentFragment = getGlobalFunction('DocumentFragment');
const Document = getGlobalFunction('Document');
const document = getGlobalObject("document");
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
const DocumentFragment = getGlobalFunction("DocumentFragment");
const Document = getGlobalFunction("Document");
let prefixID;
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
if (currentNode instanceof Node) {
if (currentNode.hasAttribute(ATTRIBUTE_TEMPLATE_PREFIX)) {
prefixID = currentNode.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX)
prefixID = currentNode.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX);
}
currentNode = currentNode.getRootNode();
......@@ -153,7 +148,6 @@ export function findDocumentTemplate(id, currentNode) {
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
currentNode = currentNode.ownerDocument;
}
}
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
......@@ -162,10 +156,10 @@ export function findDocumentTemplate(id, currentNode) {
}
let template;
let theme = getDocumentTheme()
let theme = getDocumentTheme();
if (prefixID) {
let themedPrefixID = prefixID + '-' + id + '-' + theme.getName();
let themedPrefixID = `${prefixID}-${id}-${theme.getName()}`;
// current + themedPrefixID
template = currentNode.getElementById(themedPrefixID);
......@@ -180,7 +174,7 @@ export function findDocumentTemplate(id, currentNode) {
}
}
let themedID = id + '-' + theme.getName();
let themedID = `${id}-${theme.getName()}`;
// current + themedID
template = currentNode.getElementById(themedID);
......@@ -206,6 +200,5 @@ export function findDocumentTemplate(id, currentNode) {
return new Template(template);
}
throw new Error("template " + id + " not found.")
throw new Error(`template ${id} not found.`);
}
......@@ -5,12 +5,12 @@
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {Base} from '../types/base.mjs';
import {getGlobalObject} from '../types/global.mjs';
import { Base } from "../types/base.mjs";
import { getGlobalObject } from "../types/global.mjs";
import { validateString } from "../types/validate.mjs";
import { ATTRIBUTE_THEME_NAME, DEFAULT_THEME } from "./constants.mjs";
import {instanceSymbol} from '../constants.mjs';
export {Theme, getDocumentTheme}
import { instanceSymbol } from "../constants.mjs";
export { Theme, getDocumentTheme };
/**
* The Theme class provides the functionality for the theme.
......@@ -23,7 +23,6 @@ export {Theme, getDocumentTheme}
* @summary A theme class
*/
class Theme extends Base {
/**
*
* @param name
......@@ -44,7 +43,6 @@ class Theme extends Base {
return Symbol.for("@schukai/monster/dom/theme");
}
/**
*
* @returns {string}
......@@ -52,7 +50,6 @@ class Theme extends Base {
getName() {
return this.name;
}
}
/**
......@@ -73,10 +70,10 @@ class Theme extends Base {
* @since 1.7.0
*/
function getDocumentTheme() {
let document = getGlobalObject('document');
let document = getGlobalObject("document");
let name = DEFAULT_THEME;
let element = document.querySelector('html');
let element = document.querySelector("html");
if (element instanceof HTMLElement) {
let theme = element.getAttribute(ATTRIBUTE_THEME_NAME);
if (theme) {
......@@ -85,5 +82,4 @@ function getDocumentTheme() {
}
return new Theme(name);
}
This diff is collapsed.
......@@ -8,7 +8,7 @@
import { getGlobal } from "../types/global.mjs";
import { validateString } from "../types/validate.mjs";
export {getDocument, getWindow, getDocumentFragmentFromString}
export { getDocument, getWindow, getDocumentFragmentFromString };
/**
* This method fetches the document object
......@@ -48,9 +48,9 @@ export {getDocument, getWindow, getDocumentFragmentFromString}
* @throws {Error} not supported environment
*/
function getDocument() {
let document = getGlobal()?.['document'];
if (typeof document !== 'object') {
throw new Error("not supported environment")
let document = getGlobal()?.["document"];
if (typeof document !== "object") {
throw new Error("not supported environment");
}
return document;
......@@ -96,15 +96,14 @@ function getDocument() {
* @throws {Error} not supported environment
*/
function getWindow() {
let window = getGlobal()?.['window'];
if (typeof window !== 'object') {
throw new Error("not supported environment")
let window = getGlobal()?.["window"];
if (typeof window !== "object") {
throw new Error("not supported environment");
}
return window;
}
/**
* This method fetches the document object
*
......@@ -147,7 +146,7 @@ function getDocumentFragmentFromString(html) {
validateString(html);
const document = getDocument();
const template = document.createElement('template');
const template = document.createElement("template");
template.innerHTML = html;
return template.content;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.