diff options
| author | Christian Fowler <spider@viovio.com> | 2007-06-27 04:55:10 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2007-06-27 04:55:10 +0000 |
| commit | 0b39813200328ec7e65ca0a0d450b05e84016322 (patch) | |
| tree | 86025c45ccfabef181ed9304bab8cc8b7383db54 /javascript/libs | |
| parent | 0a5be30e8f96f2771a94c872ec7a0b98286483c1 (diff) | |
| download | util-0b39813200328ec7e65ca0a0d450b05e84016322.tar.gz util-0b39813200328ec7e65ca0a0d450b05e84016322.tar.bz2 util-0b39813200328ec7e65ca0a0d450b05e84016322.zip | |
update to 1.5.1.1
Diffstat (limited to 'javascript/libs')
| -rw-r--r-- | javascript/libs/prototype.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/javascript/libs/prototype.js b/javascript/libs/prototype.js index 842385a..a3f21ac 100644 --- a/javascript/libs/prototype.js +++ b/javascript/libs/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: '<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 } @@ -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; @@ -3268,4 +3274,4 @@ if (Prototype.Browser.WebKit) { } } -Element.addMethods(); +Element.addMethods();
\ No newline at end of file |
