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
Commits on Source (6)
Showing
with 3579 additions and 2289 deletions
<a name="v3.33.0"></a>
## [v3.33.0] - 2023-03-26
### Add Features
- new function getSlottedNodes()
### Changes
- change since tag
- updated packages
<a name="v3.32.0"></a>
## [v3.32.0] - 2023-03-23
### Add Features
......@@ -469,6 +479,7 @@
<a name="1.8.0"></a>
## 1.8.0 - 2021-08-15
[v3.33.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.32.0...v3.33.0
[v3.32.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.31.1...v3.32.0
[v3.31.1]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.31.0...v3.31.1
[v3.31.0]: https://gitlab.schukai.com/oss/libraries/javascript/monster/compare/v3.30.0...v3.31.0
......
......@@ -73,7 +73,7 @@ We do try to work around some browser bugs, but on the whole we don't use polyfi
However, many functions can be mapped via [polyfill.io](https://polyfill.io/) and thus the compatibility can be increased.
```html
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,Blob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.for,Symbol.hasInstance,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,Blob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.includes,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.for,Symbol.hasInstance,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
```
......
{
"name": "@schukai/monster",
"version": "3.31.1",
"version": "3.32.0",
"description": "Monster is a simple library for creating fast, robust and lightweight websites.",
"keywords": [
"framework",
......
......@@ -29,6 +29,7 @@ import {findDocumentTemplate, Template} from "./template.mjs";
import {addObjectWithUpdaterToElement} from "./updater.mjs";
import {instanceSymbol} from "../constants.mjs";
import {getDocumentTranslations, Translations} from "../i18n/translations.mjs";
import {getSlottedElements} from "./slotted.mjs";
export {
CustomElement,
......@@ -599,58 +600,6 @@ class CustomElement extends HTMLElement {
}
}
/**
* @private
* @param {String|undefined} query
* @param {String|undefined|null} name name of the slot (if the parameter is undefined, all slots are searched, if the parameter has the value null, all slots without a name are searched. if a string is specified, the slots with this name are searched.)
* @return {*}
* @this CustomElement
* @license AGPLv3
* @since 1.23.0
* @throws {Error} query must be a string
*/
function getSlottedElements(query, name) {
const self = this;
const result = new Set();
if (!(self.shadowRoot instanceof ShadowRoot)) {
return result;
}
let selector = "slot";
if (name !== undefined) {
if (name === null) {
selector += ":not([name])";
} else {
selector += `[name=${validateString(name)}]`;
}
}
const slots = self.shadowRoot.querySelectorAll(selector);
for (const [, slot] of Object.entries(slots)) {
slot.assignedElements().forEach(function (node) {
if (!(node instanceof HTMLElement)) return;
if (isString(query)) {
node.querySelectorAll(query).forEach(function (n) {
result.add(n);
});
if (node.matches(query)) {
result.add(node);
}
} else if (query !== undefined) {
throw new Error("query must be a string");
} else {
result.add(node);
}
});
}
return result;
}
/**
* @this CustomElement
* @private
......
import {isString} from "../types/is.mjs";
import {validateString} from "../types/validate.mjs";
export {getSlottedElements, getSlottedNodes};
/**
* @private
* @param {String|undefined} query
* @param {String|undefined|null} name name of the slot (if the parameter is undefined, all slots are searched, if the parameter has the value null, all slots without a name are searched. if a string is specified, the slots with this name are searched.)
* @return {*}
* @this CustomElement
* @license AGPLv3
* @since 3.33.0
* @throws {Error} query must be a string
*/
function getSlottedNodes(query, name) {
const self = this;
const result = new Set();
if (!self.shadowRoot) {
return result;
}
let selector = "slot";
if (name !== undefined) {
if (name === null) {
selector += ":not([name])";
} else {
selector += `[name=${validateString(name)}]`;
}
}
const slots = self.shadowRoot.querySelectorAll(selector);
for (const [, slot] of Object.entries(slots)) {
slot.assignedNodes().forEach(function (node) {
if (node === null || node === undefined) {
return;
}
if (isString(query)) {
node.querySelectorAll(query).forEach(function (n) {
result.add(n);
});
if (node.matches(query)) {
result.add(node);
}
} else if (query !== undefined) {
throw new Error("query must be a string");
} else {
result.add(node);
}
});
}
return result;
}
/**
* @private
* @param {String|undefined} query
* @param {String|undefined|null} name name of the slot (if the parameter is undefined, all slots are searched, if the parameter has the value null, all slots without a name are searched. if a string is specified, the slots with this name are searched.)
* @return {*}
* @this CustomElement
* @license AGPLv3
* @since 1.23.0
* @throws {Error} query must be a string
*/
function getSlottedElements(query, name) {
const self = this;
const result = new Set();
if (!(self.shadowRoot instanceof ShadowRoot)) {
return result;
}
let selector = "slot";
if (name !== undefined) {
if (name === null) {
selector += ":not([name])";
} else {
selector += `[name=${validateString(name)}]`;
}
}
const slots = self.shadowRoot.querySelectorAll(selector);
for (const [, slot] of Object.entries(slots)) {
slot.assignedElements().forEach(function (node) {
if (!(node instanceof HTMLElement)) return;
if (isString(query)) {
node.querySelectorAll(query).forEach(function (n) {
result.add(n);
});
if (node.matches(query)) {
result.add(node);
}
} else if (query !== undefined) {
throw new Error("query must be a string");
} else {
result.add(node);
}
});
}
return result;
}
......@@ -142,7 +142,7 @@ function getMonsterVersion() {
}
/** don't touch, replaced by make with package.json version */
monsterVersion = new Version("3.31.1");
monsterVersion = new Version("3.32.0");
return monsterVersion;
}
{
"name": "monster",
"version": "3.31.1",
"version": "3.32.0",
"description": "monster",
"repository": {
"type": "git",
......
......@@ -2,7 +2,7 @@
import chai from "chai"
import {internalSymbol} from "../../../../application/source/constants.mjs";
import {ATTRIBUTE_OPTIONS, customElementUpdaterLinkSymbol} from "../../../../application/source/dom/constants.mjs";
import {ATTRIBUTE_OPTIONS} from "../../../../application/source/dom/constants.mjs";
import {getDocument} from "../../../../application/source/dom/util.mjs";
import {ProxyObserver} from "../../../../application/source/types/proxyobserver.mjs";
import {addObjectWithUpdaterToElement} from "../../../../application/source/dom/updater.mjs";
......@@ -32,42 +32,6 @@ describe('DOM', function () {
let CustomElement, registerCustomElement, TestComponent, document, TestComponent2,assignUpdaterToElement;
// This allows us to inspect the addEventListener calls
// let addEventListener = EventTarget.prototype.addEventListener;
// let removeEventListener = EventTarget.prototype.removeEventListener;
//
// before(function (done) {
// initJSDOM().then(() => {
//
// EventTarget.prototype.addEventListener = function (type, callback, options) {
// /* store args and then… */
// // callback = (e) => {
// // console.log("event fired" + e);
// // callback(e);
// // };
//
// addEventListener.call(this, type, callback, options);
// };
//
// EventTarget.prototype.removeEventListener = function (type, callback, options) {
// /* remove from stored args and then… */
// removeEventListener.call(this, type, callback, options);
// };
//
// done(e);
//
//
// });
//
//
// })
//
// after(function () {
// EventTarget.prototype.addEventListener = addEventListener;
// EventTarget.prototype.removeEventListener = removeEventListener;
// });
describe("assignUpdaterToElement", function () {
......
......@@ -3,24 +3,10 @@ import {
} from "../../../../application/source/dom/util.mjs";
import {expect} from 'chai';
import { JSDOM } from 'jsdom';
let originalEnvironment;
import {initJSDOM} from "../../util/jsdom.mjs";
function setupTestEnvironment() {
const { window } = new JSDOM('<!DOCTYPE html>', { pretendToBeVisual: true });
const { document, customElements, HTMLElement } = window;
originalEnvironment = {
document: globalThis.document,
customElements: globalThis.customElements,
HTMLElement: globalThis.HTMLElement,
ShadowRoot: globalThis.ShadowRoot,
};
globalThis.document = document;
globalThis.customElements = customElements;
globalThis.HTMLElement = HTMLElement;
globalThis.ShadowRoot = window.ShadowRoot || class ShadowRoot {}; // Fallback for JSDOM
class TestComponent extends HTMLElement {
constructor() {
......@@ -35,12 +21,16 @@ function setupTestEnvironment() {
}
function cleanupTestEnvironment() {
Object.assign(globalThis, originalEnvironment);
let mocks = document.getElementById('mocks');
mocks.innerHTML = "";
}
describe('findElementWithIdUpwards', () => {
before(() => {
before((done) => {
initJSDOM().then(() => {
setupTestEnvironment();
done()
});
});
after(() => {
......@@ -49,13 +39,14 @@ describe('findElementWithIdUpwards', () => {
beforeEach(() => {
// Set up the DOM
document.body.innerHTML = `
let mocks = document.getElementById('mocks');
mocks.innerHTML = `
<div id="container">
<div id="parent">
<div id="child"></div>
</div>
</div>
`;
</div>`;
const shadowHost = document.createElement('div');
document.body.appendChild(shadowHost);
......
import {expect} from 'chai';
import {getSlottedNodes} from "../../../../application/source/dom/slotted.mjs";
describe('getSlottedNodes', () => {
it('should return an empty Set if there is no ShadowRoot', () => {
expect(getSlottedNodes).is.a('function');
});
});
......@@ -7,7 +7,7 @@ describe('Monster', function () {
let monsterVersion
/** don´t touch, replaced by make with package.json version */
monsterVersion = new Version("3.31.1")
monsterVersion = new Version("3.32.0")
let m = getMonsterVersion();
......
......@@ -15,10 +15,10 @@
**********/
export function chaiDom(chai, utils) {
var flag = utils.flag,
let flag = utils.flag,
elToString = function(el) {
var desc
let desc
if (isNodeList(el)) {
if (el.length === 0) return 'empty NodeList'
desc = Array.prototype.slice.call(el, 0, 5).map(elToString).join(', ')
......
......@@ -6,6 +6,8 @@ import "../cases/logging/logentry.mjs";
import "../cases/logging/handler/console.mjs";
import "../cases/logging/handler.mjs";
import "../cases/text/formatter.mjs";
import "../cases/text/util.mjs";
import "../cases/dom/slotted-nodes.mjs";
import "../cases/dom/resource/link/stylesheet.mjs";
import "../cases/dom/resource/data.mjs";
import "../cases/dom/resource/link.mjs";
......@@ -17,6 +19,7 @@ import "../cases/dom/theme.mjs";
import "../cases/dom/resource.mjs";
import "../cases/dom/resourcemanager.mjs";
import "../cases/dom/util.mjs";
import "../cases/dom/find.mjs";
import "../cases/dom/customelement.mjs";
import "../cases/dom/attributes.mjs";
import "../cases/dom/events.mjs";
......@@ -40,6 +43,7 @@ import "../cases/types/randomid.mjs";
import "../cases/types/observablequeue.mjs";
import "../cases/types/uuid.mjs";
import "../cases/types/observer.mjs";
import "../cases/types/internal.mjs";
import "../cases/types/tokenlist.mjs";
import "../cases/types/queue.mjs";
import "../cases/types/stack.mjs";
......@@ -82,6 +86,7 @@ import "../cases/data/diff.mjs";
import "../cases/data/datasource/server.mjs";
import "../cases/data/datasource/storage/sessionstorage.mjs";
import "../cases/data/datasource/storage/localstorage.mjs";
import "../cases/data/datasource/dom.mjs";
import "../cases/data/datasource/server/restapi.mjs";
import "../cases/data/datasource/server/websocket.mjs";
import "../cases/math/random.mjs";
......@@ -5,17 +5,17 @@
<title>Mocha Monster</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="mocha.css"/>
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,Blob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.for,Symbol.hasInstance,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
<script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.forEach,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,Blob,CustomEvent,DataView,document,Document,DocumentFragment,Element,Event,fetch,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.includes,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.for,Symbol.hasInstance,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,DataView,document,DocumentFragment,Element,Event,globalThis,HTMLDocument,HTMLTemplateElement,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.getOwnPropertyDescriptor,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.endsWith,String.prototype.matchAll,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,WeakMap,WeakSet"
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/element-internals-polyfill@0.1.52/dist/index.min.mjs"></script>
<script src="https://cdn.jsdelivr.net/npm/element-internals-polyfill"></script>
</head>
<body>
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
<h1 style='margin-bottom: 0.1em;'>Monster 3.8.0</h1>
<div id="lastupdate" style='font-size:0.7em'>last update Do 2. Feb 11:38:37 CET 2023</div>
<h1 style='margin-bottom: 0.1em;'>Monster 3.32.0</h1>
<div id="lastupdate" style='font-size:0.7em'>last update So 26. Mär 17:02:25 CEST 2023</div>
</div>
<div id="mocks"></div>
<div id="mocha"></div>
......
This diff is collapsed.
{"version":"3.32.0"}
{"version":"3.33.0"}