malinajs 0.7.18 → 0.7.20
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 +22 -20
- package/package.json +1 -1
- package/runtime.js +6 -3
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
|
});
|
|
@@ -5791,12 +5793,25 @@
|
|
|
5791
5793
|
};
|
|
5792
5794
|
} else {
|
|
5793
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
|
+
|
|
5794
5809
|
const parsed = this.parseText(prop.value);
|
|
5795
5810
|
this.detectDependency(parsed);
|
|
5796
|
-
let exp = parsed.result;
|
|
5811
|
+
let exp = (propList[name] || isExpression(prop.raw)) && parsed.binding ? parsed.binding : parsed.result;
|
|
5797
5812
|
let hasElement = prop.value.includes('$element');
|
|
5798
5813
|
|
|
5799
|
-
if(node.spreading) return node.spreading.push(`${name}: ${exp}`);
|
|
5814
|
+
if(node.spreading) return node.spreading.push(name == exp ? name : `${name}: ${exp}`);
|
|
5800
5815
|
|
|
5801
5816
|
if(node.name == 'option' && name == 'value' && parsed.binding) {
|
|
5802
5817
|
return {
|
|
@@ -5809,23 +5824,10 @@
|
|
|
5809
5824
|
}
|
|
5810
5825
|
}
|
|
5811
5826
|
|
|
5812
|
-
const propList = {
|
|
5813
|
-
hidden: true,
|
|
5814
|
-
checked: true,
|
|
5815
|
-
value: true,
|
|
5816
|
-
disabled: true,
|
|
5817
|
-
selected: true,
|
|
5818
|
-
innerHTML: true,
|
|
5819
|
-
innerText: true,
|
|
5820
|
-
multiple: node.name == 'select',
|
|
5821
|
-
src: true,
|
|
5822
|
-
readonly: 'readOnly'
|
|
5823
|
-
};
|
|
5824
|
-
|
|
5825
5827
|
let n = xNode('bindAttribute', {
|
|
5826
5828
|
$wait: ['apply'],
|
|
5827
5829
|
name,
|
|
5828
|
-
exp
|
|
5830
|
+
exp,
|
|
5829
5831
|
hasElement,
|
|
5830
5832
|
el: element.bindName()
|
|
5831
5833
|
}, (ctx, data) => {
|
|
@@ -6905,7 +6907,7 @@
|
|
|
6905
6907
|
});
|
|
6906
6908
|
}
|
|
6907
6909
|
|
|
6908
|
-
const version = '0.7.
|
|
6910
|
+
const version = '0.7.20';
|
|
6909
6911
|
|
|
6910
6912
|
|
|
6911
6913
|
async function compile(source, config = {}) {
|
package/package.json
CHANGED
package/runtime.js
CHANGED
|
@@ -270,9 +270,12 @@ function svgToFragment(content) {
|
|
|
270
270
|
let t = document.createElement('template');
|
|
271
271
|
t.innerHTML = '<svg>' + content + '</svg>';
|
|
272
272
|
|
|
273
|
-
let result =
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
let result, svg = t.content.firstChild;
|
|
274
|
+
if (svg.firstChild == svg.lastChild) result = svg.firstChild;
|
|
275
|
+
else {
|
|
276
|
+
result = document.createDocumentFragment();
|
|
277
|
+
while(svg.firstChild) result.appendChild(svg.firstChild);
|
|
278
|
+
}
|
|
276
279
|
templatecacheSvg[content] = result.cloneNode(true);
|
|
277
280
|
return result;
|
|
278
281
|
}
|