Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

even more helpful LiveUI message on mismatched tags

  • Loading branch information...
commit 4cca9a8082c400ea0df5f9a2e802b4a1947491ce 1 parent edea43e
@dgreensp dgreensp authored
Showing with 16 additions and 1 deletion.
  1. +16 −1 packages/liveui/liveui.js
View
17 packages/liveui/liveui.js
@@ -82,8 +82,23 @@ Meteor.ui = Meteor.ui || {};
endNode === startNode.parentNode.nextSibling) {
endNode = startNode.parentNode.lastChild;
} else {
+ var r = new RegExp('<!--\\s*STARTRANGE_'+id+'.*?-->', 'g');
+ var match = r.exec(html);
+ var help = "";
+ if (match) {
+ var comment_end = r.lastIndex;
+ var comment_start = comment_end - match[0].length;
+ var stripped_before = html.slice(0, comment_start).replace(
+ /<!--\s*(START|END)RANGE.*?-->/g, '');
+ var stripped_after = html.slice(comment_end).replace(
+ /<!--\s*(START|END)RANGE.*?-->/g, '');
+ var context_amount = 50;
+ var context = stripped_before.slice(-context_amount) +
+ stripped_after.slice(0, context_amount);
+ help = " (possible unclosed near: "+context+")";
+ }
throw new Error("Could not create liverange in template. "+
- "Check for unclosed tags in your HTML.");
+ "Check for unclosed tags in your HTML."+help);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.