be-hive 0.0.97 → 0.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/be-hive.js +21 -10
- package/package.json +2 -2
package/be-hive.js
CHANGED
|
@@ -75,28 +75,39 @@ export class BeHive extends HTMLElement {
|
|
|
75
75
|
#inspectNewNode(node) {
|
|
76
76
|
if (!(node instanceof Element))
|
|
77
77
|
return;
|
|
78
|
+
const { beEnhanced } = node;
|
|
78
79
|
const { registeredBehaviors } = this;
|
|
79
80
|
for (const key in registeredBehaviors) {
|
|
80
81
|
const registeredBehavior = registeredBehaviors[key];
|
|
81
82
|
const { upgrade } = registeredBehavior;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
if (!node.matches(upgrade))
|
|
84
|
+
continue;
|
|
85
|
+
const namespacedName = beEnhanced.getFQName(key);
|
|
86
|
+
if (namespacedName === undefined)
|
|
87
|
+
continue;
|
|
88
|
+
beEnhanced.attachAttr(namespacedName, key);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
91
|
+
// #getPreciseMatch(key: string, node: Element, allowNonNamespaced = true){
|
|
92
|
+
// if(allowNonNamespaced && node.matches(`[${key}]`)) return key;
|
|
93
|
+
// let testKey = `enh-by-${key}`;
|
|
94
|
+
// let test = `[${testKey}]`;
|
|
95
|
+
// if(node.matches(test)) return testKey;
|
|
96
|
+
// testKey = `data-enh-by-${key}`;
|
|
97
|
+
// test = `[${testKey}]`;
|
|
98
|
+
// if(node.matches(test)) return testKey;
|
|
99
|
+
// return undefined;
|
|
100
|
+
// }
|
|
90
101
|
#scanForSingleRegisteredBehavior(localName, behaviorKeys) {
|
|
91
102
|
const { ifWantsToBe, upgrade } = behaviorKeys;
|
|
92
103
|
const attr = `${upgrade}[${localName}],${upgrade}[enh-by-${localName}],${upgrade}[data-enh-by-${localName}]`;
|
|
93
104
|
const rn = this.getRootNode();
|
|
94
105
|
rn.querySelectorAll(attr).forEach(el => {
|
|
95
|
-
if (el.localName.includes('-') && !el.matches(`[enh-by-${localName}],${upgrade}[data-enh-by-${localName}]`))
|
|
96
|
-
return;
|
|
97
106
|
const { beEnhanced } = el;
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
const namespacedName = beEnhanced.getFQName(localName);
|
|
108
|
+
if (namespacedName === undefined)
|
|
109
|
+
return;
|
|
110
|
+
beEnhanced.attachAttr(namespacedName, localName);
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
113
|
register(parentInstance) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "be-hive",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.98",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"web-components",
|
|
6
6
|
"web-component",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"serve": "node node_modules/may-it-serve/serve.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"be-enhanced": "0.0.
|
|
29
|
+
"be-enhanced": "0.0.24"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"may-it-serve": "0.0.5"
|