|
@@ -77,7 +77,7 @@
|
|
|
if (el.tagName.toLowerCase() !== 'template') {
|
|
|
console.warn(`Alpine: [${directive}] directive should only be added to <template> tags. See https://github.com/alpinejs/alpine#${directive}`);
|
|
|
} else if (el.content.childElementCount !== 1) {
|
|
|
- console.warn(`Alpine: <template> tag with [${directive}] encountered with multiple element roots. Make sure <template> only has a single child element.`);
|
|
|
+ console.warn(`Alpine: <template> tag with [${directive}] encountered with an unexpected number of root elements. Make sure <template> has a single root element. `);
|
|
|
}
|
|
|
}
|
|
|
function kebabCase(subject) {
|
|
@@ -115,6 +115,10 @@
|
|
|
console.warn(`Alpine Error: "${error}"\n\nExpression: "${expression}"\nElement:`, el);
|
|
|
|
|
|
if (!isTesting()) {
|
|
|
+ Object.assign(error, {
|
|
|
+ el,
|
|
|
+ expression
|
|
|
+ });
|
|
|
throw error;
|
|
|
}
|
|
|
};
|
|
@@ -574,7 +578,7 @@
|
|
|
let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
|
let stripParensRE = /^\(|\)$/g;
|
|
|
let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
|
- let inMatch = expression.match(forAliasRE);
|
|
|
+ let inMatch = String(expression).match(forAliasRE);
|
|
|
if (!inMatch) return;
|
|
|
let res = {};
|
|
|
res.items = inMatch[2].trim();
|
|
@@ -671,7 +675,7 @@
|
|
|
if (attrName === 'value') {
|
|
|
if (Alpine.ignoreFocusedForValueBinding && document.activeElement.isSameNode(el)) return; // If nested model key is undefined, set the default value to empty string.
|
|
|
|
|
|
- if (value === undefined && expression.match(/\./)) {
|
|
|
+ if (value === undefined && String(expression).match(/\./)) {
|
|
|
value = '';
|
|
|
}
|
|
|
|
|
@@ -754,7 +758,7 @@
|
|
|
|
|
|
function handleTextDirective(el, output, expression) {
|
|
|
// If nested model key is undefined, set the default value to empty string.
|
|
|
- if (output === undefined && expression.match(/\./)) {
|
|
|
+ if (output === undefined && String(expression).match(/\./)) {
|
|
|
output = '';
|
|
|
}
|
|
|
|