From f6f946df9a7fb69ff266dc77e5cdaa9227a83e9b Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 21 Jun 2007 22:01:21 +0000 Subject: [PATCH] Upgrade to Prototype 1.5.1.1 (bugfix release). Props Nazgul. fixes #4502 git-svn-id: https://develop.svn.wordpress.org/trunk@5743 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/prototype.js | 22 ++++++++++++++-------- wp-includes/script-loader.php | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/wp-includes/js/prototype.js b/wp-includes/js/prototype.js index ba526b6ec0..a3f21ac790 100644 --- a/wp-includes/js/prototype.js +++ b/wp-includes/js/prototype.js @@ -1,4 +1,4 @@ -/* 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. @@ -7,7 +7,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.5.1', + Version: '1.5.1.1', Browser: { IE: !!(window.attachEvent && !window.opera), @@ -24,8 +24,8 @@ var Prototype = { document.createElement('form').__proto__) }, - ScriptFragment: ']*>([\\s\\S]*?)<\/script>', - JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/, + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, emptyFunction: function() { }, K: function(x) { return x } @@ -364,11 +364,15 @@ Object.extend(String.prototype, { 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()); }, @@ -1270,10 +1274,12 @@ if (Prototype.BrowserFeatures.XPath) { } 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; diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 4adb5427d1..2e107588d7 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -35,7 +35,7 @@ class WP_Scripts { $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070528' ); - $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1'); + $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1.1'); $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); $this->localize( 'autosave', 'autosaveL10n', array(