Anonymous avatar Anonymous committed ae2dc56

[svn] upgrade prototype to 1.5.1.1

Comments (0)

Files changed (2)

   including client-specific authorization tokens for preventing CSRF
   attacks. Original patch by David Turner. Fixes #157.
 * current_url now accepts arguments to pass along to url_for. Fixes #251.
-* Updated prototype to 1.5.1.
+* Updated prototype to 1.5.1.1.
 * Added image support to button_to. Patch by Alex Conrad. Fixes #184.
 * Fix radio_button and submit_to_remote not handling unicode values.
   Fixes #235.

webhelpers/rails/javascripts/prototype.js

-/*  Prototype JavaScript framework, version 1.5.1
+/*  Prototype JavaScript framework, version 1.5.1.1
  *  (c) 2005-2007 Sam Stephenson
  *
  *  Prototype is freely distributable under the terms of an MIT-style license.
 /*--------------------------------------------------------------------------*/
 
 var Prototype = {
-  Version: '1.5.1',
+  Version: '1.5.1.1',
 
   Browser: {
     IE:     !!(window.attachEvent && !window.opera),
        document.createElement('form').__proto__)
   },
 
-  ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
-  JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,
+  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
 
   emptyFunction: function() { },
   K: function(x) { return x }
     return this.sub(filter || Prototype.JSONFilter, '#{1}');
   },
 
+  isJSON: function() {
+    var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+  },
+
   evalJSON: function(sanitize) {
     var json = this.unfilterJSON();
     try {
-      if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)))
-        return eval('(' + json + ')');
+      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
     } catch (e) { }
     throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
   },
 
 } else document.getElementsByClassName = function(className, parentElement) {
   var children = ($(parentElement) || document.body).getElementsByTagName('*');
-  var elements = [], child;
+  var elements = [], child, pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
   for (var i = 0, length = children.length; i < length; i++) {
     child = children[i];
-    if (Element.hasClassName(child, className))
+    var elementClassName = child.className;
+    if (elementClassName.length == 0) continue;
+    if (elementClassName == className || elementClassName.match(pattern))
       elements.push(Element.extend(child));
   }
   return elements;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.