malinajs 0.7.17 → 0.7.19
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/malina.js +25 -22
- package/package.json +1 -1
package/malina.js
CHANGED
|
@@ -3100,7 +3100,7 @@
|
|
|
3100
3100
|
function(id, context) {
|
|
3101
3101
|
var node = context, nodes = [ ], next = node.firstElementChild;
|
|
3102
3102
|
while ((node = next)) {
|
|
3103
|
-
node.id == id && (nodes[nodes.length] = node);
|
|
3103
|
+
(node.id == id || node.dynId) && (nodes[nodes.length] = node);
|
|
3104
3104
|
if ((next = node.firstElementChild || node.nextElementSibling)) continue;
|
|
3105
3105
|
while (!next && (node = node.parentElement) && node !== context) {
|
|
3106
3106
|
next = node.nextElementSibling;
|
|
@@ -4905,8 +4905,10 @@
|
|
|
4905
4905
|
else n.className += ' ' + a.value;
|
|
4906
4906
|
}
|
|
4907
4907
|
n.attributes[a.name] = a.value;
|
|
4908
|
-
} else if(a.name == 'id')
|
|
4909
|
-
|
|
4908
|
+
} else if(a.name == 'id') {
|
|
4909
|
+
if (a.value?.includes('{')) n.dynId = true;
|
|
4910
|
+
n.attributes.id = n.id = a.value;
|
|
4911
|
+
} else if(a.name.startsWith('class:')) {
|
|
4910
4912
|
n.className += ' ' + a.name.substring(6);
|
|
4911
4913
|
} else n.attributes[a.name] = a.value;
|
|
4912
4914
|
});
|
|
@@ -5211,17 +5213,18 @@
|
|
|
5211
5213
|
return;
|
|
5212
5214
|
} else if(this.config.passClass && (name == 'class' || name.startsWith('class:'))) {
|
|
5213
5215
|
let metaClass, args = name.split(':');
|
|
5214
|
-
if(args.length == 1) {
|
|
5216
|
+
if (args.length == 1) {
|
|
5215
5217
|
metaClass = '$$main';
|
|
5216
5218
|
} else {
|
|
5217
5219
|
assert(args.length == 2);
|
|
5218
5220
|
metaClass = args[1];
|
|
5219
5221
|
assert(metaClass);
|
|
5222
|
+
if (!value) value = metaClass;
|
|
5220
5223
|
}
|
|
5221
5224
|
assert(value);
|
|
5222
5225
|
this.css.passingClass = true;
|
|
5223
5226
|
|
|
5224
|
-
const parsed = this.parseText(
|
|
5227
|
+
const parsed = this.parseText(value);
|
|
5225
5228
|
this.detectDependency(parsed);
|
|
5226
5229
|
let exp = parsed.result;
|
|
5227
5230
|
$class.push(`${metaClass}: $$resolveClass(${exp})`);
|
|
@@ -5790,12 +5793,25 @@
|
|
|
5790
5793
|
};
|
|
5791
5794
|
} else {
|
|
5792
5795
|
if(prop.value && prop.value.indexOf('{') >= 0) {
|
|
5796
|
+
const propList = {
|
|
5797
|
+
hidden: true,
|
|
5798
|
+
checked: true,
|
|
5799
|
+
value: true,
|
|
5800
|
+
disabled: true,
|
|
5801
|
+
selected: true,
|
|
5802
|
+
innerHTML: true,
|
|
5803
|
+
innerText: true,
|
|
5804
|
+
multiple: node.name == 'select',
|
|
5805
|
+
src: true,
|
|
5806
|
+
readonly: 'readOnly'
|
|
5807
|
+
};
|
|
5808
|
+
|
|
5793
5809
|
const parsed = this.parseText(prop.value);
|
|
5794
5810
|
this.detectDependency(parsed);
|
|
5795
|
-
let exp = parsed.result;
|
|
5811
|
+
let exp = (propList[name] || isExpression(prop.raw)) && parsed.binding ? parsed.binding : parsed.result;
|
|
5796
5812
|
let hasElement = prop.value.includes('$element');
|
|
5797
5813
|
|
|
5798
|
-
if(node.spreading) return node.spreading.push(`${name}: ${exp}`);
|
|
5814
|
+
if(node.spreading) return node.spreading.push(name == exp ? name : `${name}: ${exp}`);
|
|
5799
5815
|
|
|
5800
5816
|
if(node.name == 'option' && name == 'value' && parsed.binding) {
|
|
5801
5817
|
return {
|
|
@@ -5808,23 +5824,10 @@
|
|
|
5808
5824
|
}
|
|
5809
5825
|
}
|
|
5810
5826
|
|
|
5811
|
-
const propList = {
|
|
5812
|
-
hidden: true,
|
|
5813
|
-
checked: true,
|
|
5814
|
-
value: true,
|
|
5815
|
-
disabled: true,
|
|
5816
|
-
selected: true,
|
|
5817
|
-
innerHTML: true,
|
|
5818
|
-
innerText: true,
|
|
5819
|
-
multiple: node.name == 'select',
|
|
5820
|
-
src: true,
|
|
5821
|
-
readonly: 'readOnly'
|
|
5822
|
-
};
|
|
5823
|
-
|
|
5824
5827
|
let n = xNode('bindAttribute', {
|
|
5825
5828
|
$wait: ['apply'],
|
|
5826
5829
|
name,
|
|
5827
|
-
exp
|
|
5830
|
+
exp,
|
|
5828
5831
|
hasElement,
|
|
5829
5832
|
el: element.bindName()
|
|
5830
5833
|
}, (ctx, data) => {
|
|
@@ -6904,7 +6907,7 @@
|
|
|
6904
6907
|
});
|
|
6905
6908
|
}
|
|
6906
6909
|
|
|
6907
|
-
const version = '0.7.
|
|
6910
|
+
const version = '0.7.19';
|
|
6908
6911
|
|
|
6909
6912
|
|
|
6910
6913
|
async function compile(source, config = {}) {
|