404 - Page Not Found

The page that you are looking for could not be found. I recently switched to a new content management platform so some of the old links no longer work. Below are the search results based on the link that you clicked on.

Syntax error in prototype when using evalScripts?

Here is a very technical entry. Are you getting syntax error when using prototype with IE to load HTML? In prototype 1.6.0.3 the error happens on line 604.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
var Enumerable = {
  each: function(iterator, context) {
    var index = 0;
    try {
      this._each(function(value) {
        iterator.call(context, value, index++);
      });
    } catch (e) {         /////// <---- IE complains of syntax error on this line
      if (e != $break) throw e;
    }
    return this;
  },

The error is misleading and it took me a little time to figure this one out. Basically, this happens when you load HTML from server using AJAX and have prototype evalScripts, and the content being loaded has javascript encapsulated in an HTML comment.

1
2
3
4
5
<script type="text/javascript">
<!--
alert("The comment tags are the problem.");
// -->
</script>

Removing the HTML comment tags should resolve this syntax error. You can read more in this ticket.