Browse Source

REFA,MINOR: movement of helper functions into helperFun object

master
chris 3 days ago
parent
commit
430411ff7f
  1. 4
      src/componentAncestry/wrapperComponent.js
  2. 2
      src/context/extStore.js
  3. 19
      src/context/generalHelpers.js

4
src/componentAncestry/wrapperComponent.js

@ -35,10 +35,10 @@ class ElementWrapper {
* @param {map<string,string>} attr Specific already known attributes * @param {map<string,string>} attr Specific already known attributes
*/ */
constructor(element, attr = {}) { constructor(element, attr = {}) {
fillAttrsInContainerByCb( helperFun.fillAttrsInContainerByCb(
attr, attr,
element, element,
function cb(k, v, con) { function (k, v, con) {
con.setAttribute(k, v); con.setAttribute(k, v);
} }
); );

2
src/context/extStore.js

@ -416,7 +416,7 @@ class ExtStorage {
case ESAggregation.INTERNALIZED: case ESAggregation.INTERNALIZED:
default: default:
return function (ssd, orgElement) { return function (ssd, orgElement) {
fillAttrsInContainerByCb( helperFun.fillAttrsInContainerByCb(
ssd._definition, ssd._definition,
orgElement, orgElement,
(key, val, el) => { el.style[key] = val; } (key, val, el) => { el.style[key] = val; }

19
src/context/generalHelpers.js

@ -62,7 +62,7 @@ class ObjectAccessObject {
/** /**
* @type {Map<string, Function>} *
*/ */
const helperFun = { const helperFun = {
/** /**
@ -83,6 +83,18 @@ const helperFun = {
return intoContainer; return intoContainer;
}, },
/**
*
* @param {HTMLElement} element
* @returns {string}
*/
getHigherCompSelector: function (element) {
let dac = "data-autocompel";
let hcompel = element.closest('[data-compel-ishcompel="true"]');
return `[${dac}="${hcompel.getAttribute(dac)}"]`;
},
/** /**
* *
* @param {string} selector * @param {string} selector
@ -131,7 +143,8 @@ const helperFun = {
}, },
/** /**
* @type {Map<string, Function>} * Contains helperFun functions from the installed/loaded extensions
* (jpclwe-<extension-name>)
*/ */
extensions: {} extensions: {}
} }

Loading…
Cancel
Save